ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SCT_CablingTool Class Reference

#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) More...
 
virtual unsigned int size () const override
 
virtual bool empty (const EventContext &ctx) const override
 is the data structure empty? More...
 
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) More...
 
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) More...
 
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 More...
 
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) More...
 
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) More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
const SCT_IDm_idHelper {nullptr}
 helper for offlineId/hash conversions More...
 
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 }

◆ ~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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ getData()

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

Definition at line 253 of file SCT_CablingTool.cxx.

253  {
255  return condData.retrieve();
256 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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;
143  return getOnlineIdFromHash(hash, ctx);
144 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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);
55  ATH_CHECK(detStore()->retrieve(m_idHelper, "SCT_ID"));
57  return StatusCode::SUCCESS;
58 }

◆ 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.

◆ 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.

◆ m_usingDatabase

bool SCT_CablingTool::m_usingDatabase {true}
private

Definition at line 100 of file SCT_CablingTool.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
SCT_CablingTool::m_usingDatabase
bool m_usingDatabase
Definition: SCT_CablingTool.h:100
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
SCT_CablingTool::size
virtual unsigned int size() const override
Definition: SCT_CablingTool.cxx:73
SCT_CablingTool::getRobIdFromOfflineId
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)
Definition: SCT_CablingTool.cxx:166
SCT_CablingTool::getOnlineIdFromHash
virtual SCT_OnlineId getOnlineIdFromHash(const IdentifierHash &hash, const EventContext &ctx) const override
return the online Id, given a hash (used by simulation encoders)
Definition: SCT_CablingTool.cxx:122
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
SCT_CablingTool::getHashesForRod
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
Definition: SCT_CablingTool.cxx:235
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
SCT_OnlineId::INVALID_ONLINE_ID
@ INVALID_ONLINE_ID
Definition: SCT_OnlineId.h:57
SCT_CablingTool::getRobIdFromHash
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)
Definition: SCT_CablingTool.cxx:154
SCT_OnlineId::FIRST_FIBRE
@ FIRST_FIBRE
Definition: SCT_OnlineId.h:57
SCT_OnlineId
Definition: SCT_OnlineId.h:22
SCT_CablingTool::getData
const SCT_CablingData * getData(const EventContext &ctx) const
Definition: SCT_CablingTool.cxx:253
Identifier::is_valid
bool is_valid() const
Check if id is in a valid state.
SCT_CablingTool::getOnlineIdFromOfflineId
virtual SCT_OnlineId getOnlineIdFromOfflineId(const Identifier &offlineId, const EventContext &ctx) const override
return the online Id, given an offlineId
Definition: SCT_CablingTool.cxx:140
SCT_OnlineId::is_valid
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...
Definition: SCT_OnlineId.cxx:76
SCT_CablingTool::getHashFromSerialNumber
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...
Definition: SCT_CablingTool.cxx:178
lumiFormat.i
int i
Definition: lumiFormat.py:85
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
SCT_CablingTool::m_idHelper
const SCT_ID * m_idHelper
helper for offlineId/hash conversions
Definition: SCT_CablingTool.h:99
file
TFile * file
Definition: tile_monitor.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SCT_ID::wafer_hash
IdentifierHash wafer_hash(const Identifier &wafer_id) const
wafer hash from id - optimized
Definition: SCT_ID.h:492
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
SCT_CablingTool::getSerialNumberFromHash
virtual SCT_SerialNumber getSerialNumberFromHash(const IdentifierHash &hash, const EventContext &ctx) const override
get module serial number from hash, needed during filling of data structure
Definition: SCT_CablingTool.cxx:197
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
SCT_CablingData
Definition: SCT_CablingData.h:35
SCT_CablingTool::getHashFromOnlineId
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)
Definition: SCT_CablingTool.cxx:92
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
SCT_SerialNumber::isWellFormed
bool isWellFormed() const
Cursory check on whether the serial number is well formed N.B.
Definition: SCT_SerialNumber.cxx:81
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SCT_CablingTool::m_cablingDataSource
StringProperty m_cablingDataSource
the name of the data source
Definition: SCT_CablingTool.h:98
SCT_CablingTool::getAllRods
virtual void getAllRods(std::vector< std::uint32_t > &usersVector, const EventContext &ctx) const override
fill a users vector with all the RodIds
Definition: SCT_CablingTool.cxx:218
SCT_CablingTool::m_data
SG::ReadCondHandleKey< SCT_CablingData > m_data
Definition: SCT_CablingTool.h:97
SCT_CablingTool::empty
virtual bool empty() const override
Definition: SCT_CablingTool.cxx:85
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
SCT_OnlineId::rod
std::uint32_t rod() const
Return the rod/rob Id.
Definition: SCT_OnlineId.cxx:59