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

of online and offline identifiers and also serial numbers More...

#include <SCT_CablingTool.h>

Inheritance diagram for SCT_CablingTool:
Collaboration diagram for SCT_CablingTool:

Public Member Functions

 SCT_CablingTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~SCT_CablingTool ()=default
virtual StatusCode initialize () override
virtual unsigned int size (const EventContext &ctx) const override
 size of the data structure (for the SCT should be 8176, one for each module side)
virtual unsigned int size () const override
virtual bool empty (const EventContext &ctx) const override
 is the data structure empty?
virtual bool empty () const override
virtual IdentifierHash getHashFromOnlineId (const SCT_OnlineId &onlineId, const EventContext &ctx, const bool withWarnings=true) const override
 return offline hash, given the online Id (used by decoders)
virtual IdentifierHash getHashFromOnlineId (const SCT_OnlineId &onlineId, const bool withWarnings=true) const override
virtual SCT_OnlineId getOnlineIdFromHash (const IdentifierHash &hash, const EventContext &ctx) const override
 return the online Id, given a hash (used by simulation encoders)
virtual SCT_OnlineId getOnlineIdFromHash (const IdentifierHash &hash) const override
virtual SCT_OnlineId getOnlineIdFromOfflineId (const Identifier &offlineId, const EventContext &ctx) const override
 return the online Id, given an offlineId
virtual SCT_OnlineId getOnlineIdFromOfflineId (const Identifier &offlineId) const override
virtual std::uint32_t getRobIdFromHash (const IdentifierHash &hash, const EventContext &ctx) const override
 return the rob/rod Id, given a hash (used by simulation encoders)
virtual std::uint32_t getRobIdFromHash (const IdentifierHash &hash) const override
virtual std::uint32_t getRobIdFromOfflineId (const Identifier &offlineId, const EventContext &ctx) const override
 return the rob/rod Id, given an offlineId (used by simulation encoders)
virtual std::uint32_t getRobIdFromOfflineId (const Identifier &offlineId) const override
virtual IdentifierHash getHashFromSerialNumber (const SCT_SerialNumber &sn, const EventContext &ctx) const override
 get hash from a module serial number, needed in the conditions service because configurations are stored by module s/n
virtual IdentifierHash getHashFromSerialNumber (const SCT_SerialNumber &sn) const override
virtual SCT_SerialNumber getSerialNumberFromHash (const IdentifierHash &hash, const EventContext &ctx) const override
 get module serial number from hash, needed during filling of data structure
virtual SCT_SerialNumber getSerialNumberFromHash (const IdentifierHash &hash) const override
virtual void getAllRods (std::vector< std::uint32_t > &usersVector, const EventContext &ctx) const override
 fill a users vector with all the RodIds
virtual void getAllRods (std::vector< std::uint32_t > &usersVector) const override
virtual void getHashesForRod (std::vector< IdentifierHash > &usersVector, const std::uint32_t rodId, const EventContext &ctx) const override
 fill a user's vector with all the hash ids which belong to a given rod
virtual void getHashesForRod (std::vector< IdentifierHash > &usersVector, const std::uint32_t rodId) const override

Private Member Functions

const SCT_CablingDatagetData (const EventContext &ctx) const

Private Attributes

SG::ReadCondHandleKey< SCT_CablingDatam_data {this, "SCT_CablingData", "SCT_CablingData", "SCT_CablingData created by SCT_CablingCondAlgFromCoraCool"}
StringProperty m_cablingDataSource
 the name of the data source
const SCT_IDm_idHelper {nullptr}
 helper for offlineId/hash conversions
bool m_usingDatabase {true}

Detailed Description

of online and offline identifiers and also serial numbers

Definition at line 39 of file SCT_CablingTool.h.

Constructor & Destructor Documentation

◆ SCT_CablingTool()

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

Definition at line 43 of file SCT_CablingTool.cxx.

