CMS 3D CMS Logo

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