ATLAS Offline Software
Loading...
Searching...
No Matches
CaloCellPedestalCorr.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5// ****************************************************************************************
6//
7// To perform cell per cell pedestal shift correction
8// taking the pedestal shift in MeV from the database /CALO/Pedestal/CellPedestal folder
9//
10// G.Unal 9 may 2008 .... first version
11//
12// ****************************************************************************************
13
15
17#include "CaloDetDescr/CaloDetDescrElement.h"
18
19//=== AttributeList
20#include "CoralBase/Blob.h"
22//=== CaloCondBlod
25
27
29
30// ======================================================
31// Constructor
32
34 const std::string& type,
35 const std::string& name,
36 const IInterface* parent)
37 : AthAlgTool(type, name, parent) {
38 declareInterface<ICaloCellMakerTool>(this);
39}
40
41//========================================================
42// Initialize
43
45{
46 ATH_MSG_INFO( " in CaloCellPedestalCorr::initialize() " );
47
48 ATH_CHECK(detStore()->retrieve(m_cellId, "CaloCell_ID"));
49
50 ATH_CHECK(m_pedShiftKey.initialize(!m_isMC));
52
53 IdentifierHash hashMin;
54 m_cellId->calo_cell_hash_range(CaloCell_ID::LARFCAL, hashMin,m_larHashMax);
55
56 ATH_MSG_INFO( "CaloCellPedestalCorr initialize() end" );
57 return StatusCode::SUCCESS;
58}
59
60
61StatusCode CaloCellPedestalCorr::process( CaloCellContainer * theCellContainer, const EventContext& ctx) const {
62
63 const CaloCellPedShift* pedShifts=nullptr;
64
65 if (!m_isMC) {
67 pedShifts=*pedShiftHdl;
68 }
69
70 const CaloBCIDAverage* bcidavgshift=nullptr;
71 if (!(m_caloBCIDAvg.key().empty())) {
73 bcidavgshift=&(*bcidavgshiftHdl);
74 }
75
76
77
78 for (CaloCell* theCell : *theCellContainer) {
79 const IdentifierHash cellHash=theCell->caloDDE()->calo_hash();
80 //Do not correct cells that are masked
81 if (cellHash<m_larHashMax && LArProv::test(theCell->provenance(),LArProv::DEADFEB)) continue;
82
83 float pedestal=0;
84 if (!m_isMC) {
85 const unsigned int dbGain = CaloCondUtils::getDbCaloGain(theCell->gain());
86 pedestal = pedShifts->pedShift(cellHash,dbGain);
87 }
88
89 if (bcidavgshift) {
90 pedestal = pedestal + bcidavgshift->averageOflHash(cellHash);
91 }
92
93 theCell->addEnergy(-pedestal);
94 }//end loop over cell-container
95
96 return StatusCode::SUCCESS;
97}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
float averageOflHash(const IdentifierHash h) const
Container class for CaloCell.
float pedShift(const IdentifierHash hash, const int gain) const
SG::ReadHandleKey< CaloBCIDAverage > m_caloBCIDAvg
CaloCellPedestalCorr(const std::string &type, const std::string &name, const IInterface *parent)
StatusCode process(CaloCellContainer *theCellContainer, const EventContext &ctx) const override
const CaloCell_ID * m_cellId
Gaudi::Property< bool > m_isMC
virtual StatusCode initialize() override
SG::ReadCondHandleKey< CaloCellPedShift > m_pedShiftKey
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
static unsigned int getDbCaloGain(int caloGain)
Returns the non-negative gainId to be used with the COOL DB.
This is a "hash" representation of an Identifier.
bool test(const uint16_t prov, const LArProvenance check)