29 EcalPulseCovariancesPlot() :
cond::payloadInspector::PlotImage<
EcalPulseCovariances>(
"ECAL PulseCovariances - map ") {
33 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
34 TH2F**
barrel =
new TH2F*[TEMPLATESAMPLES];
35 TH2F** endc_p =
new TH2F*[TEMPLATESAMPLES];
36 TH2F** endc_m =
new TH2F*[TEMPLATESAMPLES];
39 double pEBmin[TEMPLATESAMPLES], pEBmax[TEMPLATESAMPLES], pEEmin[TEMPLATESAMPLES], pEEmax[TEMPLATESAMPLES];
40 for(
int s = 0;
s < TEMPLATESAMPLES; ++
s) {
56 auto iov = iovs.front();
58 unsigned int run = std::get<0>(iov);
62 Double_t
eta = (Double_t)ieta;
63 if(ieta == 0)
continue;
64 else if(ieta > 0.) eta = eta - 0.5;
66 for (
int iphi = 1; iphi <=
MAX_IPHI; iphi++) {
67 Double_t
phi = (Double_t)iphi - 0.5;
85 for(
int s = 0;
s < TEMPLATESAMPLES; ++
s) {
86 double val = (*payload)[
id.rawId()].covval[0][
s];
87 barrel[
s]->Fill(phi, eta, val);
91 if(val < pEBmin[
s]) pEBmin[
s] =
val;
92 if(val > pEBmax[s]) pEBmax[
s] =
val;
98 int thesign =
sign==1 ? 1:-1;
99 for (
int ix = 1; ix <=
IX_MAX; ix++) {
100 for (
int iy = 1; iy <=
IY_MAX; iy++) {
103 for(
int s = 0;
s < TEMPLATESAMPLES; ++
s) {
104 double val = (*payload)[
id.rawId()].covval[0][
s];
108 if(val < pEEmin[
s]) pEEmin[
s] =
val;
109 if(val > pEEmax[s]) pEEmax[
s] =
val;
111 endc_p[
s]->Fill(ix, iy, val);
113 endc_m[
s]->Fill(ix, iy, val);
145 gStyle->SetPalette(1);
146 gStyle->SetOptStat(0);
147 TCanvas
canvas(
"CC map",
"CC map", 1600, 2800);
151 t1.SetTextSize(0.05);
152 t1.DrawLatex(0.5, 0.96, Form(
"Ecal PulseCovariances, IOV %i", run));
154 float xmi[3] = {0.0 , 0.24, 0.76};
155 float xma[3] = {0.24, 0.76, 1.00};
156 TPad*** pad =
new TPad**[6];
157 for (
int s = 0;
s < 6;
s++) {
158 pad[
s] =
new TPad*[3];
160 float yma = 0.94 - (0.16 *
s);
161 float ymi = yma - 0.14;
162 pad[
s][
obj] =
new TPad(Form(
"p_%i_%i",
obj,
s),Form(
"p_%i_%i",
obj,
s),
163 xmi[
obj], ymi, xma[obj], yma);
169 for(
int s = 0;
s<7; ++
s) {
173 if(pEBmin[
s] == pEBmax[
s]) {
174 pEBmin[
s] = pEBmin[
s] - 1.e-06;
175 pEBmax[
s] = pEBmax[
s] + 1.e-06;
177 if(pEEmin[s] == pEEmax[s]) {
178 pEEmin[
s] = pEEmin[
s] - 1.e-06;
179 pEEmax[
s] = pEEmax[
s] + 1.e-06;
181 DrawEE(endc_m[s], pEEmin[s], pEEmax[s]);
184 DrawEB(barrel[s], pEBmin[s], pEBmax[s]);
187 DrawEE(endc_p[s], pEEmin[s], pEEmax[s]);
193 canvas.SaveAs(ImageName.c_str());
204 EcalPulseCovariancesMatrix() :
cond::payloadInspector::PlotImage<
EcalPulseCovariances>(
"ECAL PulseCovariances - matrix ") {
208 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
209 double EBmean[TEMPLATESAMPLES][TEMPLATESAMPLES], EBrms[TEMPLATESAMPLES][TEMPLATESAMPLES],
210 EEmean[TEMPLATESAMPLES][TEMPLATESAMPLES], EErms[TEMPLATESAMPLES][TEMPLATESAMPLES];
211 for(
int i = 0;
i < TEMPLATESAMPLES;
i++) {
212 for(
int j = 0; j < TEMPLATESAMPLES; j++) {
220 auto iov = iovs.front();
221 std::shared_ptr<EcalPulseCovariances> payload = fetchPayload( std::get<1>(iov) );
222 unsigned int run = std::get<0>(iov);
226 Double_t eta = (Double_t)ieta;
227 if(ieta == 0)
continue;
228 else if(ieta > 0.) eta = eta - 0.5;
229 else eta = eta + 0.5;
230 for (
int iphi = 1; iphi <=
MAX_IPHI; iphi++) {
233 for(
int i = 0;
i < TEMPLATESAMPLES; ++
i) {
234 for(
int j = 0; j < TEMPLATESAMPLES; ++j) {
235 double val = (*payload)[
id.rawId()].covval[
i][j];
236 EBmean[
i][j] = EBmean[
i][j] +
val;
237 EBrms[
i][j] = EBrms[
i][j] + val *
val;
244 int thesign =
sign==1 ? 1:-1;
245 for (
int ix = 1; ix <=
IX_MAX; ix++) {
246 for (
int iy = 1; iy <=
IY_MAX; iy++) {
249 for(
int i = 0;
i < TEMPLATESAMPLES;
i++) {
250 for(
int j = 0; j < TEMPLATESAMPLES; j++) {
251 double val = (*payload)[
id.rawId()].covval[
i][j];
252 EEmean[
i][j] = EEmean[
i][j] +
val;
253 EErms[
i][j] = EErms[
i][j] + val *
val;
261 TH2F* barrel_m =
new TH2F(
"EBm",
"EB mean", TEMPLATESAMPLES, 0, TEMPLATESAMPLES, TEMPLATESAMPLES, 0., TEMPLATESAMPLES);
262 TH2F* barrel_r =
new TH2F(
"EBr",
"EB rms", TEMPLATESAMPLES, 0, TEMPLATESAMPLES, TEMPLATESAMPLES, 0., TEMPLATESAMPLES);
263 TH2F* endcap_m =
new TH2F(
"EEm",
"EE mean", TEMPLATESAMPLES, 0, TEMPLATESAMPLES, TEMPLATESAMPLES, 0., TEMPLATESAMPLES);
264 TH2F* endcap_r =
new TH2F(
"EEr",
"EE rms", TEMPLATESAMPLES, 0, TEMPLATESAMPLES, TEMPLATESAMPLES, 0., TEMPLATESAMPLES);
265 for(
int i = 0;
i < TEMPLATESAMPLES;
i++) {
268 for(
int j = 0; j < TEMPLATESAMPLES; j++) {
270 EBmean[
i][j] = EBmean[
i][j] / vt;
271 barrel_m->Fill(
i, j, EBmean[
i][j]);
272 EBrms[
i][j] = EBrms[
i][j] / vt - (EBmean[
i][j] * EBmean[
i][j]);
273 if(EBrms[
i][j] >= 0) EBrms[
i][j] =
sqrt(EBrms[
i][j]);
274 else EBrms[
i][j] = 0.;
275 barrel_r->Fill(
i, j, EBrms[
i][j]);
279 EEmean[
i][j] = EEmean[
i][j] / vt;
280 endcap_m->Fill(
i, j, EEmean[
i][j]);
281 EErms[
i][j] = EErms[
i][j] / vt - (EEmean[
i][j] * EEmean[
i][j]);
282 if(EErms[
i][j] >= 0) EErms[
i][j] =
sqrt(EErms[
i][j]);
283 else EErms[
i][j] = 0.;
284 endcap_r->Fill(
i, j, EErms[
i][j]);
290 gStyle->SetPalette(1);
291 gStyle->SetOptStat(0);
292 TCanvas
canvas(
"CC map",
"CC map", 1440, 1500);
296 t1.SetTextSize(0.05);
297 t1.DrawLatex(0.5, 0.96, Form(
"Ecal PulseCovariances, IOV %i", run));
299 float xmi[2] = {0.0, 0.5};
300 float xma[2] = {0.5, 1.0};
301 TPad*** pad =
new TPad**[2];
302 for (
int s = 0; s < 2; s++) {
303 pad[
s] =
new TPad*[2];
305 float yma = 0.94- (0.47 *
s);
306 float ymi = yma - 0.45;
307 pad[
s][
obj] =
new TPad(Form(
"p_%i_%i",
obj, s),Form(
"p_%i_%i",
obj, s),
308 xmi[
obj], ymi, xma[obj], yma);
327 canvas.SaveAs(ImageName.c_str());
332 matrix->Draw(
"COLZ1");
333 TLine*
lh =
new TLine(1., 0., 1., 1.);
334 lh->SetLineWidth(0.2);
335 TLine* lv =
new TLine(1., 0., 1., 1.);
336 lv->SetLineWidth(0.2);
338 for(
int i = 1;
i < TEMPLATESAMPLES;
i++) {
340 lv =
new TLine(
i, 0.,
i, TEMPLATESAMPLES);
342 lh =
new TLine(0.,
i, TEMPLATESAMPLES,
i);
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)