ATLAS Offline Software
Loading...
Searching...
No Matches
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
21class TTree;
22
23namespace 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
virtual void BeginOfEventAction(const G4Event *) override
std::map< std::string, TTree * > treeMap
virtual void EndOfRunAction(const G4Run *) override
G4VSensitiveDetector * m_SDMDT
std::map< std::string, std::vector< double > > variables
G4VSensitiveDetector * m_SDTGC
G4VSensitiveDetector * m_SDRPC
G4VSensitiveDetector * m_SDCSC
void fillVariables(const std::vector< double > &varvec, const std::string &name)
RadLengthAction(const Config &config)
virtual void EndOfEventAction(const G4Event *) override
virtual void UserSteppingAction(const G4Step *) override
ServiceHandle< ITHistSvc > m_hSvc
std::map< std::string, G4VPhysicalVolume * > topvolmap
virtual void BeginOfRunAction(const G4Run *) override