Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 from " + std::to_string(fragment.rob_source_id()) + ". Skipping. Error id: "+std::to_string(decoder.error_id()));
44  return StatusCode::SUCCESS;
45  }
46 
47  if (decoder.get_elinks().size()!=3 && decoder.get_elinks().size()!=5) {
48  // this is a severe requirement: a single elink missing would imply the whole event is problematic
49  ATH_MSG_DEBUG("NSW MMTP Common Decoder didn't give 3 or 5 elinks in output: something off with this fragment. Skipping.");
50  return StatusCode::SUCCESS;
51  }
52 
53  //for all the 3/5 elinks expected, the MMTP header parameters should be the same by design
54  //checking consistency of a fraction of the header
55  bool consistent = true;
56  const auto l0 = dynamic_cast<const Muon::nsw::NSWTriggerMML1AElink*>(decoder.get_elinks()[0].get());
57  for(const auto& baseLink: decoder.get_elinks()) {
58  const auto l = dynamic_cast<const Muon::nsw::NSWTriggerMML1AElink*>(baseLink.get());
59  if (l0->head_sectID() != l->head_sectID()) {consistent = false; break;}
60  if (l0->L1ID() != l->L1ID()) {consistent = false; break;}
61  if (l0->l1a_versionID() != l->l1a_versionID()) {consistent = false; break;}
62  if (l0->l1a_req_BCID() != l->l1a_req_BCID()) {consistent = false; break;}
63  }
64  if (!consistent) {
65  ATH_MSG_DEBUG("NSW MMTP Common Decoder found inconsistent header parameters in the elinks: something off with this fragment. Skipping.");
66  return StatusCode::SUCCESS;
67  }
68 
69  //TODO add checks: engines, timeouts, constants and elinks ID vs stream IDs
70 
72  rdoContainer.push_back(rdo);
73 
74  //this info is redundant with elinkID in the decoded packet! Wanna add a check in the future?
75  uint32_t sid = fragment.rob_source_id ();
76  eformat::helper::SourceIdentifier source_id (sid);
77  //eformat::SubDetector s = source_id.subdetector_id ();
78  uint16_t m = source_id.module_id ();
79 
80  //ROD info
81  rdo->set_sourceID(sid);
82  rdo->set_moduleID(m);
83  rdo->set_ROD_L1ID(fragment.rod_lvl1_id ());
84  rdo->set_ROD_BCID(fragment.rod_bc_id ());
85 
86  //TP head
87  rdo->set_EC(l0->head_EC());
88  rdo->set_sectID(l0->head_sectID());
89  rdo->set_L1ID(l0->L1ID());
90  rdo->set_BCID(l0->head_BCID());
91 
92  //TP L1A head
93  rdo->set_l1a_request_BCID(l0->l1a_local_req_BCID());
94  rdo->set_l1a_release_BCID(l0->l1a_local_rel_BCID());
95  rdo->set_l1a_window_open(l0->l1a_open_BCID());
96  rdo->set_l1a_window_center(l0->l1a_req_BCID());
97  rdo->set_l1a_window_close(l0->l1a_close_BCID());
98  rdo->set_l1a_window_open_offset(l0->l1a_open_BCID_offset());
99  rdo->set_l1a_window_center_offset(l0->l1a_req_BCID_offset());
100  rdo->set_l1a_window_close_offset(l0->l1a_close_BCID_offset());
101 
102  //L1A data quality
103  rdo->set_l1a_timeout(l0->l1a_timeout());
104  rdo->set_l1a_engines(l0->l1a_engine_snapshot());
105 
106  for(const auto& baseLink: decoder.get_elinks()){
107  const auto l = dynamic_cast<const Muon::nsw::NSWTriggerMML1AElink*>(baseLink.get());
108 
109  if (l->l1a_timeout()==0) {ATH_MSG_DEBUG("NSW MMTP Common Decoder reporting timeout condition: unclear if current event can be trusted");}
110 
111  for (const auto& a: l->art_packets()) {
112  for (const auto& c: a->channels()) {
113  rdo->art_BCID().push_back(a->art_BCID());
114  rdo->art_layer().push_back(c.first);
115  rdo->art_channel().push_back(c.second);
116  }
117  }
118  for (const auto& t: l->trig_packets()) {
119  rdo->trig_globalX().push_back(t->trig_globalX());
120  rdo->trig_globalU().push_back(t->trig_globalU());
121  rdo->trig_BCID().push_back(t->trig_BCID());
122  rdo->trig_dTheta().push_back(t->trig_dTheta());
123  rdo->trig_ROI_rID().push_back(t->trig_rBin());
124  rdo->trig_ROI_phiID().push_back(t->trig_phiBin());
125  }
126 
127  }
128 
129 
130  return StatusCode::SUCCESS;
131 }
132 
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
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
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:794
xAOD::NSWMMTPRDO_v1
Definition: NSWMMTPRDO_v1.h:23
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
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
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