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

#include <LArFCS_StepInfoSD.h>

Inheritance diagram for LArFCS_StepInfoSD:
Collaboration diagram for LArFCS_StepInfoSD:

Public Member Functions

 LArFCS_StepInfoSD (G4String a_name, const FCS_Param::Config &config)
 Constructor. More...
 
virtual ~LArFCS_StepInfoSD ()
 Destructor. More...
 
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

Identifier ConvertID (const LArG4Identifier &a_ident) const
 Helper function for making "real" identifiers from LArG4Identifiers. More...
 
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
 

Private Attributes

ILArCalculatorSvcm_calculator
 Member variable - the calculator we'll use. More...
 

Detailed Description

Definition at line 29 of file LArFCS_StepInfoSD.h.

Constructor & Destructor Documentation

◆ LArFCS_StepInfoSD()

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

Constructor.

Geant4 headers.

Athena headers

Definition at line 21 of file LArFCS_StepInfoSD.cxx.

22  : FCS_StepInfoSD(std::move(a_name), config)
24 {
25 }

◆ ~LArFCS_StepInfoSD()

LArFCS_StepInfoSD::~LArFCS_StepInfoSD ( )
virtual

Destructor.

Definition at line 27 of file LArFCS_StepInfoSD.cxx.

28 {
29 }

Member Function Documentation

◆ ConvertID()

Identifier LArFCS_StepInfoSD::ConvertID ( const LArG4Identifier a_ident) const
private

Helper function for making "real" identifiers from LArG4Identifiers.

Definition at line 266 of file LArFCS_StepInfoSD.cxx.

267 {
268  Identifier id;
269  if(a_ident[0]==4) {
270  // is LAr
271  if(a_ident[1]==1) {
272  //is LAr EM
273  try {
274  id = m_larEmID->channel_id(a_ident[2], // barrel_ec
275  a_ident[3], // sampling
276  a_ident[4], // region
277  a_ident[5], // eta
278  a_ident[6]); // phi
279  }
280  catch (LArID_Exception& e) {
281  G4ExceptionDescription description;
282  description << "ConvertID: LArEM_ID error code " << e.code() << " "
283  << (std::string) e;
284  G4Exception("LArFCS_StepInfoSD", "ConvertIDEM", FatalException, description);
285  abort();
286  }
287  }
288  else if(a_ident[1]==2) {
289  //is EM HEC
290  try {
291  id = m_larHecID->channel_id(a_ident[2], // zSide
292  a_ident[3], // sampling
293  a_ident[4], // region
294  a_ident[5], // eta
295  a_ident[6]); // phi
296  }
297  catch(LArID_Exception& e) {
298  G4ExceptionDescription description;
299  description << "ConvertID: LArHEC_ID error code " << e.code() << " "
300  << (std::string) e;
301  G4Exception("LArFCS_StepInfoSD", "ConvertIDHEC", FatalException, description);
302  abort();
303  }
304  }
305  else if(a_ident[1]==3) {
306  // FCAL
307  if(a_ident[3]>0) {
308  //is EM FCAL
309  try {
310  id = m_larFcalID->channel_id(a_ident[2], // zSide
311  a_ident[3], // sampling
312  a_ident[4], // eta
313  a_ident[5]); // phi
314  }
315  catch(LArID_Exception& e) {
316  G4ExceptionDescription description;
317  description << "ConvertID: LArFCAL_ID error code " << e.code() << " "
318  << (std::string) e;
319  G4Exception("LArFCS_StepInfoSD", "ConvertIDFCAL", FatalException, description);
320  abort();
321  }
322  }
323  else {
324  G4ExceptionDescription description;
325  description << "ConvertID: Unsupported ID. ";
326  G4Exception("LArFCS_StepInfoSD", "ConvertIDMiniFCAL", FatalException, description);
327  abort();
328  }
329  }
330  }
331  return id;
332 }

◆ EndOfAthenaEvent()

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

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 ( )
protectedinherited

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
inlineprivateinherited

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
inlineprivateinherited

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
inlineprivateinherited

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
inlineprivateinherited

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
inlineprivateinherited

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 LArFCS_StepInfoSD::ProcessHits ( G4Step *  a_step,
G4TouchableHistory *   
)
overridevirtual

