ATLAS Offline Software
Loading...
Searching...
No Matches
Rec::MuidCaloEnergyMeas Class Reference

#include <MuidCaloEnergyMeas.h>

Inheritance diagram for Rec::MuidCaloEnergyMeas:
Collaboration diagram for Rec::MuidCaloEnergyMeas:

Public Member Functions

 MuidCaloEnergyMeas (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~MuidCaloEnergyMeas ()
StatusCode initialize () override
StatusCode finalize () override
std::unique_ptr< CaloMeasenergyMeasurement (const EventContext &ctx, double etaEM, double phiEM, double etaHad, double phiHad) const override
 IMuidCaloEnergyMeas interface: get the muon energy loss measurement from the calorimeter, knowing the track intersection at the em and had cals.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()
 AlgTool and IAlgTool interface methods.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

enum  SubCaloId { TILE = 0 , LARHEC = 1 , LAREM = 2 }
 Helper enum to select which cells should be read from the container. More...
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

void energyInCalo (CaloMeas &caloMeas, const CaloCellContainer *cellContainer, const CaloDetDescrManager *detMgr, const CaloNoise *noiseCDO, double eta, double phi, int iSubCalo) const
void isolationEnergy (CaloMeas &caloMeas, const CaloCellContainer *cellContainer, const CaloDetDescrManager *detMgr, const CaloNoise *noiseCDO, double eta, double phi, int iSubCalo) const
double energyInTile (const CaloCellContainer *cellContainer, const CaloDetDescrManager *detMgr, const CaloNoise *noiseCDO, double eta, double phi, int, int) const
double energyInLArHEC (const CaloCellContainer *cellContainer, const CaloDetDescrManager *detMgr, const CaloNoise *noiseCDO, double eta, double phi, int, int) const
double energyInLArEM (const CaloCellContainer *cellContainer, const CaloDetDescrManager *detMgr, const CaloNoise *noiseCDO, double eta, double phi, int, int) const
int cellCounting (const CaloCellContainer *cellContainer, const CaloDetDescrManager *detMgr, const CaloNoise *noiseCDO, double eta, double phi) const
int samplingID (const CaloCell *cell, int iSubCalo) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadCondHandleKey< CaloNoisem_noiseCDOKey
ToolHandle< IMuidCaloEnergyParamm_caloParamTool
const TileIDm_tileID
const LArEM_IDm_emID
const LArHEC_IDm_hecID
SG::ReadHandleKey< CaloCellContainerm_cellContainerLocation
SG::ReadCondHandleKey< CaloDetDescrManagerm_caloMgrKey {this,"CaloDetDescrManager", "CaloDetDescrManager"}
double m_measurementConeTile
double m_measurementConeLArHEC
double m_measurementConeLArEM
double m_isolationConeTile
double m_isolationConeLArHEC
double m_isolationConeLArEM
double m_sigmasAboveNoise
double m_sigmasAboveNoiseCore
std::atomic_int m_totalCoreCellsEM {0}
std::atomic_int m_totalCoreCellsHEC {0}
std::atomic_int m_totalCoreCellsTile {0}
std::atomic_int m_totalSelectedEM {0}
std::atomic_int m_totalSelectedHEC {0}
std::atomic_int m_totalSelectedTile {0}
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 44 of file MuidCaloEnergyMeas.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ SubCaloId

Helper enum to select which cells should be read from the container.

Enumerator
TILE 
LARHEC 
LAREM 

Definition at line 61 of file MuidCaloEnergyMeas.h.

Constructor & Destructor Documentation

◆ MuidCaloEnergyMeas()

MuidCaloEnergyMeas::MuidCaloEnergyMeas ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 35 of file MuidCaloEnergyMeas.cxx.

35 :
36 AthAlgTool(type, name, parent),
37 m_tileID(nullptr),
38 m_emID(nullptr),
39 m_hecID(nullptr),
42 declareInterface<IMuidCaloEnergyMeas>(this);
43 declareProperty("NoiseThresInSigmas", m_sigmasAboveNoise);
44 declareProperty("NoiseThresInSigmasCore", m_sigmasAboveNoiseCore);
45
52 }
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ ~MuidCaloEnergyMeas()

MuidCaloEnergyMeas::~MuidCaloEnergyMeas ( )
virtualdefault

Member Function Documentation

◆ cellCounting()

int MuidCaloEnergyMeas::cellCounting ( const CaloCellContainer * cellContainer,
const CaloDetDescrManager * detMgr,
const CaloNoise * noiseCDO,
double eta,
double phi ) const
private

Definition at line 140 of file MuidCaloEnergyMeas.cxx.

