ATLAS Offline Software
TestActionEHist.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // //
7 // TestActionEHist.h //
8 // Code for ROOT output (filename selected in code) //
9 // of histograms of the initial kinetic energy //
10 // (from truth) of specified particles, by volume. //
11 // //
12 // Written by Kevin Sapp //
13 // University of Pittsburgh //
14 // kcs34@pitt.edu //
15 // Last update 01.26.10 //
16 // //
17 // //
19 
20 #ifndef G4PROFILINGTOOLS_TestActionEHist_H
21 #define G4PROFILINGTOOLS_TestActionEHist_H
22 
23 #include "VolumeTreeNavigator.h"
24 
25 #include <string>
26 #include <vector>
27 
28 #include "G4UserTrackingAction.hh"
29 #include "G4UserRunAction.hh"
30 #include "G4UserSteppingAction.hh"
31 
32 class G4Run;
33 class G4Event;
34 class G4Step;
35 class G4String;
36 class G4VPhysicalVolume;
37 class G4TouchableHistory;
38 class Algorithm;
39 class IMessageSvc;
40 class TFile;
41 
42 
43 namespace G4UA
44 {
45 
47  public G4UserTrackingAction, public G4UserRunAction, public G4UserSteppingAction
48  {
49 
50  public:
51 
52  struct Config
53  {
54  int dCALO=2;
55  int dBeam=2;
56  int dIDET=2;
57  int dMUON=2;
58  int maxhists=1000;
59  int maxdirs=1000;
60  std::string dDetail="";
61  std::string name="default.root";
62  };
63 
65  virtual void PreUserTrackingAction(const G4Track*) override;
66  virtual void PostUserTrackingAction(const G4Track*) override;
67  virtual void BeginOfRunAction(const G4Run*) override;
68  virtual void EndOfRunAction(const G4Run*) override;
69  virtual void UserSteppingAction(const G4Step*) override;
70  private:
72 
73  TFile* m_world;
74 
75  bool m_firstStep;
76 
77  std::string m_p_tag;
78 
79  std::vector<std::string> m_trajectory;
80 
81  void BuildHists (
82  const std::string& vol_tag,
83  const std::string& part_tag,
84  int& hLeft,
85  double xfill = -1,
86  double yfill = -1,
87  const int nbins = 3000,
88  const int binsize = 1);
89 
90  bool BuildDirs (
91  const std::string& vol_tag,
92  const std::string& dirTitle,
93  int& dLeft);
94 
95 
96 
97  }; // class TestActionEHist
98 
99 } // namespace G4UA
100 
101 #endif // #define G4PROFILINGTOOLS_TestActionEHist_H
G4UA::TestActionEHist::BuildHists
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.
Definition: TestActionEHist.cxx:158
G4UA::TestActionEHist::EndOfRunAction
virtual void EndOfRunAction(const G4Run *) override
Definition: TestActionEHist.cxx:80
G4UA::TestActionEHist::BeginOfRunAction
virtual void BeginOfRunAction(const G4Run *) override
Definition: TestActionEHist.cxx:72
G4UA
for nSW
Definition: CalibrationDefaultProcessing.h:19
G4UA::TestActionEHist::BuildDirs
bool BuildDirs(const std::string &vol_tag, const std::string &dirTitle, int &dLeft)
Remaining directories to create.
Definition: TestActionEHist.cxx:180
G4UA::TestActionEHist
Definition: TestActionEHist.h:48
G4UA::TestActionEHist::m_trajectory
std::vector< std::string > m_trajectory
Used to store volume names which the current track has entered.
Definition: TestActionEHist.h:79
G4UA::TestActionEHist::PostUserTrackingAction
virtual void PostUserTrackingAction(const G4Track *) override
Definition: TestActionEHist.cxx:65
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
G4UA::TestActionEHist::Config::dMUON
int dMUON
Used for depth limits applied in jobOptions.
Definition: TestActionEHist.h:57
G4UA::TestActionEHist::Config::dIDET
int dIDET
Definition: TestActionEHist.h:56
G4UA::TestActionEHist::UserSteppingAction
virtual void UserSteppingAction(const G4Step *) override
Definition: TestActionEHist.cxx:88
G4UA::TestActionEHist::Config::dBeam
int dBeam
Definition: TestActionEHist.h:55
G4UA::TestActionEHist::m_firstStep
bool m_firstStep
Flag indicating whether step is first in current volume.
Definition: TestActionEHist.h:75
G4UA::TestActionEHist::Config::maxdirs
int maxdirs
Used to set maximum number of histograms/directories from jobOptions.
Definition: TestActionEHist.h:59
G4UA::TestActionEHist::PreUserTrackingAction
virtual void PreUserTrackingAction(const G4Track *) override
Definition: TestActionEHist.cxx:50
G4UA::TestActionEHist::m_world
TFile * m_world
File in which to store neutron & electron info.
Definition: TestActionEHist.h:73
G4UA::TestActionEHist::Config::dDetail
std::string dDetail
Path used to set detailed depth cuts.
Definition: TestActionEHist.h:60
VolumeTreeNavigator.h
G4UA::TestActionEHist::Config
Definition: TestActionEHist.h:53
G4UA::TestActionEHist::m_config
Config m_config
holds the python configuration
Definition: TestActionEHist.h:71
G4UA::TestActionEHist::m_p_tag
std::string m_p_tag
Used to specify current particle in tracking.
Definition: TestActionEHist.h:77
G4UA::TestActionEHist::Config::maxhists
int maxhists
Definition: TestActionEHist.h:58
G4UA::TestActionEHist::TestActionEHist
TestActionEHist(const Config &config)
Definition: TestActionEHist.cxx:44
G4UA::TestActionEHist::Config::name
std::string name
Name of root output file.
Definition: TestActionEHist.h:61
G4UA::TestActionEHist::Config::dCALO
int dCALO
Definition: TestActionEHist.h:54