43 :
44 base_class(type, name, parent)
45{
46 declareProperty("DataSource", m_cablingDataSource=defaultSource);
47}
static const std::string defaultSource(coracool)
StringProperty m_cablingDataSource
the name of the data source

◆ ~SCT_CablingTool()

virtual SCT_CablingTool::~SCT_CablingTool ( )
virtualdefault

Member Function Documentation

◆ empty() [1/2]

bool SCT_CablingTool::empty ( ) const
overridevirtual

Definition at line 85 of file SCT_CablingTool.cxx.

85 {
86 const EventContext& ctx{Gaudi::Hive::currentContext()};
87 return empty(ctx);
88}
virtual bool empty() const override

◆ empty() [2/2]

bool SCT_CablingTool::empty ( const EventContext & ctx) const
overridevirtual

is the data structure empty?

Definition at line 80 of file SCT_CablingTool.cxx.

80 {
81 return (size(ctx)==0);
82}
virtual unsigned int size() const override

◆ getAllRods() [1/2]

void SCT_CablingTool::getAllRods ( std::vector< std::uint32_t > & usersVector) const
overridevirtual

Definition at line 229 of file SCT_CablingTool.cxx.

229 {
230 const EventContext& ctx{Gaudi::Hive::currentContext()};
231 getAllRods(usersVector, ctx);
232}
virtual void getAllRods(std::vector< std::uint32_t > &usersVector, const EventContext &ctx) const override
fill a users vector with all the RodIds

◆ getAllRods() [2/2]

void SCT_CablingTool::getAllRods ( std::vector< std::uint32_t > & usersVector,
const EventContext & ctx ) const
overridevirtual

fill a users vector with all the RodIds

Definition at line 218 of file SCT_CablingTool.cxx.

218 {
219 const SCT_CablingData* data{getData(ctx)};
220 if (data==nullptr) {
221 ATH_MSG_FATAL("Filling the cabling FAILED");
222 return;
223 }
224
225 data->getRods(usersVector);
226}
#define ATH_MSG_FATAL(x)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
const SCT_CablingData * getData(const EventContext &ctx) const

◆ getData()

const SCT_CablingData * SCT_CablingTool::getData ( const EventContext & ctx) const
private

Definition at line 253 of file SCT_CablingTool.cxx.

253 {
254 SG::ReadCondHandle<SCT_CablingData> condData{m_data, ctx};
255 return condData.retrieve();
256}
SG::ReadCondHandleKey< SCT_CablingData > m_data
const_pointer_type retrieve()

◆ getHashesForRod() [1/2]

void SCT_CablingTool::getHashesForRod ( std::vector< IdentifierHash > & usersVector,
const std::uint32_t rodId ) const
overridevirtual

Definition at line 247 of file SCT_CablingTool.cxx.

247 {
248 const EventContext& ctx{Gaudi::Hive::currentContext()};
249 getHashesForRod(usersVector, rodId, ctx);
250}
virtual void getHashesForRod(std::vector< IdentifierHash > &usersVector, const std::uint32_t rodId, const EventContext &ctx) const override
fill a user's vector with all the hash ids which belong to a given rod

◆ getHashesForRod() [2/2]

void SCT_CablingTool::getHashesForRod ( std::vector< IdentifierHash > & usersVector,
const std::uint32_t rodId,
const EventContext & ctx ) const
overridevirtual

fill a user's vector with all the hash ids which belong to a given rod

Definition at line 235 of file SCT_CablingTool.cxx.

235 {
236 SCT_OnlineId firstPossibleId{rodId, SCT_OnlineId::FIRST_FIBRE};
237 const bool withWarnings{false};
238 for (SCT_OnlineId i{firstPossibleId}; i!=SCT_OnlineId::INVALID_ONLINE_ID; ++i) {
239 IdentifierHash thisHash(getHashFromOnlineId(i, ctx, withWarnings));
240 if (thisHash != invalidHash) {
241 usersVector.push_back(thisHash);
242 }
243 }
244}
static const IdentifierHash invalidHash
virtual IdentifierHash getHashFromOnlineId(const SCT_OnlineId &onlineId, const EventContext &ctx, const bool withWarnings=true) const override
return offline hash, given the online Id (used by decoders)

