ATLAS Offline Software
MapperMMG.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef _MUON_NSW_MMG_MAPPER_H_
5 #define _MUON_NSW_MMG_MAPPER_H_
6 
7 #include <cstdint>
9 
10 namespace Muon
11 {
12  namespace nsw
13  {
14  class MapperMMG
15  {
16  public:
17  MapperMMG() {};
18  virtual ~MapperMMG () {};
19 
20  uint16_t channel_number (uint8_t feb_radius, uint16_t vmm, uint16_t vmm_chan) const;
21  bool vmm_info (uint8_t mod_radius, uint16_t channel_number, uint8_t& feb_radius, uint16_t& vmm, uint16_t& vmm_chan) const;
22  bool elink_info(uint8_t mod_radius, uint16_t channel_number, uint& elink) const;
23  };
24  }
25 }
26 
27 
28 //=====================================================================
29 inline uint16_t Muon::nsw::MapperMMG::channel_number (uint8_t feb_radius, uint16_t vmm, uint16_t vmm_chan) const
30 {
31  // Retrieve the strip number for a given vmm/vmm_channel.
32  // Input feb_radius is expected in [0, 15]
33  // Layers with ID (0, 2, 4, 6) have even MMFE8 on the left side, odd on the right
34  // Layers with ID (1, 3, 5, 7) have even MMFE8 on the right side, odd on the left
35  // VMMs and VMM channels are always counted inwards in even radii
36 
37  uint16_t outw_vmm = vmm;
38  uint16_t outw_chan = vmm_chan;
39 
40  if ((feb_radius % 2) == 0) {
41  outw_vmm = Muon::nsw::VMM_per_MMFE8 - vmm - 1;
42  outw_chan = Muon::nsw::VMM_channels - vmm_chan - 1;
43  }
44 
45  return ((feb_radius < 10 ? feb_radius : feb_radius - 10) * Muon::nsw::VMM_per_MMFE8 + outw_vmm) * Muon::nsw::VMM_channels + outw_chan + 1;
46 }
47 
48 
49 
50 //=====================================================================
51 inline bool Muon::nsw::MapperMMG::vmm_info (uint8_t mod_radius, uint16_t channel_number, uint8_t& feb_radius, uint16_t& vmm, uint16_t& vmm_chan) const
52 {
53  // Retrieve {feb radius [0, 15], vmm number [0, 7], vmm channel [0, 63]} for a given strip
54  // Input mod_radius is expected in [0, 1].
55 
56  channel_number -= 1;
57  feb_radius = channel_number / (Muon::nsw::VMM_per_MMFE8 * Muon::nsw::VMM_channels);
58  vmm = channel_number / Muon::nsw::VMM_channels - feb_radius * Muon::nsw::VMM_per_MMFE8;
59  vmm_chan = channel_number % Muon::nsw::VMM_channels;
60  if (mod_radius == 1) feb_radius += 10;
61 
62  if ((feb_radius % 2) == 0) {
63  vmm = Muon::nsw::VMM_per_MMFE8 - vmm - 1;
64  vmm_chan = Muon::nsw::VMM_channels - vmm_chan - 1;
65  }
66 
67  return true;
68 }
69 
70 inline bool Muon::nsw::MapperMMG::elink_info(uint8_t mod_radius, uint16_t channel_number, uint& elink) const {
71  uint16_t vmm{0}, vmm_chan{0};
72  uint8_t feb_radius{0};
73  vmm_info(mod_radius, channel_number, feb_radius, vmm, vmm_chan);
74  if(feb_radius <= 11){ // febs 0-11 are only read out through 1 elink
75  elink=0;
76  return true;
77  } else if(feb_radius >= 12 && feb_radius <= 15){
78  // for febs at radius 12 to 15 vmms 0-3 are connected to sroc 2 while vmms 3-7 are connected to sroc 3. This mapping is configurable in the ROC but not forssen to change before RUN4
79  if (vmm < 4){
80  elink = 2;
81  } else {
82  elink = 3;
83  }
84  return true;
85  }
86  return false;
87 
88 
89 
90 }
91 
92 #endif
93 
Muon::nsw::VMM_channels
@ VMM_channels
Definition: NSWDecodeHelper.h:32
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
Muon::nsw::MapperMMG::vmm_info
bool vmm_info(uint8_t mod_radius, uint16_t channel_number, uint8_t &feb_radius, uint16_t &vmm, uint16_t &vmm_chan) const
Definition: MapperMMG.h:51
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:45
Muon::nsw::MapperMMG::channel_number
uint16_t channel_number(uint8_t feb_radius, uint16_t vmm, uint16_t vmm_chan) const
Definition: MapperMMG.h:29
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
Muon::nsw::MapperMMG::elink_info
bool elink_info(uint8_t mod_radius, uint16_t channel_number, uint &elink) const
Definition: MapperMMG.h:70
Muon::nsw::MapperMMG
Definition: MapperMMG.h:15
Muon::nsw::MapperMMG::MapperMMG
MapperMMG()
Definition: MapperMMG.h:17
NSWDecodeHelper.h
Muon::nsw::VMM_per_MMFE8
@ VMM_per_MMFE8
Definition: NSWDecodeHelper.h:29
Muon::nsw::MapperMMG::~MapperMMG
virtual ~MapperMMG()
Definition: MapperMMG.h:18