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

#include <LArIdMapConvert.h>

Inheritance diagram for LArIdMapConvert:
Collaboration diagram for LArIdMapConvert:

Public Member Functions

 LArIdMapConvert (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor with parameters:
virtual ~LArIdMapConvert ()
 Destructor:
virtual StatusCode initialize () override
virtual StatusCode execute () override
virtual StatusCode finalize () override
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
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 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

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

 LArIdMapConvert ()
 Default constructor:
void print (const HWIdentifier &hwid, std::ostream &out=std::cout)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadCondHandleKey< LArOnOffIdMappingm_cablingKey {this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}
SG::ReadCondHandleKey< LArCalibLineMappingm_CLKey {this, "SCCalibLineKey", "LArCalibLineMapSC", "SG calib line key"}
const LArOnlineIDm_onlineID
const CaloCell_IDm_caloCellID
DataObjIDColl m_extendedExtraObjects
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 23 of file LArIdMapConvert.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ LArIdMapConvert() [1/2]

LArIdMapConvert::LArIdMapConvert ( const std::string & name,
ISvcLocator * pSvcLocator )

Constructor with parameters:

Definition at line 13 of file LArIdMapConvert.cxx.

14 :
15 ::AthAlgorithm( name, pSvcLocator ),
16 m_onlineID(nullptr),
17 m_caloCellID(nullptr)
18{
19
20}
AthAlgorithm()
Default constructor:
const CaloCell_ID * m_caloCellID
const LArOnlineID * m_onlineID

◆ ~LArIdMapConvert()

LArIdMapConvert::~LArIdMapConvert ( )
virtual

Destructor:

Definition at line 22 of file LArIdMapConvert.cxx.

24{}

◆ LArIdMapConvert() [2/2]

LArIdMapConvert::LArIdMapConvert ( )
private

Default constructor:

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::evtStore ( )
inlineinherited

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

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode LArIdMapConvert::execute ( )
overridevirtual

Definition at line 44 of file LArIdMapConvert.cxx.

44 {
45
46 const uint32_t onlHashMax=m_onlineID->channelHashMax();
47
48 SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey};
49 const LArOnOffIdMapping* cabling{*cablingHdl};
50 if(!cabling) {
51 ATH_MSG_ERROR( "Do not have cabling mapping from key " << m_cablingKey.key() );
52 return StatusCode::FAILURE;
53 }
54 SG::ReadCondHandle<LArCalibLineMapping> clHdl{m_CLKey};
55 const LArCalibLineMapping *clCont {*clHdl};
56 if(!clCont) {
57 ATH_MSG_ERROR( "Do not have calib line mapping !!!" );
58 return StatusCode::FAILURE;
59 }
60
61 coral::AttributeListSpecification* spec_onOff = new coral::AttributeListSpecification();
62 spec_onOff->extend("OnlineHashToOfflineId", "blob");
63 spec_onOff->extend<unsigned>("version");
64 AthenaAttributeList* al_onOff = new AthenaAttributeList(*spec_onOff);
65 coral::Blob& blobOnOff=(*al_onOff)["OnlineHashToOfflineId"].data<coral::Blob>();
66 (*al_onOff)["version"].setValue(0U);
67 blobOnOff.resize(onlHashMax*sizeof(uint32_t));
68
69 spec_onOff->release();
70 // cppcheck-suppress memleak
71 spec_onOff = nullptr;
72
73 coral::AttributeListSpecification* spec_calib = new coral::AttributeListSpecification();
74 spec_calib->extend("OnlineHashToCalibIds", "blob");
75 spec_calib->extend<unsigned>("version");
76 AthenaAttributeList* al_calib = new AthenaAttributeList(*spec_calib);
77 coral::Blob& blobCalib=(*al_calib)["OnlineHashToCalibIds"].data<coral::Blob>();
78 (*al_calib)["version"].setValue(0U);
79 blobCalib.resize(onlHashMax*sizeof(uint32_t)*3); //Bigger than necessary
80
81 spec_calib->release();
82 // cppcheck-suppress memleak
83 spec_calib = nullptr;
84
85 uint32_t* pBlobOnOff=static_cast<uint32_t*>(blobOnOff.startingAddress());
86 uint32_t* pBlobCalib=static_cast<uint32_t*>(blobCalib.startingAddress());
87
88 size_t index=0;
89 size_t calibIndex=0;
90
91 std::vector<unsigned> calibHist(5,0);
92
93 std::ofstream outfile("identifiers.txt");
94
95 outfile << "hash id bec pn FT SL chan id calo pn sampl reg eta phi calib" << std::endl;
96
97 for (uint32_t onlHash=0;onlHash<onlHashMax;++onlHash) {
98 const HWIdentifier hwid=m_onlineID->channel_Id(onlHash);
99 print(hwid,outfile);
100 const Identifier id=cabling->cnvToIdentifierFromHash(onlHash);
101 pBlobOnOff[index++]=id.get_identifier32().get_compact();
102
103 const std::vector<HWIdentifier>& calibIDs=clCont->calibSlotLine(hwid);
104 const size_t nCalibLines=calibIDs.size();
105 (calibHist[nCalibLines])++;
106 pBlobCalib[calibIndex++]=nCalibLines;
107 for(uint32_t iCalib=0;iCalib<nCalibLines;++iCalib)
108 pBlobCalib[calibIndex++]=calibIDs[iCalib].get_identifier32().get_compact();
109 }
110
111 blobCalib.resize(calibIndex*sizeof(uint32_t)); //Size down to actual size
112
113
114 outfile.close();
115
116 ATH_MSG_INFO("BlobSize OnOffId:" << index);
117 ATH_MSG_INFO("BlobSize CalibId:" << calibIndex);
118 msg(MSG::INFO) << "nCalib[i] ";
119 for (unsigned j=0;j<5;++j)
120 msg() << calibHist[j] << "/";
121 msg() << endmsg;
122
123 ATH_CHECK(detStore()->record(al_onOff,"/LAR/Identifier/OnOffIdMap"));
124
125 ATH_CHECK(detStore()->record(al_calib,"/LAR/Identifier/CalibIdMap"));
126
127 return StatusCode::SUCCESS;
128}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
const ServiceHandle< StoreGateSvc > & detStore() const
MsgStream & msg() const
const std::vector< HWIdentifier > & calibSlotLine(const HWIdentifier id) const
SG::ReadCondHandleKey< LArCalibLineMapping > m_CLKey
void print(const HWIdentifier &hwid, std::ostream &out=std::cout)
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
str index
Definition DeMoScan.py:362
setEventNumber uint32_t

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::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

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ finalize()

