ATLAS Offline Software
RadLengthAction.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef G4UserActions_RadLengthAction_H
6 #define G4UserActions_RadLengthAction_H
7 
8 #include <map>
9 #include <vector>
10 #include <string>
11 
12 #include "G4UserRunAction.hh"
13 #include "G4UserEventAction.hh"
14 #include "G4UserSteppingAction.hh"
15 #include "G4VPhysicalVolume.hh"
16 #include "G4VSensitiveDetector.hh"
17 
18 #include "GaudiKernel/ITHistSvc.h"
19 #include "GaudiKernel/ServiceHandle.h"
20 
21 class TTree;
22 
23 namespace G4UA
24 {
25  class RadLengthAction final : public G4UserRunAction,
26  public G4UserEventAction,
27  public G4UserSteppingAction
28  {
29  public:
30 
31  struct Config
32  {
33  // depth of volume, how many daughters should be taken
34  // into account, value recieved from jobOptions
36  };
37 
39  virtual void BeginOfRunAction(const G4Run*) override;
40  virtual void EndOfRunAction(const G4Run*) override;
41  virtual void BeginOfEventAction(const G4Event*) override;
42  virtual void EndOfEventAction(const G4Event*) override;
43  virtual void UserSteppingAction(const G4Step*) override;
44 
45  private:
46 
48 
49  // decision if muon chamber or trigger was already hit
50  // set to false every BeginOfEvent and changed in Stepping
51  bool MuChamberPassed = false;
52  bool MuTriggerPassed = false;
53 
54  // primary variables obtained at BeginOfEvent
55  double etaPrimary = 0.0, phiPrimary = 0.0, chargePrimary = 0.0;
56 
57  // map of volumes initialized at BeginOfRun and used
58  // for comparison in Stepping
59  std::map<std::string,G4VPhysicalVolume*> topvolmap;
60 
61  // map of trees named like the volumes initalized during
62  // BeginOfRun and filled at EndOfEvent
63  std::map<std::string,TTree*> treeMap;
64 
65  // map of vector which is initialized at BeginOfRun, components
66  // of the vector are referenced in the branches of the tree with
67  // specific volume name, in FillVariables the vectors get values
68  std::map<std::string,std::vector<double> > variables;
69 
70  // sensitive detectors retrieved at BeginOfRun and need in Stepping
71  // see ./atlas/MuonSpectrometer/MuonG4/MuonG4SD/share/muonSD.mac
72  G4VSensitiveDetector* m_SDMDT;
73  G4VSensitiveDetector* m_SDTGC;
74  G4VSensitiveDetector* m_SDCSC;
75  G4VSensitiveDetector* m_SDRPC;
76 
77  // Handle to the histogram service
79 
80  // methode to fill vector stored in variables map (index volume name)
81  void fillVariables(const std::vector<double>& varvec, const std::string& name);
82  }; //class RadLengthAction
83 
84 } //namespace G4UA
85 #endif // G4UserActions_RadLengthAction_H
G4UA::RadLengthAction::EndOfEventAction
virtual void EndOfEventAction(const G4Event *) override
Definition: RadLengthAction.cxx:194
G4UA::RadLengthAction::m_SDCSC
G4VSensitiveDetector * m_SDCSC
Definition: RadLengthAction.h:74
G4UA::RadLengthAction::EndOfRunAction
virtual void EndOfRunAction(const G4Run *) override
Definition: RadLengthAction.cxx:163
G4UA::RadLengthAction::topvolmap
std::map< std::string, G4VPhysicalVolume * > topvolmap
Definition: RadLengthAction.h:59
G4UA::RadLengthAction::treeMap
std::map< std::string, TTree * > treeMap
Definition: RadLengthAction.h:63
G4UA
for nSW
Definition: CalibrationDefaultProcessing.h:19
G4UA::RadLengthAction::UserSteppingAction
virtual void UserSteppingAction(const G4Step *) override
Definition: RadLengthAction.cxx:218
G4UA::RadLengthAction::BeginOfEventAction
virtual void BeginOfEventAction(const G4Event *) override
Definition: RadLengthAction.cxx:169
G4UA::RadLengthAction::variables
std::map< std::string, std::vector< double > > variables
Definition: RadLengthAction.h:68
G4UA::RadLengthAction::chargePrimary
double chargePrimary
Definition: RadLengthAction.h:55
G4UA::RadLengthAction::MuChamberPassed
bool MuChamberPassed
Definition: RadLengthAction.h:51
G4UA::RadLengthAction::phiPrimary
double phiPrimary
Definition: RadLengthAction.h:55
G4UA::RadLengthAction::BeginOfRunAction
virtual void BeginOfRunAction(const G4Run *) override
Definition: RadLengthAction.cxx:50
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
G4UA::RadLengthAction::MuTriggerPassed
bool MuTriggerPassed
Definition: RadLengthAction.h:52
G4UA::RadLengthAction::etaPrimary
double etaPrimary
Definition: RadLengthAction.h:55
G4UA::RadLengthAction::RadLengthAction
RadLengthAction(const Config &config)
Definition: RadLengthAction.cxx:37
G4UA::RadLengthAction
Definition: RadLengthAction.h:28
G4UA::RadLengthAction::m_hSvc
ServiceHandle< ITHistSvc > m_hSvc
Definition: RadLengthAction.h:78
G4UA::RadLengthAction::fillVariables
void fillVariables(const std::vector< double > &varvec, const std::string &name)
Definition: RadLengthAction.cxx:284
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
G4UA::RadLengthAction::Config
Definition: RadLengthAction.h:32
G4UA::RadLengthAction::m_SDMDT
G4VSensitiveDetector * m_SDMDT
Definition: RadLengthAction.h:72
G4UA::RadLengthAction::m_SDTGC
G4VSensitiveDetector * m_SDTGC
Definition: RadLengthAction.h:73
G4UA::RadLengthAction::m_SDRPC
G4VSensitiveDetector * m_SDRPC
Definition: RadLengthAction.h:75
G4UA::RadLengthAction::Config::VolumeDepthLevel
int VolumeDepthLevel
Definition: RadLengthAction.h:35
G4UA::RadLengthAction::m_config
Config m_config
Definition: RadLengthAction.h:47
ServiceHandle< ITHistSvc >