ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
FCS_StepInfoSD Class Reference

Common sensitive detector class for LAr systems. More...

#include <FCS_StepInfoSD.h>

Inheritance diagram for FCS_StepInfoSD:
Collaboration diagram for FCS_StepInfoSD:

Public Member Functions

 FCS_StepInfoSD (G4String a_name, const FCS_Param::Config &config)
 Constructor. More...
 
virtual G4bool ProcessHits (G4Step *a_step, G4TouchableHistory *) override
 Main processing method. More...
 
void EndOfAthenaEvent (ISF_FCS_Parametrization::FCS_StepInfoCollection *hitContnainer)
 End of athena event processing. More...
 
void setupHelpers (const LArEM_ID *EM, const LArFCAL_ID *FCAL, const LArHEC_ID *HEC, const TileID *tile)
 Sets the ID helper pointers. More...
 

Protected Member Functions

void getCaloDDManager ()
 Keep a map instead of trying to keep the full vector. More...
 
void update_map (const CLHEP::Hep3Vector &l_vec, const Identifier &l_identifier, double l_energy, double l_time, bool l_valid, int l_detector, double timeWindow, double distanceWindow)
 

Protected Attributes

FCS_Param::Config m_config
 
const LArEM_IDm_larEmID {nullptr}
 Pointers to the identifier helpers. More...
 
const LArFCAL_IDm_larFcalID {nullptr}
 
const LArHEC_IDm_larHecID {nullptr}
 
const TileIDm_tileID {nullptr}
 
CxxUtils::CachedPointer< const CaloDetDescrManagerm_calo_dd_man
 
std::map< Identifier, std::vector< ISF_FCS_Parametrization::FCS_StepInfo * > * > m_hit_map
 

Private Member Functions

double getMaxTime (const CaloCell_ID::CaloSample &layer) const
 
double getMaxRadius (const CaloCell_ID::CaloSample &layer) const
 
double getMaxDeltaR (const CaloCell_ID::CaloSample &layer) const
 
double getMaxDeltaEta (const CaloCell_ID::CaloSample &layer) const
 
double getMaxDeltaPhi (const CaloCell_ID::CaloSample &layer) const
 

Detailed Description

Common sensitive detector class for LAr systems.

This SD implementation saves the standard LArHits. See LArG4CalibSD for an SD that handles calibration hits.

Definition at line 92 of file FCS_StepInfoSD.h.

Constructor & Destructor Documentation

◆ FCS_StepInfoSD()

FCS_StepInfoSD::FCS_StepInfoSD ( G4String  a_name,
const FCS_Param::Config config 
)

Constructor.

Definition at line 23 of file FCS_StepInfoSD.cxx.

24  : G4VSensitiveDetector(std::move(a_name))
25  , m_config(config)
26  , m_calo_dd_man(nullptr)
27 {
28 }

Member Function Documentation

◆ EndOfAthenaEvent()

void FCS_StepInfoSD::EndOfAthenaEvent ( ISF_FCS_Parametrization::FCS_StepInfoCollection hitContnainer)

End of athena event processing.

Definition at line 209 of file FCS_StepInfoSD.cxx.

210 {
211  // Unpack map into vector
212  for (auto it : m_hit_map) {
213  for (auto *a_s : * it.second) {
214  // Giving away ownership of the objects!
215  hitContainer->push_back( a_s );
216  }
217  it.second->clear();
218  delete it.second;
219  } // Vector of IDs in the map
220  m_hit_map.clear();
221  if (m_config.verboseLevel > 4) {
222  G4cout <<this->GetName()<< " DEBUG EndOfAthenaEvent: After initial cleanup, N=" << hitContainer->size() << G4endl;
223  }
224  return;
225 }

◆ getCaloDDManager()

void FCS_StepInfoSD::getCaloDDManager ( )
protected

Keep a map instead of trying to keep the full vector.

At the end of the event we'll push the map back into the FCS_StepInfoCollection in StoreGate.

Definition at line 145 of file FCS_StepInfoSD.cxx.

