22 enum {MIN_IETA = 1, MIN_IPHI = 1, MAX_IETA = 85, MAX_IPHI = 360, EBhistEtaMax = 171};
23 enum {IX_MIN = 1, IY_MIN = 1, IX_MAX = 100, IY_MAX = 100, EEhistXMax = 220};
35 EcalIntercalibConstantsEBMap() :
cond::payloadInspector::Histogram2D<
EcalIntercalibConstants>(
"ECAL Barrel Intercalib Constants - map ",
36 "iphi", MAX_IPHI, MIN_IPHI, MAX_IPHI + 1,
37 "ieta", EBhistEtaMax, -MAX_IETA, MAX_IETA + 1) {
42 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
44 for (
auto const & iov: iovs) {
48 if (payload->barrelItems().empty())
return false;
50 for(
int iphi = MIN_IPHI; iphi < MAX_IPHI+1; iphi++)
fillWithValue(iphi, 0, -1);
57 if (value_ptr == payload->end())
continue;
76 EcalIntercalibConstantsEEMap() :
cond::payloadInspector::Histogram2D<
EcalIntercalibConstants>(
"ECAL Endcap Intercalib Constants - map ",
77 "ix", EEhistXMax, IX_MIN, EEhistXMax + 1,
78 "iy", IY_MAX, IY_MIN, IY_MAX + 1) {
79 Base::setSingleIov(
true );
82 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
84 for (
auto const & iov: iovs) {
85 std::shared_ptr<EcalIntercalibConstants> payload = Base::fetchPayload( std::get<1>(iov) );
87 if (payload->endcapItems().empty())
return false;
90 for(
int ix = IX_MIN; ix < EEhistXMax + 1; ix++)
91 for(
int iy = IY_MAX; iy < IY_MAX + 1; iy++)
92 fillWithValue(ix, iy, -1);
98 if (value_ptr == payload->end())
continue;
99 float weight = (
float)(*value_ptr);
101 if(myEEId.zside() == -1)
102 fillWithValue(myEEId.ix(), myEEId.iy(),
weight);
104 fillWithValue(myEEId.ix() + IX_MAX + EEhistSplit, myEEId.iy(),
weight);
120 setSingleIov(
true );
123 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
124 TH2F*
barrel =
new TH2F(
"EB",
"mean EB", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA);
125 TH2F* endc_p =
new TH2F(
"EE+",
"mean EE+", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1);
126 TH2F* endc_m =
new TH2F(
"EE-",
"mean EE-", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1);
128 auto iov = iovs.front();
129 std::shared_ptr<EcalIntercalibConstants> payload = fetchPayload( std::get<1>(iov) );
130 unsigned int run = std::get<0>(iov);
132 if (payload->barrelItems().empty())
return false;
136 if (value_ptr == payload->end())
continue;
137 float weight = (
float)(*value_ptr);
138 Double_t
phi = (Double_t)(
EBDetId(rawid)).iphi() - 0.5;
139 Double_t
eta = (Double_t)(
EBDetId(rawid)).ieta();
140 if(eta > 0.) eta = eta - 0.5;
141 else eta = eta + 0.5;
142 barrel->Fill(phi, eta, weight);
145 if (payload->endcapItems().empty())
return false;
147 for(
int iz = -1; iz < 2; iz = iz + 2)
148 for(
int iy = IY_MIN; iy < IY_MAX+IY_MIN; iy++)
149 for(
int ix = IX_MIN; ix < IX_MAX+IX_MIN; ix++)
152 uint32_t rawid = myEEId.
rawId();
154 if (value_ptr == payload->end())
continue;
155 float weight = (
float)(*value_ptr);
157 endc_p->Fill(ix, iy, weight);
159 endc_m->Fill(ix, iy, weight);
163 gStyle->SetPalette(1);
164 gStyle->SetOptStat(0);
165 TCanvas
canvas(
"CC map",
"CC map", 1600, 450);
169 t1.SetTextSize(0.05);
170 t1.DrawLatex(0.5, 0.96, Form(
"Ecal IntercalibConstants, IOV %i", run));
172 float xmi[3] = {0.0 , 0.24, 0.76};
173 float xma[3] = {0.24, 0.76, 1.00};
174 TPad** pad =
new TPad*;
176 pad[
obj] =
new TPad(Form(
"p_%i",
obj),Form(
"p_%i",
obj), xmi[
obj], 0.0, xma[obj], 0.94);
191 canvas.SaveAs(ImageName.c_str());
202 EcalIntercalibConstantsDiff() :
cond::payloadInspector::PlotImage<
EcalIntercalibConstants>(
"ECAL Intercalib Constants difference ") {
206 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
207 TH2F* barrel =
new TH2F(
"EB",
"mean EB", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA);
208 TH2F* endc_p =
new TH2F(
"EE+",
"mean EE+", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1);
209 TH2F* endc_m =
new TH2F(
"EE-",
"mean EE-", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1);
210 float pEBmin, pEEmin, pEBmax, pEEmax;
216 unsigned int run[2], irun = 0;
218 for (
auto const & iov: iovs) {
219 std::shared_ptr<EcalIntercalibConstants> payload = fetchPayload( std::get<1>(iov) );
220 run[irun] = std::get<0>(iov);
222 if (payload->barrelItems().empty())
return false;
226 if (value_ptr == payload->end())
continue;
227 float weight = (
float)(*value_ptr);
231 Double_t phi = (Double_t)(
EBDetId(rawid)).iphi() - 0.5;
232 Double_t eta = (Double_t)(
EBDetId(rawid)).ieta();
233 if(eta > 0.) eta = eta - 0.5;
234 else eta = eta + 0.5;
235 double diff = weight - pEB[cellid];
236 if(diff < pEBmin) pEBmin =
diff;
237 if(diff > pEBmax) pEBmax =
diff;
238 barrel->Fill(phi, eta, diff);
242 if (payload->endcapItems().empty())
return false;
244 for(
int iz = -1; iz < 2; iz = iz + 2)
245 for(
int iy = IY_MIN; iy < IY_MAX+IY_MIN; iy++)
246 for(
int ix = IX_MIN; ix < IX_MAX+IX_MIN; ix++)
250 uint32_t rawid = myEEId.
rawId();
252 if (value_ptr == payload->end())
continue;
253 float weight = (
float)(*value_ptr);
257 double diff = weight - pEE[cellid];
258 if(diff < pEEmin) pEEmin =
diff;
259 if(diff > pEEmax) pEEmax =
diff;
261 endc_p->Fill(ix, iy, diff);
263 endc_m->Fill(ix, iy, diff);
270 gStyle->SetPalette(1);
271 gStyle->SetOptStat(0);
272 TCanvas
canvas(
"CC map",
"CC map", 1600, 450);
276 t1.SetTextSize(0.05);
277 t1.DrawLatex(0.5, 0.96, Form(
"Ecal IntercalibConstants, IOV %i - %i", run[1], run[0]));
279 float xmi[3] = {0.0 , 0.24, 0.76};
280 float xma[3] = {0.24, 0.76, 1.00};
281 TPad** pad =
new TPad*;
283 pad[
obj] =
new TPad(Form(
"p_%i",
obj),Form(
"p_%i",
obj), xmi[
obj], 0.0, xma[obj], 0.94);
287 DrawEE(endc_m, pEEmin, pEEmax);
289 DrawEB(barrel, pEBmin, pEBmax);
291 DrawEE(endc_p, pEEmin, pEEmax);
294 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)
uint32_t rawId() const
get the raw id
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)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
void setSingleIov(bool flag)
std::vector< Item >::const_iterator const_iterator
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)