48 std::vector<G4VUserParallelWorld*>::iterator pwItr;
49 for(pwItr = parallelWorld.begin(); pwItr != parallelWorld.end(); pwItr++)
51 if((*pwItr)->GetName() == aPW->
GetName())
55 eM +=
"> is already registered to the user detector construction.";
56 G4Exception(
"G4VUserDetectorConstruction::RegisterParallelWorld",
60 parallelWorld.push_back(aPW);
66 std::vector<G4VUserParallelWorld*>::iterator pwItr;
67 for(pwItr = parallelWorld.begin(); pwItr != parallelWorld.end(); pwItr++)
69 (*pwItr)->Construct();
77 std::vector<G4VUserParallelWorld*>::iterator pwItr;
78 for(pwItr = parallelWorld.begin(); pwItr != parallelWorld.end(); pwItr++)
80 (*pwItr)->ConstructSD();
86 return parallelWorld.size();
94 return parallelWorld[i];
117 typedef std::map<G4FieldManager*, G4FieldManager*> FMtoFMmap;
118 typedef std::pair<G4FieldManager*, G4FieldManager*> FMpair;
119 FMtoFMmap masterToWorker;
121 assert(logVolStore != NULL);
122 for(G4LogicalVolumeStore::const_iterator it = logVolStore->begin();
123 it != logVolStore->end(); ++it)
131 FMtoFMmap::iterator fmFound = masterToWorker.find(masterFM);
132 if(fmFound == masterToWorker.end())
137 std::pair<FMtoFMmap::iterator, bool> insertedEl =
138 masterToWorker.insert(FMpair(masterFM, masterFM->
Clone()));
139 clonedFM = (insertedEl.first)->second;
143 msg <<
"Cloning of G4FieldManager failed."
144 <<
" But derived class does not implement cloning. Cannot "
146 G4Exception(
"G4VUserDetectorConstruction::CloneSD",
"Run0053",
154 clonedFM = (*fmFound).second;
170 assert(logVolStore != NULL);
172 typedef std::map<G4VSensitiveDetector*, G4VSensitiveDetector*> SDtoSDmap;
173 typedef std::pair<G4VSensitiveDetector*, G4VSensitiveDetector*> SDpair;
174 SDtoSDmap masterToWorker;
176 for(G4LogicalVolumeStore::const_iterator it = logVolStore->begin();
177 it != logVolStore->end(); ++it)
185 SDtoSDmap::iterator sdFound = masterToWorker.find(masterSD);
186 if(sdFound == masterToWorker.end())
191 std::pair<SDtoSDmap::iterator, bool> insertedEl =
192 masterToWorker.insert(SDpair(masterSD, masterSD->
Clone()));
193 clonedSD = (insertedEl.first)->second;
197 msg <<
"Cloning of G4VSensitiveDetector requested for:"
202 <<
" But derived class does not implement cloning. Cannot "
204 G4Exception(
"G4VUserDetectorConstruction::CloneSD",
"Run0053",
212 clonedSD = (*sdFound).second;
224 for(G4LogicalVolumeStore::iterator pos = store->begin(); pos != store->end();
227 if((*pos)->GetName() == logVolName)
231 G4String eM =
"More than one logical volumes of the name <";
232 eM += (*pos)->GetName();
233 eM +=
"> are found and thus the sensitive detector <";
235 eM +=
"> cannot be uniquely assigned.";
236 G4Exception(
"G4VUserDetectorConstruction::SetSensitiveDetector",
245 G4String eM2 =
"No logical volume of the name <";
247 eM2 +=
"> is found. The specified sensitive detector <";
249 eM2 +=
"> couldn't be assigned to any volume.";
250 G4Exception(
"G4VUserDetectorConstruction::SetSensitiveDetector",
"Run0053",
258 assert(logVol !=
nullptr && aSD !=
nullptr);
268 if(originalSD == aSD)
271 msg <<
"Attempting to add multiple times the same sensitive detector (\"";
272 msg << originalSD->
GetName() <<
"\") is not allowed, skipping.";
273 G4Exception(
"G4VUserDetectorConstruction::SetSensitiveDetector",
"Run0054",
277 if(originalSD ==
nullptr)
291 std::ostringstream mn;
292 mn <<
"/MultiSD_" << logVol->
GetName() <<
"_" << logVol;
297 msd->
AddSD(originalSD);
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
virtual G4FieldManager * Clone() const
static G4LogicalVolumeStore * GetInstance()
void SetFieldManager(G4FieldManager *pFieldMgr, G4bool forceToAllDaughters)
G4VSensitiveDetector * GetSensitiveDetector() const
const G4String & GetName() const
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
void AddSD(G4VSensitiveDetector *sd)
static G4SDManager * GetSDMpointer()
void AddNewDetector(G4VSensitiveDetector *aSD)
virtual G4VSensitiveDetector * Clone() const
G4String GetFullPathName() const
G4int GetNumberOfParallelWorld() const
G4VUserParallelWorld * GetParallelWorld(G4int i) const
void RegisterParallelWorld(G4VUserParallelWorld *)
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
virtual void ConstructSDandField()
virtual ~G4VUserDetectorConstruction()
G4int ConstructParallelGeometries()
void ConstructParallelSD()
G4VUserDetectorConstruction()