ATLAS Offline Software
MdtVsTgcRawData_functions.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // Package : MdtVsTgcRawDataValAlg
7 // Authors: A. Ishikawa(Kobe)
8 // Jun. 2008
9 //
10 // DESCRIPTION:
11 // Subject: correlation btw MDT hits vs TGC RoI -->Offline Muon Data Quality
13 
14 #include "GaudiKernel/MsgStream.h"
15 
16 #include "Identifier/Identifier.h"
17 
18 //mdt stuff
20 
21 #include "MdtVsTgcRawDataValAlg.h"
22 
23 #include <TList.h>
24 #include <TBox.h>
25 #include <inttypes.h>
26 
27 void
29 
30  int roiphi=cd.phi();//phi in 1/48(24) sector for endcap(forward)
31  int roi=cd.roi();//0-147(0-63)
32 
33  //int localeta=roi/4;
34 
35  if(cd.isForward()){//forward
36 
37  int localphi=roi%4;
38 
39  //eta=roi/4;
40  eta=roi/4+36;
41  phi=(localphi+roiphi*4)*2;
42 
43  }else{//endcap
44 
45  int sector=phi2sector(roiphi,1);
46 
47  phi=roiphi*4 + ( sector%2==0 ? roi%4 : 3-(roi%4) );
48  eta=roi/4;
49  }
50 
51  //eta=52-eta;
52  return;
53 
54 }
55 
56 int
58  int sector=-1;
59  if(ef==0){//forward
60  sector=phi/2+1;//(phi,sector)= (1,1), (2,2), (3,2), (4,3)
61  }else{//endcap
62  sector=(phi+1)/4+1;//(phi,sector)= (1,1), (2,1), (3,2), (4,2)
63  }
64  if(sector>12)sector=1;
65 
66  return sector;
67 }
68 
69 int
71  int mdtSector=-1;
72  if(ef==0){//forward phi1-24
73  mdtSector=roiphi/2+1;//(phi,sector)= (1,1), (2,2), (3,2), (4,3)
74  }else{//endcap
75  mdtSector=(roiphi+1)/4+1;//(phi,sector)= (1,1), (2,1), (3,2), (4,2)
76  }
77  if(mdtSector>8)mdtSector=1;
78 
79  return mdtSector;
80 }
81 
82 int
84 
85  int nSL=0;
86 
87  //loop over TGC RoI container
88  Muon::TgcCoinDataContainer::const_iterator it_end=tgctrgcontainer->end();
89  for( Muon::TgcCoinDataContainer::const_iterator it=tgctrgcontainer->begin();
90  it!=it_end;
91  ++it){
92 
93 
94  ATH_MSG_DEBUG( "size of tgc collection is " << (*it) -> size() );
95 
96  //loop over TGC RoI collection
98  for( Muon::TgcCoinDataCollection::const_iterator itc=(*it)->begin();
99  itc!= itc_end;
100  ++itc){
101 
102  const Muon::TgcCoinData* tcd=*itc;
103 
104  if( tcd->type() != Muon::TgcCoinData::TYPE_SL )continue;
105  ATH_MSG_DEBUG("pt"<<tcd->pt() );
106  nSL++;
107  }
108  }
109 
110  return nSL;
111 }
112 
113 int
115  int layer=0;
116  if(station==41||station==42){
117  layer += GasGap;
118  }else if(station==43||station==44){
119  layer = 3+GasGap;
120  }else if(station==45||station==46){
121  layer = 5+GasGap;
122  }
123  return layer;
124 }
125 
127 // Put blank gray box over histogram area
128 void
129 MdtVsTgcRawDataValAlg::putBox(TH2* h, float x1, float y1, float x2, float y2){
130  TBox* box = new TBox(x1, y1, x2, y2);
131 // box->SetFillColor(kGray+1);
132 // box->SetLineColor(kGray+1);
133 // box->SetFillStyle(3013);
134 // box->SetFillStyle(3004);
135 
136  box->SetFillColor(kGray);
137  box->SetLineColor(kGray);
138 
139 // box->SetLineStyle(3);
140 
141  (h->GetListOfFunctions())->Add(box);
142 }
143 void
145  float x1=h->GetXaxis()->GetBinLowEdge(binx);
146  float x2=h->GetXaxis()->GetBinUpEdge(binx);
147  for(int i=0;i<24;i++){
148  int biny = (i+1)*2;
149  float y1=h->GetYaxis()->GetBinLowEdge(biny);
150  float y2=h->GetYaxis()->GetBinUpEdge(biny);
151  putBox(h, x1, y1, x2, y2);
152  }
153 }
154 void
156  bool rebin=true;
157  if(rebin){//use new bin
158  for(int i=33; i<44;i++)BlankPhi24(h,i);
159  int x1=h->GetXaxis()->GetBinLowEdge(40);
160  int x2=h->GetXaxis()->GetBinUpEdge(40);
161  int x3=h->GetXaxis()->GetBinLowEdge(41);
162  int x4=h->GetXaxis()->GetBinUpEdge(41);
163  int y1=h->GetYaxis()->GetBinLowEdge(19);
164  int y2=h->GetYaxis()->GetBinUpEdge(19);
165  putBox(h, x1, y1, x2, y2);
166  putBox(h, x3, y1, x4, y2);
167  y1=h->GetYaxis()->GetBinLowEdge(35);
168  y2=h->GetYaxis()->GetBinUpEdge(35);
169  putBox(h, x1, y1, x2, y2);
170  putBox(h, x3, y1, x4, y2);
171  y1=h->GetYaxis()->GetBinLowEdge(43);
172  y2=h->GetYaxis()->GetBinUpEdge(43);
173  putBox(h, x1, y1, x2, y2);
174  putBox(h, x3, y1, x4, y2);
175 
176  if(ws==1){//Strip
177  x1=h->GetXaxis()->GetBinLowEdge(2);
178  y1=h->GetYaxis()->GetBinLowEdge(1);
179  x2=h->GetXaxis()->GetBinUpEdge(2);
180  y2=h->GetYaxis()->GetBinUpEdge(48);
181  putBox(h, x1, y1, x2, y2);
182  x1=h->GetXaxis()->GetBinLowEdge(9);
183  x2=h->GetXaxis()->GetBinUpEdge(9);
184  putBox(h, x1, y1, x2, y2);
185  x1=h->GetXaxis()->GetBinLowEdge(16);
186  x2=h->GetXaxis()->GetBinUpEdge(16);
187  putBox(h, x1, y1, x2, y2);
188  x1=h->GetXaxis()->GetBinLowEdge(23);
189  x2=h->GetXaxis()->GetBinUpEdge(23);
190  putBox(h, x1, y1, x2, y2);
191  x1=h->GetXaxis()->GetBinLowEdge(34);
192  x2=h->GetXaxis()->GetBinUpEdge(34);
193  putBox(h, x1, y1, x2, y2);
194  }
195  }else{//use old bin, logically dead code, comment out
196 // BlankPhi24(h, 5);
197 // BlankPhi24(h, 10);
198 // BlankPhi24(h, 15);
199 // BlankPhi24(h, 21);
200 // BlankPhi24(h, 27);
201 // BlankPhi24(h, 33);
202 // BlankPhi24(h, 39);
203 // BlankPhi24(h, 40);
204 // BlankPhi24(h, 41);
205 // BlankPhi24(h, 42);
206 // BlankPhi24(h, 43);
207 // int x1=h->GetXaxis()->GetBinLowEdge(40);
208 // int x2=h->GetXaxis()->GetBinUpEdge(40);
209 // int x3=h->GetXaxis()->GetBinLowEdge(42);
210 // int x4=h->GetXaxis()->GetBinUpEdge(42);
211 // int y1=h->GetYaxis()->GetBinLowEdge(19);
212 // int y2=h->GetYaxis()->GetBinUpEdge(19);
213 // putBox(h, x1, y1, x2, y2);
214 // putBox(h, x3, y1, x4, y2);
215 // y1=h->GetYaxis()->GetBinLowEdge(35);
216 // y2=h->GetYaxis()->GetBinUpEdge(35);
217 // putBox(h, x1, y1, x2, y2);
218 // putBox(h, x3, y1, x4, y2);
219 // y1=h->GetYaxis()->GetBinLowEdge(43);
220 // y2=h->GetYaxis()->GetBinUpEdge(43);
221 // putBox(h, x1, y1, x2, y2);
222 // putBox(h, x3, y1, x4, y2);
223  }
224 }
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
MdtVsTgcRawDataValAlg::numberOfSL
int numberOfSL(const Muon::TgcCoinDataContainer *tgctrgcontainer)
Definition: MdtVsTgcRawData_functions.cxx:83
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
MdtVsTgcRawDataValAlg::putBox
void putBox(TH2 *h2, float x1, float y1, float x2, float y2)
Definition: MdtVsTgcRawData_functions.cxx:129
Muon::TgcCoinData::type
CoinDataType type() const
return the coincidence type (HIPT, LPT, SL)
Definition: TgcCoinData.h:346
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
skel.it
it
Definition: skel.GENtoEVGEN.py:423
MdtVsTgcRawDataValAlg.h
MdtVsTgcRawDataValAlg::BlankPhi24
void BlankPhi24(TH2 *h2, int binx)
Definition: MdtVsTgcRawData_functions.cxx:144
MdtVsTgcRawDataValAlg::roiphi2mdtSector
int roiphi2mdtSector(int roiphi, int ef)
Definition: MdtVsTgcRawData_functions.cxx:70
Muon::TgcCoinData
Definition: TgcCoinData.h:37
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
MdtVsTgcRawDataValAlg::BlankStationMap
void BlankStationMap(TH2 *h2, int ws)
Definition: MdtVsTgcRawData_functions.cxx:155
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
MdtVsTgcRawDataValAlg::phi2sector
int phi2sector(int phi, int ef)
Definition: MdtVsTgcRawData_functions.cxx:57
lumiFormat.i
int i
Definition: lumiFormat.py:92
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MdtVsTgcRawDataValAlg::stationGasGap2layer
int stationGasGap2layer(int station, int GasGap)
Definition: MdtVsTgcRawData_functions.cxx:114
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
makeTRTBarrelCans.y2
tuple y2
Definition: makeTRTBarrelCans.py:18
IdentifiableContainerMT::end
const_iterator end() const
return const_iterator for end of container
Definition: IdentifiableContainerMT.h:242
IdentifiableContainerMT::const_iterator
Definition: IdentifiableContainerMT.h:82
IdentifiableContainerMT::begin
const_iterator begin() const
return const_iterator for first entry
Definition: IdentifiableContainerMT.h:236
TH2
Definition: rootspy.cxx:373
python.grid.Add
def Add(name)
Definition: grid.py:41
MdtVsTgcRawDataValAlg::roi2etaphi
void roi2etaphi(const Muon::TgcCoinData &cd, int &eta, int &phi)
Definition: MdtVsTgcRawData_functions.cxx:28
makeegammaturnon.rebin
def rebin(binning, data)
Definition: makeegammaturnon.py:17
Muon::MuonCoinDataContainer
Definition: MuonCoinDataContainer.h:32
h
Muon::TgcCoinData::pt
int pt() const
return pt threshold value
Definition: TgcCoinData.h:380
Muon::TgcCoinData::TYPE_SL
@ TYPE_SL
Definition: TgcCoinData.h:52
calibdata.cd
cd
Definition: calibdata.py:51
MuonFixedId.h
LheEventFiller_Common.ef
ef
Definition: SFGen_i/share/common/LheEventFiller_Common.py:7