ATLAS Offline Software
TGCSSCControllerOut.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TGCSSCControllerOut_hh
6 #define TGCSSCControllerOut_hh
8 #include <iostream>
9 
10 namespace LVL1TGCTrigger {
11 
13 {
14  public:
15  enum {MaxNumberOfPhiInSSC = 4};
17 
18  public:
20 
21  bool hasChamberBoundary(int ssc) const;
22  bool hasUpperChamber(int ssc) const;
23  int getOredChamberNumber(int ssc) const;
24 
25  int getR(int ssc) const;
26  int getDR(int ssc) const;
27  int getPtR(int ssc) const;
28 
29  int getPhi(int ssc, int phipos, bool ored=false) const;
30  int getDPhi(int ssc, int phipos, bool ored=false) const;
31  int getPtPhi(int ssc, int phipos, bool ored=false) const;
32 
33  void setR(unsigned int ssc, int rIn);
34  void setDR(unsigned int ssc, int dRIn);
35  void setPtR(unsigned int ssc, int ptLvl);
36  void setHitR(unsigned int ssc, bool hit);
37 
38  void setPhi(int chamberNo, int phiPos, int phiIn);
39  void setDPhi(int chamberNo, int phiPos, int dPhiIn);
40  void setPtPhi(int chamberNo, int phiPos, int ptLvl);
41  void setHitPhi(int chamberNo, int phiPos, bool hit);
42 
43  bool hasHit(int ssc, bool ored=false) const;
44  bool hasHit(int ssc, int phiposInSSC, bool ored=false) const;
45  bool hasHitPhi(int chamberNo, int phiPos) const;
46 
47  void clear();
48  void print() const;
49 
50 protected:
51  int getChamberNumber(int ssc) const;
52  int getNumberOfChamberInR() const;
53  int getNumberOfSubSectorCluster() const;
54 private:
55  static const int s_chamber[NumberOfRegionType][LVL1TGC::kNMaxSSC];
56 
58 
63 
64  int m_r[LVL1TGC::kNMaxSSC];
65  int m_dR[LVL1TGC::kNMaxSSC];
66  int m_ptR[LVL1TGC::kNMaxSSC];
67  bool m_hitR[LVL1TGC::kNMaxSSC];
68 };
69 
70 inline
72 {
74  if(ssc==2||ssc==4||ssc==6||ssc==12) return true;
75 
76  return false;
77 }
78 
79 inline
81 {
82  if(hasChamberBoundary(ssc)){
83  if(ssc==4||ssc==6) return true;
84  else return false;
85  } else {
86  std::cerr << "internal error: ssc " << ssc
87  << " don't has chamber boundary" << std::endl;
88  return false;
89  }
90 }
91 
92 inline
94 {
95  if(hasChamberBoundary(ssc)){
96  if(hasUpperChamber(ssc)) return getChamberNumber(ssc)-1;
97  else return getChamberNumber(ssc)+1;
98  } else {
99  std::cerr << "internal error: ssc " << ssc
100  << " don't has chamber boundary" << std::endl;
101  return -1;
102  }
103 }
104 
105 inline
107 {
108  if (m_regionType == TGCRegionType::FORWARD) return s_chamber[0][ssc];
109  else return s_chamber[1][ssc];
110 }
111 inline
113 {
114  if (m_regionType == TGCRegionType::FORWARD) return 1;
115  else return 5;
116 }
117 inline
119 {
120  return (m_regionType == TGCRegionType::FORWARD) ? 8 : LVL1TGC::kNMaxSSC;
121 }
122 inline
123  int TGCSSCControllerOut::getR(int ssc) const
124 {
125  return m_r[ssc];
126 }
127 
128 inline
129  int TGCSSCControllerOut::getDR(int ssc) const
130 {
131  return m_dR[ssc];
132 }
133 
134 inline
135  int TGCSSCControllerOut::getPtR(int ssc) const
136 {
137  return m_ptR[ssc];
138 }
139 
140 
141 inline
142  int TGCSSCControllerOut::getPhi(int ssc, int phipos, bool ored) const
143 {
144  if(!ored) {
145  return m_phi[getChamberNumber(ssc)][phipos];
146  } else {
147  int idx =getOredChamberNumber(ssc);
148  if (idx>=0 ) return m_phi[idx][phipos];
149  else {
150  std::cerr << "internal error in TGCSSCControllerOut::getPhi()"
151  << std::endl;
152  return 0;
153  }
154  }
155  return 0;
156 }
157 
158 inline
159  int TGCSSCControllerOut::getDPhi(int ssc, int phipos, bool ored) const
160 {
161  if(!ored) {
162  return m_dPhi[getChamberNumber(ssc)][phipos];
163  } else {
164  int idx =getOredChamberNumber(ssc);
165  if (idx>=0 ) return m_dPhi[idx][phipos];
166  else {
167  std::cerr << "internal error in TGCSSCControllerOut::getDPhi()"
168  << std::endl;
169  return 0;
170  }
171  }
172  return 0;
173 }
174 
175 
176 inline
177  int TGCSSCControllerOut::getPtPhi(int ssc, int phipos, bool ored) const
178 {
179  if(!ored) {
180  return m_ptPhi[getChamberNumber(ssc)][phipos];
181  } else {
182  int idx =getOredChamberNumber(ssc);
183  if (idx>=0 ) return m_ptPhi[idx][phipos];
184  else {
185  std::cerr << "internal error in TGCSSCControllerOut::getPtPhi()"
186  << std::endl;
187  return 0;
188  }
189  }
190  return 0;
191 }
192 
193 inline
194  void TGCSSCControllerOut::setR(unsigned int ssc, int rIn)
195 {
196  if (ssc < LVL1TGC::kNMaxSSC){
197  m_r[ssc]=rIn;
198  }else{
199  std::cerr << "internal error in TGCSSCControllerOut::setR() sscid:" << ssc << " 0 < SSCId < " << LVL1TGC::kNMaxSSC << std::endl;
200  }
201 }
202 
203 inline
204  void TGCSSCControllerOut::setDR(unsigned int ssc, int dRIn)
205 {
206  if (ssc < LVL1TGC::kNMaxSSC) {
207  m_dR[ssc]=dRIn;
208  } else {
209  std::cerr << "internal error in TGCSSCControllerOut::setDR() sscid:" << ssc << " 0 < SSCId < " << LVL1TGC::kNMaxSSC << std::endl;
210  }
211 }
212 
213 inline
214  void TGCSSCControllerOut::setPtR(unsigned int ssc, int ptLvl)
215 {
216  if (ssc < LVL1TGC::kNMaxSSC) {
217  m_ptR[ssc] = ptLvl;
218  } else{
219  std::cerr << "internal error in TGCSSCControllerOut::setPtR() sscid:" << ssc << " 0 < SSCId < " << LVL1TGC::kNMaxSSC << std::endl;
220  }
221 }
222 
223 inline
224  void TGCSSCControllerOut::setHitR(unsigned int ssc, bool hit)
225 {
226  if (ssc < LVL1TGC::kNMaxSSC) {
227  m_hitR[ssc]=hit;
228  } else {
229  std::cerr << "internal error in TGCSSCControllerOut::setHitR() sscid:" << ssc << " 0 < SSCId < " << LVL1TGC::kNMaxSSC << std::endl;
230  }
231 }
232 
233 inline
234  void TGCSSCControllerOut::setPhi(int chamberNo, int phiPos, int phiIn)
235 {
236  if((0 <= chamberNo)&&(chamberNo < MaxNumberOfChamberInR)&&(0 <= phiPos)&&(phiPos < MaxNumberOfPhiInSSC)){
237  m_phi[chamberNo][phiPos]=phiIn;
238  }else{
239  std::cerr << "internal error in TGCSSCControllerOut::setPhi() chamberNo:" << chamberNo << " phiPos:" << phiPos << " phiIn:" << phiIn << std::endl;
240  }
241 }
242 
243 inline
244  void TGCSSCControllerOut::setDPhi(int chamberNo, int phiPos, int dPhiIn)
245 {
246  if((0 <= chamberNo)&&(chamberNo < MaxNumberOfChamberInR)&&(0 <= phiPos)&&(phiPos < MaxNumberOfPhiInSSC)){
247  m_dPhi[chamberNo][phiPos]=dPhiIn;
248  }else{
249  std::cerr << "internal error in TGCSSCControllerOut::setDPhi() chamberNo:" << chamberNo << " phiPos:" << phiPos << " dPhiIn:" << dPhiIn << std::endl;
250  }
251 }
252 
253 inline
254  void TGCSSCControllerOut::setPtPhi(int chamberNo, int phiPos, int ptLvl)
255 {
256  if((0 <= chamberNo)&&(chamberNo < MaxNumberOfChamberInR)&&(0 <= phiPos)&&(phiPos < MaxNumberOfPhiInSSC)){
257  m_ptPhi[chamberNo][phiPos]=ptLvl;
258  }else{
259  std::cerr << "internal error in TGCSSCControllerOut::setPtPhi() chamberNo:" << chamberNo << " phiPos:" << phiPos << " ptLvl:" << ptLvl << std::endl;
260  }
261 }
262 
263 inline
264  void TGCSSCControllerOut::setHitPhi(int chamberNo, int phiPos, bool hit)
265 {
266  if((0 <= chamberNo)&&(chamberNo < MaxNumberOfChamberInR)&&(0 <= phiPos)&&(phiPos < MaxNumberOfPhiInSSC)){
267  m_hitPhi[chamberNo][phiPos]=hit;
268  }else{
269  std::cerr << "internal error in TGCSSCControllerOut::setHitPhi() chamberNo:" << chamberNo << " phiPos:" << phiPos << " hit:" << hit << std::endl;
270  }
271 }
272 
273 inline
274  bool TGCSSCControllerOut::hasHitPhi(int chamberNo, int phiPos) const
275 {
276  if((0 <= chamberNo)&&(chamberNo < MaxNumberOfChamberInR)&&(0 <= phiPos)&&(phiPos < MaxNumberOfPhiInSSC)){
277  return m_hitPhi[chamberNo][phiPos];
278  }
279  return false;
280 }
281 
282 
283 } //end of namespace bracket
284 
285 #endif
286 
LVL1TGCTrigger::TGCRegionType::ENDCAP
@ ENDCAP
LVL1TGCTrigger::TGCSSCControllerOut::getPtPhi
int getPtPhi(int ssc, int phipos, bool ored=false) const
Definition: TGCSSCControllerOut.h:177
LVL1TGCTrigger::TGCSSCControllerOut::print
void print() const
Definition: TGCSSCControllerOut.cxx:61
LVL1TGCTrigger::TGCSSCControllerOut::setPtR
void setPtR(unsigned int ssc, int ptLvl)
Definition: TGCSSCControllerOut.h:214
LVL1TGCTrigger::NumberOfRegionType
const int NumberOfRegionType
Definition: TGCNumbering.h:55
LVL1TGCTrigger::TGCSSCControllerOut::m_dR
int m_dR[LVL1TGC::kNMaxSSC]
Definition: TGCSSCControllerOut.h:65
LVL1TGCTrigger::TGCSSCControllerOut::hasHit
bool hasHit(int ssc, bool ored=false) const
Definition: TGCSSCControllerOut.cxx:35
LVL1TGCTrigger::TGCSSCControllerOut::setDR
void setDR(unsigned int ssc, int dRIn)
Definition: TGCSSCControllerOut.h:204
LVL1TGCTrigger::TGCSSCControllerOut::getPtR
int getPtR(int ssc) const
Definition: TGCSSCControllerOut.h:135
LVL1TGCTrigger::TGCSSCControllerOut::hasHitPhi
bool hasHitPhi(int chamberNo, int phiPos) const
Definition: TGCSSCControllerOut.h:274
LVL1TGCTrigger::TGCRegionType::FORWARD
@ FORWARD
LVL1TGCTrigger::TGCSSCControllerOut::m_ptR
int m_ptR[LVL1TGC::kNMaxSSC]
Definition: TGCSSCControllerOut.h:66
LVL1TGCTrigger::TGCSSCControllerOut
Definition: TGCSSCControllerOut.h:13
LVL1TGCTrigger::TGCSSCControllerOut::clear
void clear()
Definition: TGCSSCControllerOut.cxx:83
LVL1TGCTrigger::TGCSSCControllerOut::m_r
int m_r[LVL1TGC::kNMaxSSC]
Definition: TGCSSCControllerOut.h:64
LVL1TGCTrigger::TGCSSCControllerOut::hasChamberBoundary
bool hasChamberBoundary(int ssc) const
Definition: TGCSSCControllerOut.h:71
LVL1TGCTrigger::TGCSSCControllerOut::setPhi
void setPhi(int chamberNo, int phiPos, int phiIn)
Definition: TGCSSCControllerOut.h:234
LVL1TGCTrigger::TGCSSCControllerOut::m_hitPhi
bool m_hitPhi[MaxNumberOfChamberInR][MaxNumberOfPhiInSSC]
Definition: TGCSSCControllerOut.h:62
LVL1TGCTrigger::TGCSSCControllerOut::getDPhi
int getDPhi(int ssc, int phipos, bool ored=false) const
Definition: TGCSSCControllerOut.h:159
LVL1TGCTrigger::TGCSSCControllerOut::setDPhi
void setDPhi(int chamberNo, int phiPos, int dPhiIn)
Definition: TGCSSCControllerOut.h:244
LVL1TGCTrigger::TGCSSCControllerOut::hasUpperChamber
bool hasUpperChamber(int ssc) const
Definition: TGCSSCControllerOut.h:80
LVL1TGCTrigger::TGCSSCControllerOut::getNumberOfChamberInR
int getNumberOfChamberInR() const
Definition: TGCSSCControllerOut.h:112
LVL1TGCTrigger::TGCSSCControllerOut::getChamberNumber
int getChamberNumber(int ssc) const
Definition: TGCSSCControllerOut.h:106
LVL1TGCTrigger
Definition: LVL1TGCTrigger.cxx:47
LVL1TGCTrigger::TGCSSCControllerOut::getR
int getR(int ssc) const
Definition: TGCSSCControllerOut.h:123
LVL1TGCTrigger::TGCSSCControllerOut::TGCSSCControllerOut
TGCSSCControllerOut(TGCRegionType region=TGCRegionType::ENDCAP)
Definition: TGCSSCControllerOut.cxx:15
TGCNumbering.h
LVL1TGCTrigger::TGCSSCControllerOut::getNumberOfSubSectorCluster
int getNumberOfSubSectorCluster() const
Definition: TGCSSCControllerOut.h:118
LVL1TGCTrigger::TGCSSCControllerOut::s_chamber
static const int s_chamber[NumberOfRegionType][LVL1TGC::kNMaxSSC]
Definition: TGCSSCControllerOut.h:55
LVL1TGCTrigger::TGCSSCControllerOut::getOredChamberNumber
int getOredChamberNumber(int ssc) const
Definition: TGCSSCControllerOut.h:93
LVL1TGCTrigger::TGCSSCControllerOut::setPtPhi
void setPtPhi(int chamberNo, int phiPos, int ptLvl)
Definition: TGCSSCControllerOut.h:254
LVL1TGCTrigger::TGCSSCControllerOut::setR
void setR(unsigned int ssc, int rIn)
Definition: TGCSSCControllerOut.h:194
LVL1TGCTrigger::TGCSSCControllerOut::setHitR
void setHitR(unsigned int ssc, bool hit)
Definition: TGCSSCControllerOut.h:224
LVL1TGCTrigger::TGCSSCControllerOut::setHitPhi
void setHitPhi(int chamberNo, int phiPos, bool hit)
Definition: TGCSSCControllerOut.h:264
LVL1TGCTrigger::TGCSSCControllerOut::m_regionType
TGCRegionType m_regionType
Definition: TGCSSCControllerOut.h:57
LVL1TGCTrigger::TGCSSCControllerOut::m_hitR
bool m_hitR[LVL1TGC::kNMaxSSC]
Definition: TGCSSCControllerOut.h:67
LVL1TGCTrigger::TGCRegionType
TGCRegionType
Definition: TGCNumbering.h:49
LVL1TGCTrigger::TGCSSCControllerOut::MaxNumberOfChamberInR
@ MaxNumberOfChamberInR
Definition: TGCSSCControllerOut.h:16
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
LVL1TGCTrigger::TGCSSCControllerOut::MaxNumberOfPhiInSSC
@ MaxNumberOfPhiInSSC
Definition: TGCSSCControllerOut.h:15
LVL1TGCTrigger::TGCSSCControllerOut::getDR
int getDR(int ssc) const
Definition: TGCSSCControllerOut.h:129
LVL1TGCTrigger::TGCSSCControllerOut::getPhi
int getPhi(int ssc, int phipos, bool ored=false) const
Definition: TGCSSCControllerOut.h:142
LVL1TGCTrigger::TGCSSCControllerOut::m_ptPhi
int m_ptPhi[MaxNumberOfChamberInR][MaxNumberOfPhiInSSC]
Definition: TGCSSCControllerOut.h:61
LVL1TGCTrigger::TGCSSCControllerOut::m_dPhi
int m_dPhi[MaxNumberOfChamberInR][MaxNumberOfPhiInSSC]
Definition: TGCSSCControllerOut.h:60
LVL1TGCTrigger::TGCSSCControllerOut::m_phi
int m_phi[MaxNumberOfChamberInR][MaxNumberOfPhiInSSC]
Definition: TGCSSCControllerOut.h:59