141 {
142 // int isubcalo = 2;
143 constexpr double lowest_threshold = 4 * 50.;
144
146 CaloCellList myList(detMgr,cellContainer, iCalo); // Construct the list
147 myList.select(mu_eta, mu_phi, 0.2, 0.2);
148
149 int count = 0;
150 for (const CaloCell* cell : myList) {
151 const double cellEnergy = cell->energy();
152 const double noise_rms = noiseCDO->getNoise(cell->ID(), cell->gain());
153
154 if (cellEnergy > lowest_threshold && cellEnergy > noise_rms * m_sigmasAboveNoise) { count += 1; }
155 }
156
157 ATH_MSG_DEBUG(" counted " << count << " cells over threshold out of a total of " << myList.ncells() << " cells");
158
159 return count;
160 }
#define ATH_MSG_DEBUG(x)
CaloCell_Base_ID::SUBCALO SUBCALO
Definition CaloCell_ID.h:50
float getNoise(const IdentifierHash h, const int gain) const
Accessor by IdentifierHash and gain.
Definition CaloNoise.h:34
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ energyInCalo()

void MuidCaloEnergyMeas::energyInCalo ( CaloMeas & caloMeas,
const CaloCellContainer * cellContainer,
const CaloDetDescrManager * detMgr,
const CaloNoise * noiseCDO,
double eta,
double phi,
int iSubCalo ) const
private

Definition at line 174 of file MuidCaloEnergyMeas.cxx.

