ATLAS Offline Software
Loading...
Searching...
No Matches
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
18class G4Step;
19
20class LArEM_ID;
21class LArFCAL_ID;
22class LArHEC_ID;
23class CaloDM_ID;
24class AtlasDetectorID;
25
27
30
31
38class LArG4CalibSD : public G4VSensitiveDetector
39{
40FRIEND_TEST( LArG4CalibSDtest, ProcessHits );
41FRIEND_TEST( LArG4CalibSDtest, EndOfAthenaEvent );
42FRIEND_TEST( LArG4CalibSDtest, setupHelpers );
43FRIEND_TEST( LArG4CalibSDtest, addDetectorHelper );
44FRIEND_TEST( LArG4CalibSDtest, SpecialHit );
45FRIEND_TEST( LArG4CalibSDtest, SimpleHit );
46FRIEND_TEST( LArG4CalibSDtest, ConvertID );
47public:
48
50 LArG4CalibSD(G4String a_name, ILArCalibCalculatorSvc* calc, bool doPID=false);
51
53 virtual ~LArG4CalibSD();
54
56 G4bool ProcessHits(G4Step* a_step,G4TouchableHistory*) override;
57
59 void EndOfAthenaEvent( CaloCalibrationHitContainer* hitContainer, CaloCalibrationHitContainer* deadHitContainer=nullptr);
60
63
65 void setupHelpers( const LArEM_ID* EM ,
66 const LArFCAL_ID* FCAL ,
67 const LArHEC_ID* HEC ,
68 const CaloDM_ID* caloDm ) {
69 m_larEmID = EM;
70 m_larFcalID = FCAL;
71 m_larHecID = HEC;
72 m_caloDmID = caloDm;
73 }
74
75 void addDetectorHelper( const AtlasDetectorID* id_helper) { m_id_helper=id_helper; }
76
78 G4bool SpecialHit(G4Step* a_step, const std::vector<G4double>& a_energies);
79
80protected:
81
82 // We need two types containers for hits:
83
84 // The set defined below is used to tell us if we've already had a
85 // hit in a cell. We store these hits in a set, so we can quickly
86 // search it. Note the use of a custom definition of a "less"
87 // function for the set, so we're not just comparing hit pointers.
88
89 class LessHit {
90 public:
91 bool operator() ( CaloCalibrationHit* const& p, CaloCalibrationHit* const& q ) const
92 {
93 return p->Less(q);
94 }
95 };
96
97 typedef std::set< CaloCalibrationHit*, LessHit > m_calibrationHits_t;
99 G4bool SimpleHit( const LArG4Identifier& a_ident, const std::vector<double>& energies, m_calibrationHits_t& calibrationHits );
100
101 G4bool SrHit( const LArG4Identifier& a_ident, const LArG4Identifier& sr_id, const std::vector<double>& energies, m_calibrationHits_t& calibrationHitsSr );
104
107
109 G4bool m_doPID;
110
113
116
119
121 Identifier ConvertID(const LArG4Identifier& a_ident) const;
122
123 Identifier ConvertSRID(const LArG4Identifier& sr_id, const LArG4Identifier& lr_id) const;
130 };
131
132#endif
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Class to store calorimeter calibration hit.
Helper class for Calo Dead Material offline identifiers.
Definition CaloDM_ID.h:102
Helper class for LArEM offline identifiers.
Definition LArEM_ID.h:111
Helper class for LArFCAL offline identifiers.
Definition LArFCAL_ID.h:49
bool operator()(CaloCalibrationHit *const &p, CaloCalibrationHit *const &q) const
void EndOfAthenaEvent(CaloCalibrationHitContainer *hitContainer, CaloCalibrationHitContainer *deadHitContainer, SrCaloCalibrationHitContainer *srHitContainer)
End of athena event processing with dedicated SR container.
FRIEND_TEST(LArG4CalibSDtest, addDetectorHelper)
Identifier ConvertID(const LArG4Identifier &a_ident) const
Helper function for making "real" identifiers from LArG4Identifiers.
FRIEND_TEST(LArG4CalibSDtest, 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.
m_calibrationHits_t m_calibrationHitsSr
The actual set of Sr calibration hits.
G4bool SrHit(const LArG4Identifier &a_ident, const LArG4Identifier &sr_id, const std::vector< double > &energies, m_calibrationHits_t &calibrationHitsSr)
FRIEND_TEST(LArG4CalibSDtest, ProcessHits)
FRIEND_TEST(LArG4CalibSDtest, setupHelpers)
const AtlasDetectorID * m_id_helper
Identifier ConvertSRID(const LArG4Identifier &sr_id, const LArG4Identifier &lr_id) const
std::set< CaloCalibrationHit *, LessHit > m_calibrationHits_t
const CaloDM_ID * m_caloDmID
LArG4CalibSD(G4String a_name, ILArCalibCalculatorSvc *calc, bool doPID=false)
Constructor.
void addDetectorHelper(const AtlasDetectorID *id_helper)
ILArCalibCalculatorSvc * m_calculator
Member variable - the calculator we'll use.
G4bool m_doPID
Are we set up to run with PID hits?
G4bool ProcessHits(G4Step *a_step, G4TouchableHistory *) override
Main processing method.
void EndOfAthenaEvent(CaloCalibrationHitContainer *hitContainer, CaloCalibrationHitContainer *deadHitContainer=nullptr)
End of athena event processing.
G4bool SpecialHit(G4Step *a_step, const std::vector< G4double > &a_energies)
For other classes that need to call into us...
FRIEND_TEST(LArG4CalibSDtest, EndOfAthenaEvent)
FRIEND_TEST(LArG4CalibSDtest, ConvertID)
G4int m_numberInvalidHits
Count the number of invalid hits.
void setupHelpers(const LArEM_ID *EM, const LArFCAL_ID *FCAL, const LArHEC_ID *HEC, const CaloDM_ID *caloDm)
Sets the ID helper pointers.
m_calibrationHits_t m_calibrationHits
The actual set of calibration hits.
FRIEND_TEST(LArG4CalibSDtest, SpecialHit)
virtual ~LArG4CalibSD()
Destructor.
m_calibrationHits_t m_deadCalibrationHits
The actual set of dead material calibration hits.
const LArHEC_ID * m_larHecID
const LArFCAL_ID * m_larFcalID
const LArEM_ID * m_larEmID
Pointers to the identifier helpers.
Helper class for LArHEC offline identifiers.
Definition LArHEC_ID.h:76