16 #include "GaudiKernel/ISvcLocator.h"
17 #include "GaudiKernel/MsgStream.h"
19 #include "G4PrimaryParticle.hh"
20 #include "G4PrimaryVertex.hh"
22 #include "G4TouchableHistory.hh"
24 #include "G4StepPoint.hh"
27 #include "G4SDManager.hh"
28 #include "G4VSensitiveDetector.hh"
29 #include "G4LogicalVolumeStore.hh"
30 #include "G4LogicalVolume.hh"
31 #include "G4VPhysicalVolume.hh"
32 #include "G4Material.hh"
43 , m_hSvc(
"THistSvc",
"RadLengthAction")
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;
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());
100 physvec.push_back(logvol->GetDaughter(
k));
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(
"::");
120 else daughtername = 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/";
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;
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();
268 G4VSensitiveDetector* SD = (G4VSensitiveDetector*) touchHist->GetVolume()->GetLogicalVolume()->GetSensitiveDetector();
289 for(
unsigned int j = 3; j<12; j++)
variables[
name].at(j) = varvec.at(j);