ATLAS Offline Software
NSWMMTP_ROD_Decoder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 #include "NSWMMTP_ROD_Decoder.h"
7 #include "Identifier/Identifier.h"
8 #include "eformat/Issue.h"
9 #include "eformat/SourceIdentifier.h"
10 
15 
16 
17 Muon::NSWMMTP_ROD_Decoder::NSWMMTP_ROD_Decoder( const std::string& type, const std::string& name,const IInterface* parent )
19 {
20  declareInterface<INSWMMTP_ROD_Decoder>( this );
21 }
22 
23 
25  ATH_CHECK(m_idHelperSvc.retrieve());
26  return StatusCode::SUCCESS;
27 }
28 
30 {
31 
32  try {
33  fragment.check();
34  } catch (eformat::Issue &ex) {
35  ATH_MSG_WARNING(ex.what());
36  return StatusCode::SUCCESS;
37  }
38 
39 
40  const Muon::nsw::NSWTriggerCommonDecoder decoder{fragment, "MML1A"};
41 
42  if (decoder.has_error()) {
43  ATH_MSG_DEBUG("NSW MMTP Common Decoder found exceptions while reading this MML1A fragment. Skipping. Error id: "+std::to_string(decoder.error_id()));
44  return StatusCode::SUCCESS;
45  }
46 
47  if (decoder.get_elinks().size()!=3) {
48  ATH_MSG_DEBUG("NSW MMTP Common Decoder didn't give 3 elinks in output: something off with this fragment. Skipping.");
49  return StatusCode::SUCCESS;
50  }
51 
52  //TODO add checks: engines, timeouts, constants and elinks ID vs stream IDs
53 
55  rdoContainer.push_back(rdo);
56 
57  //for all the 3 elinks expected, the MMTP header parameters should be the same by design; in case one could add a check on the differences
58  const auto l0 = std::dynamic_pointer_cast<Muon::nsw::NSWTriggerMML1AElink>(decoder.get_elinks()[0]);
59 
60  //this info is redundant with elinkID in the decoded packet! Wanna add a check in the future?
61  uint32_t sid = fragment.rob_source_id ();
62  eformat::helper::SourceIdentifier source_id (sid);
63  //eformat::SubDetector s = source_id.subdetector_id ();
64  uint16_t m = source_id.module_id ();
65 
66 
67  //ROD info
68  rdo->set_sourceID(sid);
69  rdo->set_moduleID(m);
70  rdo->set_ROD_L1ID(fragment.rod_lvl1_id ());
71  rdo->set_ROD_BCID(fragment.rod_bc_id ());
72 
73  //TP head
74  rdo->set_EC(l0->head_EC());
75  rdo->set_sectID(l0->head_sectID());
76  rdo->set_L1ID(l0->L1ID());
77  rdo->set_BCID(l0->head_BCID());
78 
79  //TP L1A head
80  rdo->set_l1a_request_BCID(l0->l1a_local_req_BCID());
81  rdo->set_l1a_release_BCID(l0->l1a_local_rel_BCID());
82  rdo->set_l1a_window_open(l0->l1a_open_BCID());
83  rdo->set_l1a_window_center(l0->l1a_req_BCID());
84  rdo->set_l1a_window_close(l0->l1a_close_BCID());
85  rdo->set_l1a_window_open_offset(l0->l1a_open_BCID_offset());
86  rdo->set_l1a_window_center_offset(l0->l1a_req_BCID_offset());
87  rdo->set_l1a_window_close_offset(l0->l1a_close_BCID_offset());
88 
89  //L1A data quality
90  rdo->set_l1a_timeout(l0->l1a_timeout());
91  rdo->set_l1a_engines(l0->l1a_engine_snapshot());
92 
93  for(const auto& baseLink: decoder.get_elinks()){
94  const auto l = std::dynamic_pointer_cast<Muon::nsw::NSWTriggerMML1AElink>(baseLink);
95 
96  if (l->l1a_timeout()==0) {ATH_MSG_DEBUG("NSW MMTP Common Decoder reporting timeout condition: unclear if current event can be trusted");}
97 
98  for (const auto& a: l->art_packets()) {
99  for (const auto& c: a->channels()) {
100  rdo->art_BCID().push_back(a->art_BCID());
101  rdo->art_layer().push_back(c.first);
102  rdo->art_channel().push_back(c.second);
103  }
104  }
105  for (const auto& t: l->trig_packets()) {
106  rdo->trig_BCID().push_back(t->trig_BCID());
107  rdo->trig_dTheta().push_back(t->trig_dTheta());
108  rdo->trig_ROI_rID().push_back(t->trig_rBin());
109  rdo->trig_ROI_phiID().push_back(t->trig_phiBin());
110  }
111 
112  }
113 
114 
115  return StatusCode::SUCCESS;
116 }
117 
Muon::NSWMMTP_ROD_Decoder::initialize
StatusCode initialize() override
Definition: NSWMMTP_ROD_Decoder.cxx:24
NSWTriggerCommonDecoder.h
MMARTPacket.h
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
python.LArCondContChannels.decoder
decoder
def channelSelection(self, channelList, groupType): if groupType == self.SingleGroup: pass elif group...
Definition: LArCondContChannels.py:618
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
Issue
Configuration Issue
Definition: PscIssues.h:31
Muon::NSWMMTP_ROD_Decoder::fillCollection
StatusCode fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &fragment, xAOD::NSWMMTPRDOContainer &rdoContainer) const override
Definition: NSWMMTP_ROD_Decoder.cxx:29
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
Muon::NSWMMTP_ROD_Decoder::NSWMMTP_ROD_Decoder
NSWMMTP_ROD_Decoder(const std::string &type, const std::string &name, const IInterface *parent)
Definition: NSWMMTP_ROD_Decoder.cxx:17
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
eformat::ROBFragment
Definition: L1CaloBsDecoderUtil.h:12
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
xAOD::NSWMMTPRDO_v1
Definition: NSWMMTPRDO_v1.h:23
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
xAOD::NSWMMTPRDO
NSWMMTPRDO_v1 NSWMMTPRDO
Define the version of the NSW MM RDO class.
Definition: NSWMMTPRDO.h:13
a
TList * a
Definition: liststreamerinfos.cxx:10
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
NSWMMTP_ROD_Decoder.h
ReadCellNoiseFromCoolCompare.l0
l0
Definition: ReadCellNoiseFromCoolCompare.py:359
MMTrigPacket.h
AthAlgTool
Definition: AthAlgTool.h:26
python.compressB64.c
def c
Definition: compressB64.py:93
Muon::nsw::NSWTriggerCommonDecoder
Definition: NSWTriggerCommonDecoder.h:21