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
29
30
37class LArG4CalibSD : public G4VSensitiveDetector
38{
39FRIEND_TEST( LArG4CalibSDtest, ProcessHits );
40FRIEND_TEST( LArG4CalibSDtest, EndOfAthenaEvent );
41FRIEND_TEST( LArG4CalibSDtest, setupHelpers );
42FRIEND_TEST( LArG4CalibSDtest, addDetectorHelper );
43FRIEND_TEST( LArG4CalibSDtest, SpecialHit );
44FRIEND_TEST( LArG4CalibSDtest, SimpleHit );
45FRIEND_TEST( LArG4CalibSDtest, ConvertID );
46public:
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
76protected:
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
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
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.
FRIEND_TEST(LArG4CalibSDtest, ProcessHits)
FRIEND_TEST(LArG4CalibSDtest, setupHelpers)
const AtlasDetectorID * m_id_helper
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