38 G4int i = dirName.length();
50 for(
auto st : structure)
delete st;
52 for(
auto dt : detector)
delete dt;
58 return (
this==&right);
64 G4String remainingPath = treeStructure;
65 remainingPath.
remove(0,pathName.length());
66 if( ! remainingPath.
isNull() )
69 G4String subD = ExtractDirName( remainingPath );
71 if( tgtSDS ==
nullptr )
75 structure.push_back( tgtSDS );
83 { detector.push_back( aSD ); }
84 else if( tgtSD != aSD )
88 ed << aSD->
GetName() <<
" had already been stored in "
89 << pathName <<
". Object pointer is overwitten.\n";
90 ed <<
"It's users' responsibility to delete the old sensitive detector object.";
94 detector.push_back( aSD );
101 for(
auto st : structure)
102 {
if( subD == st->dirName )
return st; }
108 for(
auto det : detector)
109 {
if(aSDName == det->GetName())
return det; }
115 auto det = std::find(detector.begin(), detector.end(), sd);
116 if(det!=detector.end()) detector.erase(det);
123 if( i !=
G4int(std::string::npos) ) subD.
remove(i+1);
130 aPath.
remove(0,pathName.length());
131 if( aPath.
first(
'/') !=
G4int(std::string::npos) )
133 G4String subD = ExtractDirName(aPath);
135 if( tgtSDS ==
nullptr )
137 G4cout << subD <<
" is not found in " << pathName <<
G4endl;
141 tgtSDS->
Activate(aName,sensitiveFlag);
146 for(
auto det : detector) det->Activate(sensitiveFlag);
147 for(
auto st : structure) st->Activate(
G4String(
"/"),sensitiveFlag);
152 if( tgtSD ==
nullptr )
154 G4cout << aPath <<
" is not found in " << pathName <<
G4endl;
166 aPath.
remove(0,pathName.length());
167 if( aPath.
first(
'/') !=
G4int(std::string::npos) )
169 G4String subD = ExtractDirName(aPath);
171 if( tgtSDS ==
nullptr )
174 G4cout << subD <<
" is not found in " << pathName <<
G4endl;
185 if( tgtSD ==
nullptr )
188 G4cout << aPath <<
" is not found in " << pathName <<
G4endl;
197 for(
auto st : structure)
198 { st->Initialize(HCE); }
200 for(
auto dt : detector)
201 {
if(dt->isActive()) dt->Initialize(HCE); }
207 for(
auto st : structure)
208 { st->Terminate(HCE); }
210 for(
auto dt : detector)
211 {
if(dt->isActive()) dt->EndOfEvent(HCE); }
217 for(
auto sd : detector)
221 {
G4cout <<
" *** Active "; }
223 {
G4cout <<
" XXX Inactive "; }
226 for(
auto st : structure) st->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)