146 {
147  SG::ReadCondHandleKey<CaloDetDescrManager> caloMgrKey{"CaloDetDescrManager"};
148  if(caloMgrKey.initialize().isFailure()) {
149  G4ExceptionDescription description;
150  description << "Failed to get CaloDetDescrManager!";
151  G4Exception("FCS_StepInfoSD", "FCSBadCall", FatalException, description);
152  abort();
153  }
154  SG::ReadCondHandle<CaloDetDescrManager> caloMgr(caloMgrKey,Gaudi::Hive::currentContext());
155  m_calo_dd_man.set(*caloMgr);
156 }

◆ getMaxDeltaEta()

double FCS_StepInfoSD::getMaxDeltaEta ( const CaloCell_ID::CaloSample layer) const
inlineprivate

NB The result of this function should actually be constant for each SD

Definition at line 94 of file FCS_StepInfoSD.cxx.

95 {
97  if(m_config.m_maxRadiusLAr != 25) return 999.;
100  // PS default is 1mm in eta, 5mm in phi, no cut in r
101  return m_config.m_maxEtaPS;
102  }
104  // EM1 default is 1mm in eta, 5mm in phi, 15mm in r
105  return m_config.m_maxEtaEM1;
106  }
108  // EM2 default is 1mm in eta, 5mm in phi, 60mm in r
109  return m_config.m_maxEtaEM2;
110  }
112  // EM3 default is 1mm in eta, 5mm in phi, 8mm in r
113  return m_config.m_maxEtaEM3;
114  }
115  }
116  return 999.;
117 }

◆ getMaxDeltaPhi()

double FCS_StepInfoSD::getMaxDeltaPhi ( const CaloCell_ID::CaloSample layer) const
inlineprivate

NB The result of this function should actually be constant for each SD

Definition at line 119 of file FCS_StepInfoSD.cxx.

120 {
122  if(m_config.m_maxRadiusLAr != 25) return 999.;
125  // PS default is 1mm in eta, 5mm in phi, no cut in r
126  return m_config.m_maxPhiPS;
127  }
129  // EM1 default is 1mm in eta, 5mm in phi, 15mm in r
130  return m_config.m_maxPhiEM1;
131  }
133  // EM2 default is 1mm in eta, 5mm in phi, 60mm in r
134  return m_config.m_maxPhiEM2;
135  }
137  // EM3 default is 1mm in eta, 5mm in phi, 8mm in r
138  return m_config.m_maxPhiEM3;
139  }
140  }
141  return 999.;
142 }

◆ getMaxDeltaR()

double FCS_StepInfoSD::getMaxDeltaR ( const CaloCell_ID::CaloSample layer) const
inlineprivate

NB The result of this function should actually be constant for each SD

Definition at line 69 of file FCS_StepInfoSD.cxx.

70 {
72  if(m_config.m_maxRadiusLAr != 25) return 999.;
75  // PS default is 1mm in eta, 5mm in phi, no cut in r
76  return m_config.m_maxrPS;
77  }
79  // EM1 default is 1mm in eta, 5mm in phi, 15mm in r
80  return m_config.m_maxrEM1;
81  }
83  // EM2 default is 1mm in eta, 5mm in phi, 60mm in r
84  return m_config.m_maxrEM2;
85  }
87  // EM3 default is 1mm in eta, 5mm in phi, 8mm in r
88  return m_config.m_maxrEM3;
89  }
90  }
91  return 999.;
92 }

◆ getMaxRadius()

double FCS_StepInfoSD::getMaxRadius ( const CaloCell_ID::CaloSample layer) const
inlineprivate

NB The result of this function should actually be constant for each SD

Definition at line 54 of file FCS_StepInfoSD.cxx.

55 {
58  return m_config.m_maxRadiusLAr;
59  }
61  return m_config.m_maxRadiusHEC;
62  }
65  }
66  return m_config.m_maxRadius;
67 }

◆ getMaxTime()

double FCS_StepInfoSD::getMaxTime ( const CaloCell_ID::CaloSample layer) const
inlineprivate

NB The result of this function should actually be constant for each SD

