21 #include "CLHEP/Vector/RotationInterfaces.h" 45 #include "TPaveStats.h" 60 const std::map<AlignmentPI::coordinate, float> hardcodeGPR = {
67 template <AlignmentPI::coordinate coord,
int ntags, IOVMultiplicity nIOVs>
68 class TrackerAlignmentComparatorBase :
public PlotImage<Alignments, nIOVs, ntags> {
70 TrackerAlignmentComparatorBase()
72 " coordinate between two geometries") {}
74 bool fill()
override {
76 auto theIOVs = PlotBase::getTag<0>().iovs;
77 auto tagname1 = PlotBase::getTag<0>().
name;
79 auto firstiov = theIOVs.front();
80 std::tuple<cond::Time_t, cond::Hash> lastiov;
83 assert(this->m_plotAnnotations.ntags < 3);
85 if (this->m_plotAnnotations.ntags == 2) {
86 auto tag2iovs = PlotBase::getTag<1>().iovs;
87 tagname2 = PlotBase::getTag<1>().
name;
88 lastiov = tag2iovs.front();
90 lastiov = theIOVs.back();
93 std::shared_ptr<Alignments> last_payload = this->fetchPayload(std::get<1>(lastiov));
94 std::shared_ptr<Alignments> first_payload = this->fetchPayload(std::get<1>(firstiov));
99 std::vector<AlignTransform> ref_ali = first_payload->m_align;
100 std::vector<AlignTransform> target_ali = last_payload->m_align;
102 TCanvas
canvas(
"Alignment Comparison",
"Alignment Comparison", 1200, 1200);
104 if (ref_ali.size() != target_ali.size()) {
106 <<
"the size of the reference alignment (" << ref_ali.size()
107 <<
") is different from the one of the target (" << target_ali.size()
108 <<
")! You are probably trying to compare different underlying geometries. Exiting";
114 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml" 115 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
119 for (
const auto &ali : ref_ali) {
120 auto mydetid = ali.rawId();
123 <<
"Encountered invalid Tracker DetId:" <<
DetId(mydetid).
rawId() <<
" (" <<
DetId(mydetid).
det()
125 <<
"); subdetId " <<
DetId(mydetid).
subdetId() <<
" - terminating ";
136 std::unique_ptr<TH1F>
compare =
137 std::make_unique<TH1F>(
"comparison",
138 Form(
";Detector Id index; #Delta%s %s", s_coord.c_str(),
unit.c_str()),
141 ref_ali.size() - 0.5);
143 std::vector<int> boundaries;
145 for (
unsigned int i = 0;
i < ref_ali.size();
i++) {
146 if (ref_ali[
i].rawId() == target_ali[
i].rawId()) {
151 if (thePart != currentPart) {
152 currentPart = thePart;
156 CLHEP::HepRotation target_rot(target_ali[
i].
rotation());
157 CLHEP::HepRotation ref_rot(ref_ali[
i].
rotation());
196 compare->SetBinContent(
i + 1, (target_eulerAngles[0] - ref_eulerAngles[0]) * 1000.);
199 compare->SetBinContent(
i + 1, (target_eulerAngles[1] - ref_eulerAngles[1]) * 1000.);
202 compare->SetBinContent(
i + 1, (target_eulerAngles[2] - ref_eulerAngles[2]) * 1000.);
205 edm::LogError(
"TrackerAlignment_PayloadInspector") <<
"Unrecognized coordinate " << coord << std::endl;
213 canvas.SetTopMargin(0.06);
214 canvas.SetLeftMargin(0.17);
215 canvas.SetRightMargin(0.05);
216 canvas.SetBottomMargin(0.15);
230 TLine
l[boundaries.size()];
232 for (
const auto &
line : boundaries) {
237 l[
i].SetLineWidth(1);
238 l[
i].SetLineStyle(9);
239 l[
i].SetLineColor(2);
246 tSubdet.SetTextAlign(21);
247 tSubdet.SetTextSize(0.027);
248 tSubdet.SetTextAngle(90);
249 for (
unsigned int j = 1;
j <= 6;
j++) {
251 tSubdet.SetTextColor(kRed);
254 float theX_ = myPair.first + 0.025;
258 TLegend
legend = TLegend(0.17, 0.86, 0.95, 0.94);
259 if (this->m_plotAnnotations.ntags == 2) {
260 legend.SetHeader(
"#bf{Two Tags Comparison}",
"C");
263 (
"#splitline{" + tagname1 +
" : " + firstIOVsince +
"}{" + tagname2 +
" : " + lastIOVsince +
"}").c_str(),
266 legend.SetHeader((
"tag: #bf{" + tagname1 +
"}").c_str(),
"C");
268 (
"#splitline{IOV since: " + firstIOVsince +
"}{IOV since: " + lastIOVsince +
"}").c_str(),
271 legend.SetTextSize(0.020);
276 ltx.SetTextSize(0.042);
277 ltx.SetTextAlign(11);
278 ltx.DrawLatexNDC(gPad->GetLeftMargin(),
279 1 - gPad->GetTopMargin() + 0.01,
280 (
"Tracker Alignment Comparison:#color[4]{" + s_coord +
"}").c_str());
289 template <AlignmentPI::coordinate coord>
290 using TrackerAlignmentCompare = TrackerAlignmentComparatorBase<coord, 1, MULTI_IOV>;
292 template <AlignmentPI::coordinate coord>
293 using TrackerAlignmentCompareTwoTags = TrackerAlignmentComparatorBase<coord, 2, SINGLE_IOV>;
295 typedef TrackerAlignmentCompare<AlignmentPI::t_x> TrackerAlignmentCompareX;
296 typedef TrackerAlignmentCompare<AlignmentPI::t_y> TrackerAlignmentCompareY;
297 typedef TrackerAlignmentCompare<AlignmentPI::t_z> TrackerAlignmentCompareZ;
299 typedef TrackerAlignmentCompare<AlignmentPI::rot_alpha> TrackerAlignmentCompareAlpha;
300 typedef TrackerAlignmentCompare<AlignmentPI::rot_beta> TrackerAlignmentCompareBeta;
301 typedef TrackerAlignmentCompare<AlignmentPI::rot_gamma> TrackerAlignmentCompareGamma;
303 typedef TrackerAlignmentCompareTwoTags<AlignmentPI::t_x> TrackerAlignmentCompareXTwoTags;
304 typedef TrackerAlignmentCompareTwoTags<AlignmentPI::t_y> TrackerAlignmentCompareYTwoTags;
305 typedef TrackerAlignmentCompareTwoTags<AlignmentPI::t_z> TrackerAlignmentCompareZTwoTags;
307 typedef TrackerAlignmentCompareTwoTags<AlignmentPI::rot_alpha> TrackerAlignmentCompareAlphaTwoTags;
308 typedef TrackerAlignmentCompareTwoTags<AlignmentPI::rot_beta> TrackerAlignmentCompareBetaTwoTags;
309 typedef TrackerAlignmentCompareTwoTags<AlignmentPI::rot_gamma> TrackerAlignmentCompareGammaTwoTags;
315 template <AlignmentPI::partitions q>
316 class TrackerAlignmentSummary :
public PlotImage<Alignments, MULTI_IOV> {
318 TrackerAlignmentSummary()
322 bool fill()
override {
323 auto tag = PlotBase::getTag<0>();
324 auto sorted_iovs =
tag.iovs;
327 std::sort(begin(sorted_iovs),
end(sorted_iovs), [](
auto const &
t1,
auto const &
t2) {
328 return std::get<0>(
t1) < std::get<0>(
t2);
331 auto firstiov = sorted_iovs.front();
332 auto lastiov = sorted_iovs.back();
334 std::shared_ptr<Alignments> last_payload = fetchPayload(std::get<1>(lastiov));
335 std::shared_ptr<Alignments> first_payload = fetchPayload(std::get<1>(firstiov));
340 std::vector<AlignTransform> ref_ali = first_payload->m_align;
341 std::vector<AlignTransform> target_ali = last_payload->m_align;
343 if (ref_ali.size() != target_ali.size()) {
345 <<
"the size of the reference alignment (" << ref_ali.size()
346 <<
") is different from the one of the target (" << target_ali.size()
347 <<
")! You are probably trying to compare different underlying geometries. Exiting";
353 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml" 354 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
358 for (
const auto &ali : ref_ali) {
359 auto mydetid = ali.rawId();
362 <<
"Encountered invalid Tracker DetId:" <<
DetId(mydetid).
rawId() <<
" (" <<
DetId(mydetid).
det()
364 <<
"); subdetId " <<
DetId(mydetid).
subdetId() <<
" - terminating ";
369 TCanvas
canvas(
"Alignment Comparison",
"Alignment Comparison", 1800, 1200);
372 std::unordered_map<AlignmentPI::coordinate, std::unique_ptr<TH1F> > diffs;
380 for (
const auto &coord : coords) {
385 diffs[coord] = std::make_unique<TH1F>(Form(
"hDiff_%s", s_coord.c_str()),
386 Form(
";#Delta%s %s;n. of modules", s_coord.c_str(),
unit.c_str()),
392 int loopedComponents(0);
393 for (
unsigned int i = 0;
i < ref_ali.size();
i++) {
394 if (ref_ali[
i].rawId() == target_ali[
i].rawId()) {
401 CLHEP::HepRotation target_rot(target_ali[
i].
rotation());
402 CLHEP::HepRotation ref_rot(ref_ali[
i].
rotation());
427 for (
const auto &coord : coords) {
430 diffs[coord]->Fill((target_ali[
i].translation().
x() - ref_ali[
i].translation().
x()) *
434 diffs[coord]->Fill((target_ali[
i].translation().
y() - ref_ali[
i].translation().
y()) *
438 diffs[coord]->Fill((target_ali[
i].translation().
z() - ref_ali[
i].translation().
z()) *
442 diffs[coord]->Fill((target_eulerAngles[0] - ref_eulerAngles[0]) * 1000.);
445 diffs[coord]->Fill((target_eulerAngles[1] - ref_eulerAngles[1]) * 1000.);
448 diffs[coord]->Fill((target_eulerAngles[2] - ref_eulerAngles[2]) * 1000.);
451 edm::LogError(
"TrackerAlignment_PayloadInspector") <<
"Unrecognized coordinate " << coord << std::endl;
460 auto legend = std::make_unique<TLegend>(0.14, 0.93, 0.55, 0.98);
465 legend->SetTextSize(0.03);
467 for (
const auto &coord : coords) {
468 canvas.cd(c_index)->SetLogy();
469 canvas.cd(c_index)->SetTopMargin(0.02);
470 canvas.cd(c_index)->SetBottomMargin(0.15);
471 canvas.cd(c_index)->SetLeftMargin(0.14);
472 canvas.cd(c_index)->SetRightMargin(0.04);
473 diffs[coord]->SetLineWidth(2);
481 int i_max = diffs[coord]->FindLastBinAbove(0.);
482 int i_min = diffs[coord]->FindFirstBinAbove(0.);
483 diffs[coord]->GetXaxis()->SetRange(
std::max(1, i_min - 10),
std::min(i_max + 10, diffs[coord]->GetNbinsX()));
484 diffs[coord]->Draw(
"HIST");
499 typedef TrackerAlignmentSummary<AlignmentPI::BPix> TrackerAlignmentSummaryBPix;
500 typedef TrackerAlignmentSummary<AlignmentPI::FPix> TrackerAlignmentSummaryFPix;
501 typedef TrackerAlignmentSummary<AlignmentPI::TIB> TrackerAlignmentSummaryTIB;
503 typedef TrackerAlignmentSummary<AlignmentPI::TID> TrackerAlignmentSummaryTID;
504 typedef TrackerAlignmentSummary<AlignmentPI::TOB> TrackerAlignmentSummaryTOB;
505 typedef TrackerAlignmentSummary<AlignmentPI::TEC> TrackerAlignmentSummaryTEC;
511 template <AlignmentPI::coordinate coord>
512 class BPixBarycenterHistory :
public HistoryPlot<Alignments, float> {
514 BPixBarycenterHistory()
518 ~BPixBarycenterHistory()
override =
default;
521 std::vector<AlignTransform> alignments =
payload.m_align;
523 float barycenter = 0.;
525 for (
const auto &ali : alignments) {
528 <<
"Encountered invalid Tracker DetId:" << ali.rawId() <<
" " <<
DetId(ali.rawId()).det()
533 int subid =
DetId(ali.rawId()).subdetId();
540 barycenter += (ali.translation().x());
543 barycenter += (ali.translation().y());
546 barycenter += (ali.translation().z());
549 edm::LogError(
"TrackerAlignment_PayloadInspector") <<
"Unrecognized coordinate " << coord << std::endl;
554 edm::LogInfo(
"TrackerAlignment_PayloadInspector") <<
"barycenter (" << barycenter <<
")/n. modules (" << nmodules
555 <<
") = " << barycenter / nmodules << std::endl;
558 barycenter /= nmodules;
561 barycenter += hardcodeGPR.at(coord);
568 typedef BPixBarycenterHistory<AlignmentPI::t_x> X_BPixBarycenterHistory;
569 typedef BPixBarycenterHistory<AlignmentPI::t_y> Y_BPixBarycenterHistory;
570 typedef BPixBarycenterHistory<AlignmentPI::t_z> Z_BPixBarycenterHistory;
575 class TrackerAlignmentBarycenters :
public PlotImage<Alignments, SINGLE_IOV> {
579 bool fill()
override {
580 auto tag = PlotBase::getTag<0>();
581 auto iov =
tag.iovs.front();
582 std::shared_ptr<Alignments>
payload = fetchPayload(std::get<1>(iov));
583 unsigned int run = std::get<0>(iov);
585 TCanvas
canvas(
"Tracker Alignment Barycenter Summary",
"Tracker Alignment Barycenter summary", 1600, 1000);
588 canvas.SetTopMargin(0.07);
589 canvas.SetBottomMargin(0.06);
590 canvas.SetLeftMargin(0.15);
591 canvas.SetRightMargin(0.03);
595 auto h2_BarycenterParameters =
596 std::make_unique<TH2F>(
"Parameters",
"SubDetector Barycenter summary", 6, 0.0, 6.0, 6, 0, 6.);
598 auto h2_uncBarycenterParameters =
599 std::make_unique<TH2F>(
"Parameters2",
"SubDetector Barycenter summary", 6, 0.0, 6.0, 6, 0, 6.);
601 h2_BarycenterParameters->SetStats(
false);
602 h2_BarycenterParameters->SetTitle(
nullptr);
603 h2_uncBarycenterParameters->SetStats(
false);
604 h2_uncBarycenterParameters->SetTitle(
nullptr);
606 std::vector<AlignTransform> alignments =
payload->m_align;
611 const char *path_toTopologyXML = isPhase0 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml" 612 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
622 auto Xbarycenters = barycenters.
getX();
623 auto Ybarycenters = barycenters.
getY();
624 auto Zbarycenters = barycenters.
getZ();
629 auto c_Xbarycenters = barycenters.
getX();
630 auto c_Ybarycenters = barycenters.
getY();
631 auto c_Zbarycenters = barycenters.
getZ();
633 h2_BarycenterParameters->GetXaxis()->SetBinLabel(1,
"X [cm]");
634 h2_BarycenterParameters->GetXaxis()->SetBinLabel(2,
"Y [cm]");
635 h2_BarycenterParameters->GetXaxis()->SetBinLabel(3,
"Z [cm]");
636 h2_BarycenterParameters->GetXaxis()->SetBinLabel(4,
"X_{no GPR} [cm]");
637 h2_BarycenterParameters->GetXaxis()->SetBinLabel(5,
"Y_{no GPR} [cm]");
638 h2_BarycenterParameters->GetXaxis()->SetBinLabel(6,
"Z_{no GPR} [cm]");
640 bool isLikelyMC(
false);
642 std::count_if(Xbarycenters.begin(), Xbarycenters.begin() + 2, [](
float a) {
return (
std::abs(
a) >= 1.e-4); });
644 std::count_if(Ybarycenters.begin(), Ybarycenters.begin() + 2, [](
float a) {
return (
std::abs(
a) >= 1.e-4); });
646 std::count_if(Zbarycenters.begin(), Zbarycenters.begin() + 2, [](
float a) {
return (
std::abs(
a) >= 1.e-4); });
650 if ((checkX + checkY + checkZ) == 0 &&
run == 1)
653 unsigned int yBin = 6;
654 for (
unsigned int i = 0;
i < 6;
i++) {
657 h2_BarycenterParameters->GetYaxis()->SetBinLabel(
yBin, theLabel.c_str());
659 h2_BarycenterParameters->SetBinContent(1,
yBin, c_Xbarycenters[
i]);
660 h2_BarycenterParameters->SetBinContent(2,
yBin, c_Ybarycenters[
i]);
661 h2_BarycenterParameters->SetBinContent(3,
yBin, c_Zbarycenters[
i]);
664 h2_uncBarycenterParameters->SetBinContent(4,
yBin, Xbarycenters[
i]);
665 h2_uncBarycenterParameters->SetBinContent(5,
yBin, Ybarycenters[
i]);
666 h2_uncBarycenterParameters->SetBinContent(6,
yBin, Zbarycenters[
i]);
670 h2_BarycenterParameters->GetXaxis()->LabelsOption(
"h");
671 h2_BarycenterParameters->GetYaxis()->SetLabelSize(0.05);
672 h2_BarycenterParameters->GetXaxis()->SetLabelSize(0.05);
673 h2_BarycenterParameters->SetMarkerSize(1.5);
674 h2_BarycenterParameters->Draw(
"TEXT");
676 h2_uncBarycenterParameters->SetMarkerSize(1.5);
677 h2_uncBarycenterParameters->SetMarkerColor(kRed);
678 h2_uncBarycenterParameters->Draw(
"TEXTsame");
683 t1.SetTextSize(0.05);
684 t1.DrawLatex(0.5, 0.96, Form(
"Tracker Alignment Barycenters, IOV %i",
run));
685 t1.SetTextSize(0.025);
700 template <
int ntags, IOVMultiplicity nIOVs>
701 class TrackerAlignmentBarycentersComparatorBase :
public PlotImage<Alignments, nIOVs, ntags> {
703 TrackerAlignmentBarycentersComparatorBase()
706 bool fill()
override {
708 auto theIOVs = PlotBase::getTag<0>().iovs;
709 auto tagname1 = PlotBase::getTag<0>().
name;
711 auto firstiov = theIOVs.front();
712 std::tuple<cond::Time_t, cond::Hash> lastiov;
715 assert(this->m_plotAnnotations.ntags < 3);
717 if (this->m_plotAnnotations.ntags == 2) {
718 auto tag2iovs = PlotBase::getTag<1>().iovs;
719 tagname2 = PlotBase::getTag<1>().
name;
720 lastiov = tag2iovs.front();
722 lastiov = theIOVs.back();
725 unsigned int first_run = std::get<0>(firstiov);
726 unsigned int last_run = std::get<0>(lastiov);
728 std::shared_ptr<Alignments> last_payload = this->fetchPayload(std::get<1>(lastiov));
729 std::vector<AlignTransform> last_alignments = last_payload->m_align;
731 std::shared_ptr<Alignments> first_payload = this->fetchPayload(std::get<1>(firstiov));
732 std::vector<AlignTransform> first_alignments = first_payload->m_align;
738 const char *path_toTopologyXML = isInitialPhase0 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml" 739 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
744 path_toTopologyXML = isFinalPhase0 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml" 745 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
750 TCanvas
canvas(
"Tracker Alignment Barycenter Summary",
"Tracker Alignment Barycenter summary", 1200, 800);
753 canvas.SetTopMargin(0.07);
754 canvas.SetBottomMargin(0.06);
755 canvas.SetLeftMargin(0.15);
756 canvas.SetRightMargin(0.03);
760 auto h2_BarycenterDiff =
761 std::make_unique<TH2F>(
"Parameters diff",
"SubDetector Barycenter Difference", 3, 0.0, 3.0, 6, 0, 6.);
763 h2_BarycenterDiff->SetStats(
false);
764 h2_BarycenterDiff->SetTitle(
nullptr);
765 h2_BarycenterDiff->GetXaxis()->SetBinLabel(1,
"X [#mum]");
766 h2_BarycenterDiff->GetXaxis()->SetBinLabel(2,
"Y [#mum]");
767 h2_BarycenterDiff->GetXaxis()->SetBinLabel(3,
"Z [#mum]");
775 unsigned int yBin = 6;
776 for (
unsigned int i = 0;
i < 6;
i++) {
779 h2_BarycenterDiff->GetYaxis()->SetBinLabel(
yBin, theLabel.c_str());
780 h2_BarycenterDiff->SetBinContent(
782 h2_BarycenterDiff->SetBinContent(
784 h2_BarycenterDiff->SetBinContent(
789 h2_BarycenterDiff->GetXaxis()->LabelsOption(
"h");
790 h2_BarycenterDiff->GetYaxis()->SetLabelSize(0.05);
791 h2_BarycenterDiff->GetXaxis()->SetLabelSize(0.05);
792 h2_BarycenterDiff->SetMarkerSize(1.5);
793 h2_BarycenterDiff->SetMarkerColor(kRed);
794 h2_BarycenterDiff->Draw(
"TEXT");
799 t1.SetTextSize(0.05);
800 t1.DrawLatex(0.5, 0.96, Form(
"Tracker Alignment Barycenters Diff, IOV %i - IOV %i",
last_run,
first_run));
801 t1.SetTextSize(0.025);
810 bool isInitialPhase0;
814 using TrackerAlignmentBarycentersCompare = TrackerAlignmentBarycentersComparatorBase<1, MULTI_IOV>;
815 using TrackerAlignmentBarycentersCompareTwoTags = TrackerAlignmentBarycentersComparatorBase<2, SINGLE_IOV>;
820 template <
int ntags, IOVMultiplicity nIOVs>
821 class PixelBarycentersComparatorBase :
public PlotImage<Alignments, nIOVs, ntags> {
823 PixelBarycentersComparatorBase() :
PlotImage<
Alignments, nIOVs, ntags>(
"Comparison of Pixel Barycenters") {}
825 bool fill()
override {
827 auto theIOVs = PlotBase::getTag<0>().iovs;
828 auto tagname1 = PlotBase::getTag<0>().
name;
830 auto firstiov = theIOVs.front();
831 std::tuple<cond::Time_t, cond::Hash> lastiov;
834 assert(this->m_plotAnnotations.ntags < 3);
836 if (this->m_plotAnnotations.ntags == 2) {
837 auto tag2iovs = PlotBase::getTag<1>().iovs;
838 tagname2 = PlotBase::getTag<1>().
name;
839 lastiov = tag2iovs.front();
841 lastiov = theIOVs.back();
844 unsigned int first_run = std::get<0>(firstiov);
845 unsigned int last_run = std::get<0>(lastiov);
847 std::shared_ptr<Alignments> last_payload = this->fetchPayload(std::get<1>(lastiov));
848 std::vector<AlignTransform> last_alignments = last_payload->m_align;
850 std::shared_ptr<Alignments> first_payload = this->fetchPayload(std::get<1>(firstiov));
851 std::vector<AlignTransform> first_alignments = first_payload->m_align;
853 TCanvas
canvas(
"Pixel Barycenter Summary",
"Pixel Barycenter summary", 1200, 1200);
860 t1.SetTextSize(0.03);
866 t1.SetTextSize(0.025);
868 for (
unsigned int c = 1;
c <= 4;
c++) {
869 canvas.cd(
c)->SetTopMargin(0.07);
870 canvas.cd(
c)->SetBottomMargin(0.12);
871 canvas.cd(
c)->SetLeftMargin(0.15);
872 canvas.cd(
c)->SetRightMargin(0.03);
877 std::array<std::string, 3> structures = {{
"FPIX-",
"BPIX",
"FPIX+"}};
878 std::array<std::unique_ptr<TH2F>, 3>
histos;
884 const char *path_toTopologyXML = isInitialPhase0 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml" 885 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
895 path_toTopologyXML = isFinalPhase0 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml" 896 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
906 if (isFinalPhase0 != isInitialPhase0) {
908 <<
"the size of the reference alignment (" << first_alignments.size()
909 <<
") is different from the one of the target (" << last_alignments.size()
910 <<
")! You are probably trying to compare different underlying geometries.";
913 unsigned int index(0);
914 for (
const auto &piece : structures) {
915 const char *
name = piece.c_str();
918 Form(
"%s x-y Barycenter Difference;x_{%s}-x_{TOB} [mm];y_{%s}-y_{TOB} [mm]",
name,
name,
name),
938 auto h2_ZBarycenterDiff = std::make_unique<TH2F>(
939 "Pixel_z_diff",
"Pixel z-Barycenter Difference;; z_{Pixel-Ideal} -z_{TOB} [mm]", 3, -0.5, 2.5, 100, -10., 10.);
940 h2_ZBarycenterDiff->SetStats(
false);
941 h2_ZBarycenterDiff->SetTitle(
nullptr);
942 h2_ZBarycenterDiff->GetXaxis()->SetBinLabel(1,
"FPIX -");
943 h2_ZBarycenterDiff->GetXaxis()->SetBinLabel(2,
"BPIX");
944 h2_ZBarycenterDiff->GetXaxis()->SetBinLabel(3,
"FPIX +");
945 h2_ZBarycenterDiff->GetYaxis()->SetLabelSize(0.05);
946 h2_ZBarycenterDiff->GetXaxis()->SetLabelSize(0.07);
947 h2_ZBarycenterDiff->GetYaxis()->SetTitleSize(0.06);
948 h2_ZBarycenterDiff->GetXaxis()->SetTitleSize(0.06);
949 h2_ZBarycenterDiff->GetYaxis()->CenterTitle();
950 h2_ZBarycenterDiff->GetXaxis()->CenterTitle();
951 h2_ZBarycenterDiff->GetYaxis()->SetTitleOffset(1.1);
953 std::function<GlobalPoint(int)> cutFunctorInitial = [&myInitialBarycenters](
int index) {
966 std::function<GlobalPoint(int)> cutFunctorFinal = [&myFinalBarycenters](
int index) {
979 float x0i, x0f, y0i, y0f;
982 t1.SetTextSize(0.047);
983 for (
unsigned int c = 1;
c <= 3;
c++) {
984 x0i = cutFunctorInitial(
c).x() * 10;
985 x0f = cutFunctorFinal(
c).x() * 10;
986 y0i = cutFunctorInitial(
c).y() * 10;
987 y0f = cutFunctorFinal(
c).y() * 10;
992 COUT <<
"initial x,y " << std::left << std::setw(7) << structures[
c - 1] <<
" (" << x0i <<
"," << y0i <<
") mm" 994 COUT <<
"final x,y " << std::left << std::setw(7) << structures[
c - 1] <<
" (" << x0f <<
"," << y0f <<
") mm" 997 TMarker *initial =
new TMarker(x0i, y0i, 21);
998 TMarker *
final =
new TMarker(x0f, y0f, 20);
1000 initial->SetMarkerColor(kRed);
1001 final->SetMarkerColor(kBlue);
1002 initial->SetMarkerSize(2.5);
1003 final->SetMarkerSize(2.5);
1004 t1.SetTextColor(kRed);
1006 t1.DrawLatex(x0i, y0i + (y0i > y0f ? 0.3 : -0.5), Form(
"(%.2f,%.2f)", x0i, y0i));
1007 final->Draw(
"same");
1008 t1.SetTextColor(kBlue);
1009 t1.DrawLatex(x0f, y0f + (y0i > y0f ? -0.5 : 0.3), Form(
"(%.2f,%.2f)", x0f, y0f));
1014 h2_ZBarycenterDiff->Draw();
1019 std::array<double, 3> hardcodeIdealZPhase0 = {{-41.94909, 0., 41.94909}};
1020 std::array<double, 3> hardcodeIdealZPhase1 = {{-39.82911, 0., 39.82911}};
1022 for (
unsigned int c = 1;
c <= 3;
c++) {
1026 (cutFunctorInitial(
c).z() - (isInitialPhase0 ? hardcodeIdealZPhase0[
c - 1] : hardcodeIdealZPhase1[
c - 1])) *
1029 (cutFunctorFinal(
c).z() - (isFinalPhase0 ? hardcodeIdealZPhase0[
c - 1] : hardcodeIdealZPhase1[
c - 1])) * 10;
1031 TMarker *initial =
new TMarker(
c - 1, z0i, 21);
1032 TMarker *
final =
new TMarker(
c - 1, z0f, 20);
1034 COUT <<
"initial z " << std::left << std::setw(7) << structures[
c - 1] <<
" " << z0i <<
" mm" << std::endl;
1035 COUT <<
"final z " << std::left << std::setw(7) << structures[
c - 1] <<
" " << z0f <<
" mm" << std::endl;
1037 initial->SetMarkerColor(kRed);
1038 final->SetMarkerColor(kBlue);
1039 initial->SetMarkerSize(2.5);
1040 final->SetMarkerSize(2.5);
1042 t1.SetTextColor(kRed);
1043 t1.DrawLatex(
c - 1, z0i + (z0i > z0f ? 1. : -1.5), Form(
"(%.2f)", z0i));
1044 final->Draw(
"same");
1045 t1.SetTextColor(kBlue);
1046 t1.DrawLatex(
c - 1, z0f + (z0i > z0f ? -1.5 : 1), Form(
"(%.2f)", z0f));
1056 bool isInitialPhase0;
1060 using PixelBarycentersCompare = PixelBarycentersComparatorBase<1, MULTI_IOV>;
1061 using PixelBarycentersCompareTwoTags = PixelBarycentersComparatorBase<2, SINGLE_IOV>;
const std::array< double, 6 > getY()
bool tidIsDoubleSide(const DetId &id) const
void makeNicePlotStyle(TH1 *hist, int color)
void computeBarycenters(const std::vector< AlignTransform > &input, const TrackerTopology &tTopo, const std::map< AlignmentPI::coordinate, float > &GPR)
Global3DPoint GlobalPoint
std::string getStringFromPart(AlignmentPI::partitions i)
std::string to_string(const V &value)
Log< level::Error, false > LogError
constexpr Detector det() const
get the detector field from this detid
static const float cmToUm
void makeNiceStats(TH1F *hist, AlignmentPI::partitions part, int color)
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
const std::array< double, 6 > getX()
static const unsigned int phase0size
Abs< T >::type abs(const T &t)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
Basic3DVector unit() const
Log< level::Info, false > LogInfo
GlobalPoint getPartitionAvg(AlignmentPI::PARTITION p)
AlgebraicVector EulerAngles
constexpr uint32_t rawId() const
get the raw id
std::string getStringFromCoordinate(AlignmentPI::coordinate coord)
std::pair< double, double > calculatePosition(TVirtualPad *myPad, int boundary)
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)
Log< level::Warning, false > LogWarning
const std::array< double, 6 > getZ()