17 #include "TPaveStats.h"
36 EcalAlignmentPlot() : cond::payloadInspector::PlotImage<
Alignments>(
"ECAL Alignment - map ") { setSingleIov(
true); }
39 auto iov =
iovs.front();
40 std::shared_ptr<Alignments>
payload =
42 unsigned int run = std::get<0>(iov);
47 NbRows = (*payload).m_align.size();
57 align =
new TH2F(
"Align",
58 "x y z Phi Theta Psi",
66 double row = NbRows - 0.5;
67 for (std::vector<AlignTransform>::const_iterator it = (*payload).m_align.begin();
68 it != (*payload).m_align.end();
70 align->Fill(0.5, row, (*it).translation().x());
71 align->Fill(1.5, row, (*it).translation().y());
72 align->Fill(2.5, row, (*it).translation().z());
73 align->Fill(3.5, row, (*it).rotation().getPhi());
74 align->Fill(4.5, row, (*it).rotation().getTheta());
75 align->Fill(5.5, row, (*it).rotation().getPsi());
82 gStyle->SetPalette(1);
83 gStyle->SetOptStat(0);
84 TCanvas
canvas(
"CC map",
"CC map", 1000, 1000);
90 t1.DrawLatex(0.5, 0.96, Form(
"Ecal %s Alignment, IOV %i", subdet.c_str(),
run));
94 TPad* pad =
new TPad(
"pad",
"pad", 0.0, 0.0, 1.0, 0.94);
100 for (
int i = 1;
i < NbRows;
i++) {
101 double y = (double)
i;
102 l =
new TLine(0., y, 6., y);
106 for (
int i = 1;
i < 6;
i++) {
107 double x = (double)
i;
108 double y = (double)NbRows;
109 l =
new TLine(x, 0., x, y);
113 align->GetXaxis()->SetTickLength(0.);
114 align->GetXaxis()->SetLabelSize(0.);
115 align->GetYaxis()->SetTickLength(0.);
116 align->GetYaxis()->SetLabelSize(0.);
119 canvas.SaveAs(ImageName.c_str());
127 template <cond::payloadInspector::IOVMultiplicity nIOVs,
int ntags>
130 EcalAlignmentDiffBase()
131 : cond::payloadInspector::PlotImage<
Alignments, nIOVs, ntags>(
"ECAL Alignment difference") {}
133 bool fill()
override {
136 TH2F* align =
new TH2F(
"",
"", 1, 0., 1., 1, 0., 1.);
141 auto iovs = cond::payloadInspector::PlotBase::getTag<0>().
iovs;
142 l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().
name;
143 auto firstiov =
iovs.front();
144 run[0] = std::get<0>(firstiov);
145 std::tuple<cond::Time_t, cond::Hash> lastiov;
147 auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().
iovs;
148 l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().
name;
149 lastiov = tag2iovs.front();
151 lastiov =
iovs.back();
152 l_tagname[1] = l_tagname[0];
154 run[1] = std::get<0>(lastiov);
156 for (
int irun = 0; irun < nIOVs; irun++) {
157 std::shared_ptr<Alignments>
payload;
165 NbRows = (*payload).m_align.size();
169 else if (NbRows == 4)
171 else if (NbRows == 8)
176 align =
new TH2F(
"Align",
177 "x y z Phi Theta Psi",
186 double row = NbRows - 0.5;
188 for (std::vector<AlignTransform>::const_iterator it = (*payload).m_align.begin();
189 it != (*payload).m_align.end();
192 val[0][irow] = (*it).translation().x();
193 val[1][irow] = (*it).translation().y();
194 val[2][irow] = (*it).translation().z();
195 val[3][irow] = (*it).rotation().getPhi();
196 val[4][irow] = (*it).rotation().getTheta();
197 val[5][irow] = (*it).rotation().getPsi();
199 align->Fill(0.5, row, (*it).translation().x() - val[0][irow]);
200 align->Fill(1.5, row, (*it).translation().y() - val[1][irow]);
201 align->Fill(2.5, row, (*it).translation().z() - val[2][irow]);
202 align->Fill(3.5, row, (*it).rotation().getPhi() - val[3][irow]);
203 align->Fill(4.5, row, (*it).rotation().getTheta() - val[3][irow]);
204 align->Fill(5.5, row, (*it).rotation().getPsi() - val[5][irow]);
215 gStyle->SetPalette(1);
216 gStyle->SetOptStat(0);
217 TCanvas
canvas(
"CC map",
"CC map", 1000, 1000);
222 int len = l_tagname[0].length() + l_tagname[1].length();
223 if (ntags == 2 && len < 58) {
224 t1.SetTextSize(0.025);
226 0.5, 0.96, Form(
"%s IOV %i - %s IOV %i", l_tagname[1].c_str(), run[1], l_tagname[0].c_str(), run[0]));
228 t1.SetTextSize(0.05);
229 t1.DrawLatex(0.5, 0.96, Form(
"Ecal %s Alignment, IOV %i - %i", subdet.c_str(), run[1], run[0]));
231 TPad* pad =
new TPad(
"pad",
"pad", 0.0, 0.0, 1.0, 0.94);
235 TLine* l =
new TLine;
238 for (
int i = 1;
i < NbRows;
i++) {
239 double y = (double)
i;
240 l =
new TLine(0., y, 6., y);
244 for (
int i = 1;
i < 6;
i++) {
245 double x = (double)
i;
246 double y = (double)NbRows;
247 l =
new TLine(x, 0., x, y);
251 align->GetXaxis()->SetTickLength(0.);
252 align->GetXaxis()->SetLabelSize(0.);
253 align->GetYaxis()->SetTickLength(0.);
254 align->GetYaxis()->SetLabelSize(0.);
257 canvas.SaveAs(ImageName.c_str());
261 using EcalAlignmentDiffOneTag = EcalAlignmentDiffBase<cond::payloadInspector::SINGLE_IOV, 1>;
262 using EcalAlignmentDiffTwoTags = EcalAlignmentDiffBase<cond::payloadInspector::SINGLE_IOV, 2>;
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)