ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::STGC_ROD_Decoder Class Reference

#include <STGC_ROD_Decoder.h>

Inheritance diagram for Muon::STGC_ROD_Decoder:
Collaboration diagram for Muon::STGC_ROD_Decoder:

Public Member Functions

virtual ~STGC_ROD_Decoder ()=default
virtual StatusCode initialize () override
virtual StatusCode fillCollection (const EventContext &ctx, const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &fragment, const std::vector< IdentifierHash > &chamberToDecode, std::vector< std::unique_ptr< STGC_RawDataCollection > > &rdo_map) const override

Protected Attributes

const sTgcIdHelperm_stgcIdHelper {nullptr}
SG::ReadCondHandleKey< MuonGM::MuonDetectorManagerm_DetectorManagerKey
SG::ReadCondHandleKey< NswDcsDbDatam_dscKey
SG::ReadCondHandleKey< Nsw_CablingMapm_cablingKey {this, "CablingMap", "","Key of Nsw_CablingMap"}

Detailed Description

Definition at line 22 of file STGC_ROD_Decoder.h.

Constructor & Destructor Documentation

◆ ~STGC_ROD_Decoder()

virtual Muon::STGC_ROD_Decoder::~STGC_ROD_Decoder ( )
virtualdefault

Member Function Documentation

◆ fillCollection()

StatusCode Muon::STGC_ROD_Decoder::fillCollection ( const EventContext & ctx,
const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment & fragment,
const std::vector< IdentifierHash > & chamberToDecode,
std::vector< std::unique_ptr< STGC_RawDataCollection > > & rdo_map ) const
overridevirtual

Definition at line 42 of file STGC_ROD_Decoder.cxx.

46{
47
48 // check fragment for errors
49 try {
50 robFrag.check();
51 } catch (const eformat::Issue &ex) {
52 ATH_MSG_WARNING(ex.what());
53 return StatusCode::SUCCESS;
54 }
55
56 const NswDcsDbData* dcsData{nullptr};
57 ATH_CHECK(SG::get(dcsData, m_dscKey, ctx));
58
59 const Nsw_CablingMap* sTgcCablingMap{nullptr};
60 ATH_CHECK(SG::get(sTgcCablingMap, m_cablingKey, ctx));
61
62 const MuonGM::MuonDetectorManager* muonGeoMgr{};
63 ATH_CHECK(SG::get(muonGeoMgr, m_DetectorManagerKey, ctx));
64
65 // if the vector of hashes is not empty, then we are in seeded mode
66 bool seeded_mode(!rdoIdhVect.empty());
67
68 // have the NSWCommonDecoder take care of the decoding
69 Muon::nsw::NSWCommonDecoder common_decoder(robFrag);
70 const std::vector<Muon::nsw::NSWElink *>& elinks = common_decoder.get_elinks();
71 ATH_MSG_DEBUG("Retrieved "<<elinks.size()<<" elinks");
72 if (elinks.empty()) {
73 return StatusCode::SUCCESS;
74 }
75 rdo_map.resize(m_stgcIdHelper->module_hash_max());
76 // loop on elinks. for STGCs a "module" is a quadruplet
77 // therefore, we need an RDO (collection) per quadruplet!
78 for (auto* elink : elinks) {
79
80 // skip null packets
81 if (elink->isNull()) {
82 continue;
83 }
84 // get the offline ID hash (module ctx) to be passed to the RDO
85 // also specifies the index of the RDO in the container.
86 const char* station_name = elink->elinkId()->is_large_station() ? "STL" : "STS";
87 int station_eta = (int)elink->elinkId()->station_eta();
88 unsigned int station_phi = (unsigned int)elink->elinkId()->station_phi();
89 unsigned int multi_layer = (unsigned int)elink->elinkId()->multi_layer();
90 unsigned int gas_gap = (unsigned int)elink->elinkId()->gas_gap();
91 Identifier module_ID = m_stgcIdHelper->elementID(station_name, station_eta, station_phi);
92
93 IdentifierHash module_hashID{};
94 m_stgcIdHelper->get_module_hash(module_ID, module_hashID);
95 const MuonGM::sTgcReadoutElement* roElement = muonGeoMgr->getsTgcReadoutElement(module_ID);
96 // if we are in ROI-seeded mode, check if this hashID is requested
97 if (seeded_mode && std::ranges::find(rdoIdhVect, module_hashID) == rdoIdhVect.end()) {
98 continue;
99 }
100 std::unique_ptr<STGC_RawDataCollection>& rdo = rdo_map[module_hashID];
101 if (!rdo) rdo = std::make_unique<STGC_RawDataCollection>(module_hashID);
102
103 // loop on all channels of this elink to fill the collection
104 const std::vector<Muon::nsw::VMMChannel*>& channels = elink->get_channels();
105 for (auto *channel : channels) {
106 unsigned int channel_number = channel->channel_number();
107 unsigned int channel_type = channel->channel_type();
108 if (channel_number == 0) continue; // skip disconnected vmm channels
109
110 Identifier channel_ID = m_stgcIdHelper->channelID(module_ID, multi_layer, gas_gap, channel_type, channel_number); // not validating the IDs (too slow)
111 if (sTgcCablingMap) {
112 std::optional<Identifier> correctedChannelId = sTgcCablingMap->correctChannel(channel_ID, msgStream());
113 if (!correctedChannelId) {
114 ATH_MSG_DEBUG("Channel was shifted outside its connector and is therefore not decoded into and RDO");
115 continue;
116 }
117 channel_ID = (*correctedChannelId);
118 }
119 bool isOuterQ1{false};
120 if(std::abs(station_eta)==1 && dcsData){ // only the innermost quad is split in two hv sections, no need to check the others, also no need to check if no dcs data is loaded
121 Amg::Vector2D localPos{Amg::Vector2D::Zero()};
122 if (!roElement->stripPosition(channel_ID, localPos)) continue; // can also handle wires and pads
123 isOuterQ1 = !(roElement->isEtaZero(channel_ID, localPos));
124 }
125
126 if (dcsData && !dcsData->isGood(ctx, channel_ID, isOuterQ1)) continue;
127 bool timeAndChargeInCounts = true; // always true for data from detector
128 rdo->push_back(std::make_unique<STGC_RawData>(channel_ID, channel->rel_bcid(), channel->tdo(), channel->pdo(), false,timeAndChargeInCounts)); // isDead = false (ok?)
129 }
130 }
131
132 return StatusCode::SUCCESS;
133}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
const sTgcReadoutElement * getsTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
virtual bool stripPosition(const Identifier &id, Amg::Vector2D &pos) const override final
strip position - should be renamed to channel position If the strip number is outside the range of va...
bool isEtaZero(const Identifier &id, const Amg::Vector2D &localPosition) const
is eta=0 of QL1 or QS1?
SG::ReadCondHandleKey< NswDcsDbData > m_dscKey
SG::ReadCondHandleKey< Nsw_CablingMap > m_cablingKey
const sTgcIdHelper * m_stgcIdHelper
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_DetectorManagerKey
bool isGood(const EventContext &ctx, const Identifier &channelId, bool issTgcQ1OuterHv=false) const
Returns whether the channel is alive, i.e. DCS state on, etc...
std::optional< Identifier > correctChannel(const Identifier &id, MsgStream &msg) const
Eigen::Matrix< double, 2, 1 > Vector2D
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
str station_name
Simple script to generate a BIS78 cabling map as used for the Monte Carlo processing.