175 {
176 /* -------------------------------------------
177 Tile Cal
178 sample_number
179 0 --> Sampling 1
180 1 --> Sampling 2
181 2 --> Sampling 3
182 3 --> ITC
183 ===========================================
184 LarHEC calorimeter
185 sample_number
186 0 --> Sampling 1
187 1 --> Sampling 2
188 2 --> Sampling 3
189 3 --> Sampling 4
190 ===========================================
191 LarEM calorimeter
192 sample_number
193 0 --> Presampler
194 1 --> Sampling 1
195 2 --> Sampling 2
196 3 --> Sampling 3
197 leadingEnergy is contribution from presampler and first compartment
198 -------------------------------------------*/
199
200 double totalEnergy = 0.;
201 double leadingEnergy = 0.;
202 std::unique_ptr<CaloCellList> myList = nullptr;
203
204 if (isubcalo == SubCaloId::TILE) {
206 myList = std::make_unique<CaloCellList>(detMgr,cellContainer, iCalo);
207 myList->select(muEta, muPhi, m_measurementConeTile, m_measurementConeTile);
208 } else if (isubcalo == SubCaloId::LARHEC) {
210 myList = std::make_unique<CaloCellList>(detMgr,cellContainer, iCalo);
211 myList->select(muEta, muPhi, m_measurementConeLArHEC, m_measurementConeLArHEC);
212 } else if (isubcalo == SubCaloId::LAREM) {
214 myList = std::make_unique<CaloCellList>(detMgr,cellContainer, iCalo);
215 myList->select(muEta, muPhi, m_measurementConeLArEM, m_measurementConeLArEM);
216 }
217
218 int countCoreCells = 0;
219 int countSelected = 0;
220 bool compartment[4] = {false, false, false, false};
221 double measuredSamplings = 0.;
222
223 if (myList && myList->ncells()) {
224 // get last cell (as CaloCellList->back() method doesn't work)
225 const CaloCell* lastCell = *(myList->end() - 1);
226
227 // flag core in each sampling
228 for (int coreSampling = 0; coreSampling != 4; ++coreSampling) {
229 const CaloCell* coreCell = nullptr;
230 double coreRadius = 0.;
231 for (const CaloCell* cell : *myList) {
232 int sampling = samplingID(cell, isubcalo);
233
234 if (cell != lastCell && sampling != coreSampling) continue;
235
236 const double deltaEta = cell->eta() - muEta;
237 const double deltaPhi = xAOD::P4Helpers::deltaPhi(cell->phi(), muPhi);
238 const double radius = deltaEta * deltaEta + deltaPhi * deltaPhi;
239
240 if (sampling == coreSampling) {
241 if (!coreCell || radius < coreRadius) {
242 coreCell = cell;
243 coreRadius = radius;
244 }
245 }
246
247 if (cell != lastCell || !coreCell) continue;
248
249 for (const CaloCell* cell2 : *myList) {
250 sampling = samplingID(cell2, isubcalo);
251 if (sampling != coreSampling) continue;
252
253 double cellEnergy = cell2->energy();
254 double noiseRms = noiseCDO->getNoise(cell2->ID(), cell2->gain());
255
256 // looser selection for core cell where at least mip is expected
257 bool cellSelected = cellEnergy > m_sigmasAboveNoise * noiseRms;
258 if (cell2 == coreCell && cellEnergy > m_sigmasAboveNoiseCore * noiseRms) cellSelected = true;
259
260 if (cellSelected) {
261 ++countSelected;
262 totalEnergy += cellEnergy;
263 compartment[coreSampling] = true;
264 if (coreSampling < 2) leadingEnergy += cellEnergy;
265 }
266 if (cell2 == coreCell) {
267 ++countCoreCells;
268 if (isubcalo == SubCaloId::TILE) {
270 if (cellSelected) ++m_totalSelectedTile;
271 } else if (isubcalo == SubCaloId::LARHEC) {
273 if (cellSelected) ++m_totalSelectedHEC;
274 } else if (isubcalo == SubCaloId::LAREM) {
276 if (cellSelected) ++m_totalSelectedEM;
277 }
278 }
279 if (msgLvl(MSG::DEBUG)) {
280 std::string info = "";
281 std::string type = " Tile ";
282 if (isubcalo == SubCaloId::LARHEC) {
283 type = " LArHEC";
284 } else if (isubcalo == SubCaloId::LAREM) {
285 type = " EM ";
286 }
287 if (cellSelected && cell2 == coreCell) {
288 info = " selected core cell# ";
289 } else if (cellSelected) {
290 info = " selected cell# ";
291 } else if (cell2 == coreCell) {
292 info = " cell in core NOT selected";
293 }
294
295 if (info.empty()) {
296 ATH_MSG_VERBOSE(std::setiosflags(std::ios::fixed)
297 << type << " Sampling: " << std::setw(1) << coreSampling << " Radius :" << std::setw(6)
298 << std::setprecision(0) << cell2->caloDDE()->r() << " Eta : " << std::setw(6)
299 << std::setprecision(2) << cell2->eta() << " Phi : " << std::setw(6) << std::setprecision(2)
300 << cell2->phi() << " Noise level : " << std::setw(6) << std::setprecision(0) << noiseRms
301 << " Energy : " << std::setw(7) << std::setprecision(0) << cell2->energy() << info);
302 } else if (cellSelected) {
303 ATH_MSG_DEBUG(std::setiosflags(std::ios::fixed)
304 << type << " Sampling: " << std::setw(1) << coreSampling << " Radius :" << std::setw(6)
305 << std::setprecision(0) << cell2->caloDDE()->r() << " Eta : " << std::setw(6)
306 << std::setprecision(2) << cell2->eta() << " Phi : " << std::setw(6) << std::setprecision(2)
307 << cell2->phi() << " Noise level : " << std::setw(6) << std::setprecision(0) << noiseRms
308 << " Energy : " << std::setw(7) << std::setprecision(0) << cell2->energy() << info
309 << countSelected);
310 } else {
311 ATH_MSG_DEBUG(std::setiosflags(std::ios::fixed)
312 << type << " Sampling: " << std::setw(1) << coreSampling << " Radius :" << std::setw(6)
313 << std::setprecision(0) << cell2->caloDDE()->r() << " Eta : " << std::setw(6)
314 << std::setprecision(2) << cell2->eta() << " Phi : " << std::setw(6) << std::setprecision(2)
315 << cell2->phi() << " Noise level : " << std::setw(6) << std::setprecision(0) << noiseRms
316 << " Energy : " << std::setw(7) << std::setprecision(0) << cell2->energy() << info);
317 }
318 }
319 }
320 }
321 }
322
323 if (msgLvl(MSG::DEBUG)) {
324 std::string info = "";
325 std::string type = " Tile ";
326 if (isubcalo == SubCaloId::LARHEC) {
327 type = " LArHEC";
328 } else if (isubcalo == SubCaloId::LAREM) {
329 type = " EM ";
330 }
331
332 ATH_MSG_DEBUG(type << " at eta = " << muEta << " : selected " << countSelected << " from measured cone with "
333 << countCoreCells << " cells forming core");
334 }
335
336 for (int i = 0; i < 4; ++i)
337 if (compartment[i]) measuredSamplings += m_caloParamTool->caloCompartmentDepth(isubcalo, i);
338
339 // store result in caloMeas
340 if (isubcalo == SubCaloId::TILE) {
341 caloMeas.Tile_EnergyMeasured(totalEnergy);
342 caloMeas.Tile_SamplingFraction(measuredSamplings);
343 } else if (isubcalo == SubCaloId::LARHEC) {
344 caloMeas.LArHEC_EnergyMeasured(totalEnergy);
345 caloMeas.LArHEC_SamplingFraction(measuredSamplings);
346 } else if (isubcalo == SubCaloId::LAREM) {
347 caloMeas.LArEM_EnergyMeasured(totalEnergy);
348 caloMeas.LArEM_FirstCompartmentEnergy(leadingEnergy);
349 caloMeas.LArEM_SamplingFraction(measuredSamplings);
350 }
351 }
352 }
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
#define ATH_MSG_VERBOSE(x)
bool msgLvl(const MSG::Level lvl) const
std::atomic_int m_totalCoreCellsEM
std::atomic_int m_totalSelectedTile
std::atomic_int m_totalCoreCellsHEC
std::atomic_int m_totalCoreCellsTile
std::atomic_int m_totalSelectedEM
std::atomic_int m_totalSelectedHEC
ToolHandle< IMuidCaloEnergyParam > m_caloParamTool
int samplingID(const CaloCell *cell, int iSubCalo) const
double deltaEta(const I4Momentum &p1, const I4Momentum &p2)
Computes efficiently .
Definition P4Helpers.h:66
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[

◆ energyInLArEM()

double MuidCaloEnergyMeas::energyInLArEM ( const CaloCellContainer * cellContainer,
const CaloDetDescrManager * detMgr,
const CaloNoise * noiseCDO,
double eta,
double phi,
int sample,
int cone ) const
private

Definition at line 527 of file MuidCaloEnergyMeas.cxx.

528 {
529 // Look in the LarEM calorimeter
530 // i.e. loop over its cells
531 /*
532 sample_number
533 0 --> Presampler
534 1 --> Sampling 1
535 2 --> Sampling 2
536 3 --> Sampling 3
537 */
538
539 // int i,j,k;
540 double emTotalEnergy = 0.;
541
543 CaloCellList myList(detMgr, cellContainer, iCalo); // Construct the list
544 if (cone == SubCaloId::LARHEC) {
545 myList.select(mu_eta, mu_phi, 0.075, 0.075); // 0.1 0.1
546 } else if (cone == SubCaloId::LAREM) {
547 myList.select(mu_eta, mu_phi, 0.15, 0.15);
548 } else {
549 myList.select(mu_eta, mu_phi, 0., 0.);
550 }
551
552 // std::vector<const CaloCell*> new_cell_list;
553 int count = 0;
554
555 double lowest_threshold = 4. * 50.;
556
557 for (const CaloCell* cell : myList) {
558 double cellEnergy = cell->energy();
559 const double noise_rms = noiseCDO->getNoise(cell->ID(), cell->gain());
560
561 if (cellEnergy > lowest_threshold && cellEnergy > noise_rms * m_sigmasAboveNoise && m_emID->sampling(cell->ID()) == sample) {
562 count += 1;
563 // new_cell_list.push_backcell;
564
565 ATH_MSG_DEBUG("Energy : " << cell->energy() << " Sampling: " << m_emID->sampling(cell->ID())
566 << " Radius :" << cell->caloDDE()->r() << " z :" << cell->caloDDE()->z()
567 << " Eta : " << cell->eta() << " Phi : " << cell->phi() << " Noise Level : " << noise_rms);
568
569 emTotalEnergy += cell->energy();
570 }
571 }
572
573 ATH_MSG_DEBUG("larem counted " << count);
574
575 return emTotalEnergy;
576 }

◆ energyInLArHEC()

double MuidCaloEnergyMeas::energyInLArHEC ( const CaloCellContainer * cellContainer,
const CaloDetDescrManager * detMgr,
const CaloNoise * noiseCDO,
double eta,
double phi,
int sample,
int cone ) const
private

Definition at line 477 of file MuidCaloEnergyMeas.cxx.

478 {
479 // Look in the LarHEC calorimeter
480 // i.e. loop over its cells
481 /* sample_number
482 0 --> Sampling 1
483 1 --> Sampling 2
484 2 --> Sampling 3
485 3 --> Sampling 4
486 */
487
488 // int i,j,k;
489
490 // SG::ReadCondHandle<CaloNoise> noiseHdl{m_noiseCDOKey};
491 // const CaloNoise* noiseCDO = *noiseHdl;
492 double larhecTotal = 0.;
493
495 CaloCellList myList(detMgr, cellContainer, iCalo); // Construct the list
496 if (cone == SubCaloId::LARHEC) {
497 myList.select(mu_eta, mu_phi, 0.15, 0.15);
498 } else if (cone == SubCaloId::LAREM) {
499 myList.select(mu_eta, mu_phi, 0.3, 0.3);
500 } else {
501 myList.select(mu_eta, mu_phi, 0., 0.);
502 }
503
504 int count = 0;
505 constexpr double lowest_threshold = 4. * 150.;
506
507 for (const CaloCell* cell : myList) {
508 double cellEnergy = cell->energy();
509 const double noise_rms = noiseCDO->getNoise(cell->ID(), cell->gain());
510 if (cellEnergy > lowest_threshold && cellEnergy > noise_rms * m_sigmasAboveNoise && m_hecID->sampling(cell->ID()) == sample) {
511 count += 1;
512 // new_cell_list.push_backcell;
513
514 ATH_MSG_DEBUG("Energy : " << cell->energy() << " Sampling: " << m_hecID->sampling(cell->ID())
515 << " z :" << cell->caloDDE()->z() << " Eta : " << cell->eta() << " Phi : " << cell->phi()
516 << " Noise Level : " << noise_rms);
517
518 larhecTotal += cell->energy();
519 }
520 }
521
522 ATH_MSG_DEBUG("larhec counted " << count);
523
524 return larhecTotal;
525 }

◆ energyInTile()

double MuidCaloEnergyMeas::energyInTile ( const CaloCellContainer * cellContainer,
const CaloDetDescrManager * detMgr,
const CaloNoise * noiseCDO,
double eta,
double phi,
int sample,
int cone ) const
private

Definition at line 429 of file MuidCaloEnergyMeas.cxx.

430 {
431 // Tile Cal
432 // sample_number
433 // 0 --> Sampling 1
434 // 1 --> Sampling 2
435 // 2 --> Sampling 3
436 // 3 --> ITC
437
438 // int i,j,k;
439
440 double tileTotalEnergy = 0.;
441 double tileTestEnergy = 0.;
442
444 CaloCellList myList(detMgr,cellContainer, iCalo); // Construct the list
445 if (cone == SubCaloId::TILE) {
446 myList.select(mu_eta, mu_phi, 0.15, 0.15);
447 } else if (cone == SubCaloId::LARHEC) {
448 myList.select(mu_eta, mu_phi, 0.3, 0.3);
449 } else {
450 myList.select(mu_eta, mu_phi, 0., 0.);
451 }
452
453 int count = 0;
454 double lowest_threshold = 0.;
455 for (const CaloCell* cell : myList) {
456 double cellEnergy = cell->energy();
457 double noise_rms = noiseCDO->getNoise(cell->ID(), cell->gain());
458
459 if (cellEnergy > lowest_threshold && cellEnergy > noise_rms * m_sigmasAboveNoise && m_tileID->sample(cell->ID()) == sample) {
460 count += 1;
461
462 ATH_MSG_DEBUG("Energy : " << cell->energy() << " Sampling: " << m_tileID->sample(cell->ID())
463 << " Radius :" << cell->caloDDE()->r() << " Eta : " << cell->eta() << " Phi : " << cell->phi()
464 << " Noise Level : " << noise_rms);
465
466 tileTotalEnergy += cellEnergy;
467 } else {
468 tileTestEnergy += cellEnergy;
469 }
470 }
471
472 ATH_MSG_DEBUG(" counted " << count << " test energy " << tileTestEnergy);
473
474 return tileTotalEnergy;
475 }

◆ energyMeasurement()

std::unique_ptr< CaloMeas > MuidCaloEnergyMeas::energyMeasurement ( const EventContext & ctx,
double etaEM,
double phiEM,
double etaHad,
double phiHad ) const
overridevirtual

IMuidCaloEnergyMeas interface: get the muon energy loss measurement from the calorimeter, knowing the track intersection at the em and had cals.

Implements Rec::IMuidCaloEnergyMeas.

Definition at line 87 of file MuidCaloEnergyMeas.cxx.

88 {
89 SG::ReadHandle<CaloCellContainer> cellContainer(m_cellContainerLocation, ctx);
90 if (!cellContainer.isPresent()) {
91 ATH_MSG_DEBUG("No calo cell container " << m_cellContainerLocation.key() << ", energy measurement is 0");
92 return nullptr;
93 }
94 if (!cellContainer.isValid()) {
95 ATH_MSG_WARNING("Calo cell container " << m_cellContainerLocation.key() << " not valid!");
96 return nullptr;
97 }
98
99 SG::ReadCondHandle<CaloNoise> noiseHdl{m_noiseCDOKey, ctx};
100 if (!noiseHdl.isValid()) {
101 ATH_MSG_WARNING("Calo cell container " << m_noiseCDOKey.key() << " not valid!");
102 return nullptr;
103 }
104
105 const CaloNoise* noiseCDO = *noiseHdl;
106 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{m_caloMgrKey,ctx};
107 const CaloDetDescrManager* caloDDMgr = *caloMgrHandle;
108
109 // set measured tile energy, measured sampling fraction and isolation energy into CaloMeas
110 std::unique_ptr<CaloMeas> caloMeas = std::make_unique<CaloMeas>();
111 energyInCalo(*caloMeas, cellContainer.cptr(), caloDDMgr, noiseCDO, etaHad, phiHad, SubCaloId::TILE);
112 isolationEnergy(*caloMeas, cellContainer.cptr(), caloDDMgr, noiseCDO, etaHad, phiHad, SubCaloId::TILE);
113
114 // similar for LArHEC
115 energyInCalo(*caloMeas, cellContainer.cptr(), caloDDMgr, noiseCDO, etaHad, phiHad, SubCaloId::LARHEC);
116 isolationEnergy(*caloMeas, cellContainer.cptr(), caloDDMgr,noiseCDO, etaHad, phiHad, SubCaloId::LARHEC);
117
118 // and for the em calo
119 energyInCalo(*caloMeas, cellContainer.cptr(), caloDDMgr, noiseCDO, etaEM, phiEM, SubCaloId::LAREM);
120 isolationEnergy(*caloMeas, cellContainer.cptr(), caloDDMgr, noiseCDO, etaEM, phiEM, SubCaloId::LAREM);
121
122 ATH_MSG_DEBUG(std::setiosflags(std::ios::fixed)
123 << " Tile energy (GeV) :" << std::setw(8) << std::setprecision(3) << caloMeas->Tile_EnergyMeasured() / Units::GeV
124 << " Material percent:" << std::setw(4) << std::setprecision(0) << 100. * caloMeas->Tile_SamplingFraction()
125 << " ISO :" << std::setw(8) << std::setprecision(3) << caloMeas->Tile_Isolation() / Units::GeV << endmsg
126 << " LArHEC energy (GeV):" << std::setw(8) << std::setprecision(3) << caloMeas->LArHEC_EnergyMeasured() / Units::GeV
127 << " Material percent:" << std::setw(4) << std::setprecision(0) << 100. * caloMeas->LArHEC_SamplingFraction()
128 << " ISO :" << std::setw(8) << std::setprecision(3) << caloMeas->LArHEC_Isolation() / Units::GeV << endmsg
129 << " EM energy :" << std::setw(8) << std::setprecision(3) << caloMeas->LArEM_EnergyMeasured() / Units::GeV
130 << " first compartment:" << std::setw(8) << std::setprecision(3)
131 << caloMeas->LArEM_FirstCompartmentEnergy() / Units::GeV << " Material percent:" << std::setw(4)
132 << std::setprecision(0) << 100. * caloMeas->LArEM_SamplingFraction() << " ISO :" << std::setw(8)
133 << std::setprecision(3) << caloMeas->LArEM_Isolation() / Units::GeV);
134
135 return caloMeas;
136 }
#define endmsg
#define ATH_MSG_WARNING(x)
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
SG::ReadHandleKey< CaloCellContainer > m_cellContainerLocation
void energyInCalo(CaloMeas &caloMeas, const CaloCellContainer *cellContainer, const CaloDetDescrManager *detMgr, const CaloNoise *noiseCDO, double eta, double phi, int iSubCalo) const
void isolationEnergy(CaloMeas &caloMeas, const CaloCellContainer *cellContainer, const CaloDetDescrManager *detMgr, const CaloNoise *noiseCDO, double eta, double phi, int iSubCalo) const
SG::ReadCondHandleKey< CaloNoise > m_noiseCDOKey

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode MuidCaloEnergyMeas::finalize ( )
override

Definition at line 80 of file MuidCaloEnergyMeas.cxx.

80 {
81 ATH_MSG_INFO("Finalizing MuidCaloEnergyMeas Tool");
82 ATH_MSG_INFO(" EM: selected " << m_totalSelectedEM << " from " << m_totalCoreCellsEM << " cells in core");
83 ATH_MSG_INFO(" Tile: selected " << m_totalSelectedTile << " from " << m_totalCoreCellsTile << " cells in core");
84 ATH_MSG_INFO(" HEC: selected " << m_totalSelectedHEC << " from " << m_totalCoreCellsHEC << " cells in core");
85 return StatusCode::SUCCESS;
86 }
#define ATH_MSG_INFO(x)

◆ initialize()

StatusCode MuidCaloEnergyMeas::initialize ( )
override

Definition at line 58 of file MuidCaloEnergyMeas.cxx.

58 {
59 ATH_MSG_INFO("Initializing MuidCaloEnergyMeas AlgTool");
60
61 // retrieve TileID helper and TileIfno from det store
63 ATH_MSG_VERBOSE("Accessed TileID helper");
64
65 // retrieve LArEM helper
66 ATH_CHECK(detStore()->retrieve(m_emID, "LArEM_ID"));
67 ATH_MSG_VERBOSE("Accessed LArEM helper");
68
69 // retrieve LArHEC helper
70 ATH_CHECK(detStore()->retrieve(m_hecID, "LArHEC_ID"));
71 ATH_MSG_VERBOSE("Accessed LArHEC helper");
72
73 ATH_CHECK(m_caloParamTool.retrieve());
74 ATH_CHECK(m_noiseCDOKey.initialize());
76 ATH_CHECK(m_caloMgrKey.initialize());
77 return StatusCode::SUCCESS;
78 }
#define ATH_CHECK
Evaluate an expression and check for errors.
const ServiceHandle< StoreGateSvc > & detStore() const
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & Rec::IMuidCaloEnergyMeas::interfaceID ( )
inlinestaticinherited

AlgTool and IAlgTool interface methods.

Interface ID for IMuidCaloEnergyMeas

Definition at line 36 of file IMuidCaloEnergyMeas.h.

36 {
37 static const InterfaceID IID_IMuidCaloEnergyMeas("IMuidCaloEnergyMeas", 1, 0);
38 return IID_IMuidCaloEnergyMeas;
39 }

◆ isolationEnergy()

void MuidCaloEnergyMeas::isolationEnergy ( CaloMeas & caloMeas,
const CaloCellContainer * cellContainer,
const CaloDetDescrManager * detMgr,
const CaloNoise * noiseCDO,
double eta,
double phi,
int iSubCalo ) const
private

Definition at line 354 of file MuidCaloEnergyMeas.cxx.

355 {
356 double totalEnergy = 0.;
357
358 // SG::ReadCondHandle<CaloNoise> noiseHdl{m_noiseCDOKey, ctx};
359 // const CaloNoise* noiseCDO = *noiseHdl;
360
361 std::unique_ptr<CaloCellList> myList;
362
363 if (isubcalo == SubCaloId::TILE) {
365 myList = std::make_unique<CaloCellList>(detMgr,cellContainer, iCalo);
366 myList->select(muEta, muPhi, m_isolationConeTile, m_isolationConeTile);
367 } else if (isubcalo == SubCaloId::LARHEC) {
369 myList = std::make_unique<CaloCellList>(detMgr,cellContainer, iCalo);
370 myList->select(muEta, muPhi, m_isolationConeLArHEC, m_isolationConeLArHEC);
371 } else if (isubcalo == SubCaloId::LAREM) {
373 myList = std::make_unique<CaloCellList>(detMgr,cellContainer, iCalo);
374 myList->select(muEta, muPhi, m_isolationConeLArEM, m_isolationConeLArEM);
375 }
376
377 if (myList && myList->ncells()) {
378 // get last cell (as CaloCellList->back() method doesn't work)
379 const CaloCell* lastCell = *(myList->end() - 1);
380
381 // flag core in each sampling
382 for (int coreSampling = 0; coreSampling != 4; ++coreSampling) {
383 const CaloCell* coreCell = nullptr;
384 double coreRadius = 0.;
385 for (const CaloCell* cell : *myList) {
386 int sampling = samplingID(cell, isubcalo);
387
388 if (cell != lastCell && sampling != coreSampling) continue;
389
390 const double deltaEta = cell->eta() - muEta;
391 const double deltaPhi = xAOD::P4Helpers::deltaPhi(cell->phi(), muPhi);
392 const double radius = deltaEta * deltaEta + deltaPhi * deltaPhi;
393
394 if (sampling == coreSampling) {
395 if (!coreCell || radius < coreRadius) {
396 coreCell = cell;
397 coreRadius = radius;
398 }
399 }
400
401 if (cell != lastCell || !coreCell) continue;
402
403 for (const CaloCell* cell2 : *myList) {
404 sampling = samplingID(cell2, isubcalo);
405 if (sampling != coreSampling) continue;
406
407 double cellEnergy = cell2->energy();
408 double noiseRms = noiseCDO->getNoise(cell2->ID(), cell2->gain());
409 // looser selection for core cell where at least mip is expected
410 bool cellSelected = cellEnergy > m_sigmasAboveNoise * noiseRms;
411 if (cell2 == coreCell && cellEnergy > m_sigmasAboveNoiseCore * noiseRms) cellSelected = true;
412
413 if (cellSelected) totalEnergy += cellEnergy;
414 }
415 }
416 }
417
418 // store result in caloMeas
419 if (isubcalo == SubCaloId::TILE) {
420 caloMeas.Tile_Isolation(totalEnergy);
421 } else if (isubcalo == SubCaloId::LARHEC) {
422 caloMeas.LArHEC_Isolation(totalEnergy);
423 } else if (isubcalo == SubCaloId::LAREM) {
424 caloMeas.LArEM_Isolation(totalEnergy);
425 }
426 }
427 }

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ samplingID()

int MuidCaloEnergyMeas::samplingID ( const CaloCell * cell,
int iSubCalo ) const
private

Definition at line 162 of file MuidCaloEnergyMeas.cxx.

162 {
163 if (isubcalo == SubCaloId::TILE) {
164 return m_tileID->sample(cell->ID());
165 } else if (isubcalo == SubCaloId::LARHEC) {
166 return m_hecID->sampling(cell->ID());
167 } else if (isubcalo == SubCaloId::LAREM) {
168 return m_emID->sampling(cell->ID());
169 }
170
171 return -1;
172 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_caloMgrKey

SG::ReadCondHandleKey<CaloDetDescrManager> Rec::MuidCaloEnergyMeas::m_caloMgrKey {this,"CaloDetDescrManager", "CaloDetDescrManager"}
private

Definition at line 111 of file MuidCaloEnergyMeas.h.

111{this,"CaloDetDescrManager", "CaloDetDescrManager"};

◆ m_caloParamTool

ToolHandle<IMuidCaloEnergyParam> Rec::MuidCaloEnergyMeas::m_caloParamTool
private
Initial value:
{
this,
"CaloParamTool",
"",
}

Definition at line 95 of file MuidCaloEnergyMeas.h.

95 {
96 this,
97 "CaloParamTool",
98 "",
99 };

◆ m_cellContainerLocation

SG::ReadHandleKey<CaloCellContainer> Rec::MuidCaloEnergyMeas::m_cellContainerLocation
private
Initial value:
{
this,
"CellContainerLocation",
"AllCalo",
"calo cell container location",
}

Definition at line 104 of file MuidCaloEnergyMeas.h.

104 {
105 this,
106 "CellContainerLocation",
107 "AllCalo",
108 "calo cell container location",
109 };

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_emID

const LArEM_ID* Rec::MuidCaloEnergyMeas::m_emID
private

Definition at line 102 of file MuidCaloEnergyMeas.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_hecID

const LArHEC_ID* Rec::MuidCaloEnergyMeas::m_hecID
private

Definition at line 103 of file MuidCaloEnergyMeas.h.

◆ m_isolationConeLArEM

double Rec::MuidCaloEnergyMeas::m_isolationConeLArEM
private

Definition at line 118 of file MuidCaloEnergyMeas.h.

◆ m_isolationConeLArHEC

double Rec::MuidCaloEnergyMeas::m_isolationConeLArHEC
private

Definition at line 117 of file MuidCaloEnergyMeas.h.

◆ m_isolationConeTile

double Rec::MuidCaloEnergyMeas::m_isolationConeTile
private

Definition at line 116 of file MuidCaloEnergyMeas.h.

◆ m_measurementConeLArEM

double Rec::MuidCaloEnergyMeas::m_measurementConeLArEM
private

Definition at line 115 of file MuidCaloEnergyMeas.h.

◆ m_measurementConeLArHEC

double Rec::MuidCaloEnergyMeas::m_measurementConeLArHEC
private

Definition at line 114 of file MuidCaloEnergyMeas.h.

◆ m_measurementConeTile

double Rec::MuidCaloEnergyMeas::m_measurementConeTile
private

Definition at line 113 of file MuidCaloEnergyMeas.h.

◆ m_noiseCDOKey

SG::ReadCondHandleKey<CaloNoise> Rec::MuidCaloEnergyMeas::m_noiseCDOKey
private
Initial value:
{
this,
"CaloNoiseKey",
"totalNoise",
"SG Key of CaloNoise data object",
}

Definition at line 89 of file MuidCaloEnergyMeas.h.

89 {
90 this,
91 "CaloNoiseKey",
92 "totalNoise",
93 "SG Key of CaloNoise data object",
94 };

◆ m_sigmasAboveNoise

double Rec::MuidCaloEnergyMeas::m_sigmasAboveNoise
private

Definition at line 120 of file MuidCaloEnergyMeas.h.

◆ m_sigmasAboveNoiseCore

double Rec::MuidCaloEnergyMeas::m_sigmasAboveNoiseCore
private

Definition at line 121 of file MuidCaloEnergyMeas.h.

◆ m_tileID

const TileID* Rec::MuidCaloEnergyMeas::m_tileID
private

Definition at line 101 of file MuidCaloEnergyMeas.h.

◆ m_totalCoreCellsEM

std::atomic_int Rec::MuidCaloEnergyMeas::m_totalCoreCellsEM {0}
mutableprivate

Definition at line 123 of file MuidCaloEnergyMeas.h.

123{0};

◆ m_totalCoreCellsHEC

std::atomic_int Rec::MuidCaloEnergyMeas::m_totalCoreCellsHEC {0}
mutableprivate

Definition at line 124 of file MuidCaloEnergyMeas.h.

124{0};

◆ m_totalCoreCellsTile

std::atomic_int Rec::MuidCaloEnergyMeas::m_totalCoreCellsTile {0}
mutableprivate

Definition at line 125 of file MuidCaloEnergyMeas.h.

125{0};

◆ m_totalSelectedEM

std::atomic_int Rec::MuidCaloEnergyMeas::m_totalSelectedEM {0}
mutableprivate

Definition at line 126 of file MuidCaloEnergyMeas.h.

126{0};

◆ m_totalSelectedHEC

std::atomic_int Rec::MuidCaloEnergyMeas::m_totalSelectedHEC {0}
mutableprivate

Definition at line 127 of file MuidCaloEnergyMeas.h.

127{0};

◆ m_totalSelectedTile

std::atomic_int Rec::MuidCaloEnergyMeas::m_totalSelectedTile {0}
mutableprivate

Definition at line 128 of file MuidCaloEnergyMeas.h.

128{0};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: