ATLAS Offline Software
Loading...
Searching...
No Matches
LArHVMapTool Class Reference

#include <LArHVMapTool.h>

Inheritance diagram for LArHVMapTool:
Collaboration diagram for LArHVMapTool:

Public Member Functions

 LArHVMapTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~LArHVMapTool ()=default
virtual StatusCode initialize () override
virtual StatusCode finalize () override
virtual void GetHVLines (const Identifier &id, const CaloDetDescrManager *cddm, std::vector< int > &hvLineVec) const override final
virtual void GetHVLines (const Identifier &id, const CaloDetDescrManager *cddm, std::vector< HWIdentifier > &hvLineId) const override final
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

void GetHVLinesCore (const Identifier &id, const CaloDetDescrManager *cddm, std::vector< int > *hvLineVec, std::vector< HWIdentifier > *hvLineId) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

const CaloIdManagerm_caloIdMgr {nullptr}
const LArEM_IDm_larem_id {nullptr}
const LArHEC_IDm_larhec_id {nullptr}
const LArFCAL_IDm_larfcal_id {nullptr}
const LArHVIdMappingm_hvmapping {nullptr}
SG::ReadCondHandleKey< CaloDetDescrManagerm_caloDetDescrMgrKey {this,"CaloDetDescrManager", "CaloDetDescrManager"}
SG::ReadCondHandleKey< LArHVIdMappingm_hvCablingKey {this, "LArHVIdMapping", "LArHVIdMap", "SG key for HV ID mapping"}
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 17 of file LArHVMapTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ LArHVMapTool()

LArHVMapTool::LArHVMapTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 22 of file LArHVMapTool.cxx.

23 : AthAlgTool(type,name,parent)
24{
25}
AthAlgTool()
Default constructor:

◆ ~LArHVMapTool()

virtual LArHVMapTool::~LArHVMapTool ( )
virtualdefault

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

virtual StatusCode LArHVMapTool::finalize ( )
inlineoverridevirtual

Definition at line 26 of file LArHVMapTool.h.

26{return StatusCode::SUCCESS;}

◆ GetHVLines() [1/2]

void LArHVMapTool::GetHVLines ( const Identifier & id,
const CaloDetDescrManager * cddm,
std::vector< HWIdentifier > & hvLineId ) const
finaloverridevirtual

Implements ILArHVMapTool.

Definition at line 67 of file LArHVMapTool.cxx.

68 {
69 return GetHVLinesCore(id, calodetdescrmgr, nullptr, &hvLineId);
70}
void GetHVLinesCore(const Identifier &id, const CaloDetDescrManager *cddm, std::vector< int > *hvLineVec, std::vector< HWIdentifier > *hvLineId) const

◆ GetHVLines() [2/2]

void LArHVMapTool::GetHVLines ( const Identifier & id,
const CaloDetDescrManager * cddm,
std::vector< int > & hvLineVec ) const
finaloverridevirtual

Implements ILArHVMapTool.

Definition at line 62 of file LArHVMapTool.cxx.

63 {
64 return GetHVLinesCore(id, calodetdescrmgr, &hvLineVec, nullptr);
65}

◆ GetHVLinesCore()

void LArHVMapTool::GetHVLinesCore ( const Identifier & id,
const CaloDetDescrManager * cddm,
std::vector< int > * hvLineVec,
std::vector< HWIdentifier > * hvLineId ) const
private

Definition at line 72 of file LArHVMapTool.cxx.