Definition at line 39 of file FCS_StepInfoSD.cxx.

40 {
43  return m_config.m_maxTimeLAr;
44  }
46  return m_config.m_maxTimeHEC;
47  }
49  return m_config.m_maxTimeFCAL;
50  }
51  return m_config.m_maxTime;
52 }

◆ ProcessHits()

G4bool FCS_StepInfoSD::ProcessHits ( G4Step *  a_step,
G4TouchableHistory *   
)
overridevirtual

Main processing method.

Reimplemented in LArFCS_StepInfoSD, and TileFCS_StepInfoSD.

Definition at line 30 of file FCS_StepInfoSD.cxx.

31 {
32  G4ExceptionDescription description;
33  description << "ProcessHits: Base class method should not be called!!!";
34  G4Exception("FCS_StepInfoSD", "FCSBadCall", FatalException, description);
35  abort();
36  return false;
37 }

◆ setupHelpers()

void FCS_StepInfoSD::setupHelpers ( const LArEM_ID EM,
const LArFCAL_ID FCAL,
const LArHEC_ID HEC,
const TileID tile 
)
inline

Sets the ID helper pointers.

Definition at line 106 of file FCS_StepInfoSD.h.

109  {
110  m_larEmID = EM;
111  m_larFcalID = FCAL;
112  m_larHecID = HEC;
113  m_tileID = tile;
114  }

◆ update_map()

void FCS_StepInfoSD::update_map ( const CLHEP::Hep3Vector &  l_vec,
const Identifier l_identifier,
double  l_energy,
double  l_time,
bool  l_valid,
int  l_detector,
double  timeWindow,
double  distanceWindow 
)
protected

Definition at line 158 of file FCS_StepInfoSD.cxx.

159 {
160  // NB l_identifier refers to:
161  // - the cell identifier for LAr
162  // - the PMT identifier for Tile
163 
164  // Drop any hits that don't have a good identifier attached
165  if (!m_calo_dd_man.get()->get_element(l_identifier)) {
166  if(m_config.verboseLevel > 4) {
167  G4cout<<this->GetName()<<" DEBUG update_map: bad identifier: "<<l_identifier.getString()<<" skipping this hit."<<G4endl;
168  }
169  return;
170  }
171 
172  auto map_item = m_hit_map.find( l_identifier );
173  if (map_item==m_hit_map.end()) {
174  m_hit_map[l_identifier] = new std::vector< ISF_FCS_Parametrization::FCS_StepInfo* >;
175  m_hit_map[l_identifier]->reserve(200);
176  m_hit_map[l_identifier]->push_back( new ISF_FCS_Parametrization::FCS_StepInfo( l_vec , l_identifier , l_energy , l_time , l_valid , l_detector ) );
177  }
178  else {
179 
180  // Get the appropriate merging limits
181  const CaloCell_ID::CaloSample& layer = m_calo_dd_man.get()->get_element(l_identifier)->getSampling();
182  const double tsame(this->getMaxTime(layer));
183  bool match = false;
184  for (auto *map_it : * map_item->second) {
185  // Time check ... both a global flag and a check on the layer
186  const double delta_t = std::fabs(map_it->time()-l_time);
187  if ( delta_t >= tsame ) { continue; }
188  if ( delta_t >= timeWindow ) { continue; }
189 
190  // Distance check
191  const CLHEP::Hep3Vector & currentPosition = map_it->position();
192  const double hit_diff2 = currentPosition.diff2( l_vec );
193  // Global distance check
194  if ( hit_diff2 >= distanceWindow ) { continue; }
195 
196  // Found a match. Make a temporary that will be deleted!
197  const ISF_FCS_Parametrization::FCS_StepInfo my_info( l_vec , l_identifier , l_energy , l_time , l_valid , l_detector );
198  *map_it += my_info;
199  match = true;
200  break;
201  } // End of search for match in time and space
202  if (!match) {
203  map_item->second->push_back( new ISF_FCS_Parametrization::FCS_StepInfo( l_vec , l_identifier , l_energy , l_time , l_valid , l_detector ) );
204  } // Didn't match
205  } // ID already in the map
206  return;
207 } // That's it for updating the map!

