21 #include "CLHEP/Vector/RotationInterfaces.h"
45 #include "TPaveStats.h"
58 const std::map<AlignmentPI::coordinate, float> hardcodeGPR = {
65 template <AlignmentPI::coordinate coord>
68 TrackerAlignmentComparatorBase()
70 " coordinate between two geometries") {}
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;
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);
80 auto firstiov = sorted_iovs.front();
81 auto lastiov = sorted_iovs.back();
83 std::shared_ptr<Alignments> last_payload =
fetchPayload(std::get<1>(lastiov));
84 std::shared_ptr<Alignments> first_payload =
fetchPayload(std::get<1>(firstiov));
86 std::string lastIOVsince = std::to_string(std::get<0>(lastiov));
87 std::string firstIOVsince = std::to_string(std::get<0>(firstiov));
89 std::vector<AlignTransform> ref_ali = first_payload->m_align;
90 std::vector<AlignTransform> target_ali = last_payload->m_align;
92 TCanvas
canvas(
"Alignment Comparison",
"Alignment Comparison", 1200, 1200);
94 if (ref_ali.size() != target_ali.size()) {
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";
104 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml"
105 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
109 for (
const auto &ali : ref_ali) {
110 auto mydetid = ali.rawId();
113 <<
"Encountered invalid Tracker DetId:" <<
DetId(mydetid).
rawId() <<
" (" <<
DetId(mydetid).
det()
115 <<
"); subdetId " <<
DetId(mydetid).
subdetId() <<
" - terminating ";
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()),
131 ref_ali.size() - 0.5));
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()) {
140 auto thePart = static_cast<AlignmentPI::partitions>(subid);
141 if (thePart != currentPart) {
142 currentPart = thePart;
146 CLHEP::HepRotation target_rot(target_ali[
i].
rotation());
147 CLHEP::HepRotation ref_rot(ref_ali[
i].
rotation());
186 compare->SetBinContent(
i + 1, (target_eulerAngles[0] - ref_eulerAngles[0]) * 1000.);
189 compare->SetBinContent(
i + 1, (target_eulerAngles[1] - ref_eulerAngles[1]) * 1000.);
192 compare->SetBinContent(
i + 1, (target_eulerAngles[2] - ref_eulerAngles[2]) * 1000.);
195 edm::LogError(
"TrackerAlignment_PayloadInspector") <<
"Unrecognized coordinate " << coord << std::endl;
203 canvas.SetLeftMargin(0.17);
204 canvas.SetRightMargin(0.05);
205 canvas.SetBottomMargin(0.15);
219 TLine
l[boundaries.size()];
221 for (
const auto &
line : boundaries) {
226 l[
i].SetLineWidth(1);
227 l[
i].SetLineStyle(9);
228 l[
i].SetLineColor(2);
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);
243 float theX_ = myPair.first + 0.025;
247 TLegend
legend = TLegend(0.58, 0.82, 0.95, 0.9);
249 legend.SetHeader(
"Alignment comparison",
"C");
252 (
"IOV:" + std::to_string(std::get<0>(lastiov)) +
"-" + std::to_string(std::get<0>(firstiov))).c_str(),
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()));
271 template <AlignmentPI::coordinate coord>
272 class TrackerAlignmentCompare :
public TrackerAlignmentComparatorBase<coord> {
274 TrackerAlignmentCompare() : TrackerAlignmentComparatorBase<coord>() { this->setSingleIov(
false); }
277 template <AlignmentPI::coordinate coord>
278 class TrackerAlignmentCompareTwoTags :
public TrackerAlignmentComparatorBase<coord> {
280 TrackerAlignmentCompareTwoTags() : TrackerAlignmentComparatorBase<coord>() { this->setTwoTags(
true); }
283 typedef TrackerAlignmentCompare<AlignmentPI::t_x> TrackerAlignmentCompareX;
284 typedef TrackerAlignmentCompare<AlignmentPI::t_y> TrackerAlignmentCompareY;
285 typedef TrackerAlignmentCompare<AlignmentPI::t_z> TrackerAlignmentCompareZ;
287 typedef TrackerAlignmentCompare<AlignmentPI::rot_alpha> TrackerAlignmentCompareAlpha;
288 typedef TrackerAlignmentCompare<AlignmentPI::rot_beta> TrackerAlignmentCompareBeta;
289 typedef TrackerAlignmentCompare<AlignmentPI::rot_gamma> TrackerAlignmentCompareGamma;
291 typedef TrackerAlignmentCompareTwoTags<AlignmentPI::t_x> TrackerAlignmentCompareXTwoTags;
292 typedef TrackerAlignmentCompareTwoTags<AlignmentPI::t_y> TrackerAlignmentCompareYTwoTags;
293 typedef TrackerAlignmentCompareTwoTags<AlignmentPI::t_z> TrackerAlignmentCompareZTwoTags;
295 typedef TrackerAlignmentCompareTwoTags<AlignmentPI::rot_alpha> TrackerAlignmentCompareAlphaTwoTags;
296 typedef TrackerAlignmentCompareTwoTags<AlignmentPI::rot_beta> TrackerAlignmentCompareBetaTwoTags;
297 typedef TrackerAlignmentCompareTwoTags<AlignmentPI::rot_gamma> TrackerAlignmentCompareGammaTwoTags;
303 template <AlignmentPI::partitions q>
306 TrackerAlignmentSummary()
307 :
cond::payloadInspector::PlotImage<
Alignments>(
"Comparison of all coordinates between two geometries for " +
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;
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);
320 auto firstiov = sorted_iovs.front();
321 auto lastiov = sorted_iovs.back();
323 std::shared_ptr<Alignments> last_payload =
fetchPayload(std::get<1>(lastiov));
324 std::shared_ptr<Alignments> first_payload =
fetchPayload(std::get<1>(firstiov));
326 std::string lastIOVsince = std::to_string(std::get<0>(lastiov));
327 std::string firstIOVsince = std::to_string(std::get<0>(firstiov));
329 std::vector<AlignTransform> ref_ali = first_payload->m_align;
330 std::vector<AlignTransform> target_ali = last_payload->m_align;
332 if (ref_ali.size() != target_ali.size()) {
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";
342 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml"
343 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
347 for (
const auto &ali : ref_ali) {
348 auto mydetid = ali.rawId();
351 <<
"Encountered invalid Tracker DetId:" <<
DetId(mydetid).
rawId() <<
" (" <<
DetId(mydetid).
det()
353 <<
"); subdetId " <<
DetId(mydetid).
subdetId() <<
" - terminating ";
358 TCanvas
canvas(
"Alignment Comparison",
"Alignment Comparison", 1800, 1200);
361 std::unordered_map<AlignmentPI::coordinate, std::unique_ptr<TH1F> > diffs;
369 for (
const auto &coord : coords) {
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()),
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()) {
386 auto thePart = static_cast<AlignmentPI::partitions>(subid);
390 CLHEP::HepRotation target_rot(target_ali[
i].
rotation());
391 CLHEP::HepRotation ref_rot(ref_ali[
i].
rotation());
416 for (
const auto &coord : coords) {
419 diffs[coord]->Fill((target_ali[
i].translation().
x() - ref_ali[
i].translation().
x()) *
423 diffs[coord]->Fill((target_ali[
i].translation().
y() - ref_ali[
i].translation().
y()) *
427 diffs[coord]->Fill((target_ali[
i].translation().
z() - ref_ali[
i].translation().
z()) *
431 diffs[coord]->Fill((target_eulerAngles[0] - ref_eulerAngles[0]) * 1000.);
434 diffs[coord]->Fill((target_eulerAngles[1] - ref_eulerAngles[1]) * 1000.);
437 diffs[coord]->Fill((target_eulerAngles[2] - ref_eulerAngles[2]) * 1000.);
440 edm::LogError(
"TrackerAlignment_PayloadInspector") <<
"Unrecognized coordinate " << coord << std::endl;
449 auto legend = std::unique_ptr<TLegend>(
new TLegend(0.14, 0.93, 0.55, 0.98));
452 (
"#DeltaIOV: " + std::to_string(std::get<0>(lastiov)) +
"-" + std::to_string(std::get<0>(firstiov))).c_str(),
454 legend->SetTextSize(0.03);
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);
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");
488 typedef TrackerAlignmentSummary<AlignmentPI::BPix> TrackerAlignmentSummaryBPix;
489 typedef TrackerAlignmentSummary<AlignmentPI::FPix> TrackerAlignmentSummaryFPix;
490 typedef TrackerAlignmentSummary<AlignmentPI::TIB> TrackerAlignmentSummaryTIB;
492 typedef TrackerAlignmentSummary<AlignmentPI::TID> TrackerAlignmentSummaryTID;
493 typedef TrackerAlignmentSummary<AlignmentPI::TOB> TrackerAlignmentSummaryTOB;
494 typedef TrackerAlignmentSummary<AlignmentPI::TEC> TrackerAlignmentSummaryTEC;
500 template <AlignmentPI::coordinate coord>
503 BPixBarycenterHistory()
507 ~BPixBarycenterHistory()
override =
default;
510 std::vector<AlignTransform> alignments =
payload.m_align;
512 float barycenter = 0.;
514 for (
const auto &ali : alignments) {
517 <<
"Encountered invalid Tracker DetId:" << ali.rawId() <<
" " <<
DetId(ali.rawId()).det()
522 int subid =
DetId(ali.rawId()).subdetId();
529 barycenter += (ali.translation().x());
532 barycenter += (ali.translation().y());
535 barycenter += (ali.translation().z());
538 edm::LogError(
"TrackerAlignment_PayloadInspector") <<
"Unrecognized coordinate " << coord << std::endl;
543 edm::LogInfo(
"TrackerAlignment_PayloadInspector") <<
"barycenter (" << barycenter <<
")/n. modules (" << nmodules
544 <<
") = " << barycenter / nmodules << std::endl;
547 barycenter /= nmodules;
550 barycenter += hardcodeGPR.at(coord);
557 typedef BPixBarycenterHistory<AlignmentPI::t_x> X_BPixBarycenterHistory;
558 typedef BPixBarycenterHistory<AlignmentPI::t_y> Y_BPixBarycenterHistory;
559 typedef BPixBarycenterHistory<AlignmentPI::t_z> Z_BPixBarycenterHistory;
566 TrackerAlignmentBarycenters()
567 :
cond::payloadInspector::PlotImage<
Alignments>(
"Display of Tracker Alignment Barycenters") {
571 bool fill(
const std::vector<std::tuple<cond::Time_t, cond::Hash> > &iovs)
override {
572 auto iov = iovs.front();
574 unsigned int run = std::get<0>(iov);
576 TCanvas
canvas(
"Tracker Alignment Barycenter Summary",
"Tracker Alignment Barycenter summary", 1600, 1000);
579 canvas.SetTopMargin(0.07);
580 canvas.SetBottomMargin(0.06);
581 canvas.SetLeftMargin(0.15);
582 canvas.SetRightMargin(0.03);
586 auto h2_BarycenterParameters =
587 std::unique_ptr<TH2F>(
new TH2F(
"Parameters",
"SubDetector Barycenter summary", 6, 0.0, 6.0, 6, 0, 6.));
589 auto h2_uncBarycenterParameters =
590 std::unique_ptr<TH2F>(
new TH2F(
"Parameters2",
"SubDetector Barycenter summary", 6, 0.0, 6.0, 6, 0, 6.));
592 h2_BarycenterParameters->SetStats(
false);
593 h2_BarycenterParameters->SetTitle(
nullptr);
594 h2_uncBarycenterParameters->SetStats(
false);
595 h2_uncBarycenterParameters->SetTitle(
nullptr);
597 std::vector<AlignTransform> alignments =
payload->m_align;
602 const char *path_toTopologyXML = isPhase0 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml"
603 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
613 auto Xbarycenters = barycenters.
getX();
614 auto Ybarycenters = barycenters.
getY();
615 auto Zbarycenters = barycenters.
getZ();
620 auto c_Xbarycenters = barycenters.
getX();
621 auto c_Ybarycenters = barycenters.
getY();
622 auto c_Zbarycenters = barycenters.
getZ();
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]");
631 bool isLikelyMC(
false);
633 std::count_if(Xbarycenters.begin(), Xbarycenters.begin() + 2, [](
float a) {
return (
std::abs(
a) >= 1.e-4); });
635 std::count_if(Ybarycenters.begin(), Ybarycenters.begin() + 2, [](
float a) {
return (
std::abs(
a) >= 1.e-4); });
637 std::count_if(Zbarycenters.begin(), Zbarycenters.begin() + 2, [](
float a) {
return (
std::abs(
a) >= 1.e-4); });
641 if ((checkX + checkY + checkZ) == 0 &&
run == 1)
644 unsigned int yBin = 6;
645 for (
unsigned int i = 0;
i < 6;
i++) {
646 auto thePart = static_cast<AlignmentPI::partitions>(
i + 1);
648 h2_BarycenterParameters->GetYaxis()->SetBinLabel(
yBin, theLabel.c_str());
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]);
655 h2_uncBarycenterParameters->SetBinContent(4,
yBin, Xbarycenters[
i]);
656 h2_uncBarycenterParameters->SetBinContent(5,
yBin, Ybarycenters[
i]);
657 h2_uncBarycenterParameters->SetBinContent(6,
yBin, Zbarycenters[
i]);
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");
667 h2_uncBarycenterParameters->SetMarkerSize(1.5);
668 h2_uncBarycenterParameters->SetMarkerColor(kRed);
669 h2_uncBarycenterParameters->Draw(
"TEXTsame");
674 t1.SetTextSize(0.05);
675 t1.DrawLatex(0.5, 0.96, Form(
"Tracker Alignment Barycenters, IOV %i",
run));
676 t1.SetTextSize(0.025);
693 TrackerAlignmentBarycentersComparatorBase()
694 :
cond::payloadInspector::PlotImage<
Alignments>(
"Comparison of Tracker Alignment Barycenters") {}
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;
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);
704 auto firstiov = sorted_iovs.front();
705 unsigned int first_run = std::get<0>(firstiov);
707 auto lastiov = sorted_iovs.back();
708 unsigned int last_run = std::get<0>(lastiov);
710 std::shared_ptr<Alignments> last_payload =
fetchPayload(std::get<1>(lastiov));
711 std::vector<AlignTransform> last_alignments = last_payload->m_align;
713 std::shared_ptr<Alignments> first_payload =
fetchPayload(std::get<1>(firstiov));
714 std::vector<AlignTransform> first_alignments = first_payload->m_align;
720 const char *path_toTopologyXML = isInitialPhase0 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml"
721 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
726 path_toTopologyXML = isFinalPhase0 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml"
727 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
732 TCanvas
canvas(
"Tracker Alignment Barycenter Summary",
"Tracker Alignment Barycenter summary", 1200, 800);
735 canvas.SetTopMargin(0.07);
736 canvas.SetBottomMargin(0.06);
737 canvas.SetLeftMargin(0.15);
738 canvas.SetRightMargin(0.03);
742 auto h2_BarycenterDiff = std::unique_ptr<TH2F>(
743 new TH2F(
"Parameters diff",
"SubDetector Barycenter Difference", 3, 0.0, 3.0, 6, 0, 6.));
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]");
757 unsigned int yBin = 6;
758 for (
unsigned int i = 0;
i < 6;
i++) {
759 auto thePart = static_cast<AlignmentPI::partitions>(
i + 1);
761 h2_BarycenterDiff->GetYaxis()->SetBinLabel(
yBin, theLabel.c_str());
762 h2_BarycenterDiff->SetBinContent(
764 h2_BarycenterDiff->SetBinContent(
766 h2_BarycenterDiff->SetBinContent(
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");
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);
792 bool isInitialPhase0;
796 class TrackerAlignmentBarycentersCompare :
public TrackerAlignmentBarycentersComparatorBase {
798 TrackerAlignmentBarycentersCompare() : TrackerAlignmentBarycentersComparatorBase() { this->setSingleIov(
false); }
801 class TrackerAlignmentBarycentersCompareTwoTags :
public TrackerAlignmentBarycentersComparatorBase {
803 TrackerAlignmentBarycentersCompareTwoTags() : TrackerAlignmentBarycentersComparatorBase() {
804 this->setTwoTags(
true);
813 PixelBarycentersComparatorBase()
814 :
cond::payloadInspector::PlotImage<
Alignments>(
"Comparison of Pixel Barycenters") {}
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;
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);
824 auto firstiov = sorted_iovs.front();
825 unsigned int first_run = std::get<0>(firstiov);
827 auto lastiov = sorted_iovs.back();
828 unsigned int last_run = std::get<0>(lastiov);
830 std::shared_ptr<Alignments> last_payload =
fetchPayload(std::get<1>(lastiov));
831 std::vector<AlignTransform> last_alignments = last_payload->m_align;
833 std::shared_ptr<Alignments> first_payload =
fetchPayload(std::get<1>(firstiov));
834 std::vector<AlignTransform> first_alignments = first_payload->m_align;
836 TCanvas
canvas(
"Pixel Barycenter Summary",
"Pixel Barycenter summary", 1200, 1200);
843 t1.SetTextSize(0.03);
846 (
"Pixel Barycenters comparison, IOV: #color[2]{" + std::to_string(
first_run) +
847 "} vs IOV: #color[4]{" + std::to_string(
last_run) +
"}")
849 t1.SetTextSize(0.025);
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);
860 std::array<std::string, 3> structures = {{
"FPIX-",
"BPIX",
"FPIX+"}};
861 std::array<std::unique_ptr<TH2F>, 3>
histos;
867 const char *path_toTopologyXML = isInitialPhase0 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml"
868 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
878 path_toTopologyXML = isFinalPhase0 ?
"Geometry/TrackerCommonData/data/trackerParameters.xml"
879 :
"Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml";
889 if (isFinalPhase0 != isInitialPhase0) {
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.";
896 unsigned int index(0);
897 for (
const auto &piece : structures) {
898 const char *
name = piece.c_str();
901 Form(
"%s x-y Barycenter Difference;x_{%s}-x_{TOB} [mm];y_{%s}-y_{TOB} [mm]",
name,
name,
name),
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);
962 float x0i, x0f, y0i, y0f;
965 t1.SetTextSize(0.047);
966 for (
unsigned int c = 1;
c <= 3;
c++) {
967 x0i = cutFunctorInitial(
c).x() * 10;
968 x0f = cutFunctorFinal(
c).x() * 10;
969 y0i = cutFunctorInitial(
c).y() * 10;
970 y0f = cutFunctorFinal(
c).y() * 10;
975 COUT <<
"initial x,y " << std::left << std::setw(7) << structures[
c - 1] <<
" (" << x0i <<
"," << y0i <<
") mm"
977 COUT <<
"final x,y " << std::left << std::setw(7) << structures[
c - 1] <<
" (" << x0f <<
"," << y0f <<
") mm"
980 TMarker *initial =
new TMarker(x0i, y0i, 21);
981 TMarker *
final =
new TMarker(x0f, y0f, 20);
983 initial->SetMarkerColor(kRed);
984 final->SetMarkerColor(kBlue);
985 initial->SetMarkerSize(2.5);
986 final->SetMarkerSize(2.5);
987 t1.SetTextColor(kRed);
989 t1.DrawLatex(x0i, y0i - 0.5, Form(
"(%.2f,%.2f)", x0i, y0i));
991 t1.SetTextColor(kBlue);
992 t1.DrawLatex(x0f, y0f + 0.3, Form(
"(%.2f,%.2f)", x0f, y0f));
997 h2_ZBarycenterDiff->Draw();
1002 std::array<double, 3> hardcodeIdealZPhase0 = {{-41.94909, 0., 41.94909}};
1003 std::array<double, 3> hardcodeIdealZPhase1 = {{-39.82911, 0., 39.82911}};
1005 for (
unsigned int c = 1;
c <= 3;
c++) {
1009 (cutFunctorInitial(
c).z() - (isInitialPhase0 ? hardcodeIdealZPhase0[
c - 1] : hardcodeIdealZPhase1[
c - 1])) *
1012 (cutFunctorFinal(
c).z() - (isFinalPhase0 ? hardcodeIdealZPhase0[
c - 1] : hardcodeIdealZPhase1[
c - 1])) * 10;
1014 TMarker *initial =
new TMarker(
c - 1, z0i, 21);
1015 TMarker *
final =
new TMarker(
c - 1, z0f, 20);
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;
1020 initial->SetMarkerColor(kRed);
1021 final->SetMarkerColor(kBlue);
1022 initial->SetMarkerSize(2.5);
1023 final->SetMarkerSize(2.5);
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));
1039 bool isInitialPhase0;
1043 class PixelBarycentersCompare :
public PixelBarycentersComparatorBase {
1045 PixelBarycentersCompare() : PixelBarycentersComparatorBase() { this->setSingleIov(
false); }
1048 class PixelBarycentersCompareTwoTags :
public PixelBarycentersComparatorBase {
1050 PixelBarycentersCompareTwoTags() : PixelBarycentersComparatorBase() { this->setTwoTags(
true); }