ATLAS Offline Software
TGCElectronicsSystem.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "TrigT1TGC/TGCASDOut.h"
8 #include "TrigT1TGC/TGCSector.h"
9 #include "TrigT1TGC/TGCEvent.h"
10 
11 #include <iostream>
12 #include <vector>
13 
14 namespace LVL1TGCTrigger {
15 
17 {
18  const std::vector<LVL1TGCTrigger::TGCASDOut*>& vecASDOut= event->GetASDOutVector();
19  event=0;
20  size_t i;
21  for( i=0; i< vecASDOut.size(); i++) {
22  const LVL1TGCTrigger::TGCASDOut* asd= vecASDOut[i];
23  int side = asd->GetTGCReadoutIndex().GetSideNumber();
24  int octant = asd->GetTGCReadoutIndex().GetOctantNumber();
26 
27  if (getSector(side, octant, module)) {
28  if (side < LVL1TGC::kNSide && octant < NumberOfOctant)
29  getSector(side, octant, module)->distributeSignal(asd);
30  }
31  asd = 0;
32  }
33 
34 }
35 
37  : m_DB(0),
38  m_tgcArgs(nullptr)
39 {
40  for (int side=0; side < LVL1TGC::kNSide; side++) {
41  for (int oct=0; oct < NumberOfOctant; oct++) {
42  for (int mod=0; mod < NumberOfModule; mod++) {
43  m_sector[side][oct][mod]=0;
44  } // loop module
45  } // loop octant
46  } //loop side
47 
48 }
49 
52 : m_DB(database),
53  m_tgcArgs(tgcargs)
54 {
55  // TMDB
56  m_tmdb.reset(new LVL1TGC::TGCTMDB());
57 
58  // NSW
59  if(tgcargs->USE_NSW()){
60  m_nsw.reset(new LVL1TGC::TGCNSW());
61  }
62 
63  // RPC BIS78
64  if(tgcargs->USE_BIS78()){
65  m_bis78.reset(new LVL1TGC::TGCBIS78());
66  }
67 
68  int SectorId;
71  for (int side=0; side < LVL1TGC::kNSide; side++) {
72  for(int oct=0; oct < NumberOfOctant; oct++){
73  for(int mod=0; mod < NumberOfModule; mod++){
74  SectorId = getSectorId(side,oct,mod);
75  RegionType = getRegionType(mod);
76  forwardBackward = getForwardBackward(side,oct,mod);
77  m_sector[side][oct][mod] = new TGCSector(tgcArgs(),SectorId, RegionType,
78  forwardBackward,
79  m_DB,
80  m_tmdb,
81  m_nsw,
82  m_bis78);
83  } // loop module
84  } // loop octant
85  } //loop side
86 }
87 
89 {
90  // Module:
91  // <----phi-----
92  // 7 6 4 3 1 0 Endcap
93  // 8 5 2 Forward
94  //
95  // Inner
96  // <----phi-----
97  // 11 10 9 Endcap
98  // 14 13 12 Forward
99 
100  if(mod<9)
103  else if(mod<12)
105  else
107 }
108 
110 {
111  bool isEndcap = false;
112  bool isInner = false;
113  int sec=-1;
114  if(mod<9){
115  if(mod%3==2)
116  sec = mod/3+oct*3;
117  if(mod%3==0||mod%3==1){
118  sec = mod-mod/3+oct*6;
119  isEndcap = true;
120  }
121  } else if(mod<12){
122  isEndcap = true;
123  isInner = true;
124  sec = mod%3+oct*3;
125  } else {
126  isInner = true;
127  sec = mod%3+oct*3;
128  }
129 
130  TGCForwardBackwardType forwardBackward = ForwardSector;
131 
132  // for new cabling service
133  // A-side : side == 0
134  // C-side : side == 1
135  bool isAside = (side ==0);
136 
137  // backward/Forward definition is same
138  // because strip layer is swapped in default
139  if ( isEndcap ){
140  if (!isInner){
141  if(isAside) {
142  if (sec%2==0) forwardBackward = ForwardSector;
143  else forwardBackward = BackwardSector;
144  } else {
145  if (sec%2==1) forwardBackward = ForwardSector;
146  else forwardBackward = BackwardSector;
147  }
148  } else {
149  // EI
150  // Special case of EI11
151  if (sec == 15) {
152  if(isAside ) forwardBackward = ForwardSector;
153  else forwardBackward = BackwardSector;
154  } else if (sec == 16) {
155  if(isAside ) forwardBackward = BackwardSector;
156  else forwardBackward = ForwardSector;
157  } else {
158  if (isAside) {
159  if (sec%3==2) forwardBackward = BackwardSector;
160  else forwardBackward = ForwardSector;
161  } else {
162  if (sec%3!=2) forwardBackward = BackwardSector;
163  else forwardBackward = ForwardSector;
164  }
165  }
166  }
167  } else {
168  if (isAside) forwardBackward = BackwardSector; // all Backward
169  else forwardBackward = ForwardSector; // all Forward
170  }
171  return forwardBackward;
172 }
173 
174 int TGCElectronicsSystem::getSectorId(int side, int oct, int mod) const
175 {
177 }
178 
180 {
181  if (index.GetSideNumber()<0) return 0;
182  return m_sector[index.GetSideNumber()][index.GetOctantNumber()][index.GetModuleNumber()];
183 }
184 
186 {
187  for (int i=0; i < LVL1TGC::kNSide; i++) {
188  for (int j=0; j < NumberOfOctant; j++) {
189  for (int k=0; k < NumberOfModule; k++) {
190  if(m_sector[i][j][k]!=0) delete m_sector[i][j][k];
191  m_sector[i][j][k]=0;
192  } // loop module
193  } // loop octant
194  } // loop side
195 }
196 
197 
198 } //end of namespace bracket
LVL1TGCTrigger::TGCRegionType::ENDCAP
@ ENDCAP
LVL1TGCTrigger::TGCSector
Definition: TGCSector.h:32
LVL1TGCTrigger::TGCElectronicsSystem::getForwardBackward
TGCForwardBackwardType getForwardBackward(int side, int oct, int mod) const
Definition: TGCElectronicsSystem.cxx:109
TGCASDOut.h
LVL1TGC::TGCTMDB
Definition: TGCTMDB.h:19
LVL1TGCTrigger::TGCElectronicsSystem::getSectorId
int getSectorId(int side, int oct, int mod) const
Definition: TGCElectronicsSystem.cxx:174
LVL1TGCTrigger::TGCElectronicsSystem::m_bis78
std::shared_ptr< LVL1TGC::TGCBIS78 > m_bis78
Definition: TGCElectronicsSystem.h:66
index
Definition: index.py:1
LVL1TGC::TGCBIS78
Definition: TGCBIS78.h:20
TGCSector.h
LVL1TGCTrigger::TGCElectronicsSystem::getSector
TGCSector * getSector(const TGCReadoutIndex &index) const
Definition: TGCElectronicsSystem.cxx:179
LVL1TGCTrigger::TGCRegionType::FORWARD
@ FORWARD
TGCDatabaseManager.h
LVL1TGCTrigger::TGCForwardBackwardType
TGCForwardBackwardType
Definition: TGCNumbering.h:59
LVL1TGC::TGCNSW
Definition: TGCNSW.h:21
TGCElectronicsSystem.h
LVL1TGCTrigger::TGCElectronicsSystem::m_nsw
std::shared_ptr< LVL1TGC::TGCNSW > m_nsw
Definition: TGCElectronicsSystem.h:65
LVL1TGCTrigger::TGCASDOut::GetTGCReadoutIndex
const TGCReadoutIndex & GetTGCReadoutIndex() const
Definition: TGCASDOut.h:33
TRT::Hit::side
@ side
Definition: HitInfo.h:83
LVL1TGCTrigger::TGCElectronicsSystem::m_DB
TGCDatabaseManager * m_DB
Definition: TGCElectronicsSystem.h:61
python.PyAthena.module
module
Definition: PyAthena.py:131
LVL1TGCTrigger::NumberOfOctant
const int NumberOfOctant
Definition: TGCElectronicsSystem.h:19
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
lumiFormat.i
int i
Definition: lumiFormat.py:85
LVL1TGCTrigger::BackwardSector
@ BackwardSector
Definition: TGCNumbering.h:59
python.subdetectors.mmg.database
database
Definition: mmg.py:6
LVL1TGCTrigger::TGCASDOut
Definition: TGCASDOut.h:12
TGCEvent.h
LVL1TGCTrigger::TGCReadoutIndex::GetOctantNumber
int GetOctantNumber() const
Definition: TGCReadoutIndex.h:55
LVL1TGCTrigger::TGCReadoutIndex::GetModuleNumber
int GetModuleNumber() const
Definition: TGCReadoutIndex.h:56
LVL1TGCTrigger::TGCElectronicsSystem::~TGCElectronicsSystem
virtual ~TGCElectronicsSystem()
Definition: TGCElectronicsSystem.cxx:185
LVL1TGCTrigger::TGCEvent
Definition: TGCEvent.h:15
LVL1TGCTrigger
Definition: LVL1TGCTrigger.cxx:47
LVL1TGCTrigger::TGCDatabaseManager
Definition: TGCDatabaseManager.h:39
LVL1TGCTrigger::TGCArguments::USE_BIS78
bool USE_BIS78() const
Definition: TGCArguments.cxx:50
LVL1TGCTrigger::TGCArguments
Definition: TGCArguments.h:12
LVL1TGCTrigger::TGCArguments::USE_NSW
bool USE_NSW() const
Definition: TGCArguments.cxx:47
LVL1TGCTrigger::TGCReadoutIndex::GetSideNumber
int GetSideNumber() const
Definition: TGCReadoutIndex.h:52
LVL1TGCTrigger::TGCElectronicsSystem::m_sector
TGCSector * m_sector[LVL1TGC::kNSide][NumberOfOctant][NumberOfModule]
Definition: TGCElectronicsSystem.h:62
LVL1TGCTrigger::TGCElectronicsSystem::m_tmdb
std::shared_ptr< LVL1TGC::TGCTMDB > m_tmdb
Definition: TGCElectronicsSystem.h:64
LVL1TGCTrigger::TGCRegionType
TGCRegionType
Definition: TGCNumbering.h:49
LVL1TGCTrigger::TGCElectronicsSystem::distributeSignal
void distributeSignal(TGCEvent *event)
Definition: TGCElectronicsSystem.cxx:16
LVL1TGCTrigger::TGCElectronicsSystem::getRegionType
TGCRegionType getRegionType(int mod) const
Definition: TGCElectronicsSystem.cxx:88
LVL1TGC::kNSide
@ kNSide
Definition: TGCNumbering.h:16
LVL1TGCTrigger::TGCReadoutIndex
Definition: TGCReadoutIndex.h:13
LVL1TGCTrigger::NumberOfModule
const int NumberOfModule
Definition: TGCElectronicsSystem.h:20
LVL1TGCTrigger::TGCElectronicsSystem::TGCElectronicsSystem
TGCElectronicsSystem()
Definition: TGCElectronicsSystem.cxx:36
LVL1TGCTrigger::TGCSector::distributeSignal
int distributeSignal(const TGCASDOut *asdOut)
Definition: TGCSector.cxx:31
LVL1TGCTrigger::ForwardSector
@ ForwardSector
Definition: TGCNumbering.h:59
LVL1TGCTrigger::TGCElectronicsSystem::tgcArgs
TGCArguments * tgcArgs()
Definition: TGCElectronicsSystem.h:51
fitman.k
k
Definition: fitman.py:528