ATLAS Offline Software
TGCInnerTrackletSlotHolder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 namespace LVL1TGCTrigger {
10  m_tgcArgs(tgcargs)
11  {
12  for(int sideId=0; sideId<NUMBER_OF_SIDES; sideId++) { // Side A and Side C
13  for(int slotId=FIRST_SLOT; slotId<NUMBER_OF_SLOTS+FIRST_SLOT; slotId++) { // Slot01 - Slot24
14  m_innerTrackletSlot[sideId][slotId-FIRST_SLOT].setSideId(sideId);
15  // There is offset of 1. Slot01 is m_innerTrackletSlot[sideId][0].
16  m_innerTrackletSlot[sideId][slotId-FIRST_SLOT].setSlotId(slotId);
18  }
19  }
20  }
21 
23  for(int sideId=0; sideId<NUMBER_OF_SIDES; sideId++) { // Side A and Side C
24  for(int slotId=FIRST_SLOT; slotId<NUMBER_OF_SLOTS+FIRST_SLOT; slotId++) { // Slot01 - Slot24
26  }
27  }
28  }
29 
30  bool TGCInnerTrackletSlotHolder::setTriggerBit(const int sideId, const int slotId,
31  const unsigned int region, const unsigned int readout,
32  const unsigned int iBit, const bool triggerBit) {
33  if(sideId<0 || sideId>=NUMBER_OF_SIDES) return false;
34  if(slotId<FIRST_SLOT || slotId>=NUMBER_OF_SLOTS+FIRST_SLOT) return false;
35  return m_innerTrackletSlot[sideId][slotId-FIRST_SLOT].setTriggerBit(region, readout, iBit, triggerBit);
36  }
37 
38  const TGCInnerTrackletSlot* TGCInnerTrackletSlotHolder::getInnerTrackletSlot(const int sideId, const int slotId) const {
39  if(sideId<0 || sideId>=NUMBER_OF_SIDES) return 0;
40  if(slotId<FIRST_SLOT || slotId>=NUMBER_OF_SLOTS+FIRST_SLOT) return 0;
41  return &m_innerTrackletSlot[sideId][slotId-FIRST_SLOT];
42  }
43 
44  void TGCInnerTrackletSlotHolder::getInnerTrackletSlots(const int sideId, const int octId, const int moduleId,
45  const TGCInnerTrackletSlot* innerTrackletSlots[]) const {
46  // Initialize innerTrackletSlot array
47  for(unsigned int iSlot=0; iSlot<NUMBER_OF_SLOTS_PER_TRIGGER_SECTOR; iSlot++) {
48  innerTrackletSlots[iSlot] = 0;
49  }
50  if(sideId<0 || sideId>=NUMBER_OF_SIDES) return; // Side A or Side C
51  if(octId<0 || octId>=8) return; // octId is 0-8.
52  // OnlineID moduleNumber
53  // <---- phi ----
54  // EC: 7 6 4 3 1 0 11 10 9
55  // FWD: 8 5 2 14 13 12
56  // [M1, M2, M3] [EI/FI]
57  if(!(moduleId==0 || moduleId==1 ||
58  moduleId==3 || moduleId==4 ||
59  moduleId==6 || moduleId==7)) return; // moduleId is 0,1,3,4,6,7 for ENDCAP.
60  int secId = (moduleId/3)*2+moduleId%3; // secId=0-5(EC)
61  int phi = (secId+46+octId*6)%48+1; // phi=1-48(EC), 1 is just above +x-axis and 48 is just below +x-axis
62  // slot23, slot24, slot01, slot02 go to A01 phi0/phi1 (phi=47/phi=48)
63  // slot24, slot01, slot02, slot03 go to A01 phi2/phi3 (phi= 1/phi= 2)
64  // slot01, slot02, slot03, slot04 go to A02 phi0/phi1 (phi= 3/phi= 4)
65  // ... ...
66  for(unsigned int iSlot=0; iSlot<NUMBER_OF_SLOTS_PER_TRIGGER_SECTOR; iSlot++) {
67  int slotId = (static_cast<int>(iSlot) + (phi-1)/2 + 23)%24 + 1;
68  // phi (phi-1)/2 (static_cast<int>(iSlot) + (phi-1)/2 + 23)%24 + 1
69  // iSlot=0 iSlot=1 iSlot=2 iSlot=3
70  // 47 23 (0+23+23)%24+1 (1+23+23)%24+1 (2+23+23)%24+1 (3+23+23)%24+1
71  // 48 23 (0+23+23)%24+1 (1+23+23)%24+1 (2+23+23)%24+1 (3+23+23)%24+1
72  // 1 0 (0+ 0+23)%24+1 (1+ 0+23)%24+1 (2+ 0+23)%24+1 (3+ 0+23)%24+1
73  // 2 0 (0+ 0+23)%24+1 (1+ 0+23)%24+1 (2+ 0+23)%24+1 (3+ 0+23)%24+1
74  // 3 1 (0+ 1+23)%24+1 (1+ 1+23)%24+1 (2+ 1+23)%24+1 (3+ 1+23)%24+1
75  // 4 1 (0+ 1+23)%24+1 (1+ 1+23)%24+1 (2+ 1+23)%24+1 (3+ 1+23)%24+1
76  innerTrackletSlots[iSlot] = getInnerTrackletSlot(sideId, slotId);
77  }
78  }
79 
81  std::array<int, NUMBER_OF_SLOTS_PER_TRIGGER_SECTOR> &eifi_bits) const {
82 
83  const int n_slots = NUMBER_OF_SLOTS_PER_TRIGGER_SECTOR;
84  const int n_regions = TGCInnerTrackletSlot::NUMBER_OF_REGIONS;
85  const int n_readouts = TGCInnerTrackletSlot::NUMBER_OF_READOUTS;
87 
88  for (int iSlot = 0; iSlot < n_slots; iSlot++) { // Inner slots per trigger sector : 4
89  int tmp_bits = 0;
90  for (int iRegion = 0; iRegion < n_regions; iRegion++) { // EI or FI
91  for (int iReadouts = 0; iReadouts < n_readouts; iReadouts++) { // STRIP or WIRE
92  for (int iBits = 0; iBits < n_bits; iBits++) { // 4 bits : 0-7, 8-15, 16-23, 24-31
93  tmp_bits &= innerTrackletSlots[iSlot]->getTriggerBit(iRegion, iReadouts, iBits) << (iBits+iReadouts*4+iRegion*8);
94  }
95  }
96  }
97  eifi_bits[iSlot] = tmp_bits;
98  }
99  }
100 } //end of namespace bracket
LVL1TGCTrigger::TGCInnerTrackletSlotHolder::FIRST_SLOT
@ FIRST_SLOT
Definition: TGCInnerTrackletSlotHolder.h:34
TGCInnerTrackletSlotHolder.h
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
LVL1TGCTrigger::TGCInnerTrackletSlot::NUMBER_OF_REGIONS
@ NUMBER_OF_REGIONS
Definition: TGCInnerTrackletSlot.h:35
LVL1TGCTrigger::TGCInnerTrackletSlot::NUMBER_OF_READOUTS
@ NUMBER_OF_READOUTS
Definition: TGCInnerTrackletSlot.h:38
LVL1TGCTrigger::TGCInnerTrackletSlotHolder::getInnerTrackletSlot
const TGCInnerTrackletSlot * getInnerTrackletSlot(const int sideId, const int slotId) const
Definition: TGCInnerTrackletSlotHolder.cxx:38
LVL1TGCTrigger::TGCInnerTrackletSlot::setSideId
void setSideId(const int sideId)
Definition: TGCInnerTrackletSlot.cxx:21
LVL1TGCTrigger::TGCInnerTrackletSlot::getTriggerBit
bool getTriggerBit(const unsigned int region, const unsigned int readout, const unsigned int iBit) const
Definition: TGCInnerTrackletSlot.cxx:56
LVL1TGCTrigger::TGCInnerTrackletSlot::setTriggerBit
bool setTriggerBit(const unsigned int region, const unsigned int readout, const unsigned int iBit, const bool triggerBit)
Definition: TGCInnerTrackletSlot.cxx:48
LVL1TGCTrigger::TGCInnerTrackletSlot::setSlotId
void setSlotId(const int slotId)
Definition: TGCInnerTrackletSlot.cxx:29
LVL1TGCTrigger::TGCInnerTrackletSlotHolder::m_innerTrackletSlot
TGCInnerTrackletSlot m_innerTrackletSlot[NUMBER_OF_SIDES][NUMBER_OF_SLOTS]
Definition: TGCInnerTrackletSlotHolder.h:43
LVL1TGCTrigger::TGCInnerTrackletSlot::setTgcArguments
void setTgcArguments(const TGCArguments *)
Definition: TGCInnerTrackletSlot.cxx:17
LVL1TGCTrigger::TGCInnerTrackletSlot::NUMBER_OF_TRIGGER_BITS
@ NUMBER_OF_TRIGGER_BITS
Definition: TGCInnerTrackletSlot.h:39
LVL1TGCTrigger::TGCInnerTrackletSlotHolder::tgcArgs
const TGCArguments * tgcArgs() const
Definition: TGCInnerTrackletSlotHolder.h:40
LVL1TGCTrigger::TGCInnerTrackletSlotHolder::NUMBER_OF_SIDES
@ NUMBER_OF_SIDES
Definition: TGCInnerTrackletSlotHolder.h:32
LVL1TGCTrigger
Definition: LVL1TGCTrigger.cxx:47
LVL1TGCTrigger::TGCInnerTrackletSlotHolder::TGCInnerTrackletSlotHolder
TGCInnerTrackletSlotHolder(TGCArguments *)
Constructor.
Definition: TGCInnerTrackletSlotHolder.cxx:9
LVL1TGCTrigger::TGCInnerTrackletSlotHolder::getInnerTrackletBits
void getInnerTrackletBits(const TGCInnerTrackletSlot *innerTrackletSlots[], std::array< int, NUMBER_OF_SLOTS_PER_TRIGGER_SECTOR > &eifi_bits) const
Definition: TGCInnerTrackletSlotHolder.cxx:80
LVL1TGCTrigger::TGCArguments
Definition: TGCArguments.h:12
LVL1TGCTrigger::TGCInnerTrackletSlotHolder::setTriggerBit
bool setTriggerBit(const int sideId, const int slotId, const unsigned int region, const unsigned int readout, const unsigned int iBit, const bool triggerBit)
Definition: TGCInnerTrackletSlotHolder.cxx:30
LVL1TGCTrigger::TGCInnerTrackletSlotHolder::getInnerTrackletSlots
void getInnerTrackletSlots(const int sideId, const int octId, const int moduleId, const TGCInnerTrackletSlot *innerTrackletSlots[]) const
Definition: TGCInnerTrackletSlotHolder.cxx:44
LVL1TGCTrigger::TGCInnerTrackletSlotHolder::NUMBER_OF_SLOTS_PER_TRIGGER_SECTOR
@ NUMBER_OF_SLOTS_PER_TRIGGER_SECTOR
Definition: TGCInnerTrackletSlotHolder.h:35
LVL1TGCTrigger::TGCInnerTrackletSlotHolder::NUMBER_OF_SLOTS
@ NUMBER_OF_SLOTS
Definition: TGCInnerTrackletSlotHolder.h:33
LVL1TGCTrigger::TGCInnerTrackletSlotHolder::clearTriggerBits
void clearTriggerBits()
Definition: TGCInnerTrackletSlotHolder.cxx:22
LVL1TGCTrigger::TGCInnerTrackletSlot::clearTriggerBits
void clearTriggerBits()
Definition: TGCInnerTrackletSlot.cxx:64
LVL1TGCTrigger::TGCInnerTrackletSlot
Definition: TGCInnerTrackletSlot.h:11