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};
29 EcalTPGCrystalStatusPlot() :
cond::payloadInspector::PlotImage<
EcalTPGCrystalStatus>(
"ECAL TPGCrystalStatus - map ") {
33 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
34 TH2F*
barrel =
new TH2F(
"EB",
"EB TPG Crystal Status", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA);
35 TH2F* endc_p =
new TH2F(
"EE+",
"EE+ TPG Crystal Status", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1);
36 TH2F* endc_m =
new TH2F(
"EE-",
"EE- TPG Crystal Status", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1);
37 int EBstat = 0, EEstat[2] = {0, 0};
39 auto iov = iovs.front();
41 unsigned int run = std::get<0>(iov);
43 for (
int ieta = -MAX_IETA; ieta <= MAX_IETA; ieta++) {
44 Double_t
eta = (Double_t)ieta;
45 if(ieta == 0)
continue;
46 else if(ieta > 0.) eta = eta - 0.5;
48 for (
int iphi = 1; iphi <= MAX_IPHI; iphi++) {
49 Double_t
phi = (Double_t)iphi - 0.5;
51 double val = (*payload)[
id.rawId()].getStatusCode();
52 barrel->Fill(phi, eta, val);
58 int thesign =
sign==1 ? 1:-1;
59 for (
int ix = 1; ix <= IX_MAX; ix++) {
60 for (
int iy = 1; iy <= IY_MAX; iy++) {
63 double val = (*payload)[
id.rawId()].getStatusCode();
65 endc_p->Fill(ix, iy, val);
66 if(val > 0) EEstat[1]++;
69 endc_m->Fill(ix, iy, val);
70 if(val > 0) EEstat[0]++;
77 gStyle->SetPalette(1);
78 gStyle->SetOptStat(0);
82 TCanvas
canvas(
"c",
"c", w, h);
89 t1.DrawLatex(0.5, 0.96, Form(
"Ecal TPGCrystalStatus, IOV %i", run));
93 float xmi[3] = {0.0, 0.0, 0.5};
94 float xma[3] = {1.0, 0.5, 1.0};
95 float ymi[3] = {0.47, 0.0, 0.0};
96 float yma[3] = {0.94, 0.47, 0.47};
97 TPad** pad =
new TPad*;
99 pad[
obj] =
new TPad(Form(
"p_%i",
obj),Form(
"p_%i",
obj), xmi[
obj], ymi[obj], xma[obj], yma[obj]);
105 t1.DrawLatex(0.2, 0.94, Form(
"%i crystals", EBstat));
108 t1.DrawLatex(0.15, 0.92, Form(
"%i crystals", EEstat[0]));
111 t1.DrawLatex(0.15, 0.92, Form(
"%i crystals", EEstat[1]));
114 canvas.SaveAs(ImageName.c_str());
125 EcalTPGCrystalStatusDiff() :
cond::payloadInspector::PlotImage<
EcalTPGCrystalStatus>(
"ECAL TPGCrystalStatus difference") {
129 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
130 TH2F* barrel =
new TH2F(
"EB",
"EB difference", MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA);
131 TH2F* endc_p =
new TH2F(
"EE+",
"EE+ difference", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1);
132 TH2F* endc_m =
new TH2F(
"EE-",
"EE- difference", IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1);
133 int EBstat = 0, EEstat[2] = {0, 0};
135 unsigned int run[2] = {0, 0}, irun = 0;
137 for (
auto const & iov: iovs) {
138 std::shared_ptr<EcalTPGCrystalStatus> payload = fetchPayload( std::get<1>(iov) );
139 run[irun] = std::get<0>(iov);
141 for (
int ieta = -MAX_IETA; ieta <= MAX_IETA; ieta++) {
142 Double_t eta = (Double_t)ieta;
143 if(ieta == 0)
continue;
144 else if(ieta > 0.) eta = eta - 0.5;
145 else eta = eta + 0.5;
146 for (
int iphi = 1; iphi <= MAX_IPHI; iphi++) {
147 Double_t phi = (Double_t)iphi - 0.5;
149 int channel =
id.hashedIndex();
150 double val = (*payload)[
id.rawId()].getStatusCode();
151 if(irun == 0) vEB[channel] =
val;
153 double diff = val - vEB[channel];
154 barrel->Fill(phi, eta, diff);
155 if(diff != 0) EBstat++;
162 int thesign =
sign==1 ? 1:-1;
163 for (
int ix = 1; ix <= IX_MAX; ix++) {
164 for (
int iy = 1; iy <= IY_MAX; iy++) {
167 int channel =
id.hashedIndex();
168 double val = (*payload)[
id.rawId()].getStatusCode();
169 if(irun == 0) vEE[channel] =
val;
171 double diff = val - vEE[channel];
173 endc_p->Fill(ix, iy, diff);
174 if(diff != 0) EEstat[1]++;
177 endc_m->Fill(ix, iy, diff);
178 if(diff != 0) EEstat[0]++;
189 gStyle->SetPalette(1);
190 gStyle->SetOptStat(0);
193 TCanvas
canvas(
"c",
"c", w, h);
199 t1.SetTextSize(0.05);
200 t1.DrawLatex(0.5, 0.96, Form(
"Ecal TPGCrystalStatus, IOV %i - %i", run[1], run[0]));
204 float xmi[3] = {0.0, 0.0, 0.5};
205 float xma[3] = {1.0, 0.5, 1.0};
206 float ymi[3] = {0.47, 0.0, 0.0};
207 float yma[3] = {0.94, 0.47, 0.47};
208 TPad** pad =
new TPad*;
210 pad[
obj] =
new TPad(Form(
"p_%i",
obj),Form(
"p_%i",
obj), xmi[
obj], ymi[obj], xma[obj], yma[obj]);
216 t1.DrawLatex(0.2, 0.94, Form(
"%i differences", EBstat));
219 t1.DrawLatex(0.15, 0.92, Form(
"%i differences", EEstat[0]));
222 t1.DrawLatex(0.15, 0.92, Form(
"%i differences", EEstat[1]));
225 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)