◆ getHashFromOnlineId() [1/2]

IdentifierHash SCT_CablingTool::getHashFromOnlineId ( const SCT_OnlineId & onlineId,
const bool withWarnings = true ) const
overridevirtual

Definition at line 115 of file SCT_CablingTool.cxx.

115 {
116 const EventContext& ctx{Gaudi::Hive::currentContext()};
117 return getHashFromOnlineId(onlineId, ctx, withWarnings);
118}

◆ getHashFromOnlineId() [2/2]

IdentifierHash SCT_CablingTool::getHashFromOnlineId ( const SCT_OnlineId & onlineId,
const EventContext & ctx,
const bool withWarnings = true ) const
overridevirtual

return offline hash, given the online Id (used by decoders)

Definition at line 92 of file SCT_CablingTool.cxx.

92 {
93 //is it valid at all?
94 if (not onlineId.is_valid()) {
95 if (withWarnings) ATH_MSG_WARNING("Invalid online id ("<<std::hex<<onlineId<<") "<<std::dec);
96 return invalidHash;
97 }
98 //is it specifically valid for the given datasource?
99 if (not onlineId.is_valid(m_usingDatabase)) {
100 const std::string alternative=m_usingDatabase?"text file cabling":"cabling from database";
101 if (withWarnings) ATH_MSG_WARNING("Invalid online id ("<<std::hex<<onlineId<<") try using the "<<alternative<<std::dec);
102 return invalidHash;
103 }
104
105 const SCT_CablingData* data{getData(ctx)};
106 if (data==nullptr) {
107 ATH_MSG_FATAL("Filling the cabling FAILED");
108 return invalidHash;
109 }
110
111 return data->getHashFromOnlineId(onlineId);
112}
#define ATH_MSG_WARNING(x)
bool is_valid(const bool usingDbCabling) const
Check whether the onlineId is valid, with flag to switch between validity from the database or text f...

◆ getHashFromSerialNumber() [1/2]

IdentifierHash SCT_CablingTool::getHashFromSerialNumber ( const SCT_SerialNumber & sn) const
overridevirtual

Definition at line 191 of file SCT_CablingTool.cxx.

191 {
192 const EventContext& ctx{Gaudi::Hive::currentContext()};
193 return getHashFromSerialNumber(sn, ctx);
194}
virtual IdentifierHash getHashFromSerialNumber(const SCT_SerialNumber &sn, const EventContext &ctx) const override
get hash from a module serial number, needed in the conditions service because configurations are sto...

◆ getHashFromSerialNumber() [2/2]

IdentifierHash SCT_CablingTool::getHashFromSerialNumber ( const SCT_SerialNumber & sn,
const EventContext & ctx ) const
overridevirtual

get hash from a module serial number, needed in the conditions service because configurations are stored by module s/n

Definition at line 178 of file SCT_CablingTool.cxx.

178 {
179 if (not sn.isWellFormed()) return invalidHash;
180
181 const SCT_CablingData* data{getData(ctx)};
182 if (data==nullptr) {
183 ATH_MSG_FATAL("Filling the cabling FAILED");
184 return invalidHash;
185 }
186
187 return data->getHashFromSerialNumber(sn);
188}
bool isWellFormed() const
Cursory check on whether the serial number is well formed N.B.

◆ getOnlineIdFromHash() [1/2]

SCT_OnlineId SCT_CablingTool::getOnlineIdFromHash ( const IdentifierHash & hash) const
overridevirtual

Definition at line 133 of file SCT_CablingTool.cxx.

133 {
134 const EventContext& ctx{Gaudi::Hive::currentContext()};
135 return getOnlineIdFromHash(hash, ctx);
136}
virtual SCT_OnlineId getOnlineIdFromHash(const IdentifierHash &hash, const EventContext &ctx) const override
return the online Id, given a hash (used by simulation encoders)

