50 std::vector<G4VUserParallelWorld*>::iterator pwItr;
51 for(pwItr=parallelWorld.begin();pwItr!=parallelWorld.end();pwItr++)
53 if((*pwItr)->GetName()==aPW->
GetName())
57 eM +=
"> is already registered to the user detector construction.";
58 G4Exception(
"G4VUserDetectorConstruction::RegisterParallelWorld",
62 parallelWorld.push_back(aPW);
68 std::vector<G4VUserParallelWorld*>::iterator pwItr;
69 for(pwItr=parallelWorld.begin();pwItr!=parallelWorld.end();pwItr++)
71 (*pwItr)->Construct();
79 std::vector<G4VUserParallelWorld*>::iterator pwItr;
80 for(pwItr=parallelWorld.begin();pwItr!=parallelWorld.end();pwItr++)
81 { (*pwItr)->ConstructSD(); }
85 {
return parallelWorld.size(); }
90 return parallelWorld[i];
111 typedef std::map<G4FieldManager*,G4FieldManager*> FMtoFMmap;
112 typedef std::pair<G4FieldManager*,G4FieldManager*> FMpair;
113 FMtoFMmap masterToWorker;
115 assert( logVolStore != NULL );
116 for ( G4LogicalVolumeStore::const_iterator it = logVolStore->begin() ; it != logVolStore->end() ; ++it )
124 FMtoFMmap::iterator fmFound = masterToWorker.find(masterFM);
125 if ( fmFound == masterToWorker.end() )
129 std::pair<FMtoFMmap::iterator,bool> insertedEl = masterToWorker.insert( FMpair(masterFM, masterFM->
Clone()) );
130 clonedFM = (insertedEl.first)->
second;
135 msg <<
"Cloning of G4FieldManager failed."
136 <<
" But derived class does not implement cloning. Cannot continue.";
144 clonedFM = (*fmFound).second;
159 assert( logVolStore != NULL );
161 typedef std::map<G4VSensitiveDetector*,G4VSensitiveDetector*> SDtoSDmap;
162 typedef std::pair<G4VSensitiveDetector*,G4VSensitiveDetector*> SDpair;
163 SDtoSDmap masterToWorker;
165 for ( G4LogicalVolumeStore::const_iterator it = logVolStore->begin() ; it != logVolStore->end() ; ++it )
173 SDtoSDmap::iterator sdFound = masterToWorker.find(masterSD);
174 if ( sdFound == masterToWorker.end() )
178 std::pair<SDtoSDmap::iterator,bool> insertedEl = masterToWorker.insert( SDpair(masterSD,masterSD->
Clone()) );
179 clonedSD = (insertedEl.first)->
second;
184 msg <<
"Cloning of G4VSensitiveDetector requested for:" << masterSD->
GetName() <<
"\n"
188 <<
" But derived class does not implement cloning. Cannot continue.";
196 clonedSD = (*sdFound).second;
210 for(G4LogicalVolumeStore::iterator
pos=store->begin();
pos!=store->end();
pos++)
212 if((*pos)->GetName()==logVolName)
216 G4String eM =
"More than one logical volumes of the name <";
217 eM += (*pos)->GetName();
218 eM +=
"> are found and thus the sensitive detector <";
220 eM +=
"> cannot be uniquely assigned.";
221 G4Exception(
"G4VUserDetectorConstruction::SetSensitiveDetector",
225 SetSensitiveDetector(*
pos,aSD);
230 G4String eM2 =
"No logical volume of the name <";
232 eM2 +=
"> is found. The specified sensitive detector <";
234 eM2 +=
"> couldn't be assigned to any volume.";
235 G4Exception(
"G4VUserDetectorConstruction::SetSensitiveDetector",
243 assert(logVol!=
nullptr&&aSD!=
nullptr);
253 if ( originalSD ==
nullptr ) {
257 if ( msd !=
nullptr ) {
260 std::ostringstream mn;
261 mn<<
"/MultiSD_"<<logVol->
GetName()<<
"_"<<logVol;
266 msd->
AddSD(originalSD);
virtual G4FieldManager * Clone() const
std::ostringstream G4ExceptionDescription
void ConstructParallelSD()
static constexpr double second
void AddSD(G4VSensitiveDetector *sd)
void SetFieldManager(G4FieldManager *pFieldMgr, G4bool forceToAllDaughters)
void RegisterParallelWorld(G4VUserParallelWorld *)
virtual G4VSensitiveDetector * Clone() const
static G4LogicalVolumeStore * GetInstance()
G4VUserParallelWorld * GetParallelWorld(G4int i) const
G4String GetFullPathName() const
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4int ConstructParallelGeometries()
void AddNewDetector(G4VSensitiveDetector *aSD)
virtual void ConstructSDandField()
static G4SDManager * GetSDMpointer()
virtual ~G4VUserDetectorConstruction()
G4VUserDetectorConstruction()
G4int GetNumberOfParallelWorld() const
const G4String & GetName() const
G4VSensitiveDetector * GetSensitiveDetector() const
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
static const G4double pos