ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCellRec
src
LArCellGainPathology.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
/********************************************************************
6
7
NAME: LArCellGainPathology
8
PACKAGE: offline/Calorimeter/LArCellRec
9
10
AUTHORS: G.Unal
11
CREATION: 23 april 2009
12
13
PURPOSE:
14
15
********************************************************************/
16
17
#include "
LArCellGainPathology.h
"
18
19
#include "
StoreGate/StoreGateSvc.h
"
20
#include "
CaloEvent/CaloCellContainer.h
"
21
#include "Identifier/Identifier.h"
22
#include "
Identifier/IdentifierHash.h
"
23
#include "
CaloIdentifier/CaloIdManager.h
"
24
#include "
CaloIdentifier/CaloCell_ID.h
"
25
#include "
LArRawEvent/LArFebErrorSummary.h
"
26
#include "
LArIdentifier/LArOnlineID.h
"
27
28
30
// CONSTRUCTOR:
32
33
LArCellGainPathology::LArCellGainPathology
(
34
const
std::string&
type
,
35
const
std::string& name,
36
const
IInterface* parent)
37
: base_class (
type
, name, parent),
38
m_calo_id
(nullptr),
39
m_onlineID
(nullptr)
40
{
41
}
42
43
45
// INITIALIZE:
46
// The initialize method will create all the required algorithm objects
48
49
StatusCode
LArCellGainPathology::initialize
()
50
{
51
const
CaloIdManager
* caloIdMgr;
52
ATH_CHECK
( detStore()->retrieve( caloIdMgr ) );
53
m_calo_id
= caloIdMgr->
getCaloCell_ID
();
54
55
// translate offline ID into online ID
56
ATH_CHECK
(
m_cablingKey
.initialize());
57
ATH_CHECK
( detStore()->retrieve(
m_onlineID
,
"LArOnlineID"
) );
58
return
StatusCode::SUCCESS;
59
60
}
61
62
StatusCode
LArCellGainPathology::finalize
()
63
{
64
return
StatusCode::SUCCESS;
65
}
66
67
StatusCode
LArCellGainPathology::process
(
CaloCellContainer
* theCont,
68
const
EventContext& ctx)
const
69
{
70
ATH_MSG_DEBUG
(
" in LArCellGainPathology::process "
);
71
72
SG::ReadCondHandle<LArOnOffIdMapping>
cablingHdl{
m_cablingKey
, ctx};
73
const
LArOnOffIdMapping
* cabling=*cablingHdl;
74
75
// loop over all Febs
76
77
std::vector<HWIdentifier>::const_iterator feb =
m_onlineID
->feb_begin();
78
std::vector<HWIdentifier>::const_iterator feb_end =
m_onlineID
->feb_end();
79
80
81
for
( ; feb != feb_end; ++feb) {
82
// for debug
83
ATH_MSG_DEBUG
(
" process Feb: "
<<
84
feb->get_identifier32().get_compact());
85
86
// get information for channel 0-63 64-127
87
88
for
(
int
i=0;i<2;i++) {
89
int
cha1 = i*64;
90
int
cha2 = i*64+63;
91
HWIdentifier
hwid1 =
m_onlineID
->channel_Id(*feb,cha1);
92
HWIdentifier
hwid2 =
m_onlineID
->channel_Id(*feb,cha2);
93
this->
ApplyPathology
(theCont,hwid1,hwid2,cabling);
94
}
95
}
96
97
return
StatusCode::SUCCESS;
98
}
99
100
void
LArCellGainPathology::ApplyPathology
(
CaloCellContainer
* theCont,
HWIdentifier
id1,
HWIdentifier
id2,
const
LArOnOffIdMapping
* cabling)
const
101
{
102
103
CaloCell
* cell1 = this->
GetCell
(theCont, id1,cabling);
104
CaloCell
* cell2 = this->
GetCell
(theCont, id2,cabling);
105
106
if
(!cell1 || !cell2)
return
;
107
108
//std::cout << " cell pair " << m_onlineID->show_to_string(id1) << " " << m_onlineID->show_to_string(id2) << " " <<
109
// cell1->gain() << " " << cell2->gain() << " " << cell1->energy() << " " << cell2->energy() << std::endl;
110
111
if
(cell1->
gain
() == cell2->
gain
())
return
;
112
113
114
CaloGain::CaloGain
newGain = cell2->
gain
();
115
double
eratio=1;
116
if
(newGain==
CaloGain::LARHIGHGAIN
) {
117
if
(cell1->
gain
()==
CaloGain::LARMEDIUMGAIN
) eratio=0.1;
118
if
(cell1->
gain
()==
CaloGain::LARLOWGAIN
) eratio=0.01;
119
}
120
if
(newGain==
CaloGain::LARMEDIUMGAIN
) {
121
if
(cell1->
gain
()==
CaloGain::LARHIGHGAIN
) eratio=10.;
122
if
(cell1->
gain
()==
CaloGain::LARLOWGAIN
) eratio=0.1;
123
}
124
if
(newGain==
CaloGain::LARLOWGAIN
) {
125
if
(cell1->
gain
()==
CaloGain::LARHIGHGAIN
) eratio=100.;
126
if
(cell1->
gain
()==
CaloGain::LARMEDIUMGAIN
) eratio=10.;
127
}
128
double
eold = cell1->
energy
();
129
cell1->
setEnergy
(eratio*eold);
130
cell1->
setGain
(newGain);
131
//std::cout << " --- new gain/energy of cell1 " << cell1->gain() << " " << cell1->energy() << std::endl;
132
133
}
134
135
CaloCell
*
LArCellGainPathology::GetCell
(
CaloCellContainer
* theCont,
HWIdentifier
id
,
const
LArOnOffIdMapping
* cabling)
const
136
{
137
CaloCell
* aCell =
nullptr
;
138
if
(cabling->isOnlineConnected(
id
)) {
139
Identifier
id_off = cabling->cnvToIdentifier(
id
);
140
IdentifierHash
theCellHashID =
m_calo_id
->calo_cell_hash(id_off);
141
int
index
= theCont->
findIndex
(theCellHashID);
142
if
(
index
>=0) {
143
aCell = theCont->
at
(
index
);
144
}
145
}
146
return
aCell;
147
148
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloCellContainer.h
CaloCell_ID.h
CaloIdManager.h
IdentifierHash.h
LArCellGainPathology.h
LArFebErrorSummary.h
LArOnlineID.h
StoreGateSvc.h
CaloCellContainer
Container class for CaloCell.
Definition
CaloCellContainer.h:55
CaloCellContainer::findIndex
int findIndex(const IdentifierHash theHash) const
Return index of the cell with a given hash.
Definition
CaloCellContainer.cxx:363
CaloCell
Data object for each calorimeter readout cell.
Definition
CaloCell.h:57
CaloCell::energy
double energy() const
get energy (data member)
Definition
CaloCell.h:327
CaloCell::setGain
void setGain(CaloGain::CaloGain gain=CaloGain::INVALIDGAIN)
set gain
Definition
CaloCell.h:497
CaloCell::setEnergy
virtual void setEnergy(float energy)
set energy
Definition
CaloCell.h:472
CaloCell::gain
CaloGain::CaloGain gain() const
get gain (data member )
Definition
CaloCell.h:361
CaloIdManager
This class initializes the Calo (LAr and Tile) offline identifiers.
Definition
CaloIdManager.h:45
CaloIdManager::getCaloCell_ID
const CaloCell_ID * getCaloCell_ID(void) const
Access to IdHelper.
Definition
CaloIdManager.cxx:63
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
HWIdentifier
Definition
HWIdentifier.h:13
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
LArCellGainPathology::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
handle to LAr cabling service
Definition
LArCellGainPathology.h:64
LArCellGainPathology::GetCell
CaloCell * GetCell(CaloCellContainer *theCont, HWIdentifier id, const LArOnOffIdMapping *cabling) const
method to find cell from hardware id
Definition
LArCellGainPathology.cxx:135
LArCellGainPathology::ApplyPathology
void ApplyPathology(CaloCellContainer *theCont, HWIdentifier id1, HWIdentifier id, const LArOnOffIdMapping *cabling) const
method to apply pathology between a couple of cells
Definition
LArCellGainPathology.cxx:100
LArCellGainPathology::LArCellGainPathology
LArCellGainPathology(const std::string &type, const std::string &name, const IInterface *parent)
Definition
LArCellGainPathology.cxx:33
LArCellGainPathology::process
virtual StatusCode process(CaloCellContainer *theCellContainer, const EventContext &ctx) const override
update theCellContainer, masking Feb with errors
Definition
LArCellGainPathology.cxx:67
LArCellGainPathology::initialize
virtual StatusCode initialize() override
initialize the tool
Definition
LArCellGainPathology.cxx:49
LArCellGainPathology::finalize
virtual StatusCode finalize() override
finalize the tool
Definition
LArCellGainPathology.cxx:62
LArCellGainPathology::m_onlineID
const LArOnlineID * m_onlineID
Definition
LArCellGainPathology.h:69
LArCellGainPathology::m_calo_id
const CaloCell_ID * m_calo_id
pointers to storegateSvc and identifier helpers
Definition
LArCellGainPathology.h:68
LArOnOffIdMapping
Definition
LArOnOffIdMapping.h:20
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
CaloGain::CaloGain
CaloGain
Definition
CaloGain.h:11
CaloGain::LARMEDIUMGAIN
@ LARMEDIUMGAIN
Definition
CaloGain.h:18
CaloGain::LARLOWGAIN
@ LARLOWGAIN
Definition
CaloGain.h:18
CaloGain::LARHIGHGAIN
@ LARHIGHGAIN
Definition
CaloGain.h:18
Identifier
Definition
IdentifierFieldParser.cxx:14
index
Definition
index.py:1
type
Generated on
for ATLAS Offline Software by
1.17.0