Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ScoringRealWorld.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26#include "G4ScoringRealWorld.hh"
27
28#include "G4LogicalVolume.hh"
30#include "G4VPhysicalVolume.hh"
32#include "G4Region.hh"
33
35#include "G4SDParticleFilter.hh"
36#include "G4VPrimitiveScorer.hh"
37
38#include "G4ScoringManager.hh"
39#include "G4StatDouble.hh"
40
41#include "G4SystemOfUnits.hh"
42
44 :G4VScoringMesh(lvName)
45{
47 logVolName = lvName;
48 G4double size[] = {0.,0.,0.};
49 SetSize(size);
50 G4int nBin[] = {1,1,1};
52}
53
55{
56}
57
59{
60 G4cout << "G4ScoringRealWorld : " << logVolName << G4endl;
62}
63
64#include "G4AutoLock.hh"
65namespace { G4Mutex logvolmutex = G4MUTEX_INITIALIZER; }
67{
68 G4AutoLock l(&logvolmutex);
70 auto itr = store->begin();
71 for(;itr!=store->end();itr++)
72 {
73 if((*itr)->GetName()==logVolName)
74 {
75 fMeshElementLogical = (*itr); // Logical volume to score
76 G4int nb = 0;
78 auto pvItr = pvStore->begin();
79 for(;pvItr!=pvStore->end();pvItr++)
80 {
81 if((*pvItr)->GetLogicalVolume()==(*itr))
82 { nb += (*pvItr)->GetMultiplicity(); }
83 }
84 G4int nBin[] = {nb,1,1};
86 // check if this logical volume belongs to the real world
87 auto region = (*itr)->GetRegion();
88 if(region && !(region->IsInMassGeometry()))
89 {
91 ed << "Logical Volume with name <" << logVolName << "> is not used in the mass world.";
92 G4Exception("G4ScoringRealWorld","SWV0001",FatalException,ed);
93 }
94 // set the sensitive detector
96 return;
97 }
98 }
100 ed << "Logical Volume with name <" << logVolName << "> is not found";
101 G4Exception("G4ScoringRealWorld","SWV0000",FatalException,ed);
102}
103
104
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
#define G4MUTEX_INITIALIZER
Definition: G4Threading.hh:85
std::mutex G4Mutex
Definition: G4Threading.hh:81
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static G4LogicalVolumeStore * GetInstance()
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
static G4PhysicalVolumeStore * GetInstance()
virtual void List() const
virtual void SetupGeometry(G4VPhysicalVolume *)
G4ScoringRealWorld(G4String lvName)
virtual void List() const
G4MultiFunctionalDetector * fMFD
G4LogicalVolume * fMeshElementLogical
void SetNumberOfSegments(G4int nSegment[3])
void SetSize(G4double size[3])