57 G4SDManager *SDM=G4SDManager::GetSDMpointer();
58 m_SDMDT = (G4VSensitiveDetector*) SDM->FindSensitiveDetector(
"AMS");
59 m_SDTGC = (G4VSensitiveDetector*) SDM->FindSensitiveDetector(
"TMS");
60 m_SDCSC = (G4VSensitiveDetector*) SDM->FindSensitiveDetector(
"CMS");
61 m_SDRPC = (G4VSensitiveDetector*) SDM->FindSensitiveDetector(
"RMS");
70 G4LogicalVolumeStore *store = G4LogicalVolumeStore::GetInstance();
72 G4LogicalVolume* atlas = store->GetVolume(
"Atlas::Atlas");
76 std::vector<G4LogicalVolume*> logvec;
77 logvec.push_back(atlas);
80 std::vector<G4VPhysicalVolume*> physvec;
86 while(counter !=
m_config.VolumeDepthLevel){
91 std::vector<G4LogicalVolume*> tmplogvec;
94 for(G4LogicalVolume* logvol : logvec) {
95 for(
unsigned int k=0; k<logvol->GetNoDaughters();k++){
97 tmplogvec.push_back(logvol->GetDaughter(k)->GetLogicalVolume());
99 if((logvol->GetDaughter(k)->GetLogicalVolume()->GetMaterial()->GetRadlen()<100*CLHEP::cm) || (counter ==
m_config.VolumeDepthLevel)){
100 physvec.push_back(logvol->GetDaughter(k));
107 logvec=std::move(tmplogvec);
113 for (G4VPhysicalVolume* physvol : physvec) {
114 std::string fulldaughtername = physvol->GetName();
115 std::string daughtername;
116 std::string::size_type npos;
117 npos=fulldaughtername.find(
"::");
119 if(npos!=std::string::npos &&
m_config.VolumeDepthLevel==1) daughtername = fulldaughtername.substr(0,npos);
120 else daughtername = std::move(fulldaughtername);
132 treeMap[p.first]=
new TTree(TString(p.first), TString(p.first));
137 if(
m_hSvc.retrieve().isFailure())
return;
143 std::string filename=
"/RadLengthAction/";
144 std::string treepath= filename+p.first;
145 m_hSvc->regTree(treepath.c_str(),
treeMap[p.first]).ignore();
147 treeMap[p.first]->Branch(
"EnergyLoss", &
variables[p.first].at(0),
"EnergyLoss/D");
148 treeMap[p.first]->Branch(
"RadLength", &
variables[p.first].at(1),
"RadLength/D");
149 treeMap[p.first]->Branch(
"Intlength", &
variables[p.first].at(2),
"Intlength/D");
150 treeMap[p.first]->Branch(
"InitialEta", &
variables[p.first].at(3),
"InitialEta/D");
151 treeMap[p.first]->Branch(
"InitialPhi", &
variables[p.first].at(4),
"InitialPhi/D");
152 treeMap[p.first]->Branch(
"PointEta", &
variables[p.first].at(5),
"PointEta/D");
153 treeMap[p.first]->Branch(
"PointPhi", &
variables[p.first].at(6),
"PointPhi/D");
173 G4PrimaryVertex *vert=anEvent->GetPrimaryVertex(0);
175 G4PrimaryParticle *part=vert->GetPrimary();
176 G4ThreeVector mom=part->GetMomentum();
180 G4cout<<
"Begin Of Event"<<
" "<<(double)vert->GetX0()<<
" "<<(double)vert->GetY0()<<
" "<<(double)vert->GetZ0()<< G4endl;
181 G4cout<<
"Begin Of Event"<<
" "<<(double)mom[0]<<
" "<<(
double)mom[1]<<
" "<<(double)mom[2]<< G4endl;
228 const G4TouchableHistory* touchHist =
229 static_cast<const G4TouchableHistory*
>(aStep->GetPreStepPoint()->GetTouchable());
232 G4ThreeVector
xyz = (G4ThreeVector) aStep->GetPreStepPoint()->GetPosition();
237 double radl=aStep->GetPreStepPoint()->GetMaterial()->GetRadlen();
238 double intl=aStep->GetPreStepPoint()->GetMaterial()->GetNuclearInterLength();
241 double stepl=aStep->GetStepLength();
242 G4cout<<aStep->GetPreStepPoint()->GetMaterial()->GetName()<<
" "<<radl<<
" "<<stepl<<
" "<<stepl/radl<<
" "<<(double)
xyz[0]<<
" "<<(
double)
xyz[1]<<
" "<< (double)
xyz[2]<<G4endl;
244 const unsigned int nVariablesToSave(12);
245 std::vector<double> varvec(nVariablesToSave);
246 varvec.at(0) = (double) aStep->GetDeltaEnergy();
247 varvec.at(1) = (double) stepl/radl;
248 varvec.at(2) = (double) stepl/intl;
251 varvec.at(5) = (double)
xyz.pseudoRapidity();
252 varvec.at(6) = (double)
xyz.phi();
253 varvec.at(7) = (double)
xyz[0];
254 varvec.at(8) = (double)
xyz[1];
255 varvec.at(9) = (double)
xyz[2];
256 varvec.at(10) = (double) sqrt(
xyz[0]*
xyz[0]+
xyz[1]*
xyz[1]);
262 if(p.second == touchHist->GetVolume(touchHist->GetHistoryDepth()-
m_config.VolumeDepthLevel) ){
268 G4VSensitiveDetector* SD = (G4VSensitiveDetector*) touchHist->GetVolume()->GetLogicalVolume()->GetSensitiveDetector();