20 enum {MIN_IETA = 1, MIN_IPHI = 1, MAX_IETA = 85, MAX_IPHI = 360};
21 enum {IX_MIN = 1, IY_MIN = 1, IX_MAX = 100, IY_MAX = 100};
33 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
34 TH2F*
barrel =
new TH2F(
"EB",
"EB", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA);
35 TH2F* endc_p =
new TH2F(
"EE+",
"EE+", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1);
36 TH2F* endc_m =
new TH2F(
"EE-",
"EE-", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1);
37 double EBmean = 0., EBrms = 0., EEmean = 0., EErms = 0.;
38 int EBtot = 0, EEtot = 0;
40 auto iov = iovs.front();
42 unsigned int run = std::get<0>(iov);
44 for (
int ieta = -MAX_IETA; ieta <= MAX_IETA; ieta++) {
45 Double_t
eta = (Double_t)ieta;
46 if(ieta == 0)
continue;
47 else if(ieta > 0.) eta = eta - 0.5;
49 for (
int iphi = 1; iphi <= MAX_IPHI; iphi++) {
50 Double_t
phi = (Double_t)iphi - 0.5;
52 double val = (*payload)[
id.rawId()];
53 barrel->Fill(phi, eta, val);
54 EBmean = EBmean +
val;
55 EBrms = EBrms + val *
val;
61 int thesign =
sign==1 ? 1:-1;
62 for (
int ix = 1; ix <= IX_MAX; ix++) {
63 for (
int iy = 1; iy <= IY_MAX; iy++) {
66 double val = (*payload)[
id.rawId()];
67 EEmean = EEmean +
val;
68 EErms = EErms + val *
val;
71 endc_p->Fill(ix, iy, val);
73 endc_m->Fill(ix, iy, val);
78 double vt =(double)EBtot;
80 EBrms = EBrms / vt - (EBmean * EBmean);
82 if(EBrms == 0.) EBrms = 0.001;
83 double pEBmin = EBmean - kRMS * EBrms;
84 double pEBmax = EBmean + kRMS * EBrms;
88 EErms = EErms / vt - (EEmean * EEmean);
90 if(EErms == 0.) EErms = 0.001;
91 double pEEmin = EEmean - kRMS * EErms;
92 double pEEmax = EEmean + kRMS * EErms;
95 gStyle->SetPalette(1);
96 gStyle->SetOptStat(0);
97 TCanvas
canvas(
"CC map",
"CC map", 1600, 450);
101 t1.SetTextSize(0.05);
102 t1.DrawLatex(0.5, 0.96, Form(
"Ecal FloatCondObjectContainer, IOV %i", run));
104 float xmi[3] = {0.0 , 0.24, 0.76};
105 float xma[3] = {0.24, 0.76, 1.00};
106 TPad** pad =
new TPad*;
108 pad[
obj] =
new TPad(Form(
"p_%i",
obj),Form(
"p_%i",
obj), xmi[
obj], 0.0, xma[obj], 0.94);
113 DrawEE(endc_m, pEEmin, pEEmax);
115 DrawEB(barrel, pEBmin, pEBmax);
117 DrawEE(endc_p, pEEmin, pEEmax);
120 canvas.SaveAs(ImageName.c_str());
135 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
136 TH2F* barrel =
new TH2F(
"EB",
"EB difference", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA);
137 TH2F* endc_p =
new TH2F(
"EE+",
"EE+ difference", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1);
138 TH2F* endc_m =
new TH2F(
"EE-",
"EE- difference", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1);
139 double EBmean = 0., EBrms = 0., EEmean = 0., EErms = 0.;
140 int EBtot = 0, EEtot = 0;
143 unsigned int run[2], irun = 0;
145 for (
auto const & iov: iovs) {
146 std::shared_ptr<EcalFloatCondObjectContainer> payload = fetchPayload( std::get<1>(iov) );
147 run[irun] = std::get<0>(iov);
149 for (
int ieta = -MAX_IETA; ieta <= MAX_IETA; ieta++) {
150 Double_t eta = (Double_t)ieta;
151 if(ieta == 0)
continue;
152 else if(ieta > 0.) eta = eta - 0.5;
153 else eta = eta + 0.5;
154 for (
int iphi = 1; iphi <= MAX_IPHI; iphi++) {
155 Double_t phi = (Double_t)iphi - 0.5;
157 int channel =
id.hashedIndex();
158 double val = (*payload)[
id.rawId()];
159 if(irun == 0) vEB[channel] =
val;
161 double diff = val - vEB[channel];
162 barrel->Fill(phi, eta, diff);
163 EBmean = EBmean +
diff;
164 EBrms = EBrms + diff *
diff;
172 int thesign =
sign==1 ? 1:-1;
173 for (
int ix = 1; ix <= IX_MAX; ix++) {
174 for (
int iy = 1; iy <= IY_MAX; iy++) {
177 int channel =
id.hashedIndex();
178 double val = (*payload)[
id.rawId()];
179 if(irun == 0) vEE[channel] =
val;
181 double diff = val - vEE[channel];
182 EEmean = EEmean +
diff;
183 EErms = EErms + diff *
diff;
186 endc_p->Fill(ix, iy, diff);
188 endc_m->Fill(ix, iy, diff);
198 double vt =(double)EBtot;
199 EBmean = EBmean / vt;
200 EBrms = EBrms / vt - (EBmean * EBmean);
202 if(EBrms == 0.) EBrms = 0.001;
203 double pEBmin = EBmean - kRMS * EBrms;
204 double pEBmax = EBmean + kRMS * EBrms;
207 EEmean = EEmean / vt;
208 EErms = EErms / vt - (EEmean * EEmean);
210 if(EErms == 0.) EErms = 0.001;
211 double pEEmin = EEmean - kRMS * EErms;
212 double pEEmax = EEmean + kRMS * EErms;
215 gStyle->SetPalette(1);
216 gStyle->SetOptStat(0);
217 TCanvas
canvas(
"CC map",
"CC map", 1600, 450);
221 t1.SetTextSize(0.05);
222 t1.DrawLatex(0.5, 0.96, Form(
"Ecal FloatCondObjectContainer, IOV %i - %i", run[1], run[0]));
224 float xmi[3] = {0.0 , 0.24, 0.76};
225 float xma[3] = {0.24, 0.76, 1.00};
226 TPad** pad =
new TPad*;
228 pad[
obj] =
new TPad(Form(
"p_%i",
obj),Form(
"p_%i",
obj), xmi[
obj], 0.0, xma[obj], 0.94);
233 DrawEE(endc_m, pEEmin, pEEmax);
235 DrawEB(barrel, pEBmin, pEBmax);
237 DrawEE(endc_p, pEEmin, pEEmax);
240 canvas.SaveAs(ImageName.c_str());
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
void DrawEE(TH2F *endc, float min, float max)
void DrawEB(TH2F *ebmap, float min, float max)
#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)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
void setSingleIov(bool flag)