22 enum { NTCC = 108, NTower = 28, NStrip = 5, NXtal = 5 };
30 EcalTPGStripStatusPlot() :
cond::payloadInspector::PlotImage<
EcalTPGStripStatus>(
"ECAL TPGStripStatus - map ") {
34 bool fill(
const std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs)
override {
37 int EEstat[2] = {0, 0};
42 std::cout <<
"EcalTPGStripStatus File EEMap.txt not found" << std::endl;
46 uint32_t rawEE[NTCC][NTower][NStrip][NXtal];
47 int NbrawEE[NTCC][NTower][NStrip];
48 for (
int TCC = 0; TCC < NTCC; TCC++)
49 for (
int TT = 0; TT < NTower; TT++)
50 for (
int ST = 0; ST < NStrip; ST++)
51 NbrawEE[TCC][TT][ST] = 0;
54 int dccid, towerid, pseudostrip_in_SC, xtal_in_pseudostrip;
55 int tccid,
tower, pseudostrip_in_TCC, pseudostrip_in_TT;
56 f >> ix >> iy >> iz >>
CL >> dccid >> towerid >> pseudostrip_in_SC >> xtal_in_pseudostrip >> tccid >>
tower >>
57 pseudostrip_in_TCC >> pseudostrip_in_TT;
59 uint32_t rawId = detid.denseIndex();
60 if (tccid > NTCC ||
tower > NTower || pseudostrip_in_TT > NStrip || xtal_in_pseudostrip > NXtal)
61 std::cout <<
" tccid " << tccid <<
" tower " <<
tower <<
" pseudostrip_in_TT " << pseudostrip_in_TT
62 <<
" xtal_in_pseudostrip " << xtal_in_pseudostrip << std::endl;
64 rawEE[tccid - 1][
tower - 1][pseudostrip_in_TT - 1][xtal_in_pseudostrip - 1] = rawId;
65 NbrawEE[tccid - 1][
tower - 1][pseudostrip_in_TT - 1]++;
69 double wei[2] = {0., 0.};
71 auto iov = iovs.front();
73 unsigned int run = std::get<0>(iov);
78 for (itSt = stripMap.begin(); itSt != stripMap.end(); ++itSt) {
79 if (itSt->second > 0) {
81 int strip = itSt->first / 8;
82 int pseudostrip =
strip & 0x7;
86 int tccid =
strip & 0x7F;
87 int NbXtalInStrip = NbrawEE[tccid - 1][
tt - 1][pseudostrip - 1];
88 if (NbXtalInStrip != NXtal)
89 std::cout <<
" Strip TCC " << tccid <<
" TT " <<
tt <<
" ST " << pseudostrip <<
" Nx Xtals " 90 << NbXtalInStrip << std::endl;
93 for (
int Xtal = 0; Xtal < NbXtalInStrip; Xtal++) {
94 uint32_t rawId = rawEE[tccid - 1][
tt - 1][pseudostrip - 1][Xtal];
99 int iz = detid.
zside();
105 endc_m->Fill(
x + 0.5,
y + 0.5, wei[iz]);
108 endc_p->Fill(
x + 0.5,
y + 0.5, wei[iz]);
118 gStyle->SetPalette(1);
119 gStyle->SetOptStat(0);
120 const Int_t NRGBs = 5;
121 const Int_t NCont = 255;
123 Double_t stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
124 Double_t
red[NRGBs] = {0.00, 0.00, 0.87, 1.00, 0.51};
125 Double_t green[NRGBs] = {0.00, 0.81, 1.00, 0.20, 0.00};
126 Double_t
blue[NRGBs] = {0.51, 1.00, 0.12, 0.00, 0.00};
127 TColor::CreateGradientColorTable(NRGBs, stops,
red, green,
blue, NCont);
128 gStyle->SetNumberContours(NCont);
138 t1.SetTextSize(0.05);
139 t1.DrawLatex(0.5, 0.96, Form(
"Ecal TPGStripStatus, IOV %i",
run));
141 float xmi[2] = {0.0, 0.5};
142 float xma[2] = {0.5, 1.0};
143 std::array<std::unique_ptr<TPad>, 2> pad;
145 pad[
obj] = std::make_unique<TPad>(Form(
"p_%i",
obj), Form(
"p_%i",
obj), xmi[
obj], 0.0, xma[
obj], 0.94);
150 DrawEE(endc_m, 0., wei[0]);
151 t1.SetTextSize(0.03);
152 t1.DrawLatex(0.15, 0.92, Form(
"%i crystals", EEstat[0]));
154 DrawEE(endc_p, 0., wei[1]);
155 t1.DrawLatex(0.15, 0.92, Form(
"%i crystals", EEstat[1]));
158 canvas.SaveAs(ImageName.c_str());
166 template <cond::payloadInspector::IOVMultiplicity nIOVs,
int ntags>
169 EcalTPGStripStatusDiffBase()
170 :
cond::payloadInspector::PlotImage<
EcalTPGStripStatus, nIOVs, ntags>(
"ECAL TPGStripStatus difference") {}
172 bool fill()
override {
175 int EEstat[2][2] = {{0, 0}, {0, 0}};
180 std::cout <<
"EcalTPGStripStatus File EEMap.txt not found" << std::endl;
184 uint32_t rawEE[NTCC][NTower][NStrip][NXtal];
185 int NbrawEE[NTCC][NTower][NStrip];
186 for (
int TCC = 0; TCC < NTCC; TCC++)
187 for (
int TT = 0; TT < NTower; TT++)
188 for (
int ST = 0; ST < NStrip; ST++)
189 NbrawEE[TCC][TT][ST] = 0;
192 int dccid, towerid, pseudostrip_in_SC, xtal_in_pseudostrip;
193 int tccid,
tower, pseudostrip_in_TCC, pseudostrip_in_TT;
194 f >> ix >> iy >> iz >>
CL >> dccid >> towerid >> pseudostrip_in_SC >> xtal_in_pseudostrip >> tccid >>
tower >>
195 pseudostrip_in_TCC >> pseudostrip_in_TT;
198 if (tccid > NTCC ||
tower > NTower || pseudostrip_in_TT > NStrip || xtal_in_pseudostrip > NXtal)
199 std::cout <<
" tccid " << tccid <<
" tower " <<
tower <<
" pseudostrip_in_TT " << pseudostrip_in_TT
200 <<
" xtal_in_pseudostrip " << xtal_in_pseudostrip << std::endl;
202 rawEE[tccid - 1][
tower - 1][pseudostrip_in_TT - 1][xtal_in_pseudostrip - 1] = rawId;
203 NbrawEE[tccid - 1][
tower - 1][pseudostrip_in_TT - 1]++;
208 unsigned int run[2] = {0, 0};
212 auto iovs = cond::payloadInspector::PlotBase::getTag<0>().iovs;
213 l_tagname[0] = cond::payloadInspector::PlotBase::getTag<0>().
name;
214 auto firstiov = iovs.front();
215 run[0] = std::get<0>(firstiov);
216 std::tuple<cond::Time_t, cond::Hash> lastiov;
218 auto tag2iovs = cond::payloadInspector::PlotBase::getTag<1>().iovs;
219 l_tagname[1] = cond::payloadInspector::PlotBase::getTag<1>().
name;
220 lastiov = tag2iovs.front();
222 lastiov = iovs.back();
223 l_tagname[1] = l_tagname[0];
225 run[1] = std::get<0>(lastiov);
226 for (
int irun = 0; irun < nIOVs; irun++) {
227 std::shared_ptr<EcalTPGStripStatus>
payload;
237 for (itSt = stripMap.begin(); itSt != stripMap.end(); ++itSt) {
238 if (itSt->second > 0) {
239 int ID = itSt->first / 8;
240 if (irun == 0 && istat < 100) {
245 std::cout <<
" limit on number of strips reached, stop keeping others" << std::endl;
248 for (
int is = 0; is < istat; is++) {
261 int pseudostrip =
strip & 0x7;
265 int tccid =
strip & 0x7F;
266 int NbXtalInStrip = NbrawEE[tccid - 1][
tt - 1][pseudostrip - 1];
267 if (NbXtalInStrip != NXtal)
268 std::cout <<
" Strip TCC " << tccid <<
" TT " <<
tt <<
" ST " << pseudostrip <<
" Nx Xtals " 269 << NbXtalInStrip << std::endl;
270 for (
int Xtal = 0; Xtal < NbXtalInStrip; Xtal++) {
271 uint32_t rawId = rawEE[tccid - 1][
tt - 1][pseudostrip - 1][Xtal];
276 int iz = detid.
zside();
280 endc_m->Fill(
x + 0.5,
y + 0.5, 1.);
283 endc_p->Fill(
x + 0.5,
y + 0.5, 1.);
299 for (
int is = 0; is < istat; is++) {
304 int pseudostrip =
strip & 0x7;
308 int tccid =
strip & 0x7F;
309 int NbXtalInStrip = NbrawEE[tccid - 1][
tt - 1][pseudostrip - 1];
310 if (NbXtalInStrip != NXtal)
311 std::cout <<
" Strip TCC " << tccid <<
" TT " <<
tt <<
" ST " << pseudostrip <<
" Nx Xtals " 312 << NbXtalInStrip << std::endl;
313 for (
int Xtal = 0; Xtal < NbXtalInStrip; Xtal++) {
314 uint32_t rawId = rawEE[tccid - 1][
tt - 1][pseudostrip - 1][Xtal];
319 int iz = detid.
zside();
323 endc_m->Fill(
x + 0.5,
y + 0.5, -1.);
326 endc_p->Fill(
x + 0.5,
y + 0.5, -1.);
334 gStyle->SetPalette(1);
335 gStyle->SetOptStat(0);
336 const Int_t NRGBs = 5;
337 const Int_t NCont = 255;
339 Double_t stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
340 Double_t
red[NRGBs] = {0.00, 0.00, 0.87, 1.00, 0.51};
341 Double_t green[NRGBs] = {0.00, 0.81, 1.00, 0.20, 0.00};
342 Double_t
blue[NRGBs] = {0.51, 1.00, 0.12, 0.00, 0.00};
343 TColor::CreateGradientColorTable(NRGBs, stops,
red, green,
blue, NCont);
344 gStyle->SetNumberContours(NCont);
354 int len = l_tagname[0].length() + l_tagname[1].length();
357 t1.SetTextSize(0.03);
358 t1.DrawLatex(0.5, 0.96, Form(
"%s %i - %s %i", l_tagname[1].c_str(),
run[1], l_tagname[0].c_str(),
run[0]));
360 t1.SetTextSize(0.05);
361 t1.DrawLatex(0.5, 0.96, Form(
"Ecal TPGStripStatus, IOV %i - %i",
run[1],
run[0]));
364 t1.SetTextSize(0.05);
365 t1.DrawLatex(0.5, 0.96, Form(
"%s, IOV %i - %i", l_tagname[0].c_str(),
run[1],
run[0]));
368 float xmi[2] = {0.0, 0.5};
369 float xma[2] = {0.5, 1.0};
370 std::array<std::unique_ptr<TPad>, 2> pad;
372 pad[
obj] = std::make_unique<TPad>(Form(
"p_%i",
obj), Form(
"p_%i",
obj), xmi[
obj], 0.0, xma[
obj], 0.94);
377 DrawEE(endc_m, -1.0, 1.0);
378 t1.SetTextSize(0.03);
379 t1.DrawLatex(0.15, 0.92, Form(
"new %i old %i", EEstat[0][0], EEstat[0][1]));
381 DrawEE(endc_p, -1.0, 1.0);
382 t1.DrawLatex(0.15, 0.92, Form(
"new %i old %i", EEstat[1][0], EEstat[1][1]));
385 canvas.SaveAs(ImageName.c_str());
389 using EcalTPGStripStatusDiffOneTag = EcalTPGStripStatusDiffBase<cond::payloadInspector::SINGLE_IOV, 1>;
390 using EcalTPGStripStatusDiffTwoTags = EcalTPGStripStatusDiffBase<cond::payloadInspector::SINGLE_IOV, 2>;
397 EcalTPGStripStatusSummaryPlot()
402 bool fill(
const std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs)
override {
403 auto iov = iovs.front();
404 std::shared_ptr<EcalTPGStripStatus>
payload =
406 unsigned int run = std::get<0>(iov);
415 align =
new TH2F(
"Ecal TPGStrip Status Summary",
416 "Total NumberOfMasked",
427 if ((*it).second > 0)
430 align->Fill(0.5, 0.5, stripMap.size());
431 align->Fill(1.5, 0.5, NbMaskedTT);
437 gStyle->SetPalette(1);
438 gStyle->SetOptStat(0);
439 TCanvas
canvas(
"CC map",
"CC map", 1000, 1000);
443 t1.SetTextSize(0.04);
445 t1.DrawLatex(0.5, 0.96, Form(
"Endcap:Number of masked Trigger Strips, IOV %i",
run));
447 TPad pad(
"pad",
"pad", 0.0, 0.0, 1.0, 0.94);
454 align->GetXaxis()->SetTickLength(0.);
455 align->GetXaxis()->SetLabelSize(0.);
456 align->GetYaxis()->SetTickLength(0.);
457 align->GetYaxis()->SetLabelSize(0.);
460 canvas.SaveAs(ImageName.c_str());
static EEDetId detIdFromDenseIndex(uint32_t din)
void DrawEE(TH2F *endc, float min, float max)
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
uint32_t denseIndex() const
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
std::map< uint32_t, uint16_t > EcalTPGStripStatusMap
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
void drawTable(int nbRows, int nbColumns)
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
std::map< uint32_t, uint16_t >::const_iterator EcalTPGStripStatusMapIterator