24 enum {MIN_IETA = 1, MIN_IPHI = 1, MAX_IETA = 85, MAX_IPHI = 360, EBhistEtaMax = 171};
25 enum {IX_MIN = 1, IY_MIN = 1, IX_MAX = 100, IY_MAX = 100, EEhistXMax = 220};
38 EcalLaserAPDPNRatiosEBMap() :
cond::payloadInspector::Histogram2D<
EcalLaserAPDPNRatios>(
"ECAL Barrel APDPNRatios - map ",
39 "iphi", MAX_IPHI, MIN_IPHI, MAX_IPHI + 1,
40 "ieta", EBhistEtaMax, -MAX_IETA, MAX_IETA + 1) {
45 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
47 for (
auto const & iov: iovs) {
51 for(
int iphi = 1; iphi < 361; iphi++)
fillWithValue(iphi, 0, -1);
55 float p2 = (payload->getLaserMap())[rawid].p2;
72 EcalLaserAPDPNRatiosEEMap() :
cond::payloadInspector::Histogram2D<
EcalLaserAPDPNRatios>(
"ECAL Endcap APDPNRatios - map ",
73 "ix", EEhistXMax, IX_MIN, EEhistXMax + 1,
74 "iy", IY_MAX, IY_MIN, IY_MAX + 1) {
75 Base::setSingleIov(
true );
78 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
80 for (
auto const & iov: iovs) {
81 std::shared_ptr<EcalLaserAPDPNRatios> payload = Base::fetchPayload( std::get<1>(iov) );
85 for(
int ix = IX_MIN; ix < EEhistXMax + 1; ix++)
86 for(
int iy = IY_MAX; iy < IY_MAX + 1; iy++)
87 fillWithValue(ix, iy, -1);
92 float p2 = (payload->getLaserMap())[rawid].p2;
94 if(myEEId.zside() == -1)
95 fillWithValue(myEEId.ix(), myEEId.iy(),
p2);
97 fillWithValue(myEEId.ix() + IX_MAX + EEhistSplit, myEEId.iy(),
p2);
111 EcalLaserAPDPNRatiosPlot() :
cond::payloadInspector::PlotImage<
EcalLaserAPDPNRatios>(
"ECAL Laser APDPNRatios - map ") {
112 setSingleIov(
true );
115 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
116 TH2F**
barrel =
new TH2F*[3];
117 TH2F** endc_p =
new TH2F*[3];
118 TH2F** endc_m =
new TH2F*[3];
119 float pEBmin[3], pEEmin[3];
121 for (
int i = 0;
i < 3;
i++) {
122 barrel[
i] =
new TH2F(Form(
"EBp%i",
i),Form(
"EB p%i",
i+1),MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA);
123 endc_p[
i] =
new TH2F(Form(
"EE+p%i",
i),Form(
"EE+ p%i",
i+1),IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1);
124 endc_m[
i] =
new TH2F(Form(
"EE-p%i",
i),Form(
"EE- p%i",
i+1),IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1);
129 auto iov = iovs.front();
130 std::shared_ptr<EcalLaserAPDPNRatios> payload = fetchPayload( std::get<1>(iov) );
131 unsigned long IOV = std::get<0>(iov);
133 if(IOV < 4294967296) run = std::get<0>(iov);
140 Double_t
phi = (Double_t)(
EBDetId(rawid)).iphi() - 0.5;
141 Double_t
eta = (Double_t)(
EBDetId(rawid)).ieta();
142 if(eta > 0.) eta = eta - 0.5;
143 else eta = eta + 0.5;
144 float p1 = (payload->getLaserMap())[rawid].p1;
145 if(p1 < pEBmin[0]) pEBmin[0] =
p1;
146 float p2 = (payload->getLaserMap())[rawid].p2;
147 if(p2 < pEBmin[1]) pEBmin[1] =
p2;
148 float p3 = (payload->getLaserMap())[rawid].p3;
149 if(p3 < pEBmin[2]) pEBmin[2] =
p3;
150 barrel[0]->Fill(phi, eta, p1);
151 barrel[1]->Fill(phi, eta, p2);
152 barrel[2]->Fill(phi, eta, p3);
160 float p1 = (payload->getLaserMap())[rawid].p1;
161 if(p1 < pEEmin[0]) pEEmin[0] =
p1;
162 float p2 = (payload->getLaserMap())[rawid].p2;
163 if(p2 < pEEmin[1]) pEEmin[1] =
p2;
164 float p3 = (payload->getLaserMap())[rawid].p3;
165 if(p3 < pEEmin[2]) pEEmin[2] =
p3;
166 if (myEEId.zside() == 1) {
167 endc_p[0]->Fill(myEEId.ix(), myEEId.iy(),
p1);
168 endc_p[1]->Fill(myEEId.ix(), myEEId.iy(),
p2);
169 endc_p[2]->Fill(myEEId.ix(), myEEId.iy(),
p3);
172 endc_m[0]->Fill(myEEId.ix(), myEEId.iy(),
p1);
173 endc_m[1]->Fill(myEEId.ix(), myEEId.iy(),
p2);
174 endc_m[2]->Fill(myEEId.ix(), myEEId.iy(),
p3);
180 gStyle->SetPalette(1);
181 gStyle->SetOptStat(0);
182 TCanvas
canvas(
"CC map",
"CC map",2800,2600);
186 t1.SetTextSize(0.05);
188 t1.DrawLatex(0.5, 0.96, Form(
"Ecal Laser APD/PN, IOV %i", run));
193 localtime_r(&t, <);
194 strftime(buf,
sizeof(buf),
"%F %R:%S", <);
195 buf[
sizeof(buf)-1] = 0;
196 t1.DrawLatex(0.5, 0.96, Form(
"Ecal Laser APD/PN, IOV %s", buf));
199 float xmi[3] = {0.0 , 0.26, 0.74};
200 float xma[3] = {0.26, 0.74, 1.00};
201 TPad*** pad =
new TPad**[3];
202 for (
int i = 0;
i < 3;
i++) {
203 pad[
i] =
new TPad*[3];
205 float yma = 0.94 - (0.32 *
i);
206 float ymi = yma - 0.28;
207 pad[
i][
obj] =
new TPad(Form(
"p_%i_%i",
obj,
i),Form(
"p_%i_%i",
obj,
i),
208 xmi[
obj], ymi, xma[obj], yma);
213 for (
int i = 0;
i < 3;
i++) {
216 float xmin = pEBmin[
i] * 10.;
218 pEBmin[
i] = (
float)min /10.;
220 xmin = pEEmin[
i] * 10.;
222 pEEmin[
i] = (
float)min /10.;
225 DrawEE(endc_m[
i], pEEmin[i], 1.1);
227 DrawEB(barrel[
i], pEBmin[i], 1.1);
229 DrawEE(endc_p[
i], pEEmin[i], 1.1);
233 canvas.SaveAs(ImageName.c_str());
244 EcalLaserAPDPNRatiosDiff() :
cond::payloadInspector::PlotImage<
EcalLaserAPDPNRatios>(
"ECAL Laser APDPNRatios difference") {
248 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
249 TH2F** barrel =
new TH2F*[3];
250 TH2F** endc_p =
new TH2F*[3];
251 TH2F** endc_m =
new TH2F*[3];
252 float pEBmin[3], pEEmin[3], pEBmax[3], pEEmax[3];
255 for (
int i = 0;
i < 3;
i++) {
256 barrel[
i] =
new TH2F(Form(
"EBp%i",
i),Form(
"EB p%i",
i+1),MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA);
257 endc_p[
i] =
new TH2F(Form(
"EE+p%i",
i),Form(
"EE+ p%i",
i+1),IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1);
258 endc_m[
i] =
new TH2F(Form(
"EE-p%i",
i),Form(
"EE- p%i",
i+1),IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1);
264 unsigned int run[2] = {0, 0}, irun = 0;
265 unsigned long IOV = 0;
267 for (
auto const & iov: iovs) {
268 std::shared_ptr<EcalLaserAPDPNRatios> payload = fetchPayload( std::get<1>(iov) );
269 IOV = std::get<0>(iov);
270 if(IOV < 4294967296) run[irun] = std::get<0>(iov);
272 run[irun] = IOV >> 32;
278 pEB[0][cellid] = (payload->getLaserMap())[rawid].p1;
279 pEB[1][cellid] = (payload->getLaserMap())[rawid].p2;
280 pEB[2][cellid] = (payload->getLaserMap())[rawid].p3;
283 Double_t phi = (Double_t)(
EBDetId(rawid)).iphi() - 0.5;
284 Double_t eta = (Double_t)(
EBDetId(rawid)).ieta();
285 if(eta > 0.) eta = eta - 0.5;
286 else eta = eta + 0.5;
287 double diff = (payload->getLaserMap())[rawid].p1 - pEB[0][cellid];
288 if(diff < pEBmin[0]) pEBmin[0] =
diff;
289 if(diff > pEBmax[0]) pEBmax[0] =
diff;
290 barrel[0]->Fill(phi, eta, diff);
291 diff = (payload->getLaserMap())[rawid].p2 - pEB[1][cellid];
292 if(diff < pEBmin[1]) pEBmin[1] =
diff;
293 if(diff > pEBmax[1]) pEBmax[1] =
diff;
294 barrel[1]->Fill(phi, eta, diff);
295 diff = (payload->getLaserMap())[rawid].p3 - pEB[2][cellid];
296 if(diff < pEBmin[2]) pEBmin[2] =
diff;
297 if(diff > pEBmax[2]) pEBmax[2] =
diff;
298 barrel[2]->Fill(phi, eta, diff);
308 pEE[0][cellid] = (payload->getLaserMap())[rawid].p1;
309 pEE[1][cellid] = (payload->getLaserMap())[rawid].p2;
310 pEE[2][cellid] = (payload->getLaserMap())[rawid].p3;
313 double diff1 = (payload->getLaserMap())[rawid].p1 - pEE[0][cellid];
314 if(diff1 < pEEmin[0]) pEEmin[0] = diff1;
315 if(diff1 > pEEmax[0]) pEEmax[0] = diff1;
316 double diff2 = (payload->getLaserMap())[rawid].p2 - pEE[1][cellid];
317 if(diff2 < pEEmin[1]) pEEmin[1] = diff2;
318 if(diff2 > pEEmax[1]) pEEmax[1] = diff2;
319 double diff3 = (payload->getLaserMap())[rawid].p3 - pEE[2][cellid];
320 if(diff3 < pEEmin[2]) pEEmin[2] = diff3;
321 if(diff3 > pEEmax[2]) pEEmax[2] = diff3;
322 if (myEEId.zside() == 1) {
323 endc_p[0]->Fill(myEEId.ix(), myEEId.iy(), diff1);
324 endc_p[1]->Fill(myEEId.ix(), myEEId.iy(), diff2);
325 endc_p[2]->Fill(myEEId.ix(), myEEId.iy(), diff3);
328 endc_m[0]->Fill(myEEId.ix(), myEEId.iy(), diff1);
329 endc_m[1]->Fill(myEEId.ix(), myEEId.iy(), diff2);
330 endc_m[2]->Fill(myEEId.ix(), myEEId.iy(), diff3);
339 gStyle->SetPalette(1);
340 gStyle->SetOptStat(0);
341 TCanvas
canvas(
"CC map",
"CC map",2800,2600);
345 t1.SetTextSize(0.05);
346 if(IOV < 4294967296) {
347 t1.SetTextSize(0.05);
348 t1.DrawLatex(0.5, 0.96, Form(
"Ecal Laser APD/PN, IOV %i - %i", run[1], run[0]));
352 char buf0[256], buf1[256];
354 localtime_r(&t, <);
355 strftime(buf0,
sizeof(buf0),
"%F %R:%S", <);
356 buf0[
sizeof(buf0)-1] = 0;
358 localtime_r(&t, <);
359 strftime(buf1,
sizeof(buf1),
"%F %R:%S", <);
360 buf1[
sizeof(buf1)-1] = 0;
361 t1.SetTextSize(0.015);
362 t1.DrawLatex(0.5, 0.96, Form(
"Ecal Laser APD/PN, IOV %s - %s", buf1, buf0));
365 float xmi[3] = {0.0 , 0.24, 0.76};
366 float xma[3] = {0.24, 0.76, 1.00};
367 TPad*** pad =
new TPad**[3];
368 for (
int i = 0;
i < 3;
i++) {
369 pad[
i] =
new TPad*[3];
371 float yma = 0.94 - (0.32 *
i);
372 float ymi = yma - 0.28;
373 pad[
i][
obj] =
new TPad(Form(
"p_%i_%i",
obj,
i),Form(
"p_%i_%i",
obj,
i),
374 xmi[
obj], ymi, xma[obj], yma);
379 for (
int i = 0;
i < 3;
i++) {
382 float xmin = (pEBmin[
i] - 0.009) * 100.;
384 pEBmin[
i] = (
float)min /100.;
385 float xmax = (pEBmax[
i] + 0.009) * 100.;
387 pEBmax[
i] = (
float)max /100.;
389 xmin = (pEEmin[
i] + 0.009) * 100.;
391 pEEmin[
i] = (
float)min /100.;
392 xmax = (pEEmax[
i] + 0.009) * 100.;
394 pEEmax[
i] = (
float)max /100.;
397 DrawEE(endc_m[
i], pEEmin[i], pEEmax[i]);
398 endc_m[
i]->GetZaxis()->SetLabelSize(0.02);
400 DrawEB(barrel[
i], pEBmin[i], pEBmax[i]);
402 DrawEE(endc_p[
i], pEEmin[i], pEEmax[i]);
403 endc_p[
i]->GetZaxis()->SetLabelSize(0.02);
407 canvas.SaveAs(ImageName.c_str());
void fillWithValue(float xvalue, float yvalue, float weight=1)
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)
bool fill(const std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs) override
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
static const int MIN_HASH
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
void setSingleIov(bool flag)
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)