ATLAS Offline Software
Loading...
Searching...
No Matches
ITkStripCablingTool.cxx
Go to the documentation of this file.
1/*
2/ Copyright (C) 2002-2026 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
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
61std::uint32_t
62ITkStripCablingTool::getRobIdFromHash(const IdentifierHash& hash, const EventContext& ctx) const {
63 return getOnlineIdFromHash(hash, ctx).rod();
64}
65
66void
67ITkStripCablingTool::getAllRods(std::vector<std::uint32_t>& usersVector, const EventContext& ctx) const {
68 const ITkStripCablingData* data{getData(ctx)};
69 if (data==nullptr) {
70 ATH_MSG_ERROR("Filling the cabling FAILED");
71 return;
72 }
73
74 data->getRods(usersVector);
75 if (msgLvl(MSG::DEBUG)){
76 ATH_MSG_DEBUG("RODs found: " << usersVector.size());
77 for (const auto& rodId : usersVector) {
78 ATH_MSG_DEBUG("ROD ID: 0x" << std::hex << rodId << std::dec);
79 }
80 }
81}
82
84ITkStripCablingTool::getData(const EventContext& ctx) const {
86 ATH_MSG_DEBUG("After getting ITkStripCablindData");
87 return condData.retrieve();
88}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
static const ITkStripOnlineId invalidId
static const std::string coolVectorPayload("COOLVECTOR")
static const std::string coracool("CORACOOL")
static const std::string defaultSource(coracool)
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