StatusCode LArIdMapConvert::finalize ( )
overridevirtual

Definition at line 37 of file LArIdMapConvert.cxx.

38{
39
40 return StatusCode::SUCCESS;
41}

◆ initialize()

StatusCode LArIdMapConvert::initialize ( )
overridevirtual

Definition at line 26 of file LArIdMapConvert.cxx.

26 {
27
28 ATH_CHECK(detStore()->retrieve(m_onlineID, "LArOnlineID"));
29
30 ATH_CHECK(detStore()->retrieve(m_caloCellID, "CaloCell_ID"));
31
32 ATH_CHECK( m_cablingKey.initialize() );
33
34 return StatusCode::SUCCESS;
35}
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::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.

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

bool AthCommonMsg< Algorithm >::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< Algorithm > >::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.

◆ print()

void LArIdMapConvert::print ( const HWIdentifier & hwid,
std::ostream & out = std::cout )
private

Definition at line 131 of file LArIdMapConvert.cxx.

131 {
132 const IdentifierHash hwid_hash=m_onlineID->channel_Hash(hwid);
133 SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey};
134 const LArOnOffIdMapping* cabling{*cablingHdl};
135 if(!cabling) {
136 ATH_MSG_ERROR( "Do not have cabling mapping from key " << m_cablingKey.key() );
137 return;
138 }
139 SG::ReadCondHandle<LArCalibLineMapping> clHdl{m_CLKey};
140 const LArCalibLineMapping *clCont {*clHdl};
141 if(!clCont) {
142 ATH_MSG_ERROR( "Do not have calib line mapping !!!" );
143 return;
144 }
145 out << hwid_hash << " " << std::hex << "0x" << hwid.get_identifier32().get_compact() << std::dec << " "
146 << m_onlineID->barrel_ec(hwid) << " "
147 << m_onlineID->pos_neg(hwid) << " "
148 << m_onlineID->feedthrough(hwid) << " "
149 << m_onlineID->slot(hwid) << " "
150 << m_onlineID->channel(hwid) << " : ";
151 if (cabling->isOnlineConnected(hwid)) {
152 const Identifier id=cabling->cnvToIdentifier(hwid);
153 out << std::hex << "0x" << id.get_identifier32().get_compact() << std::dec << " "
154 << m_caloCellID->sub_calo(id) << " "
155 << m_caloCellID->pos_neg(id) << " "
156 << m_caloCellID->sampling(id) << " "
157 << m_caloCellID->region(id) << " "
158 << m_caloCellID->eta(id) << " "
159 << m_caloCellID->phi(id) << " ";
160 }
161 else
162 out << " disconnected ";
163
164 const std::vector<HWIdentifier>& calibIDs=clCont->calibSlotLine(hwid);
165 for (size_t i=0;i<calibIDs.size();++i) {
166 out << std::hex << "0x" << calibIDs[i].get_identifier32().get_compact() << " ";
167 }
168 out << std::dec << std::endl;
169}
value_type get_compact() const
Get the compact id.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.

◆ 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< Algorithm > >::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< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
#define ATH_MSG_WARNING(x)
static Double_t sc
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm > >::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_cablingKey

SG::ReadCondHandleKey<LArOnOffIdMapping> LArIdMapConvert::m_cablingKey {this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}
private

Definition at line 42 of file LArIdMapConvert.h.

42{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"};

◆ m_caloCellID

const CaloCell_ID* LArIdMapConvert::m_caloCellID
private

Definition at line 50 of file LArIdMapConvert.h.

◆ m_CLKey

SG::ReadCondHandleKey<LArCalibLineMapping> LArIdMapConvert::m_CLKey {this, "SCCalibLineKey", "LArCalibLineMapSC", "SG calib line key"}
private

Definition at line 43 of file LArIdMapConvert.h.

43{this, "SCCalibLineKey", "LArCalibLineMapSC", "SG calib line key"};

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_onlineID

const LArOnlineID* LArIdMapConvert::m_onlineID
private

Definition at line 49 of file LArIdMapConvert.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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