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++)
79 { (*pwItr)->ConstructSD(); }
83 {
return parallelWorld.size(); }
88 return parallelWorld[i];
109 typedef std::map<G4FieldManager*,G4FieldManager*> FMtoFMmap;
110 typedef std::pair<G4FieldManager*,G4FieldManager*> FMpair;
111 FMtoFMmap masterToWorker;
113 assert( logVolStore != NULL );
114 for ( G4LogicalVolumeStore::const_iterator it = logVolStore->begin() ; it != logVolStore->end() ; ++it )
122 FMtoFMmap::iterator fmFound = masterToWorker.find(masterFM);
123 if ( fmFound == masterToWorker.end() )
127 std::pair<FMtoFMmap::iterator,bool> insertedEl = masterToWorker.insert( FMpair(masterFM, masterFM->
Clone()) );
128 clonedFM = (insertedEl.first)->
second;
133 msg <<
"Cloning of G4FieldManager failed."
134 <<
" But derived class does not implement cloning. Cannot continue.";
142 clonedFM = (*fmFound).second;
157 assert( logVolStore != NULL );
159 typedef std::map<G4VSensitiveDetector*,G4VSensitiveDetector*> SDtoSDmap;
160 typedef std::pair<G4VSensitiveDetector*,G4VSensitiveDetector*> SDpair;
161 SDtoSDmap masterToWorker;
163 for ( G4LogicalVolumeStore::const_iterator it = logVolStore->begin() ; it != logVolStore->end() ; ++it )
171 SDtoSDmap::iterator sdFound = masterToWorker.find(masterSD);
172 if ( sdFound == masterToWorker.end() )
176 std::pair<SDtoSDmap::iterator,bool> insertedEl = masterToWorker.insert( SDpair(masterSD,masterSD->
Clone()) );
177 clonedSD = (insertedEl.first)->
second;
182 msg <<
"Cloning of G4VSensitiveDetector requested for:" << masterSD->
GetName() <<
"\n"
186 <<
" But derived class does not implement cloning. Cannot continue.";
194 clonedSD = (*sdFound).second;
208 for(G4LogicalVolumeStore::iterator pos=store->begin(); pos!=store->end(); pos++)
210 if((*pos)->GetName()==logVolName)
214 G4String eM =
"More than one logical volumes of the name <";
215 eM += (*pos)->GetName();
216 eM +=
"> are found and thus the sensitive detector <";
218 eM +=
"> cannot be uniquely assigned.";
219 G4Exception(
"G4VUserDetectorConstruction::SetSensitiveDetector",
223 SetSensitiveDetector(*pos,aSD);
228 G4String eM2 =
"No logical volume of the name <";
230 eM2 +=
"> is found. The specified sensitive detector <";
232 eM2 +=
"> couldn't be assigned to any volume.";
233 G4Exception(
"G4VUserDetectorConstruction::SetSensitiveDetector",
virtual G4FieldManager * Clone() const
std::ostringstream G4ExceptionDescription
void ConstructParallelSD()
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
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)