|
ATLAS Offline Software
|
Go to the documentation of this file.
22 #include "G4Electron.hh"
24 #include "G4Positron.hh"
25 #include "G4ParticleDefinition.hh"
26 #include "G4TouchableHistory.hh"
27 #include "G4VPhysicalVolume.hh"
28 #include "G4LogicalVolume.hh"
29 #include "G4VProcess.hh"
36 using std::stringstream;
45 : m_config(
config), m_world(0), m_firstStep(false), m_p_tag(
"")
55 G4ParticleDefinition* pDef = aTrack->GetDefinition();
56 const G4String& pName = pDef->GetParticleName();
57 const G4String& pSubType = pDef->GetParticleSubType();
58 if (pName ==
"neutron" || pName ==
"proton" ) {
m_p_tag = pName; }
59 else if (pSubType ==
"e" || pSubType ==
"pi" ) {
m_p_tag = pSubType; }
60 else {
m_p_tag = pDef->GetParticleType(); }
135 string thNoDau =
stringify(
pv->GetLogicalVolume()->GetNoDaughters());
139 string v_name = (thRep == 16969 ? thPV : thPV+
"_"+
stringify(thRep));
147 if ( !currentTree.
Descend() )
break;
163 (
TH1F*)
gDirectory->FindObjectAny((part_tag+
"_"+vol_tag+
"_hist").c_str());
164 if (!hLeft && !hExists) {
return; }
166 hExists =
new TH1F((part_tag+
"_"+vol_tag+
"_hist").c_str(),
167 (part_tag+
" KE in "+vol_tag).c_str(),
171 if (!hLeft) G4cout<<
"Last histogram reached"<<G4endl;
174 if (xfill >= 0 &&
weight >= 0) { hExists->Fill(xfill,
weight); }
175 else if (xfill >= 0) { hExists->Fill(xfill); }
183 TDirectory* dExists = (TDirectory*)
gDirectory->FindObjectAny(vol_tag.c_str());
184 if (!dLeft && !dExists) {
return enter; }
186 dExists =
new TDirectoryFile(vol_tag.c_str(),
190 if (!dLeft) G4cout<<
"Last directory created"<<G4endl;
193 if (dExists) enter = (
bool)dExists->cd();
int GetStepNumber() const
void BuildHists(const std::string &vol_tag, const std::string &part_tag, int &hLeft, double xfill=-1, double yfill=-1, const int nbins=3000, const int binsize=1)
Size of bins in histogram, in MeV.
virtual void EndOfRunAction(const G4Run *) override
void SetDepthCutSimple(const int, const int, const int, const int)
virtual void BeginOfRunAction(const G4Run *) override
G4VPhysicalVolume * GetVolume(int rel=0) const
bool BuildDirs(const std::string &vol_tag, const std::string &dirTitle, int &dLeft)
Remaining directories to create.
std::string cleanstr(T obj)
std::vector< std::string > m_trajectory
Used to store volume names which the current track has entered.
virtual void PostUserTrackingAction(const G4Track *) override
int dMUON
Used for depth limits applied in jobOptions.
virtual void UserSteppingAction(const G4Step *) override
std::string stringify(T obj)
bool m_firstStep
Flag indicating whether step is first in current volume.
int maxdirs
Used to set maximum number of histograms/directories from jobOptions.
virtual void PreUserTrackingAction(const G4Track *) override
TFile * m_world
File in which to store neutron & electron info.
std::string dDetail
Path used to set detailed depth cuts.
void SetDepthCutDetail(const char *)
int GetCopyNumber(int rel=0) const
Config m_config
holds the python configuration
std::string m_p_tag
Used to specify current particle in tracking.
bool Descend(int levels=1)
bool Ascend(int levels=1)
TestActionEHist(const Config &config)
std::string name
Name of root output file.
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
const G4StepPoint * GetPreStepPoint() const
setBGCode setTAP setLVL2ErrorBits bool