◆ getOnlineIdFromHash() [2/2]

SCT_OnlineId SCT_CablingTool::getOnlineIdFromHash ( const IdentifierHash & hash,
const EventContext & ctx ) const
overridevirtual

return the online Id, given a hash (used by simulation encoders)

Definition at line 122 of file SCT_CablingTool.cxx.

122 {
123 const SCT_CablingData* data{getData(ctx)};
124 if (data==nullptr) {
125 ATH_MSG_FATAL("Filling the cabling FAILED");
126 return invalidId;
127 }
128
129 return data->getOnlineIdFromHash(hash);
130}
static const ITkStripOnlineId invalidId

◆ getOnlineIdFromOfflineId() [1/2]

SCT_OnlineId SCT_CablingTool::getOnlineIdFromOfflineId ( const Identifier & offlineId) const
overridevirtual

Definition at line 147 of file SCT_CablingTool.cxx.

147 {
148 const EventContext& ctx{Gaudi::Hive::currentContext()};
149 return getOnlineIdFromOfflineId(offlineId, ctx);
150}
virtual SCT_OnlineId getOnlineIdFromOfflineId(const Identifier &offlineId, const EventContext &ctx) const override
return the online Id, given an offlineId

◆ getOnlineIdFromOfflineId() [2/2]

SCT_OnlineId SCT_CablingTool::getOnlineIdFromOfflineId ( const Identifier & offlineId,
const EventContext & ctx ) const
overridevirtual

return the online Id, given an offlineId

Definition at line 140 of file SCT_CablingTool.cxx.

140 {
141 if (not offlineId.is_valid()) return invalidId;
142 IdentifierHash hash(m_idHelper->wafer_hash(offlineId));
143 return getOnlineIdFromHash(hash, ctx);
144}
bool is_valid() const
Check if id is in a valid state.
const SCT_ID * m_idHelper
helper for offlineId/hash conversions

◆ getRobIdFromHash() [1/2]

std::uint32_t SCT_CablingTool::getRobIdFromHash ( const IdentifierHash & hash) const
overridevirtual

Definition at line 159 of file SCT_CablingTool.cxx.

159 {
160 const EventContext& ctx{Gaudi::Hive::currentContext()};
161 return getRobIdFromHash(hash, ctx);
162}
virtual std::uint32_t getRobIdFromHash(const IdentifierHash &hash, const EventContext &ctx) const override
return the rob/rod Id, given a hash (used by simulation encoders)

◆ getRobIdFromHash() [2/2]

std::uint32_t SCT_CablingTool::getRobIdFromHash ( const IdentifierHash & hash,
const EventContext & ctx ) const
overridevirtual

return the rob/rod Id, given a hash (used by simulation encoders)

Definition at line 154 of file SCT_CablingTool.cxx.

154 {
155 return getOnlineIdFromHash(hash, ctx).rod();
156}
std::uint32_t rod() const
Return the rod/rob Id.

◆ getRobIdFromOfflineId() [1/2]

std::uint32_t SCT_CablingTool::getRobIdFromOfflineId ( const Identifier & offlineId) const
overridevirtual

Definition at line 171 of file SCT_CablingTool.cxx.

171 {
172 const EventContext& ctx{Gaudi::Hive::currentContext()};
173 return getRobIdFromOfflineId(offlineId, ctx);
174}
virtual std::uint32_t getRobIdFromOfflineId(const Identifier &offlineId, const EventContext &ctx) const override
return the rob/rod Id, given an offlineId (used by simulation encoders)

◆ getRobIdFromOfflineId() [2/2]

std::uint32_t SCT_CablingTool::getRobIdFromOfflineId ( const Identifier & offlineId,
const EventContext & ctx ) const
overridevirtual

return the rob/rod Id, given an offlineId (used by simulation encoders)

Definition at line 166 of file SCT_CablingTool.cxx.

166 {
167 return getOnlineIdFromOfflineId(offlineId, ctx).rod();
168}

