21 #include "CLHEP/Vector/RotationInterfaces.h" 33 #include <boost/range/adaptor/indexed.hpp> 49 #include "TPaveStats.h" 64 const std::map<AlignmentPI::coordinate, float> hardcodeGPR = {
74 template <
int ntags, IOVMultiplicity nIOVs, RegionCategory cat>
75 class TrackerAlignmentCompareAll :
public PlotImage<Alignments, nIOVs, ntags> {
77 TrackerAlignmentCompareAll()
78 :
PlotImage<
Alignments, nIOVs, ntags>(
"comparison of all coordinates between two geometries") {}
80 bool fill()
override {
81 TGaxis::SetExponentOffset(-0.12, 0.01,
"y");
84 auto theIOVs = PlotBase::getTag<0>().iovs;
85 auto tagname1 = PlotBase::getTag<0>().
name;
87 auto firstiov = theIOVs.front();
88 std::tuple<cond::Time_t, cond::Hash> lastiov;
91 assert(this->m_plotAnnotations.ntags < 3);
93 if (this->m_plotAnnotations.ntags == 2) {
94 auto tag2iovs = PlotBase::getTag<1>().iovs;
95 tagname2 = PlotBase::getTag<1>().
name;
96 lastiov = tag2iovs.front();
98 lastiov = theIOVs.back();
101 std::shared_ptr<Alignments> last_payload = this->fetchPayload(std::get<1>(lastiov));
102 std::shared_ptr<Alignments> first_payload = this->fetchPayload(std::get<1>(firstiov));
107 std::vector<AlignTransform> ref_ali = first_payload->m_align;
108 std::vector<AlignTransform> target_ali = last_payload->m_align;
113 const char *path_toTopologyXML =
nullptr;
117 <<
"Both reference and target alignments are reordered. Using the trackerParameters for the Reordered " 119 path_toTopologyXML =
"Geometry/TrackerCommonData/data/PhaseII/TFPXTEPXReordered/trackerParameters.xml";
122 <<
"Neither reference nor target alignments are reordered. Using the standard trackerParameters.";
123 path_toTopologyXML =
"Geometry/TrackerCommonData/data/PhaseII/trackerParameters.xml";
128 <<
"Mismatched alignments detected. One is reordered while the other is not. Unable to proceed.";
132 <<
"Mismatched inner tracks alignments detected. One is reordered while the other is not. Ignoring as " 133 "OT only comparison requested.";
134 path_toTopologyXML =
"Geometry/TrackerCommonData/data/PhaseII/trackerParameters.xml";
139 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml" 140 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
145 ref_ali.erase(std::remove_if(ref_ali.begin(),
149 return (
cat == RegionCategory::INNER) ? (subid > 2) : (subid <= 2);
153 target_ali.erase(std::remove_if(target_ali.begin(),
157 return (
cat == RegionCategory::INNER) ? (subid > 2) : (subid <= 2);
161 TCanvas
canvas(
"Alignment Comparison",
"Alignment Comparison", 2000, 1200);
164 if (ref_ali.size() != target_ali.size()) {
166 <<
"the size of the reference alignment (" << ref_ali.size()
167 <<
") is different from the one of the target (" << target_ali.size()
168 <<
")! You are probably trying to compare different underlying geometries. Exiting";
175 for (
const auto &ali : ref_ali) {
176 auto mydetid = ali.rawId();
179 <<
"Encountered invalid Tracker DetId:" <<
DetId(mydetid).
rawId() <<
" (" <<
DetId(mydetid).
det()
181 <<
"); subdetId " <<
DetId(mydetid).
subdetId() <<
" - terminating ";
193 std::unordered_map<AlignmentPI::coordinate, std::unique_ptr<TH1F>> diffs;
196 for (
const auto &coord : coords) {
201 diffs[coord] = std::make_unique<TH1F>(Form(
"comparison_%s", s_coord.c_str()),
202 Form(
";Detector Id index; #Delta%s %s", s_coord.c_str(),
unit.c_str()),
205 ref_ali.size() - 0.5);
209 std::map<int, AlignmentPI::partitions> boundaries;
210 if (
cat < RegionCategory::OUTER) {
215 unsigned int subpad{1};
216 TLegend
legend = TLegend(0.17, 0.84, 0.95, 0.94);
217 legend.SetTextSize(0.023);
218 for (
const auto &coord : coords) {
220 canvas.cd(subpad)->SetTopMargin(0.06);
221 canvas.cd(subpad)->SetLeftMargin(0.17);
222 canvas.cd(subpad)->SetRightMargin(0.05);
223 canvas.cd(subpad)->SetBottomMargin(0.15);
225 auto max = diffs[coord]->GetMaximum();
226 auto min = diffs[coord]->GetMinimum();
232 diffs[coord]->GetYaxis()->SetRangeUser(-
range * 1.5,
range * 1.5);
233 diffs[coord]->GetYaxis()->SetTitleOffset(1.5);
234 diffs[coord]->SetMarkerStyle(20);
235 diffs[coord]->SetMarkerSize(0.5);
236 diffs[coord]->Draw(
"P");
239 if (this->m_plotAnnotations.ntags == 2) {
240 legend.SetHeader(
"#bf{Two Tags Comparison}",
"C");
243 (
"#splitline{" + tagname1 +
" : " + firstIOVsince +
"}{" + tagname2 +
" : " + lastIOVsince +
"}")
247 legend.SetHeader((
"tag: #bf{" + tagname1 +
"}").c_str(),
"C");
248 legend.AddEntry(diffs[coord].
get(),
249 (
"#splitline{IOV since: " + firstIOVsince +
"}{IOV since: " + lastIOVsince +
"}").c_str(),
260 bool doOnlyPixel = (
cat == RegionCategory::INNER);
262 TLine
l[6][boundaries.size()];
264 for (
unsigned int i = 0;
i < 6;
i++) {
265 tSubdet[
i].SetTextColor(kRed);
267 tSubdet[
i].SetTextAlign(21);
268 tSubdet[
i].SetTextSize(doOnlyPixel ? 0.05 : 0.03);
269 tSubdet[
i].SetTextAngle(90);
273 for (
const auto &coord : coords) {
276 for (
const auto &
line : boundaries | boost::adaptors::indexed(0)) {
279 l[subpad][
index] = TLine(diffs[coord]->GetBinLowEdge(
value.first),
280 canvas.cd(subpad + 1)->GetUymin(),
281 diffs[coord]->GetBinLowEdge(
value.first),
282 canvas.cd(subpad + 1)->GetUymax() * 0.84);
283 l[subpad][
index].SetLineWidth(1);
284 l[subpad][
index].SetLineStyle(9);
285 l[subpad][
index].SetLineColor(2);
286 l[subpad][
index].Draw(
"same");
289 for (
const auto &elem : boundaries | boost::adaptors::indexed(0)) {
290 const auto &lm =
canvas.cd(subpad + 1)->GetLeftMargin();
291 const auto &
rm = 1 -
canvas.cd(subpad + 1)->GetRightMargin();
292 const auto &
frac =
float(elem.value().first) / ref_ali.size();
294 LogDebug(
"TrackerAlignmentCompareAll")
295 << __PRETTY_FUNCTION__ <<
" left margin: " << lm <<
" right margin: " <<
rm <<
" fraction: " <<
frac;
297 float theX_ = lm + (
rm - lm) *
frac + ((elem.index() > 0 || doOnlyPixel) ? 0.025 : 0.01);
299 tSubdet[subpad].DrawLatex(
305 ltx.SetTextSize(0.042);
306 ltx.SetTextAlign(11);
307 ltx.DrawLatexNDC(
canvas.cd(subpad + 1)->GetLeftMargin(),
308 1 -
canvas.cd(subpad + 1)->GetTopMargin() + 0.01,
309 (
"Tracker Alignment Compare : #color[4]{" + s_coord +
"}").c_str());
322 typedef TrackerAlignmentCompareAll<1, MULTI_IOV, RegionCategory::ALL> TrackerAlignmentComparatorSingleTag;
323 typedef TrackerAlignmentCompareAll<2, SINGLE_IOV, RegionCategory::ALL> TrackerAlignmentComparatorTwoTags;
325 typedef TrackerAlignmentCompareAll<1, MULTI_IOV, RegionCategory::INNER> PixelAlignmentComparatorSingleTag;
326 typedef TrackerAlignmentCompareAll<2, SINGLE_IOV, RegionCategory::INNER> PixelAlignmentComparatorTwoTags;
328 typedef TrackerAlignmentCompareAll<1, MULTI_IOV, RegionCategory::OUTER> OTAlignmentComparatorSingleTag;
329 typedef TrackerAlignmentCompareAll<2, SINGLE_IOV, RegionCategory::OUTER> OTAlignmentComparatorTwoTags;
336 template <
int ntags, IOVMultiplicity nIOVs, RegionCategory cat>
337 class TrackerAlignmentCompareCylindricalBase :
public PlotImage<Alignments, nIOVs, ntags> {
345 TrackerAlignmentCompareCylindricalBase()
346 :
PlotImage<
Alignments, nIOVs, ntags>(
"comparison of cylindrical coordinates between two geometries") {}
348 bool fill()
override {
349 TGaxis::SetExponentOffset(-0.12, 0.01,
"y");
352 auto theIOVs = PlotBase::getTag<0>().iovs;
353 auto tagname1 = PlotBase::getTag<0>().
name;
355 auto firstiov = theIOVs.front();
356 std::tuple<cond::Time_t, cond::Hash> lastiov;
359 assert(this->m_plotAnnotations.ntags < 3);
361 if (this->m_plotAnnotations.ntags == 2) {
362 auto tag2iovs = PlotBase::getTag<1>().iovs;
363 tagname2 = PlotBase::getTag<1>().
name;
364 lastiov = tag2iovs.front();
366 lastiov = theIOVs.back();
369 std::shared_ptr<Alignments> last_payload = this->fetchPayload(std::get<1>(lastiov));
370 std::shared_ptr<Alignments> first_payload = this->fetchPayload(std::get<1>(firstiov));
375 std::vector<AlignTransform> ref_ali = first_payload->m_align;
376 std::vector<AlignTransform> target_ali = last_payload->m_align;
378 TCanvas
canvas(
"Alignment Comparison",
"", 2000, 600);
383 const std::vector<coordinate> coords = {t_r, t_phi,
t_z};
384 std::unordered_map<coordinate, std::unique_ptr<TH1F>> diffs;
388 ref_ali.erase(std::remove_if(ref_ali.begin(),
392 return (
cat == RegionCategory::INNER) ? (subid > 2) : (subid <= 2);
396 target_ali.erase(std::remove_if(target_ali.begin(),
400 return (
cat == RegionCategory::INNER) ? (subid > 2) : (subid <= 2);
405 auto h_deltaR = std::make_unique<TH1F>(
406 "deltaR", Form(
";Detector Id index; #DeltaR [#mum]"), ref_ali.size(), -0.5, ref_ali.size() - 0.5);
407 auto h_deltaPhi = std::make_unique<TH1F>(
408 "deltaPhi", Form(
";Detector Id index; #Delta#phi [mrad]"), ref_ali.size(), -0.5, ref_ali.size() - 0.5);
409 auto h_deltaZ = std::make_unique<TH1F>(
410 "deltaZ", Form(
";Detector Id index; #DeltaZ [#mum]"), ref_ali.size(), -0.5, ref_ali.size() - 0.5);
412 std::map<int, AlignmentPI::partitions> boundaries;
413 if (
cat < RegionCategory::OUTER) {
419 for (
unsigned int i = 0;
i < ref_ali.size();
i++) {
420 if (ref_ali[
i].
rawId() == target_ali[
i].rawId()) {
425 if (thePart != currentPart) {
426 currentPart = thePart;
427 boundaries.insert({
counter, thePart});
430 const auto &deltaTrans = target_ali[
i].translation() - ref_ali[
i].translation();
431 double dPhi = target_ali[
i].translation().phi() - ref_ali[
i].translation().phi();
449 unsigned int subpad{1};
450 TLegend
legend = TLegend(0.17, 0.84, 0.95, 0.94);
451 legend.SetTextSize(0.023);
452 for (
const auto &coord : coords) {
454 canvas.cd(subpad)->SetTopMargin(0.06);
455 canvas.cd(subpad)->SetLeftMargin(0.17);
456 canvas.cd(subpad)->SetRightMargin(0.05);
457 canvas.cd(subpad)->SetBottomMargin(0.15);
459 auto max = diffs[coord]->GetMaximum();
460 auto min = diffs[coord]->GetMinimum();
468 diffs[coord]->GetYaxis()->SetRangeUser(-
range * 1.5,
range * 1.5);
470 diffs[coord]->GetYaxis()->SetRangeUser(0.,
range * 1.5);
473 diffs[coord]->GetYaxis()->SetTitleOffset(1.5);
474 diffs[coord]->SetMarkerStyle(20);
475 diffs[coord]->SetMarkerSize(0.5);
476 diffs[coord]->Draw(
"P");
479 if (this->m_plotAnnotations.ntags == 2) {
480 legend.SetHeader(
"#bf{Two Tags Comparison}",
"C");
483 (
"#splitline{" + tagname1 +
" : " + firstIOVsince +
"}{" + tagname2 +
" : " + lastIOVsince +
"}")
487 legend.SetHeader((
"tag: #bf{" + tagname1 +
"}").c_str(),
"C");
488 legend.AddEntry(diffs[coord].
get(),
489 (
"#splitline{IOV since: " + firstIOVsince +
"}{IOV since: " + lastIOVsince +
"}").c_str(),
500 bool doOnlyPixel = (
cat == RegionCategory::INNER);
502 TLine
l[6][boundaries.size()];
504 for (
unsigned int i = 0;
i < 6;
i++) {
505 tSubdet[
i].SetTextColor(kRed);
507 tSubdet[
i].SetTextAlign(21);
508 tSubdet[
i].SetTextSize(doOnlyPixel ? 0.05 : 0.03);
509 tSubdet[
i].SetTextAngle(90);
513 for (
const auto &coord : coords) {
516 for (
const auto &
line : boundaries | boost::adaptors::indexed(0)) {
519 l[subpad][
index] = TLine(diffs[coord]->GetBinLowEdge(
value.first),
520 canvas.cd(subpad + 1)->GetUymin(),
521 diffs[coord]->GetBinLowEdge(
value.first),
522 canvas.cd(subpad + 1)->GetUymax() * 0.84);
523 l[subpad][
index].SetLineWidth(1);
524 l[subpad][
index].SetLineStyle(9);
525 l[subpad][
index].SetLineColor(2);
526 l[subpad][
index].Draw(
"same");
529 for (
const auto &elem : boundaries | boost::adaptors::indexed(0)) {
530 const auto &lm =
canvas.cd(subpad + 1)->GetLeftMargin();
531 const auto &
rm = 1 -
canvas.cd(subpad + 1)->GetRightMargin();
532 const auto &
frac =
float(elem.value().first) / ref_ali.size();
534 LogDebug(
"TrackerAlignmentCompareCylindricalBase")
535 << __PRETTY_FUNCTION__ <<
" left margin: " << lm <<
" right margin: " <<
rm <<
" fraction: " <<
frac;
537 float theX_ = lm + (
rm - lm) *
frac + ((elem.index() > 0 || doOnlyPixel) ? 0.025 : 0.01);
539 tSubdet[subpad].DrawLatex(
545 ltx.SetTextSize(0.042);
546 ltx.SetTextAlign(11);
547 ltx.DrawLatexNDC(
canvas.cd(subpad + 1)->GetLeftMargin(),
548 1 -
canvas.cd(subpad + 1)->GetTopMargin() + 0.01,
549 (
"Tracker Alignment Compare : #color[4]{" + s_coord +
"}").c_str());
567 return "r-translation";
569 return "#phi-rotation";
571 return "z-translation";
573 return "should never be here!";
578 typedef TrackerAlignmentCompareCylindricalBase<1, MULTI_IOV, RegionCategory::ALL>
579 TrackerAlignmentCompareRPhiZSingleTag;
580 typedef TrackerAlignmentCompareCylindricalBase<2, SINGLE_IOV, RegionCategory::ALL> TrackerAlignmentCompareRPhiZTwoTags;
582 typedef TrackerAlignmentCompareCylindricalBase<1, MULTI_IOV, RegionCategory::INNER>
583 PixelAlignmentCompareRPhiZSingleTag;
584 typedef TrackerAlignmentCompareCylindricalBase<2, SINGLE_IOV, RegionCategory::INNER> PixelAlignmentCompareRPhiZTwoTags;
586 typedef TrackerAlignmentCompareCylindricalBase<1, MULTI_IOV, RegionCategory::OUTER> OTAlignmentCompareRPhiZSingleTag;
587 typedef TrackerAlignmentCompareCylindricalBase<2, SINGLE_IOV, RegionCategory::OUTER> OTAlignmentCompareRPhiZTwoTags;
594 template <AlignmentPI::coordinate coord,
int ntags, IOVMultiplicity nIOVs>
595 class TrackerAlignmentComparatorBase :
public PlotImage<Alignments, nIOVs, ntags> {
597 TrackerAlignmentComparatorBase()
599 " coordinate between two geometries") {}
601 bool fill()
override {
602 TGaxis::SetExponentOffset(-0.12, 0.01,
"y");
605 auto theIOVs = PlotBase::getTag<0>().iovs;
606 auto tagname1 = PlotBase::getTag<0>().
name;
608 auto firstiov = theIOVs.front();
609 std::tuple<cond::Time_t, cond::Hash> lastiov;
612 assert(this->m_plotAnnotations.ntags < 3);
614 if (this->m_plotAnnotations.ntags == 2) {
615 auto tag2iovs = PlotBase::getTag<1>().iovs;
616 tagname2 = PlotBase::getTag<1>().
name;
617 lastiov = tag2iovs.front();
619 lastiov = theIOVs.back();
622 std::shared_ptr<Alignments> last_payload = this->fetchPayload(std::get<1>(lastiov));
623 std::shared_ptr<Alignments> first_payload = this->fetchPayload(std::get<1>(firstiov));
628 std::vector<AlignTransform> ref_ali = first_payload->m_align;
629 std::vector<AlignTransform> target_ali = last_payload->m_align;
631 TCanvas
canvas(
"Alignment Comparison",
"Alignment Comparison", 1200, 1200);
633 if (ref_ali.size() != target_ali.size()) {
635 <<
"the size of the reference alignment (" << ref_ali.size()
636 <<
") is different from the one of the target (" << target_ali.size()
637 <<
")! You are probably trying to compare different underlying geometries. Exiting";
644 const char *path_toTopologyXML =
nullptr;
648 <<
"Both reference and target alignments are reordered. Using the trackerParameters for the Reordered " 650 path_toTopologyXML =
"Geometry/TrackerCommonData/data/PhaseII/TFPXTEPXReordered/trackerParameters.xml";
653 <<
"Neither reference nor target alignments are reordered. Using the standard trackerParameters.";
654 path_toTopologyXML =
"Geometry/TrackerCommonData/data/PhaseII/trackerParameters.xml";
658 <<
"Mismatched alignments detected. One is reordered while the other is not. Unable to proceed.";
663 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml" 664 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
670 for (
const auto &ali : ref_ali) {
671 auto mydetid = ali.rawId();
674 <<
"Encountered invalid Tracker DetId:" <<
DetId(mydetid).
rawId() <<
" (" <<
DetId(mydetid).
det()
676 <<
"); subdetId " <<
DetId(mydetid).
subdetId() <<
" - terminating ";
686 std::unique_ptr<TH1F>
compare =
687 std::make_unique<TH1F>(
"comparison",
688 Form(
";Detector Id index; #Delta%s %s", s_coord.c_str(),
unit.c_str()),
691 ref_ali.size() - 0.5);
694 std::map<int, AlignmentPI::partitions> boundaries;
700 canvas.SetTopMargin(0.06);
701 canvas.SetLeftMargin(0.17);
702 canvas.SetRightMargin(0.05);
703 canvas.SetBottomMargin(0.15);
713 compare->GetYaxis()->SetTitleOffset(1.5);
721 TLine
l[boundaries.size()];
722 for (
const auto &
line : boundaries | boost::adaptors::indexed(0)) {
737 tSubdet.SetTextAlign(21);
738 tSubdet.SetTextSize(0.027);
739 tSubdet.SetTextAngle(90);
741 for (
const auto &elem : boundaries) {
742 tSubdet.SetTextColor(kRed);
744 float theX_ = elem.first != 0 ? myPair.first + 0.025 : myPair.first + 0.01;
749 TLegend
legend = TLegend(0.17, 0.86, 0.95, 0.94);
750 if (this->m_plotAnnotations.ntags == 2) {
751 legend.SetHeader(
"#bf{Two Tags Comparison}",
"C");
754 (
"#splitline{" + tagname1 +
" : " + firstIOVsince +
"}{" + tagname2 +
" : " + lastIOVsince +
"}").c_str(),
757 legend.SetHeader((
"tag: #bf{" + tagname1 +
"}").c_str(),
"C");
759 (
"#splitline{IOV since: " + firstIOVsince +
"}{IOV since: " + lastIOVsince +
"}").c_str(),
762 legend.SetTextSize(0.020);
767 ltx.SetTextSize(0.042);
768 ltx.SetTextAlign(11);
769 ltx.DrawLatexNDC(gPad->GetLeftMargin(),
770 1 - gPad->GetTopMargin() + 0.01,
771 (
"Tracker Alignment Compare :#color[4]{" + s_coord +
"}").c_str());
780 template <AlignmentPI::coordinate coord>
781 using TrackerAlignmentCompare = TrackerAlignmentComparatorBase<coord, 1, MULTI_IOV>;
783 template <AlignmentPI::coordinate coord>
784 using TrackerAlignmentCompareTwoTags = TrackerAlignmentComparatorBase<coord, 2, SINGLE_IOV>;
786 typedef TrackerAlignmentCompare<AlignmentPI::t_x> TrackerAlignmentCompareX;
787 typedef TrackerAlignmentCompare<AlignmentPI::t_y> TrackerAlignmentCompareY;
788 typedef TrackerAlignmentCompare<AlignmentPI::t_z> TrackerAlignmentCompareZ;
790 typedef TrackerAlignmentCompare<AlignmentPI::rot_alpha> TrackerAlignmentCompareAlpha;
791 typedef TrackerAlignmentCompare<AlignmentPI::rot_beta> TrackerAlignmentCompareBeta;
792 typedef TrackerAlignmentCompare<AlignmentPI::rot_gamma> TrackerAlignmentCompareGamma;
794 typedef TrackerAlignmentCompareTwoTags<AlignmentPI::t_x> TrackerAlignmentCompareXTwoTags;
795 typedef TrackerAlignmentCompareTwoTags<AlignmentPI::t_y> TrackerAlignmentCompareYTwoTags;
796 typedef TrackerAlignmentCompareTwoTags<AlignmentPI::t_z> TrackerAlignmentCompareZTwoTags;
798 typedef TrackerAlignmentCompareTwoTags<AlignmentPI::rot_alpha> TrackerAlignmentCompareAlphaTwoTags;
799 typedef TrackerAlignmentCompareTwoTags<AlignmentPI::rot_beta> TrackerAlignmentCompareBetaTwoTags;
800 typedef TrackerAlignmentCompareTwoTags<AlignmentPI::rot_gamma> TrackerAlignmentCompareGammaTwoTags;
806 template <
int ntags, IOVMultiplicity nIOVs, AlignmentPI::partitions q>
807 class TrackerAlignmentSummaryBase :
public PlotImage<Alignments, nIOVs, ntags> {
809 TrackerAlignmentSummaryBase()
810 :
PlotImage<
Alignments, nIOVs, ntags>(
"Comparison of all coordinates between two geometries for " +
813 bool fill()
override {
815 auto theIOVs = PlotBase::getTag<0>().iovs;
816 auto tagname1 = PlotBase::getTag<0>().
name;
818 auto firstiov = theIOVs.front();
819 std::tuple<cond::Time_t, cond::Hash> lastiov;
822 assert(this->m_plotAnnotations.ntags < 3);
824 if (this->m_plotAnnotations.ntags == 2) {
825 auto tag2iovs = PlotBase::getTag<1>().iovs;
826 tagname2 = PlotBase::getTag<1>().
name;
827 lastiov = tag2iovs.front();
829 lastiov = theIOVs.back();
832 std::shared_ptr<Alignments> last_payload = this->fetchPayload(std::get<1>(lastiov));
833 std::shared_ptr<Alignments> first_payload = this->fetchPayload(std::get<1>(firstiov));
838 std::vector<AlignTransform> ref_ali = first_payload->m_align;
839 std::vector<AlignTransform> target_ali = last_payload->m_align;
841 if (ref_ali.size() != target_ali.size()) {
843 <<
"the size of the reference alignment (" << ref_ali.size()
844 <<
") is different from the one of the target (" << target_ali.size()
845 <<
")! You are probably trying to compare different underlying geometries. Exiting";
851 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml" 852 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
856 for (
const auto &ali : ref_ali) {
857 auto mydetid = ali.rawId();
860 <<
"Encountered invalid Tracker DetId:" <<
DetId(mydetid).
rawId() <<
" (" <<
DetId(mydetid).
det()
862 <<
"); subdetId " <<
DetId(mydetid).
subdetId() <<
" - terminating ";
867 TCanvas
canvas(
"Alignment Comparison",
"Alignment Comparison", 1800, 1200);
870 std::unordered_map<AlignmentPI::coordinate, std::unique_ptr<TH1F>> diffs;
878 for (
const auto &coord : coords) {
883 diffs[coord] = std::make_unique<TH1F>(Form(
"hDiff_%s", s_coord.c_str()),
884 Form(
";#Delta%s %s;n. of modules", s_coord.c_str(),
unit.c_str()),
891 std::map<int, AlignmentPI::partitions> boundaries;
897 auto legend = std::make_unique<TLegend>(0.14, 0.88, 0.96, 0.99);
898 if (this->m_plotAnnotations.ntags == 2) {
899 legend->SetHeader(
"#bf{Two Tags Comparison}",
"C");
902 (
"#splitline{" + tagname1 +
" : " + firstIOVsince +
"}{" + tagname2 +
" : " + lastIOVsince +
"}").c_str(),
905 legend->SetHeader((
"tag: #bf{" + tagname1 +
"}").c_str(),
"C");
907 (
"#splitline{IOV since: " + firstIOVsince +
"}{IOV since: " + lastIOVsince +
"}").c_str(),
910 legend->SetTextSize(0.025);
912 for (
const auto &coord : coords) {
913 canvas.cd(c_index)->SetLogy();
914 canvas.cd(c_index)->SetTopMargin(0.01);
915 canvas.cd(c_index)->SetBottomMargin(0.15);
916 canvas.cd(c_index)->SetLeftMargin(0.14);
917 canvas.cd(c_index)->SetRightMargin(0.04);
918 diffs[coord]->SetLineWidth(2);
926 int i_max = diffs[coord]->FindLastBinAbove(0.);
927 int i_min = diffs[coord]->FindFirstBinAbove(0.);
928 diffs[coord]->GetXaxis()->SetRange(
std::max(1, i_min - 10),
std::min(i_max + 10, diffs[coord]->GetNbinsX()));
929 diffs[coord]->SetMaximum(diffs[coord]->GetMaximum() * 5);
930 diffs[coord]->Draw(
"HIST");
945 typedef TrackerAlignmentSummaryBase<1, MULTI_IOV, AlignmentPI::BPix> TrackerAlignmentSummaryBPix;
946 typedef TrackerAlignmentSummaryBase<1, MULTI_IOV, AlignmentPI::FPix> TrackerAlignmentSummaryFPix;
947 typedef TrackerAlignmentSummaryBase<1, MULTI_IOV, AlignmentPI::TIB> TrackerAlignmentSummaryTIB;
949 typedef TrackerAlignmentSummaryBase<1, MULTI_IOV, AlignmentPI::TID> TrackerAlignmentSummaryTID;
950 typedef TrackerAlignmentSummaryBase<1, MULTI_IOV, AlignmentPI::TOB> TrackerAlignmentSummaryTOB;
951 typedef TrackerAlignmentSummaryBase<1, MULTI_IOV, AlignmentPI::TEC> TrackerAlignmentSummaryTEC;
953 typedef TrackerAlignmentSummaryBase<2, SINGLE_IOV, AlignmentPI::BPix> TrackerAlignmentSummaryBPixTwoTags;
954 typedef TrackerAlignmentSummaryBase<2, SINGLE_IOV, AlignmentPI::FPix> TrackerAlignmentSummaryFPixTwoTags;
955 typedef TrackerAlignmentSummaryBase<2, SINGLE_IOV, AlignmentPI::TIB> TrackerAlignmentSummaryTIBTwoTags;
957 typedef TrackerAlignmentSummaryBase<2, SINGLE_IOV, AlignmentPI::TID> TrackerAlignmentSummaryTIDTwoTags;
958 typedef TrackerAlignmentSummaryBase<2, SINGLE_IOV, AlignmentPI::TOB> TrackerAlignmentSummaryTOBTwoTags;
959 typedef TrackerAlignmentSummaryBase<2, SINGLE_IOV, AlignmentPI::TEC> TrackerAlignmentSummaryTECTwoTags;
964 template <AlignmentPI::coordinate coord,
int ntags, IOVMultiplicity nIOVs>
965 class PixelAlignmentComparisonMapBase :
public PlotImage<Alignments, nIOVs, ntags> {
967 PixelAlignmentComparisonMapBase()
971 payloadString =
"Tracker Alignment";
974 bool fill()
override {
975 gStyle->SetPalette(1);
978 auto theIOVs = PlotBase::getTag<0>().iovs;
979 auto tagname1 = PlotBase::getTag<0>().
name;
981 auto firstiov = theIOVs.front();
982 std::tuple<cond::Time_t, cond::Hash> lastiov;
985 assert(this->m_plotAnnotations.ntags < 3);
987 if (this->m_plotAnnotations.ntags == 2) {
988 auto tag2iovs = PlotBase::getTag<1>().iovs;
989 tagname2 = PlotBase::getTag<1>().
name;
990 lastiov = tag2iovs.front();
992 lastiov = theIOVs.back();
995 std::shared_ptr<Alignments> last_payload = this->fetchPayload(std::get<1>(lastiov));
996 std::shared_ptr<Alignments> first_payload = this->fetchPayload(std::get<1>(firstiov));
1001 const std::vector<AlignTransform> &ref_ali = first_payload->m_align;
1002 const std::vector<AlignTransform> &target_ali = last_payload->m_align;
1004 if (last_payload.get() && first_payload.get()) {
1010 fullMap.createTrackerBaseMap();
1012 if (this->isPhase0(ref_ali) || this->isPhase0(target_ali)) {
1013 edm::LogError(label_) <<
"Pixel Tracker Alignment maps are not supported for non-Phase1 Pixel geometries !";
1014 TCanvas
canvas(
"Canv",
"Canv", 1200, 1000);
1022 std::map<uint32_t, double> diffPerDetid;
1023 this->fillPerDetIdDiff(coord, ref_ali, target_ali, diffPerDetid);
1026 for (
const auto &elem : diffPerDetid) {
1032 fullMap.fillTrackerMap(elem.first, elem.second);
1038 TCanvas
canvas(
"Canv",
"Canv", 3000, 2000);
1039 fullMap.printTrackerMap(
canvas);
1041 auto ltx = TLatex();
1042 ltx.SetTextFont(62);
1043 ltx.SetTextSize(0.025);
1044 ltx.SetTextAlign(11);
1046 ltx.DrawLatexNDC(gPad->GetLeftMargin() + 0.01,
1047 gPad->GetBottomMargin() + 0.01,
1048 (
"#color[4]{" + tagname1 +
"}, IOV: #color[4]{" + firstIOVsince +
"} vs #color[4]{" +
1049 tagname2 +
"}, IOV: #color[4]{" + lastIOVsince +
"}")
1064 bool isPhase0(std::vector<AlignTransform> theAlis) {
1067 const auto &p0detIds =
reader.getAllDetIds();
1069 std::vector<uint32_t> ownDetIds;
1074 for (
const auto &det : ownDetIds) {
1076 if (
std::find(p0detIds.begin(), p0detIds.end(), det) != p0detIds.end()) {
1085 const std::vector<AlignTransform> &ref_ali,
1086 const std::vector<AlignTransform> &target_ali,
1087 std::map<uint32_t, double> &
diff)
1090 for (
unsigned int i = 0;
i < ref_ali.size();
i++) {
1091 uint32_t detid = ref_ali[
i].rawId();
1093 CLHEP::HepRotation target_rot(target_ali[
i].
rotation());
1094 CLHEP::HepRotation ref_rot(ref_ali[
i].
rotation());
1116 const std::vector<double> deltaRot = {
1121 const auto &deltaTrans = target_ali[
i].translation() - ref_ali[
i].translation();
1143 edm::LogError(
"TrackerAlignment_PayloadInspector") <<
"Unrecognized coordinate " << myCoord << std::endl;
1151 template <AlignmentPI::coordinate coord>
1152 using PixelAlignmentCompareMap = PixelAlignmentComparisonMapBase<coord, 1, MULTI_IOV>;
1154 template <AlignmentPI::coordinate coord>
1155 using PixelAlignmentCompareMapTwoTags = PixelAlignmentComparisonMapBase<coord, 2, SINGLE_IOV>;
1157 typedef PixelAlignmentCompareMap<AlignmentPI::t_x> PixelAlignmentCompareMapX;
1158 typedef PixelAlignmentCompareMap<AlignmentPI::t_y> PixelAlignmentCompareMapY;
1159 typedef PixelAlignmentCompareMap<AlignmentPI::t_z> PixelAlignmentCompareMapZ;
1161 typedef PixelAlignmentCompareMap<AlignmentPI::rot_alpha> PixelAlignmentCompareMapAlpha;
1162 typedef PixelAlignmentCompareMap<AlignmentPI::rot_beta> PixelAlignmentCompareMapBeta;
1163 typedef PixelAlignmentCompareMap<AlignmentPI::rot_gamma> PixelAlignmentCompareMapGamma;
1165 typedef PixelAlignmentCompareMapTwoTags<AlignmentPI::t_x> PixelAlignmentCompareMapXTwoTags;
1166 typedef PixelAlignmentCompareMapTwoTags<AlignmentPI::t_y> PixelAlignmentCompareMapYTwoTags;
1167 typedef PixelAlignmentCompareMapTwoTags<AlignmentPI::t_z> PixelAlignmentCompareMapZTwoTags;
1169 typedef PixelAlignmentCompareMapTwoTags<AlignmentPI::rot_alpha> PixelAlignmentCompareMapAlphaTwoTags;
1170 typedef PixelAlignmentCompareMapTwoTags<AlignmentPI::rot_beta> PixelAlignmentCompareMapBetaTwoTags;
1171 typedef PixelAlignmentCompareMapTwoTags<AlignmentPI::rot_gamma> PixelAlignmentCompareMapGammaTwoTags;
1177 template <AlignmentPI::coordinate coord>
1178 class BPixBarycenterHistory :
public HistoryPlot<Alignments, float> {
1180 BPixBarycenterHistory()
1184 ~BPixBarycenterHistory()
override =
default;
1187 std::vector<AlignTransform> alignments =
payload.m_align;
1189 float barycenter = 0.;
1191 for (
const auto &ali : alignments) {
1194 <<
"Encountered invalid Tracker DetId:" << ali.rawId() <<
" " <<
DetId(ali.rawId()).det()
1199 int subid =
DetId(ali.rawId()).subdetId();
1206 barycenter += (ali.translation().x());
1209 barycenter += (ali.translation().y());
1212 barycenter += (ali.translation().z());
1215 edm::LogError(
"TrackerAlignment_PayloadInspector") <<
"Unrecognized coordinate " << coord << std::endl;
1220 edm::LogInfo(
"TrackerAlignment_PayloadInspector") <<
"barycenter (" << barycenter <<
")/n. modules (" << nmodules
1221 <<
") = " << barycenter / nmodules << std::endl;
1224 barycenter /= nmodules;
1227 barycenter += hardcodeGPR.at(coord);
1234 typedef BPixBarycenterHistory<AlignmentPI::t_x> X_BPixBarycenterHistory;
1235 typedef BPixBarycenterHistory<AlignmentPI::t_y> Y_BPixBarycenterHistory;
1236 typedef BPixBarycenterHistory<AlignmentPI::t_z> Z_BPixBarycenterHistory;
1241 class TrackerAlignmentBarycenters :
public PlotImage<Alignments, SINGLE_IOV> {
1245 bool fill()
override {
1246 auto tag = PlotBase::getTag<0>();
1247 auto iov =
tag.iovs.front();
1249 std::shared_ptr<Alignments>
payload = fetchPayload(std::get<1>(iov));
1250 unsigned int run = std::get<0>(iov);
1252 TCanvas
canvas(
"Tracker Alignment Barycenter Summary",
"Tracker Alignment Barycenter summary", 1600, 1000);
1255 canvas.SetTopMargin(0.07);
1256 canvas.SetBottomMargin(0.06);
1257 canvas.SetLeftMargin(0.15);
1258 canvas.SetRightMargin(0.03);
1262 auto h2_BarycenterParameters =
1263 std::make_unique<TH2F>(
"Parameters",
"SubDetector Barycenter summary", 6, 0.0, 6.0, 6, 0, 6.);
1265 auto h2_uncBarycenterParameters =
1266 std::make_unique<TH2F>(
"Parameters2",
"SubDetector Barycenter summary", 6, 0.0, 6.0, 6, 0, 6.);
1268 h2_BarycenterParameters->SetStats(
false);
1269 h2_BarycenterParameters->SetTitle(
nullptr);
1270 h2_uncBarycenterParameters->SetStats(
false);
1271 h2_uncBarycenterParameters->SetTitle(
nullptr);
1273 std::vector<AlignTransform> alignments =
payload->m_align;
1278 const char *path_toTopologyXML = isPhase0 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml" 1279 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
1289 auto Xbarycenters = barycenters.
getX();
1290 auto Ybarycenters = barycenters.
getY();
1291 auto Zbarycenters = barycenters.
getZ();
1296 auto c_Xbarycenters = barycenters.
getX();
1297 auto c_Ybarycenters = barycenters.
getY();
1298 auto c_Zbarycenters = barycenters.
getZ();
1300 h2_BarycenterParameters->GetXaxis()->SetBinLabel(1,
"X [cm]");
1301 h2_BarycenterParameters->GetXaxis()->SetBinLabel(2,
"Y [cm]");
1302 h2_BarycenterParameters->GetXaxis()->SetBinLabel(3,
"Z [cm]");
1303 h2_BarycenterParameters->GetXaxis()->SetBinLabel(4,
"X_{no GPR} [cm]");
1304 h2_BarycenterParameters->GetXaxis()->SetBinLabel(5,
"Y_{no GPR} [cm]");
1305 h2_BarycenterParameters->GetXaxis()->SetBinLabel(6,
"Z_{no GPR} [cm]");
1307 bool isLikelyMC(
false);
1309 std::count_if(Xbarycenters.begin(), Xbarycenters.begin() + 2, [](
float a) {
return (
std::abs(
a) >= 1.e-4); });
1311 std::count_if(Ybarycenters.begin(), Ybarycenters.begin() + 2, [](
float a) {
return (
std::abs(
a) >= 1.e-4); });
1313 std::count_if(Zbarycenters.begin(), Zbarycenters.begin() + 2, [](
float a) {
return (
std::abs(
a) >= 1.e-4); });
1317 if ((checkX + checkY + checkZ) == 0 &&
run == 1)
1320 unsigned int yBin = 6;
1321 for (
unsigned int i = 0;
i < 6;
i++) {
1324 h2_BarycenterParameters->GetYaxis()->SetBinLabel(
yBin, theLabel.c_str());
1326 h2_BarycenterParameters->SetBinContent(1,
yBin, c_Xbarycenters[
i]);
1327 h2_BarycenterParameters->SetBinContent(2,
yBin, c_Ybarycenters[
i]);
1328 h2_BarycenterParameters->SetBinContent(3,
yBin, c_Zbarycenters[
i]);
1331 h2_uncBarycenterParameters->SetBinContent(4,
yBin, Xbarycenters[
i]);
1332 h2_uncBarycenterParameters->SetBinContent(5,
yBin, Ybarycenters[
i]);
1333 h2_uncBarycenterParameters->SetBinContent(6,
yBin, Zbarycenters[
i]);
1337 h2_BarycenterParameters->GetXaxis()->LabelsOption(
"h");
1338 h2_BarycenterParameters->GetYaxis()->SetLabelSize(0.05);
1339 h2_BarycenterParameters->GetXaxis()->SetLabelSize(0.05);
1340 h2_BarycenterParameters->SetMarkerSize(1.5);
1341 h2_BarycenterParameters->Draw(
"TEXT");
1343 h2_uncBarycenterParameters->SetMarkerSize(1.5);
1344 h2_uncBarycenterParameters->SetMarkerColor(kRed);
1345 h2_uncBarycenterParameters->Draw(
"TEXTsame");
1349 t1.SetTextAlign(26);
1350 t1.SetTextSize(0.045);
1351 t1.DrawLatex(0.5, 0.96, Form(
"TkAl Barycenters, Tag: #color[4]{%s}, IOV #color[4]{%i}",
tagname.c_str(),
run));
1352 t1.SetTextSize(0.025);
1367 template <
int ntags, IOVMultiplicity nIOVs>
1368 class TrackerAlignmentBarycentersComparatorBase :
public PlotImage<Alignments, nIOVs, ntags> {
1370 TrackerAlignmentBarycentersComparatorBase()
1373 bool fill()
override {
1375 auto theIOVs = PlotBase::getTag<0>().iovs;
1376 auto tagname1 = PlotBase::getTag<0>().
name;
1378 auto firstiov = theIOVs.front();
1379 std::tuple<cond::Time_t, cond::Hash> lastiov;
1382 assert(this->m_plotAnnotations.ntags < 3);
1384 if (this->m_plotAnnotations.ntags == 2) {
1385 auto tag2iovs = PlotBase::getTag<1>().iovs;
1386 tagname2 = PlotBase::getTag<1>().
name;
1387 lastiov = tag2iovs.front();
1389 lastiov = theIOVs.back();
1392 unsigned int first_run = std::get<0>(firstiov);
1393 unsigned int last_run = std::get<0>(lastiov);
1395 std::shared_ptr<Alignments> last_payload = this->fetchPayload(std::get<1>(lastiov));
1396 std::vector<AlignTransform> last_alignments = last_payload->m_align;
1398 std::shared_ptr<Alignments> first_payload = this->fetchPayload(std::get<1>(firstiov));
1399 std::vector<AlignTransform> first_alignments = first_payload->m_align;
1405 const char *path_toTopologyXML = isInitialPhase0 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml" 1406 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
1411 path_toTopologyXML = isFinalPhase0 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml" 1412 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
1417 TCanvas
canvas(
"Tracker Alignment Barycenter Summary",
"Tracker Alignment Barycenter summary", 1200, 800);
1420 canvas.SetTopMargin(0.07);
1421 canvas.SetBottomMargin(0.06);
1422 canvas.SetLeftMargin(0.15);
1423 canvas.SetRightMargin(0.03);
1427 auto h2_BarycenterDiff =
1428 std::make_unique<TH2F>(
"Parameters diff",
"SubDetector Barycenter Difference", 3, 0.0, 3.0, 6, 0, 6.);
1430 h2_BarycenterDiff->SetStats(
false);
1431 h2_BarycenterDiff->SetTitle(
nullptr);
1432 h2_BarycenterDiff->GetXaxis()->SetBinLabel(1,
"X [#mum]");
1433 h2_BarycenterDiff->GetXaxis()->SetBinLabel(2,
"Y [#mum]");
1434 h2_BarycenterDiff->GetXaxis()->SetBinLabel(3,
"Z [#mum]");
1442 unsigned int yBin = 6;
1443 for (
unsigned int i = 0;
i < 6;
i++) {
1446 h2_BarycenterDiff->GetYaxis()->SetBinLabel(
yBin, theLabel.c_str());
1447 h2_BarycenterDiff->SetBinContent(
1449 h2_BarycenterDiff->SetBinContent(
1451 h2_BarycenterDiff->SetBinContent(
1456 h2_BarycenterDiff->GetXaxis()->LabelsOption(
"h");
1457 h2_BarycenterDiff->GetYaxis()->SetLabelSize(0.05);
1458 h2_BarycenterDiff->GetXaxis()->SetLabelSize(0.05);
1459 h2_BarycenterDiff->SetMarkerSize(1.5);
1460 h2_BarycenterDiff->SetMarkerColor(kRed);
1461 h2_BarycenterDiff->Draw(
"TEXT");
1465 t1.SetTextAlign(26);
1466 t1.SetTextSize(0.05);
1467 t1.DrawLatex(0.5, 0.96, Form(
"Tracker Alignment Barycenters Diff, IOV %i - IOV %i",
last_run,
first_run));
1468 t1.SetTextSize(0.025);
1477 bool isInitialPhase0;
1481 using TrackerAlignmentBarycentersCompare = TrackerAlignmentBarycentersComparatorBase<1, MULTI_IOV>;
1482 using TrackerAlignmentBarycentersCompareTwoTags = TrackerAlignmentBarycentersComparatorBase<2, SINGLE_IOV>;
1487 template <
int ntags, IOVMultiplicity nIOVs>
1488 class PixelBarycentersComparatorBase :
public PlotImage<Alignments, nIOVs, ntags> {
1490 PixelBarycentersComparatorBase() :
PlotImage<
Alignments, nIOVs, ntags>(
"Comparison of Pixel Barycenters") {}
1492 bool fill()
override {
1494 auto theIOVs = PlotBase::getTag<0>().iovs;
1495 auto tagname1 = PlotBase::getTag<0>().
name;
1497 auto firstiov = theIOVs.front();
1498 std::tuple<cond::Time_t, cond::Hash> lastiov;
1501 assert(this->m_plotAnnotations.ntags < 3);
1503 if (this->m_plotAnnotations.ntags == 2) {
1504 auto tag2iovs = PlotBase::getTag<1>().iovs;
1505 tagname2 = PlotBase::getTag<1>().
name;
1506 lastiov = tag2iovs.front();
1508 lastiov = theIOVs.back();
1511 unsigned int first_run = std::get<0>(firstiov);
1512 unsigned int last_run = std::get<0>(lastiov);
1514 std::shared_ptr<Alignments> last_payload = this->fetchPayload(std::get<1>(lastiov));
1515 std::vector<AlignTransform> last_alignments = last_payload->m_align;
1517 std::shared_ptr<Alignments> first_payload = this->fetchPayload(std::get<1>(firstiov));
1518 std::vector<AlignTransform> first_alignments = first_payload->m_align;
1520 TCanvas
canvas(
"Pixel Barycenter Summary",
"Pixel Barycenter summary", 1200, 1200);
1526 t1.SetTextAlign(26);
1527 t1.SetTextSize(0.03);
1533 t1.SetTextSize(0.025);
1535 for (
unsigned int c = 1;
c <= 4;
c++) {
1536 canvas.cd(
c)->SetTopMargin(0.07);
1537 canvas.cd(
c)->SetBottomMargin(0.12);
1538 canvas.cd(
c)->SetLeftMargin(0.15);
1539 canvas.cd(
c)->SetRightMargin(0.03);
1544 std::array<std::string, 3> structures = {{
"FPIX-",
"BPIX",
"FPIX+"}};
1545 std::array<std::unique_ptr<TH2F>, 3>
histos;
1551 const char *path_toTopologyXML = isInitialPhase0 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml" 1552 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
1562 path_toTopologyXML = isFinalPhase0 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml" 1563 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
1573 if (isFinalPhase0 != isInitialPhase0) {
1575 <<
"the size of the reference alignment (" << first_alignments.size()
1576 <<
") is different from the one of the target (" << last_alignments.size()
1577 <<
")! You are probably trying to compare different underlying geometries.";
1580 unsigned int index(0);
1581 for (
const auto &piece : structures) {
1582 const char *
name = piece.c_str();
1585 Form(
"%s x-y Barycenter Difference;x_{%s}-x_{TOB} [mm];y_{%s}-y_{TOB} [mm]",
name,
name,
name),
1605 auto h2_ZBarycenterDiff = std::make_unique<TH2F>(
1606 "Pixel_z_diff",
"Pixel z-Barycenter Difference;; z_{Pixel-Ideal} -z_{TOB} [mm]", 3, -0.5, 2.5, 100, -10., 10.);
1607 h2_ZBarycenterDiff->SetStats(
false);
1608 h2_ZBarycenterDiff->SetTitle(
nullptr);
1609 h2_ZBarycenterDiff->GetXaxis()->SetBinLabel(1,
"FPIX -");
1610 h2_ZBarycenterDiff->GetXaxis()->SetBinLabel(2,
"BPIX");
1611 h2_ZBarycenterDiff->GetXaxis()->SetBinLabel(3,
"FPIX +");
1612 h2_ZBarycenterDiff->GetYaxis()->SetLabelSize(0.05);
1613 h2_ZBarycenterDiff->GetXaxis()->SetLabelSize(0.07);
1614 h2_ZBarycenterDiff->GetYaxis()->SetTitleSize(0.06);
1615 h2_ZBarycenterDiff->GetXaxis()->SetTitleSize(0.06);
1616 h2_ZBarycenterDiff->GetYaxis()->CenterTitle();
1617 h2_ZBarycenterDiff->GetXaxis()->CenterTitle();
1618 h2_ZBarycenterDiff->GetYaxis()->SetTitleOffset(1.1);
1620 std::function<GlobalPoint(int)> cutFunctorInitial = [&myInitialBarycenters](
int index) {
1633 std::function<GlobalPoint(int)> cutFunctorFinal = [&myFinalBarycenters](
int index) {
1646 float x0i, x0f, y0i, y0f;
1649 t1.SetTextSize(0.047);
1650 for (
unsigned int c = 1;
c <= 3;
c++) {
1651 x0i = cutFunctorInitial(
c).x() * 10;
1652 x0f = cutFunctorFinal(
c).x() * 10;
1653 y0i = cutFunctorInitial(
c).y() * 10;
1654 y0f = cutFunctorFinal(
c).y() * 10;
1659 COUT <<
"initial x,y " << std::left << std::setw(7) << structures[
c - 1] <<
" (" << x0i <<
"," << y0i <<
") mm" 1661 COUT <<
"final x,y " << std::left << std::setw(7) << structures[
c - 1] <<
" (" << x0f <<
"," << y0f <<
") mm" 1664 TMarker *initial =
new TMarker(x0i, y0i, 21);
1665 TMarker *
final =
new TMarker(x0f, y0f, 20);
1667 initial->SetMarkerColor(kRed);
1668 final->SetMarkerColor(kBlue);
1669 initial->SetMarkerSize(2.5);
1670 final->SetMarkerSize(2.5);
1671 t1.SetTextColor(kRed);
1673 t1.DrawLatex(x0i, y0i + (y0i > y0f ? 0.3 : -0.5), Form(
"(%.2f,%.2f)", x0i, y0i));
1674 final->Draw(
"same");
1675 t1.SetTextColor(kBlue);
1676 t1.DrawLatex(x0f, y0f + (y0i > y0f ? -0.5 : 0.3), Form(
"(%.2f,%.2f)", x0f, y0f));
1681 h2_ZBarycenterDiff->Draw();
1686 std::array<double, 3> hardcodeIdealZPhase0 = {{-41.94909, 0., 41.94909}};
1687 std::array<double, 3> hardcodeIdealZPhase1 = {{-39.82911, 0., 39.82911}};
1689 for (
unsigned int c = 1;
c <= 3;
c++) {
1693 (cutFunctorInitial(
c).z() - (isInitialPhase0 ? hardcodeIdealZPhase0[
c - 1] : hardcodeIdealZPhase1[
c - 1])) *
1696 (cutFunctorFinal(
c).z() - (isFinalPhase0 ? hardcodeIdealZPhase0[
c - 1] : hardcodeIdealZPhase1[
c - 1])) * 10;
1698 TMarker *initial =
new TMarker(
c - 1, z0i, 21);
1699 TMarker *
final =
new TMarker(
c - 1, z0f, 20);
1701 COUT <<
"initial z " << std::left << std::setw(7) << structures[
c - 1] <<
" " << z0i <<
" mm" << std::endl;
1702 COUT <<
"final z " << std::left << std::setw(7) << structures[
c - 1] <<
" " << z0f <<
" mm" << std::endl;
1704 initial->SetMarkerColor(kRed);
1705 final->SetMarkerColor(kBlue);
1706 initial->SetMarkerSize(2.5);
1707 final->SetMarkerSize(2.5);
1709 t1.SetTextColor(kRed);
1710 t1.DrawLatex(
c - 1, z0i + (z0i > z0f ? 1. : -1.5), Form(
"(%.2f)", z0i));
1711 final->Draw(
"same");
1712 t1.SetTextColor(kBlue);
1713 t1.DrawLatex(
c - 1, z0f + (z0i > z0f ? -1.5 : 1), Form(
"(%.2f)", z0f));
1723 bool isInitialPhase0;
1727 using PixelBarycentersCompare = PixelBarycentersComparatorBase<1, MULTI_IOV>;
1728 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
def ALL(dt, wheel, station, sector)
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
constexpr Detector det() const
get the detector field from this detid
static std::string to_string(const XMLCh *ch)
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
static const float tomRad
bool isReorderedTFPXTEPX(const std::vector< AlignTransform > &transforms)
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) ...
static const unsigned int phase1size
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
Log< level::Warning, true > LogPrint
Basic3DVector unit() const
Log< level::Info, false > LogInfo
void fillComparisonHistograms(std::map< int, AlignmentPI::partitions > &boundaries, const std::vector< AlignTransform > &ref_ali, const std::vector< AlignTransform > &target_ali, std::unordered_map< AlignmentPI::coordinate, std::unique_ptr< TH1F > > &compare, bool diff=false, AlignmentPI::partitions checkPart=AlignmentPI::INVALID)
GlobalPoint getPartitionAvg(AlignmentPI::PARTITION p)
constexpr uint32_t rawId() const
get the raw id
std::string getStringFromCoordinate(AlignmentPI::coordinate coord)
std::pair< double, double > calculatePosition(TVirtualPad *myPad, int boundary)
static std::atomic< unsigned int > counter
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)
static constexpr char const *const kPh0DefaultFile
void displayNotSupported(TCanvas &canv, const unsigned int size)
void fillComparisonHistogram(const AlignmentPI::coordinate &coord, std::map< int, AlignmentPI::partitions > &boundaries, const std::vector< AlignTransform > &ref_ali, const std::vector< AlignTransform > &target_ali, std::unique_ptr< TH1F > &compare)
Log< level::Warning, false > LogWarning
const std::array< double, 6 > getZ()
std::string getStringFromPart(AlignmentPI::partitions i, bool isPhase2=false)