CMS 3D CMS Logo

MuonAlignmentAnalyzer.cc
Go to the documentation of this file.
1 
13 
14 // Collaborating Class Header
17 
19 #include "boost/mpl/vector.hpp"
27 
31 
33 
41 
45 
46 #include "TH2F.h"
47 #include "TLorentzVector.h"
48 
51  hGBNmuons(nullptr),
52  hSANmuons(nullptr),
53  hSimNmuons(nullptr),
54  hGBNmuons_Barrel(nullptr),
55  hSANmuons_Barrel(nullptr),
56  hSimNmuons_Barrel(nullptr),
57  hGBNmuons_Endcap(nullptr),
58  hSANmuons_Endcap(nullptr),
59  hSimNmuons_Endcap(nullptr),
60  hGBNhits(nullptr),
61  hGBNhits_Barrel(nullptr),
62  hGBNhits_Endcap(nullptr),
63  hSANhits(nullptr),
64  hSANhits_Barrel(nullptr),
65  hSANhits_Endcap(nullptr),
66  hGBChi2(nullptr),
67  hSAChi2(nullptr),
68  hGBChi2_Barrel(nullptr),
69  hSAChi2_Barrel(nullptr),
70  hGBChi2_Endcap(nullptr),
71  hSAChi2_Endcap(nullptr),
72  hGBInvM(nullptr),
73  hSAInvM(nullptr),
74  hSimInvM(nullptr),
75  hGBInvM_Barrel(nullptr),
76  hSAInvM_Barrel(nullptr),
77  hSimInvM_Barrel(nullptr),
78  hGBInvM_Endcap(nullptr),
79  hSAInvM_Endcap(nullptr),
80  hSimInvM_Endcap(nullptr),
81  hGBInvM_Overlap(nullptr),
82  hSAInvM_Overlap(nullptr),
83  hSimInvM_Overlap(nullptr),
84  hSAPTRec(nullptr),
85  hGBPTRec(nullptr),
86  hSimPT(nullptr),
87  hSAPTRec_Barrel(nullptr),
88  hGBPTRec_Barrel(nullptr),
89  hSimPT_Barrel(nullptr),
90  hSAPTRec_Endcap(nullptr),
91  hGBPTRec_Endcap(nullptr),
92  hSimPT_Endcap(nullptr),
93  hGBPTvsEta(nullptr),
94  hGBPTvsPhi(nullptr),
95  hSAPTvsEta(nullptr),
96  hSAPTvsPhi(nullptr),
97  hSimPTvsEta(nullptr),
98  hSimPTvsPhi(nullptr),
99  hSimPhivsEta(nullptr),
100  hSAPhivsEta(nullptr),
101  hGBPhivsEta(nullptr),
102  hSAPTres(nullptr),
103  hSAinvPTres(nullptr),
104  hGBPTres(nullptr),
105  hGBinvPTres(nullptr),
106  hSAPTres_Barrel(nullptr),
107  hSAPTres_Endcap(nullptr),
108  hGBPTres_Barrel(nullptr),
109  hGBPTres_Endcap(nullptr),
110  hSAPTDiff(nullptr),
111  hGBPTDiff(nullptr),
112  hSAPTDiffvsEta(nullptr),
113  hSAPTDiffvsPhi(nullptr),
114  hGBPTDiffvsEta(nullptr),
115  hGBPTDiffvsPhi(nullptr),
116  hGBinvPTvsEta(nullptr),
117  hGBinvPTvsPhi(nullptr),
118  hSAinvPTvsEta(nullptr),
119  hSAinvPTvsPhi(nullptr),
120  hSAinvPTvsNhits(nullptr),
121  hGBinvPTvsNhits(nullptr),
122  hResidualLocalXDT(nullptr),
123  hResidualLocalPhiDT(nullptr),
124  hResidualLocalThetaDT(nullptr),
125  hResidualLocalYDT(nullptr),
126  hResidualLocalXCSC(nullptr),
127  hResidualLocalPhiCSC(nullptr),
128  hResidualLocalThetaCSC(nullptr),
129  hResidualLocalYCSC(nullptr),
130 
131  hResidualLocalXDT_W(5),
132  hResidualLocalPhiDT_W(5),
133  hResidualLocalThetaDT_W(5),
134  hResidualLocalYDT_W(5),
135  hResidualLocalXCSC_ME(18),
136  hResidualLocalPhiCSC_ME(18),
137  hResidualLocalThetaCSC_ME(18),
138  hResidualLocalYCSC_ME(18),
139  hResidualLocalXDT_MB(20),
140  hResidualLocalPhiDT_MB(20),
141  hResidualLocalThetaDT_MB(20),
142  hResidualLocalYDT_MB(20),
143 
144  hResidualGlobalRPhiDT(nullptr),
145  hResidualGlobalPhiDT(nullptr),
146  hResidualGlobalThetaDT(nullptr),
147  hResidualGlobalZDT(nullptr),
148  hResidualGlobalRPhiCSC(nullptr),
149  hResidualGlobalPhiCSC(nullptr),
150  hResidualGlobalThetaCSC(nullptr),
151  hResidualGlobalRCSC(nullptr),
152 
153  hResidualGlobalRPhiDT_W(5),
154  hResidualGlobalPhiDT_W(5),
155  hResidualGlobalThetaDT_W(5),
156  hResidualGlobalZDT_W(5),
157  hResidualGlobalRPhiCSC_ME(18),
158  hResidualGlobalPhiCSC_ME(18),
159  hResidualGlobalThetaCSC_ME(18),
160  hResidualGlobalRCSC_ME(18),
161  hResidualGlobalRPhiDT_MB(20),
162  hResidualGlobalPhiDT_MB(20),
163  hResidualGlobalThetaDT_MB(20),
164  hResidualGlobalZDT_MB(20),
165 
166  hprofLocalPositionCSC(nullptr),
167  hprofLocalAngleCSC(nullptr),
168  hprofLocalPositionRmsCSC(nullptr),
169  hprofLocalAngleRmsCSC(nullptr),
170  hprofGlobalPositionCSC(nullptr),
171  hprofGlobalAngleCSC(nullptr),
172  hprofGlobalPositionRmsCSC(nullptr),
173  hprofGlobalAngleRmsCSC(nullptr),
174  hprofLocalPositionDT(nullptr),
175  hprofLocalAngleDT(nullptr),
176  hprofLocalPositionRmsDT(nullptr),
177  hprofLocalAngleRmsDT(nullptr),
178  hprofGlobalPositionDT(nullptr),
179  hprofGlobalAngleDT(nullptr),
180  hprofGlobalPositionRmsDT(nullptr),
181  hprofGlobalAngleRmsDT(nullptr),
182  hprofLocalXDT(nullptr),
183  hprofLocalPhiDT(nullptr),
184  hprofLocalThetaDT(nullptr),
185  hprofLocalYDT(nullptr),
186  hprofLocalXCSC(nullptr),
187  hprofLocalPhiCSC(nullptr),
188  hprofLocalThetaCSC(nullptr),
189  hprofLocalYCSC(nullptr),
190  hprofGlobalRPhiDT(nullptr),
191  hprofGlobalPhiDT(nullptr),
192  hprofGlobalThetaDT(nullptr),
193  hprofGlobalZDT(nullptr),
194  hprofGlobalRPhiCSC(nullptr),
195  hprofGlobalPhiCSC(nullptr),
196  hprofGlobalThetaCSC(nullptr),
197  hprofGlobalRCSC(nullptr)
198 {
199  theSTAMuonTag = pset.getParameter<edm::InputTag>("StandAloneTrackCollectionTag");
200  theGLBMuonTag = pset.getParameter<edm::InputTag>("GlobalMuonTrackCollectionTag");
201 
202  theRecHits4DTagDT = pset.getParameter<edm::InputTag>("RecHits4DDTCollectionTag");
203  theRecHits4DTagCSC = pset.getParameter<edm::InputTag>("RecHits4DCSCCollectionTag");
204 
205  theDataType = pset.getUntrackedParameter<std::string>("DataType");
206  ptRangeMin = pset.getUntrackedParameter<double>("ptRangeMin");
207  ptRangeMax = pset.getUntrackedParameter<double>("ptRangeMax");
208  invMassRangeMin = pset.getUntrackedParameter<double>("invMassRangeMin");
209  invMassRangeMax = pset.getUntrackedParameter<double>("invMassRangeMax");
210 
211  doSAplots = pset.getUntrackedParameter<bool>("doSAplots");
212  doGBplots = pset.getUntrackedParameter<bool>("doGBplots");
213  doResplots = pset.getUntrackedParameter<bool>("doResplots");
214 
215  resLocalXRangeStation1 = pset.getUntrackedParameter<double>("resLocalXRangeStation1");
216  resLocalXRangeStation2 = pset.getUntrackedParameter<double>("resLocalXRangeStation2");
217  resLocalXRangeStation3 = pset.getUntrackedParameter<double>("resLocalXRangeStation3");
218  resLocalXRangeStation4 = pset.getUntrackedParameter<double>("resLocalXRangeStation4");
219  resLocalYRangeStation1 = pset.getUntrackedParameter<double>("resLocalYRangeStation1");
220  resLocalYRangeStation2 = pset.getUntrackedParameter<double>("resLocalYRangeStation2");
221  resLocalYRangeStation3 = pset.getUntrackedParameter<double>("resLocalYRangeStation3");
222  resLocalYRangeStation4 = pset.getUntrackedParameter<double>("resLocalYRangeStation4");
223  resPhiRange = pset.getUntrackedParameter<double>("resPhiRange");
224  resThetaRange = pset.getUntrackedParameter<double>("resThetaRange");
225  nbins = pset.getUntrackedParameter<unsigned int>("nbins");
226  min1DTrackRecHitSize = pset.getUntrackedParameter<unsigned int>("min1DTrackRecHitSize");
227  min4DTrackSegmentSize = pset.getUntrackedParameter<unsigned int>("min4DTrackSegmentSize");
228 
229  if(theDataType != "RealData" && theDataType != "SimData")
230  edm::LogError("MuonAlignmentAnalyzer") << "Error in Data Type!!"<<std::endl;
231 
235  numberOfHits=0;
236 }
237 
240 }
241 
243 
244 // eventSetup.get<IdealMagneticFieldRecord>().get(theMGField);
245 
246  //Create the propagator
247 // if(doResplots) thePropagator = new SteppingHelixPropagator(&*theMGField, alongMomentum);
248 
249  int nBinsPt= (int) fabs(ptRangeMax-ptRangeMin);
250  int nBinsMass= (int) fabs(invMassRangeMax-invMassRangeMin);
251 
252 // Define and book histograms for SA and GB muon quantities/objects
253 
254  if(doGBplots) {
255  hGBNmuons = fs->make<TH1F>("GBNmuons","Nmuons",10,0,10);
256  hGBNmuons_Barrel = fs->make<TH1F>("GBNmuons_Barrel","Nmuons",10,0,10);
257  hGBNmuons_Endcap = fs->make<TH1F>("GBNmuons_Endcap","Nmuons",10,0,10);
258  hGBNhits = fs->make<TH1F>("GBNhits","Nhits",100,0,100);
259  hGBNhits_Barrel = fs->make<TH1F>("GBNhits_Barrel","Nhits",100,0,100);
260  hGBNhits_Endcap = fs->make<TH1F>("GBNhits_Endcap","Nhits",100,0,100);
261  hGBPTRec = fs->make<TH1F>("GBpTRec","p_{T}^{rec}",nBinsPt,ptRangeMin,ptRangeMax);
262  hGBPTRec_Barrel = fs->make<TH1F>("GBpTRec_Barrel","p_{T}^{rec}",nBinsPt,ptRangeMin,ptRangeMax);
263  hGBPTRec_Endcap = fs->make<TH1F>("GBpTRec_Endcap","p_{T}^{rec}",nBinsPt,ptRangeMin,ptRangeMax);
264  hGBPTvsEta = fs->make<TH2F> ("GBPTvsEta","p_{T}^{rec} VS #eta",100,-2.5,2.5,nBinsPt,ptRangeMin,ptRangeMax);
265  hGBPTvsPhi = fs->make<TH2F> ("GBPTvsPhi","p_{T}^{rec} VS #phi",100,-3.1416,3.1416,nBinsPt,ptRangeMin,ptRangeMax);
266  hGBPhivsEta = fs->make<TH2F> ("GBPhivsEta","#phi VS #eta",100,-2.5,2.5,100,-3.1416,3.1416);
267 
268  if(theDataType == "SimData"){
269  hGBPTDiff = fs->make<TH1F>("GBpTDiff","p_{T}^{rec} - p_{T}^{gen} ",250,-120,120);
270  hGBPTDiffvsEta = fs->make<TH2F> ("GBPTDiffvsEta","p_{T}^{rec} - p_{T}^{gen} VS #eta",100,-2.5,2.5,250,-120,120);
271  hGBPTDiffvsPhi = fs->make<TH2F> ("GBPTDiffvsPhi","p_{T}^{rec} - p_{T}^{gen} VS #phi",100,-3.1416,3.1416,250,-120,120);
272  hGBPTres = fs->make<TH1F>("GBpTRes","pT Resolution",100,-2,2);
273  hGBPTres_Barrel = fs->make<TH1F>("GBpTRes_Barrel","pT Resolution",100,-2,2);
274  hGBPTres_Endcap = fs->make<TH1F>("GBpTRes_Endcap","pT Resolution",100,-2,2);
275  hGBinvPTres = fs->make<TH1F>("GBinvPTRes","#sigma (q/p_{T}) Resolution",100,-2,2);
276  hGBinvPTvsEta = fs->make<TH2F> ("GBinvPTvsEta","#sigma (q/p_{T}) VS #eta",100,-2.5,2.5,100,-2,2);
277  hGBinvPTvsPhi = fs->make<TH2F> ("GBinvPTvsPhi","#sigma (q/p_{T}) VS #phi",100,-3.1416,3.1416,100,-2,2);
278  hGBinvPTvsNhits = fs->make<TH2F> ("GBinvPTvsNhits","#sigma (q/p_{T}) VS Nhits",100,0,100,100,-2,2);
279  }
280 
281  hGBChi2 = fs->make<TH1F>("GBChi2","Chi2",200,0,200);
282  hGBChi2_Barrel = fs->make<TH1F>("GBChi2_Barrel","Chi2",200,0,200);
283  hGBChi2_Endcap = fs->make<TH1F>("GBChi2_Endcap ","Chi2",200,0,200);
284  hGBInvM = fs->make<TH1F>("GBInvM","M_{inv}^{rec}",nBinsMass,invMassRangeMin,invMassRangeMax);
285  hGBInvM_Barrel = fs->make<TH1F>("GBInvM_Barrel","M_{inv}^{rec}",nBinsMass,invMassRangeMin,invMassRangeMax);
286  hGBInvM_Endcap = fs->make<TH1F>("GBInvM_Endcap ","M_{inv}^{rec}",nBinsMass,invMassRangeMin,invMassRangeMax);
287  hGBInvM_Overlap = fs->make<TH1F>("GBInvM_Overlap","M_{inv}^{rec}",nBinsMass,invMassRangeMin,invMassRangeMax);
288  }
289 
290 
291  if(doSAplots) {
292  hSANmuons = fs->make<TH1F>("SANmuons","Nmuons",10,0,10);
293  hSANmuons_Barrel = fs->make<TH1F>("SANmuons_Barrel","Nmuons",10,0,10);
294  hSANmuons_Endcap = fs->make<TH1F>("SANmuons_Endcap","Nmuons",10,0,10);
295  hSANhits = fs->make<TH1F>("SANhits","Nhits",100,0,100);
296  hSANhits_Barrel = fs->make<TH1F>("SANhits_Barrel","Nhits",100,0,100);
297  hSANhits_Endcap = fs->make<TH1F>("SANhits_Endcap","Nhits",100,0,100);
298  hSAPTRec = fs->make<TH1F>("SApTRec","p_{T}^{rec}",nBinsPt,ptRangeMin,ptRangeMax);
299  hSAPTRec_Barrel = fs->make<TH1F>("SApTRec_Barrel","p_{T}^{rec}",nBinsPt,ptRangeMin,ptRangeMax);
300  hSAPTRec_Endcap = fs->make<TH1F>("SApTRec_Endcap","p_{T}^{rec}",nBinsPt,ptRangeMin,ptRangeMax);
301  hSAPTvsEta = fs->make<TH2F> ("SAPTvsEta","p_{T}^{rec} VS #eta",100,-2.5,2.5,nBinsPt,ptRangeMin,ptRangeMax);
302  hSAPTvsPhi = fs->make<TH2F> ("SAPTvsPhi","p_{T}^{rec} VS #phi",100,-3.1416,3.1416,nBinsPt,ptRangeMin,ptRangeMax);
303  hSAPhivsEta = fs->make<TH2F> ("SAPhivsEta","#phi VS #eta",100,-2.5,2.5,100,-3.1416,3.1416);
304 
305  if(theDataType == "SimData"){
306  hSAPTDiff = fs->make<TH1F>("SApTDiff","p_{T}^{rec} - p_{T}^{gen} ",250,-120,120);
307  hSAPTDiffvsEta = fs->make<TH2F> ("SAPTDiffvsEta","p_{T}^{rec} - p_{T}^{gen} VS #eta",100,-2.5,2.5,250,-120,120);
308  hSAPTDiffvsPhi = fs->make<TH2F> ("SAPTDiffvsPhi","p_{T}^{rec} - p_{T}^{gen} VS #phi",100,-3.1416,3.1416,250,-120,120);
309  hSAPTres = fs->make<TH1F>("SApTRes","pT Resolution",100,-2,2);
310  hSAPTres_Barrel = fs->make<TH1F>("SApTRes_Barrel","pT Resolution",100,-2,2);
311  hSAPTres_Endcap = fs->make<TH1F>("SApTRes_Endcap","pT Resolution",100,-2,2);
312  hSAinvPTres = fs->make<TH1F>("SAinvPTRes","1/pT Resolution",100,-2,2);
313 
314  hSAinvPTvsEta = fs->make<TH2F> ("SAinvPTvsEta","#sigma (q/p_{T}) VS #eta",100,-2.5,2.5,100,-2,2);
315  hSAinvPTvsPhi = fs->make<TH2F> ("SAinvPTvsPhi","#sigma (q/p_{T}) VS #phi",100,-3.1416,3.1416,100,-2,2);
316  hSAinvPTvsNhits = fs->make<TH2F> ("SAinvPTvsNhits","#sigma (q/p_{T}) VS Nhits",100,0,100,100,-2,2);
317  }
318  hSAInvM = fs->make<TH1F>("SAInvM","M_{inv}^{rec}",nBinsMass,invMassRangeMin,invMassRangeMax);
319  hSAInvM_Barrel = fs->make<TH1F>("SAInvM_Barrel","M_{inv}^{rec}",nBinsMass,invMassRangeMin,invMassRangeMax);
320  hSAInvM_Endcap = fs->make<TH1F>("SAInvM_Endcap","M_{inv}^{rec}",nBinsMass,invMassRangeMin,invMassRangeMax);
321  hSAInvM_Overlap = fs->make<TH1F>("SAInvM_Overlap","M_{inv}^{rec}",nBinsMass,invMassRangeMin,invMassRangeMax);
322  hSAChi2 = fs->make<TH1F>("SAChi2","Chi2",200,0,200);
323  hSAChi2_Barrel = fs->make<TH1F>("SAChi2_Barrel","Chi2",200,0,200);
324  hSAChi2_Endcap = fs->make<TH1F>("SAChi2_Endcap","Chi2",200,0,200);
325  }
326 
327 
328  if(theDataType == "SimData"){
329  hSimNmuons = fs->make<TH1F>("SimNmuons","Nmuons",10,0,10);
330  hSimNmuons_Barrel = fs->make<TH1F>("SimNmuons_Barrel","Nmuons",10,0,10);
331  hSimNmuons_Endcap = fs->make<TH1F>("SimNmuons_Endcap","Nmuons",10,0,10);
332  hSimPT = fs->make<TH1F>("SimPT","p_{T}^{gen} ",nBinsPt,ptRangeMin,ptRangeMax);
333  hSimPT_Barrel = fs->make<TH1F>("SimPT_Barrel","p_{T}^{gen} ",nBinsPt,ptRangeMin,ptRangeMax);
334  hSimPT_Endcap = fs->make<TH1F>("SimPT_Endcap","p_{T}^{gen} ",nBinsPt,ptRangeMin,ptRangeMax);
335  hSimPTvsEta = fs->make<TH2F> ("SimPTvsEta","p_{T}^{gen} VS #eta",100,-2.5,2.5,nBinsPt,ptRangeMin,ptRangeMax);
336  hSimPTvsPhi = fs->make<TH2F> ("SimPTvsPhi","p_{T}^{gen} VS #phi",100,-3.1416,3.1416,nBinsPt,ptRangeMin,ptRangeMax);
337  hSimPhivsEta = fs->make<TH2F> ("SimPhivsEta","#phi VS #eta",100,-2.5,2.5,100,-3.1416,3.1416);
338  hSimInvM = fs->make<TH1F>("SimInvM","M_{inv}^{gen} ",nBinsMass,invMassRangeMin,invMassRangeMax);
339  hSimInvM_Barrel = fs->make<TH1F>("SimInvM_Barrel","M_{inv}^{rec}",nBinsMass,invMassRangeMin,invMassRangeMax);
340  hSimInvM_Endcap = fs->make<TH1F>("SimInvM_Endcap","M_{inv}^{gen} ",nBinsMass,invMassRangeMin,invMassRangeMax);
341  hSimInvM_Overlap = fs->make<TH1F>("SimInvM_Overlap","M_{inv}^{gen} ",nBinsMass,invMassRangeMin,invMassRangeMax);
342  }
343 
344  if(doResplots){
345 // All DT and CSC chambers
346  hResidualLocalXDT = fs->make<TH1F>("hResidualLocalXDT","hResidualLocalXDT",200,-10,10);
347  hResidualLocalPhiDT = fs->make<TH1F>("hResidualLocalPhiDT","hResidualLocalPhiDT",100,-1,1);
348  hResidualLocalThetaDT = fs->make<TH1F>("hResidualLocalThetaDT","hResidualLocalThetaDT",100,-1,1);
349  hResidualLocalYDT = fs->make<TH1F>("hResidualLocalYDT","hResidualLocalYDT",200,-10,10);
350  hResidualLocalXCSC = fs->make<TH1F>("hResidualLocalXCSC","hResidualLocalXCSC",200,-10,10);
351  hResidualLocalPhiCSC = fs->make<TH1F>("hResidualLocalPhiCSC","hResidualLocalPhiCSC",100,-1,1);
352  hResidualLocalThetaCSC = fs->make<TH1F>("hResidualLocalThetaCSC","hResidualLocalThetaCSC",100,-1,1);
353  hResidualLocalYCSC = fs->make<TH1F>("hResidualLocalYCSC","hResidualLocalYCSC",200,-10,10);
354  hResidualGlobalRPhiDT = fs->make<TH1F>("hResidualGlobalRPhiDT","hResidualGlobalRPhiDT",200,-10,10);
355  hResidualGlobalPhiDT = fs->make<TH1F>("hResidualGlobalPhiDT","hResidualGlobalPhiDT",100,-1,1);
356  hResidualGlobalThetaDT = fs->make<TH1F>("hResidualGlobalThetaDT","hResidualGlobalThetaDT",100,-1,1);
357  hResidualGlobalZDT = fs->make<TH1F>("hResidualGlobalZDT","hResidualGlobalZDT",200,-10,10);
358  hResidualGlobalRPhiCSC = fs->make<TH1F>("hResidualGlobalRPhiCSC","hResidualGlobalRPhiCSC",200,-10,10);
359  hResidualGlobalPhiCSC = fs->make<TH1F>("hResidualGlobalPhiCSC","hResidualGlobalPhiCSC",100,-1,1);
360  hResidualGlobalThetaCSC = fs->make<TH1F>("hResidualGlobalThetaCSC","hResidualGlobalThetaCSC",100,-1,1);
361  hResidualGlobalRCSC = fs->make<TH1F>("hResidualGlobalRCSC","hResidualGlobalRCSC",200,-10,10);
362 
363 // DT Wheels
364  hResidualLocalXDT_W[0]=fs->make<TH1F>("hResidualLocalXDT_W-2","hResidualLocalXDT_W-2",200,-10,10);
365  hResidualLocalPhiDT_W[0]=fs->make<TH1F>("hResidualLocalPhiDT_W-2","hResidualLocalPhiDT_W-2",200,-1,1);
366  hResidualLocalThetaDT_W[0]=fs->make<TH1F>("hResidualLocalThetaDT_W-2","hResidualLocalThetaDT_W-2",200,-1,1);
367  hResidualLocalYDT_W[0] = fs->make<TH1F>("hResidualLocalYDT_W-2","hResidualLocalYDT_W-2",200,-10,10);
368  hResidualLocalXDT_W[1]=fs->make<TH1F>("hResidualLocalXDT_W-1","hResidualLocalXDT_W-1",200,-10,10);
369  hResidualLocalPhiDT_W[1]=fs->make<TH1F>("hResidualLocalPhiDT_W-1","hResidualLocalPhiDT_W-1",200,-1,1);
370  hResidualLocalThetaDT_W[1]=fs->make<TH1F>("hResidualLocalThetaDT_W-1","hResidualLocalThetaDT_W-1",200,-1,1);
371  hResidualLocalYDT_W[1] = fs->make<TH1F>("hResidualLocalYDT_W-1","hResidualLocalYDT_W-1",200,-10,10);
372  hResidualLocalXDT_W[2]=fs->make<TH1F>("hResidualLocalXDT_W0","hResidualLocalXDT_W0",200,-10,10);
373  hResidualLocalPhiDT_W[2]=fs->make<TH1F>("hResidualLocalPhiDT_W0","hResidualLocalPhiDT_W0",200,-1,1);
374  hResidualLocalThetaDT_W[2]=fs->make<TH1F>("hResidualLocalThetaDT_W0","hResidualLocalThetaDT_W0",200,-1,1);
375  hResidualLocalYDT_W[2] = fs->make<TH1F>("hResidualLocalYDT_W0","hResidualLocalYDT_W0",200,-10,10);
376  hResidualLocalXDT_W[3]=fs->make<TH1F>("hResidualLocalXDT_W1","hResidualLocalXDT_W1",200,-10,10);
377  hResidualLocalPhiDT_W[3]=fs->make<TH1F>("hResidualLocalPhiDT_W1","hResidualLocalPhiDT_W1",200,-1,1);
378  hResidualLocalThetaDT_W[3]=fs->make<TH1F>("hResidualLocalThetaDT_W1","hResidualLocalThetaDT_W1",200,-1,1);
379  hResidualLocalYDT_W[3] = fs->make<TH1F>("hResidualLocalYDT_W1","hResidualLocalYDT_W1",200,-10,10);
380  hResidualLocalXDT_W[4]=fs->make<TH1F>("hResidualLocalXDT_W2","hResidualLocalXDT_W2",200,-10,10);
381  hResidualLocalPhiDT_W[4]=fs->make<TH1F>("hResidualLocalPhiDT_W2","hResidualLocalPhiDT_W2",200,-1,1);
382  hResidualLocalThetaDT_W[4]=fs->make<TH1F>("hResidualLocalThetaDT_W2","hResidualLocalThetaDT_W2",200,-1,1);
383  hResidualLocalYDT_W[4] = fs->make<TH1F>("hResidualLocalYDT_W2","hResidualLocalYDT_W2",200,-10,10);
384  hResidualGlobalRPhiDT_W[0]=fs->make<TH1F>("hResidualGlobalRPhiDT_W-2","hResidualGlobalRPhiDT_W-2",200,-10,10);
385  hResidualGlobalPhiDT_W[0]=fs->make<TH1F>("hResidualGlobalPhiDT_W-2","hResidualGlobalPhiDT_W-2",200,-1,1);
386  hResidualGlobalThetaDT_W[0]=fs->make<TH1F>("hResidualGlobalThetaDT_W-2","hResidualGlobalThetaDT_W-2",200,-1,1);
387  hResidualGlobalZDT_W[0] = fs->make<TH1F>("hResidualGlobalZDT_W-2","hResidualGlobalZDT_W-2",200,-10,10);
388  hResidualGlobalRPhiDT_W[1]=fs->make<TH1F>("hResidualGlobalRPhiDT_W-1","hResidualGlobalRPhiDT_W-1",200,-10,10);
389  hResidualGlobalPhiDT_W[1]=fs->make<TH1F>("hResidualGlobalPhiDT_W-1","hResidualGlobalPhiDT_W-1",200,-1,1);
390  hResidualGlobalThetaDT_W[1]=fs->make<TH1F>("hResidualGlobalThetaDT_W-1","hResidualGlobalThetaDT_W-1",200,-1,1);
391  hResidualGlobalZDT_W[1] = fs->make<TH1F>("hResidualGlobalZDT_W-1","hResidualGlobalZDT_W-1",200,-10,10);
392  hResidualGlobalRPhiDT_W[2]=fs->make<TH1F>("hResidualGlobalRPhiDT_W0","hResidualGlobalRPhiDT_W0",200,-10,10);
393  hResidualGlobalPhiDT_W[2]=fs->make<TH1F>("hResidualGlobalPhiDT_W0","hResidualGlobalPhiDT_W0",200,-1,1);
394  hResidualGlobalThetaDT_W[2]=fs->make<TH1F>("hResidualGlobalThetaDT_W0","hResidualGlobalThetaDT_W0",200,-1,1);
395  hResidualGlobalZDT_W[2] = fs->make<TH1F>("hResidualGlobalZDT_W0","hResidualGlobalZDT_W0",200,-10,10);
396  hResidualGlobalRPhiDT_W[3]=fs->make<TH1F>("hResidualGlobalRPhiDT_W1","hResidualGlobalRPhiDT_W1",200,-10,10);
397  hResidualGlobalPhiDT_W[3]=fs->make<TH1F>("hResidualGlobalPhiDT_W1","hResidualGlobalPhiDT_W1",200,-1,1);
398  hResidualGlobalThetaDT_W[3]=fs->make<TH1F>("hResidualGlobalThetaDT_W1","hResidualGlobalThetaDT_W1",200,-1,1);
399  hResidualGlobalZDT_W[3] = fs->make<TH1F>("hResidualGlobalZDT_W1","hResidualGlobalZDT_W1",200,-10,10);
400  hResidualGlobalRPhiDT_W[4]=fs->make<TH1F>("hResidualGlobalRPhiDT_W2","hResidualGlobalRPhiDT_W2",200,-10,10);
401  hResidualGlobalPhiDT_W[4]=fs->make<TH1F>("hResidualGlobalPhiDT_W2","hResidualGlobalPhiDT_W2",200,-1,1);
402  hResidualGlobalThetaDT_W[4]=fs->make<TH1F>("hResidualGlobalThetaDT_W2","hResidualGlobalThetaDT_W2",200,-1,1);
403  hResidualGlobalZDT_W[4] = fs->make<TH1F>("hResidualGlobalZDT_W2","hResidualGlobalZDT_W2",200,-10,10);
404 
405 // DT Stations
406  hResidualLocalXDT_MB[0]=fs->make<TH1F>("hResidualLocalXDT_MB-2/1","hResidualLocalXDT_MB-2/1",200,-10,10);
407  hResidualLocalPhiDT_MB[0]=fs->make<TH1F>("hResidualLocalPhiDT_MB-2/1","hResidualLocalPhiDT_MB-2/1",200,-1,1);
408  hResidualLocalThetaDT_MB[0]=fs->make<TH1F>("hResidualLocalThetaDT_MB-2/1","hResidualLocalThetaDT_MB-2/1",200,-1,1);
409  hResidualLocalYDT_MB[0] = fs->make<TH1F>("hResidualLocalYDT_MB-2/1","hResidualLocalYDT_MB-2/1",200,-10,10);
410  hResidualLocalXDT_MB[1]=fs->make<TH1F>("hResidualLocalXDT_MB-2/2","hResidualLocalXDT_MB-2/2",200,-10,10);
411  hResidualLocalPhiDT_MB[1]=fs->make<TH1F>("hResidualLocalPhiDT_MB-2/2","hResidualLocalPhiDT_MB-2/2",200,-1,1);
412  hResidualLocalThetaDT_MB[1]=fs->make<TH1F>("hResidualLocalThetaDT_MB-2/2","hResidualLocalThetaDT_MB-2/2",200,-1,1);
413  hResidualLocalYDT_MB[1] = fs->make<TH1F>("hResidualLocalYDT_MB-2/2","hResidualLocalYDT_MB-2/2",200,-10,10);
414  hResidualLocalXDT_MB[2]=fs->make<TH1F>("hResidualLocalXDT_MB-2/3","hResidualLocalXDT_MB-2/3",200,-10,10);
415  hResidualLocalPhiDT_MB[2]=fs->make<TH1F>("hResidualLocalPhiDT_MB-2/3","hResidualLocalPhiDT_MB-2/3",200,-1,1);
416  hResidualLocalThetaDT_MB[2]=fs->make<TH1F>("hResidualLocalThetaDT_MB-2/3","hResidualLocalThetaDT_MB-2/3",200,-1,1);
417  hResidualLocalYDT_MB[2] = fs->make<TH1F>("hResidualLocalYDT_MB-2/3","hResidualLocalYDT_MB-2/3",200,-10,10);
418  hResidualLocalXDT_MB[3]=fs->make<TH1F>("hResidualLocalXDT_MB-2/4","hResidualLocalXDT_MB-2/4",200,-10,10);
419  hResidualLocalPhiDT_MB[3]=fs->make<TH1F>("hResidualLocalPhiDT_MB-2/4","hResidualLocalPhiDT_MB-2/4",200,-1,1);
420  hResidualLocalThetaDT_MB[3]=fs->make<TH1F>("hResidualLocalThetaDT_MB-2/4","hResidualLocalThetaDT_MB-2/4",200,-1,1);
421  hResidualLocalYDT_MB[3] = fs->make<TH1F>("hResidualLocalYDT_MB-2/4","hResidualLocalYDT_MB-2/4",200,-10,10);
422  hResidualLocalXDT_MB[4]=fs->make<TH1F>("hResidualLocalXDT_MB-1/1","hResidualLocalXDT_MB-1/1",200,-10,10);
423  hResidualLocalPhiDT_MB[4]=fs->make<TH1F>("hResidualLocalPhiDT_MB-1/1","hResidualLocalPhiDT_MB-1/1",200,-1,1);
424  hResidualLocalThetaDT_MB[4]=fs->make<TH1F>("hResidualLocalThetaDT_MB-1/1","hResidualLocalThetaDT_MB-1/1",200,-1,1);
425  hResidualLocalYDT_MB[4] = fs->make<TH1F>("hResidualLocalYDT_MB-1/1","hResidualLocalYDT_MB-1/1",200,-10,10);
426  hResidualLocalXDT_MB[5]=fs->make<TH1F>("hResidualLocalXDT_MB-1/2","hResidualLocalXDT_MB-1/2",200,-10,10);
427  hResidualLocalPhiDT_MB[5]=fs->make<TH1F>("hResidualLocalPhiDT_MB-1/2","hResidualLocalPhiDT_MB-1/2",200,-1,1);
428  hResidualLocalThetaDT_MB[5]=fs->make<TH1F>("hResidualLocalThetaDT_MB-1/2","hResidualLocalThetaDT_MB-1/2",200,-1,1);
429  hResidualLocalYDT_MB[5] = fs->make<TH1F>("hResidualLocalYDT_MB-1/2","hResidualLocalYDT_MB-1/2",200,-10,10);
430  hResidualLocalXDT_MB[6]=fs->make<TH1F>("hResidualLocalXDT_MB-1/3","hResidualLocalXDT_MB-1/3",200,-10,10);
431  hResidualLocalPhiDT_MB[6]=fs->make<TH1F>("hResidualLocalPhiDT_MB-1/3","hResidualLocalPhiDT_MB-1/3",200,-1,1);
432  hResidualLocalThetaDT_MB[6]=fs->make<TH1F>("hResidualLocalThetaDT_MB-1/3","hResidualLocalThetaDT_MB-1/3",200,-1,1);
433  hResidualLocalYDT_MB[6] = fs->make<TH1F>("hResidualLocalYDT_MB-1/3","hResidualLocalYDT_MB-1/3",200,-10,10);
434  hResidualLocalXDT_MB[7]=fs->make<TH1F>("hResidualLocalXDT_MB-1/4","hResidualLocalXDT_MB-1/4",200,-10,10);
435  hResidualLocalPhiDT_MB[7]=fs->make<TH1F>("hResidualLocalPhiDT_MB-1/4","hResidualLocalPhiDT_MB-1/4",200,-1,1);
436  hResidualLocalThetaDT_MB[7]=fs->make<TH1F>("hResidualLocalThetaDT_MB-1/4","hResidualLocalThetaDT_MB-1/4",200,-1,1);
437  hResidualLocalYDT_MB[7] = fs->make<TH1F>("hResidualLocalYDT_MB-1/4","hResidualLocalYDT_MB-1/4",200,-10,10);
438  hResidualLocalXDT_MB[8]=fs->make<TH1F>("hResidualLocalXDT_MB0/1","hResidualLocalXDT_MB0/1",200,-10,10);
439  hResidualLocalPhiDT_MB[8]=fs->make<TH1F>("hResidualLocalPhiDT_MB0/1","hResidualLocalPhiDT_MB0/1",200,-1,1);
440  hResidualLocalThetaDT_MB[8]=fs->make<TH1F>("hResidualLocalThetaDT_MB0/1","hResidualLocalThetaDT_MB0/1",200,-1,1);
441  hResidualLocalYDT_MB[8] = fs->make<TH1F>("hResidualLocalYDT_MB0/1","hResidualLocalYDT_MB0/1",200,-10,10);
442  hResidualLocalXDT_MB[9]=fs->make<TH1F>("hResidualLocalXDT_MB0/2","hResidualLocalXDT_MB0/2",200,-10,10);
443  hResidualLocalPhiDT_MB[9]=fs->make<TH1F>("hResidualLocalPhiDT_MB0/2","hResidualLocalPhiDT_MB0/2",200,-1,1);
444  hResidualLocalThetaDT_MB[9]=fs->make<TH1F>("hResidualLocalThetaDT_MB0/2","hResidualLocalThetaDT_MB0/2",200,-1,1);
445  hResidualLocalYDT_MB[9] = fs->make<TH1F>("hResidualLocalYDT_MB0/2","hResidualLocalYDT_MB0/2",200,-10,10);
446  hResidualLocalXDT_MB[10]=fs->make<TH1F>("hResidualLocalXDT_MB0/3","hResidualLocalXDT_MB0/3",200,-10,10);
447  hResidualLocalThetaDT_MB[10]=fs->make<TH1F>("hResidualLocalThetaDT_MB0/3","hResidualLocalThetaDT_MB0/3",200,-1,1);
448  hResidualLocalPhiDT_MB[10]=fs->make<TH1F>("hResidualLocalPhiDT_MB0/3","hResidualLocalPhiDT_MB0/3",200,-1,1);
449  hResidualLocalYDT_MB[10] = fs->make<TH1F>("hResidualLocalYDT_MB0/3","hResidualLocalYDT_MB0/3",200,-10,10);
450  hResidualLocalXDT_MB[11]=fs->make<TH1F>("hResidualLocalXDT_MB0/4","hResidualLocalXDT_MB0/4",200,-10,10);
451  hResidualLocalPhiDT_MB[11]=fs->make<TH1F>("hResidualLocalPhiDT_MB0/4","hResidualLocalPhiDT_MB0/4",200,-1,1);
452  hResidualLocalThetaDT_MB[11]=fs->make<TH1F>("hResidualLocalThetaDT_MB0/4","hResidualLocalThetaDT_MB0/4",200,-1,1);
453  hResidualLocalYDT_MB[11] = fs->make<TH1F>("hResidualLocalYDT_MB0/4","hResidualLocalYDT_MB0/4",200,-10,10);
454  hResidualLocalXDT_MB[12]=fs->make<TH1F>("hResidualLocalXDT_MB1/1","hResidualLocalXDT_MB1/1",200,-10,10);
455  hResidualLocalPhiDT_MB[12]=fs->make<TH1F>("hResidualLocalPhiDT_MB1/1","hResidualLocalPhiDT_MB1/1",200,-1,1);
456  hResidualLocalThetaDT_MB[12]=fs->make<TH1F>("hResidualLocalThetaDT_MB1/1","hResidualLocalThetaDT_MB1/1",200,-1,1);
457  hResidualLocalYDT_MB[12] = fs->make<TH1F>("hResidualLocalYDT_MB1/1","hResidualLocalYDT_MB1/1",200,-10,10);
458  hResidualLocalXDT_MB[13]=fs->make<TH1F>("hResidualLocalXDT_MB1/2","hResidualLocalXDT_MB1/2",200,-10,10);
459  hResidualLocalPhiDT_MB[13]=fs->make<TH1F>("hResidualLocalPhiDT_MB1/2","hResidualLocalPhiDT_MB1/2",200,-1,1);
460  hResidualLocalThetaDT_MB[13]=fs->make<TH1F>("hResidualLocalThetaDT_MB1/2","hResidualLocalThetaDT_MB1/2",200,-1,1);
461  hResidualLocalYDT_MB[13] = fs->make<TH1F>("hResidualLocalYDT_MB1/2","hResidualLocalYDT_MB1/2",200,-10,10);
462  hResidualLocalXDT_MB[14]=fs->make<TH1F>("hResidualLocalXDT_MB1/3","hResidualLocalXDT_MB1/3",200,-10,10);
463  hResidualLocalPhiDT_MB[14]=fs->make<TH1F>("hResidualLocalPhiDT_MB1/3","hResidualLocalPhiDT_MB1/3",200,-1,1);
464  hResidualLocalThetaDT_MB[14]=fs->make<TH1F>("hResidualLocalThetaDT_MB1/3","hResidualLocalThetaDT_MB1/3",200,-1,1);
465  hResidualLocalYDT_MB[14] = fs->make<TH1F>("hResidualLocalYDT_MB1/3","hResidualLocalYDT_MB1/3",200,-10,10);
466  hResidualLocalXDT_MB[15]=fs->make<TH1F>("hResidualLocalXDT_MB1/4","hResidualLocalXDT_MB1/4",200,-10,10);
467  hResidualLocalPhiDT_MB[15]=fs->make<TH1F>("hResidualLocalPhiDT_MB1/4","hResidualLocalPhiDT_MB1/4",200,-1,1);
468  hResidualLocalThetaDT_MB[15]=fs->make<TH1F>("hResidualLocalThetaDT_MB1/4","hResidualLocalThetaDT_MB1/4",200,-1,1);
469  hResidualLocalYDT_MB[15] = fs->make<TH1F>("hResidualLocalYDT_MB1/4","hResidualLocalYDT_MB1/4",200,-10,10);
470  hResidualLocalXDT_MB[16]=fs->make<TH1F>("hResidualLocalXDT_MB2/1","hResidualLocalXDT_MB2/1",200,-10,10);
471  hResidualLocalPhiDT_MB[16]=fs->make<TH1F>("hResidualLocalPhiDT_MB2/1","hResidualLocalPhiDT_MB2/1",200,-1,1);
472  hResidualLocalThetaDT_MB[16]=fs->make<TH1F>("hResidualLocalThetaDT_MB2/1","hResidualLocalThetaDT_MB2/1",200,-1,1);
473  hResidualLocalYDT_MB[16] = fs->make<TH1F>("hResidualLocalYDT_MB2/1","hResidualLocalYDT_MB2/1",200,-10,10);
474  hResidualLocalXDT_MB[17]=fs->make<TH1F>("hResidualLocalXDT_MB2/2","hResidualLocalXDT_MB2/2",200,-10,10);
475  hResidualLocalPhiDT_MB[17]=fs->make<TH1F>("hResidualLocalPhiDT_MB2/2","hResidualLocalPhiDT_MB2/2",200,-1,1);
476  hResidualLocalThetaDT_MB[17]=fs->make<TH1F>("hResidualLocalThetaDT_MB2/2","hResidualLocalThetaDT_MB2/2",200,-1,1);
477  hResidualLocalYDT_MB[17] = fs->make<TH1F>("hResidualLocalYDT_MB2/2","hResidualLocalYDT_MB2/2",200,-10,10);
478  hResidualLocalXDT_MB[18]=fs->make<TH1F>("hResidualLocalXDT_MB2/3","hResidualLocalXDT_MB2/3",200,-10,10);
479  hResidualLocalPhiDT_MB[18]=fs->make<TH1F>("hResidualLocalPhiDT_MB2/3","hResidualLocalPhiDT_MB2/3",200,-1,1);
480  hResidualLocalThetaDT_MB[18]=fs->make<TH1F>("hResidualLocalThetaDT_MB2/3","hResidualLocalThetaDT_MB2/3",200,-1,1);
481  hResidualLocalYDT_MB[18] = fs->make<TH1F>("hResidualLocalYDT_MB2/3","hResidualLocalYDT_MB2/3",200,-10,10);
482  hResidualLocalXDT_MB[19]=fs->make<TH1F>("hResidualLocalXDT_MB2/4","hResidualLocalXDT_MB2/4",200,-10,10);
483  hResidualLocalPhiDT_MB[19]=fs->make<TH1F>("hResidualLocalPhiDT_MB2/4","hResidualLocalPhiDT_MB2/4",200,-1,1);
484  hResidualLocalThetaDT_MB[19]=fs->make<TH1F>("hResidualLocalThetaDT_MB2/4","hResidualLocalThetaDT_MB2/4",200,-1,1);
485  hResidualLocalYDT_MB[19] = fs->make<TH1F>("hResidualLocalYDT_MB2/4","hResidualLocalYDT_MB2/4",200,-10,10);
486  hResidualGlobalRPhiDT_MB[0]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB-2/1","hResidualGlobalRPhiDT_MB-2/1",200,-10,10);
487  hResidualGlobalPhiDT_MB[0]=fs->make<TH1F>("hResidualGlobalPhiDT_MB-2/1","hResidualGlobalPhiDT_MB-2/1",200,-1,1);
488  hResidualGlobalThetaDT_MB[0]=fs->make<TH1F>("hResidualGlobalThetaDT_MB-2/1","hResidualGlobalThetaDT_MB-2/1",200,-1,1);
489  hResidualGlobalZDT_MB[0] = fs->make<TH1F>("hResidualGlobalZDT_MB-2/1","hResidualGlobalZDT_MB-2/1",200,-10,10);
490  hResidualGlobalRPhiDT_MB[1]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB-2/2","hResidualGlobalRPhiDT_MB-2/2",200,-10,10);
491  hResidualGlobalPhiDT_MB[1]=fs->make<TH1F>("hResidualGlobalPhiDT_MB-2/2","hResidualGlobalPhiDT_MB-2/2",200,-1,1);
492  hResidualGlobalThetaDT_MB[1]=fs->make<TH1F>("hResidualGlobalThetaDT_MB-2/2","hResidualGlobalThetaDT_MB-2/2",200,-1,1);
493  hResidualGlobalZDT_MB[1] = fs->make<TH1F>("hResidualGlobalZDT_MB-2/2","hResidualGlobalZDT_MB-2/2",200,-10,10);
494  hResidualGlobalRPhiDT_MB[2]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB-2/3","hResidualGlobalRPhiDT_MB-2/3",200,-10,10);
495  hResidualGlobalPhiDT_MB[2]=fs->make<TH1F>("hResidualGlobalPhiDT_MB-2/3","hResidualGlobalPhiDT_MB-2/3",200,-1,1);
496  hResidualGlobalThetaDT_MB[2]=fs->make<TH1F>("hResidualGlobalThetaDT_MB-2/3","hResidualGlobalThetaDT_MB-2/3",200,-1,1);
497  hResidualGlobalZDT_MB[2] = fs->make<TH1F>("hResidualGlobalZDT_MB-2/3","hResidualGlobalZDT_MB-2/3",200,-10,10);
498  hResidualGlobalRPhiDT_MB[3]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB-2/4","hResidualGlobalRPhiDT_MB-2/4",200,-10,10);
499  hResidualGlobalPhiDT_MB[3]=fs->make<TH1F>("hResidualGlobalPhiDT_MB-2/4","hResidualGlobalPhiDT_MB-2/4",200,-1,1);
500  hResidualGlobalThetaDT_MB[3]=fs->make<TH1F>("hResidualGlobalThetaDT_MB-2/4","hResidualGlobalThetaDT_MB-2/4",200,-1,1);
501  hResidualGlobalZDT_MB[3] = fs->make<TH1F>("hResidualGlobalZDT_MB-2/4","hResidualGlobalZDT_MB-2/4",200,-10,10);
502  hResidualGlobalRPhiDT_MB[4]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB-1/1","hResidualGlobalRPhiDT_MB-1/1",200,-10,10);
503  hResidualGlobalPhiDT_MB[4]=fs->make<TH1F>("hResidualGlobalPhiDT_MB-1/1","hResidualGlobalPhiDT_MB-1/1",200,-1,1);
504  hResidualGlobalThetaDT_MB[4]=fs->make<TH1F>("hResidualGlobalThetaDT_MB-1/1","hResidualGlobalThetaDT_MB-1/1",200,-1,1);
505  hResidualGlobalZDT_MB[4] = fs->make<TH1F>("hResidualGlobalZDT_MB-1/1","hResidualGlobalZDT_MB-1/1",200,-10,10);
506  hResidualGlobalRPhiDT_MB[5]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB-1/2","hResidualGlobalRPhiDT_MB-1/2",200,-10,10);
507  hResidualGlobalPhiDT_MB[5]=fs->make<TH1F>("hResidualGlobalPhiDT_MB-1/2","hResidualGlobalPhiDT_MB-1/2",200,-1,1);
508  hResidualGlobalThetaDT_MB[5]=fs->make<TH1F>("hResidualGlobalThetaDT_MB-1/2","hResidualGlobalThetaDT_MB-1/2",200,-1,1);
509  hResidualGlobalZDT_MB[5] = fs->make<TH1F>("hResidualGlobalZDT_MB-1/2","hResidualGlobalZDT_MB-1/2",200,-10,10);
510  hResidualGlobalRPhiDT_MB[6]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB-1/3","hResidualGlobalRPhiDT_MB-1/3",200,-10,10);
511  hResidualGlobalPhiDT_MB[6]=fs->make<TH1F>("hResidualGlobalPhiDT_MB-1/3","hResidualGlobalPhiDT_MB-1/3",200,-1,1);
512  hResidualGlobalThetaDT_MB[6]=fs->make<TH1F>("hResidualGlobalThetaDT_MB-1/3","hResidualGlobalThetaDT_MB-1/3",200,-1,1);
513  hResidualGlobalZDT_MB[6] = fs->make<TH1F>("hResidualGlobalZDT_MB-1/3","hResidualGlobalZDT_MB-1/3",200,-10,10);
514  hResidualGlobalRPhiDT_MB[7]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB-1/4","hResidualGlobalRPhiDT_MB-1/4",200,-10,10);
515  hResidualGlobalPhiDT_MB[7]=fs->make<TH1F>("hResidualGlobalPhiDT_MB-1/4","hResidualGlobalPhiDT_MB-1/4",200,-1,1);
516  hResidualGlobalThetaDT_MB[7]=fs->make<TH1F>("hResidualGlobalThetaDT_MB-1/4","hResidualGlobalThetaDT_MB-1/4",200,-1,1);
517  hResidualGlobalZDT_MB[7] = fs->make<TH1F>("hResidualGlobalZDT_MB-1/4","hResidualGlobalZDT_MB-1/4",200,-10,10);
518  hResidualGlobalRPhiDT_MB[8]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB0/1","hResidualGlobalRPhiDT_MB0/1",200,-10,10);
519  hResidualGlobalPhiDT_MB[8]=fs->make<TH1F>("hResidualGlobalPhiDT_MB0/1","hResidualGlobalPhiDT_MB0/1",200,-1,1);
520  hResidualGlobalThetaDT_MB[8]=fs->make<TH1F>("hResidualGlobalThetaDT_MB0/1","hResidualGlobalThetaDT_MB0/1",200,-1,1);
521  hResidualGlobalZDT_MB[8] = fs->make<TH1F>("hResidualGlobalZDT_MB0/1","hResidualGlobalZDT_MB0/1",200,-10,10);
522  hResidualGlobalRPhiDT_MB[9]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB0/2","hResidualGlobalRPhiDT_MB0/2",200,-10,10);
523  hResidualGlobalPhiDT_MB[9]=fs->make<TH1F>("hResidualGlobalPhiDT_MB0/2","hResidualGlobalPhiDT_MB0/2",200,-1,1);
524  hResidualGlobalThetaDT_MB[9]=fs->make<TH1F>("hResidualGlobalThetaDT_MB0/2","hResidualGlobalThetaDT_MB0/2",200,-1,1);
525  hResidualGlobalZDT_MB[9] = fs->make<TH1F>("hResidualGlobalZDT_MB0/2","hResidualGlobalZDT_MB0/2",200,-10,10);
526  hResidualGlobalRPhiDT_MB[10]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB0/3","hResidualGlobalRPhiDT_MB0/3",200,-10,10);
527  hResidualGlobalThetaDT_MB[10]=fs->make<TH1F>("hResidualGlobalThetaDT_MB0/3","hResidualGlobalThetaDT_MB0/3",200,-1,1);
528  hResidualGlobalPhiDT_MB[10]=fs->make<TH1F>("hResidualGlobalPhiDT_MB0/3","hResidualGlobalPhiDT_MB0/3",200,-1,1);
529  hResidualGlobalZDT_MB[10] = fs->make<TH1F>("hResidualGlobalZDT_MB0/3","hResidualGlobalZDT_MB0/3",200,-10,10);
530  hResidualGlobalRPhiDT_MB[11]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB0/4","hResidualGlobalRPhiDT_MB0/4",200,-10,10);
531  hResidualGlobalPhiDT_MB[11]=fs->make<TH1F>("hResidualGlobalPhiDT_MB0/4","hResidualGlobalPhiDT_MB0/4",200,-1,1);
532  hResidualGlobalThetaDT_MB[11]=fs->make<TH1F>("hResidualGlobalThetaDT_MB0/4","hResidualGlobalThetaDT_MB0/4",200,-1,1);
533  hResidualGlobalZDT_MB[11] = fs->make<TH1F>("hResidualGlobalZDT_MB0/4","hResidualGlobalZDT_MB0/4",200,-10,10);
534  hResidualGlobalRPhiDT_MB[12]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB1/1","hResidualGlobalRPhiDT_MB1/1",200,-10,10);
535  hResidualGlobalPhiDT_MB[12]=fs->make<TH1F>("hResidualGlobalPhiDT_MB1/1","hResidualGlobalPhiDT_MB1/1",200,-1,1);
536  hResidualGlobalThetaDT_MB[12]=fs->make<TH1F>("hResidualGlobalThetaDT_MB1/1","hResidualGlobalThetaDT_MB1/1",200,-1,1);
537  hResidualGlobalZDT_MB[12] = fs->make<TH1F>("hResidualGlobalZDT_MB1/1","hResidualGlobalZDT_MB1/1",200,-10,10);
538  hResidualGlobalRPhiDT_MB[13]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB1/2","hResidualGlobalRPhiDT_MB1/2",200,-10,10);
539  hResidualGlobalPhiDT_MB[13]=fs->make<TH1F>("hResidualGlobalPhiDT_MB1/2","hResidualGlobalPhiDT_MB1/2",200,-1,1);
540  hResidualGlobalThetaDT_MB[13]=fs->make<TH1F>("hResidualGlobalThetaDT_MB1/2","hResidualGlobalThetaDT_MB1/2",200,-1,1);
541  hResidualGlobalZDT_MB[13] = fs->make<TH1F>("hResidualGlobalZDT_MB1/2","hResidualGlobalZDT_MB1/2",200,-10,10);
542  hResidualGlobalRPhiDT_MB[14]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB1/3","hResidualGlobalRPhiDT_MB1/3",200,-10,10);
543  hResidualGlobalPhiDT_MB[14]=fs->make<TH1F>("hResidualGlobalPhiDT_MB1/3","hResidualGlobalPhiDT_MB1/3",200,-1,1);
544  hResidualGlobalThetaDT_MB[14]=fs->make<TH1F>("hResidualGlobalThetaDT_MB1/3","hResidualGlobalThetaDT_MB1/3",200,-1,1);
545  hResidualGlobalZDT_MB[14] = fs->make<TH1F>("hResidualGlobalZDT_MB1/3","hResidualGlobalZDT_MB1/3",200,-10,10);
546  hResidualGlobalRPhiDT_MB[15]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB1/4","hResidualGlobalRPhiDT_MB1/4",200,-10,10);
547  hResidualGlobalPhiDT_MB[15]=fs->make<TH1F>("hResidualGlobalPhiDT_MB1/4","hResidualGlobalPhiDT_MB1/4",200,-1,1);
548  hResidualGlobalThetaDT_MB[15]=fs->make<TH1F>("hResidualGlobalThetaDT_MB1/4","hResidualGlobalThetaDT_MB1/4",200,-1,1);
549  hResidualGlobalZDT_MB[15] = fs->make<TH1F>("hResidualGlobalZDT_MB1/4","hResidualGlobalZDT_MB1/4",200,-10,10);
550  hResidualGlobalRPhiDT_MB[16]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB2/1","hResidualGlobalRPhiDT_MB2/1",200,-10,10);
551  hResidualGlobalPhiDT_MB[16]=fs->make<TH1F>("hResidualGlobalPhiDT_MB2/1","hResidualGlobalPhiDT_MB2/1",200,-1,1);
552  hResidualGlobalThetaDT_MB[16]=fs->make<TH1F>("hResidualGlobalThetaDT_MB2/1","hResidualGlobalThetaDT_MB2/1",200,-1,1);
553  hResidualGlobalZDT_MB[16] = fs->make<TH1F>("hResidualGlobalZDT_MB2/1","hResidualGlobalZDT_MB2/1",200,-10,10);
554  hResidualGlobalRPhiDT_MB[17]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB2/2","hResidualGlobalRPhiDT_MB2/2",200,-10,10);
555  hResidualGlobalPhiDT_MB[17]=fs->make<TH1F>("hResidualGlobalPhiDT_MB2/2","hResidualGlobalPhiDT_MB2/2",200,-1,1);
556  hResidualGlobalThetaDT_MB[17]=fs->make<TH1F>("hResidualGlobalThetaDT_MB2/2","hResidualGlobalThetaDT_MB2/2",200,-1,1);
557  hResidualGlobalZDT_MB[17] = fs->make<TH1F>("hResidualGlobalZDT_MB2/2","hResidualGlobalZDT_MB2/2",200,-10,10);
558  hResidualGlobalRPhiDT_MB[18]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB2/3","hResidualGlobalRPhiDT_MB2/3",200,-10,10);
559  hResidualGlobalPhiDT_MB[18]=fs->make<TH1F>("hResidualGlobalPhiDT_MB2/3","hResidualGlobalPhiDT_MB2/3",200,-1,1);
560  hResidualGlobalThetaDT_MB[18]=fs->make<TH1F>("hResidualGlobalThetaDT_MB2/3","hResidualGlobalThetaDT_MB2/3",200,-1,1);
561  hResidualGlobalZDT_MB[18] = fs->make<TH1F>("hResidualGlobalZDT_MB2/3","hResidualGlobalZDT_MB2/3",200,-10,10);
562  hResidualGlobalRPhiDT_MB[19]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB2/4","hResidualGlobalRPhiDT_MB2/4",200,-10,10);
563  hResidualGlobalPhiDT_MB[19]=fs->make<TH1F>("hResidualGlobalPhiDT_MB2/4","hResidualGlobalPhiDT_MB2/4",200,-1,1);
564  hResidualGlobalThetaDT_MB[19]=fs->make<TH1F>("hResidualGlobalThetaDT_MB2/4","hResidualGlobalThetaDT_MB2/4",200,-1,1);
565  hResidualGlobalZDT_MB[19] = fs->make<TH1F>("hResidualGlobalZDT_MB2/4","hResidualGlobalZDT_MB2/4",200,-10,10);
566 
567 
568 // CSC Stations
569  hResidualLocalXCSC_ME[0]=fs->make<TH1F>("hResidualLocalXCSC_ME-4/1","hResidualLocalXCSC_ME-4/1",200,-10,10);
570  hResidualLocalPhiCSC_ME[0]=fs->make<TH1F>("hResidualLocalPhiCSC_ME-4/1","hResidualLocalPhiCSC_ME-4/1",200,-1,1);
571  hResidualLocalThetaCSC_ME[0]=fs->make<TH1F>("hResidualLocalThetaCSC_ME-4/1","hResidualLocalThetaCSC_ME-4/1",200,-1,1);
572  hResidualLocalYCSC_ME[0] = fs->make<TH1F>("hResidualLocalYCSC_ME-4/1","hResidualLocalYCSC_ME-4/1",200,-10,10);
573  hResidualLocalXCSC_ME[1]=fs->make<TH1F>("hResidualLocalXCSC_ME-4/2","hResidualLocalXCSC_ME-4/2",200,-10,10);
574  hResidualLocalPhiCSC_ME[1]=fs->make<TH1F>("hResidualLocalPhiCSC_ME-4/2","hResidualLocalPhiCSC_ME-4/2",200,-1,1);
575  hResidualLocalThetaCSC_ME[1]=fs->make<TH1F>("hResidualLocalThetaCSC_ME-4/2","hResidualLocalThetaCSC_ME-4/2",200,-1,1);
576  hResidualLocalYCSC_ME[1] = fs->make<TH1F>("hResidualLocalYCSC_ME-4/2","hResidualLocalYCSC_ME-4/2",200,-10,10);
577  hResidualLocalXCSC_ME[2]=fs->make<TH1F>("hResidualLocalXCSC_ME-3/1","hResidualLocalXCSC_ME-3/1",200,-10,10);
578  hResidualLocalPhiCSC_ME[2]=fs->make<TH1F>("hResidualLocalPhiCSC_ME-3/1","hResidualLocalPhiCSC_ME-3/1",200,-1,1);
579  hResidualLocalThetaCSC_ME[2]=fs->make<TH1F>("hResidualLocalThetaCSC_ME-3/1","hResidualLocalThetaCSC_ME-3/1",200,-1,1);
580  hResidualLocalYCSC_ME[2] = fs->make<TH1F>("hResidualLocalYCSC_ME-3/1","hResidualLocalYCSC_ME-3/1",200,-10,10);
581  hResidualLocalXCSC_ME[3]=fs->make<TH1F>("hResidualLocalXCSC_ME-3/2","hResidualLocalXCSC_ME-3/2",200,-10,10);
582  hResidualLocalPhiCSC_ME[3]=fs->make<TH1F>("hResidualLocalPhiCSC_ME-3/2","hResidualLocalPhiCSC_ME-3/2",200,-1,1);
583  hResidualLocalThetaCSC_ME[3]=fs->make<TH1F>("hResidualLocalThetaCSC_ME-3/2","hResidualLocalThetaCSC_ME-3/2",200,-1,1);
584  hResidualLocalYCSC_ME[3] = fs->make<TH1F>("hResidualLocalYCSC_ME-3/2","hResidualLocalYCSC_ME-3/2",200,-10,10);
585  hResidualLocalXCSC_ME[4]=fs->make<TH1F>("hResidualLocalXCSC_ME-2/1","hResidualLocalXCSC_ME-2/1",200,-10,10);
586  hResidualLocalPhiCSC_ME[4]=fs->make<TH1F>("hResidualLocalPhiCSC_ME-2/1","hResidualLocalPhiCSC_ME-2/1",200,-1,1);
587  hResidualLocalThetaCSC_ME[4]=fs->make<TH1F>("hResidualLocalThetaCSC_ME-2/1","hResidualLocalThetaCSC_ME-2/1",200,-1,1);
588  hResidualLocalYCSC_ME[4] = fs->make<TH1F>("hResidualLocalYCSC_ME-2/1","hResidualLocalYCSC_ME-2/1",200,-10,10);
589  hResidualLocalXCSC_ME[5]=fs->make<TH1F>("hResidualLocalXCSC_ME-2/2","hResidualLocalXCSC_ME-2/2",200,-10,10);
590  hResidualLocalPhiCSC_ME[5]=fs->make<TH1F>("hResidualLocalPhiCSC_ME-2/2","hResidualLocalPhiCSC_ME-2/2",200,-1,1);
591  hResidualLocalThetaCSC_ME[5]=fs->make<TH1F>("hResidualLocalThetaCSC_ME-2/2","hResidualLocalThetaCSC_ME-2/2",200,-1,1);
592  hResidualLocalYCSC_ME[5] = fs->make<TH1F>("hResidualLocalYCSC_ME-2/2","hResidualLocalYCSC_ME-2/2",200,-10,10);
593  hResidualLocalXCSC_ME[6]=fs->make<TH1F>("hResidualLocalXCSC_ME-1/1","hResidualLocalXCSC_ME-1/1",200,-10,10);
594  hResidualLocalPhiCSC_ME[6]=fs->make<TH1F>("hResidualLocalPhiCSC_ME-1/1","hResidualLocalPhiCSC_ME-1/1",200,-1,1);
595  hResidualLocalThetaCSC_ME[6]=fs->make<TH1F>("hResidualLocalThetaCSC_ME-1/1","hResidualLocalThetaCSC_ME-1/1",200,-1,1);
596  hResidualLocalYCSC_ME[6] = fs->make<TH1F>("hResidualLocalYCSC_ME-1/1","hResidualLocalYCSC_ME-1/1",200,-10,10);
597  hResidualLocalXCSC_ME[7]=fs->make<TH1F>("hResidualLocalXCSC_ME-1/2","hResidualLocalXCSC_ME-1/2",200,-10,10);
598  hResidualLocalPhiCSC_ME[7]=fs->make<TH1F>("hResidualLocalPhiCSC_ME-1/2","hResidualLocalPhiCSC_ME-1/2",200,-1,1);
599  hResidualLocalThetaCSC_ME[7]=fs->make<TH1F>("hResidualLocalThetaCSC_ME-1/2","hResidualLocalThetaCSC_ME-1/2",200,-1,1);
600  hResidualLocalYCSC_ME[7] = fs->make<TH1F>("hResidualLocalYCSC_ME-1/2","hResidualLocalYCSC_ME-1/2",200,-10,10);
601  hResidualLocalXCSC_ME[8]=fs->make<TH1F>("hResidualLocalXCSC_ME-1/3","hResidualLocalXCSC_ME-1/3",200,-10,10);
602  hResidualLocalPhiCSC_ME[8]=fs->make<TH1F>("hResidualLocalPhiCSC_ME-1/3","hResidualLocalPhiCSC_ME-1/3",200,-1,1);
603  hResidualLocalThetaCSC_ME[8]=fs->make<TH1F>("hResidualLocalThetaCSC_ME-1/3","hResidualLocalThetaCSC_ME-1/3",200,-1,1);
604  hResidualLocalYCSC_ME[8] = fs->make<TH1F>("hResidualLocalYCSC_ME-1/3","hResidualLocalYCSC_ME-1/3",200,-10,10);
605  hResidualLocalXCSC_ME[9]=fs->make<TH1F>("hResidualLocalXCSC_ME1/1","hResidualLocalXCSC_ME1/1",200,-10,10);
606  hResidualLocalPhiCSC_ME[9]=fs->make<TH1F>("hResidualLocalPhiCSC_ME1/1","hResidualLocalPhiCSC_ME1/1",100,-1,1);
607  hResidualLocalThetaCSC_ME[9]=fs->make<TH1F>("hResidualLocalThetaCSC_ME1/1","hResidualLocalThetaCSC_ME1/1",200,-1,1);
608  hResidualLocalYCSC_ME[9] = fs->make<TH1F>("hResidualLocalYCSC_ME1/1","hResidualLocalYCSC_ME1/1",200,-10,10);
609  hResidualLocalXCSC_ME[10]=fs->make<TH1F>("hResidualLocalXCSC_ME1/2","hResidualLocalXCSC_ME1/2",200,-10,10);
610  hResidualLocalPhiCSC_ME[10]=fs->make<TH1F>("hResidualLocalPhiCSC_ME1/2","hResidualLocalPhiCSC_ME1/2",200,-1,1);
611  hResidualLocalThetaCSC_ME[10]=fs->make<TH1F>("hResidualLocalThetaCSC_ME1/2","hResidualLocalThetaCSC_ME1/2",200,-1,1);
612  hResidualLocalYCSC_ME[10] = fs->make<TH1F>("hResidualLocalYCSC_ME1/2","hResidualLocalYCSC_ME1/2",200,-10,10);
613  hResidualLocalXCSC_ME[11]=fs->make<TH1F>("hResidualLocalXCSC_ME1/3","hResidualLocalXCSC_ME1/3",200,-10,10);
614  hResidualLocalPhiCSC_ME[11]=fs->make<TH1F>("hResidualLocalPhiCSC_ME1/3","hResidualLocalPhiCSC_ME1/3",200,-1,1);
615  hResidualLocalThetaCSC_ME[11]=fs->make<TH1F>("hResidualLocalThetaCSC_ME1/3","hResidualLocalThetaCSC_ME1/3",200,-1,1);
616  hResidualLocalYCSC_ME[11] = fs->make<TH1F>("hResidualLocalYCSC_ME1/3","hResidualLocalYCSC_ME1/3",200,-10,10);
617  hResidualLocalXCSC_ME[12]=fs->make<TH1F>("hResidualLocalXCSC_ME2/1","hResidualLocalXCSC_ME2/1",200,-10,10);
618  hResidualLocalPhiCSC_ME[12]=fs->make<TH1F>("hResidualLocalPhiCSC_ME2/1","hResidualLocalPhiCSC_ME2/1",200,-1,1);
619  hResidualLocalThetaCSC_ME[12]=fs->make<TH1F>("hResidualLocalThetaCSC_ME2/1","hResidualLocalThetaCSC_ME2/1",200,-1,1);
620  hResidualLocalYCSC_ME[12] = fs->make<TH1F>("hResidualLocalYCSC_ME2/1","hResidualLocalYCSC_ME2/1",200,-10,10);
621  hResidualLocalXCSC_ME[13]=fs->make<TH1F>("hResidualLocalXCSC_ME2/2","hResidualLocalXCSC_ME2/2",200,-10,10);
622  hResidualLocalPhiCSC_ME[13]=fs->make<TH1F>("hResidualLocalPhiCSC_ME2/2","hResidualLocalPhiCSC_ME2/2",200,-1,1);
623  hResidualLocalThetaCSC_ME[13]=fs->make<TH1F>("hResidualLocalThetaCSC_ME2/2","hResidualLocalThetaCSC_ME2/2",200,-1,1);
624  hResidualLocalYCSC_ME[13] = fs->make<TH1F>("hResidualLocalYCSC_ME2/2","hResidualLocalYCSC_ME2/2",200,-10,10);
625  hResidualLocalXCSC_ME[14]=fs->make<TH1F>("hResidualLocalXCSC_ME3/1","hResidualLocalXCSC_ME3/1",200,-10,10);
626  hResidualLocalPhiCSC_ME[14]=fs->make<TH1F>("hResidualLocalPhiCSC_ME3/1","hResidualLocalPhiCSC_ME3/1",200,-1,1);
627  hResidualLocalThetaCSC_ME[14]=fs->make<TH1F>("hResidualLocalThetaCSC_ME3/1","hResidualLocalThetaCSC_ME3/1",200,-1,1);
628  hResidualLocalYCSC_ME[14] = fs->make<TH1F>("hResidualLocalYCSC_ME3/1","hResidualLocalYCSC_ME3/1",200,-10,10);
629  hResidualLocalXCSC_ME[15]=fs->make<TH1F>("hResidualLocalXCSC_ME3/2","hResidualLocalXCSC_ME3/2",200,-10,10);
630  hResidualLocalPhiCSC_ME[15]=fs->make<TH1F>("hResidualLocalPhiCSC_ME3/2","hResidualLocalPhiCSC_ME3/2",200,-1,1);
631  hResidualLocalThetaCSC_ME[15]=fs->make<TH1F>("hResidualLocalThetaCSC_ME3/2","hResidualLocalThetaCSC_ME3/2",200,-1,1);
632  hResidualLocalYCSC_ME[15] = fs->make<TH1F>("hResidualLocalYCSC_ME3/2","hResidualLocalYCSC_ME3/2",200,-10,10);
633  hResidualLocalXCSC_ME[16]=fs->make<TH1F>("hResidualLocalXCSC_ME4/1","hResidualLocalXCSC_ME4/1",200,-10,10);
634  hResidualLocalPhiCSC_ME[16]=fs->make<TH1F>("hResidualLocalPhiCSC_ME4/1","hResidualLocalPhiCSC_ME4/1",200,-1,1);
635  hResidualLocalThetaCSC_ME[16]=fs->make<TH1F>("hResidualLocalThetaCSC_ME4/1","hResidualLocalThetaCSC_ME4/1",200,-1,1);
636  hResidualLocalYCSC_ME[16] = fs->make<TH1F>("hResidualLocalYCSC_ME4/1","hResidualLocalYCSC_ME4/1",200,-10,10);
637  hResidualLocalXCSC_ME[17]=fs->make<TH1F>("hResidualLocalXCSC_ME4/2","hResidualLocalXCSC_ME4/2",200,-10,10);
638  hResidualLocalPhiCSC_ME[17]=fs->make<TH1F>("hResidualLocalPhiCSC_ME4/2","hResidualLocalPhiCSC_ME4/2",200,-1,1);
639  hResidualLocalThetaCSC_ME[17]=fs->make<TH1F>("hResidualLocalThetaCSC_ME4/2","hResidualLocalThetaCSC_ME4/2",200,-1,1);
640  hResidualLocalYCSC_ME[17] = fs->make<TH1F>("hResidualLocalYCSC_ME4/2","hResidualLocalYCSC_ME4/2",200,-10,10);
641  hResidualGlobalRPhiCSC_ME[0]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME-4/1","hResidualGlobalRPhiCSC_ME-4/1",200,-10,10);
642  hResidualGlobalPhiCSC_ME[0]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME-4/1","hResidualGlobalPhiCSC_ME-4/1",200,-1,1);
643  hResidualGlobalThetaCSC_ME[0]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME-4/1","hResidualGlobalThetaCSC_ME-4/1",200,-1,1);
644  hResidualGlobalRCSC_ME[0] = fs->make<TH1F>("hResidualGlobalRCSC_ME-4/1","hResidualGlobalRCSC_ME-4/1",200,-10,10);
645  hResidualGlobalRPhiCSC_ME[1]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME-4/2","hResidualGlobalRPhiCSC_ME-4/2",200,-10,10);
646  hResidualGlobalPhiCSC_ME[1]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME-4/2","hResidualGlobalPhiCSC_ME-4/2",200,-1,1);
647  hResidualGlobalThetaCSC_ME[1]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME-4/2","hResidualGlobalThetaCSC_ME-4/2",200,-1,1);
648  hResidualGlobalRCSC_ME[1] = fs->make<TH1F>("hResidualGlobalRCSC_ME-4/2","hResidualGlobalRCSC_ME-4/2",200,-10,10);
649  hResidualGlobalRPhiCSC_ME[2]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME-3/1","hResidualGlobalRPhiCSC_ME-3/1",200,-10,10);
650  hResidualGlobalPhiCSC_ME[2]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME-3/1","hResidualGlobalPhiCSC_ME-3/1",200,-1,1);
651  hResidualGlobalThetaCSC_ME[2]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME-3/1","hResidualGlobalThetaCSC_ME-3/1",200,-1,1);
652  hResidualGlobalRCSC_ME[2] = fs->make<TH1F>("hResidualGlobalRCSC_ME-3/1","hResidualGlobalRCSC_ME-3/1",200,-10,10);
653  hResidualGlobalRPhiCSC_ME[3]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME-3/2","hResidualGlobalRPhiCSC_ME-3/2",200,-10,10);
654  hResidualGlobalPhiCSC_ME[3]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME-3/2","hResidualGlobalPhiCSC_ME-3/2",200,-1,1);
655  hResidualGlobalThetaCSC_ME[3]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME-3/2","hResidualGlobalThetaCSC_ME-3/2",200,-1,1);
656  hResidualGlobalRCSC_ME[3] = fs->make<TH1F>("hResidualGlobalRCSC_ME-3/2","hResidualGlobalRCSC_ME-3/2",200,-10,10);
657  hResidualGlobalRPhiCSC_ME[4]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME-2/1","hResidualGlobalRPhiCSC_ME-2/1",200,-10,10);
658  hResidualGlobalPhiCSC_ME[4]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME-2/1","hResidualGlobalPhiCSC_ME-2/1",200,-1,1);
659  hResidualGlobalThetaCSC_ME[4]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME-2/1","hResidualGlobalThetaCSC_ME-2/1",200,-1,1);
660  hResidualGlobalRCSC_ME[4] = fs->make<TH1F>("hResidualGlobalRCSC_ME-2/1","hResidualGlobalRCSC_ME-2/1",200,-10,10);
661  hResidualGlobalRPhiCSC_ME[5]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME-2/2","hResidualGlobalRPhiCSC_ME-2/2",200,-10,10);
662  hResidualGlobalPhiCSC_ME[5]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME-2/2","hResidualGlobalPhiCSC_ME-2/2",200,-1,1);
663  hResidualGlobalThetaCSC_ME[5]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME-2/2","hResidualGlobalThetaCSC_ME-2/2",200,-1,1);
664  hResidualGlobalRCSC_ME[5] = fs->make<TH1F>("hResidualGlobalRCSC_ME-2/2","hResidualGlobalRCSC_ME-2/2",200,-10,10);
665  hResidualGlobalRPhiCSC_ME[6]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME-1/1","hResidualGlobalRPhiCSC_ME-1/1",200,-10,10);
666  hResidualGlobalPhiCSC_ME[6]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME-1/1","hResidualGlobalPhiCSC_ME-1/1",200,-1,1);
667  hResidualGlobalThetaCSC_ME[6]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME-1/1","hResidualGlobalThetaCSC_ME-1/1",200,-1,1);
668  hResidualGlobalRCSC_ME[6] = fs->make<TH1F>("hResidualGlobalRCSC_ME-1/1","hResidualGlobalRCSC_ME-1/1",200,-10,10);
669  hResidualGlobalRPhiCSC_ME[7]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME-1/2","hResidualGlobalRPhiCSC_ME-1/2",200,-10,10);
670  hResidualGlobalPhiCSC_ME[7]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME-1/2","hResidualGlobalPhiCSC_ME-1/2",200,-1,1);
671  hResidualGlobalThetaCSC_ME[7]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME-1/2","hResidualGlobalThetaCSC_ME-1/2",200,-1,1);
672  hResidualGlobalRCSC_ME[7] = fs->make<TH1F>("hResidualGlobalRCSC_ME-1/2","hResidualGlobalRCSC_ME-1/2",200,-10,10);
673  hResidualGlobalRPhiCSC_ME[8]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME-1/3","hResidualGlobalRPhiCSC_ME-1/3",200,-10,10);
674  hResidualGlobalPhiCSC_ME[8]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME-1/3","hResidualGlobalPhiCSC_ME-1/3",200,-1,1);
675  hResidualGlobalThetaCSC_ME[8]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME-1/3","hResidualGlobalThetaCSC_ME-1/3",200,-1,1);
676  hResidualGlobalRCSC_ME[8] = fs->make<TH1F>("hResidualGlobalRCSC_ME-1/3","hResidualGlobalRCSC_ME-1/3",200,-10,10);
677  hResidualGlobalRPhiCSC_ME[9]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME1/1","hResidualGlobalRPhiCSC_ME1/1",200,-10,10);
678  hResidualGlobalPhiCSC_ME[9]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME1/1","hResidualGlobalPhiCSC_ME1/1",100,-1,1);
679  hResidualGlobalThetaCSC_ME[9]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME1/1","hResidualGlobalThetaCSC_ME1/1",200,-1,1);
680  hResidualGlobalRCSC_ME[9] = fs->make<TH1F>("hResidualGlobalRCSC_ME1/1","hResidualGlobalRCSC_ME1/1",200,-10,10);
681  hResidualGlobalRPhiCSC_ME[10]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME1/2","hResidualGlobalRPhiCSC_ME1/2",200,-10,10);
682  hResidualGlobalPhiCSC_ME[10]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME1/2","hResidualGlobalPhiCSC_ME1/2",200,-1,1);
683  hResidualGlobalThetaCSC_ME[10]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME1/2","hResidualGlobalThetaCSC_ME1/2",200,-1,1);
684  hResidualGlobalRCSC_ME[10] = fs->make<TH1F>("hResidualGlobalRCSC_ME1/2","hResidualGlobalRCSC_ME1/2",200,-10,10);
685  hResidualGlobalRPhiCSC_ME[11]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME1/3","hResidualGlobalRPhiCSC_ME1/3",200,-10,10);
686  hResidualGlobalPhiCSC_ME[11]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME1/3","hResidualGlobalPhiCSC_ME1/3",200,-1,1);
687  hResidualGlobalThetaCSC_ME[11]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME1/3","hResidualGlobalThetaCSC_ME1/3",200,-1,1);
688  hResidualGlobalRCSC_ME[11] = fs->make<TH1F>("hResidualGlobalRCSC_ME1/3","hResidualGlobalRCSC_ME1/3",200,-10,10);
689  hResidualGlobalRPhiCSC_ME[12]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME2/1","hResidualGlobalRPhiCSC_ME2/1",200,-10,10);
690  hResidualGlobalPhiCSC_ME[12]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME2/1","hResidualGlobalPhiCSC_ME2/1",200,-1,1);
691  hResidualGlobalThetaCSC_ME[12]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME2/1","hResidualGlobalThetaCSC_ME2/1",200,-1,1);
692  hResidualGlobalRCSC_ME[12] = fs->make<TH1F>("hResidualGlobalRCSC_ME2/1","hResidualGlobalRCSC_ME2/1",200,-10,10);
693  hResidualGlobalRPhiCSC_ME[13]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME2/2","hResidualGlobalRPhiCSC_ME2/2",200,-10,10);
694  hResidualGlobalPhiCSC_ME[13]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME2/2","hResidualGlobalPhiCSC_ME2/2",200,-1,1);
695  hResidualGlobalThetaCSC_ME[13]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME2/2","hResidualGlobalThetaCSC_ME2/2",200,-1,1);
696  hResidualGlobalRCSC_ME[13] = fs->make<TH1F>("hResidualGlobalRCSC_ME2/2","hResidualGlobalRCSC_ME2/2",200,-10,10);
697  hResidualGlobalRPhiCSC_ME[14]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME3/1","hResidualGlobalRPhiCSC_ME3/1",200,-10,10);
698  hResidualGlobalPhiCSC_ME[14]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME3/1","hResidualGlobalPhiCSC_ME3/1",200,-1,1);
699  hResidualGlobalThetaCSC_ME[14]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME3/1","hResidualGlobalThetaCSC_ME3/1",200,-1,1);
700  hResidualGlobalRCSC_ME[14] = fs->make<TH1F>("hResidualGlobalRCSC_ME3/1","hResidualGlobalRCSC_ME3/1",200,-10,10);
701  hResidualGlobalRPhiCSC_ME[15]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME3/2","hResidualGlobalRPhiCSC_ME3/2",200,-10,10);
702  hResidualGlobalPhiCSC_ME[15]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME3/2","hResidualGlobalPhiCSC_ME3/2",200,-1,1);
703  hResidualGlobalThetaCSC_ME[15]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME3/2","hResidualGlobalThetaCSC_ME3/2",200,-1,1);
704  hResidualGlobalRCSC_ME[15] = fs->make<TH1F>("hResidualGlobalRCSC_ME3/2","hResidualGlobalRCSC_ME3/2",200,-10,10);
705  hResidualGlobalRPhiCSC_ME[16]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME4/1","hResidualGlobalRPhiCSC_ME4/1",200,-10,10);
706  hResidualGlobalPhiCSC_ME[16]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME4/1","hResidualGlobalPhiCSC_ME4/1",200,-1,1);
707  hResidualGlobalThetaCSC_ME[16]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME4/1","hResidualGlobalThetaCSC_ME4/1",200,-1,1);
708  hResidualGlobalRCSC_ME[16] = fs->make<TH1F>("hResidualGlobalRCSC_ME4/1","hResidualGlobalRCSC_ME4/1",200,-10,10);
709  hResidualGlobalRPhiCSC_ME[17]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME4/2","hResidualGlobalRPhiCSC_ME4/2",200,-10,10);
710  hResidualGlobalPhiCSC_ME[17]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME4/2","hResidualGlobalPhiCSC_ME4/2",200,-1,1);
711  hResidualGlobalThetaCSC_ME[17]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME4/2","hResidualGlobalThetaCSC_ME4/2",200,-1,1);
712  hResidualGlobalRCSC_ME[17] = fs->make<TH1F>("hResidualGlobalRCSC_ME4/2","hResidualGlobalRCSC_ME4/2",200,-10,10);
713 
714  //DQM plots: mean residual with RMS as error
715  hprofLocalXDT=fs->make<TH1F>("hprofLocalXDT","Local X DT;;X (cm)", 280,0, 280);
716  hprofLocalPhiDT=fs->make<TH1F>("hprofLocalPhiDT","Local Phi DT;;Phi (rad)", 280,0, 280);
717  hprofLocalThetaDT=fs->make<TH1F>("hprofLocalThetaDT","Local Theta DT;;Theta (rad)", 280,0, 280);
718  hprofLocalYDT=fs->make<TH1F>("hprofLocalYDT","Local Y DT;;Y (cm)", 280,0, 280);
719  hprofLocalXCSC=fs->make<TH1F>("hprofLocalXCSC","Local X CSC;;X (cm)", 540,0, 540);
720  hprofLocalPhiCSC=fs->make<TH1F>("hprofLocalPhiCSC","Local Phi CSC;;Phi (rad)", 540,0, 540);
721  hprofLocalThetaCSC=fs->make<TH1F>("hprofLocalThetaCSC","Local Theta CSC;;Theta (rad)", 540,0, 540);
722  hprofLocalYCSC=fs->make<TH1F>("hprofLocalYCSC","Local Y CSC;;Y (cm)", 540,0, 540);
723  hprofGlobalRPhiDT=fs->make<TH1F>("hprofGlobalRPhiDT","Global RPhi DT;;RPhi (cm)", 280,0, 280);
724  hprofGlobalPhiDT=fs->make<TH1F>("hprofGlobalPhiDT","Global Phi DT;;Phi (rad)", 280,0, 280);
725  hprofGlobalThetaDT=fs->make<TH1F>("hprofGlobalThetaDT","Global Theta DT;;Theta (rad)", 280,0, 280);
726  hprofGlobalZDT=fs->make<TH1F>("hprofGlobalZDT","Global Z DT;;Z (cm)", 280,0, 280);
727  hprofGlobalRPhiCSC=fs->make<TH1F>("hprofGlobalRPhiCSC","Global RPhi CSC;;RPhi (cm)", 540,0, 540);
728  hprofGlobalPhiCSC=fs->make<TH1F>("hprofGlobalPhiCSC","Global Phi CSC;;Phi (cm)", 540,0, 540);
729  hprofGlobalThetaCSC=fs->make<TH1F>("hprofGlobalThetaCSC","Global Theta CSC;;Theta (rad)", 540,0, 540);
730  hprofGlobalRCSC=fs->make<TH1F>("hprofGlobalRCSC","Global R CSC;;R (cm)", 540,0, 540);
731 
732  // TH1F options
733  hprofLocalXDT->GetXaxis()->SetLabelSize(0.025);
734  hprofLocalPhiDT->GetXaxis()->SetLabelSize(0.025);
735  hprofLocalThetaDT->GetXaxis()->SetLabelSize(0.025);
736  hprofLocalYDT->GetXaxis()->SetLabelSize(0.025);
737  hprofLocalXCSC->GetXaxis()->SetLabelSize(0.025);
738  hprofLocalPhiCSC->GetXaxis()->SetLabelSize(0.025);
739  hprofLocalThetaCSC->GetXaxis()->SetLabelSize(0.025);
740  hprofLocalYCSC->GetXaxis()->SetLabelSize(0.025);
741  hprofGlobalRPhiDT->GetXaxis()->SetLabelSize(0.025);
742  hprofGlobalPhiDT->GetXaxis()->SetLabelSize(0.025);
743  hprofGlobalThetaDT->GetXaxis()->SetLabelSize(0.025);
744  hprofGlobalZDT->GetXaxis()->SetLabelSize(0.025);
745  hprofGlobalRPhiCSC->GetXaxis()->SetLabelSize(0.025);
746  hprofGlobalPhiCSC->GetXaxis()->SetLabelSize(0.025);
747  hprofGlobalThetaCSC->GetXaxis()->SetLabelSize(0.025);
748  hprofGlobalRCSC->GetXaxis()->SetLabelSize(0.025);
749 
750  // TH2F histos definition
751  hprofGlobalPositionDT=fs->make<TH2F>("hprofGlobalPositionDT","Global DT position (cm) absolute MEAN residuals;Sector;;cm", 14,0, 14,40,0,40);
752  hprofGlobalAngleDT=fs->make<TH2F>("hprofGlobalAngleDT","Global DT angle (rad) absolute MEAN residuals;Sector;;rad", 14,0, 14,40,0,40);
753  hprofGlobalPositionRmsDT=fs->make<TH2F>("hprofGlobalPositionRmsDT","Global DT position (cm) RMS residuals;Sector;;rad", 14,0, 14,40,0,40);
754  hprofGlobalAngleRmsDT=fs->make<TH2F>("hprofGlobalAngleRmsDT","Global DT angle (rad) RMS residuals;Sector;;rad", 14,0, 14,40,0,40);
755  hprofLocalPositionDT=fs->make<TH2F>("hprofLocalPositionDT","Local DT position (cm) absolute MEAN residuals;Sector;;cm", 14,0, 14,40,0,40);
756  hprofLocalAngleDT=fs->make<TH2F>("hprofLocalAngleDT","Local DT angle (rad) absolute MEAN residuals;Sector;;rad", 14,0, 14,40,0,40);
757  hprofLocalPositionRmsDT=fs->make<TH2F>("hprofLocalPositionRmsDT","Local DT position (cm) RMS residuals;Sector;;rad", 14,0, 14,40,0,40);
758  hprofLocalAngleRmsDT=fs->make<TH2F>("hprofLocalAngleRmsDT","Local DT angle (rad) RMS residuals;Sector;;rad", 14,0, 14,40,0,40);
759 
760  hprofGlobalPositionCSC=fs->make<TH2F>("hprofGlobalPositionCSC","Global CSC position (cm) absolute MEAN residuals;Sector;;cm", 36,0,36,36,0,36);
761  hprofGlobalAngleCSC=fs->make<TH2F>("hprofGlobalAngleCSC","Global CSC angle (rad) absolute MEAN residuals;Sector;;rad", 36,0,36,36,0,36);
762  hprofGlobalPositionRmsCSC=fs->make<TH2F>("hprofGlobalPositionRmsCSC","Global CSC position (cm) RMS residuals;Sector;;rad", 36,0,36,36,0,36);
763  hprofGlobalAngleRmsCSC=fs->make<TH2F>("hprofGlobalAngleRmsCSC","Global CSC angle (rad) RMS residuals;Sector;;rad", 36,0,36,36,0,36);
764  hprofLocalPositionCSC=fs->make<TH2F>("hprofLocalPositionCSC","Local CSC position (cm) absolute MEAN residuals;Sector;;cm", 36,0,36,36,0,36);
765  hprofLocalAngleCSC=fs->make<TH2F>("hprofLocalAngleCSC","Local CSC angle (rad) absolute MEAN residuals;Sector;;rad", 36,0,36,36,0,36);
766  hprofLocalPositionRmsCSC=fs->make<TH2F>("hprofLocalPositionRmsCSC","Local CSC position (cm) RMS residuals;Sector;;rad", 36,0,36,36,0,36);
767  hprofLocalAngleRmsCSC=fs->make<TH2F>("hprofLocalAngleRmsCSC","Local CSC angle (rad) RMS residuals;Sector;;rad", 36,0,36,36,0,36);
768 
769  // histos options
770  Float_t labelSize=0.025;
771  hprofGlobalPositionDT->GetYaxis()->SetLabelSize(labelSize);
772  hprofGlobalAngleDT->GetYaxis()->SetLabelSize(labelSize);
773  hprofGlobalPositionRmsDT->GetYaxis()->SetLabelSize(labelSize);
774  hprofGlobalAngleRmsDT->GetYaxis()->SetLabelSize(labelSize);
775  hprofLocalPositionDT->GetYaxis()->SetLabelSize(labelSize);
776  hprofLocalAngleDT->GetYaxis()->SetLabelSize(labelSize);
777  hprofLocalPositionRmsDT->GetYaxis()->SetLabelSize(labelSize);
778  hprofLocalAngleRmsDT->GetYaxis()->SetLabelSize(labelSize);
779 
780  hprofGlobalPositionCSC->GetYaxis()->SetLabelSize(labelSize);
781  hprofGlobalAngleCSC->GetYaxis()->SetLabelSize(labelSize);
782  hprofGlobalPositionRmsCSC->GetYaxis()->SetLabelSize(labelSize);
783  hprofGlobalAngleRmsCSC->GetYaxis()->SetLabelSize(labelSize);
784  hprofLocalPositionCSC->GetYaxis()->SetLabelSize(labelSize);
785  hprofLocalAngleCSC->GetYaxis()->SetLabelSize(labelSize);
786  hprofLocalPositionRmsCSC->GetYaxis()->SetLabelSize(labelSize);
787  hprofLocalAngleRmsCSC->GetYaxis()->SetLabelSize(labelSize);
788 
789  char binLabel[15];
790  for (int i=1;i<15;i++){
791  snprintf(binLabel, sizeof(binLabel), "Sec-%d", i );
792  hprofGlobalPositionDT->GetXaxis()->SetBinLabel(i,binLabel);
793  hprofGlobalAngleDT->GetXaxis()->SetBinLabel(i,binLabel);
794  hprofGlobalPositionRmsDT->GetXaxis()->SetBinLabel(i,binLabel);
795  hprofGlobalAngleRmsDT->GetXaxis()->SetBinLabel(i,binLabel);
796  hprofLocalPositionDT->GetXaxis()->SetBinLabel(i,binLabel);
797  hprofLocalAngleDT->GetXaxis()->SetBinLabel(i,binLabel);
798  hprofLocalPositionRmsDT->GetXaxis()->SetBinLabel(i,binLabel);
799  hprofLocalAngleRmsDT->GetXaxis()->SetBinLabel(i,binLabel);
800  }
801 
802  for (int i=1;i<37;i++){
803  snprintf(binLabel, sizeof(binLabel), "Ch-%d", i );
804  hprofGlobalPositionCSC->GetXaxis()->SetBinLabel(i,binLabel);
805  hprofGlobalAngleCSC->GetXaxis()->SetBinLabel(i,binLabel);
806  hprofGlobalPositionRmsCSC->GetXaxis()->SetBinLabel(i,binLabel);
807  hprofGlobalAngleRmsCSC->GetXaxis()->SetBinLabel(i,binLabel);
808  hprofLocalPositionCSC->GetXaxis()->SetBinLabel(i,binLabel);
809  hprofLocalAngleCSC->GetXaxis()->SetBinLabel(i,binLabel);
810  hprofLocalPositionRmsCSC->GetXaxis()->SetBinLabel(i,binLabel);
811  hprofLocalAngleRmsCSC->GetXaxis()->SetBinLabel(i,binLabel);
812  }
813 
814  }
815 
816 }
817 
819 
820 
821  edm::LogInfo("MuonAlignmentAnalyzer") << "----------------- " << std::endl << std::endl;
822 
823  if(theDataType == "SimData")
824  edm::LogInfo("MuonAlignmentAnalyzer") << "Number of Sim tracks: " << numberOfSimTracks << std::endl << std::endl;
825 
826  if(doSAplots)
827  edm::LogInfo("MuonAlignmentAnalyzer") << "Number of SA Reco tracks: " << numberOfSARecTracks << std::endl << std::endl;
828 
829  if(doGBplots)
830  edm::LogInfo("MuonAlignmentAnalyzer") << "Number of GB Reco tracks: " << numberOfGBRecTracks << std::endl << std::endl;
831 
832  if(doResplots){
833 
834 // delete thePropagator;
835 
836  edm::LogInfo("MuonAlignmentAnalyzer") << "Number of Hits considered for residuals: " << numberOfHits << std::endl << std::endl;
837 
838 
839 
840  char binLabel[40];
841 
842  for(unsigned int i=0 ; i<unitsLocalX.size() ; i++)
843  {
844 
845  TString nameHistoLocalX=unitsLocalX[i]->GetName();
846 
847  TString nameHistoLocalPhi=unitsLocalPhi[i]->GetName();
848 
849  TString nameHistoLocalTheta=unitsLocalTheta[i]->GetName();
850 
851  TString nameHistoLocalY=unitsLocalY[i]->GetName();
852 
853  TString nameHistoGlobalRPhi=unitsGlobalRPhi[i]->GetName();
854 
855  TString nameHistoGlobalPhi=unitsGlobalPhi[i]->GetName();
856 
857  TString nameHistoGlobalTheta=unitsGlobalTheta[i]->GetName();
858 
859  TString nameHistoGlobalRZ=unitsGlobalRZ[i]->GetName();
860 
861  if (nameHistoLocalX.Contains("MB")) // HistoLocalX DT
862  {
863  int wheel, station, sector;
864 
865  sscanf(nameHistoLocalX, "ResidualLocalX_W%dMB%1dS%d",&wheel,&station,&sector);
866 
867  Int_t nstation=station - 1;
868  Int_t nwheel=wheel+2;
869 
870  Double_t MeanRPhi=unitsLocalX[i]->GetMean();
871  Double_t ErrorRPhi=unitsLocalX[i]->GetMeanError();
872 
873  Int_t xbin=sector+14*nstation+14*4*nwheel;
874 
875  snprintf(binLabel, sizeof(binLabel), "MB%d/%dS%d", wheel, station, sector );
876 
877  hprofLocalXDT->SetMarkerStyle(21);
878  hprofLocalXDT->SetMarkerColor(kRed);
879  hprofLocalXDT->SetBinContent(xbin,MeanRPhi);
880  hprofLocalXDT->SetBinError(xbin, ErrorRPhi);
881  hprofLocalXDT->GetXaxis()->SetBinLabel(xbin, binLabel);
882 
883  Int_t ybin=1+nwheel*8+nstation*2;
884  hprofLocalPositionDT->SetBinContent(sector,ybin,fabs(MeanRPhi));
885  snprintf(binLabel, sizeof(binLabel), "MB%d/%d_LocalX",wheel, station );
886  hprofLocalPositionDT->GetYaxis()->SetBinLabel(ybin,binLabel);
887  hprofLocalPositionRmsDT->SetBinContent(sector,ybin,ErrorRPhi);
888  hprofLocalPositionRmsDT->GetYaxis()->SetBinLabel(ybin,binLabel);
889  }
890 
891  if (nameHistoLocalX.Contains("ME")) // HistoLocalX CSC
892  {
893 
894  int station, ring, chamber;
895 
896  sscanf(nameHistoLocalX, "ResidualLocalX_ME%dR%1dC%d",&station,&ring,&chamber);
897 
898  Double_t MeanRPhi=unitsLocalX[i]->GetMean();
899  Double_t ErrorRPhi=unitsLocalX[i]->GetMeanError();
900 
901  Int_t xbin=abs(station)*2+ring;
902  if(abs(station)==1) xbin=ring;
903  if (station>0) xbin=xbin+9;
904  else xbin = 10 -xbin;
905 
906  // To avoid holes in xAxis, I can't imagine right now a simpler way...
907  if(xbin<5) xbin= 18*(((Int_t)(xbin/3))*2+(Int_t)(xbin/2))+chamber;
908  else if(xbin<6) xbin=108+chamber;
909  else if(xbin<14) xbin=126 +(xbin-6)*36+chamber;
910  else if(xbin<18) xbin=414+18*(((Int_t)(xbin-13)/3)*2+((Int_t)(xbin-13)/2))+chamber;
911  else xbin=522+chamber;
912 
913  snprintf(binLabel, sizeof(binLabel), "ME%d/%dC%d", station, ring, chamber );
914 
915  hprofLocalXCSC->SetMarkerStyle(21);
916  hprofLocalXCSC->SetMarkerColor(kRed);
917  hprofLocalXCSC->SetBinContent(xbin,MeanRPhi);
918  hprofLocalXCSC->SetBinError(xbin, ErrorRPhi);
919  hprofLocalXCSC->GetXaxis()->SetBinLabel(xbin, binLabel);
920 
921  Int_t ybin=abs(station)*2+ring;
922  if(abs(station)==1) ybin=ring;
923  if (station>0) ybin=ybin+9;
924  else ybin = 10 -ybin;
925  ybin=2*ybin-1;
926  hprofLocalPositionCSC->SetBinContent(chamber,ybin,fabs(MeanRPhi));
927  snprintf(binLabel, sizeof(binLabel), "ME%d/%d_LocalX", station,ring );
928  hprofLocalPositionCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
929  hprofLocalPositionRmsCSC->SetBinContent(chamber,ybin,ErrorRPhi);
930  hprofLocalPositionRmsCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
931  }
932 
933  if (nameHistoLocalTheta.Contains("MB")) // HistoLocalTheta DT
934  {
935 
936  int wheel, station, sector;
937 
938  sscanf(nameHistoLocalTheta, "ResidualLocalTheta_W%dMB%1dS%d",&wheel,&station,&sector);
939 
940  if(station != 4){
941  Int_t nstation=station - 1;
942  Int_t nwheel=wheel+2;
943 
944  Double_t MeanTheta=unitsLocalTheta[i]->GetMean();
945  Double_t ErrorTheta=unitsLocalTheta[i]->GetMeanError();
946 
947  Int_t xbin=sector+14*nstation+14*4*nwheel;
948 
949  snprintf(binLabel, sizeof(binLabel), "MB%d/%dS%d", wheel, station, sector );
950 
951  hprofLocalThetaDT->SetBinContent(xbin,MeanTheta);
952  hprofLocalThetaDT->SetBinError(xbin, ErrorTheta);
953  hprofLocalThetaDT->SetMarkerStyle(21);
954  hprofLocalThetaDT->SetMarkerColor(kRed);
955  hprofLocalThetaDT->GetXaxis()->SetBinLabel(xbin, binLabel);
956 
957  Int_t ybin=2+nwheel*8+nstation*2;
958  hprofLocalAngleDT->SetBinContent(sector,ybin,fabs(MeanTheta));
959  snprintf(binLabel, sizeof(binLabel), "MB%d/%d_LocalTheta",wheel,station );
960  hprofLocalAngleDT->GetYaxis()->SetBinLabel(ybin,binLabel);
961  hprofLocalAngleRmsDT->SetBinContent(sector,ybin,ErrorTheta);
962  hprofLocalAngleRmsDT->GetYaxis()->SetBinLabel(ybin,binLabel);
963 
964  }
965  }
966 
967  if (nameHistoLocalPhi.Contains("MB")) // HistoLocalPhi DT
968  {
969 
970  int wheel, station, sector;
971 
972  sscanf(nameHistoLocalPhi, "ResidualLocalPhi_W%dMB%1dS%d",&wheel,&station,&sector);
973 
974  Int_t nstation=station - 1;
975  Int_t nwheel=wheel+2;
976 
977  Double_t MeanPhi=unitsLocalPhi[i]->GetMean();
978  Double_t ErrorPhi=unitsLocalPhi[i]->GetMeanError();
979 
980  Int_t xbin=sector+14*nstation+14*4*nwheel;
981 
982  snprintf(binLabel, sizeof(binLabel), "MB%d/%dS%d", wheel, station, sector );
983 
984  hprofLocalPhiDT->SetBinContent(xbin,MeanPhi);
985  hprofLocalPhiDT->SetBinError(xbin, ErrorPhi);
986  hprofLocalPhiDT->SetMarkerStyle(21);
987  hprofLocalPhiDT->SetMarkerColor(kRed);
988  hprofLocalPhiDT->GetXaxis()->SetBinLabel(xbin, binLabel);
989 
990  Int_t ybin=1+nwheel*8+nstation*2;
991  hprofLocalAngleDT->SetBinContent(sector,ybin,fabs(MeanPhi));
992  snprintf(binLabel, sizeof(binLabel), "MB%d/%d_LocalPhi", wheel,station );
993  hprofLocalAngleDT->GetYaxis()->SetBinLabel(ybin,binLabel);
994  hprofLocalAngleRmsDT->SetBinContent(sector,ybin,ErrorPhi);
995  hprofLocalAngleRmsDT->GetYaxis()->SetBinLabel(ybin,binLabel);
996  }
997 
998  if (nameHistoLocalPhi.Contains("ME")) // HistoLocalPhi CSC
999  {
1000 
1001  int station, ring, chamber;
1002 
1003  sscanf(nameHistoLocalPhi, "ResidualLocalPhi_ME%dR%1dC%d",&station,&ring,&chamber);
1004 
1005  Double_t MeanPhi=unitsLocalPhi[i]->GetMean();
1006  Double_t ErrorPhi=unitsLocalPhi[i]->GetMeanError();
1007 
1008  Int_t xbin=abs(station)*2+ring;
1009  if(abs(station)==1) xbin=ring;
1010  if (station>0) xbin=xbin+9;
1011  else xbin = 10 -xbin;
1012 
1013  // To avoid holes in xAxis, I can't imagine right now a simpler way...
1014  if(xbin<5) xbin= 18*(((Int_t)(xbin/3))*2+(Int_t)(xbin/2))+chamber;
1015  else if(xbin<6) xbin=108+chamber;
1016  else if(xbin<14) xbin=126 +(xbin-6)*36+chamber;
1017  else if(xbin<18) xbin=414+18*(((Int_t)(xbin-13)/3)*2+((Int_t)(xbin-13)/2))+chamber;
1018  else xbin=522+chamber;
1019 
1020  snprintf(binLabel, sizeof(binLabel), "ME%d/%dC%d", station, ring, chamber );
1021 
1022  hprofLocalPhiCSC->SetMarkerStyle(21);
1023  hprofLocalPhiCSC->SetMarkerColor(kRed);
1024  hprofLocalPhiCSC->SetBinContent(xbin,MeanPhi);
1025  hprofLocalPhiCSC->SetBinError(xbin, ErrorPhi);
1026  hprofLocalPhiCSC->GetXaxis()->SetBinLabel(xbin, binLabel);
1027 
1028  Int_t ybin=abs(station)*2+ring;
1029  if(abs(station)==1) ybin=ring;
1030  if (station>0) ybin=ybin+9;
1031  else ybin = 10 -ybin;
1032  ybin=2*ybin-1;
1033  hprofLocalAngleCSC->SetBinContent(chamber,ybin,fabs(MeanPhi));
1034  snprintf(binLabel, sizeof(binLabel), "ME%d/%d_LocalPhi", station,ring );
1035  hprofLocalAngleCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
1036  hprofLocalAngleRmsCSC->SetBinContent(chamber,ybin,ErrorPhi);
1037  hprofLocalAngleRmsCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
1038  }
1039 
1040  if (nameHistoLocalTheta.Contains("ME")) // HistoLocalTheta CSC
1041  {
1042 
1043  int station, ring, chamber;
1044 
1045  sscanf(nameHistoLocalTheta, "ResidualLocalTheta_ME%dR%1dC%d",&station,&ring,&chamber);
1046 
1047  Double_t MeanTheta=unitsLocalTheta[i]->GetMean();
1048  Double_t ErrorTheta=unitsLocalTheta[i]->GetMeanError();
1049 
1050  Int_t xbin=abs(station)*2+ring;
1051  if(abs(station)==1) xbin=ring;
1052  if (station>0) xbin=xbin+9;
1053  else xbin = 10 -xbin;
1054 
1055  // To avoid holes in xAxis, I can't imagine right now a simpler way...
1056  if(xbin<5) xbin= 18*(((Int_t)(xbin/3))*2+(Int_t)(xbin/2))+chamber;
1057  else if(xbin<6) xbin=108+chamber;
1058  else if(xbin<14) xbin=126 +(xbin-6)*36+chamber;
1059  else if(xbin<18) xbin=414+18*(((Int_t)(xbin-13)/3)*2+((Int_t)(xbin-13)/2))+chamber;
1060  else xbin=522+chamber;
1061 
1062  snprintf(binLabel, sizeof(binLabel), "ME%d/%dC%d", station, ring, chamber );
1063 
1064  hprofLocalThetaCSC->SetMarkerStyle(21);
1065  hprofLocalThetaCSC->SetMarkerColor(kRed);
1066  hprofLocalThetaCSC->SetBinContent(xbin,MeanTheta);
1067  hprofLocalThetaCSC->SetBinError(xbin, ErrorTheta);
1068  hprofLocalThetaCSC->GetXaxis()->SetBinLabel(xbin, binLabel);
1069 
1070  Int_t ybin=abs(station)*2+ring;
1071  if(abs(station)==1) ybin=ring;
1072  if (station>0) ybin=ybin+9;
1073  else ybin = 10 -ybin;
1074  ybin=2*ybin;
1075  hprofLocalAngleCSC->SetBinContent(chamber,ybin,fabs(MeanTheta));
1076  snprintf(binLabel, sizeof(binLabel), "ME%d/%d_LocalTheta", station,ring );
1077  hprofLocalAngleCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
1078  hprofLocalAngleRmsCSC->SetBinContent(chamber,ybin,ErrorTheta);
1079  hprofLocalAngleRmsCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
1080  }
1081 
1082  if (nameHistoLocalY.Contains("MB")) // HistoLocalY DT
1083  {
1084 
1085  int wheel, station, sector;
1086 
1087  sscanf(nameHistoLocalY, "ResidualLocalY_W%dMB%1dS%d",&wheel,&station,&sector);
1088 
1089  if(station!=4){
1090  Int_t nstation=station - 1;
1091  Int_t nwheel=wheel+2;
1092 
1093  Double_t MeanZ=unitsLocalY[i]->GetMean();
1094  Double_t ErrorZ=unitsLocalY[i]->GetMeanError();
1095 
1096  Int_t xbin=sector+14*nstation+14*4*nwheel;
1097 
1098  snprintf(binLabel, sizeof(binLabel), "MB%d/%dS%d", wheel, station, sector );
1099 
1100  hprofLocalYDT->SetMarkerStyle(21);
1101  hprofLocalYDT->SetMarkerColor(kRed);
1102  hprofLocalYDT->SetBinContent(xbin,MeanZ);
1103  hprofLocalYDT->SetBinError(xbin, ErrorZ);
1104  hprofLocalYDT->GetXaxis()->SetBinLabel(xbin, binLabel);
1105 
1106  Int_t ybin=2+nwheel*8+nstation*2;
1107  hprofLocalPositionDT->SetBinContent(sector,ybin,fabs(MeanZ));
1108  snprintf(binLabel, sizeof(binLabel), "MB%d/%d_LocalY", wheel,station );
1109  hprofLocalPositionDT->GetYaxis()->SetBinLabel(ybin,binLabel);
1110  hprofLocalPositionRmsDT->SetBinContent(sector,ybin,ErrorZ);
1111  hprofLocalPositionRmsDT->GetYaxis()->SetBinLabel(ybin,binLabel);
1112  }
1113  }
1114 
1115  if (nameHistoLocalY.Contains("ME")) // HistoLocalY CSC
1116  {
1117 
1118  int station, ring, chamber;
1119 
1120  sscanf(nameHistoLocalY, "ResidualLocalY_ME%dR%1dC%d",&station,&ring,&chamber);
1121 
1122  Double_t MeanR=unitsLocalY[i]->GetMean();
1123  Double_t ErrorR=unitsLocalY[i]->GetMeanError();
1124 
1125  Int_t xbin=abs(station)*2+ring;
1126  if(abs(station)==1) xbin=ring;
1127  if (station>0) xbin=xbin+9;
1128  else xbin = 10 -xbin;
1129 
1130  // To avoid holes in xAxis, I can't imagine right now a simpler way...
1131  if(xbin<5) xbin= 18*(((Int_t)(xbin/3))*2+(Int_t)(xbin/2))+chamber;
1132  else if(xbin<6) xbin=108+chamber;
1133  else if(xbin<14) xbin=126 +(xbin-6)*36+chamber;
1134  else if(xbin<18) xbin=414+18*(((Int_t)(xbin-13)/3)*2+((Int_t)(xbin-13)/2))+chamber;
1135  else xbin=522+chamber;
1136 
1137  snprintf(binLabel, sizeof(binLabel), "ME%d/%dC%d", station, ring, chamber );
1138 
1139  hprofLocalYCSC->SetMarkerStyle(21);
1140  hprofLocalYCSC->SetMarkerColor(kRed);
1141  hprofLocalYCSC->SetBinContent(xbin,MeanR);
1142  hprofLocalYCSC->SetBinError(xbin, ErrorR);
1143  hprofLocalYCSC->GetXaxis()->SetBinLabel(xbin, binLabel);
1144 
1145  Int_t ybin=abs(station)*2+ring;
1146  if(abs(station)==1) ybin=ring;
1147  if (station>0) ybin=ybin+9;
1148  else ybin = 10 -ybin;
1149  ybin=2*ybin;
1150  hprofLocalPositionCSC->SetBinContent(chamber,ybin,fabs(MeanR));
1151  snprintf(binLabel, sizeof(binLabel), "ME%d/%d_LocalY", station,ring );
1152  hprofLocalPositionCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
1153  hprofLocalPositionRmsCSC->SetBinContent(chamber,ybin,ErrorR);
1154  hprofLocalPositionRmsCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
1155  }
1156 
1157  if (nameHistoGlobalRPhi.Contains("MB")) // HistoGlobalRPhi DT
1158  {
1159  int wheel, station, sector;
1160 
1161  sscanf(nameHistoGlobalRPhi, "ResidualGlobalRPhi_W%dMB%1dS%d",&wheel,&station,&sector);
1162 
1163  Int_t nstation=station - 1;
1164  Int_t nwheel=wheel+2;
1165 
1166  Double_t MeanRPhi=unitsGlobalRPhi[i]->GetMean();
1167  Double_t ErrorRPhi=unitsGlobalRPhi[i]->GetMeanError();
1168 
1169  Int_t xbin=sector+14*nstation+14*4*nwheel;
1170 
1171  snprintf(binLabel, sizeof(binLabel), "MB%d/%dS%d", wheel, station, sector );
1172 
1173  hprofGlobalRPhiDT->SetMarkerStyle(21);
1174  hprofGlobalRPhiDT->SetMarkerColor(kRed);
1175  hprofGlobalRPhiDT->SetBinContent(xbin,MeanRPhi);
1176  hprofGlobalRPhiDT->SetBinError(xbin, ErrorRPhi);
1177  hprofGlobalRPhiDT->GetXaxis()->SetBinLabel(xbin, binLabel);
1178 
1179  Int_t ybin=1+nwheel*8+nstation*2;
1180  hprofGlobalPositionDT->SetBinContent(sector,ybin,fabs(MeanRPhi));
1181  snprintf(binLabel, sizeof(binLabel), "MB%d/%d_GlobalRPhi", wheel,station );
1182  hprofGlobalPositionDT->GetYaxis()->SetBinLabel(ybin,binLabel);
1183  hprofGlobalPositionRmsDT->SetBinContent(sector,ybin,ErrorRPhi);
1184  hprofGlobalPositionRmsDT->GetYaxis()->SetBinLabel(ybin,binLabel);
1185  }
1186 
1187  if (nameHistoGlobalRPhi.Contains("ME")) // HistoGlobalRPhi CSC
1188  {
1189 
1190  int station, ring, chamber;
1191 
1192  sscanf(nameHistoGlobalRPhi, "ResidualGlobalRPhi_ME%dR%1dC%d",&station,&ring,&chamber);
1193 
1194  Double_t MeanRPhi=unitsGlobalRPhi[i]->GetMean();
1195  Double_t ErrorRPhi=unitsGlobalRPhi[i]->GetMeanError();
1196 
1197  Int_t xbin=abs(station)*2+ring;
1198  if(abs(station)==1) xbin=ring;
1199  if (station>0) xbin=xbin+9;
1200  else xbin = 10 -xbin;
1201 
1202  // To avoid holes in xAxis, I can't imagine right now a simpler way...
1203  if(xbin<5) xbin= 18*(((Int_t)(xbin/3))*2+(Int_t)(xbin/2))+chamber;
1204  else if(xbin<6) xbin=108+chamber;
1205  else if(xbin<14) xbin=126 +(xbin-6)*36+chamber;
1206  else if(xbin<18) xbin=414+18*(((Int_t)(xbin-13)/3)*2+((Int_t)(xbin-13)/2))+chamber;
1207  else xbin=522+chamber;
1208 
1209  snprintf(binLabel, sizeof(binLabel), "ME%d/%dC%d", station, ring, chamber );
1210 
1211  hprofGlobalRPhiCSC->SetMarkerStyle(21);
1212  hprofGlobalRPhiCSC->SetMarkerColor(kRed);
1213  hprofGlobalRPhiCSC->SetBinContent(xbin,MeanRPhi);
1214  hprofGlobalRPhiCSC->SetBinError(xbin, ErrorRPhi);
1215  hprofGlobalRPhiCSC->GetXaxis()->SetBinLabel(xbin, binLabel);
1216 
1217  Int_t ybin=abs(station)*2+ring;
1218  if(abs(station)==1) ybin=ring;
1219  if (station>0) ybin=ybin+9;
1220  else ybin = 10 -ybin;
1221  ybin=2*ybin-1;
1222  hprofGlobalPositionCSC->SetBinContent(chamber,ybin,fabs(MeanRPhi));
1223  snprintf(binLabel, sizeof(binLabel), "ME%d/%d_GlobalRPhi", station,ring );
1224  hprofGlobalPositionCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
1225  hprofGlobalPositionRmsCSC->SetBinContent(chamber,ybin,ErrorRPhi);
1226  hprofGlobalPositionRmsCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
1227  }
1228 
1229  if (nameHistoGlobalTheta.Contains("MB")) // HistoGlobalRTheta DT
1230  {
1231 
1232  int wheel, station, sector;
1233 
1234  sscanf(nameHistoGlobalTheta, "ResidualGlobalTheta_W%dMB%1dS%d",&wheel,&station,&sector);
1235 
1236  if(station!=4){
1237  Int_t nstation=station - 1;
1238  Int_t nwheel=wheel+2;
1239 
1240  Double_t MeanTheta=unitsGlobalTheta[i]->GetMean();
1241  Double_t ErrorTheta=unitsGlobalTheta[i]->GetMeanError();
1242 
1243  Int_t xbin=sector+14*nstation+14*4*nwheel;
1244 
1245  snprintf(binLabel, sizeof(binLabel), "MB%d/%dS%d", wheel, station, sector );
1246 
1247  hprofGlobalThetaDT->SetBinContent(xbin,MeanTheta);
1248  hprofGlobalThetaDT->SetBinError(xbin, ErrorTheta);
1249  hprofGlobalThetaDT->SetMarkerStyle(21);
1250  hprofGlobalThetaDT->SetMarkerColor(kRed);
1251  hprofGlobalThetaDT->GetXaxis()->SetBinLabel(xbin, binLabel);
1252 
1253  Int_t ybin=2+nwheel*8+nstation*2;
1254  hprofGlobalAngleDT->SetBinContent(sector,ybin,fabs(MeanTheta));
1255  snprintf(binLabel, sizeof(binLabel), "MB%d/%d_GlobalTheta", wheel,station );
1256  hprofGlobalAngleDT->GetYaxis()->SetBinLabel(ybin,binLabel);
1257  hprofGlobalAngleRmsDT->SetBinContent(sector,ybin,ErrorTheta);
1258  hprofGlobalAngleRmsDT->GetYaxis()->SetBinLabel(ybin,binLabel);
1259  }
1260  }
1261 
1262  if (nameHistoGlobalPhi.Contains("MB")) // HistoGlobalPhi DT
1263  {
1264 
1265  int wheel, station, sector;
1266 
1267  sscanf(nameHistoGlobalPhi, "ResidualGlobalPhi_W%dMB%1dS%d",&wheel,&station,&sector);
1268 
1269  Int_t nstation=station - 1;
1270  Int_t nwheel=wheel+2;
1271 
1272  Double_t MeanPhi=unitsGlobalPhi[i]->GetMean();
1273  Double_t ErrorPhi=unitsGlobalPhi[i]->GetMeanError();
1274 
1275  Int_t xbin=sector+14*nstation+14*4*nwheel;
1276 
1277  snprintf(binLabel, sizeof(binLabel), "MB%d/%dS%d", wheel, station, sector );
1278 
1279  hprofGlobalPhiDT->SetBinContent(xbin,MeanPhi);
1280  hprofGlobalPhiDT->SetBinError(xbin, ErrorPhi);
1281  hprofGlobalPhiDT->SetMarkerStyle(21);
1282  hprofGlobalPhiDT->SetMarkerColor(kRed);
1283  hprofGlobalPhiDT->GetXaxis()->SetBinLabel(xbin, binLabel);
1284 
1285  Int_t ybin=1+nwheel*8+nstation*2;
1286  hprofGlobalAngleDT->SetBinContent(sector,ybin,fabs(MeanPhi));
1287  snprintf(binLabel, sizeof(binLabel), "MB%d/%d_GlobalPhi", wheel,station );
1288  hprofGlobalAngleDT->GetYaxis()->SetBinLabel(ybin,binLabel);
1289  hprofGlobalAngleRmsDT->SetBinContent(sector,ybin,ErrorPhi);
1290  hprofGlobalAngleRmsDT->GetYaxis()->SetBinLabel(ybin,binLabel);
1291  }
1292 
1293  if (nameHistoGlobalPhi.Contains("ME")) // HistoGlobalPhi CSC
1294  {
1295 
1296  int station, ring, chamber;
1297 
1298  sscanf(nameHistoGlobalPhi, "ResidualGlobalPhi_ME%dR%1dC%d",&station,&ring,&chamber);
1299 
1300  Double_t MeanPhi=unitsGlobalPhi[i]->GetMean();
1301  Double_t ErrorPhi=unitsGlobalPhi[i]->GetMeanError();
1302 
1303  Int_t xbin=abs(station)*2+ring;
1304  if(abs(station)==1) xbin=ring;
1305  if (station>0) xbin=xbin+9;
1306  else xbin = 10 -xbin;
1307 
1308  // To avoid holes in xAxis, I can't imagine right now a simpler way...
1309  if(xbin<5) xbin= 18*(((Int_t)(xbin/3))*2+(Int_t)(xbin/2))+chamber;
1310  else if(xbin<6) xbin=108+chamber;
1311  else if(xbin<14) xbin=126 +(xbin-6)*36+chamber;
1312  else if(xbin<18) xbin=414+18*(((Int_t)(xbin-13)/3)*2+((Int_t)(xbin-13)/2))+chamber;
1313  else xbin=522+chamber;
1314 
1315  snprintf(binLabel, sizeof(binLabel), "ME%d/%dC%d", station, ring, chamber );
1316 
1317  hprofGlobalPhiCSC->SetMarkerStyle(21);
1318  hprofGlobalPhiCSC->SetMarkerColor(kRed);
1319  hprofGlobalPhiCSC->SetBinContent(xbin,MeanPhi);
1320  hprofGlobalPhiCSC->SetBinError(xbin, ErrorPhi);
1321  hprofGlobalPhiCSC->GetXaxis()->SetBinLabel(xbin, binLabel);
1322 
1323  Int_t ybin=abs(station)*2+ring;
1324  if(abs(station)==1) ybin=ring;
1325  if (station>0) ybin=ybin+9;
1326  else ybin = 10 -ybin;
1327  ybin=2*ybin-1;
1328  hprofGlobalAngleCSC->SetBinContent(chamber,ybin,fabs(MeanPhi));
1329  snprintf(binLabel, sizeof(binLabel), "ME%d/%d_GlobalPhi", station,ring );
1330  hprofGlobalAngleCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
1331  hprofGlobalAngleRmsCSC->SetBinContent(chamber,ybin,ErrorPhi);
1332  hprofGlobalAngleRmsCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
1333  }
1334 
1335  if (nameHistoGlobalTheta.Contains("ME")) // HistoGlobalTheta CSC
1336  {
1337 
1338  int station, ring, chamber;
1339 
1340  sscanf(nameHistoGlobalTheta, "ResidualGlobalTheta_ME%dR%1dC%d",&station,&ring,&chamber);
1341 
1342  Double_t MeanTheta=unitsGlobalTheta[i]->GetMean();
1343  Double_t ErrorTheta=unitsGlobalTheta[i]->GetMeanError();
1344 
1345  Int_t xbin=abs(station)*2+ring;
1346  if(abs(station)==1) xbin=ring;
1347  if (station>0) xbin=xbin+9;
1348  else xbin = 10 -xbin;
1349 
1350  // To avoid holes in xAxis, I can't imagine right now a simpler way...
1351  if(xbin<5) xbin= 18*(((Int_t)(xbin/3))*2+(Int_t)(xbin/2))+chamber;
1352  else if(xbin<6) xbin=108+chamber;
1353  else if(xbin<14) xbin=126 +(xbin-6)*36+chamber;
1354  else if(xbin<18) xbin=414+18*(((Int_t)(xbin-13)/3)*2+((Int_t)(xbin-13)/2))+chamber;
1355  else xbin=522+chamber;
1356 
1357  snprintf(binLabel, sizeof(binLabel), "ME%d/%dC%d", station, ring, chamber );
1358 
1359  hprofGlobalThetaCSC->SetMarkerStyle(21);
1360  hprofGlobalThetaCSC->SetMarkerColor(kRed);
1361  hprofGlobalThetaCSC->SetBinContent(xbin,MeanTheta);
1362  hprofGlobalThetaCSC->SetBinError(xbin, ErrorTheta);
1363  hprofGlobalThetaCSC->GetXaxis()->SetBinLabel(xbin, binLabel);
1364 
1365  Int_t ybin=abs(station)*2+ring;
1366  if(abs(station)==1) ybin=ring;
1367  if (station>0) ybin=ybin+9;
1368  else ybin = 10 -ybin;
1369  ybin=2*ybin;
1370  hprofGlobalAngleCSC->SetBinContent(chamber,ybin,fabs(MeanTheta));
1371  snprintf(binLabel, sizeof(binLabel), "ME%d/%d_GlobalTheta", station,ring );
1372  hprofGlobalAngleCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
1373  hprofGlobalAngleRmsCSC->SetBinContent(chamber,ybin,ErrorTheta);
1374  hprofGlobalAngleRmsCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
1375  }
1376 
1377  if (nameHistoGlobalRZ.Contains("MB")) // HistoGlobalZ DT
1378  {
1379 
1380  int wheel, station, sector;
1381 
1382  sscanf(nameHistoGlobalRZ, "ResidualGlobalZ_W%dMB%1dS%d",&wheel,&station,&sector);
1383 
1384  if(station!=4){
1385  Int_t nstation=station - 1;
1386  Int_t nwheel=wheel+2;
1387 
1388  Double_t MeanZ=unitsGlobalRZ[i]->GetMean();
1389  Double_t ErrorZ=unitsGlobalRZ[i]->GetMeanError();
1390 
1391  Int_t xbin=sector+14*nstation+14*4*nwheel;
1392 
1393  snprintf(binLabel, sizeof(binLabel), "MB%d/%dS%d", wheel, station, sector );
1394 
1395  hprofGlobalZDT->SetMarkerStyle(21);
1396  hprofGlobalZDT->SetMarkerColor(kRed);
1397 
1398  hprofGlobalZDT->SetBinContent(xbin,MeanZ);
1399  hprofGlobalZDT->SetBinError(xbin, ErrorZ);
1400  hprofGlobalZDT->GetXaxis()->SetBinLabel(xbin, binLabel);
1401 
1402  Int_t ybin=2+nwheel*8+nstation*2;
1403  hprofGlobalPositionDT->SetBinContent(sector,ybin,fabs(MeanZ));
1404  snprintf(binLabel, sizeof(binLabel), "MB%d/%d_GlobalZ", wheel,station );
1405  hprofGlobalPositionDT->GetYaxis()->SetBinLabel(ybin,binLabel);
1406  hprofGlobalPositionRmsDT->SetBinContent(sector,ybin,ErrorZ);
1407  hprofGlobalPositionRmsDT->GetYaxis()->SetBinLabel(ybin,binLabel);
1408  }
1409  }
1410 
1411  if (nameHistoGlobalRZ.Contains("ME")) // HistoGlobalR CSC
1412  {
1413 
1414  int station, ring, chamber;
1415 
1416  sscanf(nameHistoGlobalRZ, "ResidualGlobalR_ME%dR%1dC%d",&station,&ring,&chamber);
1417 
1418  Double_t MeanR=unitsGlobalRZ[i]->GetMean();
1419  Double_t ErrorR=unitsGlobalRZ[i]->GetMeanError();
1420 
1421  Int_t xbin=abs(station)*2+ring;
1422  if(abs(station)==1) xbin=ring;
1423  if (station>0) xbin=xbin+9;
1424  else xbin = 10 -xbin;
1425 
1426  // To avoid holes in xAxis, I can't imagine right now a simpler way...
1427  if(xbin<5) xbin= 18*(((Int_t)(xbin/3))*2+(Int_t)(xbin/2))+chamber;
1428  else if(xbin<6) xbin=108+chamber;
1429  else if(xbin<14) xbin=126 +(xbin-6)*36+chamber;
1430  else if(xbin<18) xbin=414+18*(((Int_t)(xbin-13)/3)*2+((Int_t)(xbin-13)/2))+chamber;
1431  else xbin=522+chamber;
1432 
1433  snprintf(binLabel, sizeof(binLabel), "ME%d/%dC%d", station, ring, chamber );
1434 
1435  hprofGlobalRCSC->SetMarkerStyle(21);
1436  hprofGlobalRCSC->SetMarkerColor(kRed);
1437  hprofGlobalRCSC->SetBinContent(xbin,MeanR);
1438  hprofGlobalRCSC->SetBinError(xbin, ErrorR);
1439  hprofGlobalRCSC->GetXaxis()->SetBinLabel(xbin, binLabel);
1440 
1441  Int_t ybin=abs(station)*2+ring;
1442  if(abs(station)==1) ybin=ring;
1443  if (station>0) ybin=ybin+9;
1444  else ybin = 10 -ybin;
1445  ybin=2*ybin;
1446  hprofGlobalPositionCSC->SetBinContent(chamber,ybin,fabs(MeanR));
1447  snprintf(binLabel, sizeof(binLabel), "ME%d/%d_GlobalR", station,ring );
1448  hprofGlobalPositionCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
1449  hprofGlobalPositionRmsCSC->SetBinContent(chamber,ybin,ErrorR);
1450  hprofGlobalPositionRmsCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
1451  }
1452 
1453  } // for in histos
1454 
1455  } // doResPlots
1456 
1457 }
1458 
1459 
1461 
1462  GlobalVector p1,p2;
1463  std::vector< double > simPar[4] ; //pt,eta,phi,charge
1464 
1465 
1466 // ######### if data= MC, do Simulation Plots#####
1467  if(theDataType == "SimData"){
1468  double simEta=0;
1469  double simPt=0;
1470  double simPhi=0;
1471  int i=0, ie=0,ib=0;
1472 
1473  // Get the SimTrack collection from the event
1475  event.getByLabel("g4SimHits",simTracks);
1476 
1477 
1478  edm::SimTrackContainer::const_iterator simTrack;
1479 
1480  for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack){
1481  if (abs((*simTrack).type()) == 13) {
1482  i++;
1483  simPt=(*simTrack).momentum().Pt();
1484  simEta=(*simTrack).momentum().eta();
1485  simPhi=(*simTrack).momentum().phi();
1487  hSimPT->Fill(simPt);
1488  if(fabs(simEta)<1.04) {hSimPT_Barrel->Fill(simPt);ib++;}
1489  else {hSimPT_Endcap->Fill(simPt);ie++;}
1490  hSimPTvsEta->Fill(simEta,simPt);
1491  hSimPTvsPhi->Fill(simPhi,simPt);
1492  hSimPhivsEta->Fill(simEta,simPhi);
1493 
1494  simPar[0].push_back(simPt);
1495  simPar[1].push_back(simEta);
1496  simPar[2].push_back(simPhi);
1497  simPar[3].push_back((*simTrack).charge());
1498 
1499 // Save the muon pair
1500  if(i==1) p1=GlobalVector((*simTrack).momentum().x(),(*simTrack).momentum().y(),(*simTrack).momentum().z());
1501  if(i==2) p2=GlobalVector((*simTrack).momentum().x(),(*simTrack).momentum().y(),(*simTrack).momentum().z());
1502  }
1503  }
1504  hSimNmuons->Fill(i);
1505  hSimNmuons_Barrel->Fill(ib);
1506  hSimNmuons_Endcap->Fill(ie);
1507 
1508  if(i>1){ // Take 2 first muons :-(
1509  TLorentzVector mu1(p1.x(), p1.y(), p1.z(), p1.mag());
1510  TLorentzVector mu2(p2.x(), p2.y(), p2.z(), p2.mag());
1511  TLorentzVector pair = mu1 + mu2;
1512  double Minv = pair.M();
1513  hSimInvM->Fill(Minv);
1514  if(fabs(p1.eta())<1.04 && fabs(p2.eta())<1.04) hSimInvM_Barrel->Fill(Minv);
1515  else if(fabs(p1.eta())>=1.04 && fabs(p2.eta())>=1.04) hSimInvM_Endcap->Fill(Minv);
1516  else hSimInvM_Overlap->Fill(Minv);
1517  }
1518 
1519  } //simData
1520 
1521 
1522 // ############ Stand Alone Muon plots ###############
1523  if(doSAplots){
1524 
1525  double SArecPt=0.;
1526  double SAeta=0.;
1527  double SAphi=0.;
1528  int i=0, ie=0,ib=0;
1529  double ich=0;
1530 
1531  // Get the RecTrack collection from the event
1533  event.getByLabel(theSTAMuonTag, staTracks);
1534  numberOfSARecTracks += staTracks->size();
1535 
1536  reco::TrackCollection::const_iterator staTrack;
1537 
1538  for (staTrack = staTracks->begin(); staTrack != staTracks->end(); ++staTrack){
1539  i++;
1540 
1541  SArecPt = (*staTrack).pt();
1542  SAeta = (*staTrack).eta();
1543  SAphi = (*staTrack).phi();
1544  ich= (*staTrack).charge();
1545 
1546  hSAPTRec->Fill(SArecPt);
1547  hSAPhivsEta->Fill(SAeta,SAphi);
1548  hSAChi2->Fill((*staTrack).chi2());
1549  hSANhits->Fill((*staTrack).numberOfValidHits());
1550  if(fabs(SAeta)<1.04) {hSAPTRec_Barrel->Fill(SArecPt); hSAChi2_Barrel->Fill((*staTrack).chi2()); hSANhits_Barrel->Fill((*staTrack).numberOfValidHits()); ib++;}
1551  else {hSAPTRec_Endcap->Fill(SArecPt); hSAChi2_Endcap->Fill((*staTrack).chi2()); hSANhits_Endcap->Fill((*staTrack).numberOfValidHits()); ie++;}
1552 
1553 // save the muon pair
1554  if(i==1) p1=GlobalVector((*staTrack).momentum().x(),(*staTrack).momentum().y(),(*staTrack).momentum().z());
1555  if(i==2) p2=GlobalVector((*staTrack).momentum().x(),(*staTrack).momentum().y(),(*staTrack).momentum().z());
1556 
1557 
1558  if(SArecPt && theDataType == "SimData"){
1559 
1560  double candDeltaR= -999.0, dR;
1561  int iCand=0;
1562  if(!simPar[0].empty()){
1563  for(unsigned int iSim = 0; iSim <simPar[0].size(); iSim++) {
1564  dR=deltaR(SAeta,SAphi,simPar[1][iSim],simPar[2][iSim]);
1565  if(candDeltaR<0 || dR<candDeltaR) {
1566  candDeltaR=dR;
1567  iCand=iSim;
1568  }
1569  }}
1570 
1571  double simPt=simPar[0][iCand];
1572  hSAPTres->Fill( (SArecPt-simPt)/simPt);
1573  if(fabs(SAeta)<1.04) hSAPTres_Barrel->Fill((SArecPt-simPt)/simPt);
1574  else hSAPTres_Endcap->Fill((SArecPt-simPt)/simPt);
1575 
1576  hSAPTDiff->Fill(SArecPt-simPt);
1577 
1578  hSAPTDiffvsEta->Fill(SAeta,SArecPt-simPt);
1579  hSAPTDiffvsPhi->Fill(SAphi,SArecPt-simPt);
1580  double ptInvRes= ( ich/SArecPt - simPar[3][iCand]/simPt)/ (simPar[3][iCand]/simPt);
1581  hSAinvPTres->Fill( ptInvRes);
1582 
1583  hSAinvPTvsEta->Fill(SAeta,ptInvRes);
1584  hSAinvPTvsPhi->Fill(SAphi,ptInvRes);
1585  hSAinvPTvsNhits->Fill((*staTrack).numberOfValidHits(),ptInvRes);
1586  }
1587 
1588  hSAPTvsEta->Fill(SAeta,SArecPt);
1589  hSAPTvsPhi->Fill(SAphi,SArecPt);
1590  }
1591 
1592  hSANmuons->Fill(i);
1593  hSANmuons_Barrel->Fill(ib);
1594  hSANmuons_Endcap->Fill(ie);
1595 
1596  if(i>1){ // Take 2 first muons :-(
1597  TLorentzVector mu1(p1.x(), p1.y(), p1.z(), p1.mag());
1598  TLorentzVector mu2(p2.x(), p2.y(), p2.z(), p2.mag());
1599  TLorentzVector pair = mu1 + mu2;
1600  double Minv = pair.M();
1601  hSAInvM->Fill(Minv);
1602  if(fabs(p1.eta())<1.04 && fabs(p2.eta())<1.04) hSAInvM_Barrel->Fill(Minv);
1603  else if(fabs(p1.eta())>=1.04 && fabs(p2.eta())>=1.04) hSAInvM_Endcap->Fill(Minv);
1604  else hSAInvM_Overlap->Fill(Minv);
1605  } // 2 first muons
1606 
1607  }//end doSAplots
1608 
1609 
1610 
1611 // ############### Global Muons plots ##########
1612 
1613  if(doGBplots){
1614  // Get the RecTrack collection from the event
1616  event.getByLabel(theGLBMuonTag, glbTracks);
1617  numberOfGBRecTracks += glbTracks->size();
1618 
1619  double GBrecPt = 0;
1620  double GBeta = 0;
1621  double GBphi = 0;
1622  double ich =0;
1623  int i=0, ie=0,ib=0;
1624 
1625  reco::TrackCollection::const_iterator glbTrack;
1626 
1627  for (glbTrack = glbTracks->begin(); glbTrack != glbTracks->end(); ++glbTrack){
1628  i++;
1629 
1630  GBrecPt = (*glbTrack).pt();
1631  GBeta = (*glbTrack).eta();
1632  GBphi = (*glbTrack).phi();
1633  ich= (*glbTrack).charge();
1634 
1635  hGBPTRec->Fill(GBrecPt);
1636  hGBPhivsEta->Fill(GBeta,GBphi);
1637  hGBChi2->Fill((*glbTrack).chi2());
1638  hGBNhits->Fill((*glbTrack).numberOfValidHits());
1639  if(fabs(GBeta)<1.04) {hGBPTRec_Barrel->Fill(GBrecPt); hGBChi2_Barrel->Fill((*glbTrack).chi2()); hGBNhits_Barrel->Fill((*glbTrack).numberOfValidHits()); ib++;}
1640  else {hGBPTRec_Endcap->Fill(GBrecPt); hGBChi2_Endcap->Fill((*glbTrack).chi2()); hGBNhits_Endcap->Fill((*glbTrack).numberOfValidHits()); ie++;}
1641 
1642 // save the muon pair
1643  if(i==1) p1=GlobalVector((*glbTrack).momentum().x(),(*glbTrack).momentum().y(),(*glbTrack).momentum().z());
1644  if(i==2) p2=GlobalVector((*glbTrack).momentum().x(),(*glbTrack).momentum().y(),(*glbTrack).momentum().z());
1645 
1646  if(GBrecPt && theDataType == "SimData"){
1647  double candDeltaR= -999.0, dR;
1648  int iCand=0;
1649  if(!simPar[0].empty()){
1650  for(unsigned int iSim = 0; iSim <simPar[0].size(); iSim++) {
1651  dR=deltaR(GBeta,GBphi,simPar[1][iSim],simPar[2][iSim]);
1652  if(candDeltaR<0 || dR<candDeltaR) {
1653  candDeltaR=dR;
1654  iCand=iSim;
1655  }
1656  }}
1657 
1658  double simPt=simPar[0][iCand];
1659 
1660  hGBPTres->Fill( (GBrecPt-simPt)/simPt);
1661  if(fabs(GBeta)<1.04) hGBPTres_Barrel->Fill((GBrecPt-simPt)/simPt);
1662  else hGBPTres_Endcap->Fill((GBrecPt-simPt)/simPt);
1663 
1664  hGBPTDiff->Fill(GBrecPt-simPt);
1665 
1666  hGBPTDiffvsEta->Fill(GBeta,GBrecPt-simPt);
1667  hGBPTDiffvsPhi->Fill(GBphi,GBrecPt-simPt);
1668 
1669  double ptInvRes= ( ich/GBrecPt - simPar[3][iCand]/simPt)/ (simPar[3][iCand]/simPt);
1670  hGBinvPTres->Fill( ptInvRes);
1671 
1672  hGBinvPTvsEta->Fill(GBeta,ptInvRes);
1673  hGBinvPTvsPhi->Fill(GBphi,ptInvRes);
1674  hGBinvPTvsNhits->Fill((*glbTrack).numberOfValidHits(),ptInvRes);
1675  }
1676 
1677 
1678  hGBPTvsEta->Fill(GBeta,GBrecPt);
1679  hGBPTvsPhi->Fill(GBphi,GBrecPt);
1680 
1681  }
1682 
1683  hGBNmuons->Fill(i);
1684  hGBNmuons_Barrel->Fill(ib);
1685  hGBNmuons_Endcap->Fill(ie);
1686 
1687  if(i>1){ // Take 2 first muons :-(
1688  TLorentzVector mu1(p1.x(), p1.y(), p1.z(), p1.mag());
1689  TLorentzVector mu2(p2.x(), p2.y(), p2.z(), p2.mag());
1690  TLorentzVector pair = mu1 + mu2;
1691  double Minv = pair.M();
1692  hGBInvM->Fill(Minv);
1693  if(fabs(p1.eta())<1.04 && fabs(p2.eta())<1.04) hGBInvM_Barrel->Fill(Minv);
1694  else if(fabs(p1.eta())>=1.04 && fabs(p2.eta())>=1.04) hGBInvM_Endcap->Fill(Minv);
1695  else hGBInvM_Overlap->Fill(Minv);
1696  }
1697 
1698  } //end doGBplots
1699 
1700 
1701 // ############ Residual plots ###################
1702 
1703  if(doResplots){
1704 
1705  edm::ESHandle<MagneticField> theMGField;
1706  eventSetup.get<IdealMagneticFieldRecord>().get(theMGField);
1707 
1708  edm::ESHandle<GlobalTrackingGeometry> theTrackingGeometry;
1709  eventSetup.get<GlobalTrackingGeometryRecord>().get(theTrackingGeometry);
1710 
1711 
1712  // Get the RecTrack collection from the event
1714  event.getByLabel(theSTAMuonTag, staTracks);
1715 
1716  // Get the 4D DTSegments
1717  edm::Handle<DTRecSegment4DCollection> all4DSegmentsDT;
1718  event.getByLabel(theRecHits4DTagDT, all4DSegmentsDT);
1720 
1721  // Get the 4D CSCSegments
1722  edm::Handle<CSCSegmentCollection> all4DSegmentsCSC;
1723  event.getByLabel(theRecHits4DTagCSC, all4DSegmentsCSC);
1725 
1726  //Vectors used to perform the matching between Segments and hits from Track
1727  intDVector indexCollectionDT;
1728  intDVector indexCollectionCSC;
1729 
1730 /* std::cout << "<MuonAlignmentAnalyzer> List of DTSegments found in Local Reconstruction" << std::endl;
1731  std::cout << "Number: " << all4DSegmentsDT->size() << std::endl;
1732  for (segmentDT = all4DSegmentsDT->begin(); segmentDT != all4DSegmentsDT->end(); ++segmentDT){
1733  const GeomDet* geomDet = theTrackingGeometry->idToDet((*segmentDT).geographicalId());
1734  std::cout << "<MuonAlignmentAnalyzer> " << geomDet->toGlobal((*segmentDT).localPosition()) << std::endl;
1735  std::cout << "<MuonAlignmentAnalyzer> Local " << (*segmentDT).localPosition() << std::endl;
1736  }
1737  std::cout << "<MuonAlignmentAnalyzer> List of CSCSegments found in Local Reconstruction" << std::endl;
1738  for (segmentCSC = all4DSegmentsCSC->begin(); segmentCSC != all4DSegmentsCSC->end(); ++segmentCSC){
1739  const GeomDet* geomDet = theTrackingGeometry->idToDet((*segmentCSC).geographicalId());
1740  std::cout << "<MuonAlignmentAnalyzer>" << geomDet->toGlobal((*segmentCSC).localPosition()) << std::endl;
1741  }
1742 */
1744 
1745  reco::TrackCollection::const_iterator staTrack;
1746  for (staTrack = staTracks->begin(); staTrack != staTracks->end(); ++staTrack){
1747 
1748  int countPoints = 0;
1749 
1750  reco::TransientTrack track(*staTrack,&*theMGField,theTrackingGeometry);
1751 
1752 
1753  if(staTrack->numberOfValidHits()>(min1DTrackRecHitSize-1)) {
1754 
1755  RecHitVector my4DTrack = this->doMatching(*staTrack, all4DSegmentsDT, all4DSegmentsCSC, &indexCollectionDT, &indexCollectionCSC, theTrackingGeometry);
1756 
1757 
1758 //cut in number of segments
1759 
1760  if(my4DTrack.size()>(min4DTrackSegmentSize-1) ){
1761 
1762 // start propagation
1763 // TrajectoryStateOnSurface innerTSOS = track.impactPointState();
1765 
1766  //If the state is valid
1767  if(innerTSOS.isValid()) {
1768 
1769  //Loop over Associated segments
1770  for(RecHitVector::iterator rechit = my4DTrack.begin(); rechit != my4DTrack.end(); ++rechit) {
1771 
1772  const GeomDet* geomDet = theTrackingGeometry->idToDet((*rechit)->geographicalId());
1773 //Otherwise the propagator could throw an exception
1774  const Plane* pDest = dynamic_cast<const Plane*>(&geomDet->surface());
1775  const Cylinder* cDest = dynamic_cast<const Cylinder*>(&geomDet->surface());
1776 
1777  if(pDest != nullptr || cDest != nullptr) { //Donde antes iba el try
1778 
1779  TrajectoryStateOnSurface destiny = thePropagator->propagate(*(innerTSOS.freeState()), geomDet->surface());
1780 
1781  if(!destiny.isValid()|| !destiny.hasError()) continue;
1782 
1783 /* std::cout << "<MuonAlignmentAnalyzer> Segment: " << geomDet->toGlobal((*rechit)->localPosition()) << std::endl;
1784  std::cout << "<MuonAlignmentAnalyzer> Segment local: " << (*rechit)->localPosition() << std::endl;
1785  std::cout << "<MuonAlignmentAnalyzer> Predicted: " << destiny.freeState()->position() << std::endl;
1786  std::cout << "<MuonAlignmentAnalyzer> Predicted local: " << destiny.localPosition() << std::endl;
1787 */
1788  const long rawId= (*rechit)->geographicalId().rawId();
1789  int position = -1;
1790  bool newDetector = true;
1791  //Loop over the DetectorCollection to see if the detector is new and requires a new entry
1792  for(std::vector<long>::iterator myIds = detectorCollection.begin(); myIds != detectorCollection.end(); myIds++) {
1793  ++position;
1794  //If matches newDetector = false
1795  if(*myIds == rawId) {
1796  newDetector = false;
1797  break;
1798  }
1799  }
1800 
1801  DetId myDet(rawId);
1802  int det = myDet.subdetId();
1803  int wheel=0,station=0,sector=0;
1804  int endcap=0,ring=0,chamber=0;
1805 
1806  double residualGlobalRPhi=0,residualGlobalPhi=0,residualGlobalR=0,residualGlobalTheta=0,residualGlobalZ=0;
1807  double residualLocalX=0,residualLocalPhi=0,residualLocalY=0,residualLocalTheta=0;
1808 
1809  // Fill generic histograms
1810  //If it's a DT
1811  if(det == 1) {
1812  DTChamberId myChamber(rawId);
1813  wheel=myChamber.wheel();
1814  station = myChamber.station();
1815  sector=myChamber.sector();
1816 
1817 //global
1818  residualGlobalRPhi = geomDet->toGlobal((*rechit)->localPosition()).perp() * geomDet->toGlobal((*rechit)->localPosition()).barePhi() - destiny.freeState()->position().perp() * destiny.freeState()->position().barePhi();
1819 
1820 //local
1821  residualLocalX = (*rechit)->localPosition().x() -destiny.localPosition().x();
1822 
1823 //global
1824  residualGlobalPhi = geomDet->toGlobal(((RecSegment *)(*rechit))->localDirection()).barePhi() - destiny.globalDirection().barePhi();
1825 
1826 //local
1827  residualLocalPhi = atan2(((RecSegment *)(*rechit))->localDirection().z(),
1828  ((RecSegment*)(*rechit))->localDirection().x()) - atan2(destiny.localDirection().z(), destiny.localDirection().x());
1829 
1830  hResidualGlobalRPhiDT->Fill(residualGlobalRPhi);
1831  hResidualGlobalPhiDT->Fill(residualGlobalPhi);
1832  hResidualLocalXDT->Fill(residualLocalX);
1833  hResidualLocalPhiDT->Fill(residualLocalPhi);
1834 
1835  if(station!=4){
1836 //global
1837  residualGlobalZ = geomDet->toGlobal((*rechit)->localPosition()).z() - destiny.freeState()->position().z();
1838 
1839 //local
1840  residualLocalY = (*rechit)->localPosition().y() - destiny.localPosition().y();
1841 
1842 //global
1843  residualGlobalTheta = geomDet->toGlobal(((RecSegment *)(*rechit))->localDirection()).bareTheta() - destiny.globalDirection().bareTheta();
1844 
1845 //local
1846  residualLocalTheta = atan2(((RecSegment *)(*rechit))->localDirection().z(),
1847  ((RecSegment*)(*rechit))->localDirection().y()) - atan2(destiny.localDirection().z(), destiny.localDirection().y());
1848 
1849 
1850  hResidualGlobalThetaDT->Fill(residualGlobalTheta);
1851  hResidualGlobalZDT->Fill(residualGlobalZ);
1852  hResidualLocalThetaDT->Fill(residualLocalTheta);
1853  hResidualLocalYDT->Fill(residualLocalY);
1854  }
1855 
1856  int index = wheel+2;
1857  hResidualGlobalRPhiDT_W[index]->Fill(residualGlobalRPhi);
1858  hResidualGlobalPhiDT_W[index]->Fill(residualGlobalPhi);
1859  hResidualLocalXDT_W[index]->Fill(residualLocalX);
1860  hResidualLocalPhiDT_W[index]->Fill(residualLocalPhi);
1861  if(station!=4){
1862  hResidualGlobalThetaDT_W[index]->Fill(residualGlobalTheta);
1863  hResidualGlobalZDT_W[index]->Fill(residualGlobalZ);
1864  hResidualLocalThetaDT_W[index]->Fill(residualLocalTheta);
1865  hResidualLocalYDT_W[index]->Fill(residualLocalY);
1866  }
1867 
1868  index=wheel*4+station+7;
1869  hResidualGlobalRPhiDT_MB[index]->Fill(residualGlobalRPhi);
1870  hResidualGlobalPhiDT_MB[index]->Fill(residualGlobalPhi);
1871  hResidualLocalXDT_MB[index]->Fill(residualLocalX);
1872  hResidualLocalPhiDT_MB[index]->Fill(residualLocalPhi);
1873 
1874  if(station!=4){
1875  hResidualGlobalThetaDT_MB[index]->Fill(residualGlobalTheta);
1876  hResidualGlobalZDT_MB[index]->Fill(residualGlobalZ);
1877  hResidualLocalThetaDT_MB[index]->Fill(residualLocalTheta);
1878  hResidualLocalYDT_MB[index]->Fill(residualLocalY);
1879  }
1880  }
1881  else if (det==2){
1882  CSCDetId myChamber(rawId);
1883  endcap= myChamber.endcap();
1884  station = myChamber.station();
1885  if(endcap==2) station = -station;
1886  ring = myChamber.ring();
1887  chamber=myChamber.chamber();
1888 
1889 
1890 //global
1891  residualGlobalRPhi = geomDet->toGlobal((*rechit)->localPosition()).perp() * geomDet->toGlobal((*rechit)->localPosition()).barePhi() - destiny.freeState()->position().perp() * destiny.freeState()->position().barePhi();
1892 
1893 //local
1894  residualLocalX = (*rechit)->localPosition().x() -destiny.localPosition().x();
1895 
1896 //global
1897  residualGlobalR = geomDet->toGlobal((*rechit)->localPosition()).perp() - destiny.freeState()->position().perp();
1898 
1899 //local
1900  residualLocalY = (*rechit)->localPosition().y() - destiny.localPosition().y();
1901 
1902 //global
1903  residualGlobalPhi = geomDet->toGlobal(((RecSegment *)(*rechit))->localDirection()).barePhi() - destiny.globalDirection().barePhi();
1904 
1905 //local
1906  residualLocalPhi = atan2(((RecSegment *)(*rechit))->localDirection().y(),
1907  ((RecSegment*)(*rechit))->localDirection().x()) - atan2(destiny.localDirection().y(), destiny.localDirection().x());
1908 
1909 //global
1910  residualGlobalTheta = geomDet->toGlobal(((RecSegment *)(*rechit))->localDirection()).bareTheta() - destiny.globalDirection().bareTheta();
1911 
1912 //local
1913  residualLocalTheta = atan2(((RecSegment *)(*rechit))->localDirection().y(),
1914  ((RecSegment*)(*rechit))->localDirection().z()) - atan2(destiny.localDirection().y(), destiny.localDirection().z());
1915 
1916  hResidualGlobalRPhiCSC->Fill(residualGlobalRPhi);
1917  hResidualGlobalPhiCSC->Fill(residualGlobalPhi);
1918  hResidualGlobalThetaCSC->Fill(residualGlobalTheta);
1919  hResidualGlobalRCSC->Fill(residualGlobalR);
1920  hResidualLocalXCSC->Fill(residualLocalX);
1921  hResidualLocalPhiCSC->Fill(residualLocalPhi);
1922  hResidualLocalThetaCSC->Fill(residualLocalTheta);
1923  hResidualLocalYCSC->Fill(residualLocalY);
1924 
1925  int index=2*station+ring+7;
1926  if(station==-1) {index=5+ring;
1927  if(ring==4) index=6;}
1928  if(station==1) {index=8+ring;
1929  if(ring==4) index=9;}
1930  hResidualGlobalRPhiCSC_ME[index]->Fill(residualGlobalRPhi);
1931  hResidualGlobalPhiCSC_ME[index]->Fill(residualGlobalPhi);
1932  hResidualGlobalThetaCSC_ME[index]->Fill(residualGlobalTheta);
1933  hResidualGlobalRCSC_ME[index]->Fill(residualGlobalR);
1934  hResidualLocalXCSC_ME[index]->Fill(residualLocalX);
1935  hResidualLocalPhiCSC_ME[index]->Fill(residualLocalPhi);
1936  hResidualLocalThetaCSC_ME[index]->Fill(residualLocalTheta);
1937  hResidualLocalYCSC_ME[index]->Fill(residualLocalY);
1938 
1939  }
1940  else{residualGlobalRPhi=0,residualGlobalPhi=0,residualGlobalR=0,residualGlobalTheta=0,residualGlobalZ=0;
1941  residualLocalX=0,residualLocalPhi=0,residualLocalY=0,residualLocalTheta=0,residualLocalY=0;
1942  }
1943 // Fill individual chamber histograms
1944  if(newDetector) {
1945 
1946  //Create an RawIdDetector, fill it and push it into the collection
1947  detectorCollection.push_back(rawId);
1948 
1949  //This piece of code calculates the range of the residuals
1950  double rangeX = 3.0, rangeY =5.;
1951  switch(abs(station)) {
1952  case 1:
1953  {rangeX = resLocalXRangeStation1; rangeY = resLocalYRangeStation1;}
1954  break;
1955  case 2:
1956  {rangeX = resLocalXRangeStation2; rangeY = resLocalYRangeStation2;}
1957  break;
1958  case 3:
1959  {rangeX = resLocalXRangeStation3; rangeY = resLocalYRangeStation3;}
1960  break;
1961  case 4:
1962  {rangeX = resLocalXRangeStation4; rangeY = resLocalYRangeStation4;}
1963  break;
1964  default:
1965  break;
1966  }
1967 
1968  //create new histograms
1969 
1970  char nameOfHistoLocalX[50];
1971  char nameOfHistoLocalTheta[50];
1972  char nameOfHistoLocalY[50];
1973  char nameOfHistoLocalPhi[50];
1974  char nameOfHistoGlobalRPhi[50];
1975  char nameOfHistoGlobalTheta[50];
1976  char nameOfHistoGlobalR[50];
1977  char nameOfHistoGlobalPhi[50];
1978  char nameOfHistoGlobalZ[50];
1979 
1980  if(det==1){ // DT
1981  snprintf(nameOfHistoLocalX, sizeof(nameOfHistoLocalX), "ResidualLocalX_W%dMB%1dS%1d",wheel,station,sector );
1982  snprintf(nameOfHistoLocalPhi, sizeof(nameOfHistoLocalPhi), "ResidualLocalPhi_W%dMB%1dS%1d",wheel,station,sector);
1983  snprintf(nameOfHistoGlobalRPhi, sizeof(nameOfHistoGlobalRPhi), "ResidualGlobalRPhi_W%dMB%1dS%1d",wheel,station,sector );
1984  snprintf(nameOfHistoGlobalPhi, sizeof(nameOfHistoGlobalPhi), "ResidualGlobalPhi_W%dMB%1dS%1d",wheel,station,sector);
1985  snprintf(nameOfHistoLocalTheta, sizeof(nameOfHistoLocalTheta), "ResidualLocalTheta_W%dMB%1dS%1d",wheel,station,sector);
1986  snprintf(nameOfHistoLocalY, sizeof(nameOfHistoLocalY), "ResidualLocalY_W%dMB%1dS%1d",wheel,station,sector);
1987  TH1F *histoLocalY = fs->make<TH1F>(nameOfHistoLocalY, nameOfHistoLocalY, nbins, -rangeY, rangeY);
1988  unitsLocalY.push_back(histoLocalY);
1989  snprintf(nameOfHistoGlobalTheta, sizeof(nameOfHistoGlobalTheta), "ResidualGlobalTheta_W%dMB%1dS%1d",wheel,station,sector);
1990  snprintf(nameOfHistoGlobalZ, sizeof(nameOfHistoGlobalZ), "ResidualGlobalZ_W%dMB%1dS%1d",wheel,station,sector);
1991  TH1F *histoGlobalZ = fs->make<TH1F>(nameOfHistoGlobalZ, nameOfHistoGlobalZ, nbins, -rangeY, rangeY);
1992  unitsGlobalRZ.push_back(histoGlobalZ);
1993 
1994  }
1995  else if(det==2){ //CSC
1996  snprintf(nameOfHistoLocalX, sizeof(nameOfHistoLocalX), "ResidualLocalX_ME%dR%1dC%1d",station,ring,chamber );
1997  snprintf(nameOfHistoLocalPhi, sizeof(nameOfHistoLocalPhi), "ResidualLocalPhi_ME%dR%1dC%1d",station,ring,chamber);
1998  snprintf(nameOfHistoLocalTheta, sizeof(nameOfHistoLocalTheta), "ResidualLocalTheta_ME%dR%1dC%1d",station,ring,chamber);
1999  snprintf(nameOfHistoLocalY, sizeof(nameOfHistoLocalY), "ResidualLocalY_ME%dR%1dC%1d",station,ring,chamber);
2000  TH1F *histoLocalY = fs->make<TH1F>(nameOfHistoLocalY, nameOfHistoLocalY, nbins, -rangeY, rangeY);
2001  unitsLocalY.push_back(histoLocalY);
2002  snprintf(nameOfHistoGlobalRPhi, sizeof(nameOfHistoGlobalRPhi), "ResidualGlobalRPhi_ME%dR%1dC%1d",station,ring,chamber );
2003  snprintf(nameOfHistoGlobalPhi, sizeof(nameOfHistoGlobalPhi), "ResidualGlobalPhi_ME%dR%1dC%1d",station,ring,chamber);
2004  snprintf(nameOfHistoGlobalTheta, sizeof(nameOfHistoGlobalTheta), "ResidualGlobalTheta_ME%dR%1dC%1d",station,ring,chamber);
2005  snprintf(nameOfHistoGlobalR, sizeof(nameOfHistoGlobalR), "ResidualGlobalR_ME%dR%1dC%1d",station,ring,chamber);
2006  TH1F *histoGlobalR = fs->make<TH1F>(nameOfHistoGlobalR, nameOfHistoGlobalR, nbins, -rangeY, rangeY);
2007  unitsGlobalRZ.push_back(histoGlobalR);
2008  }
2009 
2010  // Common histos to DT and CSC
2011  TH1F *histoLocalX = fs->make<TH1F>(nameOfHistoLocalX, nameOfHistoLocalX, nbins, -rangeX, rangeX);
2012  TH1F *histoGlobalRPhi = fs->make<TH1F>(nameOfHistoGlobalRPhi, nameOfHistoGlobalRPhi, nbins, -rangeX, rangeX);
2013  TH1F *histoLocalPhi = fs->make<TH1F>(nameOfHistoLocalPhi, nameOfHistoLocalPhi, nbins, -resPhiRange, resPhiRange);
2014  TH1F *histoGlobalPhi = fs->make<TH1F>(nameOfHistoGlobalPhi, nameOfHistoGlobalPhi, nbins, -resPhiRange, resPhiRange);
2015  TH1F *histoGlobalTheta = fs->make<TH1F>(nameOfHistoGlobalTheta, nameOfHistoGlobalTheta, nbins, -resThetaRange, resThetaRange);
2016  TH1F *histoLocalTheta = fs->make<TH1F>(nameOfHistoLocalTheta, nameOfHistoLocalTheta, nbins, -resThetaRange, resThetaRange);
2017 
2018  histoLocalX->Fill(residualLocalX);
2019  histoLocalPhi->Fill(residualLocalPhi);
2020  histoLocalTheta->Fill(residualLocalTheta);
2021  histoGlobalRPhi->Fill(residualGlobalRPhi);
2022  histoGlobalPhi->Fill(residualGlobalPhi);
2023  histoGlobalTheta->Fill(residualGlobalTheta);
2024  //Push them into their respective vectors
2025  unitsLocalX.push_back(histoLocalX);
2026  unitsLocalPhi.push_back(histoLocalPhi);
2027  unitsLocalTheta.push_back(histoLocalTheta);
2028  unitsGlobalRPhi.push_back(histoGlobalRPhi);
2029  unitsGlobalPhi.push_back(histoGlobalPhi);
2030  unitsGlobalTheta.push_back(histoGlobalTheta);
2031 
2032  } // new detector
2033  else {
2034  //If the detector was not new, just fill the histogram
2035  unitsLocalX.at(position)->Fill(residualLocalX);
2036  unitsLocalPhi.at(position)->Fill(residualLocalPhi);
2037  unitsLocalTheta.at(position)->Fill(residualLocalTheta);
2038  unitsGlobalRPhi.at(position)->Fill(residualGlobalRPhi);
2039  unitsGlobalPhi.at(position)->Fill(residualGlobalPhi);
2040  unitsGlobalTheta.at(position)->Fill(residualGlobalTheta);
2041  if(det==1) {unitsLocalY.at(position)->Fill(residualLocalY); unitsGlobalRZ.at(position)->Fill(residualGlobalZ);}
2042  else if(det==2) {unitsLocalY.at(position)->Fill(residualLocalY); unitsGlobalRZ.at(position)->Fill(residualGlobalR);}
2043  }
2044 
2045  countPoints++;
2046 
2047  innerTSOS = destiny;
2048 
2049 
2050  }else {
2051  edm::LogError("MuonAlignmentAnalyzer") <<" Error!! Exception in propagator catched" << std::endl;
2052  continue;
2053  }
2054 
2055  } //loop over my4DTrack
2056  } //TSOS was valid
2057 
2058  } // cut in at least 4 segments
2059 
2060  } //end cut in RecHitsSize>36
2061  numberOfHits=numberOfHits+countPoints;
2062  } //loop over STAtracks
2063 
2064  delete thePropagator;
2065 
2066  } //end doResplots
2067 
2068 
2069 }
2070 
2071 RecHitVector MuonAlignmentAnalyzer::doMatching(const reco::Track &staTrack, edm::Handle<DTRecSegment4DCollection> &all4DSegmentsDT, edm::Handle<CSCSegmentCollection> &all4DSegmentsCSC, intDVector *indexCollectionDT, intDVector *indexCollectionCSC, edm::ESHandle<GlobalTrackingGeometry> &theTrackingGeometry) {
2072 
2075 
2076  std::vector<int> positionDT;
2077  std::vector<int> positionCSC;
2078  RecHitVector my4DTrack;
2079 
2080  //Loop over the hits of the track
2081  for( int counter = 0; counter != staTrack.numberOfValidHits()-1; counter++) {
2082 
2083  TrackingRecHitRef myRef = staTrack.recHit(counter);
2084  const TrackingRecHit *rechit = myRef.get();
2085  const GeomDet* geomDet = theTrackingGeometry->idToDet(rechit->geographicalId());
2086 
2087  //It's a DT Hit
2088  if(geomDet->subDetector() == GeomDetEnumerators::DT) {
2089 
2090  //Take the layer associated to this hit
2091  DTLayerId myLayer(rechit->geographicalId().rawId());
2092 
2093  int NumberOfDTSegment = 0;
2094  //Loop over segments
2095  for(segmentDT = all4DSegmentsDT->begin(); segmentDT != all4DSegmentsDT->end(); ++segmentDT) {
2096 
2097  //By default the chamber associated to this Segment is new
2098  bool isNewChamber = true;
2099 
2100  //Loop over segments already included in the vector of segments in the actual track
2101  for(std::vector<int>::iterator positionIt = positionDT.begin(); positionIt != positionDT.end(); positionIt++) {
2102 
2103  //If this segment has been used before isNewChamber = false
2104  if(NumberOfDTSegment == *positionIt) isNewChamber = false;
2105  }
2106 
2107  //Loop over vectors of segments associated to previous tracks
2108  for(std::vector<std::vector<int> >::iterator collect = indexCollectionDT->begin(); collect != indexCollectionDT->end(); ++collect) {
2109 
2110  //Loop over segments associated to a track
2111  for(std::vector<int>::iterator positionIt = (*collect).begin(); positionIt != (*collect).end(); positionIt++) {
2112 
2113  //If this segment was used in a previos track then isNewChamber = false
2114  if(NumberOfDTSegment == *positionIt) isNewChamber = false;
2115  }
2116  }
2117 
2118  //If the chamber is new
2119  if(isNewChamber) {
2120 
2121  DTChamberId myChamber((*segmentDT).geographicalId().rawId());
2122  //If the layer of the hit belongs to the chamber of the 4D Segment
2123  if(myLayer.wheel() == myChamber.wheel() && myLayer.station() == myChamber.station() && myLayer.sector() == myChamber.sector()) {
2124 
2125  //push position of the segment and tracking rechit
2126  positionDT.push_back(NumberOfDTSegment);
2127  my4DTrack.push_back((TrackingRecHit *) &(*segmentDT));
2128  }
2129  }
2130  NumberOfDTSegment++;
2131  }
2132  //In case is a CSC
2133  } else if (geomDet->subDetector() == GeomDetEnumerators::CSC) {
2134 
2135  //Take the layer associated to this hit
2136  CSCDetId myLayer(rechit->geographicalId().rawId());
2137 
2138  int NumberOfCSCSegment = 0;
2139  //Loop over 4Dsegments
2140  for(segmentCSC = all4DSegmentsCSC->begin(); segmentCSC != all4DSegmentsCSC->end(); segmentCSC++) {
2141 
2142  //By default the chamber associated to the segment is new
2143  bool isNewChamber = true;
2144 
2145  //Loop over segments in the current track
2146  for(std::vector<int>::iterator positionIt = positionCSC.begin(); positionIt != positionCSC.end(); positionIt++) {
2147 
2148  //If this segment has been used then newchamber = false
2149  if(NumberOfCSCSegment == *positionIt) isNewChamber = false;
2150  }
2151  //Loop over vectors of segments in previous tracks
2152  for(std::vector<std::vector<int> >::iterator collect = indexCollectionCSC->begin(); collect != indexCollectionCSC->end(); ++collect) {
2153 
2154  //Loop over segments in a track
2155  for(std::vector<int>::iterator positionIt = (*collect).begin(); positionIt != (*collect).end(); positionIt++) {
2156 
2157  //If the segment was used in a previous track isNewChamber = false
2158  if(NumberOfCSCSegment == *positionIt) isNewChamber = false;
2159  }
2160  }
2161  //If the chamber is new
2162  if(isNewChamber) {
2163 
2164  CSCDetId myChamber((*segmentCSC).geographicalId().rawId());
2165  //If the chambers are the same
2166  if(myLayer.chamberId() == myChamber.chamberId()) {
2167  //push
2168  positionCSC.push_back(NumberOfCSCSegment);
2169  my4DTrack.push_back((TrackingRecHit *) &(*segmentCSC));
2170  }
2171  }
2172  NumberOfCSCSegment++;
2173  }
2174  }
2175  }
2176 
2177  indexCollectionDT->push_back(positionDT);
2178  indexCollectionCSC->push_back(positionCSC);
2179 
2180  return my4DTrack;
2181 }
2182 
std::vector< TH1F * > hResidualLocalXCSC_ME
int chamber() const
Definition: CSCDetId.h:68
T getParameter(std::string const &) const
T barePhi() const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< TH1F * > hResidualLocalThetaDT_W
std::vector< TH1F * > hResidualGlobalZDT_MB
std::vector< TH1F * > hResidualLocalYCSC_ME
T perp() const
Definition: PV3DBase.h:72
std::vector< TH1F * > unitsGlobalPhi
std::vector< TH1F * > hResidualGlobalThetaCSC_ME
RecHitVector doMatching(const reco::Track &, edm::Handle< DTRecSegment4DCollection > &, edm::Handle< CSCSegmentCollection > &, intDVector *, intDVector *, edm::ESHandle< GlobalTrackingGeometry > &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< TH1F * > hResidualGlobalPhiCSC_ME
LocalVector localDirection() const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
std::vector< TH1F * > hResidualLocalYDT_W
std::vector< TH1F * > hResidualGlobalZDT_W
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
T bareTheta() const
Definition: PV3DBase.h:74
T y() const
Definition: PV3DBase.h:63
edm::Service< TFileService > fs
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
std::vector< TH1F * > unitsGlobalRPhi
std::vector< TH1F * > hResidualLocalXDT_W
#define nullptr
std::vector< TH1F * > unitsLocalX
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
Definition: Plane.h:17
std::vector< TH1F * > hResidualLocalThetaCSC_ME
std::vector< TrackingRecHit * > RecHitVector
std::vector< TH1F * > hResidualLocalPhiDT_W
std::vector< TH1F * > hResidualGlobalRPhiCSC_ME
TrajectoryStateOnSurface innermostMeasurementState() const
std::vector< TH1F * > unitsLocalTheta
int endcap() const
Definition: CSCDetId.h:93
T barePhi() const
Definition: PV3DBase.h:68
T mag() const
Definition: PV3DBase.h:67
std::vector< TH1F * > hResidualGlobalThetaDT_W
simTrack
per collection params
FreeTrajectoryState const * freeState(bool withErrors=true) const
T z() const
Definition: PV3DBase.h:64
std::vector< TH1F * > unitsGlobalRZ
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< TH1F * > hResidualGlobalRCSC_ME
unsigned short numberOfValidHits() const
number of valid hits found
Definition: TrackBase.h:820
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:245
std::vector< TH1F * > hResidualLocalPhiCSC_ME
double p2[4]
Definition: TauolaWrapper.h:90
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override
std::vector< TH1F * > hResidualGlobalPhiDT_MB
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
std::vector< TH1F * > unitsLocalPhi
std::vector< TH1F * > hResidualLocalPhiDT_MB
int ring() const
Definition: CSCDetId.h:75
Definition: DetId.h:18
GlobalPoint position() const
std::vector< TH1F * > hResidualLocalXDT_MB
std::vector< std::vector< int > > intDVector
std::vector< TH1F * > hResidualGlobalRPhiDT_W
std::vector< TH1F * > hResidualGlobalThetaDT_MB
std::vector< TH1F * > hResidualGlobalRPhiDT_MB
MuonAlignmentAnalyzer(const edm::ParameterSet &pset)
Constructor.
std::vector< TH1F * > hResidualLocalYDT_MB
std::vector< TH1F * > unitsLocalY
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
T eta() const
Definition: PV3DBase.h:76
T perp() const
Magnitude of transverse component.
~MuonAlignmentAnalyzer() override
Destructor.
double p1[4]
Definition: TauolaWrapper.h:89
int sector() const
Definition: DTChamberId.h:61
static int position[264][3]
Definition: ReadPGInfo.cc:509
TrackingRecHitRef recHit(size_t i) const
Get i-th hit on the track.
Definition: Track.h:114
T get() const
Definition: EventSetup.h:63
const GeomDet * idToDet(DetId) const override
std::vector< TH1F * > hResidualGlobalPhiDT_W
int station() const
Definition: CSCDetId.h:86
DetId geographicalId() const
int station() const
Return the station number.
Definition: DTChamberId.h:51
virtual SubDetector subDetector() const
Which subdetector.
Definition: GeomDet.cc:44
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
T x() const
Definition: PV3DBase.h:62
std::vector< long > detectorCollection
std::vector< TH1F * > unitsGlobalTheta
std::vector< TH1F * > hResidualLocalThetaDT_MB
Definition: event.py:1
Global3DVector GlobalVector
Definition: GlobalVector.h:10
GlobalVector globalDirection() const
ib
Definition: cuy.py:661