CMS 3D CMS Logo

AlignmentMonitorMuonResiduals.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: CommonAlignmentProducer
4 // Class : AlignmentMonitorMuonResiduals
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Jim Pivarski
10 // Created: Mon Nov 12 13:30:14 CST 2007
11 //
12 
13 // system include files
18 
25 #include "TH1F.h"
26 #include "TTree.h"
27 
28 // user include files
29 
30 //
31 // class definition
32 //
33 
35 public:
38 
39  void book() override;
40  void event(const edm::Event &iEvent,
41  const edm::EventSetup &iSetup,
42  const ConstTrajTrackPairCollection &iTrajTracks) override;
43  void afterAlignment() override;
44 
45 private:
46  std::map<int, int> m_numx;
47  std::map<int, double> m_x_w;
48  std::map<int, double> m_x_ww;
49  std::map<int, double> m_x_wx;
50  std::map<int, double> m_x_wxx;
51  std::map<int, int> m_numy;
52  std::map<int, double> m_y_w;
53  std::map<int, double> m_y_ww;
54  std::map<int, double> m_y_wy;
55  std::map<int, double> m_y_wyy;
56 
58 
66 
73 
81 
90 
98 
105 
112  *m_ystdev_me41;
113 
122 
123  TTree *m_chambers;
129 
134 };
135 
136 //
137 // constants, enums and typedefs
138 //
139 
140 //
141 // static data member definitions
142 //
143 
144 //
145 // member functions
146 //
147 
149  : AlignmentMonitorBase(cfg, iC, "AlignmentMonitorMuonResiduals") {
150  xresid_bins = cfg.getParameter<unsigned int>("xresid_bins");
151  xmean_bins = cfg.getParameter<unsigned int>("xmean_bins");
152  xstdev_bins = cfg.getParameter<unsigned int>("xstdev_bins");
153  xerronmean_bins = cfg.getParameter<unsigned int>("xerronmean_bins");
154  yresid_bins = cfg.getParameter<unsigned int>("yresid_bins");
155  ymean_bins = cfg.getParameter<unsigned int>("ymean_bins");
156  ystdev_bins = cfg.getParameter<unsigned int>("ystdev_bins");
157  yerronmean_bins = cfg.getParameter<unsigned int>("yerronmean_bins");
158  xresid_low = cfg.getParameter<double>("xresid_low");
159  xresid_high = cfg.getParameter<double>("xresid_high");
160  xmean_low = cfg.getParameter<double>("xmean_low");
161  xmean_high = cfg.getParameter<double>("xmean_high");
162  xstdev_low = cfg.getParameter<double>("xstdev_low");
163  xstdev_high = cfg.getParameter<double>("xstdev_high");
164  xerronmean_low = cfg.getParameter<double>("xerronmean_low");
165  xerronmean_high = cfg.getParameter<double>("xerronmean_high");
166  yresid_low = cfg.getParameter<double>("yresid_low");
167  yresid_high = cfg.getParameter<double>("yresid_high");
168  ymean_low = cfg.getParameter<double>("ymean_low");
169  ymean_high = cfg.getParameter<double>("ymean_high");
170  ystdev_low = cfg.getParameter<double>("ystdev_low");
171  ystdev_high = cfg.getParameter<double>("ystdev_high");
172  yerronmean_low = cfg.getParameter<double>("yerronmean_low");
173  yerronmean_high = cfg.getParameter<double>("yerronmean_high");
174 }
175 
177  m_numx.clear();
178  m_x_w.clear();
179  m_x_ww.clear();
180  m_x_wx.clear();
181  m_x_wxx.clear();
182  m_numy.clear();
183  m_y_w.clear();
184  m_y_ww.clear();
185  m_y_wy.clear();
186  m_y_wyy.clear();
187 
189  for (const auto &iter : pMuon()->DTChambers())
190  chambers.push_back(iter);
191  for (const auto &iter : pMuon()->CSCChambers())
192  chambers.push_back(iter);
193 
194  for (const auto &chamber : chambers) {
195  int id = chamber->geomDetId().rawId();
196  m_numx[id] = 0;
197  m_x_w[id] = 0;
198  m_x_ww[id] = 0;
199  m_x_wx[id] = 0;
200  m_x_wxx[id] = 0;
201  m_numy[id] = 0;
202  m_y_w[id] = 0;
203  m_y_ww[id] = 0;
204  m_y_wy[id] = 0;
205  m_y_wyy[id] = 0;
206  }
207 
208  m_sumnumx = book1D("/iterN/", "numx", "number of x hits", chambers.size(), 0.5, chambers.size() + 0.5);
209  m_sumnumy = book1D("/iterN/", "numy", "number of y hits", chambers.size(), 0.5, chambers.size() + 0.5);
210  m_xsummary = book1D("/iterN/",
211  "xsummary",
212  "summary of x means and errors (mm vertical axis)",
213  chambers.size(),
214  0.5,
215  chambers.size() + 0.5);
216  m_ysummary = book1D("/iterN/",
217  "ysummary",
218  "summary of y means and errors (mm vertical axis)",
219  chambers.size(),
220  0.5,
221  chambers.size() + 0.5);
222 
223  m_xresid = book1D("/iterN/", "xresid", "x residual (mm)", xresid_bins, xresid_low, xresid_high);
224  m_xresid_mb = book1D("/iterN/mb/", "xresid_mb", "barrel x residual (mm)", xresid_bins, xresid_low, xresid_high);
225  m_xresid_me = book1D("/iterN/me/", "xresid_me", "endcap x residual (mm)", xresid_bins, xresid_low, xresid_high);
226  m_xresid_mb1 =
227  book1D("/iterN/mb1/", "xresid_mb1", "MB station 1 x residual (mm)", xresid_bins, xresid_low, xresid_high);
228  m_xresid_mb2 =
229  book1D("/iterN/mb2/", "xresid_mb2", "MB station 2 x residual (mm)", xresid_bins, xresid_low, xresid_high);
230  m_xresid_mb3 =
231  book1D("/iterN/mb3/", "xresid_mb3", "MB station 3 x residual (mm)", xresid_bins, xresid_low, xresid_high);
232  m_xresid_mb4 =
233  book1D("/iterN/mb4/", "xresid_mb4", "MB station 4 x residual (mm)", xresid_bins, xresid_low, xresid_high);
235  book1D("/iterN/minus2/", "xresid_minus2", "MB wheel -2 x residual (mm)", xresid_bins, xresid_low, xresid_high);
237  book1D("/iterN/minus1/", "xresid_minus1", "MB wheel -1 x residual (mm)", xresid_bins, xresid_low, xresid_high);
238  m_xresid_zero =
239  book1D("/iterN/zero/", "xresid_zero", "MB wheel 0 x residual (mm)", xresid_bins, xresid_low, xresid_high);
241  book1D("/iterN/plus1/", "xresid_plus1", "MB wheel +1 x residual (mm)", xresid_bins, xresid_low, xresid_high);
243  book1D("/iterN/plus2/", "xresid_plus2", "MB wheel +2 x residual (mm)", xresid_bins, xresid_low, xresid_high);
245  book1D("/iterN/mep11/", "xresid_mep11", "ME+1/1 x residual (mm)", xresid_bins, xresid_low, xresid_high);
247  book1D("/iterN/mep12/", "xresid_mep12", "ME+1/2 x residual (mm)", xresid_bins, xresid_low, xresid_high);
249  book1D("/iterN/mep13/", "xresid_mep13", "ME+1/3 x residual (mm)", xresid_bins, xresid_low, xresid_high);
251  book1D("/iterN/mep14/", "xresid_mep14", "ME+1/4 x residual (mm)", xresid_bins, xresid_low, xresid_high);
253  book1D("/iterN/mep21/", "xresid_mep21", "ME+2/1 x residual (mm)", xresid_bins, xresid_low, xresid_high);
255  book1D("/iterN/mep22/", "xresid_mep22", "ME+2/2 x residual (mm)", xresid_bins, xresid_low, xresid_high);
257  book1D("/iterN/mep31/", "xresid_mep31", "ME+3/1 x residual (mm)", xresid_bins, xresid_low, xresid_high);
259  book1D("/iterN/mep32/", "xresid_mep32", "ME+3/2 x residual (mm)", xresid_bins, xresid_low, xresid_high);
261  book1D("/iterN/mep41/", "xresid_mep41", "ME+4/1 x residual (mm)", xresid_bins, xresid_low, xresid_high);
263  book1D("/iterN/mem11/", "xresid_mem11", "ME-1/1 x residual (mm)", xresid_bins, xresid_low, xresid_high);
265  book1D("/iterN/mem12/", "xresid_mem12", "ME-1/2 x residual (mm)", xresid_bins, xresid_low, xresid_high);
267  book1D("/iterN/mem13/", "xresid_mem13", "ME-1/3 x residual (mm)", xresid_bins, xresid_low, xresid_high);
269  book1D("/iterN/mem14/", "xresid_mem14", "ME-1/4 x residual (mm)", xresid_bins, xresid_low, xresid_high);
271  book1D("/iterN/mem21/", "xresid_mem21", "ME-2/1 x residual (mm)", xresid_bins, xresid_low, xresid_high);
273  book1D("/iterN/mem22/", "xresid_mem22", "ME-2/2 x residual (mm)", xresid_bins, xresid_low, xresid_high);
275  book1D("/iterN/mem31/", "xresid_mem31", "ME-3/1 x residual (mm)", xresid_bins, xresid_low, xresid_high);
277  book1D("/iterN/mem32/", "xresid_mem32", "ME-3/2 x residual (mm)", xresid_bins, xresid_low, xresid_high);
279  book1D("/iterN/mem41/", "xresid_mem41", "ME-4/1 x residual (mm)", xresid_bins, xresid_low, xresid_high);
280  m_xresid_me11 = book1D("/iterN/me11/", "xresid_me11", "ME1/1 x residual (mm)", xresid_bins, xresid_low, xresid_high);
281  m_xresid_me12 = book1D("/iterN/me12/", "xresid_me12", "ME1/2 x residual (mm)", xresid_bins, xresid_low, xresid_high);
282  m_xresid_me13 = book1D("/iterN/me13/", "xresid_me13", "ME1/3 x residual (mm)", xresid_bins, xresid_low, xresid_high);
283  m_xresid_me14 = book1D("/iterN/me14/", "xresid_me14", "ME1/4 x residual (mm)", xresid_bins, xresid_low, xresid_high);
284  m_xresid_me21 = book1D("/iterN/me21/", "xresid_me21", "ME2/1 x residual (mm)", xresid_bins, xresid_low, xresid_high);
285  m_xresid_me22 = book1D("/iterN/me22/", "xresid_me22", "ME2/2 x residual (mm)", xresid_bins, xresid_low, xresid_high);
286  m_xresid_me31 = book1D("/iterN/me31/", "xresid_me31", "ME3/1 x residual (mm)", xresid_bins, xresid_low, xresid_high);
287  m_xresid_me32 = book1D("/iterN/me32/", "xresid_me32", "ME3/2 x residual (mm)", xresid_bins, xresid_low, xresid_high);
288  m_xresid_me41 = book1D("/iterN/me41/", "xresid_me41", "ME4/1 x residual (mm)", xresid_bins, xresid_low, xresid_high);
289 
290  m_xmean = book1D("/iterN/", "xmean", "weighted mean x residual per chamber (mm)", xmean_bins, xmean_low, xmean_high);
291  m_xmean_mb = book1D(
292  "/iterN/mb/", "xmean_mb", "barrel weighted mean x residual per chamber (mm)", xmean_bins, xmean_low, xmean_high);
293  m_xmean_me = book1D(
294  "/iterN/me/", "xmean_me", "endcap weighted mean x residual per chamber (mm)", xmean_bins, xmean_low, xmean_high);
295  m_xmean_mb1 = book1D("/iterN/mb1/",
296  "xmean_mb1",
297  "MB station 1 weighted mean x residual per chamber (mm)",
298  xmean_bins,
299  xmean_low,
300  xmean_high);
301  m_xmean_mb2 = book1D("/iterN/mb2/",
302  "xmean_mb2",
303  "MB station 2 weighted mean x residual per chamber (mm)",
304  xmean_bins,
305  xmean_low,
306  xmean_high);
307  m_xmean_mb3 = book1D("/iterN/mb3/",
308  "xmean_mb3",
309  "MB station 3 weighted mean x residual per chamber (mm)",
310  xmean_bins,
311  xmean_low,
312  xmean_high);
313  m_xmean_mb4 = book1D("/iterN/mb4/",
314  "xmean_mb4",
315  "MB station 4 weighted mean x residual per chamber (mm)",
316  xmean_bins,
317  xmean_low,
318  xmean_high);
319  m_xmean_minus2 = book1D("/iterN/minus2/",
320  "xmean_minus2",
321  "MB wheel -2 weighted mean x residual per chamber (mm)",
322  xmean_bins,
323  xmean_low,
324  xmean_high);
325  m_xmean_minus1 = book1D("/iterN/minus1/",
326  "xmean_minus1",
327  "MB wheel -1 weighted mean x residual per chamber (mm)",
328  xmean_bins,
329  xmean_low,
330  xmean_high);
331  m_xmean_zero = book1D("/iterN/zero/",
332  "xmean_zero",
333  "MB wheel 0 weighted mean x residual per chamber (mm)",
334  xmean_bins,
335  xmean_low,
336  xmean_high);
337  m_xmean_plus1 = book1D("/iterN/plus1/",
338  "xmean_plus1",
339  "MB wheel +1 weighted mean x residual per chamber (mm)",
340  xmean_bins,
341  xmean_low,
342  xmean_high);
343  m_xmean_plus2 = book1D("/iterN/plus2/",
344  "xmean_plus2",
345  "MB wheel +2 weighted mean x residual per chamber (mm)",
346  xmean_bins,
347  xmean_low,
348  xmean_high);
349  m_xmean_mep11 = book1D("/iterN/mep11/",
350  "xmean_mep11",
351  "ME+1/1 weighted mean x residual per chamber (mm)",
352  xmean_bins,
353  xmean_low,
354  xmean_high);
355  m_xmean_mep12 = book1D("/iterN/mep12/",
356  "xmean_mep12",
357  "ME+1/2 weighted mean x residual per chamber (mm)",
358  xmean_bins,
359  xmean_low,
360  xmean_high);
361  m_xmean_mep13 = book1D("/iterN/mep13/",
362  "xmean_mep13",
363  "ME+1/3 weighted mean x residual per chamber (mm)",
364  xmean_bins,
365  xmean_low,
366  xmean_high);
367  m_xmean_mep14 = book1D("/iterN/mep14/",
368  "xmean_mep14",
369  "ME+1/4 weighted mean x residual per chamber (mm)",
370  xmean_bins,
371  xmean_low,
372  xmean_high);
373  m_xmean_mep21 = book1D("/iterN/mep21/",
374  "xmean_mep21",
375  "ME+2/1 weighted mean x residual per chamber (mm)",
376  xmean_bins,
377  xmean_low,
378  xmean_high);
379  m_xmean_mep22 = book1D("/iterN/mep22/",
380  "xmean_mep22",
381  "ME+2/2 weighted mean x residual per chamber (mm)",
382  xmean_bins,
383  xmean_low,
384  xmean_high);
385  m_xmean_mep31 = book1D("/iterN/mep31/",
386  "xmean_mep31",
387  "ME+3/1 weighted mean x residual per chamber (mm)",
388  xmean_bins,
389  xmean_low,
390  xmean_high);
391  m_xmean_mep32 = book1D("/iterN/mep32/",
392  "xmean_mep32",
393  "ME+3/2 weighted mean x residual per chamber (mm)",
394  xmean_bins,
395  xmean_low,
396  xmean_high);
397  m_xmean_mep41 = book1D("/iterN/mep41/",
398  "xmean_mep41",
399  "ME+4/1 weighted mean x residual per chamber (mm)",
400  xmean_bins,
401  xmean_low,
402  xmean_high);
403  m_xmean_mem11 = book1D("/iterN/mem11/",
404  "xmean_mem11",
405  "ME-1/1 weighted mean x residual per chamber (mm)",
406  xmean_bins,
407  xmean_low,
408  xmean_high);
409  m_xmean_mem12 = book1D("/iterN/mem12/",
410  "xmean_mem12",
411  "ME-1/2 weighted mean x residual per chamber (mm)",
412  xmean_bins,
413  xmean_low,
414  xmean_high);
415  m_xmean_mem13 = book1D("/iterN/mem13/",
416  "xmean_mem13",
417  "ME-1/3 weighted mean x residual per chamber (mm)",
418  xmean_bins,
419  xmean_low,
420  xmean_high);
421  m_xmean_mem14 = book1D("/iterN/mem14/",
422  "xmean_mem14",
423  "ME-1/4 weighted mean x residual per chamber (mm)",
424  xmean_bins,
425  xmean_low,
426  xmean_high);
427  m_xmean_mem21 = book1D("/iterN/mem21/",
428  "xmean_mem21",
429  "ME-2/1 weighted mean x residual per chamber (mm)",
430  xmean_bins,
431  xmean_low,
432  xmean_high);
433  m_xmean_mem22 = book1D("/iterN/mem22/",
434  "xmean_mem22",
435  "ME-2/2 weighted mean x residual per chamber (mm)",
436  xmean_bins,
437  xmean_low,
438  xmean_high);
439  m_xmean_mem31 = book1D("/iterN/mem31/",
440  "xmean_mem31",
441  "ME-3/1 weighted mean x residual per chamber (mm)",
442  xmean_bins,
443  xmean_low,
444  xmean_high);
445  m_xmean_mem32 = book1D("/iterN/mem32/",
446  "xmean_mem32",
447  "ME-3/2 weighted mean x residual per chamber (mm)",
448  xmean_bins,
449  xmean_low,
450  xmean_high);
451  m_xmean_mem41 = book1D("/iterN/mem41/",
452  "xmean_mem41",
453  "ME-4/1 weighted mean x residual per chamber (mm)",
454  xmean_bins,
455  xmean_low,
456  xmean_high);
457  m_xmean_me11 = book1D("/iterN/me11/",
458  "xmean_me11",
459  "ME1/1 weighted mean x residual per chamber (mm)",
460  xmean_bins,
461  xmean_low,
462  xmean_high);
463  m_xmean_me12 = book1D("/iterN/me12/",
464  "xmean_me12",
465  "ME1/2 weighted mean x residual per chamber (mm)",
466  xmean_bins,
467  xmean_low,
468  xmean_high);
469  m_xmean_me13 = book1D("/iterN/me13/",
470  "xmean_me13",
471  "ME1/3 weighted mean x residual per chamber (mm)",
472  xmean_bins,
473  xmean_low,
474  xmean_high);
475  m_xmean_me14 = book1D("/iterN/me14/",
476  "xmean_me14",
477  "ME1/4 weighted mean x residual per chamber (mm)",
478  xmean_bins,
479  xmean_low,
480  xmean_high);
481  m_xmean_me21 = book1D("/iterN/me21/",
482  "xmean_me21",
483  "ME2/1 weighted mean x residual per chamber (mm)",
484  xmean_bins,
485  xmean_low,
486  xmean_high);
487  m_xmean_me22 = book1D("/iterN/me22/",
488  "xmean_me22",
489  "ME2/2 weighted mean x residual per chamber (mm)",
490  xmean_bins,
491  xmean_low,
492  xmean_high);
493  m_xmean_me31 = book1D("/iterN/me31/",
494  "xmean_me31",
495  "ME3/1 weighted mean x residual per chamber (mm)",
496  xmean_bins,
497  xmean_low,
498  xmean_high);
499  m_xmean_me32 = book1D("/iterN/me32/",
500  "xmean_me32",
501  "ME3/2 weighted mean x residual per chamber (mm)",
502  xmean_bins,
503  xmean_low,
504  xmean_high);
505  m_xmean_me41 = book1D("/iterN/me41/",
506  "xmean_me41",
507  "ME4/1 weighted mean x residual per chamber (mm)",
508  xmean_bins,
509  xmean_low,
510  xmean_high);
511 
512  m_xstdev =
513  book1D("/iterN/", "xstdev", "weighted stdev x residual per chamber (mm)", xstdev_bins, xstdev_low, xstdev_high);
514  m_xstdev_mb = book1D("/iterN/mb/",
515  "xstdev_mb",
516  "barrel weighted stdev x residual per chamber (mm)",
517  xstdev_bins,
518  xstdev_low,
519  xstdev_high);
520  m_xstdev_me = book1D("/iterN/me/",
521  "xstdev_me",
522  "endcap weighted stdev x residual per chamber (mm)",
523  xstdev_bins,
524  xstdev_low,
525  xstdev_high);
526  m_xstdev_mb1 = book1D("/iterN/mb1/",
527  "xstdev_mb1",
528  "MB station 1 weighted stdev x residual per chamber (mm)",
529  xstdev_bins,
530  xstdev_low,
531  xstdev_high);
532  m_xstdev_mb2 = book1D("/iterN/mb2/",
533  "xstdev_mb2",
534  "MB station 2 weighted stdev x residual per chamber (mm)",
535  xstdev_bins,
536  xstdev_low,
537  xstdev_high);
538  m_xstdev_mb3 = book1D("/iterN/mb3/",
539  "xstdev_mb3",
540  "MB station 3 weighted stdev x residual per chamber (mm)",
541  xstdev_bins,
542  xstdev_low,
543  xstdev_high);
544  m_xstdev_mb4 = book1D("/iterN/mb4/",
545  "xstdev_mb4",
546  "MB station 4 weighted stdev x residual per chamber (mm)",
547  xstdev_bins,
548  xstdev_low,
549  xstdev_high);
550  m_xstdev_minus2 = book1D("/iterN/minus2/",
551  "xstdev_minus2",
552  "MB wheel -2 weighted stdev x residual per chamber (mm)",
553  xstdev_bins,
554  xstdev_low,
555  xstdev_high);
556  m_xstdev_minus1 = book1D("/iterN/minus1/",
557  "xstdev_minus1",
558  "MB wheel -1 weighted stdev x residual per chamber (mm)",
559  xstdev_bins,
560  xstdev_low,
561  xstdev_high);
562  m_xstdev_zero = book1D("/iterN/zero/",
563  "xstdev_zero",
564  "MB wheel 0 weighted stdev x residual per chamber (mm)",
565  xstdev_bins,
566  xstdev_low,
567  xstdev_high);
568  m_xstdev_plus1 = book1D("/iterN/plus1/",
569  "xstdev_plus1",
570  "MB wheel +1 weighted stdev x residual per chamber (mm)",
571  xstdev_bins,
572  xstdev_low,
573  xstdev_high);
574  m_xstdev_plus2 = book1D("/iterN/plus2/",
575  "xstdev_plus2",
576  "MB wheel +2 weighted stdev x residual per chamber (mm)",
577  xstdev_bins,
578  xstdev_low,
579  xstdev_high);
580  m_xstdev_mep11 = book1D("/iterN/mep11/",
581  "xstdev_mep11",
582  "ME+1/1 weighted stdev x residual per chamber (mm)",
583  xstdev_bins,
584  xstdev_low,
585  xstdev_high);
586  m_xstdev_mep12 = book1D("/iterN/mep12/",
587  "xstdev_mep12",
588  "ME+1/2 weighted stdev x residual per chamber (mm)",
589  xstdev_bins,
590  xstdev_low,
591  xstdev_high);
592  m_xstdev_mep13 = book1D("/iterN/mep13/",
593  "xstdev_mep13",
594  "ME+1/3 weighted stdev x residual per chamber (mm)",
595  xstdev_bins,
596  xstdev_low,
597  xstdev_high);
598  m_xstdev_mep14 = book1D("/iterN/mep14/",
599  "xstdev_mep14",
600  "ME+1/4 weighted stdev x residual per chamber (mm)",
601  xstdev_bins,
602  xstdev_low,
603  xstdev_high);
604  m_xstdev_mep21 = book1D("/iterN/mep21/",
605  "xstdev_mep21",
606  "ME+2/1 weighted stdev x residual per chamber (mm)",
607  xstdev_bins,
608  xstdev_low,
609  xstdev_high);
610  m_xstdev_mep22 = book1D("/iterN/mep22/",
611  "xstdev_mep22",
612  "ME+2/2 weighted stdev x residual per chamber (mm)",
613  xstdev_bins,
614  xstdev_low,
615  xstdev_high);
616  m_xstdev_mep31 = book1D("/iterN/mep31/",
617  "xstdev_mep31",
618  "ME+3/1 weighted stdev x residual per chamber (mm)",
619  xstdev_bins,
620  xstdev_low,
621  xstdev_high);
622  m_xstdev_mep32 = book1D("/iterN/mep32/",
623  "xstdev_mep32",
624  "ME+3/2 weighted stdev x residual per chamber (mm)",
625  xstdev_bins,
626  xstdev_low,
627  xstdev_high);
628  m_xstdev_mep41 = book1D("/iterN/mep41/",
629  "xstdev_mep41",
630  "ME+4/1 weighted stdev x residual per chamber (mm)",
631  xstdev_bins,
632  xstdev_low,
633  xstdev_high);
634  m_xstdev_mem11 = book1D("/iterN/mem11/",
635  "xstdev_mem11",
636  "ME-1/1 weighted stdev x residual per chamber (mm)",
637  xstdev_bins,
638  xstdev_low,
639  xstdev_high);
640  m_xstdev_mem12 = book1D("/iterN/mem12/",
641  "xstdev_mem12",
642  "ME-1/2 weighted stdev x residual per chamber (mm)",
643  xstdev_bins,
644  xstdev_low,
645  xstdev_high);
646  m_xstdev_mem13 = book1D("/iterN/mem13/",
647  "xstdev_mem13",
648  "ME-1/3 weighted stdev x residual per chamber (mm)",
649  xstdev_bins,
650  xstdev_low,
651  xstdev_high);
652  m_xstdev_mem14 = book1D("/iterN/mem14/",
653  "xstdev_mem14",
654  "ME-1/4 weighted stdev x residual per chamber (mm)",
655  xstdev_bins,
656  xstdev_low,
657  xstdev_high);
658  m_xstdev_mem21 = book1D("/iterN/mem21/",
659  "xstdev_mem21",
660  "ME-2/1 weighted stdev x residual per chamber (mm)",
661  xstdev_bins,
662  xstdev_low,
663  xstdev_high);
664  m_xstdev_mem22 = book1D("/iterN/mem22/",
665  "xstdev_mem22",
666  "ME-2/2 weighted stdev x residual per chamber (mm)",
667  xstdev_bins,
668  xstdev_low,
669  xstdev_high);
670  m_xstdev_mem31 = book1D("/iterN/mem31/",
671  "xstdev_mem31",
672  "ME-3/1 weighted stdev x residual per chamber (mm)",
673  xstdev_bins,
674  xstdev_low,
675  xstdev_high);
676  m_xstdev_mem32 = book1D("/iterN/mem32/",
677  "xstdev_mem32",
678  "ME-3/2 weighted stdev x residual per chamber (mm)",
679  xstdev_bins,
680  xstdev_low,
681  xstdev_high);
682  m_xstdev_mem41 = book1D("/iterN/mem41/",
683  "xstdev_mem41",
684  "ME-4/1 weighted stdev x residual per chamber (mm)",
685  xstdev_bins,
686  xstdev_low,
687  xstdev_high);
688  m_xstdev_me11 = book1D("/iterN/me11/",
689  "xstdev_me11",
690  "ME1/1 weighted stdev x residual per chamber (mm)",
691  xstdev_bins,
692  xstdev_low,
693  xstdev_high);
694  m_xstdev_me12 = book1D("/iterN/me12/",
695  "xstdev_me12",
696  "ME1/2 weighted stdev x residual per chamber (mm)",
697  xstdev_bins,
698  xstdev_low,
699  xstdev_high);
700  m_xstdev_me13 = book1D("/iterN/me13/",
701  "xstdev_me13",
702  "ME1/3 weighted stdev x residual per chamber (mm)",
703  xstdev_bins,
704  xstdev_low,
705  xstdev_high);
706  m_xstdev_me14 = book1D("/iterN/me14/",
707  "xstdev_me14",
708  "ME1/4 weighted stdev x residual per chamber (mm)",
709  xstdev_bins,
710  xstdev_low,
711  xstdev_high);
712  m_xstdev_me21 = book1D("/iterN/me21/",
713  "xstdev_me21",
714  "ME2/1 weighted stdev x residual per chamber (mm)",
715  xstdev_bins,
716  xstdev_low,
717  xstdev_high);
718  m_xstdev_me22 = book1D("/iterN/me22/",
719  "xstdev_me22",
720  "ME2/2 weighted stdev x residual per chamber (mm)",
721  xstdev_bins,
722  xstdev_low,
723  xstdev_high);
724  m_xstdev_me31 = book1D("/iterN/me31/",
725  "xstdev_me31",
726  "ME3/1 weighted stdev x residual per chamber (mm)",
727  xstdev_bins,
728  xstdev_low,
729  xstdev_high);
730  m_xstdev_me32 = book1D("/iterN/me32/",
731  "xstdev_me32",
732  "ME3/2 weighted stdev x residual per chamber (mm)",
733  xstdev_bins,
734  xstdev_low,
735  xstdev_high);
736  m_xstdev_me41 = book1D("/iterN/me41/",
737  "xstdev_me41",
738  "ME4/1 weighted stdev x residual per chamber (mm)",
739  xstdev_bins,
740  xstdev_low,
741  xstdev_high);
742 
743  m_xerronmean = book1D("/iterN/",
744  "xerronmean",
745  "error on x weighted mean residual per chamber (mm)",
749  m_xerronmean_mb = book1D("/iterN/mb/",
750  "xerronmean_mb",
751  "barrel error on x weighted mean residual per chamber (mm)",
755  m_xerronmean_me = book1D("/iterN/me/",
756  "xerronmean_me",
757  "endcap error on x weighted mean residual per chamber (mm)",
761  m_xerronmean_mb1 = book1D("/iterN/mb1/",
762  "xerronmean_mb1",
763  "MB station 1 error on x weighted mean residual per chamber (mm)",
767  m_xerronmean_mb2 = book1D("/iterN/mb2/",
768  "xerronmean_mb2",
769  "MB station 2 error on x weighted mean residual per chamber (mm)",
773  m_xerronmean_mb3 = book1D("/iterN/mb3/",
774  "xerronmean_mb3",
775  "MB station 3 error on x weighted mean residual per chamber (mm)",
779  m_xerronmean_mb4 = book1D("/iterN/mb4/",
780  "xerronmean_mb4",
781  "MB station 4 error on x weighted mean residual per chamber (mm)",
785  m_xerronmean_minus2 = book1D("/iterN/minus2/",
786  "xerronmean_minus2",
787  "MB wheel -2 error on x weighted mean residual per chamber (mm)",
791  m_xerronmean_minus1 = book1D("/iterN/minus1/",
792  "xerronmean_minus1",
793  "MB wheel -1 error on x weighted mean residual per chamber (mm)",
797  m_xerronmean_zero = book1D("/iterN/zero/",
798  "xerronmean_zero",
799  "MB wheel 0 error on x weighted mean residual per chamber (mm)",
803  m_xerronmean_plus1 = book1D("/iterN/plus1/",
804  "xerronmean_plus1",
805  "MB wheel +1 error on x weighted mean residual per chamber (mm)",
809  m_xerronmean_plus2 = book1D("/iterN/plus2/",
810  "xerronmean_plus2",
811  "MB wheel +2 error on x weighted mean residual per chamber (mm)",
815  m_xerronmean_mep11 = book1D("/iterN/mep11/",
816  "xerronmean_mep11",
817  "ME+1/1 error on x weighted mean residual per chamber (mm)",
821  m_xerronmean_mep12 = book1D("/iterN/mep12/",
822  "xerronmean_mep12",
823  "ME+1/2 error on x weighted mean residual per chamber (mm)",
827  m_xerronmean_mep13 = book1D("/iterN/mep13/",
828  "xerronmean_mep13",
829  "ME+1/3 error on x weighted mean residual per chamber (mm)",
833  m_xerronmean_mep14 = book1D("/iterN/mep14/",
834  "xerronmean_mep14",
835  "ME+1/4 error on x weighted mean residual per chamber (mm)",
839  m_xerronmean_mep21 = book1D("/iterN/mep21/",
840  "xerronmean_mep21",
841  "ME+2/1 error on x weighted mean residual per chamber (mm)",
845  m_xerronmean_mep22 = book1D("/iterN/mep22/",
846  "xerronmean_mep22",
847  "ME+2/2 error on x weighted mean residual per chamber (mm)",
851  m_xerronmean_mep31 = book1D("/iterN/mep31/",
852  "xerronmean_mep31",
853  "ME+3/1 error on x weighted mean residual per chamber (mm)",
857  m_xerronmean_mep32 = book1D("/iterN/mep32/",
858  "xerronmean_mep32",
859  "ME+3/2 error on x weighted mean residual per chamber (mm)",
863  m_xerronmean_mep41 = book1D("/iterN/mep41/",
864  "xerronmean_mep41",
865  "ME+4/1 error on x weighted mean residual per chamber (mm)",
869  m_xerronmean_mem11 = book1D("/iterN/mem11/",
870  "xerronmean_mem11",
871  "ME-1/1 error on x weighted mean residual per chamber (mm)",
875  m_xerronmean_mem12 = book1D("/iterN/mem12/",
876  "xerronmean_mem12",
877  "ME-1/2 error on x weighted mean residual per chamber (mm)",
881  m_xerronmean_mem13 = book1D("/iterN/mem13/",
882  "xerronmean_mem13",
883  "ME-1/3 error on x weighted mean residual per chamber (mm)",
887  m_xerronmean_mem14 = book1D("/iterN/mem14/",
888  "xerronmean_mem14",
889  "ME-1/4 error on x weighted mean residual per chamber (mm)",
893  m_xerronmean_mem21 = book1D("/iterN/mem21/",
894  "xerronmean_mem21",
895  "ME-2/1 error on x weighted mean residual per chamber (mm)",
899  m_xerronmean_mem22 = book1D("/iterN/mem22/",
900  "xerronmean_mem22",
901  "ME-2/2 error on x weighted mean residual per chamber (mm)",
905  m_xerronmean_mem31 = book1D("/iterN/mem31/",
906  "xerronmean_mem31",
907  "ME-3/1 error on x weighted mean residual per chamber (mm)",
911  m_xerronmean_mem32 = book1D("/iterN/mem32/",
912  "xerronmean_mem32",
913  "ME-3/2 error on x weighted mean residual per chamber (mm)",
917  m_xerronmean_mem41 = book1D("/iterN/mem41/",
918  "xerronmean_mem41",
919  "ME-4/1 error on x weighted mean residual per chamber (mm)",
923  m_xerronmean_me11 = book1D("/iterN/me11/",
924  "xerronmean_me11",
925  "ME1/1 error on x weighted mean residual per chamber (mm)",
929  m_xerronmean_me12 = book1D("/iterN/me12/",
930  "xerronmean_me12",
931  "ME1/2 error on x weighted mean residual per chamber (mm)",
935  m_xerronmean_me13 = book1D("/iterN/me13/",
936  "xerronmean_me13",
937  "ME1/3 error on x weighted mean residual per chamber (mm)",
941  m_xerronmean_me14 = book1D("/iterN/me14/",
942  "xerronmean_me14",
943  "ME1/4 error on x weighted mean residual per chamber (mm)",
947  m_xerronmean_me21 = book1D("/iterN/me21/",
948  "xerronmean_me21",
949  "ME2/1 error on x weighted mean residual per chamber (mm)",
953  m_xerronmean_me22 = book1D("/iterN/me22/",
954  "xerronmean_me22",
955  "ME2/2 error on x weighted mean residual per chamber (mm)",
959  m_xerronmean_me31 = book1D("/iterN/me31/",
960  "xerronmean_me31",
961  "ME3/1 error on x weighted mean residual per chamber (mm)",
965  m_xerronmean_me32 = book1D("/iterN/me32/",
966  "xerronmean_me32",
967  "ME3/2 error on x weighted mean residual per chamber (mm)",
971  m_xerronmean_me41 = book1D("/iterN/me41/",
972  "xerronmean_me41",
973  "ME4/1 error on x weighted mean residual per chamber (mm)",
977 
978  m_yresid = book1D("/iterN/", "yresid", "y residual (mm)", yresid_bins, yresid_low, yresid_high);
979  m_yresid_mb = book1D("/iterN/mb/", "yresid_mb", "barrel y residual (mm)", yresid_bins, yresid_low, yresid_high);
980  m_yresid_me = book1D("/iterN/me/", "yresid_me", "endcap y residual (mm)", yresid_bins, yresid_low, yresid_high);
981  m_yresid_mb1 =
982  book1D("/iterN/mb1/", "yresid_mb1", "MB station 1 y residual (mm)", yresid_bins, yresid_low, yresid_high);
983  m_yresid_mb2 =
984  book1D("/iterN/mb2/", "yresid_mb2", "MB station 2 y residual (mm)", yresid_bins, yresid_low, yresid_high);
985  m_yresid_mb3 =
986  book1D("/iterN/mb3/", "yresid_mb3", "MB station 3 y residual (mm)", yresid_bins, yresid_low, yresid_high);
987  m_yresid_mb4 =
988  book1D("/iterN/mb4/", "yresid_mb4", "MB station 4 y residual (mm)", yresid_bins, yresid_low, yresid_high);
990  book1D("/iterN/minus2/", "yresid_minus2", "MB wheel -2 y residual (mm)", yresid_bins, yresid_low, yresid_high);
992  book1D("/iterN/minus1/", "yresid_minus1", "MB wheel -1 y residual (mm)", yresid_bins, yresid_low, yresid_high);
993  m_yresid_zero =
994  book1D("/iterN/zero/", "yresid_zero", "MB wheel 0 y residual (mm)", yresid_bins, yresid_low, yresid_high);
996  book1D("/iterN/plus1/", "yresid_plus1", "MB wheel +1 y residual (mm)", yresid_bins, yresid_low, yresid_high);
998  book1D("/iterN/plus2/", "yresid_plus2", "MB wheel +2 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1000  book1D("/iterN/mep11/", "yresid_mep11", "ME+1/1 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1001  m_yresid_mep12 =
1002  book1D("/iterN/mep12/", "yresid_mep12", "ME+1/2 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1003  m_yresid_mep13 =
1004  book1D("/iterN/mep13/", "yresid_mep13", "ME+1/3 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1005  m_yresid_mep14 =
1006  book1D("/iterN/mep14/", "yresid_mep14", "ME+1/4 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1007  m_yresid_mep21 =
1008  book1D("/iterN/mep21/", "yresid_mep21", "ME+2/1 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1009  m_yresid_mep22 =
1010  book1D("/iterN/mep22/", "yresid_mep22", "ME+2/2 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1011  m_yresid_mep31 =
1012  book1D("/iterN/mep31/", "yresid_mep31", "ME+3/1 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1013  m_yresid_mep32 =
1014  book1D("/iterN/mep32/", "yresid_mep32", "ME+3/2 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1015  m_yresid_mep41 =
1016  book1D("/iterN/mep41/", "yresid_mep41", "ME+4/1 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1017  m_yresid_mem11 =
1018  book1D("/iterN/mem11/", "yresid_mem11", "ME-1/1 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1019  m_yresid_mem12 =
1020  book1D("/iterN/mem12/", "yresid_mem12", "ME-1/2 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1021  m_yresid_mem13 =
1022  book1D("/iterN/mem13/", "yresid_mem13", "ME-1/3 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1023  m_yresid_mem14 =
1024  book1D("/iterN/mem14/", "yresid_mem14", "ME-1/4 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1025  m_yresid_mem21 =
1026  book1D("/iterN/mem21/", "yresid_mem21", "ME-2/1 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1027  m_yresid_mem22 =
1028  book1D("/iterN/mem22/", "yresid_mem22", "ME-2/2 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1029  m_yresid_mem31 =
1030  book1D("/iterN/mem31/", "yresid_mem31", "ME-3/1 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1031  m_yresid_mem32 =
1032  book1D("/iterN/mem32/", "yresid_mem32", "ME-3/2 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1033  m_yresid_mem41 =
1034  book1D("/iterN/mem41/", "yresid_mem41", "ME-4/1 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1035  m_yresid_me11 = book1D("/iterN/me11/", "yresid_me11", "ME1/1 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1036  m_yresid_me12 = book1D("/iterN/me12/", "yresid_me12", "ME1/2 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1037  m_yresid_me13 = book1D("/iterN/me13/", "yresid_me13", "ME1/3 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1038  m_yresid_me14 = book1D("/iterN/me14/", "yresid_me14", "ME1/4 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1039  m_yresid_me21 = book1D("/iterN/me21/", "yresid_me21", "ME2/1 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1040  m_yresid_me22 = book1D("/iterN/me22/", "yresid_me22", "ME2/2 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1041  m_yresid_me31 = book1D("/iterN/me31/", "yresid_me31", "ME3/1 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1042  m_yresid_me32 = book1D("/iterN/me32/", "yresid_me32", "ME3/2 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1043  m_yresid_me41 = book1D("/iterN/me41/", "yresid_me41", "ME4/1 y residual (mm)", yresid_bins, yresid_low, yresid_high);
1044 
1045  m_ymean = book1D("/iterN/", "ymean", "weighted mean y residual per chamber (mm)", ymean_bins, ymean_low, ymean_high);
1046  m_ymean_mb = book1D(
1047  "/iterN/mb/", "ymean_mb", "barrel weighted mean y residual per chamber (mm)", ymean_bins, ymean_low, ymean_high);
1048  m_ymean_me = book1D(
1049  "/iterN/me/", "ymean_me", "endcap weighted mean y residual per chamber (mm)", ymean_bins, ymean_low, ymean_high);
1050  m_ymean_mb1 = book1D("/iterN/mb1/",
1051  "ymean_mb1",
1052  "MB station 1 weighted mean y residual per chamber (mm)",
1053  ymean_bins,
1054  ymean_low,
1055  ymean_high);
1056  m_ymean_mb2 = book1D("/iterN/mb2/",
1057  "ymean_mb2",
1058  "MB station 2 weighted mean y residual per chamber (mm)",
1059  ymean_bins,
1060  ymean_low,
1061  ymean_high);
1062  m_ymean_mb3 = book1D("/iterN/mb3/",
1063  "ymean_mb3",
1064  "MB station 3 weighted mean y residual per chamber (mm)",
1065  ymean_bins,
1066  ymean_low,
1067  ymean_high);
1068  m_ymean_mb4 = book1D("/iterN/mb4/",
1069  "ymean_mb4",
1070  "MB station 4 weighted mean y residual per chamber (mm)",
1071  ymean_bins,
1072  ymean_low,
1073  ymean_high);
1074  m_ymean_minus2 = book1D("/iterN/minus2/",
1075  "ymean_minus2",
1076  "MB wheel -2 weighted mean y residual per chamber (mm)",
1077  ymean_bins,
1078  ymean_low,
1079  ymean_high);
1080  m_ymean_minus1 = book1D("/iterN/minus1/",
1081  "ymean_minus1",
1082  "MB wheel -1 weighted mean y residual per chamber (mm)",
1083  ymean_bins,
1084  ymean_low,
1085  ymean_high);
1086  m_ymean_zero = book1D("/iterN/zero/",
1087  "ymean_zero",
1088  "MB wheel 0 weighted mean y residual per chamber (mm)",
1089  ymean_bins,
1090  ymean_low,
1091  ymean_high);
1092  m_ymean_plus1 = book1D("/iterN/plus1/",
1093  "ymean_plus1",
1094  "MB wheel +1 weighted mean y residual per chamber (mm)",
1095  ymean_bins,
1096  ymean_low,
1097  ymean_high);
1098  m_ymean_plus2 = book1D("/iterN/plus2/",
1099  "ymean_plus2",
1100  "MB wheel +2 weighted mean y residual per chamber (mm)",
1101  ymean_bins,
1102  ymean_low,
1103  ymean_high);
1104  m_ymean_mep11 = book1D("/iterN/mep11/",
1105  "ymean_mep11",
1106  "ME+1/1 weighted mean y residual per chamber (mm)",
1107  ymean_bins,
1108  ymean_low,
1109  ymean_high);
1110  m_ymean_mep12 = book1D("/iterN/mep12/",
1111  "ymean_mep12",
1112  "ME+1/2 weighted mean y residual per chamber (mm)",
1113  ymean_bins,
1114  ymean_low,
1115  ymean_high);
1116  m_ymean_mep13 = book1D("/iterN/mep13/",
1117  "ymean_mep13",
1118  "ME+1/3 weighted mean y residual per chamber (mm)",
1119  ymean_bins,
1120  ymean_low,
1121  ymean_high);
1122  m_ymean_mep14 = book1D("/iterN/mep14/",
1123  "ymean_mep14",
1124  "ME+1/4 weighted mean y residual per chamber (mm)",
1125  ymean_bins,
1126  ymean_low,
1127  ymean_high);
1128  m_ymean_mep21 = book1D("/iterN/mep21/",
1129  "ymean_mep21",
1130  "ME+2/1 weighted mean y residual per chamber (mm)",
1131  ymean_bins,
1132  ymean_low,
1133  ymean_high);
1134  m_ymean_mep22 = book1D("/iterN/mep22/",
1135  "ymean_mep22",
1136  "ME+2/2 weighted mean y residual per chamber (mm)",
1137  ymean_bins,
1138  ymean_low,
1139  ymean_high);
1140  m_ymean_mep31 = book1D("/iterN/mep31/",
1141  "ymean_mep31",
1142  "ME+3/1 weighted mean y residual per chamber (mm)",
1143  ymean_bins,
1144  ymean_low,
1145  ymean_high);
1146  m_ymean_mep32 = book1D("/iterN/mep32/",
1147  "ymean_mep32",
1148  "ME+3/2 weighted mean y residual per chamber (mm)",
1149  ymean_bins,
1150  ymean_low,
1151  ymean_high);
1152  m_ymean_mep41 = book1D("/iterN/mep41/",
1153  "ymean_mep41",
1154  "ME+4/1 weighted mean y residual per chamber (mm)",
1155  ymean_bins,
1156  ymean_low,
1157  ymean_high);
1158  m_ymean_mem11 = book1D("/iterN/mem11/",
1159  "ymean_mem11",
1160  "ME-1/1 weighted mean y residual per chamber (mm)",
1161  ymean_bins,
1162  ymean_low,
1163  ymean_high);
1164  m_ymean_mem12 = book1D("/iterN/mem12/",
1165  "ymean_mem12",
1166  "ME-1/2 weighted mean y residual per chamber (mm)",
1167  ymean_bins,
1168  ymean_low,
1169  ymean_high);
1170  m_ymean_mem13 = book1D("/iterN/mem13/",
1171  "ymean_mem13",
1172  "ME-1/3 weighted mean y residual per chamber (mm)",
1173  ymean_bins,
1174  ymean_low,
1175  ymean_high);
1176  m_ymean_mem14 = book1D("/iterN/mem14/",
1177  "ymean_mem14",
1178  "ME-1/4 weighted mean y residual per chamber (mm)",
1179  ymean_bins,
1180  ymean_low,
1181  ymean_high);
1182  m_ymean_mem21 = book1D("/iterN/mem21/",
1183  "ymean_mem21",
1184  "ME-2/1 weighted mean y residual per chamber (mm)",
1185  ymean_bins,
1186  ymean_low,
1187  ymean_high);
1188  m_ymean_mem22 = book1D("/iterN/mem22/",
1189  "ymean_mem22",
1190  "ME-2/2 weighted mean y residual per chamber (mm)",
1191  ymean_bins,
1192  ymean_low,
1193  ymean_high);
1194  m_ymean_mem31 = book1D("/iterN/mem31/",
1195  "ymean_mem31",
1196  "ME-3/1 weighted mean y residual per chamber (mm)",
1197  ymean_bins,
1198  ymean_low,
1199  ymean_high);
1200  m_ymean_mem32 = book1D("/iterN/mem32/",
1201  "ymean_mem32",
1202  "ME-3/2 weighted mean y residual per chamber (mm)",
1203  ymean_bins,
1204  ymean_low,
1205  ymean_high);
1206  m_ymean_mem41 = book1D("/iterN/mem41/",
1207  "ymean_mem41",
1208  "ME-4/1 weighted mean y residual per chamber (mm)",
1209  ymean_bins,
1210  ymean_low,
1211  ymean_high);
1212  m_ymean_me11 = book1D("/iterN/me11/",
1213  "ymean_me11",
1214  "ME1/1 weighted mean y residual per chamber (mm)",
1215  ymean_bins,
1216  ymean_low,
1217  ymean_high);
1218  m_ymean_me12 = book1D("/iterN/me12/",
1219  "ymean_me12",
1220  "ME1/2 weighted mean y residual per chamber (mm)",
1221  ymean_bins,
1222  ymean_low,
1223  ymean_high);
1224  m_ymean_me13 = book1D("/iterN/me13/",
1225  "ymean_me13",
1226  "ME1/3 weighted mean y residual per chamber (mm)",
1227  ymean_bins,
1228  ymean_low,
1229  ymean_high);
1230  m_ymean_me14 = book1D("/iterN/me14/",
1231  "ymean_me14",
1232  "ME1/4 weighted mean y residual per chamber (mm)",
1233  ymean_bins,
1234  ymean_low,
1235  ymean_high);
1236  m_ymean_me21 = book1D("/iterN/me21/",
1237  "ymean_me21",
1238  "ME2/1 weighted mean y residual per chamber (mm)",
1239  ymean_bins,
1240  ymean_low,
1241  ymean_high);
1242  m_ymean_me22 = book1D("/iterN/me22/",
1243  "ymean_me22",
1244  "ME2/2 weighted mean y residual per chamber (mm)",
1245  ymean_bins,
1246  ymean_low,
1247  ymean_high);
1248  m_ymean_me31 = book1D("/iterN/me31/",
1249  "ymean_me31",
1250  "ME3/1 weighted mean y residual per chamber (mm)",
1251  ymean_bins,
1252  ymean_low,
1253  ymean_high);
1254  m_ymean_me32 = book1D("/iterN/me32/",
1255  "ymean_me32",
1256  "ME3/2 weighted mean y residual per chamber (mm)",
1257  ymean_bins,
1258  ymean_low,
1259  ymean_high);
1260  m_ymean_me41 = book1D("/iterN/me41/",
1261  "ymean_me41",
1262  "ME4/1 weighted mean y residual per chamber (mm)",
1263  ymean_bins,
1264  ymean_low,
1265  ymean_high);
1266 
1267  m_ystdev =
1268  book1D("/iterN/", "ystdev", "weighted stdev y residual per chamber (mm)", ystdev_bins, ystdev_low, ystdev_high);
1269  m_ystdev_mb = book1D("/iterN/mb/",
1270  "ystdev_mb",
1271  "barrel weighted stdev y residual per chamber (mm)",
1272  ystdev_bins,
1273  ystdev_low,
1274  ystdev_high);
1275  m_ystdev_me = book1D("/iterN/me/",
1276  "ystdev_me",
1277  "endcap weighted stdev y residual per chamber (mm)",
1278  ystdev_bins,
1279  ystdev_low,
1280  ystdev_high);
1281  m_ystdev_mb1 = book1D("/iterN/mb1/",
1282  "ystdev_mb1",
1283  "MB station 1 weighted stdev y residual per chamber (mm)",
1284  ystdev_bins,
1285  ystdev_low,
1286  ystdev_high);
1287  m_ystdev_mb2 = book1D("/iterN/mb2/",
1288  "ystdev_mb2",
1289  "MB station 2 weighted stdev y residual per chamber (mm)",
1290  ystdev_bins,
1291  ystdev_low,
1292  ystdev_high);
1293  m_ystdev_mb3 = book1D("/iterN/mb3/",
1294  "ystdev_mb3",
1295  "MB station 3 weighted stdev y residual per chamber (mm)",
1296  ystdev_bins,
1297  ystdev_low,
1298  ystdev_high);
1299  m_ystdev_mb4 = book1D("/iterN/mb4/",
1300  "ystdev_mb4",
1301  "MB station 4 weighted stdev y residual per chamber (mm)",
1302  ystdev_bins,
1303  ystdev_low,
1304  ystdev_high);
1305  m_ystdev_minus2 = book1D("/iterN/minus2/",
1306  "ystdev_minus2",
1307  "MB wheel -2 weighted stdev y residual per chamber (mm)",
1308  ystdev_bins,
1309  ystdev_low,
1310  ystdev_high);
1311  m_ystdev_minus1 = book1D("/iterN/minus1/",
1312  "ystdev_minus1",
1313  "MB wheel -1 weighted stdev y residual per chamber (mm)",
1314  ystdev_bins,
1315  ystdev_low,
1316  ystdev_high);
1317  m_ystdev_zero = book1D("/iterN/zero/",
1318  "ystdev_zero",
1319  "MB wheel 0 weighted stdev y residual per chamber (mm)",
1320  ystdev_bins,
1321  ystdev_low,
1322  ystdev_high);
1323  m_ystdev_plus1 = book1D("/iterN/plus1/",
1324  "ystdev_plus1",
1325  "MB wheel +1 weighted stdev y residual per chamber (mm)",
1326  ystdev_bins,
1327  ystdev_low,
1328  ystdev_high);
1329  m_ystdev_plus2 = book1D("/iterN/plus2/",
1330  "ystdev_plus2",
1331  "MB wheel +2 weighted stdev y residual per chamber (mm)",
1332  ystdev_bins,
1333  ystdev_low,
1334  ystdev_high);
1335  m_ystdev_mep11 = book1D("/iterN/mep11/",
1336  "ystdev_mep11",
1337  "ME+1/1 weighted stdev y residual per chamber (mm)",
1338  ystdev_bins,
1339  ystdev_low,
1340  ystdev_high);
1341  m_ystdev_mep12 = book1D("/iterN/mep12/",
1342  "ystdev_mep12",
1343  "ME+1/2 weighted stdev y residual per chamber (mm)",
1344  ystdev_bins,
1345  ystdev_low,
1346  ystdev_high);
1347  m_ystdev_mep13 = book1D("/iterN/mep13/",
1348  "ystdev_mep13",
1349  "ME+1/3 weighted stdev y residual per chamber (mm)",
1350  ystdev_bins,
1351  ystdev_low,
1352  ystdev_high);
1353  m_ystdev_mep14 = book1D("/iterN/mep14/",
1354  "ystdev_mep14",
1355  "ME+1/4 weighted stdev y residual per chamber (mm)",
1356  ystdev_bins,
1357  ystdev_low,
1358  ystdev_high);
1359  m_ystdev_mep21 = book1D("/iterN/mep21/",
1360  "ystdev_mep21",
1361  "ME+2/1 weighted stdev y residual per chamber (mm)",
1362  ystdev_bins,
1363  ystdev_low,
1364  ystdev_high);
1365  m_ystdev_mep22 = book1D("/iterN/mep22/",
1366  "ystdev_mep22",
1367  "ME+2/2 weighted stdev y residual per chamber (mm)",
1368  ystdev_bins,
1369  ystdev_low,
1370  ystdev_high);
1371  m_ystdev_mep31 = book1D("/iterN/mep31/",
1372  "ystdev_mep31",
1373  "ME+3/1 weighted stdev y residual per chamber (mm)",
1374  ystdev_bins,
1375  ystdev_low,
1376  ystdev_high);
1377  m_ystdev_mep32 = book1D("/iterN/mep32/",
1378  "ystdev_mep32",
1379  "ME+3/2 weighted stdev y residual per chamber (mm)",
1380  ystdev_bins,
1381  ystdev_low,
1382  ystdev_high);
1383  m_ystdev_mep41 = book1D("/iterN/mep41/",
1384  "ystdev_mep41",
1385  "ME+4/1 weighted stdev y residual per chamber (mm)",
1386  ystdev_bins,
1387  ystdev_low,
1388  ystdev_high);
1389  m_ystdev_mem11 = book1D("/iterN/mem11/",
1390  "ystdev_mem11",
1391  "ME-1/1 weighted stdev y residual per chamber (mm)",
1392  ystdev_bins,
1393  ystdev_low,
1394  ystdev_high);
1395  m_ystdev_mem12 = book1D("/iterN/mem12/",
1396  "ystdev_mem12",
1397  "ME-1/2 weighted stdev y residual per chamber (mm)",
1398  ystdev_bins,
1399  ystdev_low,
1400  ystdev_high);
1401  m_ystdev_mem13 = book1D("/iterN/mem13/",
1402  "ystdev_mem13",
1403  "ME-1/3 weighted stdev y residual per chamber (mm)",
1404  ystdev_bins,
1405  ystdev_low,
1406  ystdev_high);
1407  m_ystdev_mem14 = book1D("/iterN/mem14/",
1408  "ystdev_mem14",
1409  "ME-1/4 weighted stdev y residual per chamber (mm)",
1410  ystdev_bins,
1411  ystdev_low,
1412  ystdev_high);
1413  m_ystdev_mem21 = book1D("/iterN/mem21/",
1414  "ystdev_mem21",
1415  "ME-2/1 weighted stdev y residual per chamber (mm)",
1416  ystdev_bins,
1417  ystdev_low,
1418  ystdev_high);
1419  m_ystdev_mem22 = book1D("/iterN/mem22/",
1420  "ystdev_mem22",
1421  "ME-2/2 weighted stdev y residual per chamber (mm)",
1422  ystdev_bins,
1423  ystdev_low,
1424  ystdev_high);
1425  m_ystdev_mem31 = book1D("/iterN/mem31/",
1426  "ystdev_mem31",
1427  "ME-3/1 weighted stdev y residual per chamber (mm)",
1428  ystdev_bins,
1429  ystdev_low,
1430  ystdev_high);
1431  m_ystdev_mem32 = book1D("/iterN/mem32/",
1432  "ystdev_mem32",
1433  "ME-3/2 weighted stdev y residual per chamber (mm)",
1434  ystdev_bins,
1435  ystdev_low,
1436  ystdev_high);
1437  m_ystdev_mem41 = book1D("/iterN/mem41/",
1438  "ystdev_mem41",
1439  "ME-4/1 weighted stdev y residual per chamber (mm)",
1440  ystdev_bins,
1441  ystdev_low,
1442  ystdev_high);
1443  m_ystdev_me11 = book1D("/iterN/me11/",
1444  "ystdev_me11",
1445  "ME1/1 weighted stdev y residual per chamber (mm)",
1446  ystdev_bins,
1447  ystdev_low,
1448  ystdev_high);
1449  m_ystdev_me12 = book1D("/iterN/me12/",
1450  "ystdev_me12",
1451  "ME1/2 weighted stdev y residual per chamber (mm)",
1452  ystdev_bins,
1453  ystdev_low,
1454  ystdev_high);
1455  m_ystdev_me13 = book1D("/iterN/me13/",
1456  "ystdev_me13",
1457  "ME1/3 weighted stdev y residual per chamber (mm)",
1458  ystdev_bins,
1459  ystdev_low,
1460  ystdev_high);
1461  m_ystdev_me14 = book1D("/iterN/me14/",
1462  "ystdev_me14",
1463  "ME1/4 weighted stdev y residual per chamber (mm)",
1464  ystdev_bins,
1465  ystdev_low,
1466  ystdev_high);
1467  m_ystdev_me21 = book1D("/iterN/me21/",
1468  "ystdev_me21",
1469  "ME2/1 weighted stdev y residual per chamber (mm)",
1470  ystdev_bins,
1471  ystdev_low,
1472  ystdev_high);
1473  m_ystdev_me22 = book1D("/iterN/me22/",
1474  "ystdev_me22",
1475  "ME2/2 weighted stdev y residual per chamber (mm)",
1476  ystdev_bins,
1477  ystdev_low,
1478  ystdev_high);
1479  m_ystdev_me31 = book1D("/iterN/me31/",
1480  "ystdev_me31",
1481  "ME3/1 weighted stdev y residual per chamber (mm)",
1482  ystdev_bins,
1483  ystdev_low,
1484  ystdev_high);
1485  m_ystdev_me32 = book1D("/iterN/me32/",
1486  "ystdev_me32",
1487  "ME3/2 weighted stdev y residual per chamber (mm)",
1488  ystdev_bins,
1489  ystdev_low,
1490  ystdev_high);
1491  m_ystdev_me41 = book1D("/iterN/me41/",
1492  "ystdev_me41",
1493  "ME4/1 weighted stdev y residual per chamber (mm)",
1494  ystdev_bins,
1495  ystdev_low,
1496  ystdev_high);
1497 
1498  m_yerronmean = book1D("/iterN/",
1499  "yerronmean",
1500  "error on y weighted mean residual per chamber (mm)",
1503  yerronmean_high);
1504  m_yerronmean_mb = book1D("/iterN/mb/",
1505  "yerronmean_mb",
1506  "barrel error on y weighted mean residual per chamber (mm)",
1509  yerronmean_high);
1510  m_yerronmean_me = book1D("/iterN/me/",
1511  "yerronmean_me",
1512  "endcap error on y weighted mean residual per chamber (mm)",
1515  yerronmean_high);
1516  m_yerronmean_mb1 = book1D("/iterN/mb1/",
1517  "yerronmean_mb1",
1518  "MB station 1 error on y weighted mean residual per chamber (mm)",
1521  yerronmean_high);
1522  m_yerronmean_mb2 = book1D("/iterN/mb2/",
1523  "yerronmean_mb2",
1524  "MB station 2 error on y weighted mean residual per chamber (mm)",
1527  yerronmean_high);
1528  m_yerronmean_mb3 = book1D("/iterN/mb3/",
1529  "yerronmean_mb3",
1530  "MB station 3 error on y weighted mean residual per chamber (mm)",
1533  yerronmean_high);
1534  m_yerronmean_mb4 = book1D("/iterN/mb4/",
1535  "yerronmean_mb4",
1536  "MB station 4 error on y weighted mean residual per chamber (mm)",
1539  yerronmean_high);
1540  m_yerronmean_minus2 = book1D("/iterN/minus2/",
1541  "yerronmean_minus2",
1542  "MB wheel -2 error on y weighted mean residual per chamber (mm)",
1545  yerronmean_high);
1546  m_yerronmean_minus1 = book1D("/iterN/minus1/",
1547  "yerronmean_minus1",
1548  "MB wheel -1 error on y weighted mean residual per chamber (mm)",
1551  yerronmean_high);
1552  m_yerronmean_zero = book1D("/iterN/zero/",
1553  "yerronmean_zero",
1554  "MB wheel 0 error on y weighted mean residual per chamber (mm)",
1557  yerronmean_high);
1558  m_yerronmean_plus1 = book1D("/iterN/plus1/",
1559  "yerronmean_plus1",
1560  "MB wheel +1 error on y weighted mean residual per chamber (mm)",
1563  yerronmean_high);
1564  m_yerronmean_plus2 = book1D("/iterN/plus2/",
1565  "yerronmean_plus2",
1566  "MB wheel +2 error on y weighted mean residual per chamber (mm)",
1569  yerronmean_high);
1570  m_yerronmean_mep11 = book1D("/iterN/mep11/",
1571  "yerronmean_mep11",
1572  "ME+1/1 error on y weighted mean residual per chamber (mm)",
1575  yerronmean_high);
1576  m_yerronmean_mep12 = book1D("/iterN/mep12/",
1577  "yerronmean_mep12",
1578  "ME+1/2 error on y weighted mean residual per chamber (mm)",
1581  yerronmean_high);
1582  m_yerronmean_mep13 = book1D("/iterN/mep13/",
1583  "yerronmean_mep13",
1584  "ME+1/3 error on y weighted mean residual per chamber (mm)",
1587  yerronmean_high);
1588  m_yerronmean_mep14 = book1D("/iterN/mep14/",
1589  "yerronmean_mep14",
1590  "ME+1/4 error on y weighted mean residual per chamber (mm)",
1593  yerronmean_high);
1594  m_yerronmean_mep21 = book1D("/iterN/mep21/",
1595  "yerronmean_mep21",
1596  "ME+2/1 error on y weighted mean residual per chamber (mm)",
1599  yerronmean_high);
1600  m_yerronmean_mep22 = book1D("/iterN/mep22/",
1601  "yerronmean_mep22",
1602  "ME+2/2 error on y weighted mean residual per chamber (mm)",
1605  yerronmean_high);
1606  m_yerronmean_mep31 = book1D("/iterN/mep31/",
1607  "yerronmean_mep31",
1608  "ME+3/1 error on y weighted mean residual per chamber (mm)",
1611  yerronmean_high);
1612  m_yerronmean_mep32 = book1D("/iterN/mep32/",
1613  "yerronmean_mep32",
1614  "ME+3/2 error on y weighted mean residual per chamber (mm)",
1617  yerronmean_high);
1618  m_yerronmean_mep41 = book1D("/iterN/mep41/",
1619  "yerronmean_mep41",
1620  "ME+4/1 error on y weighted mean residual per chamber (mm)",
1623  yerronmean_high);
1624  m_yerronmean_mem11 = book1D("/iterN/mem11/",
1625  "yerronmean_mem11",
1626  "ME-1/1 error on y weighted mean residual per chamber (mm)",
1629  yerronmean_high);
1630  m_yerronmean_mem12 = book1D("/iterN/mem12/",
1631  "yerronmean_mem12",
1632  "ME-1/2 error on y weighted mean residual per chamber (mm)",
1635  yerronmean_high);
1636  m_yerronmean_mem13 = book1D("/iterN/mem13/",
1637  "yerronmean_mem13",
1638  "ME-1/3 error on y weighted mean residual per chamber (mm)",
1641  yerronmean_high);
1642  m_yerronmean_mem14 = book1D("/iterN/mem14/",
1643  "yerronmean_mem14",
1644  "ME-1/4 error on y weighted mean residual per chamber (mm)",
1647  yerronmean_high);
1648  m_yerronmean_mem21 = book1D("/iterN/mem21/",
1649  "yerronmean_mem21",
1650  "ME-2/1 error on y weighted mean residual per chamber (mm)",
1653  yerronmean_high);
1654  m_yerronmean_mem22 = book1D("/iterN/mem22/",
1655  "yerronmean_mem22",
1656  "ME-2/2 error on y weighted mean residual per chamber (mm)",
1659  yerronmean_high);
1660  m_yerronmean_mem31 = book1D("/iterN/mem31/",
1661  "yerronmean_mem31",
1662  "ME-3/1 error on y weighted mean residual per chamber (mm)",
1665  yerronmean_high);
1666  m_yerronmean_mem32 = book1D("/iterN/mem32/",
1667  "yerronmean_mem32",
1668  "ME-3/2 error on y weighted mean residual per chamber (mm)",
1671  yerronmean_high);
1672  m_yerronmean_mem41 = book1D("/iterN/mem41/",
1673  "yerronmean_mem41",
1674  "ME-4/1 error on y weighted mean residual per chamber (mm)",
1677  yerronmean_high);
1678  m_yerronmean_me11 = book1D("/iterN/me11/",
1679  "yerronmean_me11",
1680  "ME1/1 error on y weighted mean residual per chamber (mm)",
1683  yerronmean_high);
1684  m_yerronmean_me12 = book1D("/iterN/me12/",
1685  "yerronmean_me12",
1686  "ME1/2 error on y weighted mean residual per chamber (mm)",
1689  yerronmean_high);
1690  m_yerronmean_me13 = book1D("/iterN/me13/",
1691  "yerronmean_me13",
1692  "ME1/3 error on y weighted mean residual per chamber (mm)",
1695  yerronmean_high);
1696  m_yerronmean_me14 = book1D("/iterN/me14/",
1697  "yerronmean_me14",
1698  "ME1/4 error on y weighted mean residual per chamber (mm)",
1701  yerronmean_high);
1702  m_yerronmean_me21 = book1D("/iterN/me21/",
1703  "yerronmean_me21",
1704  "ME2/1 error on y weighted mean residual per chamber (mm)",
1707  yerronmean_high);
1708  m_yerronmean_me22 = book1D("/iterN/me22/",
1709  "yerronmean_me22",
1710  "ME2/2 error on y weighted mean residual per chamber (mm)",
1713  yerronmean_high);
1714  m_yerronmean_me31 = book1D("/iterN/me31/",
1715  "yerronmean_me31",
1716  "ME3/1 error on y weighted mean residual per chamber (mm)",
1719  yerronmean_high);
1720  m_yerronmean_me32 = book1D("/iterN/me32/",
1721  "yerronmean_me32",
1722  "ME3/2 error on y weighted mean residual per chamber (mm)",
1725  yerronmean_high);
1726  m_yerronmean_me41 = book1D("/iterN/me41/",
1727  "yerronmean_me41",
1728  "ME4/1 error on y weighted mean residual per chamber (mm)",
1731  yerronmean_high);
1732 
1733  m_chambers = directory("/iterN/")->make<TTree>("chambers", "residual statistics for each chamber");
1734  m_chambers->Branch("rawid", &m_chambers_rawid, "rawid/I");
1735  m_chambers->Branch("endcap", &m_chambers_endcap, "endcap/I");
1736  m_chambers->Branch("wheel", &m_chambers_wheel, "wheel/I");
1737  m_chambers->Branch("station", &m_chambers_station, "station/I");
1738  m_chambers->Branch("sector", &m_chambers_sector, "sector/I");
1739  m_chambers->Branch("ring", &m_chambers_ring, "ring/I");
1740  m_chambers->Branch("chamber", &m_chambers_chamber, "chamber/I");
1741  m_chambers->Branch("numx", &m_chambers_numx, "numx/I");
1742  m_chambers->Branch("x_w", &m_chambers_x_w, "x_w/F");
1743  m_chambers->Branch("x_ww", &m_chambers_x_ww, "x_ww/F");
1744  m_chambers->Branch("x_wx", &m_chambers_x_wx, "x_wx/F");
1745  m_chambers->Branch("x_wxx", &m_chambers_x_wxx, "x_wxx/F");
1746  m_chambers->Branch("numy", &m_chambers_numy, "numy/I");
1747  m_chambers->Branch("y_w", &m_chambers_y_w, "y_w/F");
1748  m_chambers->Branch("y_ww", &m_chambers_y_ww, "y_ww/F");
1749  m_chambers->Branch("y_wy", &m_chambers_y_wy, "y_wy/F");
1750  m_chambers->Branch("y_wyy", &m_chambers_y_wyy, "y_wyy/F");
1751 }
1752 
1754  const edm::EventSetup &iSetup,
1756  TrajectoryStateCombiner tsoscomb;
1757 
1758  for (ConstTrajTrackPairCollection::const_iterator it = tracks.begin(); it != tracks.end(); ++it) {
1759  const Trajectory *traj = it->first;
1760  // const reco::Track *track = it->second;
1761 
1762  std::vector<TrajectoryMeasurement> measurements = traj->measurements();
1763 
1764  for (std::vector<TrajectoryMeasurement>::const_iterator im = measurements.begin(); im != measurements.end(); ++im) {
1765  const TrajectoryMeasurement &meas = *im;
1766  const TransientTrackingRecHit *hit = &(*meas.recHit());
1767  const DetId id = hit->geographicalId();
1768 
1769  if (hit->isValid() && pNavigator()->detAndSubdetInMap(id)) {
1771  align::LocalPoint trackPos = tsosc.localPosition();
1772  LocalError trackErr = tsosc.localError().positionError();
1773  align::LocalPoint hitPos = hit->localPosition();
1774  LocalError hitErr = hit->localPositionError(); // CPE+APE
1775 
1776  // subtract APEs from hitErr (if existing) from covariance matrix
1777  auto det = static_cast<const TrackerGeomDet *>(hit->det());
1778  const auto localAPE = det->localAlignmentError();
1779  if (localAPE.valid()) {
1780  hitErr = LocalError(hitErr.xx() - localAPE.xx(), hitErr.xy() - localAPE.xy(), hitErr.yy() - localAPE.yy());
1781  }
1782 
1783  double x_residual = 10. * (trackPos.x() - hitPos.x());
1784  double y_residual = 10. * (trackPos.y() - hitPos.y());
1785  double x_reserr2 = 100. * (trackErr.xx() + hitErr.xx());
1786  double y_reserr2 = 100. * (trackErr.yy() + hitErr.yy());
1787  // double xpos = trackPos.x();
1788  // double ypos = trackPos.y();
1789 
1790  if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::DT) {
1791  if (fabs(hit->surface()->toGlobal(align::LocalVector(0, 1, 0)).z()) < 0.1) {
1792  // local y != global z: it's a middle (y-measuring) superlayer
1793  y_residual = x_residual;
1794  y_reserr2 = x_reserr2;
1795 
1796  x_residual = 0.;
1797  x_reserr2 = 0.;
1798  } else {
1799  y_residual = 0.;
1800  y_reserr2 = 0.;
1801  }
1802 
1803  if (x_reserr2 > 0.) {
1804  m_xresid->Fill(x_residual, 1. / x_reserr2);
1805  m_xresid_mb->Fill(x_residual, 1. / x_reserr2);
1806  }
1807  if (y_reserr2 > 0.) {
1808  m_yresid->Fill(y_residual, 1. / y_reserr2);
1809  m_yresid_mb->Fill(y_residual, 1. / y_reserr2);
1810  }
1811 
1812  DTChamberId dtId(id.rawId());
1813  int rawId = dtId.rawId();
1814  if (x_reserr2 > 0.) {
1815  m_numx[rawId]++;
1816  m_x_w[rawId] += 1. / x_reserr2;
1817  m_x_ww[rawId] += 1. / x_reserr2 / x_reserr2;
1818  m_x_wx[rawId] += x_residual / x_reserr2;
1819  m_x_wxx[rawId] += x_residual * x_residual / x_reserr2;
1820  }
1821  if (y_reserr2 > 0.) {
1822  m_numy[rawId]++;
1823  m_y_w[rawId] += 1. / y_reserr2;
1824  m_y_ww[rawId] += 1. / y_reserr2 / y_reserr2;
1825  m_y_wy[rawId] += y_residual / y_reserr2;
1826  m_y_wyy[rawId] += y_residual * y_residual / y_reserr2;
1827  }
1828 
1829  if (dtId.station() == 1) {
1830  if (x_reserr2 > 0.) {
1831  m_xresid_mb1->Fill(x_residual, 1. / x_reserr2);
1832  }
1833  if (y_reserr2 > 0.) {
1834  m_yresid_mb1->Fill(y_residual, 1. / y_reserr2);
1835  }
1836  } else if (dtId.station() == 2) {
1837  if (x_reserr2 > 0.) {
1838  m_xresid_mb2->Fill(x_residual, 1. / x_reserr2);
1839  }
1840  if (y_reserr2 > 0.) {
1841  m_yresid_mb2->Fill(y_residual, 1. / y_reserr2);
1842  }
1843  } else if (dtId.station() == 3) {
1844  if (x_reserr2 > 0.) {
1845  m_xresid_mb3->Fill(x_residual, 1. / x_reserr2);
1846  }
1847  if (y_reserr2 > 0.) {
1848  m_yresid_mb3->Fill(y_residual, 1. / y_reserr2);
1849  }
1850  } else if (dtId.station() == 4) {
1851  if (x_reserr2 > 0.) {
1852  m_xresid_mb4->Fill(x_residual, 1. / x_reserr2);
1853  }
1854  if (y_reserr2 > 0.) {
1855  m_yresid_mb4->Fill(y_residual, 1. / y_reserr2);
1856  }
1857  }
1858 
1859  if (dtId.wheel() == -2) {
1860  if (x_reserr2 > 0.) {
1861  m_xresid_minus2->Fill(x_residual, 1. / x_reserr2);
1862  }
1863  if (y_reserr2 > 0.) {
1864  m_yresid_minus2->Fill(y_residual, 1. / y_reserr2);
1865  }
1866  } else if (dtId.wheel() == -1) {
1867  if (x_reserr2 > 0.) {
1868  m_xresid_minus1->Fill(x_residual, 1. / x_reserr2);
1869  }
1870  if (y_reserr2 > 0.) {
1871  m_yresid_minus1->Fill(y_residual, 1. / y_reserr2);
1872  }
1873  } else if (dtId.wheel() == 0) {
1874  if (x_reserr2 > 0.) {
1875  m_xresid_zero->Fill(x_residual, 1. / x_reserr2);
1876  }
1877  if (y_reserr2 > 0.) {
1878  m_yresid_zero->Fill(y_residual, 1. / y_reserr2);
1879  }
1880  } else if (dtId.wheel() == 1) {
1881  if (x_reserr2 > 0.) {
1882  m_xresid_plus1->Fill(x_residual, 1. / x_reserr2);
1883  }
1884  if (y_reserr2 > 0.) {
1885  m_yresid_plus1->Fill(y_residual, 1. / y_reserr2);
1886  }
1887  } else if (dtId.wheel() == 2) {
1888  if (x_reserr2 > 0.) {
1889  m_xresid_plus2->Fill(x_residual, 1. / x_reserr2);
1890  }
1891  if (y_reserr2 > 0.) {
1892  m_yresid_plus2->Fill(y_residual, 1. / y_reserr2);
1893  }
1894  }
1895  } // end if DT
1896 
1897  else if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::CSC) {
1898  m_xresid->Fill(x_residual, 1. / x_reserr2);
1899  m_yresid->Fill(y_residual, 1. / y_reserr2);
1900 
1901  m_xresid_me->Fill(x_residual, 1. / x_reserr2);
1902  m_yresid_me->Fill(y_residual, 1. / y_reserr2);
1903 
1904  CSCDetId cscId(id.rawId());
1905  int rawId = cscId.chamberId().rawId();
1906  if (x_reserr2 > 0.) {
1907  m_numx[rawId]++;
1908  m_x_w[rawId] += 1. / x_reserr2;
1909  m_x_ww[rawId] += 1. / x_reserr2 / x_reserr2;
1910  m_x_wx[rawId] += x_residual / x_reserr2;
1911  m_x_wxx[rawId] += x_residual * x_residual / x_reserr2;
1912  }
1913  if (y_reserr2 > 0.) {
1914  m_numy[rawId]++;
1915  m_y_w[rawId] += 1. / y_reserr2;
1916  m_y_ww[rawId] += 1. / y_reserr2 / y_reserr2;
1917  m_y_wy[rawId] += y_residual / y_reserr2;
1918  m_y_wyy[rawId] += y_residual * y_residual / y_reserr2;
1919  }
1920 
1921  if ((cscId.endcap() == 1 ? 1 : -1) * cscId.station() == 1 && cscId.ring() == 1) {
1922  m_xresid_mep11->Fill(x_residual, 1. / x_reserr2);
1923  m_yresid_mep11->Fill(y_residual, 1. / y_reserr2);
1924  m_xresid_me11->Fill(x_residual, 1. / x_reserr2);
1925  m_yresid_me11->Fill(y_residual, 1. / y_reserr2);
1926  } else if ((cscId.endcap() == 1 ? 1 : -1) * cscId.station() == -1 && cscId.ring() == 1) {
1927  m_xresid_mem11->Fill(x_residual, 1. / x_reserr2);
1928  m_yresid_mem11->Fill(y_residual, 1. / y_reserr2);
1929  m_xresid_me11->Fill(x_residual, 1. / x_reserr2);
1930  m_yresid_me11->Fill(y_residual, 1. / y_reserr2);
1931  } else if ((cscId.endcap() == 1 ? 1 : -1) * cscId.station() == 1 && cscId.ring() == 2) {
1932  m_xresid_mep12->Fill(x_residual, 1. / x_reserr2);
1933  m_yresid_mep12->Fill(y_residual, 1. / y_reserr2);
1934  m_xresid_me12->Fill(x_residual, 1. / x_reserr2);
1935  m_yresid_me12->Fill(y_residual, 1. / y_reserr2);
1936  } else if ((cscId.endcap() == 1 ? 1 : -1) * cscId.station() == -1 && cscId.ring() == 2) {
1937  m_xresid_mem12->Fill(x_residual, 1. / x_reserr2);
1938  m_yresid_mem12->Fill(y_residual, 1. / y_reserr2);
1939  m_xresid_me12->Fill(x_residual, 1. / x_reserr2);
1940  m_yresid_me12->Fill(y_residual, 1. / y_reserr2);
1941  } else if ((cscId.endcap() == 1 ? 1 : -1) * cscId.station() == 1 && cscId.ring() == 3) {
1942  m_xresid_mep13->Fill(x_residual, 1. / x_reserr2);
1943  m_yresid_mep13->Fill(y_residual, 1. / y_reserr2);
1944  m_xresid_me13->Fill(x_residual, 1. / x_reserr2);
1945  m_yresid_me13->Fill(y_residual, 1. / y_reserr2);
1946  } else if ((cscId.endcap() == 1 ? 1 : -1) * cscId.station() == -1 && cscId.ring() == 3) {
1947  m_xresid_mem13->Fill(x_residual, 1. / x_reserr2);
1948  m_yresid_mem13->Fill(y_residual, 1. / y_reserr2);
1949  m_xresid_me13->Fill(x_residual, 1. / x_reserr2);
1950  m_yresid_me13->Fill(y_residual, 1. / y_reserr2);
1951  } else if ((cscId.endcap() == 1 ? 1 : -1) * cscId.station() == 1 && cscId.ring() == 4) {
1952  m_xresid_mep14->Fill(x_residual, 1. / x_reserr2);
1953  m_yresid_mep14->Fill(y_residual, 1. / y_reserr2);
1954  m_xresid_me14->Fill(x_residual, 1. / x_reserr2);
1955  m_yresid_me14->Fill(y_residual, 1. / y_reserr2);
1956  } else if ((cscId.endcap() == 1 ? 1 : -1) * cscId.station() == -1 && cscId.ring() == 4) {
1957  m_xresid_mem14->Fill(x_residual, 1. / x_reserr2);
1958  m_yresid_mem14->Fill(y_residual, 1. / y_reserr2);
1959  m_xresid_me14->Fill(x_residual, 1. / x_reserr2);
1960  m_yresid_me14->Fill(y_residual, 1. / y_reserr2);
1961  } else if ((cscId.endcap() == 1 ? 1 : -1) * cscId.station() == 2 && cscId.ring() == 1) {
1962  m_xresid_mep21->Fill(x_residual, 1. / x_reserr2);
1963  m_yresid_mep21->Fill(y_residual, 1. / y_reserr2);
1964  m_xresid_me21->Fill(x_residual, 1. / x_reserr2);
1965  m_yresid_me21->Fill(y_residual, 1. / y_reserr2);
1966  } else if ((cscId.endcap() == 1 ? 1 : -1) * cscId.station() == -2 && cscId.ring() == 1) {
1967  m_xresid_mem21->Fill(x_residual, 1. / x_reserr2);
1968  m_yresid_mem21->Fill(y_residual, 1. / y_reserr2);
1969  m_xresid_me21->Fill(x_residual, 1. / x_reserr2);
1970  m_yresid_me21->Fill(y_residual, 1. / y_reserr2);
1971  } else if ((cscId.endcap() == 1 ? 1 : -1) * cscId.station() == 2 && cscId.ring() == 2) {
1972  m_xresid_mep22->Fill(x_residual, 1. / x_reserr2);
1973  m_yresid_mep22->Fill(y_residual, 1. / y_reserr2);
1974  m_xresid_me22->Fill(x_residual, 1. / x_reserr2);
1975  m_yresid_me22->Fill(y_residual, 1. / y_reserr2);
1976  } else if ((cscId.endcap() == 1 ? 1 : -1) * cscId.station() == -2 && cscId.ring() == 2) {
1977  m_xresid_mem22->Fill(x_residual, 1. / x_reserr2);
1978  m_yresid_mem22->Fill(y_residual, 1. / y_reserr2);
1979  m_xresid_me22->Fill(x_residual, 1. / x_reserr2);
1980  m_yresid_me22->Fill(y_residual, 1. / y_reserr2);
1981  } else if ((cscId.endcap() == 1 ? 1 : -1) * cscId.station() == 3 && cscId.ring() == 1) {
1982  m_xresid_mep31->Fill(x_residual, 1. / x_reserr2);
1983  m_yresid_mep31->Fill(y_residual, 1. / y_reserr2);
1984  m_xresid_me31->Fill(x_residual, 1. / x_reserr2);
1985  m_yresid_me31->Fill(y_residual, 1. / y_reserr2);
1986  } else if ((cscId.endcap() == 1 ? 1 : -1) * cscId.station() == -3 && cscId.ring() == 1) {
1987  m_xresid_mem31->Fill(x_residual, 1. / x_reserr2);
1988  m_yresid_mem31->Fill(y_residual, 1. / y_reserr2);
1989  m_xresid_me31->Fill(x_residual, 1. / x_reserr2);
1990  m_yresid_me31->Fill(y_residual, 1. / y_reserr2);
1991  } else if ((cscId.endcap() == 1 ? 1 : -1) * cscId.station() == 3 && cscId.ring() == 2) {
1992  m_xresid_mep32->Fill(x_residual, 1. / x_reserr2);
1993  m_yresid_mep32->Fill(y_residual, 1. / y_reserr2);
1994  m_xresid_me32->Fill(x_residual, 1. / x_reserr2);
1995  m_yresid_me32->Fill(y_residual, 1. / y_reserr2);
1996  } else if ((cscId.endcap() == 1 ? 1 : -1) * cscId.station() == -3 && cscId.ring() == 2) {
1997  m_xresid_mem32->Fill(x_residual, 1. / x_reserr2);
1998  m_yresid_mem32->Fill(y_residual, 1. / y_reserr2);
1999  m_xresid_me32->Fill(x_residual, 1. / x_reserr2);
2000  m_yresid_me32->Fill(y_residual, 1. / y_reserr2);
2001  } else if ((cscId.endcap() == 1 ? 1 : -1) * cscId.station() == 4 && cscId.ring() == 1) {
2002  m_xresid_mep41->Fill(x_residual, 1. / x_reserr2);
2003  m_yresid_mep41->Fill(y_residual, 1. / y_reserr2);
2004  m_xresid_me41->Fill(x_residual, 1. / x_reserr2);
2005  m_yresid_me41->Fill(y_residual, 1. / y_reserr2);
2006  } else if ((cscId.endcap() == 1 ? 1 : -1) * cscId.station() == -4 && cscId.ring() == 1) {
2007  m_xresid_mem41->Fill(x_residual, 1. / x_reserr2);
2008  m_yresid_mem41->Fill(y_residual, 1. / y_reserr2);
2009  m_xresid_me41->Fill(x_residual, 1. / x_reserr2);
2010  m_yresid_me41->Fill(y_residual, 1. / y_reserr2);
2011  }
2012  } // else if CSC
2013 
2014  } // end if good hit
2015  } // end loop over measurements
2016 
2017  } // end loop over track-trajectories
2018 }
2019 
2022  for (const auto &iter : pMuon()->DTChambers())
2023  chambers.push_back(iter);
2024  for (const auto &iter : pMuon()->CSCChambers())
2025  chambers.push_back(iter);
2026 
2027  int index = 0;
2028  for (const auto &chamber : chambers) {
2029  const int id = chamber->geomDetId().rawId();
2030 
2031  m_chambers_rawid = id;
2033  m_chambers_x_w = m_x_w[id];
2038  m_chambers_y_w = m_y_w[id];
2042 
2043  index++;
2044  m_sumnumx->SetBinContent(index, m_numx[id]);
2045  m_sumnumy->SetBinContent(index, m_numy[id]);
2046 
2047  std::ostringstream name;
2048  if (chamber->geomDetId().subdetId() == MuonSubdetId::DT) {
2049  DTChamberId dtId(chamber->geomDetId());
2050  name << "MB" << dtId.wheel() << "/" << dtId.station() << " (" << dtId.sector() << ")";
2051  m_chambers_endcap = 0;
2052  m_chambers_wheel = dtId.wheel();
2053  m_chambers_station = dtId.station();
2054  m_chambers_sector = dtId.sector();
2055  m_chambers_ring = 0;
2056  m_chambers_chamber = 0;
2057  } else {
2058  CSCDetId cscId(chamber->geomDetId());
2059  name << "ME" << (cscId.endcap() == 1 ? "+" : "-") << cscId.station() << "/" << cscId.ring() << " ("
2060  << cscId.chamber() << ")";
2061  m_chambers_endcap = cscId.endcap();
2062  m_chambers_wheel = 0;
2063  m_chambers_station = cscId.station();
2064  m_chambers_sector = 0;
2065  m_chambers_ring = cscId.ring();
2066  m_chambers_chamber = cscId.chamber();
2067  }
2068  m_chambers->Fill();
2069 
2070  m_sumnumx->GetXaxis()->SetBinLabel(index, name.str().c_str());
2071  m_sumnumy->GetXaxis()->SetBinLabel(index, name.str().c_str());
2072  m_xsummary->GetXaxis()->SetBinLabel(index, name.str().c_str());
2073  m_ysummary->GetXaxis()->SetBinLabel(index, name.str().c_str());
2074 
2075  if (m_numx[id] > 0.) {
2076  double xmean = m_x_wx[id] / m_x_w[id];
2077  double xstdev =
2078  sqrt(((m_x_wxx[id] * m_x_w[id]) - (m_x_wx[id] * m_x_wx[id])) / ((m_x_w[id] * m_x_w[id]) - m_x_ww[id]));
2079  double xerronmean = xstdev / sqrt(m_numx[id]);
2080 
2081  m_xsummary->SetBinContent(index, xmean);
2082  m_xsummary->SetBinError(index, xerronmean);
2083 
2084  m_xmean->Fill(xmean);
2085  m_xstdev->Fill(xstdev);
2086  m_xerronmean->Fill(xerronmean);
2087  if (chamber->geomDetId().subdetId() == MuonSubdetId::DT) {
2088  m_xmean_mb->Fill(xmean);
2089  m_xstdev_mb->Fill(xstdev);
2090  m_xerronmean_mb->Fill(xerronmean);
2091  DTChamberId id(chamber->geomDetId().rawId());
2092  if (id.station() == 1) {
2093  m_xmean_mb1->Fill(xmean);
2094  m_xstdev_mb1->Fill(xstdev);
2095  m_xerronmean_mb1->Fill(xerronmean);
2096  } else if (id.station() == 2) {
2097  m_xmean_mb2->Fill(xmean);
2098  m_xstdev_mb2->Fill(xstdev);
2099  m_xerronmean_mb2->Fill(xerronmean);
2100  } else if (id.station() == 3) {
2101  m_xmean_mb3->Fill(xmean);
2102  m_xstdev_mb3->Fill(xstdev);
2103  m_xerronmean_mb3->Fill(xerronmean);
2104  } else if (id.station() == 4) {
2105  m_xmean_mb4->Fill(xmean);
2106  m_xstdev_mb4->Fill(xstdev);
2107  m_xerronmean_mb4->Fill(xerronmean);
2108  }
2109 
2110  if (id.wheel() == -2) {
2111  m_xmean_minus2->Fill(xmean);
2112  m_xstdev_minus2->Fill(xstdev);
2113  m_xerronmean_minus2->Fill(xerronmean);
2114  } else if (id.wheel() == -1) {
2115  m_xmean_minus1->Fill(xmean);
2116  m_xstdev_minus1->Fill(xstdev);
2117  m_xerronmean_minus1->Fill(xerronmean);
2118  } else if (id.wheel() == 0) {
2119  m_xmean_zero->Fill(xmean);
2120  m_xstdev_zero->Fill(xstdev);
2121  m_xerronmean_zero->Fill(xerronmean);
2122  } else if (id.wheel() == 1) {
2123  m_xmean_plus1->Fill(xmean);
2124  m_xstdev_plus1->Fill(xstdev);
2125  m_xerronmean_plus1->Fill(xerronmean);
2126  } else if (id.wheel() == 2) {
2127  m_xmean_plus2->Fill(xmean);
2128  m_xstdev_plus2->Fill(xstdev);
2129  m_xerronmean_plus2->Fill(xerronmean);
2130  }
2131  } // end if DT
2132  else {
2133  m_xmean_me->Fill(xmean);
2134  m_xstdev_me->Fill(xstdev);
2135  m_xerronmean_me->Fill(xerronmean);
2136 
2137  CSCDetId id(chamber->geomDetId().rawId());
2138 
2139  if ((id.endcap() == 1 ? 1 : -1) * id.station() == 1 && id.ring() == 1) {
2140  m_xmean_mep11->Fill(xmean);
2141  m_xstdev_mep11->Fill(xstdev);
2142  m_xerronmean_mep11->Fill(xerronmean);
2143  m_xmean_me11->Fill(xmean);
2144  m_xstdev_me11->Fill(xstdev);
2145  m_xerronmean_me11->Fill(xerronmean);
2146  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == -1 && id.ring() == 1) {
2147  m_xmean_mem11->Fill(xmean);
2148  m_xstdev_mem11->Fill(xstdev);
2149  m_xerronmean_mem11->Fill(xerronmean);
2150  m_xmean_me11->Fill(xmean);
2151  m_xstdev_me11->Fill(xstdev);
2152  m_xerronmean_me11->Fill(xerronmean);
2153  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == 1 && id.ring() == 2) {
2154  m_xmean_mep12->Fill(xmean);
2155  m_xstdev_mep12->Fill(xstdev);
2156  m_xerronmean_mep12->Fill(xerronmean);
2157  m_xmean_me12->Fill(xmean);
2158  m_xstdev_me12->Fill(xstdev);
2159  m_xerronmean_me12->Fill(xerronmean);
2160  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == -1 && id.ring() == 2) {
2161  m_xmean_mem12->Fill(xmean);
2162  m_xstdev_mem12->Fill(xstdev);
2163  m_xerronmean_mem12->Fill(xerronmean);
2164  m_xmean_me12->Fill(xmean);
2165  m_xstdev_me12->Fill(xstdev);
2166  m_xerronmean_me12->Fill(xerronmean);
2167  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == 1 && id.ring() == 3) {
2168  m_xmean_mep13->Fill(xmean);
2169  m_xstdev_mep13->Fill(xstdev);
2170  m_xerronmean_mep13->Fill(xerronmean);
2171  m_xmean_me13->Fill(xmean);
2172  m_xstdev_me13->Fill(xstdev);
2173  m_xerronmean_me13->Fill(xerronmean);
2174  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == -1 && id.ring() == 3) {
2175  m_xmean_mem13->Fill(xmean);
2176  m_xstdev_mem13->Fill(xstdev);
2177  m_xerronmean_mem13->Fill(xerronmean);
2178  m_xmean_me13->Fill(xmean);
2179  m_xstdev_me13->Fill(xstdev);
2180  m_xerronmean_me13->Fill(xerronmean);
2181  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == 1 && id.ring() == 4) {
2182  m_xmean_mep14->Fill(xmean);
2183  m_xstdev_mep14->Fill(xstdev);
2184  m_xerronmean_mep14->Fill(xerronmean);
2185  m_xmean_me14->Fill(xmean);
2186  m_xstdev_me14->Fill(xstdev);
2187  m_xerronmean_me14->Fill(xerronmean);
2188  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == -1 && id.ring() == 4) {
2189  m_xmean_mem14->Fill(xmean);
2190  m_xstdev_mem14->Fill(xstdev);
2191  m_xerronmean_mem14->Fill(xerronmean);
2192  m_xmean_me14->Fill(xmean);
2193  m_xstdev_me14->Fill(xstdev);
2194  m_xerronmean_me14->Fill(xerronmean);
2195  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == 2 && id.ring() == 1) {
2196  m_xmean_mep21->Fill(xmean);
2197  m_xstdev_mep21->Fill(xstdev);
2198  m_xerronmean_mep21->Fill(xerronmean);
2199  m_xmean_me21->Fill(xmean);
2200  m_xstdev_me21->Fill(xstdev);
2201  m_xerronmean_me21->Fill(xerronmean);
2202  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == -2 && id.ring() == 1) {
2203  m_xmean_mem21->Fill(xmean);
2204  m_xstdev_mem21->Fill(xstdev);
2205  m_xerronmean_mem21->Fill(xerronmean);
2206  m_xmean_me21->Fill(xmean);
2207  m_xstdev_me21->Fill(xstdev);
2208  m_xerronmean_me21->Fill(xerronmean);
2209  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == 2 && id.ring() == 2) {
2210  m_xmean_mep22->Fill(xmean);
2211  m_xstdev_mep22->Fill(xstdev);
2212  m_xerronmean_mep22->Fill(xerronmean);
2213  m_xmean_me22->Fill(xmean);
2214  m_xstdev_me22->Fill(xstdev);
2215  m_xerronmean_me22->Fill(xerronmean);
2216  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == -2 && id.ring() == 2) {
2217  m_xmean_mem22->Fill(xmean);
2218  m_xstdev_mem22->Fill(xstdev);
2219  m_xerronmean_mem22->Fill(xerronmean);
2220  m_xmean_me22->Fill(xmean);
2221  m_xstdev_me22->Fill(xstdev);
2222  m_xerronmean_me22->Fill(xerronmean);
2223  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == 3 && id.ring() == 1) {
2224  m_xmean_mep31->Fill(xmean);
2225  m_xstdev_mep31->Fill(xstdev);
2226  m_xerronmean_mep31->Fill(xerronmean);
2227  m_xmean_me31->Fill(xmean);
2228  m_xstdev_me31->Fill(xstdev);
2229  m_xerronmean_me31->Fill(xerronmean);
2230  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == -3 && id.ring() == 1) {
2231  m_xmean_mem31->Fill(xmean);
2232  m_xstdev_mem31->Fill(xstdev);
2233  m_xerronmean_mem31->Fill(xerronmean);
2234  m_xmean_me31->Fill(xmean);
2235  m_xstdev_me31->Fill(xstdev);
2236  m_xerronmean_me31->Fill(xerronmean);
2237  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == 3 && id.ring() == 2) {
2238  m_xmean_mep32->Fill(xmean);
2239  m_xstdev_mep32->Fill(xstdev);
2240  m_xerronmean_mep32->Fill(xerronmean);
2241  m_xmean_me32->Fill(xmean);
2242  m_xstdev_me32->Fill(xstdev);
2243  m_xerronmean_me32->Fill(xerronmean);
2244  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == -3 && id.ring() == 2) {
2245  m_xmean_mem32->Fill(xmean);
2246  m_xstdev_mem32->Fill(xstdev);
2247  m_xerronmean_mem32->Fill(xerronmean);
2248  m_xmean_me32->Fill(xmean);
2249  m_xstdev_me32->Fill(xstdev);
2250  m_xerronmean_me32->Fill(xerronmean);
2251  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == 4 && id.ring() == 1) {
2252  m_xmean_mep41->Fill(xmean);
2253  m_xstdev_mep41->Fill(xstdev);
2254  m_xerronmean_mep41->Fill(xerronmean);
2255  m_xmean_me41->Fill(xmean);
2256  m_xstdev_me41->Fill(xstdev);
2257  m_xerronmean_me41->Fill(xerronmean);
2258  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == -4 && id.ring() == 1) {
2259  m_xmean_mem41->Fill(xmean);
2260  m_xstdev_mem41->Fill(xstdev);
2261  m_xerronmean_mem41->Fill(xerronmean);
2262  m_xmean_me41->Fill(xmean);
2263  m_xstdev_me41->Fill(xstdev);
2264  m_xerronmean_me41->Fill(xerronmean);
2265  }
2266  } // else itis CSC
2267  } // end if xmean, xstdev exist
2268 
2269  if (m_numy[id] > 0.) {
2270  double ymean = m_y_wy[id] / m_y_w[id];
2271  double ystdev =
2272  sqrt(((m_y_wyy[id] * m_y_w[id]) - (m_y_wy[id] * m_y_wy[id])) / ((m_y_w[id] * m_y_w[id]) - m_y_ww[id]));
2273  double yerronmean = ystdev / sqrt(m_numy[id]);
2274 
2275  m_ysummary->SetBinContent(index, ymean);
2276  m_ysummary->SetBinError(index, yerronmean);
2277 
2278  m_ymean->Fill(ymean);
2279  m_ystdev->Fill(ystdev);
2280  m_yerronmean->Fill(yerronmean);
2281  if (chamber->geomDetId().subdetId() == MuonSubdetId::DT) {
2282  m_ymean_mb->Fill(ymean);
2283  m_ystdev_mb->Fill(ystdev);
2284  m_yerronmean_mb->Fill(yerronmean);
2285  DTChamberId id(chamber->geomDetId().rawId());
2286  if (id.station() == 1) {
2287  m_ymean_mb1->Fill(ymean);
2288  m_ystdev_mb1->Fill(ystdev);
2289  m_yerronmean_mb1->Fill(yerronmean);
2290  } else if (id.station() == 2) {
2291  m_ymean_mb2->Fill(ymean);
2292  m_ystdev_mb2->Fill(ystdev);
2293  m_yerronmean_mb2->Fill(yerronmean);
2294  } else if (id.station() == 3) {
2295  m_ymean_mb3->Fill(ymean);
2296  m_ystdev_mb3->Fill(ystdev);
2297  m_yerronmean_mb3->Fill(yerronmean);
2298  } else if (id.station() == 4) {
2299  m_ymean_mb4->Fill(ymean);
2300  m_ystdev_mb4->Fill(ystdev);
2301  m_yerronmean_mb4->Fill(yerronmean);
2302  }
2303 
2304  if (id.wheel() == -2) {
2305  m_ymean_minus2->Fill(ymean);
2306  m_ystdev_minus2->Fill(ystdev);
2307  m_yerronmean_minus2->Fill(yerronmean);
2308  } else if (id.wheel() == -1) {
2309  m_ymean_minus1->Fill(ymean);
2310  m_ystdev_minus1->Fill(ystdev);
2311  m_yerronmean_minus1->Fill(yerronmean);
2312  } else if (id.wheel() == 0) {
2313  m_ymean_zero->Fill(ymean);
2314  m_ystdev_zero->Fill(ystdev);
2315  m_yerronmean_zero->Fill(yerronmean);
2316  } else if (id.wheel() == 1) {
2317  m_ymean_plus1->Fill(ymean);
2318  m_ystdev_plus1->Fill(ystdev);
2319  m_yerronmean_plus1->Fill(yerronmean);
2320  } else if (id.wheel() == 2) {
2321  m_ymean_plus2->Fill(ymean);
2322  m_ystdev_plus2->Fill(ystdev);
2323  m_yerronmean_plus2->Fill(yerronmean);
2324  }
2325  } // end if DT
2326  else {
2327  m_ymean_me->Fill(ymean);
2328  m_ystdev_me->Fill(ystdev);
2329  m_yerronmean_me->Fill(yerronmean);
2330 
2331  CSCDetId id(chamber->geomDetId().rawId());
2332 
2333  if ((id.endcap() == 1 ? 1 : -1) * id.station() == 1 && id.ring() == 1) {
2334  m_ymean_mep11->Fill(ymean);
2335  m_ystdev_mep11->Fill(ystdev);
2336  m_yerronmean_mep11->Fill(yerronmean);
2337  m_ymean_me11->Fill(ymean);
2338  m_ystdev_me11->Fill(ystdev);
2339  m_yerronmean_me11->Fill(yerronmean);
2340  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == -1 && id.ring() == 1) {
2341  m_ymean_mem11->Fill(ymean);
2342  m_ystdev_mem11->Fill(ystdev);
2343  m_yerronmean_mem11->Fill(yerronmean);
2344  m_ymean_me11->Fill(ymean);
2345  m_ystdev_me11->Fill(ystdev);
2346  m_yerronmean_me11->Fill(yerronmean);
2347  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == 1 && id.ring() == 2) {
2348  m_ymean_mep12->Fill(ymean);
2349  m_ystdev_mep12->Fill(ystdev);
2350  m_yerronmean_mep12->Fill(yerronmean);
2351  m_ymean_me12->Fill(ymean);
2352  m_ystdev_me12->Fill(ystdev);
2353  m_yerronmean_me12->Fill(yerronmean);
2354  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == -1 && id.ring() == 2) {
2355  m_ymean_mem12->Fill(ymean);
2356  m_ystdev_mem12->Fill(ystdev);
2357  m_yerronmean_mem12->Fill(yerronmean);
2358  m_ymean_me12->Fill(ymean);
2359  m_ystdev_me12->Fill(ystdev);
2360  m_yerronmean_me12->Fill(yerronmean);
2361  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == 1 && id.ring() == 3) {
2362  m_ymean_mep13->Fill(ymean);
2363  m_ystdev_mep13->Fill(ystdev);
2364  m_yerronmean_mep13->Fill(yerronmean);
2365  m_ymean_me13->Fill(ymean);
2366  m_ystdev_me13->Fill(ystdev);
2367  m_yerronmean_me13->Fill(yerronmean);
2368  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == -1 && id.ring() == 3) {
2369  m_ymean_mem13->Fill(ymean);
2370  m_ystdev_mem13->Fill(ystdev);
2371  m_yerronmean_mem13->Fill(yerronmean);
2372  m_ymean_me13->Fill(ymean);
2373  m_ystdev_me13->Fill(ystdev);
2374  m_yerronmean_me13->Fill(yerronmean);
2375  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == 1 && id.ring() == 4) {
2376  m_ymean_mep14->Fill(ymean);
2377  m_ystdev_mep14->Fill(ystdev);
2378  m_yerronmean_mep14->Fill(yerronmean);
2379  m_ymean_me14->Fill(ymean);
2380  m_ystdev_me14->Fill(ystdev);
2381  m_yerronmean_me14->Fill(yerronmean);
2382  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == -1 && id.ring() == 4) {
2383  m_ymean_mem14->Fill(ymean);
2384  m_ystdev_mem14->Fill(ystdev);
2385  m_yerronmean_mem14->Fill(yerronmean);
2386  m_ymean_me14->Fill(ymean);
2387  m_ystdev_me14->Fill(ystdev);
2388  m_yerronmean_me14->Fill(yerronmean);
2389  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == 2 && id.ring() == 1) {
2390  m_ymean_mep21->Fill(ymean);
2391  m_ystdev_mep21->Fill(ystdev);
2392  m_yerronmean_mep21->Fill(yerronmean);
2393  m_ymean_me21->Fill(ymean);
2394  m_ystdev_me21->Fill(ystdev);
2395  m_yerronmean_me21->Fill(yerronmean);
2396  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == -2 && id.ring() == 1) {
2397  m_ymean_mem21->Fill(ymean);
2398  m_ystdev_mem21->Fill(ystdev);
2399  m_yerronmean_mem21->Fill(yerronmean);
2400  m_ymean_me21->Fill(ymean);
2401  m_ystdev_me21->Fill(ystdev);
2402  m_yerronmean_me21->Fill(yerronmean);
2403  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == 2 && id.ring() == 2) {
2404  m_ymean_mep22->Fill(ymean);
2405  m_ystdev_mep22->Fill(ystdev);
2406  m_yerronmean_mep22->Fill(yerronmean);
2407  m_ymean_me22->Fill(ymean);
2408  m_ystdev_me22->Fill(ystdev);
2409  m_yerronmean_me22->Fill(yerronmean);
2410  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == -2 && id.ring() == 2) {
2411  m_ymean_mem22->Fill(ymean);
2412  m_ystdev_mem22->Fill(ystdev);
2413  m_yerronmean_mem22->Fill(yerronmean);
2414  m_ymean_me22->Fill(ymean);
2415  m_ystdev_me22->Fill(ystdev);
2416  m_yerronmean_me22->Fill(yerronmean);
2417  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == 3 && id.ring() == 1) {
2418  m_ymean_mep31->Fill(ymean);
2419  m_ystdev_mep31->Fill(ystdev);
2420  m_yerronmean_mep31->Fill(yerronmean);
2421  m_ymean_me31->Fill(ymean);
2422  m_ystdev_me31->Fill(ystdev);
2423  m_yerronmean_me31->Fill(yerronmean);
2424  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == -3 && id.ring() == 1) {
2425  m_ymean_mem31->Fill(ymean);
2426  m_ystdev_mem31->Fill(ystdev);
2427  m_yerronmean_mem31->Fill(yerronmean);
2428  m_ymean_me31->Fill(ymean);
2429  m_ystdev_me31->Fill(ystdev);
2430  m_yerronmean_me31->Fill(yerronmean);
2431  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == 3 && id.ring() == 2) {
2432  m_ymean_mep32->Fill(ymean);
2433  m_ystdev_mep32->Fill(ystdev);
2434  m_yerronmean_mep32->Fill(yerronmean);
2435  m_ymean_me32->Fill(ymean);
2436  m_ystdev_me32->Fill(ystdev);
2437  m_yerronmean_me32->Fill(yerronmean);
2438  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == -3 && id.ring() == 2) {
2439  m_ymean_mem32->Fill(ymean);
2440  m_ystdev_mem32->Fill(ystdev);
2441  m_yerronmean_mem32->Fill(yerronmean);
2442  m_ymean_me32->Fill(ymean);
2443  m_ystdev_me32->Fill(ystdev);
2444  m_yerronmean_me32->Fill(yerronmean);
2445  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == 4 && id.ring() == 1) {
2446  m_ymean_mep41->Fill(ymean);
2447  m_ystdev_mep41->Fill(ystdev);
2448  m_yerronmean_mep41->Fill(yerronmean);
2449  m_ymean_me41->Fill(ymean);
2450  m_ystdev_me41->Fill(ystdev);
2451  m_yerronmean_me41->Fill(yerronmean);
2452  } else if ((id.endcap() == 1 ? 1 : -1) * id.station() == -4 && id.ring() == 1) {
2453  m_ymean_mem41->Fill(ymean);
2454  m_ystdev_mem41->Fill(ystdev);
2455  m_yerronmean_mem41->Fill(yerronmean);
2456  m_ymean_me41->Fill(ymean);
2457  m_ystdev_me41->Fill(ystdev);
2458  m_yerronmean_me41->Fill(yerronmean);
2459  }
2460  } // else itis CSC
2461  } // end if ymean, ystdev exist
2462 
2463  } // end loop over chambers
2464 }
2465 
2466 //
2467 // constructors and destructor
2468 //
2469 
2470 // AlignmentMonitorMuonResiduals::AlignmentMonitorMuonResiduals(const AlignmentMonitorMuonResiduals& rhs)
2471 // {
2472 // // do actual copying here;
2473 // }
2474 
2475 //
2476 // assignment operators
2477 //
2478 // const AlignmentMonitorMuonResiduals& AlignmentMonitorMuonResiduals::operator=(const AlignmentMonitorMuonResiduals& rhs)
2479 // {
2480 // //An exception safe implementation is
2481 // AlignmentMonitorMuonResiduals temp(rhs);
2482 // swap(rhs);
2483 //
2484 // return *this;
2485 // }
2486 
2487 //
2488 // const member functions
2489 //
2490 
2491 //
2492 // static member functions
2493 //
2494 
2495 //
2496 // SEAL definitions
2497 //
2498 
int station() const
Return the station number.
Definition: DTChamberId.h:42
AlignableNavigator * pNavigator()
const LocalTrajectoryError & localError() const
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
void book() override
Book or retrieve histograms; MUST be reimplemented.
AlignmentMonitorMuonResiduals(const edm::ParameterSet &cfg, edm::ConsumesCollector iC)
bool detAndSubdetInMap(const DetId &detid) const
Given a DetId, returns true if DetIds with this detector and subdetector id are in the map (not neces...
LocalError positionError() const
DataContainer const & measurements() const
Definition: Trajectory.h:178
T * make(const Args &...args) const
make new ROOT object
float yy() const
Definition: LocalError.h:24
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
TFileDirectory * directory(std::string dir)
int iEvent
Definition: GenABIO.cc:224
T sqrt(T t)
Definition: SSEVec.h:19
void event(const edm::Event &iEvent, const edm::EventSetup &iSetup, const ConstTrajTrackPairCollection &iTrajTracks) override
Called for each event (by "run()"): may be reimplemented.
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
std::vector< ConstTrajTrackPair > ConstTrajTrackPairCollection
TH1F * book1D(std::string dir, std::string name, std::string title, int nchX, double lowX, double highX)
float xy() const
Definition: LocalError.h:23
Definition: DetId.h:17
int station() const
Definition: CSCDetId.h:79
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
CSCDetId chamberId() const
Definition: CSCDetId.h:47
int endcap() const
Definition: CSCDetId.h:85
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
LocalError const & localAlignmentError() const
Return local alligment error.
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
#define DEFINE_EDM_PLUGIN(factory, type, name)
static constexpr int DT
Definition: MuonSubdetId.h:11
int ring() const
Definition: CSCDetId.h:68
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
static constexpr int CSC
Definition: MuonSubdetId.h:12
TSOS combine(const TSOS &pTsos1, const TSOS &pTsos2) const
float xx() const
Definition: LocalError.h:22
ConstRecHitPointer const & recHit() const