CMS 3D CMS Logo

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