ATLAS Offline Software
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 
7 LArHVFraction::LArHVFraction(const std::string& type,
8  const std::string& name,
9  const IInterface* parent) :
11  declareInterface<ILArHVFraction>(this);
12 }
13 
14 
18  return StatusCode::SUCCESS;
19 }
20 
21 std::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 
33 for(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 }
ILArHVScaleCorr
Definition: ILArHVScaleCorr.h:13
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
LArHVFraction::m_hvScaleKey
SG::ReadCondHandleKey< ILArHVScaleCorr > m_hvScaleKey
Definition: LArHVFraction.h:35
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
LArHVFraction::getLArHVFrac
std::pair< double, unsigned > getLArHVFrac(const CaloClusterCellLink *cclc, const EventContext &ctx) const override
Definition: LArHVFraction.cxx:21
HWIdentifier
Definition: HWIdentifier.h:13
LArHVFraction.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LArHVFraction::initialize
StatusCode initialize() override
Definition: LArHVFraction.cxx:15
LArHVFraction::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition: LArHVFraction.h:33
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
LArHVFraction::LArHVFraction
LArHVFraction(const std::string &type, const std::string &name, const IInterface *parent)
Definition: LArHVFraction.cxx:7
LArHVFraction::m_threshold
Gaudi::Property< float > m_threshold
Definition: LArHVFraction.h:37
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ILArHVScaleCorr::HVScaleCorr
virtual const float & HVScaleCorr(const HWIdentifier &id) const =0
AthAlgTool
Definition: AthAlgTool.h:26
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20