7 #include "GaudiKernel/Bootstrap.h"
8 #include "GaudiKernel/ISvcLocator.h"
9 #include "GaudiKernel/IMessageSvc.h"
10 #include "GaudiKernel/IDataProviderSvc.h"
11 #include "GaudiKernel/INTupleSvc.h"
12 #include "GaudiKernel/NTuple.h"
13 #include "GaudiKernel/SmartDataPtr.h"
33 for (
int i : pdgids ){
40 NTupleFilePtr file1(
ntupleSvc(),
"/NTUPLES/FILE1");
42 SmartDataPtr<NTuple::Directory>
43 ntdir(
ntupleSvc(),
"/NTUPLES/FILE1/StepNtuple");
45 if ( !ntdir ) ntdir =
ntupleSvc()->createDirectory(file1,
"StepNtuple");
47 NTuplePtr
nt(
ntupleSvc(),
"/NTUPLES/FILE1/StepNtuple/10");
49 nt =
ntupleSvc()->book (ntdir.ptr(), 10,CLID_ColumnWiseTuple,
"GEANT4 Step NTuple");
54 if(
nt->addItem (
"nstep",
m_nsteps,0 ,50000)!=StatusCode::SUCCESS
79 ||
nt->addItem (
"evtid",
m_evtid)!=StatusCode::SUCCESS)
103 if(!
ntupleSvc()->writeRecord(
"/NTUPLES/FILE1/StepNtuple/10").isSuccess()) {
113 const int pdg_id = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
123 ATH_MSG_DEBUG (
" TruthUtils classifies "<<pdg_id<<
" as an R-Hadron, gluino or LH Squark!");
131 G4Material *
mat = aStep->GetTrack()->GetMaterial();
132 double minA=1500000.;
133 for (
unsigned int i=0;
i<
mat->GetNumberOfElements();++
i){
134 if (
mat->GetElement(
i) && minA>
mat->GetElement(
i)->GetN()){
135 minA=
mat->GetElement(
i)->GetN();
145 if (firstslow || aStep->GetTrack()->GetCurrentStepNumber()<=1 || aStep->GetPostStepPoint()->GetKineticEnergy()==0.){
158 if (aStep->GetPreStepPoint()->GetGlobalTime()==0)
m_rhadronIndex++;
164 m_mass[
m_nsteps]=aStep->GetTrack()->GetDefinition()->GetPDGMass();
166 m_t1[
m_nsteps]=aStep->GetPreStepPoint()->GetGlobalTime();
167 m_t2[
m_nsteps]=aStep->GetPostStepPoint()->GetGlobalTime();
168 G4ThreeVector pos1=aStep->GetPreStepPoint()->GetPosition();
172 G4ThreeVector pos2=aStep->GetPostStepPoint()->GetPosition();
176 m_ke1[
m_nsteps]=aStep->GetPreStepPoint()->GetKineticEnergy();
177 m_ke2[
m_nsteps]=aStep->GetPostStepPoint()->GetKineticEnergy();
178 m_pt1[
m_nsteps]=aStep->GetPreStepPoint()->GetMomentum().perp();
179 m_pt2[
m_nsteps]=aStep->GetPostStepPoint()->GetMomentum().perp();
183 m_v2[
m_nsteps]=aStep->GetPostStepPoint()->GetVelocity();
197 ATH_MSG_DEBUG (
"UserSteppingAction(): Killing uninteresting track with pdg_id "<<pdg_id);
199 aStep->GetTrack()->SetTrackStatus(fKillTrackAndSecondaries);
200 const G4TrackVector *tv = aStep->GetSecondary();
202 for (
unsigned int i=0;
i<tv->size();
i++){
203 G4Track *
t = (*tv)[
i];
204 t->SetTrackStatus(fKillTrackAndSecondaries);