17 #include "TPaveStats.h" 23 enum {MIN_IETA = 1, MIN_IPHI = 1, MAX_IETA = 85, MAX_IPHI = 360};
24 enum {IX_MIN = 1, IY_MIN = 1, IX_MAX = 100, IY_MAX = 100};
31 EcalAlignmentPlot() :
cond::payloadInspector::PlotImage<
Alignments>(
"ECAL Alignment - map ") {
35 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
36 auto iov = iovs.front();
38 unsigned int run = std::get<0>(iov);
43 NbRows = (*payload).m_align.size();
44 if(NbRows == 36) subdet =
"EB";
45 else if(NbRows == 4) subdet =
"EE";
46 else if(NbRows == 8) subdet =
"ES";
47 else subdet =
"unknown";
49 align =
new TH2F(
"Align",
"x y z Phi Theta Psi",
50 6, 0, 6, NbRows, 0, NbRows);
51 double row = NbRows - 0.5;
52 for(std::vector<AlignTransform>::const_iterator it = (*payload).m_align.begin();
53 it != (*payload).m_align.end(); it++ ) {
54 align->Fill(0.5, row, (*it).translation().x());
55 align->Fill(1.5, row, (*it).translation().y());
56 align->Fill(2.5, row, (*it).translation().z());
57 align->Fill(3.5, row, (*it).rotation().getPhi());
58 align->Fill(4.5, row, (*it).rotation().getTheta());
59 align->Fill(5.5, row, (*it).rotation().getPsi());
65 gStyle->SetPalette(1);
66 gStyle->SetOptStat(0);
67 TCanvas
canvas(
"CC map",
"CC map",1000,1000);
73 t1.DrawLatex(0.5, 0.96, Form(
"Ecal %s Alignment, IOV %i", subdet.c_str(),
run));
77 TPad* pad =
new TPad(
"pad",
"pad", 0.0, 0.0, 1.0, 0.94);
83 for(
int i = 1;
i < NbRows;
i++) {
85 l =
new TLine(0., y, 6., y);
88 for(
int i = 1;
i < 6;
i++) {
90 double y = (double)NbRows;
91 l =
new TLine(x, 0., x, y);
94 align->GetXaxis()->SetTickLength(0.);
95 align->GetXaxis()->SetLabelSize(0.);
96 align->GetYaxis()->SetTickLength(0.);
97 align->GetYaxis()->SetLabelSize(0.);
100 canvas.SaveAs(ImageName.c_str());
111 EcalAlignmentDiff() :
cond::payloadInspector::PlotImage<
Alignments>(
"ECAL Alignment difference") {
115 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
116 unsigned int run[2], irun = 0;
118 TH2F* align =
new TH2F(
"",
"", 1, 0., 1., 1, 0., 1.);
121 for (
auto const & iov: iovs) {
122 std::shared_ptr<Alignments> payload = fetchPayload( std::get<1>(iov) );
123 run[irun] = std::get<0>(iov);
125 NbRows = (*payload).m_align.size();
127 if(NbRows == 36) subdet =
"EB";
128 else if(NbRows == 4) subdet =
"EE";
129 else if(NbRows == 8) subdet =
"ES";
130 else subdet =
"unknown";
132 align =
new TH2F(
"Align",
"x y z Phi Theta Psi",
133 6, 0, 6, NbRows, 0, NbRows);
135 double row = NbRows - 0.5;
137 for(std::vector<AlignTransform>::const_iterator it = (*payload).m_align.begin();
138 it != (*payload).m_align.end(); it++ ) {
140 val[0][irow] = (*it).translation().x();
141 val[1][irow] = (*it).translation().y();
142 val[2][irow] = (*it).translation().z();
143 val[3][irow] = (*it).rotation().getPhi();
144 val[4][irow] = (*it).rotation().getTheta();
145 val[5][irow] = (*it).rotation().getPsi();
148 align->Fill(0.5, row, (*it).translation().x()- val[0][irow]);
149 align->Fill(1.5, row, (*it).translation().y() - val[1][irow]);
150 align->Fill(2.5, row, (*it).translation().z() - val[2][irow]);
151 align->Fill(3.5, row, (*it).rotation().getPhi() - val[3][irow]);
152 align->Fill(4.5, row, (*it).rotation().getTheta() - val[3][irow]);
153 align->Fill(5.5, row, (*it).rotation().getPsi() - val[5][irow]);
163 gStyle->SetPalette(1);
164 gStyle->SetOptStat(0);
165 TCanvas
canvas(
"CC map",
"CC map",1000,1000);
169 t1.SetTextSize(0.05);
171 t1.DrawLatex(0.5, 0.96, Form(
"Ecal %s Alignment, IOV %i - %i", subdet.c_str(), run[1], run[0]));
173 TPad* pad =
new TPad(
"pad",
"pad", 0.0, 0.0, 1.0, 0.94);
177 TLine* l =
new TLine;
179 for(
int i = 1;
i < NbRows;
i++) {
180 double y = (double)
i;
181 l =
new TLine(0., y, 6., y);
184 for(
int i = 1;
i < 6;
i++) {
185 double x = (double)
i;
186 double y = (double)NbRows;
187 l =
new TLine(x, 0., x, y);
190 align->GetXaxis()->SetTickLength(0.);
191 align->GetXaxis()->SetLabelSize(0.);
192 align->GetYaxis()->SetTickLength(0.);
193 align->GetYaxis()->SetLabelSize(0.);
196 canvas.SaveAs(ImageName.c_str());
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
virtual bool fill(const std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs)=0
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
void setSingleIov(bool flag)