Main processing method.

Reimplemented from FCS_StepInfoSD.

Definition at line 31 of file LArFCS_StepInfoSD.cxx.

32 {
33  G4bool result(false);
34  // If there's no energy, there's no hit. (Aside: Isn't this energy
35  // the same as the energy from the calculator? Not necessarily.
36  // The calculator may include detector effects such as
37  // charge-collection which are not modeled by Geant4.)
38  if(a_step->GetTotalEnergyDeposit() <= 0.) { return result; }
39 
40  if (m_calculator) {
41  if(!m_calo_dd_man.get()) {
43  }
44 
45  const double StepLength = a_step->GetStepLength()/ CLHEP::mm;
46  const G4ThreeVector preStepPosition = a_step->GetPreStepPoint()->GetPosition(); //pre step is the position we're interested in
47  const G4ThreeVector postStepPosition = a_step->GetPostStepPoint()->GetPosition();
48  std::vector<const G4Step*> steps;
49  bool madeSubSteps(false);
51  //create smaller substeps instead
52  G4int nsub_step=(int) (StepLength/m_config.substpsize) + 1;
53  G4double delta=1./((double) nsub_step);
54  //G4cout <<"Orig prestep: "<<preStepPosition<<std::endl;
55  for (G4int i=0;i<nsub_step;i++) {
56  G4double fraction1 = ((G4double) i)*delta;
57  G4double fraction2 = (((G4double) i) + 1.)*delta;
58  G4ThreeVector subpoint1=preStepPosition*(1-fraction1) + postStepPosition*fraction1;
59  G4ThreeVector subpoint2=preStepPosition*(1-fraction2) + postStepPosition*fraction2;
60  G4StepPoint *startpoint = new G4StepPoint(*(a_step->GetPreStepPoint()));
61  G4StepPoint *endpoint = new G4StepPoint(*(a_step->GetPostStepPoint()));
62  startpoint->SetPosition(subpoint1);
63  endpoint->SetPosition(subpoint2);
64 
65  G4Step* newstep = new G4Step(*a_step);
66  newstep->SetPreStepPoint(startpoint);
67  newstep->SetPostStepPoint(endpoint);
68  newstep->SetStepLength( (subpoint1-subpoint2).mag());
69  newstep->SetTotalEnergyDeposit(a_step->GetTotalEnergyDeposit()/nsub_step);
70  steps.push_back(newstep);
71  madeSubSteps=true;
72  }
73  }
74  else {
75  steps.push_back(a_step);
76  }
77 
78  if (m_config.verboseLevel > 4) {
79  G4cout <<"LArFCS_StepInfoSD::ProcessHits(): original step in Volume: "<<
80  a_step->GetPreStepPoint()->GetPhysicalVolume()->GetName()<<
81  " position: "<<a_step->GetPreStepPoint()->GetPosition()<<" Length="<<a_step->GetStepLength()/CLHEP::mm<<
82  " E="<<a_step->GetTotalEnergyDeposit()<<G4endl;
83  std::vector<LArHitData> processedHits;
84  if (m_calculator->Process(a_step, processedHits)) {
85  if (m_config.verboseLevel > -1) {
86  G4cout <<" #LArHitData="<<processedHits.size();
87  for(const auto& lhd:processedHits) {
88  G4cout <<" ; id="<<(std::string)lhd.id<<" E="<<lhd.energy<<G4endl;
89  }
90  G4cout << G4endl;
91  }
92  }
93  G4cout <<"LArFCS_StepInfoSD::ProcessHits(): #substep="<< steps.size()<<G4endl;
94  }
95 
96  double et_all=0; // Total collected charge in all substeps
97  for (const G4Step* substep : steps) {
98  double et(0.); // Total collected charge in this substep
99  G4ThreeVector stepPosition = 0.5*(substep->GetPreStepPoint()->GetPosition()+substep->GetPostStepPoint()->GetPosition());
100  std::vector<LArHitData> processedHits;
101  if (m_config.verboseLevel > 4) {
102  G4cout <<" LArFCS_StepInfoSD::ProcessHits(): substep in Volume: "<<
103  substep->GetPreStepPoint()->GetPhysicalVolume()->GetName()<<
104  " position: "<<substep->GetPreStepPoint()->GetPosition()<<" Length="<<substep->GetStepLength()/CLHEP::mm<<
105  " E="<<substep->GetTotalEnergyDeposit()<<G4endl;
106  }
107  if (m_calculator->Process(substep, processedHits)) {
108  for (const auto& larhit: processedHits) {
109  et += larhit.energy;
110  et_all += larhit.energy;
111  }
112  if (m_config.verboseLevel > 4) {
113  G4cout <<" substep #LArHitData="<<processedHits.size();
114  for(const auto& lhd:processedHits) {
115  G4cout <<" ; id="<<(std::string)lhd.id<<" E="<<lhd.energy<<G4endl;
116  }
117  G4cout << G4endl;
118  }
119  } else {
120  if (m_config.verboseLevel > 4) {
121  //Maybe 0 hits or something like that...
122  G4cout << this->GetName()<<" WARNING ProcessHits: Call to ILArCalculatorSvc::Process failed! Details:" << G4endl
123  << " " << "Volume: "<< a_step->GetPreStepPoint()->GetPhysicalVolume()->GetName()<<" "<<m_calculator<< " position: "<<stepPosition<<" SL: "<<StepLength<<G4endl
124  << " " << "Orig position: "<<substep->GetPreStepPoint()->GetPosition()<<" / "<<substep->GetPostStepPoint()->GetPosition()<<G4endl
125  << " " << "StepLength: "<<StepLength<<" step: "<<preStepPosition<<" / "<<postStepPosition<<G4endl;
126  }
127  continue;
128  }
129 
130  // drop hits with zero deposited energy (could still happen with negative corrections from calculator)
131  //Or if total energy is <0
132  if (et <= 0.) {
133  if (m_config.verboseLevel > 4) {
134  G4cout << this->GetName()<<" WARNING ProcessHits: Total negative energy: " << et << " not processing..." << G4endl;
135  }
136  continue;
137  }
138 
139  const size_t numberOfProcessedHits = processedHits.size();
140  const G4ThreeVector originalStepPosition = stepPosition;
141  double maxSubHitEnergy = -999.;
142  int maxSubHitEnergyindex =-1;
143  if (numberOfProcessedHits>0) {
144  maxSubHitEnergy = processedHits[0].energy;
145  maxSubHitEnergyindex = 0;
146  }
147  //Figure out the subhit with most energy
148  for (size_t i=1; i<numberOfProcessedHits; ++i) {
149  if (maxSubHitEnergy<processedHits[i].energy) {
150  maxSubHitEnergy = processedHits[i].energy;
151  maxSubHitEnergyindex = i;
152  }
153  }
154  if (maxSubHitEnergyindex == -1){//because there were no hits; numberOfProcessedHits ==0
155  G4cout << this->GetName()<<" WARNING ProcessHits: numberOfProcessedHits is zero" << G4endl;
156  continue;
157  }
158  //Identifier for the subhit with max energy
159  Identifier maxEnergyIdentifier = this->ConvertID(processedHits[maxSubHitEnergyindex].id);
160  const CaloDetDescrElement *maxEnergyCell = m_calo_dd_man.get()->get_element(maxEnergyIdentifier);
161 
162  Identifier invalidIdentifier;
163  //for (size_t i=0; i<numberOfProcessedHits; ++i) {
164  for (const auto& larhit: processedHits) {
165  Identifier id = this->ConvertID(larhit.id);
166  if(larhit.id[0]==10) {
167  if(m_config.verboseLevel > 9) {
168  G4cout << this->GetName()<<" VERBOSE ProcessHits: Dead Material LArG4Identifier: "<<(std::string) larhit.id<<G4endl
169  <<" "<<id<<G4endl
170  <<" "<<id.getString()<<G4endl
171  <<" "<< a_step->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName()<<G4endl
172  <<" numberOfProcessedHits: "<<numberOfProcessedHits<<G4endl;
173  G4cout <<" "<<invalidIdentifier<<G4endl;
174  }
175  }
176  else if (id == invalidIdentifier) {
177  G4cout << this->GetName()<<" WARNING ProcessHits: Something wrong with LArG4Identifier: "<<(std::string) larhit.id<<G4endl
178  <<" "<<id<<G4endl
179  <<" "<<id.getString()<<G4endl
180  <<" "<< a_step->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName()<<G4endl
181  <<" numberOfProcessedHits: "<<numberOfProcessedHits<<G4endl;
182  G4cout <<" "<<invalidIdentifier<<G4endl;
183  }
184  //need to get the cell information
185  if (numberOfProcessedHits>1) {
186  if (!m_larEmID->is_em_barrel(id)) {
187  //It didn't seem to happen outside em_barrel, so flag up if it does:
188  G4cout << this->GetName()<<" WARNING ProcessHits: Outside LAr barrel, but numberOfProcessedHits="<<numberOfProcessedHits
189  <<", LArG4Identifier: "<<(std::string) larhit.id<<G4endl;
190  }
191  else {
193  //find subhit with largest energy
194  if (maxSubHitEnergyindex == -1) {
195  G4cout << this->GetName()<<" WARNING ProcessHits: no subhit index with e>-999??? "<<G4endl;
196  continue;
197  }
198  if(m_config.verboseLevel > 9) {
199  G4cout << this->GetName()<<" VERBOSE ProcessHits: shifting subhits: largest energy subhit index is "<<maxSubHitEnergyindex<<" E: "<<maxSubHitEnergy<<" identifier: "<<maxEnergyIdentifier.getString()<<G4endl;
200  }
201  //from identifier
202  const CaloDetDescrElement *thiscell = m_calo_dd_man.get()->get_element(id);
203  if (!maxEnergyCell) {
204  //How often does this happen? Do not shift.
205  G4cout << this->GetName()<<" WARNING ProcessHits: maxEnergyCell failed: "<<maxEnergyIdentifier.getString()<<G4endl
206  <<" "<<m_calo_dd_man.get()->get_element(id)->getSampling()<<G4endl
207  <<" "<<originalStepPosition.eta()<<G4endl
208  <<" "<< originalStepPosition.phi()<<G4endl;
209  stepPosition = originalStepPosition;
210  }
211  else if (maxEnergyCell == thiscell) {
212  //The cells match, so do not shift this hit.
213  if(m_config.verboseLevel > 9) {
214  G4cout << this->GetName()<<" VERBOSE ProcessHits: Original step position: "<<originalStepPosition.x()<<" "<<originalStepPosition.y()<<" "<<originalStepPosition.z()<<G4endl
215  <<" "<<"This cell: "<<thiscell->x()<<" "<<thiscell->y()<<" "<<thiscell->z()<<G4endl
216  <<" "<<"No shift"<<G4endl;
217  }
218  stepPosition = originalStepPosition;
219  }
220  else {
221  //the two cells do not match => shift
222  G4ThreeVector diff(thiscell->x()-maxEnergyCell->x(), thiscell->y()-maxEnergyCell->y(), thiscell->z()-maxEnergyCell->z());
223  stepPosition = originalStepPosition+diff;
224  if(m_config.verboseLevel > 9) {
225  const CaloDetDescrElement *bestcell = m_calo_dd_man.get()->get_element(m_calo_dd_man.get()->get_element(id)->getSampling(),originalStepPosition.eta(), originalStepPosition.phi());
226  G4cout << this->GetName()<<" VERBOSE ProcessHits: Original step position: "<<originalStepPosition.x()<<" "<<originalStepPosition.y()<<" "<<originalStepPosition.z()<<G4endl
227  <<" "<<"This cell: "<<thiscell->x()<<" "<<thiscell->y()<<" "<<thiscell->z()<<G4endl
228  <<" "<<"Highest E cell: "<<maxEnergyCell->x()<<" "<<maxEnergyCell->y()<<" "<<maxEnergyCell->z()<<G4endl
229  <<" "<<"(Best cell: "<<bestcell->x()<<" "<<bestcell->y()<<" "<<bestcell->z()<<")"<<G4endl
230  <<" "<<"Shifted step position: "<<stepPosition.x()<<" "<<stepPosition.y()<<" "<<stepPosition.z()<<G4endl;
231  }
232  }
233  }
234  }
235  }
236  //Finalize time for LAr hits?: NO
237  //double time = larhit.energy)==0 ? 0. : (double) larhit.time/larhit.energy/CLHEP::ns;
238  double time = larhit.time;
239  double energy = larhit.energy/CLHEP::MeV;
240  // Drop any hits that don't have a good identifier attached
241  if (!m_calo_dd_man.get()->get_element(id)) {
242  if(m_config.verboseLevel > 4) {
243  G4cout<<this->GetName()<<" DEBUG update_map: bad identifier: "<<id.getString()<<" skipping this hit."<<G4endl;
244  }
245  continue;
246  }
247  // Get the appropriate merging limits
248  const CaloCell_ID::CaloSample& layer = m_calo_dd_man.get()->get_element(id)->getSampling();
249  const double timeWindow(m_config.m_maxTime);
250  const double distanceWindow((layer == CaloCell_ID::EMB1 || layer == CaloCell_ID::EME1) ? m_config.m_maxRadiusFine : m_config.m_maxRadius); //Default 1mm merging in layers 1 & 5, 5mm merging elsewhere
251  this->update_map(stepPosition, id, energy, time, true, numberOfProcessedHits, timeWindow, distanceWindow); //store numberOfProcessedHits as info
252  }//numberOfProcessedHits
253  } //istep
254  if (madeSubSteps) {
255  //only delete steps when doing substeps. Do not delete the original G4Step!
256  while(!steps.empty()) { delete steps.back(); steps.pop_back(); }
257  }
258  if (m_config.verboseLevel > 4) {
259  G4cout <<"LArFCS_StepInfoSD::ProcessHits(): Etotal substeps="<<et_all<<G4endl<<G4endl<<G4endl;
260  }
261  }
262 
263  return result;
264 }

