AuxDetAction.h
Go to the documentation of this file.
1 //
2 // AuxDetAction.hpp
3 // garsoft-mrb
4 //
5 // Created by Brian Rebel on 11/22/16.
6 // Copyright © 2016 Brian Rebel. All rights reserved.
7 //
8 
9 #ifndef AuxDetAction_h
10 #define AuxDetAction_h
11 
12 
13 // NuTools includes
14 #include "nug4/G4Base/UserAction.h"
15 
16 // GArSoft includes
17 #include "Geometry/GeometryGAr.h"
18 #include "Geometry/GeometryCore.h"
21 
24 #include "DetectorInfo/DetectorProperties.h"
26 
27 #include "CLHEP/Random/RandGauss.h"
28 
29 // Forward declarations.
30 class G4Event;
31 class G4Track;
32 class G4Step;
33 class G4EnergyLossForExtrapolator;
34 
35 namespace gar {
36  namespace garg4 {
37 
38  /// list of energy deposits from Geant4
39  class AuxDetAction : public g4b::UserAction {
40 
41  public:
42 
43  // Standard constructors and destructors;
44  AuxDetAction(CLHEP::HepRandomEngine* engine, fhicl::ParameterSet const& pset);
45  virtual ~AuxDetAction();
46 
47  void reconfigure(fhicl::ParameterSet const& pset);
48 
49  // UserActions method that we'll override, to obtain access to
50  // Geant4's particle tracks and trajectories.
51  void BeginOfEventAction(const G4Event*);
52  void EndOfEventAction (const G4Event*);
53  void PreTrackingAction (const G4Track*);
54  void PostTrackingAction(const G4Track*);
55  void SteppingAction (const G4Step* );
56 
57  // Returns the LArDeposit set accumulated during the current event.
58  std::vector<gar::sdp::LArDeposit> const& LArDeposits() const { return fLArDeposits; }
59  // Returns the CaloDeposit set accumulated during the current event.
60  std::vector<gar::sdp::CaloDeposit> const& CaloDeposits() const { return fECALDeposits; }
61  // Returns the CaloDeposit set accumulated during the current event.
62  std::vector<gar::sdp::CaloDeposit> const& TrackerScDeposits() const { return fTrackerScDeposits; }
63  // Returns the CaloDeposit set accumulated during the current event.
64  std::vector<gar::sdp::CaloDeposit> const& MuIDDeposits() const { return fMuIDDeposits; }
65 
66  private:
67 
68  void LArSteppingAction(const G4Step* );
69  void ECALSteppingAction(const G4Step* );
70  void TrackerScSteppingAction(const G4Step* );
71  void MuIDSteppingAction(const G4Step* );
72  void AddHits(const std::map< gar::raw::CellID_t, std::vector<gar::sdp::CaloDeposit> > m_hits, std::vector<gar::sdp::CaloDeposit> &fDeposits);
73 
74  std::string GetVolumeName(const G4Track *track);
75 
76  unsigned int GetDetNumber(std::string volname);
77  unsigned int GetStaveNumber(std::string volname);
78  unsigned int GetModuleNumber(std::string volname);
79  unsigned int GetLayerNumber(std::string volname);
80  unsigned int GetSliceNumber(std::string volname);
81 
82  G4ThreeVector globalToLocal(const G4Step* step, const G4ThreeVector& glob);
83  G4ThreeVector localToGlobal(const G4Step* step, const G4ThreeVector& loc);
84  float GetStepEnergy(const G4Step* step, bool birks);
85  float birksAttenuation(const G4Step* step);
86 
87  double fLArEnergyCut; ///< The minimum energy in GeV for a particle to be included in the list.
88  std::string fLArMaterial; ///< Material for the LArTPC
89  std::vector<std::string> fLArVolumeName; ///< volume we will record energy depositions in
90 
91  std::string fECALMaterial; ///< Material for the ECAL
92  std::vector<std::string> fECALVolumeName; ///< volume we will record energy depositions in
93 
94  std::string fTrackerScMaterial; ///< Material for the TrackerSc (GArLite)
95  std::vector<std::string> fTrackerScVolumeName; ///< volume we will record energy depositions in
96 
97  std::string fMuIDMaterial; ///< Material for the MuID
98  std::vector<std::string> fMuIDVolumeName; ///< volume we will record energy depositions in
100 
101  std::vector<gar::sdp::LArDeposit> fLArDeposits; ///< energy fDeposits for the LArTPC
102 
103  std::map< gar::raw::CellID_t, std::vector<gar::sdp::CaloDeposit> > m_ECALDeposits;
104  std::vector<gar::sdp::CaloDeposit> fECALDeposits; ///< energy fDeposits for the ECAL
105 
106  std::map< gar::raw::CellID_t, std::vector<gar::sdp::CaloDeposit> > m_TrackerScDeposits;
107  std::vector<gar::sdp::CaloDeposit> fTrackerScDeposits; ///< energy fDeposits for the TrackerSc
108 
109  std::map< gar::raw::CellID_t, std::vector<gar::sdp::CaloDeposit> > m_MuIDDeposits;
110  std::vector<gar::sdp::CaloDeposit> fMuIDDeposits; ///< energy fDeposits for the MuID
111 
112  const gar::geo::GeometryCore* fGeo; ///< geometry information
113  const detinfo::DetectorProperties* fDetProp; ///< detector properties
115  };
116 
117  } // garg4
118 } // gar
119 
120 
121 #endif /* AuxDetAction_h */
float GetStepEnergy(const G4Step *step, bool birks)
unsigned int GetDetNumber(std::string volname)
std::vector< gar::sdp::CaloDeposit > const & CaloDeposits() const
Definition: AuxDetAction.h:60
const gar::geo::GeometryCore * fGeo
geometry information
Definition: AuxDetAction.h:112
std::vector< gar::sdp::CaloDeposit > const & MuIDDeposits() const
Definition: AuxDetAction.h:64
std::string fLArMaterial
Material for the LArTPC.
Definition: AuxDetAction.h:88
std::vector< std::string > fECALVolumeName
volume we will record energy depositions in
Definition: AuxDetAction.h:92
std::string string
Definition: nybbler.cc:12
std::vector< std::string > fMuIDVolumeName
volume we will record energy depositions in
Definition: AuxDetAction.h:98
std::string fTrackerScMaterial
Material for the TrackerSc (GArLite)
Definition: AuxDetAction.h:94
AuxDetAction(CLHEP::HepRandomEngine *engine, fhicl::ParameterSet const &pset)
Description of geometry of one entire detector.
Definition: GeometryCore.h:436
void LArSteppingAction(const G4Step *)
std::map< gar::raw::CellID_t, std::vector< gar::sdp::CaloDeposit > > m_ECALDeposits
Definition: AuxDetAction.h:103
unsigned int GetSliceNumber(std::string volname)
const detinfo::DetectorProperties * fDetProp
detector properties
Definition: AuxDetAction.h:113
std::map< gar::raw::CellID_t, std::vector< gar::sdp::CaloDeposit > > m_TrackerScDeposits
Definition: AuxDetAction.h:106
G4ThreeVector globalToLocal(const G4Step *step, const G4ThreeVector &glob)
void reconfigure(fhicl::ParameterSet const &pset)
void BeginOfEventAction(const G4Event *)
double fLArEnergyCut
The minimum energy in GeV for a particle to be included in the list.
Definition: AuxDetAction.h:87
std::map< gar::raw::CellID_t, std::vector< gar::sdp::CaloDeposit > > m_MuIDDeposits
Definition: AuxDetAction.h:109
unsigned int GetModuleNumber(std::string volname)
std::string fMuIDMaterial
Material for the MuID.
Definition: AuxDetAction.h:97
unsigned int GetLayerNumber(std::string volname)
std::string GetVolumeName(const G4Track *track)
Definition of basic calo raw digits.
const gar::geo::seg::MinervaSegmentationAlg * fMinervaSegAlg
Definition: AuxDetAction.h:114
long long int CellID_t
Definition: CaloRawDigit.h:24
std::vector< gar::sdp::CaloDeposit > fMuIDDeposits
energy fDeposits for the MuID
Definition: AuxDetAction.h:110
std::vector< gar::sdp::LArDeposit > fLArDeposits
energy fDeposits for the LArTPC
Definition: AuxDetAction.h:101
void AddHits(const std::map< gar::raw::CellID_t, std::vector< gar::sdp::CaloDeposit > > m_hits, std::vector< gar::sdp::CaloDeposit > &fDeposits)
General GArSoft Utilities.
std::string fECALMaterial
Material for the ECAL.
Definition: AuxDetAction.h:91
std::vector< std::string > fTrackerScVolumeName
volume we will record energy depositions in
Definition: AuxDetAction.h:95
std::vector< gar::sdp::LArDeposit > const & LArDeposits() const
Definition: AuxDetAction.h:58
void SteppingAction(const G4Step *)
void ECALSteppingAction(const G4Step *)
std::vector< gar::sdp::CaloDeposit > fTrackerScDeposits
energy fDeposits for the TrackerSc
Definition: AuxDetAction.h:107
void MuIDSteppingAction(const G4Step *)
list of energy deposits from Geant4
Definition: AuxDetAction.h:39
std::vector< std::string > fLArVolumeName
volume we will record energy depositions in
Definition: AuxDetAction.h:89
G4ThreeVector localToGlobal(const G4Step *step, const G4ThreeVector &loc)
void EndOfEventAction(const G4Event *)
float birksAttenuation(const G4Step *step)
unsigned int GetStaveNumber(std::string volname)
void TrackerScSteppingAction(const G4Step *)
art framework interface to geometry description
void PreTrackingAction(const G4Track *)
std::vector< gar::sdp::CaloDeposit > const & TrackerScDeposits() const
Definition: AuxDetAction.h:62
std::vector< gar::sdp::CaloDeposit > fECALDeposits
energy fDeposits for the ECAL
Definition: AuxDetAction.h:104
void PostTrackingAction(const G4Track *)