17 #include "TPaveStats.h" 31 EcalGainRatiosPlot() :
cond::payloadInspector::PlotImage<
EcalGainRatios>(
"ECAL Gain Ratios - map ") {
35 bool fill(
const std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs)
override {
42 TH1F* b_12O6 =
new TH1F(
"b_12O6",
"EB gain 12/6", 50, 1.8, 2.1);
43 TH1F* e_12O6 =
new TH1F(
"e_12O6",
"EE gain 12/6", 50, 1.8, 2.1);
44 TH1F* b_6O1 =
new TH1F(
"b_6O1",
"EB gain 6/1", 100, 5.3, 6.3);
45 TH1F* e_6O1 =
new TH1F(
"e_6O1",
"EE gain 6/1", 100, 5.3, 6.3);
47 auto iov = iovs.front();
49 unsigned int run = std::get<0>(iov);
62 b_12O6->Fill((*
payload)[rawid].gain12Over6());
63 b_6O1->Fill((*
payload)[rawid].gain6Over1());
72 if (myEEId.zside() == 1) {
73 endc_p_12O6->Fill(myEEId.ix(), myEEId.iy(), (*payload)[rawid].gain12Over6());
74 endc_p_6O1->Fill(myEEId.ix(), myEEId.iy(), (*payload)[rawid].gain6Over1());
76 endc_m_12O6->Fill(myEEId.ix(), myEEId.iy(), (*payload)[rawid].gain12Over6());
77 endc_m_6O1->Fill(myEEId.ix(), myEEId.iy(), (*payload)[rawid].gain6Over1());
79 e_12O6->Fill((*
payload)[rawid].gain12Over6());
80 e_6O1->Fill((*
payload)[rawid].gain6Over1());
86 gStyle->SetPalette(1);
87 gStyle->SetOptStat(0);
88 TCanvas
canvas(
"CC map",
"CC map", 1680, 1320);
93 t1.DrawLatex(0.5, 0.96, Form(
"Ecal Gain Ratios, IOV %i",
run));
95 float xmi[3] = {0.0, 0.22, 0.78};
96 float xma[3] = {0.22, 0.78, 1.00};
97 TPad*** pad =
new TPad**[2];
98 for (
int gId = 0; gId < 2; gId++) {
99 pad[gId] =
new TPad*[3];
101 float yma = 0.94 - (0.32 * gId);
102 float ymi = yma - 0.28;
103 pad[gId][
obj] =
new TPad(Form(
"p_%i_%i",
obj, gId), Form(
"p_%i_%i",
obj, gId), xmi[
obj], ymi, xma[
obj], yma);
104 pad[gId][
obj]->Draw();
107 TPad**
pad1 =
new TPad*[4];
109 float xmi = 0.26 *
obj;
110 float xma = xmi + 0.22;
111 pad1[
obj] =
new TPad(Form(
"p1_%i",
obj), Form(
"p1_%i",
obj), xmi, 0.0, xma, 0.32);
115 float min12O6 = 1.8, max12O6 = 2.1, min6O1 = 5.3, max6O1 = 6.3;
117 DrawEE(endc_m_12O6, min12O6, max12O6);
118 endc_m_12O6->SetStats(
false);
120 DrawEB(barrel_12O6, min12O6, max12O6);
121 barrel_12O6->SetStats(
false);
123 DrawEE(endc_p_12O6, min12O6, max12O6);
124 endc_p_12O6->SetStats(
false);
126 DrawEE(endc_m_6O1, min6O1, max6O1);
127 endc_m_6O1->SetStats(
false);
129 DrawEB(barrel_6O1, min6O1, max6O1);
130 barrel_6O1->SetStats(
false);
132 DrawEE(endc_p_6O1, min6O1, max6O1);
133 endc_p_6O1->SetStats(
false);
135 gStyle->SetOptStat(111110);
139 TPaveStats* st = (TPaveStats*)b_12O6->FindObject(
"stats");
145 st = (TPaveStats*)e_12O6->FindObject(
"stats");
151 st = (TPaveStats*)b_6O1->FindObject(
"stats");
157 st = (TPaveStats*)e_6O1->FindObject(
"stats");
162 canvas.SaveAs(ImageName.c_str());
170 template <cond::payloadInspector::IOVMultiplicity nIOVs,
int ntags>
173 EcalGainRatiosDiffBase()
174 :
cond::payloadInspector::PlotImage<
EcalGainRatios, nIOVs, ntags>(
"ECAL Gain Ratios difference") {}
176 bool fill()
override {
189 TH1F* b_12O6 =
new TH1F(
"b_12O6",
"EB gain 12/6 difference", 50, -0.1, 0.1);
190 TH1F* e_12O6 =
new TH1F(
"e_12O6",
"EE gain 12/6 difference", 50, -0.1, 0.1);
191 TH1F* b_6O1 =
new TH1F(
"b_6O1",
"EB gain 6/1 difference", 100, -0.1, 0.1);
192 TH1F* e_6O1 =
new TH1F(
"e_6O1",
"EE gain 6/1 difference", 100, -0.1, 0.1);
197 auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs;
198 l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().
name;
199 auto firstiov = iovs.front();
200 run[0] = std::get<0>(firstiov);
201 std::tuple<cond::Time_t, cond::Hash> lastiov;
203 auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs;
204 l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().
name;
205 lastiov = tag2iovs.front();
207 lastiov = iovs.back();
208 l_tagname[1] = l_tagname[0];
210 run[1] = std::get<0>(lastiov);
211 for (
int irun = 0; irun < nIOVs; irun++) {
212 std::shared_ptr<EcalGainRatios>
payload;
223 gEB[0][cellid] = (*payload)[rawid].gain12Over6();
224 gEB[1][cellid] = (*payload)[rawid].gain6Over1();
232 float diff = gEB[0][cellid] - (*payload)[rawid].gain12Over6();
235 diff = gEB[1][cellid] - (*payload)[rawid].gain6Over1();
248 gEE[0][cellid] = (*payload)[rawid].gain12Over6();
249 gEE[1][cellid] = (*payload)[rawid].gain6Over1();
251 float diff1 = gEE[0][cellid] - (*payload)[rawid].gain12Over6();
252 float diff2 = gEE[1][cellid] - (*payload)[rawid].gain6Over1();
253 if (myEEId.zside() == 1) {
254 endc_p_12O6->Fill(myEEId.ix(), myEEId.iy(), diff1);
255 endc_p_6O1->Fill(myEEId.ix(), myEEId.iy(), diff2);
257 endc_m_12O6->Fill(myEEId.ix(), myEEId.iy(), diff1);
258 endc_m_6O1->Fill(myEEId.ix(), myEEId.iy(), diff2);
269 gStyle->SetPalette(1);
270 gStyle->SetOptStat(0);
271 TCanvas
canvas(
"CC map",
"CC map", 1680, 1320);
275 int len = l_tagname[0].length() + l_tagname[1].length();
276 if (ntags == 2 && len < 70) {
277 t1.SetTextSize(0.03);
279 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]));
281 t1.SetTextSize(0.05);
282 t1.DrawLatex(0.5, 0.96, Form(
"%s, IOV %i - %i", l_tagname[0].c_str(),
run[1],
run[0]));
285 float xmi[3] = {0.0, 0.22, 0.78};
286 float xma[3] = {0.22, 0.78, 1.00};
287 TPad*** pad =
new TPad**[2];
288 for (
int gId = 0; gId < 2; gId++) {
289 pad[gId] =
new TPad*[3];
291 float yma = 0.94 - (0.32 * gId);
292 float ymi = yma - 0.28;
293 pad[gId][
obj] =
new TPad(Form(
"p_%i_%i",
obj, gId), Form(
"p_%i_%i",
obj, gId), xmi[
obj], ymi, xma[
obj], yma);
294 pad[gId][
obj]->Draw();
297 TPad**
pad1 =
new TPad*[4];
299 float xmi = 0.26 *
obj;
300 float xma = xmi + 0.22;
301 pad1[
obj] =
new TPad(Form(
"p1_%i",
obj), Form(
"p1_%i",
obj), xmi, 0.0, xma, 0.32);
305 float min12O6 = -0.1, max12O6 = 0.1, min6O1 = -0.1, max6O1 = 0.1;
307 DrawEE(endc_m_12O6, min12O6, max12O6);
308 endc_m_12O6->SetStats(
false);
310 DrawEB(barrel_12O6, min12O6, max12O6);
311 barrel_12O6->SetStats(
false);
313 DrawEE(endc_p_12O6, min12O6, max12O6);
314 endc_p_12O6->SetStats(
false);
316 DrawEE(endc_m_6O1, min6O1, max6O1);
317 endc_m_6O1->SetStats(
false);
319 DrawEB(barrel_6O1, min6O1, max6O1);
320 barrel_6O1->SetStats(
false);
322 DrawEE(endc_p_6O1, min6O1, max6O1);
323 endc_p_6O1->SetStats(
false);
325 gStyle->SetOptStat(111110);
329 TPaveStats* st = (TPaveStats*)b_12O6->FindObject(
"stats");
335 st = (TPaveStats*)e_12O6->FindObject(
"stats");
341 st = (TPaveStats*)b_6O1->FindObject(
"stats");
347 st = (TPaveStats*)e_6O1->FindObject(
"stats");
352 canvas.SaveAs(ImageName.c_str());
356 using EcalGainRatiosDiffOneTag = EcalGainRatiosDiffBase<cond::payloadInspector::SINGLE_IOV, 1>;
357 using EcalGainRatiosDiffTwoTags = EcalGainRatiosDiffBase<cond::payloadInspector::SINGLE_IOV, 2>;
static EEDetId unhashIndex(int hi)
static bool validHashIndex(int i)
void DrawEE(TH2F *endc, float min, float max)
void DrawEB(TH2F *ebmap, float min, float max)
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)