Member Data Documentation

◆ m_calo_dd_man

CxxUtils::CachedPointer<const CaloDetDescrManager> FCS_StepInfoSD::m_calo_dd_man
protected

Definition at line 128 of file FCS_StepInfoSD.h.

◆ m_config

FCS_Param::Config FCS_StepInfoSD::m_config
protected

Definition at line 122 of file FCS_StepInfoSD.h.

◆ m_hit_map

std::map< Identifier , std::vector< ISF_FCS_Parametrization::FCS_StepInfo* >* > FCS_StepInfoSD::m_hit_map
protected

Definition at line 129 of file FCS_StepInfoSD.h.

◆ m_larEmID

const LArEM_ID* FCS_StepInfoSD::m_larEmID {nullptr}
protected

Pointers to the identifier helpers.

Definition at line 124 of file FCS_StepInfoSD.h.

◆ m_larFcalID

const LArFCAL_ID* FCS_StepInfoSD::m_larFcalID {nullptr}
protected

Definition at line 125 of file FCS_StepInfoSD.h.

◆ m_larHecID

const LArHEC_ID* FCS_StepInfoSD::m_larHecID {nullptr}
protected

Definition at line 126 of file FCS_StepInfoSD.h.

◆ m_tileID

const TileID* FCS_StepInfoSD::m_tileID {nullptr}
protected

Definition at line 127 of file FCS_StepInfoSD.h.


