ATLAS Offline Software
LArG4CalibSD.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef LARG4CALIBSD_H
6 #define LARG4CALIBSD_H
7 
8 #include "G4VSensitiveDetector.hh"
9 
12 #include <gtest/gtest_prod.h>
13 
14 #include <set>
15 #include <vector>
16 
17 // Forward declarations
18 class G4Step;
19 
20 class LArEM_ID;
21 class LArFCAL_ID;
22 class LArHEC_ID;
23 class CaloDM_ID;
24 class AtlasDetectorID;
25 
27 
29 
30 
37 class LArG4CalibSD : public G4VSensitiveDetector
38 {
39 FRIEND_TEST( LArG4CalibSDtest, ProcessHits );
40 FRIEND_TEST( LArG4CalibSDtest, EndOfAthenaEvent );
41 FRIEND_TEST( LArG4CalibSDtest, setupHelpers );
42 FRIEND_TEST( LArG4CalibSDtest, addDetectorHelper );
43 FRIEND_TEST( LArG4CalibSDtest, SpecialHit );
44 FRIEND_TEST( LArG4CalibSDtest, SimpleHit );
45 FRIEND_TEST( LArG4CalibSDtest, ConvertID );
46 public:
47 
49  LArG4CalibSD(G4String a_name, ILArCalibCalculatorSvc* calc, bool doPID=false);
50 
52  virtual ~LArG4CalibSD();
53 
55  G4bool ProcessHits(G4Step* a_step,G4TouchableHistory*) override;
56 
58  void EndOfAthenaEvent( CaloCalibrationHitContainer* hitContainer, CaloCalibrationHitContainer* deadHitContainer=nullptr );
59 
61  void setupHelpers( const LArEM_ID* EM ,
62  const LArFCAL_ID* FCAL ,
63  const LArHEC_ID* HEC ,
64  const CaloDM_ID* caloDm ) {
65  m_larEmID = EM;
66  m_larFcalID = FCAL;
67  m_larHecID = HEC;
68  m_caloDmID = caloDm;
69  }
70 
71  void addDetectorHelper( const AtlasDetectorID* id_helper) { m_id_helper=id_helper; }
72 
74  G4bool SpecialHit(G4Step* a_step, const std::vector<G4double>& a_energies);
75 
76 protected:
77 
78  // We need two types containers for hits:
79 
80  // The set defined below is used to tell us if we've already had a
81  // hit in a cell. We store these hits in a set, so we can quickly
82  // search it. Note the use of a custom definition of a "less"
83  // function for the set, so we're not just comparing hit pointers.
84 
85  class LessHit {
86  public:
87  bool operator() ( CaloCalibrationHit* const& p, CaloCalibrationHit* const& q ) const
88  {
89  return p->Less(q);
90  }
91  };
92 
93  typedef std::set< CaloCalibrationHit*, LessHit > m_calibrationHits_t;
95  G4bool SimpleHit( const LArG4Identifier& a_ident, const std::vector<double>& energies, m_calibrationHits_t& calibrationHits );
96 
99 
102 
104  G4bool m_doPID;
105 
108 
111 
113  Identifier ConvertID(const LArG4Identifier& a_ident) const;
114 
121 };
122 
123 #endif
CaloCalibrationHitContainer
Definition: CaloCalibrationHitContainer.h:25
LArG4CalibSD::m_id_helper
const AtlasDetectorID * m_id_helper
Definition: LArG4CalibSD.h:120
LArG4Identifier
Definition: LArG4Identifier.h:121
LArG4CalibSD::m_calibrationHits_t
std::set< CaloCalibrationHit *, LessHit > m_calibrationHits_t
Definition: LArG4CalibSD.h:93
LArSamples::HEC
@ HEC
Definition: CaloId.h:26
CaloCalibrationHit.h
LArG4CalibSD::m_larEmID
const LArEM_ID * m_larEmID
Pointers to the identifier helpers.
Definition: LArG4CalibSD.h:116
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
LArG4CalibSD::FRIEND_TEST
FRIEND_TEST(LArG4CalibSDtest, addDetectorHelper)
LArG4CalibSD::SpecialHit
G4bool SpecialHit(G4Step *a_step, const std::vector< G4double > &a_energies)
For other classes that need to call into us...
LArHEC_ID
Helper class for LArHEC offline identifiers.
Definition: LArHEC_ID.h:85
LArG4CalibSD::addDetectorHelper
void addDetectorHelper(const AtlasDetectorID *id_helper)
Definition: LArG4CalibSD.h:71
LArG4CalibSD::FRIEND_TEST
FRIEND_TEST(LArG4CalibSDtest, SimpleHit)
LArG4CalibSD::m_caloDmID
const CaloDM_ID * m_caloDmID
Definition: LArG4CalibSD.h:119
LArG4CalibSD::FRIEND_TEST
FRIEND_TEST(LArG4CalibSDtest, ProcessHits)
LArG4CalibSD::m_numberInvalidHits
G4int m_numberInvalidHits
Count the number of invalid hits.
Definition: LArG4CalibSD.h:101
LArG4CalibSD::LArG4CalibSD
LArG4CalibSD(G4String a_name, ILArCalibCalculatorSvc *calc, bool doPID=false)
Constructor.
Ringer::EM
@ EM
Definition: CaloRingsDefs.h:19
LArG4CalibSD::~LArG4CalibSD
virtual ~LArG4CalibSD()
Destructor.
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
LArG4CalibSD::m_doPID
G4bool m_doPID
Are we set up to run with PID hits?
Definition: LArG4CalibSD.h:104
LArG4CalibSD
A specialized SD class for saving LAr calibration hits.
Definition: LArG4CalibSD.h:38
LArG4CalibSD::FRIEND_TEST
FRIEND_TEST(LArG4CalibSDtest, SpecialHit)
LArG4Identifier.h
LArG4CalibSD::LessHit
Definition: LArG4CalibSD.h:85
LArG4CalibSD::m_larHecID
const LArHEC_ID * m_larHecID
Definition: LArG4CalibSD.h:118
CaloCalibrationHit
Class to store calorimeter calibration hit.
Definition: CaloCalibrationHit.h:21
LArG4CalibSD::SimpleHit
G4bool SimpleHit(const LArG4Identifier &a_ident, const std::vector< double > &energies, m_calibrationHits_t &calibrationHits)
Constructs the calibration hit and saves it to the set.
LArG4CalibSD::FRIEND_TEST
FRIEND_TEST(LArG4CalibSDtest, EndOfAthenaEvent)
LArG4CalibSD::m_calculator
ILArCalibCalculatorSvc * m_calculator
Member variable - the calculator we'll use.
Definition: LArG4CalibSD.h:98
LArG4CalibSD::FRIEND_TEST
FRIEND_TEST(LArG4CalibSDtest, ConvertID)
LArG4CalibSD::EndOfAthenaEvent
void EndOfAthenaEvent(CaloCalibrationHitContainer *hitContainer, CaloCalibrationHitContainer *deadHitContainer=nullptr)
End of athena event processing.
LArG4CalibSD::FRIEND_TEST
FRIEND_TEST(LArG4CalibSDtest, setupHelpers)
LArG4CalibSD::ProcessHits
G4bool ProcessHits(G4Step *a_step, G4TouchableHistory *) override
Main processing method.
LArSamples::FCAL
@ FCAL
Definition: CaloId.h:26
ILArCalibCalculatorSvc
Definition: ILArCalibCalculatorSvc.h:23
CaloDM_ID
Helper class for Calo Dead Material offline identifiers.
Definition: CaloDM_ID.h:102
LArG4CalibSD::LessHit::operator()
bool operator()(CaloCalibrationHit *const &p, CaloCalibrationHit *const &q) const
Definition: LArG4CalibSD.h:87
extractSporadic.q
list q
Definition: extractSporadic.py:98
LArG4CalibSD::ConvertID
Identifier ConvertID(const LArG4Identifier &a_ident) const
Helper function for making "real" identifiers from LArG4Identifiers.
LArEM_ID
Helper class for LArEM offline identifiers.
Definition: LArEM_ID.h:118
LArG4CalibSD::m_calibrationHits
m_calibrationHits_t m_calibrationHits
The actual set of calibration hits.
Definition: LArG4CalibSD.h:107
LArFCAL_ID
Helper class for LArFCAL offline identifiers.
Definition: LArFCAL_ID.h:60
beamspotnt.calc
calc
Definition: bin/beamspotnt.py:1252
LArG4CalibSD::setupHelpers
void setupHelpers(const LArEM_ID *EM, const LArFCAL_ID *FCAL, const LArHEC_ID *HEC, const CaloDM_ID *caloDm)
Sets the ID helper pointers.
Definition: LArG4CalibSD.h:61
AtlasDetectorID
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Definition: AtlasDetectorID.h:57
LArG4CalibSD::m_larFcalID
const LArFCAL_ID * m_larFcalID
Definition: LArG4CalibSD.h:117
LArG4CalibSD::m_deadCalibrationHits
m_calibrationHits_t m_deadCalibrationHits
The actual set of dead material calibration hits.
Definition: LArG4CalibSD.h:110