38 G4int i = dirName.length();
50 size_t nTree = structure.size();
51 for(
size_t iTree=0;iTree<nTree;iTree++)
52 {
delete structure[iTree]; }
53 size_t nDet = detector.size();
54 for(
size_t iDet=0;iDet<nDet;iDet++)
55 {
delete detector[iDet]; }
60 return (
this==&right);
66 G4String remainingPath = treeStructure;
67 remainingPath.
remove(0,pathName.length());
68 if( ! remainingPath.
isNull() )
71 G4String subD = ExtractDirName( remainingPath );
77 structure.push_back( tgtSDS );
85 { detector.push_back( aSD ); }
86 else if( tgtSD != aSD )
90 ed << aSD->
GetName() <<
" had already been stored in "
91 << pathName <<
". Object pointer is overwitten.\n";
92 ed <<
"It's users' responsibility to delete the old sensitive detector object.";
96 detector.push_back( aSD );
103 for(
size_t i=0; i<structure.size(); i++ )
105 if( subD == structure[i]->dirName )
return structure[i];
112 for(
size_t i=0; i<detector.size(); i++ )
115 if( aSDName == tgtSD->
GetName() )
return tgtSD;
122 std::vector<G4VSensitiveDetector*>::iterator itr = detector.begin();
123 for(;itr!=detector.end();itr++)
136 if( i !=
G4int(std::string::npos) ) subD.
remove(i+1);
143 aPath.
remove(0,pathName.length());
144 if( aPath.
first(
'/') !=
G4int(std::string::npos) )
146 G4String subD = ExtractDirName(aPath);
150 G4cout << subD <<
" is not found in " << pathName <<
G4endl;
154 tgtSDS->
Activate(aName,sensitiveFlag);
159 for(
size_t i=0; i<detector.size(); i++)
161 detector[i]->Activate(sensitiveFlag);
163 for(
size_t j=0;j<structure.size(); j++)
165 structure[j]->Activate(
G4String(
"/"),sensitiveFlag);
173 G4cout << aPath <<
" is not found in " << pathName <<
G4endl;
185 aPath.
remove(0,pathName.length());
186 if( aPath.
first(
'/') !=
G4int(std::string::npos) )
188 G4String subD = ExtractDirName(aPath);
193 G4cout << subD <<
" is not found in " << pathName <<
G4endl;
207 G4cout << aPath <<
" is not found in " << pathName <<
G4endl;
217 for( i=0; i<structure.size(); i++ )
219 structure[i]->Initialize(HCE);
222 for( i=0; i<detector.size(); i++ )
224 if(detector[i]->isActive()) detector[i]->
Initialize(HCE);
232 for( i=0; i<structure.size(); i++ )
234 structure[i]->Terminate(HCE);
237 for( i=0; i<detector.size(); i++ )
239 if(detector[i]->isActive()) detector[i]->EndOfEvent(HCE);
246 for(
size_t i=0; i<detector.size(); i++)
251 {
G4cout <<
" *** Active "; }
253 {
G4cout <<
" XXX Inactive "; }
256 for(
size_t j=0; j<structure.size(); j++)
257 { structure[j]->ListTree(); }
void AddNewDetector(G4VSensitiveDetector *aSD, G4String treeStructure)
void Activate(G4bool activeFlag)
std::ostringstream G4ExceptionDescription
G4String & remove(str_size)
void Initialize(G4HCofThisEvent *HCE)
void Activate(G4String aName, G4bool sensitiveFlag)
G4String & prepend(const char *)
G4GLOB_DLL std::ostream G4cout
void Terminate(G4HCofThisEvent *HCE)
G4int operator==(const G4SDStructure &right) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4VSensitiveDetector * GetSD(G4String aName)
G4SDStructure(G4String aPath)
G4VSensitiveDetector * FindSensitiveDetector(G4String aName, G4bool warning=true)