The documentation for this class was generated from the following files:
FCS_StepInfoSD::m_hit_map
std::map< Identifier, std::vector< ISF_FCS_Parametrization::FCS_StepInfo * > * > m_hit_map
Definition: FCS_StepInfoSD.h:129
LArSamples::HEC
@ HEC
Definition: CaloId.h:26
FCS_Param::Config::m_maxEtaEM3
double m_maxEtaEM3
Definition: FCS_StepInfoSD.h:76
constants.EMB1
int EMB1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:53
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
FCS_Param::Config::m_maxRadius
double m_maxRadius
property, see LArG4GenShowerLib::LArG4GenShowerLib
Definition: FCS_StepInfoSD.h:50
skel.it
it
Definition: skel.GENtoEVGEN.py:423
FCS_StepInfoSD::getMaxTime
double getMaxTime(const CaloCell_ID::CaloSample &layer) const
Definition: FCS_StepInfoSD.cxx:39
FCS_StepInfoSD::m_calo_dd_man
CxxUtils::CachedPointer< const CaloDetDescrManager > m_calo_dd_man
Definition: FCS_StepInfoSD.h:128
FCS_Param::Config::m_maxEtaPS
double m_maxEtaPS
Definition: FCS_StepInfoSD.h:64
FCS_Param::Config::m_maxrEM3
double m_maxrEM3
Definition: FCS_StepInfoSD.h:78
FCS_Param::Config::m_maxrEM1
double m_maxrEM1
Definition: FCS_StepInfoSD.h:70
FCS_Param::Config::m_maxrEM2
double m_maxrEM2
Definition: FCS_StepInfoSD.h:74
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
CxxUtils::CachedPointer::set
void set(pointer_t elt) const
Set the element, assuming it is currently null.
ReadCellNoiseFromCool.tile
tile
Definition: ReadCellNoiseFromCool.py:92
FCS_Param::Config::m_maxPhiPS
double m_maxPhiPS
Definition: FCS_StepInfoSD.h:65
FCS_Param::Config::m_maxPhiEM3
double m_maxPhiEM3
Definition: FCS_StepInfoSD.h:77
FCS_Param::Config::m_maxrPS
double m_maxrPS
Definition: FCS_StepInfoSD.h:66
Ringer::EM
@ EM
Definition: CaloRingsDefs.h:19
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
FCS_StepInfoSD::m_larHecID
const LArHEC_ID * m_larHecID
Definition: FCS_StepInfoSD.h:126
FCS_Param::Config::m_maxTime
double m_maxTime
Definition: FCS_StepInfoSD.h:57
FCS_StepInfoSD::m_tileID
const TileID * m_tileID
Definition: FCS_StepInfoSD.h:127
constants.EME1
int EME1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:55
FCS_Param::Config::m_maxTimeFCAL
double m_maxTimeFCAL
Definition: FCS_StepInfoSD.h:60
FCS_Param::Config::m_maxPhiEM1
double m_maxPhiEM1
Definition: FCS_StepInfoSD.h:69
FCS_StepInfoSD::m_larEmID
const LArEM_ID * m_larEmID
Pointers to the identifier helpers.
Definition: FCS_StepInfoSD.h:124
FCS_Param::Config::m_maxRadiusLAr
double m_maxRadiusLAr
property, see LArG4GenShowerLib::LArG4GenShowerLib
Definition: FCS_StepInfoSD.h:52
CaloCell_ID_FCS::EME3
@ EME3
Definition: FastCaloSim_CaloCell_ID.h:26
FCS_Param::Config::m_maxTimeHEC
double m_maxTimeHEC
Definition: FCS_StepInfoSD.h:59
ISF_FCS_Parametrization::FCS_StepInfo
Definition: FCS_StepInfo.h:45
CaloCell_ID_FCS::HEC0
@ HEC0
Definition: FastCaloSim_CaloCell_ID.h:27
SG::ReadCondHandleKey< CaloDetDescrManager >
LArSamples::FCAL
@ FCAL
Definition: CaloId.h:26
Identifier::getString
std::string getString() const
Provide a string form of the identifier - hexadecimal.
Definition: Identifier.cxx:25
FCS_Param::Config::m_maxTimeLAr
double m_maxTimeLAr
Definition: FCS_StepInfoSD.h:58
CaloCell_ID_FCS::PreSamplerE
@ PreSamplerE
Definition: FastCaloSim_CaloCell_ID.h:23
CaloCell_ID_FCS::PreSamplerB
@ PreSamplerB
Definition: FastCaloSim_CaloCell_ID.h:19
CxxUtils::CachedPointer::get
pointer_t get() const
Return the current value of the element.
FCS_Param::Config::m_maxEtaEM2
double m_maxEtaEM2
Definition: FCS_StepInfoSD.h:72
CaloCell_ID_FCS::FCAL2
@ FCAL2
Definition: FastCaloSim_CaloCell_ID.h:42
FCS_StepInfoSD::m_config
FCS_Param::Config m_config
Definition: FCS_StepInfoSD.h:122
CaloCell_ID_FCS::HEC3
@ HEC3
Definition: FastCaloSim_CaloCell_ID.h:30
CaloCell_ID_FCS::FCAL0
@ FCAL0
Definition: FastCaloSim_CaloCell_ID.h:40
CaloCell_ID_FCS::EMB3
@ EMB3
Definition: FastCaloSim_CaloCell_ID.h:22
FCS_Param::Config::verboseLevel
int verboseLevel
Helper to keep the same verbosity everywhere.
Definition: FCS_StepInfoSD.h:44
FCS_Param::Config::m_maxRadiusFCAL
double m_maxRadiusFCAL
property, see LArG4GenShowerLib::LArG4GenShowerLib
Definition: FCS_StepInfoSD.h:54
FCS_Param::Config::m_maxPhiEM2
double m_maxPhiEM2
Definition: FCS_StepInfoSD.h:73
FCS_Param::Config::m_maxRadiusHEC
double m_maxRadiusHEC
property, see LArG4GenShowerLib::LArG4GenShowerLib
Definition: FCS_StepInfoSD.h:53
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56
match
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition: hcg.cxx:356
description
std::string description
glabal timer - how long have I taken so far?
Definition: hcg.cxx:88
FCS_Param::Config::m_maxEtaEM1
double m_maxEtaEM1
Definition: FCS_StepInfoSD.h:68
FCS_StepInfoSD::m_larFcalID
const LArFCAL_ID * m_larFcalID
Definition: FCS_StepInfoSD.h:125