ATLAS Offline Software
Loading...
Searching...
No Matches
LArHVFraction.cxx
Go to the documentation of this file.
1#include "LArHVFraction.h"
2/*
3 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
4*/
5
6
8 const std::string& name,
9 const IInterface* parent) :
10 AthAlgTool(type,name,parent) {
11 declareInterface<ILArHVFraction>(this);
12}
13
14
16 ATH_CHECK(m_cablingKey.initialize());
17 ATH_CHECK(m_hvScaleKey.initialize());
18 return StatusCode::SUCCESS;
19}
20
21std::pair<double,unsigned> LArHVFraction::getLArHVFrac(const CaloClusterCellLink* cclc,const EventContext& ctx) const {
22
24 const LArOnOffIdMapping* cabling=*cablingHdl;
25
27 const ILArHVScaleCorr* hvcorr=*hvScaleHdl;
28
29
30 double energyHVaff=0;
31 unsigned numCellsHVaff=0;
32
33for(const CaloCell* cell : *cclc) {
34 if(cell->caloDDE()->is_tile()) continue;
35 HWIdentifier hwid=cabling->createSignalChannelID(cell->ID());
36 float corr=hvcorr->HVScaleCorr(hwid);
37 //Correction should be between (0 and 2)
38 if (corr<=0. || corr>=100.) continue;
39
40 if (fabs(corr-1.)>m_threshold) {
41 energyHVaff+=fabs(cell->e());
42 numCellsHVaff++;
43 }//end of non nominal HV area
44 }//end loop over cells
45
46 return {energyHVaff,numCellsHVaff};
47}
#define ATH_CHECK
Evaluate an expression and check for errors.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
virtual const float & HVScaleCorr(const HWIdentifier &id) const =0
SG::ReadCondHandleKey< ILArHVScaleCorr > m_hvScaleKey
std::pair< double, unsigned > getLArHVFrac(const CaloClusterCellLink *cclc, const EventContext &ctx) const override
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
StatusCode initialize() override
Gaudi::Property< float > m_threshold
LArHVFraction(const std::string &type, const std::string &name, const IInterface *parent)