◆ initialize()

StatusCode Muon::STGC_ROD_Decoder::initialize ( )
overridevirtual

Definition at line 26 of file STGC_ROD_Decoder.cxx.

27{
28 ATH_CHECK(detStore()->retrieve(m_stgcIdHelper, "STGCIDHELPER"));
29 ATH_CHECK(m_DetectorManagerKey.initialize());
30 ATH_CHECK(m_dscKey.initialize(!m_dscKey.empty()));
31 ATH_CHECK(m_cablingKey.initialize(!m_cablingKey.empty()));
32 return StatusCode::SUCCESS;
33}

Member Data Documentation

◆ m_cablingKey

SG::ReadCondHandleKey<Nsw_CablingMap> Muon::STGC_ROD_Decoder::m_cablingKey {this, "CablingMap", "","Key of Nsw_CablingMap"}
protected

Definition at line 39 of file STGC_ROD_Decoder.h.

39{this, "CablingMap", "","Key of Nsw_CablingMap"};

◆ m_DetectorManagerKey

SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> Muon::STGC_ROD_Decoder::m_DetectorManagerKey
protected
Initial value:
{this, "DetectorManagerKey", "MuonDetectorManager",
"Key of input MuonDetectorManager condition data"}

Definition at line 34 of file STGC_ROD_Decoder.h.

34 {this, "DetectorManagerKey", "MuonDetectorManager",
35 "Key of input MuonDetectorManager condition data"};

◆ m_dscKey

SG::ReadCondHandleKey<NswDcsDbData> Muon::STGC_ROD_Decoder::m_dscKey
protected
Initial value:
{this, "DcsKey", "NswDcsDbData",
"Key of NswDcsDbData object containing DCS conditions data"}

Definition at line 36 of file STGC_ROD_Decoder.h.

36 {this, "DcsKey", "NswDcsDbData",
37 "Key of NswDcsDbData object containing DCS conditions data"};

◆ m_stgcIdHelper

const sTgcIdHelper* Muon::STGC_ROD_Decoder::m_stgcIdHelper {nullptr}
protected

Definition at line 33 of file STGC_ROD_Decoder.h.

33{nullptr};

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