ATLAS Offline Software
Loading...
Searching...
No Matches
ITkStripCablingTool.cxx
Go to the documentation of this file.
1/*
2/ Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
13
14//this package
15#include "ITkStripCablingTool.h"
16
17//Athena
19#include "Identifier/Identifier.h"
21
22//Gaudi includes
23#include "GaudiKernel/StatusCode.h"
24
25//constants in file scope
26static const std::string coracool("CORACOOL");
27static const std::string coolVectorPayload("COOLVECTOR");
28static const std::string defaultSource(coracool);
29static const std::string file("ITkStrip_Sept08Cabling_svc.dat");
30//invalid identifiers to return in case of error
31static const ITkStripOnlineId invalidId;
32
33
34StatusCode
36 ATH_MSG_DEBUG("Initialize ITkStrip cabling");
37 const std::string cablingDataSource = m_cablingDataSource.value();
38 m_usingDatabase=(cablingDataSource == coracool) or (cablingDataSource == coolVectorPayload) or (cablingDataSource == file);
39 ATH_CHECK(detStore()->retrieve(m_idHelper, "SCT_ID"));
40 ATH_CHECK(m_data.initialize());
41 return StatusCode::SUCCESS;
42}
43
44//
46ITkStripCablingTool::getHashFromOnlineId(const ITkStripOnlineId& /*onlineId*/, const EventContext& /*ctx*/, const bool /*withWarnings*/) const {
47 return 0;
48}
49
51ITkStripCablingTool::getOnlineIdFromHash(const IdentifierHash& hash, const EventContext& ctx) const {
52 const ITkStripCablingData* data{getData(ctx)};
53 if (data==nullptr) {
54 ATH_MSG_ERROR("Filling the cabling FAILED");
55 return invalidId;
56 }
57
58 return data->getOnlineIdFromHash(hash);
59}
60
63 const EventContext& ctx{Gaudi::Hive::currentContext()};
64 return getOnlineIdFromHash(hash, ctx);
65}
66
67std::uint32_t
68ITkStripCablingTool::getRobIdFromHash(const IdentifierHash& hash, const EventContext& ctx) const {
69 return getOnlineIdFromHash(hash, ctx).rod();
70}
71
72std::uint32_t
74 const EventContext& ctx{Gaudi::Hive::currentContext()};
75 return getRobIdFromHash(hash, ctx);
76}
77
78void
79ITkStripCablingTool::getAllRods(std::vector<std::uint32_t>& usersVector, const EventContext& ctx) const {
80 const ITkStripCablingData* data{getData(ctx)};
81 if (data==nullptr) {
82 ATH_MSG_ERROR("Filling the cabling FAILED");
83 return;
84 }
85
86 data->getRods(usersVector);
87 if (msgLvl(MSG::DEBUG)){
88 ATH_MSG_DEBUG("RODs found: " << usersVector.size());
89 for (const auto& rodId : usersVector) {
90 ATH_MSG_DEBUG("ROD ID: 0x" << std::hex << rodId << std::dec);
91 }
92 }
93}
94
95void
96ITkStripCablingTool::getAllRods(std::vector<std::uint32_t>& usersVector) const {
97 const EventContext& ctx{Gaudi::Hive::currentContext()};
98 getAllRods(usersVector, ctx);
99}
100
102ITkStripCablingTool::getData(const EventContext& ctx) const {
104 ATH_MSG_DEBUG("After getting ITkStripCablindData");
105 return condData.retrieve();
106}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
Header file for ITkStrip cabling service Based on code by Susumu Oda.
This is an Identifier helper class for the SCT subdetector.
const SCT_ID * m_idHelper
helper for offlineId/hash conversions
virtual void getAllRods(std::vector< std::uint32_t > &usersVector, const EventContext &ctx) const override
fill a users vector with all the RodIds
StringProperty m_cablingDataSource
virtual ITkStripOnlineId getOnlineIdFromHash(const IdentifierHash &hash, const EventContext &ctx) const override
return the online Id, given a hash (used by simulation encoders)
virtual IdentifierHash getHashFromOnlineId(const ITkStripOnlineId &onlineId, const EventContext &ctx, const bool withWarnings=true) const override
SG::ReadCondHandleKey< ITkStripCablingData > m_data
virtual StatusCode initialize() 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)
const ITkStripCablingData * getData(const EventContext &ctx) const
std::uint32_t rod() const
Return the rod/rob Id.
This is a "hash" representation of an Identifier.
const_pointer_type retrieve()
TFile * file