73 {
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++) {
89 HWIdentifier hvline;
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++) {
105 HWIdentifier hvline;
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);
121 HWIdentifier hvline;
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;
142 HWIdentifier hvline;
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++) {
158 HWIdentifier hvline;
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 ();
170 HWIdentifier hvline;
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}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
EMBCellConstLink getEMBCell() const
EMB Cell description from LArReadoutGeometry.
const EMBHVModule & getModule() const
int hvLineNo(const EMBHVElectrode &electrode, int gap, const LArHVIdMapping *hvIdMapping, HWIdentifier *hvlId=nullptr) const
const EMBHVManager & getManager() const
int hvLineNo(const EMBPresamplerHVModule &module, int gap, const LArHVIdMapping *hvIdMapping, HWIdentifier *hvlId=nullptr) const
const EMBPresamplerHVManager & getManager() const
EMECCellConstLink getEMECCell() const
EMEC Cell description from LArReadoutGeometry.
const EMECHVModule & getModule() const
int hvLineNo(const EMECHVElectrode &electrode, int gap, const LArHVIdMapping *hvIdMapping, HWIdentifier *hvlId=nullptr) const
const EMECHVManager & getManager() const
int hvLineNo(const EMECPresamplerHVModule &module, const LArHVIdMapping *hvIdMapping, HWIdentifier *hvlineId=nullptr) const
const EMECPresamplerHVManager & getManager() const
const FCALTile * getFCALTile() const
FCAL Tile description from LArReadoutGeometry.
HECCellConstLink getHECCell() const
HEC Cell description from LArReadoutGeometry.
int hvLineNo(const HECHVSubgap &subgap, const LArHVIdMapping *hvIdMapping, HWIdentifier *hvlId=nullptr) const
const HECHVManager & getManager() const
const HECHVModule & getModule() const
const LArEM_ID * m_larem_id
const LArFCAL_ID * m_larfcal_id
const LArHVIdMapping * m_hvmapping
const LArHEC_ID * m_larhec_id

◆ initialize()

StatusCode LArHVMapTool::initialize ( )
overridevirtual

Definition at line 27 of file LArHVMapTool.cxx.

27 {
28
30
31 m_larem_id = m_caloIdMgr->getEM_ID();
32 m_larhec_id = m_caloIdMgr->getHEC_ID();
33 m_larfcal_id = m_caloIdMgr->getFCAL_ID();
34
35 ATH_CHECK(m_caloDetDescrMgrKey.initialize());
36 ATH_CHECK( m_hvCablingKey.initialize() );
37
38 ATH_MSG_DEBUG("LArHVMapTool::initialize ...");
39
40 const EventContext& ctx = Gaudi::Hive::currentContext();
41
42 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{m_caloDetDescrMgrKey,ctx};
43 const CaloDetDescrManager *calodetdescrmgr = *caloMgrHandle;
44 SG::ReadCondHandle<LArHVIdMapping> hvCabling (m_hvCablingKey, ctx);
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
const ServiceHandle< StoreGateSvc > & detStore() const
SG::ReadCondHandleKey< LArHVIdMapping > m_hvCablingKey
virtual void GetHVLines(const Identifier &id, const CaloDetDescrManager *cddm, std::vector< int > &hvLineVec) const override final
const CaloIdManager * m_caloIdMgr
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloDetDescrMgrKey
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & ILArHVMapTool::interfaceID ( )
inlinestaticinherited

Definition at line 36 of file ILArHVMapTool.h.

37{
38 return IID_ILArHVMapTool;
39}
static const InterfaceID IID_ILArHVMapTool("ILArHVMapTool", 1, 0)

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_caloDetDescrMgrKey

SG::ReadCondHandleKey<CaloDetDescrManager> LArHVMapTool::m_caloDetDescrMgrKey {this,"CaloDetDescrManager", "CaloDetDescrManager"}
private

Definition at line 45 of file LArHVMapTool.h.

46{this,"CaloDetDescrManager", "CaloDetDescrManager"};

◆ m_caloIdMgr

const CaloIdManager* LArHVMapTool::m_caloIdMgr {nullptr}
private

Definition at line 38 of file LArHVMapTool.h.

38{nullptr};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_hvCablingKey

SG::ReadCondHandleKey<LArHVIdMapping> LArHVMapTool::m_hvCablingKey {this, "LArHVIdMapping", "LArHVIdMap", "SG key for HV ID mapping"}
private

Definition at line 47 of file LArHVMapTool.h.

48{this, "LArHVIdMapping", "LArHVIdMap", "SG key for HV ID mapping"};

◆ m_hvmapping

const LArHVIdMapping* LArHVMapTool::m_hvmapping {nullptr}
private

Definition at line 43 of file LArHVMapTool.h.

43{nullptr};

◆ m_larem_id

const LArEM_ID* LArHVMapTool::m_larem_id {nullptr}
private

Definition at line 39 of file LArHVMapTool.h.

39{nullptr};

◆ m_larfcal_id

const LArFCAL_ID* LArHVMapTool::m_larfcal_id {nullptr}
private

Definition at line 41 of file LArHVMapTool.h.

41{nullptr};

◆ m_larhec_id

const LArHEC_ID* LArHVMapTool::m_larhec_id {nullptr}
private

Definition at line 40 of file LArHVMapTool.h.

40{nullptr};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: