ATLAS Offline Software
TgcChamber.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 #include "TgcChamber.h"
5 #include "TString.h"
6 #include <iostream>
7 
8 void TGC::TgcChamber::initChamber(const std::string& cham_name){
9  // example: A01M01f01E01
10  TGCSIDE iSide = (cham_name.substr(0,1).compare("A")==0)?(TGC::TGCSIDE::TGCASIDE):(TGC::TGCSIDE::TGCCSIDE);
11  int iSec = std::stoi(cham_name.substr(1,2));
12  int iM = std::stoi(cham_name.substr(4,2));
13  int iPhi = std::stoi(cham_name.substr(7,2));
14  int iEta = std::stoi(cham_name.substr(10,2));
16 }
17 void TGC::TgcChamber::initChamber(TGCSIDE side,int sec,int m, int phi, int eta)
18 {
19  m_iSide = side;
20  m_iSec = sec;
21  m_iM = m;
22  m_iPhi = phi;
23  m_iEta = eta;
24  if(m_iM==1 && m_iEta==0){
25  m_stationName = 41;
26  m_stationEta = (m_iSide==TGC::TGCSIDE::TGCASIDE)?(+1):(-1);
27  m_stationPhi = (m_iSec-1)*2 + m_iPhi/2+1 - 1;
28  if( m_stationPhi <= 0 ) m_stationPhi += 24;
29  m_detId = TGC::TGCDETECTOR::TGCM1;
30  }else if(m_iM==1 && m_iEta!=0){
31  m_stationName = 42;
32  m_stationEta = ((m_iSide==TGC::TGCSIDE::TGCASIDE)?(+1):(-1)) * (5 - m_iEta);
33  m_stationPhi = (m_iSec-1)*4 + m_iPhi - 1;
34  if( m_stationPhi <= 0 ) m_stationPhi += 48;
35  m_detId = TGC::TGCDETECTOR::TGCM1;
36  }else if(m_iM==2 && m_iEta==0){
37  m_stationName = 43;
38  m_stationEta = (m_iSide==TGC::TGCSIDE::TGCASIDE)?(+1):(-1);
39  m_stationPhi = (m_iSec-1)*2 + m_iPhi/2+1 - 1;
40  if( m_stationPhi <= 0 ) m_stationPhi += 24;
41  m_detId = TGC::TGCDETECTOR::TGCM2;
42  }else if(m_iM==2 && m_iEta!=0){
43  m_stationName = 44;
44  m_stationEta = ((m_iSide==TGC::TGCSIDE::TGCASIDE)?(+1):(-1)) * (6 - m_iEta);
45  m_stationPhi = (m_iSec-1)*4 + m_iPhi - 1;
46  if( m_stationPhi <= 0 ) m_stationPhi += 48;
47  m_detId = TGC::TGCDETECTOR::TGCM2;
48  }else if(m_iM==3 && m_iEta==0){
49  m_stationName = 45;
50  m_stationEta = (m_iSide==TGC::TGCSIDE::TGCASIDE)?(+1):(-1);
51  m_stationPhi = (m_iSec-1)*2 + m_iPhi/2+1 - 1;
52  if( m_stationPhi <= 0 ) m_stationPhi += 24;
53  m_detId = TGC::TGCDETECTOR::TGCM3;
54  }else if(m_iM==3 && m_iEta!=0){
55  m_stationName = 46;
56  m_stationEta = ((m_iSide==TGC::TGCSIDE::TGCASIDE)?(+1):(-1)) * (6 - m_iEta);
57  m_stationPhi = (m_iSec-1)*4 + m_iPhi - 1;
58  if( m_stationPhi <= 0 ) m_stationPhi += 48;
59  m_detId = TGC::TGCDETECTOR::TGCM3;
60  }else if(m_iM==4 && m_iEta==0){
61  m_stationName = 47;
62  m_stationEta = (m_iSide==TGC::TGCSIDE::TGCASIDE)?(+1):(-1);
63  m_stationPhi = m_iPhi;
64  m_detId = TGC::TGCDETECTOR::TGCFI;
65  }else if(m_iM==4 && m_iEta!=0){
66  m_stationName = 48;
67  m_stationEta = (m_iSide==TGC::TGCSIDE::TGCASIDE)?(+1):(-1);
68  if(m_iSec==1){
69  m_stationPhi = m_iPhi;
70  }else if(m_iSec==3){
71  m_stationPhi = m_iPhi + 3;
72  }else if(m_iSec==5){
73  m_stationPhi = m_iPhi + 6;
74  }else if(m_iSec==7){
75  m_stationPhi = m_iPhi + 8;
76  }else if(m_iSec==9){
77  m_stationPhi = m_iPhi + 11;
78  }else if(m_iSec==11){
79  m_stationPhi = m_iPhi + 13;
80  }else if(m_iSec==13){
81  m_stationPhi = m_iPhi + 16;
82  }else if(m_iSec==15){
83  m_stationPhi = m_iPhi + 18;
84  }
85  if( m_stationPhi <= 0 ) m_stationPhi += 21;
86  m_detId = TGC::TGCDETECTOR::TGCEI;
87  }
88  m_cham_name = Form("%s%02dM%02df%02d%s%02d",(m_iSide==TGC::TGCSIDE::TGCASIDE)?("A"):("C"),m_iSec,m_iM,m_iPhi,(m_iEta==0)?("F"):("E"),m_iEta);
89 }
90 void TGC::TgcChamber::initChamber(TGCSIDE side,int stationEta ,int stationPhi, int stationName){
91  initChamber(std::abs(stationEta) * ((side==TGC::TGCSIDE::TGCASIDE) ? (+1.0) : (-1.0)) , stationPhi, stationName);
92 }
93 void TGC::TgcChamber::initChamber(int stationEta ,int stationPhi, int stationName){
95  int iSec = 0;
96  int iM = 0;
97  int iPhi = 0;
98  int iEta = 0;
99  iSide = (stationEta > 0) ? (TGC::TGCSIDE::TGCASIDE) : (TGC::TGCSIDE::TGCCSIDE);
100  iM = 0;
101  if (stationName == 41 || stationName == 42) iM = 1;
102  else if (stationName == 43 || stationName == 44) iM = 2;
103  else if (stationName == 45 || stationName == 46) iM = 3;
104  else if (stationName == 47 || stationName == 48) iM = 4; // EIFI
105 
106  if (iM != 4) { // Big Wheel, (M1,M2,M3)
107  if (stationName % 2 == 0) { // Endcap
108  int iphi2 = stationPhi + 1; // 2,3,4,..,49
109  if (iphi2 >= 48) iphi2 -= 48; // 0,1,2,3 ..., 47
110  iSec = int(iphi2 / 4) + 1; // 1,2,3,,,12
111  iPhi = iphi2 - (iSec - 1) * 4; // 0,1,2,3
112  iEta = (iM == 1) ? (5 - std::abs(stationEta)) : (6 - std::abs(stationEta));
113  } else { // Forward
114  int iphi2 = stationPhi; // 1,2,3,4,..,25
115  if (iphi2 >= 24) iphi2 -= 24; // 0,1,2,3 ...,23
116  iSec = int(iphi2 / 2) + 1; // 1,2,3,,,12
117  iPhi = iphi2 - (iSec - 1) * 2; // 0,1
118  if (iPhi == 1) iPhi = 2; //0,2
119  iEta = 0; // F
120  }
121  } else { // Small Wheel (M4)
122  if (stationName == 47) { // FI
123  iSec = 0;
124  iPhi = stationPhi; // 1,2,3..24
125  iEta = 0;
126  } else if (stationName == 48) { // EI
127  int iphi2 = (stationPhi >= 21) ? (stationPhi - 21) : (stationPhi); // 0,1,2,..,20
128  if (iphi2 >= 0 && iphi2 <= 2) {
129  iSec = 1;
130  iPhi = iphi2; // 0,1,2
131  } else if (iphi2 >= 3 && iphi2 <= 5) {
132  iSec = 3;
133  iPhi = iphi2 - 3; // 0,1,2
134  } else if (iphi2 >= 6 && iphi2 <= 8) {
135  iSec = 5;
136  iPhi = iphi2 - 6; // 0,1,2
137  } else if (iphi2 >= 9 && iphi2 <= 10) {
138  iSec = 7;
139  iPhi = iphi2 - 9 + 1; // 1,2
140  } else if (iphi2 >= 11 && iphi2 <= 13) {
141  iSec = 9;
142  iPhi = iphi2 - 11; // 0,1,2
143  } else if (iphi2 >= 14 && iphi2 <= 15) {
144  iSec = 11;
145  iPhi = iphi2 - 13; // 1,2
146  } else if (iphi2 >= 16 && iphi2 <= 18) {
147  iSec = 13;
148  iPhi = iphi2 - 16; // 0,1,2
149  } else if (iphi2 >= 19 && iphi2 <= 20) {
150  iSec = 15;
151  iPhi = iphi2 - 19 + 1; // 1,2
152  }
153  iEta = 1;
154  }
155  }
156  initChamber(iSide,iSec,iM,iPhi,iEta);
157 }
158 
159 
TGC::TgcChamber::initChamber
void initChamber(const std::string &chamber_name)
Definition: TgcChamber.cxx:8
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
TGC::TgcChamber::cham_name
const std::string & cham_name() const
Definition: TgcChamber.h:43
TGC::TgcChamber::iSec
const int & iSec() const
Definition: TgcChamber.h:46
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
dumpTgcDigiDeadChambers.stationName
dictionary stationName
Definition: dumpTgcDigiDeadChambers.py:30
TGC::TGCDETECTOR::TGCM2
@ TGCM2
TGC::TGCDETECTOR::TGCFI
@ TGCFI
TgcChamber.h
TGC::TGCSIDE::TGCSIDEUNDEF
@ TGCSIDEUNDEF
TRT::Hit::side
@ side
Definition: HitInfo.h:83
TGC::TGCSIDE
TGCSIDE
Definition: TgcBase.h:10
TGC::TgcChamber::iPhi
const int & iPhi() const
Definition: TgcChamber.h:48
TGC::TGCDETECTOR::TGCEI
@ TGCEI
TGC::TGCSIDE::TGCCSIDE
@ TGCCSIDE
TGC::TGCDETECTOR::TGCM3
@ TGCM3
Trk::iPhi
@ iPhi
Definition: ParamDefs.h:47
TGC::TgcChamber::iM
const int & iM() const
Definition: TgcChamber.h:47
TGC::TGCDETECTOR::TGCM1
@ TGCM1
xAOD::iEta
setScale setgFexType iEta
Definition: gFexJetRoI_v1.cxx:74
TGC::TgcChamber::iSide
const TGCSIDE & iSide() const
Definition: TgcChamber.h:44
TGC::TGCSIDE::TGCASIDE
@ TGCASIDE
TGC::TgcChamber::iEta
const int & iEta() const
Definition: TgcChamber.h:49