ATLAS Offline Software
Loading...
Searching...
No Matches
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
7namespace 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);
17 m_innerTrackletSlot[sideId][slotId-FIRST_SLOT].setTgcArguments( tgcArgs() );
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
25 m_innerTrackletSlot[sideId][slotId-FIRST_SLOT].clearTriggerBits();
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
Scalar phi() const
phi method
bool setTriggerBit(const int sideId, const int slotId, const unsigned int region, const unsigned int readout, const unsigned int iBit, const bool triggerBit)
TGCInnerTrackletSlot m_innerTrackletSlot[NUMBER_OF_SIDES][NUMBER_OF_SLOTS]
void getInnerTrackletSlots(const int sideId, const int octId, const int moduleId, const TGCInnerTrackletSlot *innerTrackletSlots[]) const
void getInnerTrackletBits(const TGCInnerTrackletSlot *innerTrackletSlots[], std::array< int, NUMBER_OF_SLOTS_PER_TRIGGER_SECTOR > &eifi_bits) const
const TGCInnerTrackletSlot * getInnerTrackletSlot(const int sideId, const int slotId) const
bool getTriggerBit(const unsigned int region, const unsigned int readout, const unsigned int iBit) const