ATLAS Offline Software
L1CaloSrcIdMap.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 #include "L1CaloSrcIdMap.h"
7 
8 namespace LVL1BS {
9 
10  std::atomic<bool> L1CaloSrcIdMap::s_useSWROD = false;
11 
13 {
14 }
15 
16 // Make a ROD Source ID
17 
18 uint32_t L1CaloSrcIdMap::getRodID(int crate, int slink, int daqOrRoi,
19  eformat::SubDetector subdet) const
20 {
21  // module ID = r0sscccc (ROD-spec-version1_06d, P33)
22  uint16_t moduleId = (daqOrRoi << 7) | (slink << 4) | crate;
23  if(s_useSWROD && (crate == 6 || crate == 7)) {
24  moduleId |= (0x1<<12);
25  }
26  eformat::helper::SourceIdentifier helpID(subdet, moduleId);
27  return helpID.code();
28 }
29 
30 // Make a ROB Source ID from a ROD source ID
31 
33 {
34  return rod_id;
35 }
36 
37 // Make a ROS Source ID from a ROB source ID
38 
40 {
41  eformat::helper::SourceIdentifier id(rob_id);
42  eformat::helper::SourceIdentifier id2(id.subdetector_id(), 0);
43  return id2.code();
44 }
45 
46 // Make a SubDetector ID from ROS source ID
47 
49 {
50  eformat::helper::SourceIdentifier id(ros_id);
51  eformat::helper::SourceIdentifier id2(id.subdetector_id(), 0);
52  return id2.code();
53 }
54 
55 // Return crate from unpacked moduleID
56 
58 {
59  eformat::helper::SourceIdentifier id(code);
60  return id.module_id() & 0xf;
61 }
62 
63 // Return daqOrRoi from unpacked moduleID
64 
66 {
67  eformat::helper::SourceIdentifier id(code);
68  return (id.module_id() >> 7) & 0x1;
69 }
70 
71 // Return slink from unpacked moduleID
72 
74 {
75  eformat::helper::SourceIdentifier id(code);
76  return (id.module_id() >> 4) & 0x3;
77 }
78 
79 // Return the maximum possible number of slinks given number of
80 // bits in module ID
81 
83 {
84  return 4;
85 }
86 
87 // Return sub-detector for given ID
88 
89 eformat::SubDetector L1CaloSrcIdMap::subDet(uint32_t code) const {
90  eformat::helper::SourceIdentifier id(code);
91  return id.subdetector_id();
92 }
93 
94 } // end namespace
LVL1BS::L1CaloSrcIdMap::slink
int slink(uint32_t code) const
Return slink from unpacked moduleID.
Definition: L1CaloSrcIdMap.cxx:73
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LVL1BS::L1CaloSrcIdMap::getRobID
uint32_t getRobID(uint32_t rod_id) const
Make a ROB Source ID from a ROD source ID.
Definition: L1CaloSrcIdMap.cxx:32
histSizes.code
code
Definition: histSizes.py:129
id2
HWIdentifier id2
Definition: LArRodBlockPhysicsV0.cxx:562
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
LVL1BS::L1CaloSrcIdMap::L1CaloSrcIdMap
L1CaloSrcIdMap()
Definition: L1CaloSrcIdMap.cxx:12
LVL1BS::L1CaloSrcIdMap::crate
int crate(uint32_t code) const
Return crate from unpacked moduleID.
Definition: L1CaloSrcIdMap.cxx:57
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
LVL1BS::L1CaloSrcIdMap::subDet
eformat::SubDetector subDet(uint32_t code) const
Return sub-detector for given ID.
Definition: L1CaloSrcIdMap.cxx:89
LVL1BS::L1CaloSrcIdMap::getRosID
uint32_t getRosID(uint32_t rob_id) const
Make a ROS Source ID from a ROB source ID.
Definition: L1CaloSrcIdMap.cxx:39
LVL1BS
Definition: ZdcByteStreamReadV1V2Tool.h:47
LVL1BS::L1CaloSrcIdMap::getRodID
uint32_t getRodID(int crate, int slink, int daqOrRoi, eformat::SubDetector subdet) const
Make a ROD Source ID.
Definition: L1CaloSrcIdMap.cxx:18
L1CaloSrcIdMap.h
LVL1BS::L1CaloSrcIdMap::maxSlinks
int maxSlinks() const
Return the maximum possible number of slinks.
Definition: L1CaloSrcIdMap.cxx:82
LVL1BS::L1CaloSrcIdMap::getDetID
uint32_t getDetID(uint32_t ros_id) const
Make a SubDetector ID from ROS source ID.
Definition: L1CaloSrcIdMap.cxx:48
LVL1BS::L1CaloSrcIdMap::daqOrRoi
int daqOrRoi(uint32_t code) const
Return daqOrRoi from unpacked moduleID.
Definition: L1CaloSrcIdMap.cxx:65