ATLAS Offline Software
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"
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
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 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::eratio
setCharge setNTRTHiThresholdHits eratio
Definition: TrigElectron_v1.cxx:96
CaloCell_Base_ID::calo_cell_hash
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
LArCellGainPathology::initialize
virtual StatusCode initialize() override
initialize the tool
Definition: LArCellGainPathology.cxx:49
LArCellGainPathology::process
virtual StatusCode process(CaloCellContainer *theCellContainer, const EventContext &ctx) const override
update theCellContainer, masking Feb with errors
Definition: LArCellGainPathology.cxx:67
LArCellGainPathology::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
handle to LAr cabling service
Definition: LArCellGainPathology.h:64
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
index
Definition: index.py:1
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
LArOnlineID_Base::feb_begin
id_iterator feb_begin() const
Returns an iterator pointing to a feb identifier collection.
Definition: LArOnlineID_Base.cxx:1906
CaloCell::setEnergy
virtual void setEnergy(float energy)
set energy
Definition: CaloCell.cxx:136
HWIdentifier
Definition: HWIdentifier.h:13
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
CaloCell_ID.h
CaloCell::energy
double energy() const
get energy (data member)
Definition: CaloCell.h:311
CaloIdManager
This class initializes the Calo (LAr and Tile) offline identifiers.
Definition: CaloIdManager.h:45
id2
HWIdentifier id2
Definition: LArRodBlockPhysicsV0.cxx:562
LArCellGainPathology::LArCellGainPathology
LArCellGainPathology(const std::string &type, const std::string &name, const IInterface *parent)
Definition: LArCellGainPathology.cxx:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
LArOnlineID_Base::channel_Id
HWIdentifier channel_Id(int barrel_ec, int pos_neg, int feedthrough, int slot, int channel) const
create channel identifier from fields
Definition: LArOnlineID_Base.cxx:1565
test_pyathena.parent
parent
Definition: test_pyathena.py:15
LArCellGainPathology.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloCell::setGain
void setGain(CaloGain::CaloGain gain=CaloGain::INVALIDGAIN)
set gain
Definition: CaloCell.cxx:173
LArCellGainPathology::m_calo_id
const CaloCell_ID * m_calo_id
pointers to storegateSvc and identifier helpers
Definition: LArCellGainPathology.h:68
LArOnlineID_Base::feb_end
id_iterator feb_end() const
Definition: LArOnlineID_Base.cxx:1911
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:225
CaloIdManager::getCaloCell_ID
const CaloCell_ID * getCaloCell_ID(void) const
Access to IdHelper.
Definition: CaloIdManager.cxx:63
IdentifierHash.h
CaloCell::gain
CaloGain::CaloGain gain() const
get gain (data member )
Definition: CaloCell.h:345
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
CaloGain::LARHIGHGAIN
@ LARHIGHGAIN
Definition: CaloGain.h:18
LArCellGainPathology::GetCell
CaloCell * GetCell(CaloCellContainer *theCont, HWIdentifier id, const LArOnOffIdMapping *cabling) const
method to find cell from hardware id
Definition: LArCellGainPathology.cxx:135
CaloCellContainer.h
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
CaloGain::CaloGain
CaloGain
Definition: CaloGain.h:11
CaloGain::LARMEDIUMGAIN
@ LARMEDIUMGAIN
Definition: CaloGain.h:18
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
LArCellGainPathology::m_onlineID
const LArOnlineID * m_onlineID
Definition: LArCellGainPathology.h:69
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CaloCellContainer::findIndex
int findIndex(const IdentifierHash theHash) const
Return index of the cell with a given hash.
Definition: CaloCellContainer.cxx:363
CaloIdManager.h
LArCellGainPathology::finalize
virtual StatusCode finalize() override
finalize the tool
Definition: LArCellGainPathology.cxx:62
LArFebErrorSummary.h
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
CaloGain::LARLOWGAIN
@ LARLOWGAIN
Definition: CaloGain.h:18
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
StoreGateSvc.h
LArOnlineID.h
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20
Identifier
Definition: IdentifierFieldParser.cxx:14