21 enum {MIN_IETA = 1, MIN_IPHI = 1, MAX_IETA = 85, MAX_IPHI = 360};
22 enum {IX_MIN = 1, IY_MIN = 1, IX_MAX = 100, IY_MAX = 100};
30 EcalPulseShapesPlot() :
cond::payloadInspector::PlotImage<
EcalPulseShapes>(
"ECAL PulseShapes - map ") {
34 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
35 TH2F**
barrel =
new TH2F*[TEMPLATESAMPLES];
36 TH2F** endc_p =
new TH2F*[TEMPLATESAMPLES];
37 TH2F** endc_m =
new TH2F*[TEMPLATESAMPLES];
38 double EBmean[TEMPLATESAMPLES], EBrms[TEMPLATESAMPLES], EEmean[TEMPLATESAMPLES], EErms[TEMPLATESAMPLES];
39 int EBtot[TEMPLATESAMPLES], EEtot[TEMPLATESAMPLES];
40 double pEBmin[TEMPLATESAMPLES], pEBmax[TEMPLATESAMPLES], pEEmin[TEMPLATESAMPLES], pEEmax[TEMPLATESAMPLES];
41 for(
int s = 0;
s < TEMPLATESAMPLES; ++
s) {
42 barrel[
s] =
new TH2F(Form(
"EBs%i",
s),Form(
"sample %i EB",
s), MAX_IPHI, 0, MAX_IPHI, 2 * MAX_IETA, -MAX_IETA, MAX_IETA);
43 endc_p[
s] =
new TH2F(Form(
"EE+s%i",
s),Form(
"sample %i EE+",
s), IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1);
44 endc_m[
s] =
new TH2F(Form(
"EE-s%i",
s),Form(
"sample %i EE-",
s), IX_MAX, IX_MIN, IX_MAX + 1, IY_MAX, IY_MIN, IY_MAX + 1);
57 auto iov = iovs.front();
59 unsigned int run = std::get<0>(iov);
62 for (
int ieta = -MAX_IETA; ieta <= MAX_IETA; ieta++) {
63 Double_t
eta = (Double_t)ieta;
64 if(ieta == 0)
continue;
65 else if(ieta > 0.) eta = eta - 0.5;
67 for (
int iphi = 1; iphi <= MAX_IPHI; iphi++) {
68 Double_t
phi = (Double_t)iphi - 0.5;
70 for(
int s = 0;
s < TEMPLATESAMPLES;
s++) {
71 double val = (*payload)[
id.rawId()].pdfval[
s];
72 barrel[
s]->Fill(phi, eta, val);
73 EBmean[
s] = EBmean[
s] +
val;
74 EBrms[
s] = EBrms[
s] + val *
val;
83 int thesign =
sign==1 ? 1:-1;
84 for (
int ix = 1; ix <= IX_MAX; ix++) {
85 for (
int iy = 1; iy <= IY_MAX; iy++) {
88 for(
int s = 0;
s < TEMPLATESAMPLES;
s++) {
89 double val = (*payload)[
id.rawId()].pdfval[
s];
90 EEmean[
s] = EEmean[
s] +
val;
91 EErms[
s] = EErms[
s] + val *
val;
96 endc_p[
s]->Fill(ix, iy, val);
98 endc_m[
s]->Fill(ix, iy, val);
105 for(
int s = 0;
s < TEMPLATESAMPLES;
s++) {
106 std::cout <<
"EB sample " <<
s <<
" mean " << EBmean[
s] <<
" rms " << EBrms[
s] <<
" entries " << EBtot[
s]
107 <<
" EE mean " << EEmean[
s] <<
" rms " << EErms[
s] <<
" entries " << EEtot[
s] << std::endl;
108 double vt =(double)EBtot[
s];
109 EBmean[
s] = EBmean[
s] / vt;
110 EBrms[
s] = EBrms[
s] / vt - (EBmean[
s] * EBmean[
s]);
111 if(EBrms[
s] > 0) EBrms[
s] =
sqrt(EBrms[
s]);
112 else EBrms[
s] = 1.e-06;
113 pEBmin[
s] = EBmean[
s] - kRMS * EBrms[
s];
114 pEBmax[
s] = EBmean[
s] + kRMS * EBrms[
s];
115 std::cout <<
"EB sample " <<
s <<
" mean " << EBmean[
s] <<
" rms " << EBrms[
s] <<
" entries " << EBtot[
s] <<
" min " << pEBmin[
s] <<
" max " << pEBmax[
s] << std::endl;
117 vt =(double)EEtot[
s];
118 EEmean[
s] = EEmean[
s] / vt;
119 EErms[
s] = EErms[
s] / vt - (EEmean[
s] * EEmean[
s]);
120 if(EErms[
s] > 0) EErms[
s] =
sqrt(EErms[
s]);
121 else EErms[
s] = 1.e-06;
122 pEEmin[
s] = EEmean[
s] - kRMS * EErms[
s];
123 pEEmax[
s] = EEmean[
s] + kRMS * EErms[
s];
124 std::cout <<
"EE sample " <<
s <<
" mean " << EEmean[
s] <<
" rms " << EErms[
s] <<
" entries " << EEtot[
s] <<
" min " << pEEmin[
s] <<
" max " << pEEmax[
s] << std::endl;
130 gStyle->SetPalette(1);
131 gStyle->SetOptStat(0);
132 TCanvas
canvas(
"CC map",
"CC map", 1600, 5600);
136 t1.SetTextSize(0.05);
137 t1.DrawLatex(0.5, 0.98, Form(
"Ecal PulseShapes, IOV %i", run));
139 float xmi[3] = {0.0 , 0.24, 0.76};
140 float xma[3] = {0.24, 0.76, 1.00};
141 TPad*** pad =
new TPad**[6];
142 for (
int s = 0;
s < TEMPLATESAMPLES;
s++) {
143 pad[
s] =
new TPad*[3];
145 float yma = 0.96 - (0.08 *
s);
146 float ymi = yma - 0.07;
147 pad[
s][
obj] =
new TPad(Form(
"p_%i_%i",
obj,
s),Form(
"p_%i_%i",
obj,
s),
148 xmi[
obj], ymi, xma[obj], yma);
154 for(
int s = 0;
s < TEMPLATESAMPLES;
s++) {
156 if(pEBmin[
s] == pEBmax[
s]) {
157 pEBmin[
s] = pEBmin[
s] - 1.e-06;
158 pEBmax[
s] = pEBmax[
s] + 1.e-06;
160 if(pEEmin[s] == pEEmax[s]) {
161 pEEmin[
s] = pEEmin[
s] - 1.e-06;
162 pEEmax[
s] = pEEmax[
s] + 1.e-06;
164 DrawEE(endc_m[s], pEEmin[s], pEEmax[s]);
166 DrawEB(barrel[s], pEBmin[s], pEBmax[s]);
168 DrawEE(endc_p[s], pEEmin[s], pEEmax[s]);
173 canvas.SaveAs(ImageName.c_str());
185 EcalPulseShapesProfile() :
cond::payloadInspector::PlotImage<
EcalPulseShapes>(
"ECAL PulseShapes - Profile ") {
189 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
190 TProfile* barrel =
new TProfile(
"EB",
"EB profile", TEMPLATESAMPLES, 0, TEMPLATESAMPLES);
191 TProfile*
endcap =
new TProfile(
"EE",
"EE profile", TEMPLATESAMPLES, 0, TEMPLATESAMPLES);
193 auto iov = iovs.front();
194 std::shared_ptr<EcalPulseShapes> payload = fetchPayload( std::get<1>(iov) );
195 unsigned int run = std::get<0>(iov);
198 for (
int ieta = -MAX_IETA; ieta <= MAX_IETA; ieta++) {
199 Double_t eta = (Double_t)ieta;
200 if(ieta == 0)
continue;
201 else if(ieta > 0.) eta = eta - 0.5;
202 else eta = eta + 0.5;
203 for (
int iphi = 1; iphi <= MAX_IPHI; iphi++) {
207 for(
int s = 0; s < TEMPLATESAMPLES; s++) {
209 barrel->Fill(s, val);
215 int thesign =
sign==1 ? 1:-1;
216 for (
int ix = 1; ix <= IX_MAX; ix++) {
217 for (
int iy = 1; iy <= IY_MAX; iy++) {
221 for(
int s = 0; s < TEMPLATESAMPLES; s++) {
223 endcap->Fill(s, val);
231 gStyle->SetPalette(1);
232 gStyle->SetOptStat(0);
233 TCanvas
canvas(
"CC map",
"CC map", 500, 1000);
237 t1.SetTextSize(0.05);
238 t1.DrawLatex(0.5, 0.98, Form(
"Ecal PulseShapes, IOV %i", run));
240 TPad** pad =
new TPad*[2];
241 for (
int s = 0; s < 2; s++) {
242 float yma = 0.96 - (0.47 *
s);
243 float ymi = yma - 0.45;
244 pad[
s] =
new TPad(Form(
"p_%i", s),Form(
"p_%i", s), 0.0, ymi, 1.0, yma);
254 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)
float pdfval[TEMPLATESAMPLES]