50 std::vector<G4VUserParallelWorld*>::iterator pwItr;
53 if((*pwItr)->GetName()==aPW->
GetName())
57 eM +=
"> is already registered to the user detector construction.";
58 G4Exception(
"G4VUserDetectorConstruction::RegisterParallelWorld",
68 std::vector<G4VUserParallelWorld*>::iterator pwItr;
71 (*pwItr)->Construct();
79 std::vector<G4VUserParallelWorld*>::iterator pwItr;
81 { (*pwItr)->ConstructSD(); }
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 == aSD ) {
255 msg <<
"Attempting to add multiple times the same sensitive detector (\"";
256 msg << originalSD->
GetName()<<
"\") is not allowed, skipping.";
257 G4Exception(
"G4VUserDetectorConstruction::SetSensitiveDetector",
262 if ( originalSD ==
nullptr ) {
266 if ( msd !=
nullptr ) {
269 std::ostringstream mn;
270 mn<<
"/MultiSD_"<<logVol->
GetName()<<
"_"<<logVol;
275 msd->
AddSD(originalSD);
G4String GetFullPathName() const
G4VUserParallelWorld * GetParallelWorld(G4int i) const
std::ostringstream G4ExceptionDescription
virtual ~G4VUserDetectorConstruction()
static const G4double pos
G4VSensitiveDetector * GetSensitiveDetector() const
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
void AddNewDetector(G4VSensitiveDetector *aSD)
void SetFieldManager(G4FieldManager *pFieldMgr, G4bool forceToAllDaughters)
G4int GetNumberOfParallelWorld() const
G4int ConstructParallelGeometries()
static constexpr double second
void AddSD(G4VSensitiveDetector *sd)
void ConstructParallelSD()
virtual G4FieldManager * Clone() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
static G4SDManager * GetSDMpointer()
std::vector< G4VUserParallelWorld * > parallelWorld
virtual void ConstructSDandField()
void RegisterParallelWorld(G4VUserParallelWorld *)
static G4LogicalVolumeStore * GetInstance()
const G4String & GetName() const
virtual G4VSensitiveDetector * Clone() const
G4VUserDetectorConstruction()
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)