ATLAS Offline Software
Loading...
Searching...
No Matches
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
7NAME: LArCellGainPathology
8PACKAGE: offline/Calorimeter/LArCellRec
9
10AUTHORS: G.Unal
11CREATION: 23 april 2009
12
13PURPOSE:
14
15********************************************************************/
16
18
21#include "Identifier/Identifier.h"
27
28
30// CONSTRUCTOR:
32
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
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
63{
64 return StatusCode::SUCCESS;
65}
66
68 const EventContext& ctx) const
69{
70 ATH_MSG_DEBUG (" in LArCellGainPathology::process ");
71
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
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
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
HWIdentifier id2
Container class for CaloCell.
int findIndex(const IdentifierHash theHash) const
Return index of the cell with a given hash.
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
double energy() const
get energy (data member)
Definition CaloCell.h:327
void setGain(CaloGain::CaloGain gain=CaloGain::INVALIDGAIN)
set gain
Definition CaloCell.h:497
virtual void setEnergy(float energy)
set energy
Definition CaloCell.h:472
CaloGain::CaloGain gain() const
get gain (data member )
Definition CaloCell.h:361
This class initializes the Calo (LAr and Tile) offline identifiers.
const CaloCell_ID * getCaloCell_ID(void) const
Access to IdHelper.
const T * at(size_type n) const
Access an element, as an rvalue.
This is a "hash" representation of an Identifier.
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
handle to LAr cabling service
CaloCell * GetCell(CaloCellContainer *theCont, HWIdentifier id, const LArOnOffIdMapping *cabling) const
method to find cell from hardware id
void ApplyPathology(CaloCellContainer *theCont, HWIdentifier id1, HWIdentifier id, const LArOnOffIdMapping *cabling) const
method to apply pathology between a couple of cells
LArCellGainPathology(const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode process(CaloCellContainer *theCellContainer, const EventContext &ctx) const override
update theCellContainer, masking Feb with errors
virtual StatusCode initialize() override
initialize the tool
virtual StatusCode finalize() override
finalize the tool
const LArOnlineID * m_onlineID
const CaloCell_ID * m_calo_id
pointers to storegateSvc and identifier helpers
@ LARMEDIUMGAIN
Definition CaloGain.h:18
@ LARLOWGAIN
Definition CaloGain.h:18
@ LARHIGHGAIN
Definition CaloGain.h:18
Definition index.py:1