ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloCellCorrection
src
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
14
#include "
CaloCellPedestalCorr.h
"
15
16
#include "
CaloEvent/CaloCellContainer.h
"
17
#include "CaloDetDescr/CaloDetDescrElement.h"
18
19
//=== AttributeList
20
#include "CoralBase/Blob.h"
21
#include "
AthenaPoolUtilities/CondAttrListCollection.h
"
22
//=== CaloCondBlod
23
#include "
CaloCondBlobObjs/CaloCondBlobFlt.h
"
24
#include "
CaloCondBlobObjs/CaloCondUtils.h
"
25
26
#include "
CaloIdentifier/CaloCell_ID.h
"
27
28
#include "
LArElecCalib/LArProvenance.h
"
29
30
// ======================================================
31
// Constructor
32
33
CaloCellPedestalCorr::CaloCellPedestalCorr
(
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
44
StatusCode
CaloCellPedestalCorr::initialize
()
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
));
51
ATH_CHECK
(
m_caloBCIDAvg
.initialize(
SG::AllowEmpty
));
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
61
StatusCode
CaloCellPedestalCorr::process
(
CaloCellContainer
* theCellContainer,
const
EventContext& ctx)
const
{
62
63
const
CaloCellPedShift
* pedShifts=
nullptr
;
64
65
if
(!
m_isMC
) {
66
SG::ReadCondHandle<CaloCellPedShift>
pedShiftHdl{
m_pedShiftKey
,ctx};
67
pedShifts=*pedShiftHdl;
68
}
69
70
const
CaloBCIDAverage
* bcidavgshift=
nullptr
;
71
if
(!(
m_caloBCIDAvg
.key().empty())) {
72
SG::ReadHandle<CaloBCIDAverage>
bcidavgshiftHdl(
m_caloBCIDAvg
,ctx);
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
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
CaloCellContainer.h
CaloCellPedestalCorr.h
CaloCell_ID.h
CaloCondBlobFlt.h
CaloCondUtils.h
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
LArProvenance.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
CaloBCIDAverage
Definition
CaloBCIDAverage.h:16
CaloBCIDAverage::averageOflHash
float averageOflHash(const IdentifierHash h) const
Definition
CaloBCIDAverage.h:21
CaloCellContainer
Container class for CaloCell.
Definition
CaloCellContainer.h:55
CaloCellPedShift
Definition
CaloCellPedShift.h:17
CaloCellPedShift::pedShift
float pedShift(const IdentifierHash hash, const int gain) const
Definition
CaloCellPedShift.h:41
CaloCellPedestalCorr::m_larHashMax
IdentifierHash m_larHashMax
Definition
CaloCellPedestalCorr.h:44
CaloCellPedestalCorr::m_caloBCIDAvg
SG::ReadHandleKey< CaloBCIDAverage > m_caloBCIDAvg
Definition
CaloCellPedestalCorr.h:40
CaloCellPedestalCorr::CaloCellPedestalCorr
CaloCellPedestalCorr(const std::string &type, const std::string &name, const IInterface *parent)
Definition
CaloCellPedestalCorr.cxx:33
CaloCellPedestalCorr::process
StatusCode process(CaloCellContainer *theCellContainer, const EventContext &ctx) const override
Definition
CaloCellPedestalCorr.cxx:61
CaloCellPedestalCorr::m_cellId
const CaloCell_ID * m_cellId
Definition
CaloCellPedestalCorr.h:43
CaloCellPedestalCorr::m_isMC
Gaudi::Property< bool > m_isMC
Definition
CaloCellPedestalCorr.h:42
CaloCellPedestalCorr::initialize
virtual StatusCode initialize() override
Definition
CaloCellPedestalCorr.cxx:44
CaloCellPedestalCorr::m_pedShiftKey
SG::ReadCondHandleKey< CaloCellPedShift > m_pedShiftKey
Definition
CaloCellPedestalCorr.h:39
CaloCell_Base_ID::LARFCAL
@ LARFCAL
Definition
CaloCell_Base_ID.h:45
CaloCell
Data object for each calorimeter readout cell.
Definition
CaloCell.h:57
CaloCondUtils::getDbCaloGain
static unsigned int getDbCaloGain(int caloGain)
Returns the non-negative gainId to be used with the COOL DB.
Definition
CaloCondUtils.cxx:86
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
LArProv::test
bool test(const uint16_t prov, const LArProvenance check)
Definition
LArProvenance.h:38
LArProv::DEADFEB
@ DEADFEB
Definition
LArProvenance.h:35
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:27
type
Generated on
for ATLAS Offline Software by
1.17.0