Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
LArHVMapTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "LArHVMapTool.h"
11 
12 #include "LArHV/EMBHVElectrode.h"
13 #include "LArHV/EMBHVManager.h"
16 #include "LArHV/EMECHVElectrode.h"
18 #include "LArHV/HECHVSubgap.h"
19 #include "LArHV/FCALHVLine.h"
20 #include "LArHV/FCALHVManager.h"
21 
22 LArHVMapTool::LArHVMapTool(const std::string& type, const std::string& name, const IInterface* parent)
24 {
25 }
26 
28 
30 
34 
37 
38  ATH_MSG_DEBUG("LArHVMapTool::initialize ...");
39 
40  const EventContext& ctx = Gaudi::Hive::currentContext();
41 
43  const CaloDetDescrManager *calodetdescrmgr = *caloMgrHandle;
45  m_hvmapping=*hvCabling;
46  if(!m_hvmapping) {
47  ATH_MSG_ERROR("Could not get HV mapping !");
48  return StatusCode::FAILURE;
49  } else {
50  ATH_MSG_DEBUG("Got HV mapping !");
51  }
52 
53  IdentifierHash h=0;
54  Identifier offId;
55  m_larem_id->get_id(h,offId);
56  std::vector<int> hvlineVec;
57  GetHVLines(offId, calodetdescrmgr, hvlineVec);
58 
59  return StatusCode::SUCCESS;
60 }
61 
62 void LArHVMapTool::GetHVLines(const Identifier& id, const CaloDetDescrManager *calodetdescrmgr,
63  std::vector<int> &hvLineVec) const {
64  return GetHVLinesCore(id, calodetdescrmgr, &hvLineVec, nullptr);
65 }
66 
67 void LArHVMapTool::GetHVLines(const Identifier& id, const CaloDetDescrManager *calodetdescrmgr,
68  std::vector<HWIdentifier> &hvLineId) const {
69  return GetHVLinesCore(id, calodetdescrmgr, nullptr, &hvLineId);
70 }
71 
72 void LArHVMapTool::GetHVLinesCore(const Identifier& id, const CaloDetDescrManager *calodetdescrmgr,
73  std::vector<int> *hvLineVec, std::vector<HWIdentifier> *hvLineId) const {
74  std::set<int> hv;
75  std::set<HWIdentifier> hvId;
76  if(hvLineVec) hvLineVec->clear();
77  if(hvLineId) hvLineId->clear();
78 
79  // LAr EMB
80  if (m_larem_id->is_lar_em(id) && m_larem_id->sampling(id)>0) {
81  if (abs(m_larem_id->barrel_ec(id))==1) {
82  const EMBDetectorElement* embElement = dynamic_cast<const EMBDetectorElement*>(calodetdescrmgr->get_element(id));
83  if (embElement) {
84  const EMBCellConstLink &cell = embElement->getEMBCell();
85  unsigned int nelec = cell->getNumElectrodes();
86  for (unsigned int i=0;i<nelec;i++) {
87  const EMBHVElectrode &electrode = cell->getElectrode(i);
88  for (unsigned int igap=0;igap<2;igap++) {
90  hv.insert(electrode.getModule().getManager().hvLineNo(electrode,igap, m_hvmapping, &hvline));
91  hvId.insert(hvline);
92  }
93  }
94  } else {
95  ATH_MSG_ERROR( "Failed d'cast to EMBDetectorElement" );
96  }
97  } else { // LAr EMEC
98  const EMECDetectorElement* emecElement = dynamic_cast<const EMECDetectorElement*>(calodetdescrmgr->get_element(id));
99  if (emecElement) {
100  const EMECCellConstLink cell = emecElement->getEMECCell();
101  unsigned int nelec = cell->getNumElectrodes();
102  for (unsigned int i=0;i<nelec;i++) {
103  const EMECHVElectrode &electrode = cell->getElectrode(i);
104  for (unsigned int igap=0;igap<2;igap++) {
106  hv.insert(electrode.getModule().getManager().hvLineNo( electrode, igap, m_hvmapping, &hvline));
107  hvId.insert(hvline);
108  }
109  }
110  } else {
111  ATH_MSG_ERROR( "Failed d'cast to EMECDetectorElement" );
112  }
113  }
114  } else if (m_larhec_id->is_lar_hec(id)) { // LAr HEC
115  const HECDetectorElement* hecElement = dynamic_cast<const HECDetectorElement*>(calodetdescrmgr->get_element(id));
116  if (hecElement) {
117  const HECCellConstLink cell = hecElement->getHECCell();
118  unsigned int nsubgaps = cell->getNumSubgaps();
119  for (unsigned int igap=0;igap<nsubgaps;igap++) {
120  const HECHVSubgap &subgap = cell->getSubgap(igap);
122  hv.insert(subgap.getModule().getManager().hvLineNo(subgap,m_hvmapping,&hvline));
123  hvId.insert(hvline);
124  }
125  } else {
126  ATH_MSG_ERROR( "Failed d'cast to HECDetectorElement" );
127  }
128  } else if (m_larfcal_id->is_lar_fcal(id)) { // LAr FCAL
129  const FCALDetectorElement* fcalElement = dynamic_cast<const FCALDetectorElement*>(calodetdescrmgr->get_element(id));
130  if (fcalElement) {
131  const FCALTile* tile = fcalElement->getFCALTile();
132  unsigned int nlines = tile->getNumHVLines();
133  unsigned int nlines_found=0;
134  for (unsigned int i=0;i<nlines;i++) {
135  const FCALHVLine *line = tile->getHVLine(i);
136  if (line) nlines_found++;
137  }
138  if ( nlines_found>0 ) {
139  for (unsigned int i=0;i<nlines;i++) {
140  const FCALHVLine *line = tile->getHVLine(i);
141  if (!line) continue;
143  hv.insert(line->getModule().getManager().hvLineNo(*line,m_hvmapping,&hvline));
144  hvId.insert(hvline);
145  }
146  }
147  } else {
148  ATH_MSG_ERROR( "Failed d'cast to FCALDetectorElement" );
149  }
150 
151  } else if (m_larem_id->is_lar_em(id) && m_larem_id->sampling(id)==0) { // Presamplers
152  if (abs(m_larem_id->barrel_ec(id))==1) {
153  const EMBDetectorElement* embElement = dynamic_cast<const EMBDetectorElement*>(calodetdescrmgr->get_element(id));
154  if (embElement) {
155  const EMBCellConstLink cell = embElement->getEMBCell();
156  const EMBPresamplerHVModule &hvmodule = cell->getPresamplerHVModule();
157  for (unsigned int igap=0;igap<2;igap++) {
159  hv.insert(hvmodule.getManager().hvLineNo(hvmodule,igap,m_hvmapping,&hvline));
160  hvId.insert(hvline);
161  }
162  } else {
163  ATH_MSG_ERROR( "Failed d'cast to EMBDetectorElement (for presampler)" );
164  }
165  } else {
166  const EMECDetectorElement* emecElement = dynamic_cast<const EMECDetectorElement*>(calodetdescrmgr->get_element(id));
167  if (emecElement) {
168  const EMECCellConstLink cell = emecElement->getEMECCell();
169  const EMECPresamplerHVModule &hvmodule = cell->getPresamplerHVModule ();
171  hv.insert(hvmodule.getManager().hvLineNo(hvmodule, m_hvmapping, &hvline));
172  hvId.insert(hvline);
173  } else {
174  ATH_MSG_ERROR( "Failed d'cast to EMECDetectorElement (for presampler)" );
175  }
176  }
177  }
178 
179  ATH_MSG_VERBOSE("Found "<<hvId.size()<<" hvIds for id: "<<id.get_identifier32().get_compact());
180 
181  if(hvLineVec) {
182  for (std::set<int>::iterator i=hv.begin();i!=hv.end();++i) hvLineVec->push_back(*i);
183  }
184  if(hvLineId) {
185  for (std::set<HWIdentifier>::iterator i=hvId.begin();i!=hvId.end();++i) hvLineId->push_back(*i);
186  }
187  return;
188 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
EMBHVElectrode
Definition: EMBHVElectrode.h:15
EMECHVElectrode.h
LArEM_ID.h
EMECDetectorElement
LAr EMEC Detector Element.
Definition: CaloDetectorElements.h:116
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
EMECHVModule::getManager
const EMECHVManager & getManager() const
Definition: EMECHVModule.cxx:140
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
AtlasDetectorID::is_lar_fcal
bool is_lar_fcal(Identifier id) const
Definition: AtlasDetectorID.h:839
collListGuids.line
string line
Definition: collListGuids.py:77
LArHVMapTool::m_hvCablingKey
SG::ReadCondHandleKey< LArHVIdMapping > m_hvCablingKey
Definition: LArHVMapTool.h:48
EMBPresamplerHVManager.h
CaloIdManager::getEM_ID
const LArEM_ID * getEM_ID(void) const
Definition: CaloIdManager.cxx:80
CaloDetDescrManager_Base::get_element
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
Definition: CaloDetDescrManager.cxx:159
CaloIDHelper::get_id
virtual int get_id(const IdentifierHash &hash_id, Identifier &id, const IdContext *context=0) const
Convert a hash code to an Identifier for either channels or regions, depending on the context.
Definition: CaloIDHelper.cxx:119
LArEM_Base_ID::sampling
int sampling(const Identifier id) const
return sampling according to :
HECHVModule::getManager
const HECHVManager & getManager() const
Definition: HECHVModule.cxx:89
EMECHVManager::hvLineNo
int hvLineNo(const EMECHVElectrode &electrode, int gap, const LArHVIdMapping *hvIdMapping, HWIdentifier *hvlId=nullptr) const
Definition: EMECHVManager.cxx:396
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
LArHVMapTool::LArHVMapTool
LArHVMapTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: LArHVMapTool.cxx:22
FCALDetectorElement::getFCALTile
const FCALTile * getFCALTile() const
FCAL Tile description from LArReadoutGeometry.
Definition: CaloDetectorElements.h:286
LArHEC_ID.h
EMBPresamplerHVModule::getManager
const EMBPresamplerHVManager & getManager() const
Definition: EMBPresamplerHVModule.cxx:85
EMECDetectorElement::getEMECCell
EMECCellConstLink getEMECCell() const
EMEC Cell description from LArReadoutGeometry.
Definition: CaloDetectorElements.h:141
EMBDetectorElement
LAr EMB Detector Element.
Definition: CaloDetectorElements.h:52
HWIdentifier
Definition: HWIdentifier.h:13
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
EMECPresamplerHVModule.h
EMBHVElectrode.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
HECDetectorElement
LAr HEC Detector Element.
Definition: CaloDetectorElements.h:189
ReadCellNoiseFromCool.tile
tile
Definition: ReadCellNoiseFromCool.py:92
FCALHVLine.h
FCALTile
A tile of the forward calorimeter readout geometry.
Definition: FCALTile.h:27
dumpHVPathFromNtuple.hvline
hvline
Definition: dumpHVPathFromNtuple.py:72
FCALHVLine
Definition: FCALHVLine.h:15
EMBHVModule::getManager
const EMBHVManager & getManager() const
Definition: EMBHVModule.cxx:114
CaloIdManager::getHEC_ID
const LArHEC_ID * getHEC_ID(void) const
Definition: CaloIdManager.cxx:95
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h: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
FCALDetectorElement
LAr FCAL Detector Element.
Definition: CaloDetectorElements.h:261
EMBHVManager::hvLineNo
int hvLineNo(const EMBHVElectrode &electrode, int gap, const LArHVIdMapping *hvIdMapping, HWIdentifier *hvlId=nullptr) const
Definition: EMBHVManager.cxx:351
CaloIdManager::getFCAL_ID
const LArFCAL_ID * getFCAL_ID(void) const
Definition: CaloIdManager.cxx:85
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
AtlasDetectorID::is_lar_hec
bool is_lar_hec(Identifier id) const
Definition: AtlasDetectorID.h:829
HECHVSubgap.h
HECHVSubgap::getModule
const HECHVModule & getModule() const
Definition: HECHVSubgap.cxx:34
LArHVMapTool::GetHVLinesCore
void GetHVLinesCore(const Identifier &id, const CaloDetDescrManager *cddm, std::vector< int > *hvLineVec, std::vector< HWIdentifier > *hvLineId) const
Definition: LArHVMapTool.cxx:72
LArHVMapTool::m_larfcal_id
const LArFCAL_ID * m_larfcal_id
Definition: LArHVMapTool.h:41
EMBPresamplerHVModule.h
EMBHVElectrode::getModule
const EMBHVModule & getModule() const
Definition: EMBHVElectrode.cxx:32
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
LArEM_Base_ID::barrel_ec
int barrel_ec(const Identifier id) const
return barrel_ec according to :
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
EMECHVElectrode::getModule
const EMECHVModule & getModule() const
Definition: EMECHVElectrode.cxx:37
EMBDetectorElement::getEMBCell
EMBCellConstLink getEMBCell() const
EMB Cell description from LArReadoutGeometry.
Definition: CaloDetectorElements.h:77
LArFCAL_ID.h
h
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition: CaloDetDescrManager.h:473
FCALHVManager.h
LArHVMapTool::m_caloDetDescrMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloDetDescrMgrKey
Definition: LArHVMapTool.h:46
EMECPresamplerHVManager::hvLineNo
int hvLineNo(const EMECPresamplerHVModule &module, const LArHVIdMapping *hvIdMapping, HWIdentifier *hvlineId=nullptr) const
Definition: EMECPresamplerHVManager.cxx:249
EMECPresamplerHVModule
Describes one HV Module within the EMEc Presampler.
Definition: EMECPresamplerHVModule.h:22
LArHVMapTool::initialize
virtual StatusCode initialize() override
Definition: LArHVMapTool.cxx:27
LArHVMapTool::m_caloIdMgr
const CaloIdManager * m_caloIdMgr
Definition: LArHVMapTool.h:38
CaloIdManager.h
EMECPresamplerHVModule::getManager
const EMECPresamplerHVManager & getManager() const
Definition: EMECPresamplerHVModule.cxx:68
LArHVMapTool::m_larem_id
const LArEM_ID * m_larem_id
Definition: LArHVMapTool.h:39
LArHVMapTool::m_hvmapping
const LArHVIdMapping * m_hvmapping
Definition: LArHVMapTool.h:43
EMECHVElectrode
Definition: EMECHVElectrode.h:15
HECDetectorElement::getHECCell
HECCellConstLink getHECCell() const
HEC Cell description from LArReadoutGeometry.
Definition: CaloDetectorElements.h:214
AthAlgTool
Definition: AthAlgTool.h:26
LArHVMapTool.h
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
HECHVManager::hvLineNo
int hvLineNo(const HECHVSubgap &subgap, const LArHVIdMapping *hvIdMapping, HWIdentifier *hvlId=nullptr) const
Definition: HECHVManager.cxx:298
LArHVMapTool::m_larhec_id
const LArHEC_ID * m_larhec_id
Definition: LArHVMapTool.h:40
LArHVMapTool::GetHVLines
virtual void GetHVLines(const Identifier &id, const CaloDetDescrManager *cddm, std::vector< int > &hvLineVec) const override final
Definition: LArHVMapTool.cxx:62
EMBPresamplerHVManager::hvLineNo
int hvLineNo(const EMBPresamplerHVModule &module, int gap, const LArHVIdMapping *hvIdMapping, HWIdentifier *hvlId=nullptr) const
Definition: EMBPresamplerHVManager.cxx:284
AtlasDetectorID::is_lar_em
bool is_lar_em(Identifier id) const
Definition: AtlasDetectorID.h:818
HECHVSubgap
Definition: HECHVSubgap.h:15
EMBHVManager.h
EMBPresamplerHVModule
Describes one HV Module within the EMB Presampler.
Definition: EMBPresamplerHVModule.h:22
CaloDetectorElements.h
Calo Subsystem specific Detector Elements + Dummy element for testing.
Identifier
Definition: IdentifierFieldParser.cxx:14