49 std::vector<G4VUserParallelWorld*>::iterator pwItr;
52 if((*pwItr)->GetName()==aPW->
GetName())
56 eM +=
"> is already registered to the user detector construction.";
57 G4Exception(
"G4VUserDetectorConstruction::RegisterParallelWorld",
67 std::vector<G4VUserParallelWorld*>::iterator pwItr;
70 (*pwItr)->Construct();
78 std::vector<G4VUserParallelWorld*>::iterator pwItr;
80 { (*pwItr)->ConstructSD(); }
110 typedef std::map<G4FieldManager*,G4FieldManager*> FMtoFMmap;
111 typedef std::pair<G4FieldManager*,G4FieldManager*> FMpair;
112 FMtoFMmap masterToWorker;
114 assert( logVolStore != NULL );
115 for ( G4LogicalVolumeStore::const_iterator
it = logVolStore->begin() ;
it != logVolStore->end() ; ++
it )
123 FMtoFMmap::iterator fmFound = masterToWorker.find(masterFM);
124 if ( fmFound == masterToWorker.end() )
128 std::pair<FMtoFMmap::iterator,bool> insertedEl = masterToWorker.insert( FMpair(masterFM, masterFM->
Clone()) );
129 clonedFM = (insertedEl.first)->
second;
134 msg <<
"Cloning of G4FieldManager failed."
135 <<
" But derived class does not implement cloning. Cannot continue.";
143 clonedFM = (*fmFound).second;
158 assert( logVolStore != NULL );
160 typedef std::map<G4VSensitiveDetector*,G4VSensitiveDetector*> SDtoSDmap;
161 typedef std::pair<G4VSensitiveDetector*,G4VSensitiveDetector*> SDpair;
162 SDtoSDmap masterToWorker;
164 for ( G4LogicalVolumeStore::const_iterator
it = logVolStore->begin() ;
it != logVolStore->end() ; ++
it )
172 SDtoSDmap::iterator sdFound = masterToWorker.find(masterSD);
173 if ( sdFound == masterToWorker.end() )
177 std::pair<SDtoSDmap::iterator,bool> insertedEl = masterToWorker.insert( SDpair(masterSD,masterSD->
Clone()) );
178 clonedSD = (insertedEl.first)->
second;
183 msg <<
"Cloning of G4VSensitiveDetector requested for:" << masterSD->
GetName() <<
"\n"
187 <<
" But derived class does not implement cloning. Cannot continue.";
195 clonedSD = (*sdFound).second;
209 for(G4LogicalVolumeStore::iterator
pos=store->begin();
pos!=store->end();
pos++)
211 if((*pos)->GetName()==logVolName)
215 G4String eM =
"More than one logical volumes of the name <";
216 eM += (*pos)->GetName();
217 eM +=
"> are found and thus the sensitive detector <";
219 eM +=
"> cannot be uniquely assigned.";
220 G4Exception(
"G4VUserDetectorConstruction::SetSensitiveDetector",
224 SetSensitiveDetector(*
pos,aSD);
229 G4String eM2 =
"No logical volume of the name <";
231 eM2 +=
"> is found. The specified sensitive detector <";
233 eM2 +=
"> couldn't be assigned to any volume.";
234 G4Exception(
"G4VUserDetectorConstruction::SetSensitiveDetector",
242 assert(logVol!=
nullptr&&aSD!=
nullptr);
252 if ( originalSD == aSD ) {
254 msg <<
"Attempting to add multiple times the same sensitive detector (\"";
255 msg << originalSD->
GetName()<<
"\") is not allowed, skipping.";
256 G4Exception(
"G4VUserDetectorConstruction::SetSensitiveDetector",
261 if ( originalSD ==
nullptr ) {
265 if ( msd !=
nullptr ) {
268 std::ostringstream mn;
269 mn<<
"/MultiSD_"<<logVol->
GetName()<<
"_"<<logVol;
274 msd->
AddSD(originalSD);