29 EcalPulseShapesPlot() : cond::payloadInspector::PlotImage<
EcalPulseShapes>(
"ECAL PulseShapes - map ") {
34 TH2F**
barrel =
new TH2F*[TEMPLATESAMPLES];
35 TH2F** endc_p =
new TH2F*[TEMPLATESAMPLES];
36 TH2F** endc_m =
new TH2F*[TEMPLATESAMPLES];
37 double EBmean[TEMPLATESAMPLES], EBrms[TEMPLATESAMPLES], EEmean[TEMPLATESAMPLES], EErms[TEMPLATESAMPLES];
38 int EBtot[TEMPLATESAMPLES], EEtot[TEMPLATESAMPLES];
39 double pEBmin[TEMPLATESAMPLES], pEBmax[TEMPLATESAMPLES], pEEmin[TEMPLATESAMPLES], pEEmax[TEMPLATESAMPLES];
40 for (
int s = 0;
s < TEMPLATESAMPLES; ++
s) {
59 auto iov =
iovs.front();
61 unsigned int run = std::get<0>(iov);
65 Double_t
eta = (Double_t)ieta;
72 for (
int iphi = 1; iphi <=
MAX_IPHI; iphi++) {
73 Double_t
phi = (Double_t)iphi - 0.5;
75 for (
int s = 0;
s < TEMPLATESAMPLES;
s++) {
76 double val = (*payload)[
id.rawId()].pdfval[
s];
77 barrel[
s]->Fill(phi, eta, val);
78 EBmean[
s] = EBmean[
s] +
val;
79 EBrms[
s] = EBrms[
s] + val *
val;
88 int thesign =
sign == 1 ? 1 : -1;
89 for (
int ix = 1; ix <=
IX_MAX; ix++) {
90 for (
int iy = 1; iy <=
IY_MAX; iy++) {
94 for (
int s = 0;
s < TEMPLATESAMPLES;
s++) {
95 double val = (*payload)[
id.rawId()].pdfval[
s];
96 EEmean[
s] = EEmean[
s] +
val;
97 EErms[
s] = EErms[
s] + val *
val;
102 endc_p[
s]->Fill(ix, iy, val);
104 endc_m[
s]->Fill(ix, iy, val);
111 for (
int s = 0;
s < TEMPLATESAMPLES;
s++) {
112 std::cout <<
"EB sample " <<
s <<
" mean " << EBmean[
s] <<
" rms " << EBrms[
s] <<
" entries " << EBtot[
s]
113 <<
" EE mean " << EEmean[
s] <<
" rms " << EErms[
s] <<
" entries " << EEtot[
s] << std::endl;
114 double vt = (double)EBtot[
s];
115 EBmean[
s] = EBmean[
s] / vt;
116 EBrms[
s] = EBrms[
s] / vt - (EBmean[
s] * EBmean[
s]);
118 EBrms[
s] =
sqrt(EBrms[
s]);
121 pEBmin[
s] = EBmean[
s] - kRMS * EBrms[
s];
122 pEBmax[
s] = EBmean[
s] + kRMS * EBrms[
s];
123 std::cout <<
"EB sample " <<
s <<
" mean " << EBmean[
s] <<
" rms " << EBrms[
s] <<
" entries " << EBtot[
s]
124 <<
" min " << pEBmin[
s] <<
" max " << pEBmax[
s] << std::endl;
126 vt = (double)EEtot[
s];
127 EEmean[
s] = EEmean[
s] / vt;
128 EErms[
s] = EErms[
s] / vt - (EEmean[
s] * EEmean[
s]);
130 EErms[
s] =
sqrt(EErms[
s]);
133 pEEmin[
s] = EEmean[
s] - kRMS * EErms[
s];
134 pEEmax[
s] = EEmean[
s] + kRMS * EErms[
s];
135 std::cout <<
"EE sample " <<
s <<
" mean " << EEmean[
s] <<
" rms " << EErms[
s] <<
" entries " << EEtot[
s]
136 <<
" min " << pEEmin[
s] <<
" max " << pEEmax[
s] << std::endl;
142 gStyle->SetPalette(1);
143 gStyle->SetOptStat(0);
144 TCanvas
canvas(
"CC map",
"CC map", 1600, 5600);
148 t1.SetTextSize(0.05);
149 t1.DrawLatex(0.5, 0.98, Form(
"Ecal PulseShapes, IOV %i", run));
151 float xmi[3] = {0.0, 0.24, 0.76};
152 float xma[3] = {0.24, 0.76, 1.00};
153 TPad*** pad =
new TPad**[6];
154 for (
int s = 0;
s < TEMPLATESAMPLES;
s++) {
155 pad[
s] =
new TPad*[3];
157 float yma = 0.96 - (0.08 *
s);
158 float ymi = yma - 0.07;
159 pad[
s][
obj] =
new TPad(Form(
"p_%i_%i",
obj,
s), Form(
"p_%i_%i",
obj,
s), xmi[
obj], ymi, xma[obj], yma);
165 for (
int s = 0;
s < TEMPLATESAMPLES;
s++) {
167 if (pEBmin[
s] == pEBmax[
s]) {
168 pEBmin[
s] = pEBmin[
s] - 1.e-06;
169 pEBmax[
s] = pEBmax[
s] + 1.e-06;
171 if (pEEmin[s] == pEEmax[s]) {
172 pEEmin[
s] = pEEmin[
s] - 1.e-06;
173 pEEmax[
s] = pEEmax[
s] + 1.e-06;
175 DrawEE(endc_m[s], pEEmin[s], pEEmax[s]);
177 DrawEB(barrel[s], pEBmin[s], pEBmax[s]);
179 DrawEE(endc_p[s], pEEmin[s], pEEmax[s]);
184 canvas.SaveAs(ImageName.c_str());
195 EcalPulseShapesProfile() : cond::payloadInspector::PlotImage<
EcalPulseShapes>(
"ECAL PulseShapes - Profile ") {
200 TProfile* barrel =
new TProfile(
"EB",
"EB profile", TEMPLATESAMPLES, 0, TEMPLATESAMPLES);
201 TProfile*
endcap =
new TProfile(
"EE",
"EE profile", TEMPLATESAMPLES, 0, TEMPLATESAMPLES);
203 auto iov =
iovs.front();
204 std::shared_ptr<EcalPulseShapes> payload =
fetchPayload(std::get<1>(iov));
205 unsigned int run = std::get<0>(iov);
208 for (
int iphi = 1; iphi <=
MAX_IPHI; iphi++) {
211 for (
int s = 0; s < TEMPLATESAMPLES; s++) {
213 barrel->Fill(s, val);
219 int thesign =
sign == 1 ? 1 : -1;
220 for (
int ix = 1; ix <=
IX_MAX; ix++) {
221 for (
int iy = 1; iy <=
IY_MAX; iy++) {
226 for (
int s = 0; s < TEMPLATESAMPLES; s++) {
228 endcap->Fill(s, val);
235 gStyle->SetPalette(1);
236 gStyle->SetOptStat(0);
237 TCanvas
canvas(
"CC map",
"CC map", 500, 1000);
241 t1.SetTextSize(0.05);
242 t1.DrawLatex(0.5, 0.98, Form(
"Ecal PulseShapes, IOV %i", run));
244 TPad** pad =
new TPad*[2];
245 for (
int s = 0; s < 2; s++) {
246 float yma = 0.96 - (0.47 *
s);
247 float ymi = yma - 0.45;
248 pad[
s] =
new TPad(Form(
"p_%i", s), Form(
"p_%i", s), 0.0, ymi, 1.0, yma);
258 canvas.SaveAs(ImageName.c_str());
uint16_t *__restrict__ id
void DrawEE(TH2F *endc, float min, float max)
void DrawEB(TH2F *ebmap, float min, float max)
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
double pulse(double x, double y, double z, double t)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
float pdfval[TEMPLATESAMPLES]
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)