CMS 3D CMS Logo

AlignmentPayloadInspectorHelper.h
Go to the documentation of this file.
1 #ifndef CONDCORE_ALIGNMENTPLUGINS_ALIGNMENTPAYLOADINSPECTORHELPER_H
2 #define CONDCORE_ALIGNMENTPLUGINS_ALIGNMENTPAYLOADINSPECTORHELPER_H
3 
4 #include <iostream>
5 #include <algorithm>
6 #include <vector>
7 #include <numeric>
8 #include <string>
9 #include "TH1.h"
10 #include "TCanvas.h"
11 #include "TPaveStats.h"
12 #include "TStyle.h"
13 #include "TList.h"
16 
17 namespace AlignmentPI {
18 
19  // size of the phase-I Tracker APE payload (including both SS + DS modules)
20  static const unsigned int phase0size = 19876;
21  static const float cmToUm = 10000;
22 
23  enum coordinate {
24  t_x = 1,
25  t_y = 2,
26  t_z = 3,
27  rot_alpha = 4,
28  rot_beta = 5,
29  rot_gamma = 6,
30  };
31 
32  // M.M. 2017/09/12
33  // As the matrix is symmetric, we map only 6/9 terms
34  // More terms for the extended APE can be added to the following methods
35 
36  enum index { XX = 1, XY = 2, XZ = 3, YZ = 4, YY = 5, ZZ = 6 };
37 
38  enum partitions {
39  BPix = 1, // Barrel Pixel
40  FPix = 2, // Forward Pixel
41  TIB = 3, // Tracker Inner Barrel
42  TID = 4, // Tracker Inner Disks
43  TOB = 5, // Tracker Outer Barrel
44  TEC = 6 // Tracker Endcaps
45  };
46 
47  enum regions {
48  BPixL1o, //0 Barrel Pixel Layer 1 outer
49  BPixL1i, //1 Barrel Pixel Layer 1 inner
50  BPixL2o, //2 Barrel Pixel Layer 2 outer
51  BPixL2i, //3 Barrel Pixel Layer 2 inner
52  BPixL3o, //4 Barrel Pixel Layer 3 outer
53  BPixL3i, //5 Barrel Pixel Layer 3 inner
54  BPixL4o, //6 Barrel Pixel Layer 4 outer
55  BPixL4i, //7 Barrel Pixel Layer 4 inner
56  FPixmL1, //8 Forward Pixel Minus side Disk 1
57  FPixmL2, //9 Forward Pixel Minus side Disk 2
58  FPixmL3, //10 Forward Pixel Minus side Disk 3
59  FPixpL1, //11 Forward Pixel Plus side Disk 1
60  FPixpL2, //12 Forward Pixel Plus side Disk 2
61  FPixpL3, //13 Forward Pixel Plus side Disk 3
62  TIBL1Ro, //14 Inner Barrel Layer 1 Rphi outer
63  TIBL1Ri, //15 Inner Barrel Layer 1 Rphi inner
64  TIBL1So, //16 Inner Barrel Layer 1 Stereo outer
65  TIBL1Si, //17 Inner Barrel Layer 1 Stereo inner
66  TIBL2Ro, //18 Inner Barrel Layer 2 Rphi outer
67  TIBL2Ri, //19 Inner Barrel Layer 2 Rphi inner
68  TIBL2So, //20 Inner Barrel Layer 2 Stereo outer
69  TIBL2Si, //21 Inner Barrel Layer 2 Stereo inner
70  TIBL3o, //22 Inner Barrel Layer 3 outer
71  TIBL3i, //23 Inner Barrel Layer 3 inner
72  TIBL4o, //24 Inner Barrel Layer 4 outer
73  TIBL4i, //25 Inner Barrel Layer 4 inner
74  TOBL1Ro, //26 Outer Barrel Layer 1 Rphi outer
75  TOBL1Ri, //27 Outer Barrel Layer 1 Rphi inner
76  TOBL1So, //28 Outer Barrel Layer 1 Stereo outer
77  TOBL1Si, //29 Outer Barrel Layer 1 Stereo inner
78  TOBL2Ro, //30 Outer Barrel Layer 2 Rphi outer
79  TOBL2Ri, //31 Outer Barrel Layer 2 Rphi inner
80  TOBL2So, //32 Outer Barrel Layer 2 Stereo outer
81  TOBL2Si, //33 Outer Barrel Layer 2 Stereo inner
82  TOBL3o, //34 Outer Barrel Layer 3 outer
83  TOBL3i, //35 Outer Barrel Layer 3 inner
84  TOBL4o, //36 Outer Barrel Layer 4 outer
85  TOBL4i, //37 Outer Barrel Layer 4 inner
86  TOBL5o, //38 Outer Barrel Layer 5 outer
87  TOBL5i, //39 Outer Barrel Layer 5 inner
88  TOBL6o, //40 Outer Barrel Layer 6 outer
89  TOBL6i, //41 Outer Barrel Layer 6 inner
90  TIDmR1R, //42 Inner Disk Minus side Ring 1 Rphi
91  TIDmR1S, //43 Inner Disk Minus side Ring 1 Stereo
92  TIDmR2R, //44 Inner Disk Minus side Ring 2 Rphi
93  TIDmR2S, //45 Inner Disk Minus side Ring 2 Stereo
94  TIDmR3, //46 Inner Disk Minus side Ring 3
95  TIDpR1R, //47 Inner Disk Plus side Ring 1 Rphi
96  TIDpR1S, //48 Inner Disk Plus side Ring 1 Stereo
97  TIDpR2R, //49 Inner Disk Plus side Ring 2 Rphi
98  TIDpR2S, //50 Inner Disk Plus side Ring 2 Stereo
99  TIDpR3, //51 Inner Disk Plus side Ring 3
100  TECmR1R, //52 Endcaps Minus side Ring 1 Rphi
101  TECmR1S, //53 Endcaps Minus side Ring 1 Stereo
102  TECmR2R, //54 Encdaps Minus side Ring 2 Rphi
103  TECmR2S, //55 Endcaps Minus side Ring 2 Stereo
104  TECmR3, //56 Endcaps Minus side Ring 3
105  TECmR4, //57 Endcaps Minus side Ring 4
106  TECmR5, //58 Endcaps Minus side Ring 5
107  TECmR6, //59 Endcaps Minus side Ring 6
108  TECmR7, //60 Endcaps Minus side Ring 7
109  TECpR1R, //61 Endcaps Plus side Ring 1 Rphi
110  TECpR1S, //62 Endcaps Plus side Ring 1 Stereo
111  TECpR2R, //63 Encdaps Plus side Ring 2 Rphi
112  TECpR2S, //64 Endcaps Plus side Ring 2 Stereo
113  TECpR3, //65 Endcaps Plus side Ring 3
114  TECpR4, //66 Endcaps Plus side Ring 4
115  TECpR5, //67 Endcaps Plus side Ring 5
116  TECpR6, //68 Endcaps Plus side Ring 6
117  TECpR7, //67 Endcaps Plus side Ring 7
118  StripDoubleSide, // 70 -- not to be considered
119  NUM_OF_REGIONS // 71 -- default
120  };
121 
122  /*--------------------------------------------------------------------*/
124  /*--------------------------------------------------------------------*/
125  {
126  switch (e) {
128  return "BPixL1o";
130  return "BPixL1i";
132  return "BPixL2o";
134  return "BPixL2i";
136  return "BPixL3o";
138  return "BPixL3i";
140  return "BPixL4o";
142  return "BPixL4i";
144  return "FPixmL1";
146  return "FPixmL2";
148  return "FPixmL3";
150  return "FPixpL1";
152  return "FPixpL2";
154  return "FPixpL3";
156  return "TIBL1Ro";
158  return "TIBL1Ri";
160  return "TIBL1So";
162  return "TIBL1Si";
164  return "TIBL2Ro";
166  return "TIBL2Ri";
168  return "TIBL2So";
170  return "TIBL2Si";
171  case AlignmentPI::TIBL3o:
172  return "TIBL3o";
173  case AlignmentPI::TIBL3i:
174  return "TIBL3i";
175  case AlignmentPI::TIBL4o:
176  return "TIBL4o";
177  case AlignmentPI::TIBL4i:
178  return "TIBL4i";
180  return "TOBL1Ro";
182  return "TOBL1Ri";
184  return "TOBL1So";
186  return "TOBL1Si";
188  return "TOBL2Ro";
190  return "TOBL2Ri";
192  return "TOBL2So";
194  return "TOBL2Si";
195  case AlignmentPI::TOBL3o:
196  return "TOBL3o";
197  case AlignmentPI::TOBL3i:
198  return "TOBL3i";
199  case AlignmentPI::TOBL4o:
200  return "TOBL4o";
201  case AlignmentPI::TOBL4i:
202  return "TOBL4i";
203  case AlignmentPI::TOBL5o:
204  return "TOBL5o";
205  case AlignmentPI::TOBL5i:
206  return "TOBL5i";
207  case AlignmentPI::TOBL6o:
208  return "TOBL6o";
209  case AlignmentPI::TOBL6i:
210  return "TOBL6i";
212  return "TIDmR1R";
214  return "TIDmR1S";
216  return "TIDmR2R";
218  return "TIDmR2S";
219  case AlignmentPI::TIDmR3:
220  return "TIDmR3";
222  return "TIDpR1R";
224  return "TIDpR1S";
226  return "TIDpR2R";
228  return "TIDpR2S";
229  case AlignmentPI::TIDpR3:
230  return "TIDpR3";
232  return "TECmR1R";
234  return "TECmR1S";
236  return "TECmR2R";
238  return "TECmR2S";
239  case AlignmentPI::TECmR3:
240  return "TECmR3";
241  case AlignmentPI::TECmR4:
242  return "TECmR4";
243  case AlignmentPI::TECmR5:
244  return "TECmR5";
245  case AlignmentPI::TECmR6:
246  return "TECmR6";
247  case AlignmentPI::TECmR7:
248  return "TECmR7";
250  return "TECpR1R";
252  return "TECpR1S";
254  return "TECpR2R";
256  return "TECpR2S";
257  case AlignmentPI::TECpR3:
258  return "TECpR3";
259  case AlignmentPI::TECpR4:
260  return "TECpR4";
261  case AlignmentPI::TECpR5:
262  return "TECpR5";
263  case AlignmentPI::TECpR6:
264  return "TECpR6";
265  case AlignmentPI::TECpR7:
266  return "TECpR7";
267  default:
268  edm::LogWarning("LogicError") << "Unknown partition: " << e;
269  return "";
270  }
271  }
272 
273  /*--------------------------------------------------------------------*/
274  bool isBPixOuterLadder(const DetId& detid, const TrackerTopology& tTopo, bool isPhase0)
275  /*--------------------------------------------------------------------*/
276  {
277  bool isOuter = false;
278  int layer = tTopo.pxbLayer(detid.rawId());
279  bool odd_ladder = tTopo.pxbLadder(detid.rawId()) % 2;
280  if (isPhase0) {
281  if (layer == 2)
282  isOuter = !odd_ladder;
283  else
284  isOuter = odd_ladder;
285  } else {
286  if (layer == 4)
287  isOuter = odd_ladder;
288  else
289  isOuter = !odd_ladder;
290  }
291  return isOuter;
292  }
293 
294  // ancillary struct to manage the topology
295  // info in a more compact way
296 
297  struct topolInfo {
298  private:
299  uint32_t m_rawid;
301  int m_layer;
302  int m_side;
303  int m_ring;
304  bool m_isRphi;
307 
308  public:
309  void init();
310  void fillGeometryInfo(const DetId& detId, const TrackerTopology& tTopo, bool isPhase0);
312  bool sanityCheck();
313  void printAll();
314  virtual ~topolInfo() {}
315  };
316 
317  /*--------------------------------------------------------------------*/
319  /*--------------------------------------------------------------------*/
320  {
321  std::cout << " detId:" << m_rawid << " subdetid: " << m_subdetid << " layer: " << m_layer << " side: " << m_side
322  << " ring: " << m_ring << " isRphi:" << m_isRphi << " isDoubleSide:" << m_isDoubleSide
323  << " isInternal:" << m_isInternal << std::endl;
324  }
325 
326  /*--------------------------------------------------------------------*/
328  /*--------------------------------------------------------------------*/
329  {
330  m_rawid = 0;
331  m_subdetid = -1;
332  m_layer = -1;
333  m_side = -1;
334  m_ring = -1;
335  m_isRphi = false;
336  m_isDoubleSide = false;
337  m_isInternal = false;
338  };
339 
340  /*--------------------------------------------------------------------*/
342  /*--------------------------------------------------------------------*/
343  {
344  if (m_layer == 0 || (m_subdetid == 1 && m_layer > 4) || (m_subdetid == 2 && m_layer > 3)) {
345  return false;
346  } else {
347  return true;
348  }
349  }
350  /*--------------------------------------------------------------------*/
351  void topolInfo::fillGeometryInfo(const DetId& detId, const TrackerTopology& tTopo, bool isPhase0)
352  /*--------------------------------------------------------------------*/
353  {
354  unsigned int subdetId = static_cast<unsigned int>(detId.subdetId());
355 
356  m_rawid = detId.rawId();
357  m_subdetid = subdetId;
358 
359  if (subdetId == StripSubdetector::TIB) {
360  m_layer = tTopo.tibLayer(detId.rawId());
361  m_side = tTopo.tibSide(detId.rawId());
362  m_isRphi = tTopo.isRPhi(detId.rawId());
363  m_isDoubleSide = tTopo.tibIsDoubleSide(detId.rawId());
364  m_isInternal = tTopo.tibIsInternalString(detId.rawId());
365  } else if (subdetId == StripSubdetector::TOB) {
366  m_layer = tTopo.tobLayer(detId.rawId());
367  m_side = tTopo.tobSide(detId.rawId());
368  m_isRphi = tTopo.isRPhi(detId.rawId());
369  m_isDoubleSide = tTopo.tobIsDoubleSide(detId.rawId());
370  m_isInternal = tTopo.tobModule(detId.rawId()) % 2;
371  } else if (subdetId == StripSubdetector::TID) {
372  m_layer = tTopo.tidWheel(detId.rawId());
373  m_side = tTopo.tidSide(detId.rawId());
374  m_isRphi = tTopo.isRPhi(detId.rawId());
375  m_ring = tTopo.tidRing(detId.rawId());
376  m_isDoubleSide = tTopo.tidIsDoubleSide(detId.rawId());
377  m_isInternal = tTopo.tidModuleInfo(detId.rawId())[0];
378  } else if (subdetId == StripSubdetector::TEC) {
379  m_layer = tTopo.tecWheel(detId.rawId());
380  m_side = tTopo.tecSide(detId.rawId());
381  m_isRphi = tTopo.isRPhi(detId.rawId());
382  m_ring = tTopo.tecRing(detId.rawId());
383  m_isDoubleSide = tTopo.tecIsDoubleSide(detId.rawId());
384  m_isInternal = tTopo.tecPetalInfo(detId.rawId())[0];
385  } else if (subdetId == PixelSubdetector::PixelBarrel) {
386  m_layer = tTopo.pxbLayer(detId.rawId());
387  m_isInternal = !AlignmentPI::isBPixOuterLadder(detId, tTopo, isPhase0);
388  } else if (subdetId == PixelSubdetector::PixelEndcap) {
389  m_layer = tTopo.pxfDisk(detId.rawId());
390  m_side = tTopo.pxfSide(detId.rawId());
391  } else
392  edm::LogWarning("LogicError") << "Unknown subdetid: " << subdetId;
393  }
394 
395  // ------------ method to assign a partition based on the topology struct info ---------------
396 
397  /*--------------------------------------------------------------------*/
399  /*--------------------------------------------------------------------*/
400  {
402 
403  if (m_isDoubleSide) {
405  }
406 
407  // BPix
408  if (m_subdetid == 1) {
409  switch (m_layer) {
410  case 1:
412  break;
413  case 2:
415  break;
416  case 3:
418  break;
419  case 4:
421  break;
422  default:
423  edm::LogWarning("LogicError") << "Unknow BPix layer: " << m_layer;
424  break;
425  }
426  // FPix
427  } else if (m_subdetid == 2) {
428  switch (m_layer) {
429  case 1:
431  break;
432  case 2:
434  break;
435  case 3:
437  break;
438  default:
439  edm::LogWarning("LogicError") << "Unknow FPix disk: " << m_layer;
440  break;
441  }
442  // TIB
443  } else if (m_subdetid == 3) {
444  switch (m_layer) {
445  case 1:
446  if (m_isRphi) {
448  } else {
450  }
451  break;
452  case 2:
453  if (m_isRphi) {
455  } else {
457  }
458  break;
459  case 3:
461  break;
462  case 4:
464  break;
465  default:
466  edm::LogWarning("LogicError") << "Unknow TIB layer: " << m_layer;
467  break;
468  }
469  // TID
470  } else if (m_subdetid == 4) {
471  switch (m_ring) {
472  case 1:
473  if (m_isRphi) {
475  } else {
477  }
478  break;
479  case 2:
480  if (m_isRphi) {
482  } else {
484  }
485  break;
486  case 3:
487  m_side > 1 ? ret = AlignmentPI::TIDpR3 : ret = AlignmentPI::TIDmR3;
488  break;
489  default:
490  edm::LogWarning("LogicError") << "Unknow TID wheel: " << m_layer;
491  break;
492  }
493  // TOB
494  } else if (m_subdetid == 5) {
495  switch (m_layer) {
496  case 1:
497  if (m_isRphi) {
499  } else {
501  }
502  break;
503  case 2:
504  if (m_isRphi) {
506  } else {
508  }
509  break;
510  case 3:
512  break;
513  case 4:
515  break;
516  case 5:
518  break;
519  case 6:
521  break;
522  default:
523  edm::LogWarning("LogicError") << "Unknow TOB layer: " << m_layer;
524  break;
525  }
526  // TEC
527  } else if (m_subdetid == 6) {
528  switch (m_ring) {
529  case 1:
530  if (m_isRphi) {
532  } else {
534  }
535  break;
536  case 2:
537  if (m_isRphi) {
539  } else {
541  }
542  break;
543  case 3:
544  m_side > 1 ? ret = AlignmentPI::TECpR3 : ret = AlignmentPI::TECmR3;
545  break;
546  case 4:
547  m_side > 1 ? ret = AlignmentPI::TECpR4 : ret = AlignmentPI::TECmR4;
548  break;
549  case 5:
550  m_side > 1 ? ret = AlignmentPI::TECpR5 : ret = AlignmentPI::TECmR5;
551  break;
552  case 6:
553  m_side > 1 ? ret = AlignmentPI::TECpR6 : ret = AlignmentPI::TECmR6;
554  break;
555  case 7:
556  m_side > 1 ? ret = AlignmentPI::TECpR7 : ret = AlignmentPI::TECmR7;
557  break;
558  default:
559  edm::LogWarning("LogicError") << "Unknow TEC ring: " << m_ring;
560  break;
561  }
562  }
563 
564  return ret;
565  }
566 
567  /*--------------------------------------------------------------------*/
569  /*--------------------------------------------------------------------*/
570  {
571  switch (coord) {
572  case t_x:
573  return "x-translation";
574  case t_y:
575  return "y-translation";
576  case t_z:
577  return "z-translation";
578  case rot_alpha:
579  return "#alpha angle rotation";
580  case rot_beta:
581  return "#beta angle rotation";
582  case rot_gamma:
583  return "#gamma angle rotation";
584  default:
585  return "should never be here!";
586  }
587  }
588 
589  /*--------------------------------------------------------------------*/
591  /*--------------------------------------------------------------------*/
592  {
593  switch (i) {
594  case XX:
595  return "XX";
596  case XY:
597  return "XY";
598  case XZ:
599  return "XZ";
600  case YZ:
601  return "YX";
602  case YY:
603  return "YY";
604  case ZZ:
605  return "ZZ";
606  default:
607  return "should never be here!";
608  }
609  }
610 
611  /*--------------------------------------------------------------------*/
613  /*--------------------------------------------------------------------*/
614  {
615  switch (i) {
616  case BPix:
617  return "BPix";
618  case FPix:
619  return "FPix";
620  case TIB:
621  return "TIB";
622  case TID:
623  return "TID";
624  case TOB:
625  return "TOB";
626  case TEC:
627  return "TEC";
628  default:
629  return "should never be here!";
630  }
631  }
632 
633  /*--------------------------------------------------------------------*/
634  std::pair<int, int> getIndices(AlignmentPI::index i)
635  /*--------------------------------------------------------------------*/
636  {
637  switch (i) {
638  case XX:
639  return std::make_pair(0, 0);
640  case XY:
641  return std::make_pair(0, 1);
642  case XZ:
643  return std::make_pair(0, 2);
644  case YZ:
645  return std::make_pair(1, 0);
646  case YY:
647  return std::make_pair(1, 1);
648  case ZZ:
649  return std::make_pair(2, 2);
650  default:
651  return std::make_pair(-1, -1);
652  }
653  }
654 
655  /*--------------------------------------------------------------------*/
656  void makeNicePlotStyle(TH1* hist, int color)
657  /*--------------------------------------------------------------------*/
658  {
659  hist->SetStats(kFALSE);
660 
661  hist->GetXaxis()->SetTitleColor(color);
662  hist->SetLineColor(color);
663  hist->SetTitleSize(0.08);
664  hist->SetLineWidth(2);
665  hist->GetXaxis()->CenterTitle(true);
666  hist->GetYaxis()->CenterTitle(true);
667  hist->GetXaxis()->SetTitleFont(42);
668  hist->GetYaxis()->SetTitleFont(42);
669  hist->GetXaxis()->SetNdivisions(505);
670  hist->GetXaxis()->SetTitleSize(0.06);
671  hist->GetYaxis()->SetTitleSize(0.06);
672  hist->GetXaxis()->SetTitleOffset(1.0);
673  hist->GetYaxis()->SetTitleOffset(1.3);
674  hist->GetXaxis()->SetLabelFont(42);
675  hist->GetYaxis()->SetLabelFont(42);
676  hist->GetYaxis()->SetLabelSize(.05);
677  hist->GetXaxis()->SetLabelSize(.05);
678  }
679 
680  /*--------------------------------------------------------------------*/
682  /*--------------------------------------------------------------------*/
683  {
684  char buffer[255];
685  TPaveText* stat = new TPaveText(0.60, 0.75, 0.95, 0.95, "NDC");
686  sprintf(buffer, "%s \n", AlignmentPI::getStringFromPart(part).c_str());
687  stat->AddText(buffer);
688 
689  sprintf(buffer, "Entries : %i\n", (int)hist->GetEntries());
690  stat->AddText(buffer);
691 
692  if (std::abs(hist->GetMean()) > 0.01) {
693  sprintf(buffer, "Mean : %6.2f\n", hist->GetMean());
694  } else {
695  sprintf(buffer, "Mean : %6.2f e-2\n", 100 * hist->GetMean());
696  }
697  stat->AddText(buffer);
698 
699  if (std::abs(hist->GetRMS()) > 0.01) {
700  sprintf(buffer, "RMS : %6.2f\n", hist->GetRMS());
701  } else {
702  sprintf(buffer, "RMS : %6.2f e-2\n", 100 * hist->GetRMS());
703  }
704  stat->AddText(buffer);
705 
706  stat->SetLineColor(color);
707  stat->SetTextColor(color);
708  stat->SetFillColor(10);
709  stat->SetShadowColor(10);
710  stat->Draw();
711  }
712 
713  /*--------------------------------------------------------------------*/
714  std::pair<float, float> getTheRange(std::map<uint32_t, float> values, const float nsigma)
715  /*--------------------------------------------------------------------*/
716  {
717  float sum = std::accumulate(
718  std::begin(values), std::end(values), 0.0, [](float value, const std::map<uint32_t, float>::value_type& p) {
719  return value + p.second;
720  });
721 
722  float m = sum / values.size();
723 
724  float accum = 0.0;
725  std::for_each(std::begin(values), std::end(values), [&](const std::map<uint32_t, float>::value_type& p) {
726  accum += (p.second - m) * (p.second - m);
727  });
728 
729  float stdev = sqrt(accum / (values.size() - 1));
730 
731  if (stdev != 0.) {
732  return std::make_pair(m - nsigma * stdev, m + nsigma * stdev);
733  } else {
734  return std::make_pair(m > 0. ? 0.95 * m : 1.05 * m, m > 0 ? 1.05 * m : 0.95 * m);
735  }
736  }
737 
738  /*--------------------------------------------------------------------*/
739  std::pair<double, double> calculatePosition(TVirtualPad* myPad, int boundary)
740  /*--------------------------------------------------------------------*/
741  {
742  int ix1;
743  int ix2;
744  int iw = myPad->GetWw();
745  int ih = myPad->GetWh();
746  double x1p, y1p, x2p, y2p;
747  myPad->GetPadPar(x1p, y1p, x2p, y2p);
748  ix1 = (int)(iw * x1p);
749  ix2 = (int)(iw * x2p);
750  double wndc = std::min(1., (double)iw / (double)ih);
751  double rw = wndc / (double)iw;
752  double x1ndc = (double)ix1 * rw;
753  double x2ndc = (double)ix2 * rw;
754  double rx1, ry1, rx2, ry2;
755  myPad->GetRange(rx1, ry1, rx2, ry2);
756  double rx = (x2ndc - x1ndc) / (rx2 - rx1);
757  double _sx;
758  _sx = rx * (boundary - rx1) + x1ndc;
759  double _dx = _sx + 0.05;
760 
761  return std::make_pair(_sx, _dx);
762  }
763 
764 } // namespace AlignmentPI
765 
766 #endif
static constexpr auto TEC
bool tecIsDoubleSide(const DetId &id) const
bool tobIsDoubleSide(const DetId &id) const
bool tibIsDoubleSide(const DetId &id) const
unsigned int tibLayer(const DetId &id) const
unsigned int tidRing(const DetId &id) const
void makeNicePlotStyle(TH1 *hist, int color)
std::vector< unsigned int > tidModuleInfo(const DetId &id) const
ret
prodAgent to be discontinued
unsigned int pxfDisk(const DetId &id) const
unsigned int tecRing(const DetId &id) const
ring id
unsigned int pxbLadder(const DetId &id) const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::string getStringFromPart(AlignmentPI::partitions i)
unsigned int tidWheel(const DetId &id) const
bool isBPixOuterLadder(const DetId &detid, const TrackerTopology &tTopo, bool isPhase0)
static const float cmToUm
void makeNiceStats(TH1F *hist, AlignmentPI::partitions part, int color)
unsigned int tibSide(const DetId &id) const
static const unsigned int phase0size
std::vector< unsigned int > tecPetalInfo(const DetId &id) const
unsigned int tidSide(const DetId &id) const
T sqrt(T t)
Definition: SSEVec.h:19
unsigned int tobSide(const DetId &id) const
void fillGeometryInfo(const DetId &detId, const TrackerTopology &tTopo, bool isPhase0)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define end
Definition: vmac.h:39
Definition: value.py:1
T min(T a, T b)
Definition: MathUtil.h:58
static constexpr auto TOB
std::pair< int, int > getIndices(AlignmentPI::index i)
unsigned int pxbLayer(const DetId &id) const
std::pair< float, float > getTheRange(std::map< uint32_t, float > values, const float nsigma)
Definition: DetId.h:17
static constexpr auto TIB
std::string getStringFromCoordinate(AlignmentPI::coordinate coord)
part
Definition: HCALResponse.h:20
AlignmentPI::regions filterThePartition()
bool tidIsDoubleSide(const DetId &id) const
std::string getStringFromIndex(AlignmentPI::index i)
unsigned int tobModule(const DetId &id) const
std::pair< double, double > calculatePosition(TVirtualPad *myPad, int boundary)
#define begin
Definition: vmac.h:32
unsigned int pxfSide(const DetId &id) const
def stdev(xlist)
Definition: plotscripts.py:69
std::string getStringFromRegionEnum(AlignmentPI::regions e)
bool isRPhi(const DetId &id) const
bool tibIsInternalString(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
static constexpr auto TID
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const