CMS 3D CMS Logo

TrackerAlignment_PayloadInspector.cc
Go to the documentation of this file.
1 
10 
14 
15 // the data format of the condition to be inspected
19 
20 //#include "CondFormats/Alignment/interface/Definitions.h"
21 #include "CLHEP/Vector/RotationInterfaces.h"
23 
24 // needed for the tracker map
26 
27 // needed for mapping
30 
31 #include <memory>
32 #include <sstream>
33 #include <iostream>
34 #include <iomanip> // std::setprecision
35 
36 // include ROOT
37 #include "TH2F.h"
38 #include "TLegend.h"
39 #include "TCanvas.h"
40 #include "TLine.h"
41 #include "TStyle.h"
42 #include "TLatex.h"
43 #include "TPave.h"
44 #include "TMarker.h"
45 #include "TPaveStats.h"
46 
47 namespace {
48 
49  // M.M. 2017/09/29
50  // Hardcoded Tracker Global Position Record
51  // Without accessing the ES, it is not possible to access to the GPR with the PI technology,
52  // so this needs to be hardcoded.
53  // Anyway it is not likely to change until a new Tracker is installed.
54  // Details at:
55  // - https://indico.cern.ch/event/238026/contributions/513928/attachments/400000/556192/mm_TkAlMeeting_28_03_2013.pdf
56  // - https://twiki.cern.ch/twiki/bin/view/CMS/TkAlignmentPixelPosition
57 
58  const std::map<AlignmentPI::coordinate, float> hardcodeGPR = {
59  {AlignmentPI::t_x, -9.00e-02}, {AlignmentPI::t_y, -1.10e-01}, {AlignmentPI::t_z, -1.70e-01}};
60 
61  //*******************************************//
62  // Size of the movement over all partitions
63  //******************************************//
64 
65  template <AlignmentPI::coordinate coord>
66  class TrackerAlignmentComparatorBase : public cond::payloadInspector::PlotImage<Alignments> {
67  public:
68  TrackerAlignmentComparatorBase()
69  : cond::payloadInspector::PlotImage<Alignments>("comparison of " + AlignmentPI::getStringFromCoordinate(coord) +
70  " coordinate between two geometries") {}
71 
72  bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash> > &iovs) override {
73  std::vector<std::tuple<cond::Time_t, cond::Hash> > sorted_iovs = iovs;
74 
75  // make absolute sure the IOVs are sortd by since
76  std::sort(begin(sorted_iovs), end(sorted_iovs), [](auto const &t1, auto const &t2) {
77  return std::get<0>(t1) < std::get<0>(t2);
78  });
79 
80  auto firstiov = sorted_iovs.front();
81  auto lastiov = sorted_iovs.back();
82 
83  std::shared_ptr<Alignments> last_payload = fetchPayload(std::get<1>(lastiov));
84  std::shared_ptr<Alignments> first_payload = fetchPayload(std::get<1>(firstiov));
85 
86  std::string lastIOVsince = std::to_string(std::get<0>(lastiov));
87  std::string firstIOVsince = std::to_string(std::get<0>(firstiov));
88 
89  std::vector<AlignTransform> ref_ali = first_payload->m_align;
90  std::vector<AlignTransform> target_ali = last_payload->m_align;
91 
92  TCanvas canvas("Alignment Comparison", "Alignment Comparison", 1200, 1200);
93 
94  if (ref_ali.size() != target_ali.size()) {
95  edm::LogError("TrackerAlignment_PayloadInspector")
96  << "the size of the reference alignment (" << ref_ali.size()
97  << ") is different from the one of the target (" << target_ali.size()
98  << ")! You are probably trying to compare different underlying geometries. Exiting";
99  return false;
100  }
101 
102  // check that the geomtery is a tracker one
103  const char *path_toTopologyXML = (ref_ali.size() == AlignmentPI::phase0size)
104  ? "Geometry/TrackerCommonData/data/trackerParameters.xml"
105  : "Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
106  TrackerTopology tTopo =
108 
109  for (const auto &ali : ref_ali) {
110  auto mydetid = ali.rawId();
111  if (DetId(mydetid).det() != DetId::Tracker) {
112  edm::LogWarning("TrackerAlignment_PayloadInspector")
113  << "Encountered invalid Tracker DetId:" << DetId(mydetid).rawId() << " (" << DetId(mydetid).det()
114  << ") is different from " << DetId::Tracker << " (is DoubleSide: " << tTopo.tidIsDoubleSide(mydetid)
115  << "); subdetId " << DetId(mydetid).subdetId() << " - terminating ";
116  return false;
117  }
118  }
119 
120  int counter = 0;
121  auto s_coord = AlignmentPI::getStringFromCoordinate(coord);
122  std::string unit =
123  (coord == AlignmentPI::t_x || coord == AlignmentPI::t_y || coord == AlignmentPI::t_z) ? "[#mum]" : "[mrad]";
124 
125  //std::unique_ptr<TH1F> compare = std::unique_ptr<TH1F>(new TH1F("comparison",Form("Comparison of %s;DetId index; #Delta%s %s",s_coord.c_str(),s_coord.c_str(),unit.c_str()),ref_ali.size(),-0.5,ref_ali.size()-0.5));
126  std::unique_ptr<TH1F> compare =
127  std::unique_ptr<TH1F>(new TH1F("comparison",
128  Form(";Detector Id index; #Delta%s %s", s_coord.c_str(), unit.c_str()),
129  ref_ali.size(),
130  -0.5,
131  ref_ali.size() - 0.5));
132 
133  std::vector<int> boundaries;
135  for (unsigned int i = 0; i < ref_ali.size(); i++) {
136  if (ref_ali[i].rawId() == target_ali[i].rawId()) {
137  counter++;
138  int subid = DetId(ref_ali[i].rawId()).subdetId();
139 
140  auto thePart = static_cast<AlignmentPI::partitions>(subid);
141  if (thePart != currentPart) {
142  currentPart = thePart;
143  boundaries.push_back(counter);
144  }
145 
146  CLHEP::HepRotation target_rot(target_ali[i].rotation());
147  CLHEP::HepRotation ref_rot(ref_ali[i].rotation());
148 
149  align::RotationType target_rotation(target_rot.xx(),
150  target_rot.xy(),
151  target_rot.xz(),
152  target_rot.yx(),
153  target_rot.yy(),
154  target_rot.yz(),
155  target_rot.zx(),
156  target_rot.zy(),
157  target_rot.zz());
158 
159  align::RotationType ref_rotation(ref_rot.xx(),
160  ref_rot.xy(),
161  ref_rot.xz(),
162  ref_rot.yx(),
163  ref_rot.yy(),
164  ref_rot.yz(),
165  ref_rot.zx(),
166  ref_rot.zy(),
167  ref_rot.zz());
168 
169  align::EulerAngles target_eulerAngles = align::toAngles(target_rotation);
170  align::EulerAngles ref_eulerAngles = align::toAngles(ref_rotation);
171 
172  switch (coord) {
173  case AlignmentPI::t_x:
174  compare->SetBinContent(
175  i + 1, (target_ali[i].translation().x() - ref_ali[i].translation().x()) * AlignmentPI::cmToUm);
176  break;
177  case AlignmentPI::t_y:
178  compare->SetBinContent(
179  i + 1, (target_ali[i].translation().y() - ref_ali[i].translation().y()) * AlignmentPI::cmToUm);
180  break;
181  case AlignmentPI::t_z:
182  compare->SetBinContent(
183  i + 1, (target_ali[i].translation().z() - ref_ali[i].translation().z()) * AlignmentPI::cmToUm);
184  break;
186  compare->SetBinContent(i + 1, (target_eulerAngles[0] - ref_eulerAngles[0]) * 1000.);
187  break;
189  compare->SetBinContent(i + 1, (target_eulerAngles[1] - ref_eulerAngles[1]) * 1000.);
190  break;
192  compare->SetBinContent(i + 1, (target_eulerAngles[2] - ref_eulerAngles[2]) * 1000.);
193  break;
194  default:
195  edm::LogError("TrackerAlignment_PayloadInspector") << "Unrecognized coordinate " << coord << std::endl;
196  break;
197  } // switch on the coordinate
198  } // check on the same detID
199  } // loop on the components
200 
201  canvas.cd();
202 
203  canvas.SetLeftMargin(0.17);
204  canvas.SetRightMargin(0.05);
205  canvas.SetBottomMargin(0.15);
207  auto max = compare->GetMaximum();
208  auto min = compare->GetMinimum();
209  auto range = std::abs(max) > std::abs(min) ? std::abs(max) : std::abs(min);
210  //auto newMax = (max > 0.) ? max*1.2 : max*0.8;
211  compare->GetYaxis()->SetRangeUser(-range * 1.3, range * 1.2);
212  compare->SetMarkerStyle(20);
213  compare->SetMarkerSize(0.5);
214  compare->Draw("P");
215 
216  canvas.Update();
217  canvas.cd();
218 
219  TLine l[boundaries.size()];
220  unsigned int i = 0;
221  for (const auto &line : boundaries) {
222  l[i] = TLine(compare->GetBinLowEdge(line),
223  canvas.cd()->GetUymin(),
224  compare->GetBinLowEdge(line),
225  canvas.cd()->GetUymax());
226  l[i].SetLineWidth(1);
227  l[i].SetLineStyle(9);
228  l[i].SetLineColor(2);
229  l[i].Draw("same");
230  i++;
231  }
232 
233  TLatex tSubdet;
234  tSubdet.SetNDC();
235  tSubdet.SetTextAlign(21);
236  tSubdet.SetTextSize(0.027);
237  tSubdet.SetTextAngle(90);
238  for (unsigned int j = 1; j <= 6; j++) {
239  auto thePart = static_cast<AlignmentPI::partitions>(j);
240  tSubdet.SetTextColor(kRed);
241  auto myPair = (j > 1) ? AlignmentPI::calculatePosition(gPad, compare->GetBinLowEdge(boundaries[j - 2]))
242  : AlignmentPI::calculatePosition(gPad, compare->GetBinLowEdge(0));
243  float theX_ = myPair.first + 0.025;
244  tSubdet.DrawLatex(theX_, 0.20, Form("%s", (AlignmentPI::getStringFromPart(thePart)).c_str()));
245  }
246 
247  TLegend legend = TLegend(0.58, 0.82, 0.95, 0.9);
248  legend.SetTextSize(0.03);
249  legend.SetHeader("Alignment comparison", "C"); // option "C" allows to center the header
250  legend.AddEntry(
251  compare.get(),
252  ("IOV:" + std::to_string(std::get<0>(lastiov)) + "-" + std::to_string(std::get<0>(firstiov))).c_str(),
253  "PL");
254  legend.Draw("same");
255 
256  TLatex t1;
257  t1.SetNDC();
258  t1.SetTextAlign(21);
259  t1.SetTextSize(0.05);
260  t1.DrawLatex(0.2, 0.93, Form("%s", s_coord.c_str()));
261  t1.SetTextColor(kBlue);
262  t1.DrawLatex(0.6, 0.93, Form("IOV %s - %s ", lastIOVsince.c_str(), firstIOVsince.c_str()));
263 
264  std::string fileName(m_imageFileName);
265  canvas.SaveAs(fileName.c_str());
266 
267  return true;
268  }
269  };
270 
271  template <AlignmentPI::coordinate coord>
272  class TrackerAlignmentCompare : public TrackerAlignmentComparatorBase<coord> {
273  public:
274  TrackerAlignmentCompare() : TrackerAlignmentComparatorBase<coord>() { this->setSingleIov(false); }
275  };
276 
277  template <AlignmentPI::coordinate coord>
278  class TrackerAlignmentCompareTwoTags : public TrackerAlignmentComparatorBase<coord> {
279  public:
280  TrackerAlignmentCompareTwoTags() : TrackerAlignmentComparatorBase<coord>() { this->setTwoTags(true); }
281  };
282 
283  typedef TrackerAlignmentCompare<AlignmentPI::t_x> TrackerAlignmentCompareX;
284  typedef TrackerAlignmentCompare<AlignmentPI::t_y> TrackerAlignmentCompareY;
285  typedef TrackerAlignmentCompare<AlignmentPI::t_z> TrackerAlignmentCompareZ;
286 
287  typedef TrackerAlignmentCompare<AlignmentPI::rot_alpha> TrackerAlignmentCompareAlpha;
288  typedef TrackerAlignmentCompare<AlignmentPI::rot_beta> TrackerAlignmentCompareBeta;
289  typedef TrackerAlignmentCompare<AlignmentPI::rot_gamma> TrackerAlignmentCompareGamma;
290 
291  typedef TrackerAlignmentCompareTwoTags<AlignmentPI::t_x> TrackerAlignmentCompareXTwoTags;
292  typedef TrackerAlignmentCompareTwoTags<AlignmentPI::t_y> TrackerAlignmentCompareYTwoTags;
293  typedef TrackerAlignmentCompareTwoTags<AlignmentPI::t_z> TrackerAlignmentCompareZTwoTags;
294 
295  typedef TrackerAlignmentCompareTwoTags<AlignmentPI::rot_alpha> TrackerAlignmentCompareAlphaTwoTags;
296  typedef TrackerAlignmentCompareTwoTags<AlignmentPI::rot_beta> TrackerAlignmentCompareBetaTwoTags;
297  typedef TrackerAlignmentCompareTwoTags<AlignmentPI::rot_gamma> TrackerAlignmentCompareGammaTwoTags;
298 
299  //*******************************************//
300  // Summary canvas per subdetector
301  //******************************************//
302 
303  template <AlignmentPI::partitions q>
304  class TrackerAlignmentSummary : public cond::payloadInspector::PlotImage<Alignments> {
305  public:
306  TrackerAlignmentSummary()
307  : cond::payloadInspector::PlotImage<Alignments>("Comparison of all coordinates between two geometries for " +
308  getStringFromPart(q)) {
309  setSingleIov(false);
310  }
311 
312  bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash> > &iovs) override {
313  std::vector<std::tuple<cond::Time_t, cond::Hash> > sorted_iovs = iovs;
314 
315  // make absolute sure the IOVs are sortd by since
316  std::sort(begin(sorted_iovs), end(sorted_iovs), [](auto const &t1, auto const &t2) {
317  return std::get<0>(t1) < std::get<0>(t2);
318  });
319 
320  auto firstiov = sorted_iovs.front();
321  auto lastiov = sorted_iovs.back();
322 
323  std::shared_ptr<Alignments> last_payload = fetchPayload(std::get<1>(lastiov));
324  std::shared_ptr<Alignments> first_payload = fetchPayload(std::get<1>(firstiov));
325 
326  std::string lastIOVsince = std::to_string(std::get<0>(lastiov));
327  std::string firstIOVsince = std::to_string(std::get<0>(firstiov));
328 
329  std::vector<AlignTransform> ref_ali = first_payload->m_align;
330  std::vector<AlignTransform> target_ali = last_payload->m_align;
331 
332  if (ref_ali.size() != target_ali.size()) {
333  edm::LogError("TrackerAlignment_PayloadInspector")
334  << "the size of the reference alignment (" << ref_ali.size()
335  << ") is different from the one of the target (" << target_ali.size()
336  << ")! You are probably trying to compare different underlying geometries. Exiting";
337  return false;
338  }
339 
340  // check that the geomtery is a tracker one
341  const char *path_toTopologyXML = (ref_ali.size() == AlignmentPI::phase0size)
342  ? "Geometry/TrackerCommonData/data/trackerParameters.xml"
343  : "Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
344  TrackerTopology tTopo =
346 
347  for (const auto &ali : ref_ali) {
348  auto mydetid = ali.rawId();
349  if (DetId(mydetid).det() != DetId::Tracker) {
350  edm::LogWarning("TrackerAlignment_PayloadInspector")
351  << "Encountered invalid Tracker DetId:" << DetId(mydetid).rawId() << " (" << DetId(mydetid).det()
352  << ") is different from " << DetId::Tracker << " (is DoubleSide: " << tTopo.tidIsDoubleSide(mydetid)
353  << "); subdetId " << DetId(mydetid).subdetId() << " - terminating ";
354  return false;
355  }
356  }
357 
358  TCanvas canvas("Alignment Comparison", "Alignment Comparison", 1800, 1200);
359  canvas.Divide(3, 2);
360 
361  std::unordered_map<AlignmentPI::coordinate, std::unique_ptr<TH1F> > diffs;
362  std::vector<AlignmentPI::coordinate> coords = {AlignmentPI::t_x,
368 
369  for (const auto &coord : coords) {
370  auto s_coord = AlignmentPI::getStringFromCoordinate(coord);
371  std::string unit =
372  (coord == AlignmentPI::t_x || coord == AlignmentPI::t_y || coord == AlignmentPI::t_z) ? "[#mum]" : "[mrad]";
373 
374  diffs[coord] = std::make_unique<TH1F>(Form("hDiff_%s", s_coord.c_str()),
375  Form(";#Delta%s %s;n. of modules", s_coord.c_str(), unit.c_str()),
376  1000,
377  -500.,
378  500.);
379  }
380 
381  int loopedComponents(0);
382  for (unsigned int i = 0; i < ref_ali.size(); i++) {
383  if (ref_ali[i].rawId() == target_ali[i].rawId()) {
384  loopedComponents++;
385  int subid = DetId(ref_ali[i].rawId()).subdetId();
386  auto thePart = static_cast<AlignmentPI::partitions>(subid);
387  if (thePart != q)
388  continue;
389 
390  CLHEP::HepRotation target_rot(target_ali[i].rotation());
391  CLHEP::HepRotation ref_rot(ref_ali[i].rotation());
392 
393  align::RotationType target_rotation(target_rot.xx(),
394  target_rot.xy(),
395  target_rot.xz(),
396  target_rot.yx(),
397  target_rot.yy(),
398  target_rot.yz(),
399  target_rot.zx(),
400  target_rot.zy(),
401  target_rot.zz());
402 
403  align::RotationType ref_rotation(ref_rot.xx(),
404  ref_rot.xy(),
405  ref_rot.xz(),
406  ref_rot.yx(),
407  ref_rot.yy(),
408  ref_rot.yz(),
409  ref_rot.zx(),
410  ref_rot.zy(),
411  ref_rot.zz());
412 
413  align::EulerAngles target_eulerAngles = align::toAngles(target_rotation);
414  align::EulerAngles ref_eulerAngles = align::toAngles(ref_rotation);
415 
416  for (const auto &coord : coords) {
417  switch (coord) {
418  case AlignmentPI::t_x:
419  diffs[coord]->Fill((target_ali[i].translation().x() - ref_ali[i].translation().x()) *
421  break;
422  case AlignmentPI::t_y:
423  diffs[coord]->Fill((target_ali[i].translation().y() - ref_ali[i].translation().y()) *
425  break;
426  case AlignmentPI::t_z:
427  diffs[coord]->Fill((target_ali[i].translation().z() - ref_ali[i].translation().z()) *
429  break;
431  diffs[coord]->Fill((target_eulerAngles[0] - ref_eulerAngles[0]) * 1000.);
432  break;
434  diffs[coord]->Fill((target_eulerAngles[1] - ref_eulerAngles[1]) * 1000.);
435  break;
437  diffs[coord]->Fill((target_eulerAngles[2] - ref_eulerAngles[2]) * 1000.);
438  break;
439  default:
440  edm::LogError("TrackerAlignment_PayloadInspector") << "Unrecognized coordinate " << coord << std::endl;
441  break;
442  } // switch on the coordinate
443  }
444  } // check on the same detID
445  } // loop on the components
446 
447  int c_index = 1;
448 
449  auto legend = std::unique_ptr<TLegend>(new TLegend(0.14, 0.93, 0.55, 0.98));
450  legend->AddEntry(
451  diffs[AlignmentPI::t_x].get(),
452  ("#DeltaIOV: " + std::to_string(std::get<0>(lastiov)) + "-" + std::to_string(std::get<0>(firstiov))).c_str(),
453  "L");
454  legend->SetTextSize(0.03);
455 
456  for (const auto &coord : coords) {
457  canvas.cd(c_index)->SetLogy();
458  canvas.cd(c_index)->SetTopMargin(0.02);
459  canvas.cd(c_index)->SetBottomMargin(0.15);
460  canvas.cd(c_index)->SetLeftMargin(0.14);
461  canvas.cd(c_index)->SetRightMargin(0.04);
462  diffs[coord]->SetLineWidth(2);
463  AlignmentPI::makeNicePlotStyle(diffs[coord].get(), kBlack);
464 
465  //float x_max = diffs[coord]->GetXaxis()->GetBinCenter(diffs[coord]->FindLastBinAbove(0.));
466  //float x_min = diffs[coord]->GetXaxis()->GetBinCenter(diffs[coord]->FindFirstBinAbove(0.));
467  //float extremum = std::abs(x_max) > std::abs(x_min) ? std::abs(x_max) : std::abs(x_min);
468  //diffs[coord]->GetXaxis()->SetRangeUser(-extremum*2,extremum*2);
469 
470  int i_max = diffs[coord]->FindLastBinAbove(0.);
471  int i_min = diffs[coord]->FindFirstBinAbove(0.);
472  diffs[coord]->GetXaxis()->SetRange(std::max(1, i_min - 10), std::min(i_max + 10, diffs[coord]->GetNbinsX()));
473  diffs[coord]->Draw("HIST");
474  AlignmentPI::makeNiceStats(diffs[coord].get(), q, kBlack);
475 
476  legend->Draw("same");
477 
478  c_index++;
479  }
480 
481  std::string fileName(m_imageFileName);
482  canvas.SaveAs(fileName.c_str());
483 
484  return true;
485  }
486  };
487 
488  typedef TrackerAlignmentSummary<AlignmentPI::BPix> TrackerAlignmentSummaryBPix;
489  typedef TrackerAlignmentSummary<AlignmentPI::FPix> TrackerAlignmentSummaryFPix;
490  typedef TrackerAlignmentSummary<AlignmentPI::TIB> TrackerAlignmentSummaryTIB;
491 
492  typedef TrackerAlignmentSummary<AlignmentPI::TID> TrackerAlignmentSummaryTID;
493  typedef TrackerAlignmentSummary<AlignmentPI::TOB> TrackerAlignmentSummaryTOB;
494  typedef TrackerAlignmentSummary<AlignmentPI::TEC> TrackerAlignmentSummaryTEC;
495 
496  //*******************************************//
497  // History of the position of the BPix Barycenter
498  //******************************************//
499 
500  template <AlignmentPI::coordinate coord>
501  class BPixBarycenterHistory : public cond::payloadInspector::HistoryPlot<Alignments, float> {
502  public:
503  BPixBarycenterHistory()
504  : cond::payloadInspector::HistoryPlot<Alignments, float>(
505  " Barrel Pixel " + AlignmentPI::getStringFromCoordinate(coord) + " positions vs time",
506  AlignmentPI::getStringFromCoordinate(coord) + " position [cm]") {}
507  ~BPixBarycenterHistory() override = default;
508 
509  float getFromPayload(Alignments &payload) override {
510  std::vector<AlignTransform> alignments = payload.m_align;
511 
512  float barycenter = 0.;
513  float nmodules(0.);
514  for (const auto &ali : alignments) {
515  if (DetId(ali.rawId()).det() != DetId::Tracker) {
516  edm::LogWarning("TrackerAlignment_PayloadInspector")
517  << "Encountered invalid Tracker DetId:" << ali.rawId() << " " << DetId(ali.rawId()).det()
518  << " is different from " << DetId::Tracker << " - terminating ";
519  return false;
520  }
521 
522  int subid = DetId(ali.rawId()).subdetId();
523  if (subid != PixelSubdetector::PixelBarrel)
524  continue;
525 
526  nmodules++;
527  switch (coord) {
528  case AlignmentPI::t_x:
529  barycenter += (ali.translation().x());
530  break;
531  case AlignmentPI::t_y:
532  barycenter += (ali.translation().y());
533  break;
534  case AlignmentPI::t_z:
535  barycenter += (ali.translation().z());
536  break;
537  default:
538  edm::LogError("TrackerAlignment_PayloadInspector") << "Unrecognized coordinate " << coord << std::endl;
539  break;
540  } // switch on the coordinate (only X,Y,Z are interesting)
541  } // ends loop on the alignments
542 
543  edm::LogInfo("TrackerAlignment_PayloadInspector") << "barycenter (" << barycenter << ")/n. modules (" << nmodules
544  << ") = " << barycenter / nmodules << std::endl;
545 
546  // take the mean
547  barycenter /= nmodules;
548 
549  // applied GPR correction to move barycenter to global CMS coordinates
550  barycenter += hardcodeGPR.at(coord);
551 
552  return barycenter;
553 
554  } // payload
555  };
556 
557  typedef BPixBarycenterHistory<AlignmentPI::t_x> X_BPixBarycenterHistory;
558  typedef BPixBarycenterHistory<AlignmentPI::t_y> Y_BPixBarycenterHistory;
559  typedef BPixBarycenterHistory<AlignmentPI::t_z> Z_BPixBarycenterHistory;
560 
561  /************************************************
562  Display of Tracker Detector barycenters
563  *************************************************/
564  class TrackerAlignmentBarycenters : public cond::payloadInspector::PlotImage<Alignments> {
565  public:
566  TrackerAlignmentBarycenters()
567  : cond::payloadInspector::PlotImage<Alignments>("Display of Tracker Alignment Barycenters") {
568  setSingleIov(true);
569  }
570 
571  bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash> > &iovs) override {
572  auto iov = iovs.front();
573  std::shared_ptr<Alignments> payload = fetchPayload(std::get<1>(iov));
574  unsigned int run = std::get<0>(iov);
575 
576  TCanvas canvas("Tracker Alignment Barycenter Summary", "Tracker Alignment Barycenter summary", 1600, 1000);
577  canvas.cd();
578 
579  canvas.SetTopMargin(0.07);
580  canvas.SetBottomMargin(0.06);
581  canvas.SetLeftMargin(0.15);
582  canvas.SetRightMargin(0.03);
583  canvas.Modified();
584  canvas.SetGrid();
585 
586  auto h2_BarycenterParameters =
587  std::unique_ptr<TH2F>(new TH2F("Parameters", "SubDetector Barycenter summary", 6, 0.0, 6.0, 6, 0, 6.));
588 
589  auto h2_uncBarycenterParameters =
590  std::unique_ptr<TH2F>(new TH2F("Parameters2", "SubDetector Barycenter summary", 6, 0.0, 6.0, 6, 0, 6.));
591 
592  h2_BarycenterParameters->SetStats(false);
593  h2_BarycenterParameters->SetTitle(nullptr);
594  h2_uncBarycenterParameters->SetStats(false);
595  h2_uncBarycenterParameters->SetTitle(nullptr);
596 
597  std::vector<AlignTransform> alignments = payload->m_align;
598 
599  isPhase0 = (alignments.size() == AlignmentPI::phase0size) ? true : false;
600 
601  // check that the geomtery is a tracker one
602  const char *path_toTopologyXML = isPhase0 ? "Geometry/TrackerCommonData/data/trackerParameters.xml"
603  : "Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
604 
605  TrackerTopology tTopo =
607 
608  AlignmentPI::TkAlBarycenters barycenters;
609  // compute uncorrected barycenter
610  barycenters.computeBarycenters(
611  alignments, tTopo, {{AlignmentPI::t_x, 0.0}, {AlignmentPI::t_y, 0.0}, {AlignmentPI::t_z, 0.0}});
612 
613  auto Xbarycenters = barycenters.getX();
614  auto Ybarycenters = barycenters.getY();
615  auto Zbarycenters = barycenters.getZ();
616 
617  // compute barycenter corrected for the GPR
618  barycenters.computeBarycenters(alignments, tTopo, hardcodeGPR);
619 
620  auto c_Xbarycenters = barycenters.getX();
621  auto c_Ybarycenters = barycenters.getY();
622  auto c_Zbarycenters = barycenters.getZ();
623 
624  h2_BarycenterParameters->GetXaxis()->SetBinLabel(1, "X [cm]");
625  h2_BarycenterParameters->GetXaxis()->SetBinLabel(2, "Y [cm]");
626  h2_BarycenterParameters->GetXaxis()->SetBinLabel(3, "Z [cm]");
627  h2_BarycenterParameters->GetXaxis()->SetBinLabel(4, "X_{no GPR} [cm]");
628  h2_BarycenterParameters->GetXaxis()->SetBinLabel(5, "Y_{no GPR} [cm]");
629  h2_BarycenterParameters->GetXaxis()->SetBinLabel(6, "Z_{no GPR} [cm]");
630 
631  bool isLikelyMC(false);
632  int checkX =
633  std::count_if(Xbarycenters.begin(), Xbarycenters.begin() + 2, [](float a) { return (std::abs(a) >= 1.e-4); });
634  int checkY =
635  std::count_if(Ybarycenters.begin(), Ybarycenters.begin() + 2, [](float a) { return (std::abs(a) >= 1.e-4); });
636  int checkZ =
637  std::count_if(Zbarycenters.begin(), Zbarycenters.begin() + 2, [](float a) { return (std::abs(a) >= 1.e-4); });
638 
639  // if all the coordinate barycenters for both BPix and FPix are below 10um
640  // this is very likely a MC payload
641  if ((checkX + checkY + checkZ) == 0 && run == 1)
642  isLikelyMC = true;
643 
644  unsigned int yBin = 6;
645  for (unsigned int i = 0; i < 6; i++) {
646  auto thePart = static_cast<AlignmentPI::partitions>(i + 1);
647  std::string theLabel = getStringFromPart(thePart);
648  h2_BarycenterParameters->GetYaxis()->SetBinLabel(yBin, theLabel.c_str());
649  if (!isLikelyMC) {
650  h2_BarycenterParameters->SetBinContent(1, yBin, c_Xbarycenters[i]);
651  h2_BarycenterParameters->SetBinContent(2, yBin, c_Ybarycenters[i]);
652  h2_BarycenterParameters->SetBinContent(3, yBin, c_Zbarycenters[i]);
653  }
654 
655  h2_uncBarycenterParameters->SetBinContent(4, yBin, Xbarycenters[i]);
656  h2_uncBarycenterParameters->SetBinContent(5, yBin, Ybarycenters[i]);
657  h2_uncBarycenterParameters->SetBinContent(6, yBin, Zbarycenters[i]);
658  yBin--;
659  }
660 
661  h2_BarycenterParameters->GetXaxis()->LabelsOption("h");
662  h2_BarycenterParameters->GetYaxis()->SetLabelSize(0.05);
663  h2_BarycenterParameters->GetXaxis()->SetLabelSize(0.05);
664  h2_BarycenterParameters->SetMarkerSize(1.5);
665  h2_BarycenterParameters->Draw("TEXT");
666 
667  h2_uncBarycenterParameters->SetMarkerSize(1.5);
668  h2_uncBarycenterParameters->SetMarkerColor(kRed);
669  h2_uncBarycenterParameters->Draw("TEXTsame");
670 
671  TLatex t1;
672  t1.SetNDC();
673  t1.SetTextAlign(26);
674  t1.SetTextSize(0.05);
675  t1.DrawLatex(0.5, 0.96, Form("Tracker Alignment Barycenters, IOV %i", run));
676  t1.SetTextSize(0.025);
677 
678  std::string fileName(m_imageFileName);
679  canvas.SaveAs(fileName.c_str());
680 
681  return true;
682  }
683 
684  private:
685  bool isPhase0;
686  };
687 
688  /************************************************
689  Comparator of Tracker Detector barycenters
690  *************************************************/
691  class TrackerAlignmentBarycentersComparatorBase : public cond::payloadInspector::PlotImage<Alignments> {
692  public:
693  TrackerAlignmentBarycentersComparatorBase()
694  : cond::payloadInspector::PlotImage<Alignments>("Comparison of Tracker Alignment Barycenters") {}
695 
696  bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash> > &iovs) override {
697  std::vector<std::tuple<cond::Time_t, cond::Hash> > sorted_iovs = iovs;
698 
699  // make absolute sure the IOVs are sortd by since
700  std::sort(begin(sorted_iovs), end(sorted_iovs), [](auto const &t1, auto const &t2) {
701  return std::get<0>(t1) < std::get<0>(t2);
702  });
703 
704  auto firstiov = sorted_iovs.front();
705  unsigned int first_run = std::get<0>(firstiov);
706 
707  auto lastiov = sorted_iovs.back();
708  unsigned int last_run = std::get<0>(lastiov);
709 
710  std::shared_ptr<Alignments> last_payload = fetchPayload(std::get<1>(lastiov));
711  std::vector<AlignTransform> last_alignments = last_payload->m_align;
712 
713  std::shared_ptr<Alignments> first_payload = fetchPayload(std::get<1>(firstiov));
714  std::vector<AlignTransform> first_alignments = first_payload->m_align;
715 
716  isInitialPhase0 = (first_alignments.size() == AlignmentPI::phase0size) ? true : false;
717  isFinalPhase0 = (last_alignments.size() == AlignmentPI::phase0size) ? true : false;
718 
719  // check that the geomtery is a tracker one
720  const char *path_toTopologyXML = isInitialPhase0 ? "Geometry/TrackerCommonData/data/trackerParameters.xml"
721  : "Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
722 
723  TrackerTopology tTopo_f =
725 
726  path_toTopologyXML = isFinalPhase0 ? "Geometry/TrackerCommonData/data/trackerParameters.xml"
727  : "Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
728 
729  TrackerTopology tTopo_l =
731 
732  TCanvas canvas("Tracker Alignment Barycenter Summary", "Tracker Alignment Barycenter summary", 1200, 800);
733  canvas.cd();
734 
735  canvas.SetTopMargin(0.07);
736  canvas.SetBottomMargin(0.06);
737  canvas.SetLeftMargin(0.15);
738  canvas.SetRightMargin(0.03);
739  canvas.Modified();
740  canvas.SetGrid();
741 
742  auto h2_BarycenterDiff = std::unique_ptr<TH2F>(
743  new TH2F("Parameters diff", "SubDetector Barycenter Difference", 3, 0.0, 3.0, 6, 0, 6.));
744 
745  h2_BarycenterDiff->SetStats(false);
746  h2_BarycenterDiff->SetTitle(nullptr);
747  h2_BarycenterDiff->GetXaxis()->SetBinLabel(1, "X [#mum]");
748  h2_BarycenterDiff->GetXaxis()->SetBinLabel(2, "Y [#mum]");
749  h2_BarycenterDiff->GetXaxis()->SetBinLabel(3, "Z [#mum]");
750 
751  AlignmentPI::TkAlBarycenters l_barycenters;
752  l_barycenters.computeBarycenters(last_alignments, tTopo_l, hardcodeGPR);
753 
754  AlignmentPI::TkAlBarycenters f_barycenters;
755  f_barycenters.computeBarycenters(first_alignments, tTopo_f, hardcodeGPR);
756 
757  unsigned int yBin = 6;
758  for (unsigned int i = 0; i < 6; i++) {
759  auto thePart = static_cast<AlignmentPI::partitions>(i + 1);
760  std::string theLabel = getStringFromPart(thePart);
761  h2_BarycenterDiff->GetYaxis()->SetBinLabel(yBin, theLabel.c_str());
762  h2_BarycenterDiff->SetBinContent(
763  1, yBin, (l_barycenters.getX()[i] - f_barycenters.getX()[i]) * AlignmentPI::cmToUm);
764  h2_BarycenterDiff->SetBinContent(
765  2, yBin, (l_barycenters.getY()[i] - f_barycenters.getY()[i]) * AlignmentPI::cmToUm);
766  h2_BarycenterDiff->SetBinContent(
767  3, yBin, (l_barycenters.getZ()[i] - f_barycenters.getZ()[i]) * AlignmentPI::cmToUm);
768  yBin--;
769  }
770 
771  h2_BarycenterDiff->GetXaxis()->LabelsOption("h");
772  h2_BarycenterDiff->GetYaxis()->SetLabelSize(0.05);
773  h2_BarycenterDiff->GetXaxis()->SetLabelSize(0.05);
774  h2_BarycenterDiff->SetMarkerSize(1.5);
775  h2_BarycenterDiff->SetMarkerColor(kRed);
776  h2_BarycenterDiff->Draw("TEXT");
777 
778  TLatex t1;
779  t1.SetNDC();
780  t1.SetTextAlign(26);
781  t1.SetTextSize(0.05);
782  t1.DrawLatex(0.5, 0.96, Form("Tracker Alignment Barycenters Diff, IOV %i - IOV %i", last_run, first_run));
783  t1.SetTextSize(0.025);
784 
785  std::string fileName(m_imageFileName);
786  canvas.SaveAs(fileName.c_str());
787 
788  return true;
789  }
790 
791  private:
792  bool isInitialPhase0;
793  bool isFinalPhase0;
794  };
795 
796  class TrackerAlignmentBarycentersCompare : public TrackerAlignmentBarycentersComparatorBase {
797  public:
798  TrackerAlignmentBarycentersCompare() : TrackerAlignmentBarycentersComparatorBase() { this->setSingleIov(false); }
799  };
800 
801  class TrackerAlignmentBarycentersCompareTwoTags : public TrackerAlignmentBarycentersComparatorBase {
802  public:
803  TrackerAlignmentBarycentersCompareTwoTags() : TrackerAlignmentBarycentersComparatorBase() {
804  this->setTwoTags(true);
805  }
806  };
807 
808  /************************************************
809  Comparator of Pixel Tracker Detector barycenters
810  *************************************************/
811  class PixelBarycentersComparatorBase : public cond::payloadInspector::PlotImage<Alignments> {
812  public:
813  PixelBarycentersComparatorBase()
814  : cond::payloadInspector::PlotImage<Alignments>("Comparison of Pixel Barycenters") {}
815 
816  bool fill(const std::vector<std::tuple<cond::Time_t, cond::Hash> > &iovs) override {
817  std::vector<std::tuple<cond::Time_t, cond::Hash> > sorted_iovs = iovs;
818 
819  // make absolute sure the IOVs are sortd by since
820  std::sort(begin(sorted_iovs), end(sorted_iovs), [](auto const &t1, auto const &t2) {
821  return std::get<0>(t1) < std::get<0>(t2);
822  });
823 
824  auto firstiov = sorted_iovs.front();
825  unsigned int first_run = std::get<0>(firstiov);
826 
827  auto lastiov = sorted_iovs.back();
828  unsigned int last_run = std::get<0>(lastiov);
829 
830  std::shared_ptr<Alignments> last_payload = fetchPayload(std::get<1>(lastiov));
831  std::vector<AlignTransform> last_alignments = last_payload->m_align;
832 
833  std::shared_ptr<Alignments> first_payload = fetchPayload(std::get<1>(firstiov));
834  std::vector<AlignTransform> first_alignments = first_payload->m_align;
835 
836  TCanvas canvas("Pixel Barycenter Summary", "Pixel Barycenter summary", 1200, 1200);
837  canvas.Divide(2, 2);
838  canvas.cd();
839 
840  TLatex t1;
841  t1.SetNDC();
842  t1.SetTextAlign(26);
843  t1.SetTextSize(0.03);
844  t1.DrawLatex(0.5,
845  0.97,
846  ("Pixel Barycenters comparison, IOV: #color[2]{" + std::to_string(first_run) +
847  "} vs IOV: #color[4]{" + std::to_string(last_run) + "}")
848  .c_str());
849  t1.SetTextSize(0.025);
850 
851  for (unsigned int c = 1; c <= 4; c++) {
852  canvas.cd(c)->SetTopMargin(0.07);
853  canvas.cd(c)->SetBottomMargin(0.12);
854  canvas.cd(c)->SetLeftMargin(0.15);
855  canvas.cd(c)->SetRightMargin(0.03);
856  canvas.cd(c)->Modified();
857  canvas.cd(c)->SetGrid();
858  }
859 
860  std::array<std::string, 3> structures = {{"FPIX-", "BPIX", "FPIX+"}};
861  std::array<std::unique_ptr<TH2F>, 3> histos;
862 
863  isInitialPhase0 = (first_alignments.size() == AlignmentPI::phase0size) ? true : false;
864  isFinalPhase0 = (last_alignments.size() == AlignmentPI::phase0size) ? true : false;
865 
866  // check that the geomtery is a tracker one
867  const char *path_toTopologyXML = isInitialPhase0 ? "Geometry/TrackerCommonData/data/trackerParameters.xml"
868  : "Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
869 
870  TrackerTopology tTopo_f =
872 
873  AlignmentPI::TkAlBarycenters myInitialBarycenters;
874  //myInitialBarycenters.computeBarycenters(first_alignments,tTopo_f,hardcodeGPR);
875  myInitialBarycenters.computeBarycenters(
876  first_alignments, tTopo_f, {{AlignmentPI::t_x, 0.0}, {AlignmentPI::t_y, 0.0}, {AlignmentPI::t_z, 0.0}});
877 
878  path_toTopologyXML = isFinalPhase0 ? "Geometry/TrackerCommonData/data/trackerParameters.xml"
879  : "Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
880 
881  TrackerTopology tTopo_l =
883 
884  AlignmentPI::TkAlBarycenters myFinalBarycenters;
885  //myFinalBarycenters.computeBarycenters(last_alignments,tTopo_l,hardcodeGPR);
886  myFinalBarycenters.computeBarycenters(
887  last_alignments, tTopo_l, {{AlignmentPI::t_x, 0.0}, {AlignmentPI::t_y, 0.0}, {AlignmentPI::t_z, 0.0}});
888 
889  if (isFinalPhase0 != isInitialPhase0) {
890  edm::LogWarning("TrackerAlignment_PayloadInspector")
891  << "the size of the reference alignment (" << first_alignments.size()
892  << ") is different from the one of the target (" << last_alignments.size()
893  << ")! You are probably trying to compare different underlying geometries.";
894  }
895 
896  unsigned int index(0);
897  for (const auto &piece : structures) {
898  const char *name = piece.c_str();
899  histos[index] = std::unique_ptr<TH2F>(
900  new TH2F(name,
901  Form("%s x-y Barycenter Difference;x_{%s}-x_{TOB} [mm];y_{%s}-y_{TOB} [mm]", name, name, name),
902  100,
903  -3.,
904  3.,
905  100,
906  -3.,
907  3.));
908 
909  histos[index]->SetStats(false);
910  histos[index]->SetTitle(nullptr);
911  histos[index]->GetYaxis()->SetLabelSize(0.05);
912  histos[index]->GetXaxis()->SetLabelSize(0.05);
913  histos[index]->GetYaxis()->SetTitleSize(0.06);
914  histos[index]->GetXaxis()->SetTitleSize(0.06);
915  histos[index]->GetYaxis()->CenterTitle();
916  histos[index]->GetXaxis()->CenterTitle();
917  histos[index]->GetXaxis()->SetTitleOffset(0.9);
918  index++;
919  }
920 
921  auto h2_ZBarycenterDiff = std::unique_ptr<TH2F>(new TH2F(
922  "Pixel_z_diff", "Pixel z-Barycenter Difference;; z_{Pixel-Ideal} -z_{TOB} [mm]", 3, -0.5, 2.5, 100, -10., 10.));
923  h2_ZBarycenterDiff->SetStats(false);
924  h2_ZBarycenterDiff->SetTitle(nullptr);
925  h2_ZBarycenterDiff->GetXaxis()->SetBinLabel(1, "FPIX -");
926  h2_ZBarycenterDiff->GetXaxis()->SetBinLabel(2, "BPIX");
927  h2_ZBarycenterDiff->GetXaxis()->SetBinLabel(3, "FPIX +");
928  h2_ZBarycenterDiff->GetYaxis()->SetLabelSize(0.05);
929  h2_ZBarycenterDiff->GetXaxis()->SetLabelSize(0.07);
930  h2_ZBarycenterDiff->GetYaxis()->SetTitleSize(0.06);
931  h2_ZBarycenterDiff->GetXaxis()->SetTitleSize(0.06);
932  h2_ZBarycenterDiff->GetYaxis()->CenterTitle();
933  h2_ZBarycenterDiff->GetXaxis()->CenterTitle();
934  h2_ZBarycenterDiff->GetYaxis()->SetTitleOffset(1.1);
935 
936  std::function<GlobalPoint(int)> cutFunctorInitial = [&myInitialBarycenters](int index) {
937  switch (index) {
938  case 1:
939  return myInitialBarycenters.getPartitionAvg(AlignmentPI::PARTITION::FPIXm);
940  case 2:
941  return myInitialBarycenters.getPartitionAvg(AlignmentPI::PARTITION::BPIX);
942  case 3:
943  return myInitialBarycenters.getPartitionAvg(AlignmentPI::PARTITION::FPIXp);
944  default:
945  return GlobalPoint(0, 0, 0);
946  }
947  };
948 
949  std::function<GlobalPoint(int)> cutFunctorFinal = [&myFinalBarycenters](int index) {
950  switch (index) {
951  case 1:
952  return myFinalBarycenters.getPartitionAvg(AlignmentPI::PARTITION::FPIXm);
953  case 2:
954  return myFinalBarycenters.getPartitionAvg(AlignmentPI::PARTITION::BPIX);
955  case 3:
956  return myFinalBarycenters.getPartitionAvg(AlignmentPI::PARTITION::FPIXp);
957  default:
958  return GlobalPoint(0, 0, 0);
959  }
960  };
961 
962  float x0i, x0f, y0i, y0f;
963 
964  t1.SetNDC(kFALSE);
965  t1.SetTextSize(0.047);
966  for (unsigned int c = 1; c <= 3; c++) {
967  x0i = cutFunctorInitial(c).x() * 10; // transform cm to mm (x10)
968  x0f = cutFunctorFinal(c).x() * 10;
969  y0i = cutFunctorInitial(c).y() * 10;
970  y0f = cutFunctorFinal(c).y() * 10;
971 
972  canvas.cd(c);
973  histos[c - 1]->Draw();
974 
975  COUT << "initial x,y " << std::left << std::setw(7) << structures[c - 1] << " (" << x0i << "," << y0i << ") mm"
976  << std::endl;
977  COUT << "final x,y " << std::left << std::setw(7) << structures[c - 1] << " (" << x0f << "," << y0f << ") mm"
978  << std::endl;
979 
980  TMarker *initial = new TMarker(x0i, y0i, 21);
981  TMarker *final = new TMarker(x0f, y0f, 20);
982 
983  initial->SetMarkerColor(kRed);
984  final->SetMarkerColor(kBlue);
985  initial->SetMarkerSize(2.5);
986  final->SetMarkerSize(2.5);
987  t1.SetTextColor(kRed);
988  initial->Draw();
989  t1.DrawLatex(x0i, y0i - 0.5, Form("(%.2f,%.2f)", x0i, y0i));
990  final->Draw("same");
991  t1.SetTextColor(kBlue);
992  t1.DrawLatex(x0f, y0f + 0.3, Form("(%.2f,%.2f)", x0f, y0f));
993  }
994 
995  // fourth pad is a special case for the z coordinate
996  canvas.cd(4);
997  h2_ZBarycenterDiff->Draw();
998  float z0i, z0f;
999 
1000  // numbers do agree with https://twiki.cern.ch/twiki/bin/view/CMSPublic/TkAlignmentPerformancePhaseIStartUp17#Pixel_Barycentre_Positions
1001 
1002  std::array<double, 3> hardcodeIdealZPhase0 = {{-41.94909, 0., 41.94909}}; // units are cm
1003  std::array<double, 3> hardcodeIdealZPhase1 = {{-39.82911, 0., 39.82911}}; // units are cm
1004 
1005  for (unsigned int c = 1; c <= 3; c++) {
1006  // less than pretty but needed to remove the z position of the FPix barycenters != 0
1007 
1008  z0i =
1009  (cutFunctorInitial(c).z() - (isInitialPhase0 ? hardcodeIdealZPhase0[c - 1] : hardcodeIdealZPhase1[c - 1])) *
1010  10; // convert to mm
1011  z0f =
1012  (cutFunctorFinal(c).z() - (isFinalPhase0 ? hardcodeIdealZPhase0[c - 1] : hardcodeIdealZPhase1[c - 1])) * 10;
1013 
1014  TMarker *initial = new TMarker(c - 1, z0i, 21);
1015  TMarker *final = new TMarker(c - 1, z0f, 20);
1016 
1017  COUT << "initial z " << std::left << std::setw(7) << structures[c - 1] << " " << z0i << " mm" << std::endl;
1018  COUT << "final z " << std::left << std::setw(7) << structures[c - 1] << " " << z0f << " mm" << std::endl;
1019 
1020  initial->SetMarkerColor(kRed);
1021  final->SetMarkerColor(kBlue);
1022  initial->SetMarkerSize(2.5);
1023  final->SetMarkerSize(2.5);
1024  initial->Draw();
1025  t1.SetTextColor(kRed);
1026  t1.DrawLatex(c - 1, z0i - 1.5, Form("(%.2f)", z0i));
1027  final->Draw("same");
1028  t1.SetTextColor(kBlue);
1029  t1.DrawLatex(c - 1, z0f + 1., Form("(%.2f)", z0f));
1030  }
1031 
1032  std::string fileName(m_imageFileName);
1033  canvas.SaveAs(fileName.c_str());
1034 
1035  return true;
1036  }
1037 
1038  private:
1039  bool isInitialPhase0;
1040  bool isFinalPhase0;
1041  };
1042 
1043  class PixelBarycentersCompare : public PixelBarycentersComparatorBase {
1044  public:
1045  PixelBarycentersCompare() : PixelBarycentersComparatorBase() { this->setSingleIov(false); }
1046  };
1047 
1048  class PixelBarycentersCompareTwoTags : public PixelBarycentersComparatorBase {
1049  public:
1050  PixelBarycentersCompareTwoTags() : PixelBarycentersComparatorBase() { this->setTwoTags(true); }
1051  };
1052 
1053 } // namespace
1054 
1056  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentCompareX);
1057  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentCompareY);
1058  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentCompareZ);
1059  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentCompareAlpha);
1060  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentCompareBeta);
1061  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentCompareGamma);
1062  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentCompareXTwoTags);
1063  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentCompareYTwoTags);
1064  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentCompareZTwoTags);
1065  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentCompareAlphaTwoTags);
1066  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentCompareBetaTwoTags);
1067  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentCompareGammaTwoTags);
1068  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentSummaryBPix);
1069  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentSummaryFPix);
1070  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentSummaryTIB);
1071  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentSummaryTID);
1072  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentSummaryTOB);
1073  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentSummaryTEC);
1074  PAYLOAD_INSPECTOR_CLASS(X_BPixBarycenterHistory);
1075  PAYLOAD_INSPECTOR_CLASS(Y_BPixBarycenterHistory);
1076  PAYLOAD_INSPECTOR_CLASS(Z_BPixBarycenterHistory);
1077  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentBarycenters);
1078  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentBarycentersCompare);
1079  PAYLOAD_INSPECTOR_CLASS(TrackerAlignmentBarycentersCompareTwoTags);
1080  PAYLOAD_INSPECTOR_CLASS(PixelBarycentersCompare);
1081  PAYLOAD_INSPECTOR_CLASS(PixelBarycentersCompareTwoTags);
1082 }
align::toAngles
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
Definition: Utilities.cc:8
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
RandomServiceHelper.t2
t2
Definition: RandomServiceHelper.py:257
TkRotation< Scalar >
counter
Definition: counter.py:1
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
DDAxes::y
mps_fire.i
i
Definition: mps_fire.py:355
AlignmentPI::TkAlBarycenters::getZ
const std::array< double, 6 > getZ()
Definition: AlignmentPayloadInspectorHelper.h:839
MessageLogger.h
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
AlignmentPI::PARTITION::BPIX
writedatasetfile.last_run
last_run
Definition: writedatasetfile.py:27
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
min
T min(T a, T b)
Definition: MathUtil.h:58
AlignmentPI::makeNicePlotStyle
void makeNicePlotStyle(TH1 *hist, int color)
Definition: AlignmentPayloadInspectorHelper.h:685
contentValuesFiles.fullPath
fullPath
Definition: contentValuesFiles.py:64
TrackerTopology
Definition: TrackerTopology.h:16
PayloadInspector.h
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
TrackerTopology::tidIsDoubleSide
bool tidIsDoubleSide(const DetId &id) const
Definition: TrackerTopology.h:250
AlignmentPI::t_z
Definition: AlignmentPayloadInspectorHelper.h:36
edm::LogInfo
Definition: MessageLogger.h:254
data-class-funcs.q
q
Definition: data-class-funcs.py:169
Alignments.h
AlignmentPI::rot_gamma
Definition: AlignmentPayloadInspectorHelper.h:39
AlignmentPI::rot_alpha
Definition: AlignmentPayloadInspectorHelper.h:37
AlignmentPI::PARTITION::FPIXm
PAYLOAD_INSPECTOR_CLASS
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
Definition: PayloadInspectorModule.h:10
photonAnalyzer_cfi.yBin
yBin
Definition: photonAnalyzer_cfi.py:85
DDAxes::x
AlignmentPI::partitions
partitions
Definition: AlignmentPayloadInspectorHelper.h:48
AlignmentPayloadInspectorHelper.h
AlignmentPI::t_y
Definition: AlignmentPayloadInspectorHelper.h:35
AlignmentPI::getStringFromPart
std::string getStringFromPart(AlignmentPI::partitions i)
Definition: AlignmentPayloadInspectorHelper.h:641
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
PayloadInspectorModule.h
end
#define end
Definition: vmac.h:39
DetId
Definition: DetId.h:17
edm::FileInPath
Definition: FileInPath.h:64
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
AlignmentPI::makeNiceStats
void makeNiceStats(TH1F *hist, AlignmentPI::partitions part, int color)
Definition: AlignmentPayloadInspectorHelper.h:710
StandaloneTrackerTopology.h
AlignmentPI::TkAlBarycenters::getX
const std::array< double, 6 > getX()
Definition: AlignmentPayloadInspectorHelper.h:815
DDAxes::z
jets_cff.payload
payload
Definition: jets_cff.py:34
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
AlignmentPI::getStringFromCoordinate
std::string getStringFromCoordinate(AlignmentPI::coordinate coord)
Definition: AlignmentPayloadInspectorHelper.h:597
PAYLOAD_INSPECTOR_MODULE
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
Definition: PayloadInspectorModule.h:8
cond::payloadInspector::HistoryPlot
Definition: PayloadInspector.h:500
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
AlignmentPI::t_x
Definition: AlignmentPayloadInspectorHelper.h:34
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
TrackerAlignment
Definition: TrackerAlignment.h:15
cond
Definition: plugin.cc:23
Time.h
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
edm::LogError
Definition: MessageLogger.h:183
a
double a
Definition: hdecay.h:119
DetId::Tracker
Definition: DetId.h:25
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
AlignmentPI::cmToUm
static const float cmToUm
Definition: AlignmentPayloadInspectorHelper.h:31
AlignmentPI::TkAlBarycenters::computeBarycenters
void computeBarycenters(const std::vector< AlignTransform > &input, const TrackerTopology &tTopo, const std::map< AlignmentPI::coordinate, float > &GPR)
Definition: AlignmentPayloadInspectorHelper.h:860
cond::payloadInspector::PlotImage::fetchPayload
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Definition: PayloadInspector.h:840
listHistos.legend
legend
Definition: listHistos.py:41
AlignmentPI
Definition: AlignmentPayloadInspectorHelper.h:27
AlignmentPI::rot_beta
Definition: AlignmentPayloadInspectorHelper.h:38
Utilities.h
AlignmentPI::TkAlBarycenters::getY
const std::array< double, 6 > getY()
Definition: AlignmentPayloadInspectorHelper.h:827
AlignmentPI::BPix
Definition: AlignmentPayloadInspectorHelper.h:48
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
get
#define get
align::EulerAngles
AlgebraicVector EulerAngles
Definition: Definitions.h:34
cond::payloadInspector::HistoryPlot::getFromPayload
virtual Y getFromPayload(PayloadType &payload)=0
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
TrackerMap.h
unit
Basic3DVector unit() const
Definition: Basic3DVectorLD.h:162
combine.histos
histos
Definition: combine.py:4
AlignmentPI::TkAlBarycenters
Definition: AlignmentPayloadInspectorHelper.h:796
COUT
#define COUT
Definition: PVValidationHelpers.h:13
AlignmentPI::PARTITION::FPIXp
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
writedatasetfile.run
run
Definition: writedatasetfile.py:27
AlignmentPI::calculatePosition
std::pair< double, double > calculatePosition(TVirtualPad *myPad, int boundary)
Definition: AlignmentPayloadInspectorHelper.h:768
DetId.h
cond::payloadInspector::PlotImpl::fill
virtual bool fill()=0
cond::payloadInspector::PlotImage
Definition: PayloadInspector.h:829
HiBiasedCentrality_cfi.function
function
Definition: HiBiasedCentrality_cfi.py:4
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
AlignmentPI::TkAlBarycenters::getPartitionAvg
GlobalPoint getPartitionAvg(AlignmentPI::PARTITION p)
Definition: AlignmentPayloadInspectorHelper.h:853
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
AlignmentPI::phase0size
static const unsigned int phase0size
Definition: AlignmentPayloadInspectorHelper.h:30
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
compare
Definition: compare.py:1
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
mps_splice.line
line
Definition: mps_splice.py:76
Alignments
Definition: Alignments.h:10
StripSubdetector.h
StandaloneTrackerTopology::fromTrackerParametersXMLFile
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)
Definition: StandaloneTrackerTopology.cc:168
begin
#define begin
Definition: vmac.h:32
writedatasetfile.first_run
first_run
Definition: writedatasetfile.py:27