◆ setupHelpers()

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

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 
)
protectedinherited

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_calculator

ILArCalculatorSvc* LArFCS_StepInfoSD::m_calculator
private

Member variable - the calculator we'll use.

Definition at line 47 of file LArFCS_StepInfoSD.h.

◆ m_calo_dd_man

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

Definition at line 128 of file FCS_StepInfoSD.h.

◆ m_config

FCS_Param::Config FCS_StepInfoSD::m_config
protectedinherited

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
protectedinherited

Definition at line 129 of file FCS_StepInfoSD.h.

◆ m_larEmID

const LArEM_ID* FCS_StepInfoSD::m_larEmID {nullptr}
protectedinherited

Pointers to the identifier helpers.

Definition at line 124 of file FCS_StepInfoSD.h.

◆ m_larFcalID

const LArFCAL_ID* FCS_StepInfoSD::m_larFcalID {nullptr}
protectedinherited

Definition at line 125 of file FCS_StepInfoSD.h.

◆ m_larHecID

const LArHEC_ID* FCS_StepInfoSD::m_larHecID {nullptr}
protectedinherited

Definition at line 126 of file FCS_StepInfoSD.h.

◆ m_tileID

const TileID* FCS_StepInfoSD::m_tileID {nullptr}
protectedinherited

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
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
FCS_StepInfoSD::update_map
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)
Definition: FCS_StepInfoSD.cxx:158
et
Extra patterns decribing particle interation process.
LArSamples::HEC
@ HEC
Definition: CaloId.h:26
FCS_Param::Config::m_maxEtaEM3
double m_maxEtaEM3
Definition: FCS_StepInfoSD.h:76
get_generator_info.result
result
Definition: get_generator_info.py:21
LArFCS_StepInfoSD::m_calculator
ILArCalculatorSvc * m_calculator
Member variable - the calculator we'll use.
Definition: LArFCS_StepInfoSD.h:47
constants.EMB1
int EMB1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:53
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
CaloDetDescrElement::y
float y() const
cell y
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:365
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
xAOD::et
et
Definition: TrigEMCluster_v1.cxx:25
LArFCS_StepInfoSD::ConvertID
Identifier ConvertID(const LArG4Identifier &a_ident) const
Helper function for making "real" identifiers from LArG4Identifiers.
Definition: LArFCS_StepInfoSD.cxx:266
FCS_StepInfoSD::getCaloDDManager
void getCaloDDManager()
Keep a map instead of trying to keep the full vector.
Definition: FCS_StepInfoSD.cxx:145
FCS_Param::Config::m_maxRadius
double m_maxRadius
property, see LArG4GenShowerLib::LArG4GenShowerLib
Definition: FCS_StepInfoSD.h:50
ILArCalculatorSvc::Process
virtual G4bool Process(const G4Step *, std::vector< LArHitData > &) const =0
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
python.SystemOfUnits.MeV
int MeV
Definition: SystemOfUnits.py:154
skel.it
it
Definition: skel.GENtoEVGEN.py:396
FCS_StepInfoSD::getMaxTime
double getMaxTime(const CaloCell_ID::CaloSample &layer) const
Definition: FCS_StepInfoSD.cxx:39
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
FCS_Param::Config::shift_lar_subhit
bool shift_lar_subhit
Definition: FCS_StepInfoSD.h:45
FCS_Param::Config::m_LArCalculator
ILArCalculatorSvc * m_LArCalculator
Definition: FCS_StepInfoSD.h:80
FCS_StepInfoSD::m_calo_dd_man
CxxUtils::CachedPointer< const CaloDetDescrManager > m_calo_dd_man
Definition: FCS_StepInfoSD.h:128
FCS_Param::Config::m_maxRadiusFine
double m_maxRadiusFine
property, see LArG4GenShowerLib::LArG4GenShowerLib
Definition: FCS_StepInfoSD.h:51
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
LArEM_Base_ID::channel_id
Identifier channel_id(const ExpandedIdentifier &exp_id) const
Build a cell identifier from an expanded identifier.
FCS_Param::Config::substpsize
double substpsize
Definition: FCS_StepInfoSD.h:47
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_StepInfoSD::FCS_StepInfoSD
FCS_StepInfoSD(G4String a_name, const FCS_Param::Config &config)
Constructor.
Definition: FCS_StepInfoSD.cxx:23
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
beamspotman.steps
int steps
Definition: beamspotman.py:505
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
Ringer::EM
@ EM
Definition: CaloRingsDefs.h:19
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
lumiFormat.i
int i
Definition: lumiFormat.py:85
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
LArFCAL_Base_ID::channel_id
Identifier channel_id(const ExpandedIdentifier &exp_id) const
cell identifier for a channel from ExpandedIdentifier
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
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
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
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
CaloCell_ID_FCS::EME3
@ EME3
Definition: FastCaloSim_CaloCell_ID.h:26
LArHEC_Base_ID::channel_id
Identifier channel_id(const ExpandedIdentifier &exp_id) const
channel identifier for a channel from ExpandedIdentifier
FCS_Param::Config::m_maxTimeHEC
double m_maxTimeHEC
Definition: FCS_StepInfoSD.h:59
ISF_FCS_Parametrization::FCS_StepInfo
Definition: FCS_StepInfo.h:45
CaloDetDescrElement::x
float x() const
cell x
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:363
CaloCell_ID_FCS::HEC0
@ HEC0
Definition: FastCaloSim_CaloCell_ID.h:27
SG::ReadCondHandleKey< CaloDetDescrManager >
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
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
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
LArEM_Base_ID::is_em_barrel
bool is_em_barrel(const Identifier id) const
test if the id belongs to the EM barrel
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
CaloDetDescrElement::z
float z() const
cell z
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:367
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
Trk::StepLength
@ StepLength
Definition: MaterialAssociationType.h:17
FCS_Param::Config::shorten_lar_step
bool shorten_lar_step
Definition: FCS_StepInfoSD.h:46
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
G4StepHelper::preStepPosition
G4ThreeVector preStepPosition(const G4Step *theStep)
TODO.
Definition: StepHelper.cxx:14
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:26
FCS_Param::Config::m_maxRadiusHEC
double m_maxRadiusHEC
property, see LArG4GenShowerLib::LArG4GenShowerLib
Definition: FCS_StepInfoSD.h:53
LArID_Exception
Exception class for LAr Identifiers.
Definition: LArID_Exception.h:20
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
G4StepHelper::postStepPosition
G4ThreeVector postStepPosition(const G4Step *theStep)
TODO.
Definition: StepHelper.cxx:19
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
Identifier
Definition: IdentifierFieldParser.cxx:14