◆ getSerialNumberFromHash() [1/2]

SCT_SerialNumber SCT_CablingTool::getSerialNumberFromHash ( const IdentifierHash & hash) const
overridevirtual

Definition at line 212 of file SCT_CablingTool.cxx.

212 {
213 const EventContext& ctx{Gaudi::Hive::currentContext()};
214 return getSerialNumberFromHash(hash, ctx);
215}
virtual SCT_SerialNumber getSerialNumberFromHash(const IdentifierHash &hash, const EventContext &ctx) const override
get module serial number from hash, needed during filling of data structure

◆ getSerialNumberFromHash() [2/2]

SCT_SerialNumber SCT_CablingTool::getSerialNumberFromHash ( const IdentifierHash & hash,
const EventContext & ctx ) const
overridevirtual

get module serial number from hash, needed during filling of data structure

Definition at line 197 of file SCT_CablingTool.cxx.

197 {
198 if (not hash.is_valid()) return invalidSn;
199 //hash must be even
200 IdentifierHash evenHash{even(hash)};
201
202 const SCT_CablingData* data{getData(ctx)};
203 if (data==nullptr) {
204 ATH_MSG_FATAL("Filling the cabling FAILED");
205 return invalidSn;
206 }
207
208 return data->getSerialNumberFromHash(evenHash);
209}
static const SCT_SerialNumber invalidSn

◆ initialize()

StatusCode SCT_CablingTool::initialize ( )
overridevirtual

Definition at line 51 of file SCT_CablingTool.cxx.

51 {
52 ATH_MSG_DEBUG("Initialize SCT cabling");
53 const std::string cablingDataSource = m_cablingDataSource.value();
54 m_usingDatabase=(cablingDataSource == coracool) or (cablingDataSource == coolVectorPayload) or (cablingDataSource == file);
56 ATH_CHECK(m_data.initialize());
57 return StatusCode::SUCCESS;
58}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
static const std::string coolVectorPayload("COOLVECTOR")
static const std::string coracool("CORACOOL")
retrieve(aClass, aKey=None)
Definition PyKernel.py:110
TFile * file

◆ size() [1/2]

unsigned int SCT_CablingTool::size ( ) const
overridevirtual

Definition at line 73 of file SCT_CablingTool.cxx.

73 {
74 const EventContext& ctx{Gaudi::Hive::currentContext()};
75 return size(ctx);
76}

◆ size() [2/2]

unsigned int SCT_CablingTool::size ( const EventContext & ctx) const
overridevirtual

size of the data structure (for the SCT should be 8176, one for each module side)

Definition at line 62 of file SCT_CablingTool.cxx.

62 {
63 const SCT_CablingData* data{getData(ctx)};
64 if (data==nullptr) {
65 ATH_MSG_FATAL("Filling the cabling FAILED");
66 return 0;
67 }
68
69 return data->getHashEntries();
70}

Member Data Documentation

◆ m_cablingDataSource

StringProperty SCT_CablingTool::m_cablingDataSource
private

the name of the data source

Definition at line 98 of file SCT_CablingTool.h.

◆ m_data

SG::ReadCondHandleKey<SCT_CablingData> SCT_CablingTool::m_data {this, "SCT_CablingData", "SCT_CablingData", "SCT_CablingData created by SCT_CablingCondAlgFromCoraCool"}
private

Definition at line 97 of file SCT_CablingTool.h.

97{this, "SCT_CablingData", "SCT_CablingData", "SCT_CablingData created by SCT_CablingCondAlgFromCoraCool"};

◆ m_idHelper

const SCT_ID* SCT_CablingTool::m_idHelper {nullptr}
private

helper for offlineId/hash conversions

Definition at line 99 of file SCT_CablingTool.h.

99{nullptr};

◆ m_usingDatabase

bool SCT_CablingTool::m_usingDatabase {true}
private

Definition at line 100 of file SCT_CablingTool.h.

100{true};

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