20 enum {NTCC = 108, NTower = 28, NStrip = 5, NXtal = 5};
29 EcalTPGStripStatusPlot() :
cond::payloadInspector::PlotImage<
EcalTPGStripStatus>(
"ECAL TPGStripStatus - map ") {
33 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
36 int EEstat[2] = {0, 0};
38 std::string mappingFile =
"Geometry/EcalMapping/data/EEMap.txt";
41 std::cout <<
"EcalTPGStripStatus File EEMap.txt not found" << std::endl;
45 uint32_t rawEE[NTCC][NTower][NStrip][NXtal];
46 int NbrawEE[NTCC][NTower][NStrip];
47 for(
int TCC = 0; TCC < NTCC; TCC++)
48 for(
int TT = 0; TT < NTower; TT++)
49 for(
int ST = 0; ST < NStrip; ST++)
50 NbrawEE[TCC][TT][ST] = 0;
53 int dccid, towerid, pseudostrip_in_SC, xtal_in_pseudostrip;
54 int tccid, tower, pseudostrip_in_TCC, pseudostrip_in_TT;
55 f >> ix >> iy >> iz >> CL >> dccid >> towerid >> pseudostrip_in_SC >> xtal_in_pseudostrip
56 >> tccid >> tower >> pseudostrip_in_TCC >> pseudostrip_in_TT ;
58 uint32_t rawId = detid.denseIndex();
59 if(tccid > NTCC || tower > NTower || pseudostrip_in_TT > NStrip || xtal_in_pseudostrip > NXtal)
60 std::cout <<
" tccid " << tccid <<
" tower " << tower <<
" pseudostrip_in_TT "<< pseudostrip_in_TT
61 <<
" xtal_in_pseudostrip " << xtal_in_pseudostrip << std::endl;
63 rawEE[tccid - 1][tower - 1][pseudostrip_in_TT - 1][xtal_in_pseudostrip - 1] = rawId;
64 NbrawEE[tccid - 1][tower - 1][pseudostrip_in_TT - 1]++;
68 double wei[2] = {0., 0.};
70 auto iov = iovs.front();
72 unsigned int run = std::get<0>(iov);
77 for(itSt = stripMap.begin(); itSt != stripMap.end(); ++itSt) {
78 if(itSt->second > 0) {
80 int strip = itSt->first/8;
81 int pseudostrip = strip & 0x7;
83 int tt = strip & 0x7F;
85 int tccid = strip & 0x7F;
86 int NbXtalInStrip = NbrawEE[tccid - 1][tt - 1][pseudostrip - 1];
87 if(NbXtalInStrip != NXtal)
std::cout <<
" Strip TCC " << tccid <<
" TT " << tt <<
" ST " << pseudostrip
88 <<
" Nx Xtals " << NbXtalInStrip << std::endl;
91 for(
int Xtal = 0; Xtal < NbXtalInStrip; Xtal++) {
92 uint32_t rawId = rawEE[tccid - 1][tt - 1][pseudostrip - 1][Xtal];
97 int iz = detid.
zside();
99 if(Xtal == 0) wei[iz] += 1.;
101 endc_m->Fill(x + 0.5, y + 0.5, wei[iz]);
105 endc_p->Fill(x + 0.5, y + 0.5, wei[iz]);
115 gStyle->SetPalette(1);
116 gStyle->SetOptStat(0);
117 const Int_t NRGBs = 5;
118 const Int_t NCont = 255;
120 Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
121 Double_t
red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
122 Double_t
green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
123 Double_t
blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
124 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
125 gStyle->SetNumberContours(NCont);
129 TCanvas
canvas(
"c",
"c", w, h);
135 t1.SetTextSize(0.05);
136 t1.DrawLatex(0.5, 0.96, Form(
"Ecal TPGStripStatus, IOV %i", run));
138 float xmi[2] = {0.0, 0.5};
139 float xma[2] = {0.5, 1.0};
140 TPad** pad =
new TPad*;
142 pad[
obj] =
new TPad(Form(
"p_%i",
obj),Form(
"p_%i",
obj), xmi[
obj], 0.0, xma[obj], 0.94);
147 DrawEE(endc_m, 0., wei[0]);
148 t1.SetTextSize(0.03);
149 t1.DrawLatex(0.15, 0.92, Form(
"%i crystals", EEstat[0]));
151 DrawEE(endc_p, 0., wei[1]);
152 t1.DrawLatex(0.15, 0.92, Form(
"%i crystals", EEstat[1]));
155 canvas.SaveAs(ImageName.c_str());
166 EcalTPGStripStatusDiff() :
cond::payloadInspector::PlotImage<
EcalTPGStripStatus>(
"ECAL TPGStripStatus difference") {
170 bool fill(
const std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs )
override{
173 int EEstat[2][2] = {{0, 0}, {0, 0}};
175 std::string mappingFile =
"Geometry/EcalMapping/data/EEMap.txt";
178 std::cout <<
"EcalTPGStripStatus File EEMap.txt not found" << std::endl;
182 uint32_t rawEE[NTCC][NTower][NStrip][NXtal];
183 int NbrawEE[NTCC][NTower][NStrip];
184 for(
int TCC = 0; TCC < NTCC; TCC++)
185 for(
int TT = 0; TT < NTower; TT++)
186 for(
int ST = 0; ST < NStrip; ST++)
187 NbrawEE[TCC][TT][ST] = 0;
190 int dccid, towerid, pseudostrip_in_SC, xtal_in_pseudostrip;
191 int tccid, tower, pseudostrip_in_TCC, pseudostrip_in_TT;
192 f >> ix >> iy >> iz >> CL >> dccid >> towerid >> pseudostrip_in_SC >> xtal_in_pseudostrip
193 >> tccid >> tower >> pseudostrip_in_TCC >> pseudostrip_in_TT ;
196 if(tccid > NTCC || tower > NTower || pseudostrip_in_TT > NStrip || xtal_in_pseudostrip > NXtal)
197 std::cout <<
" tccid " << tccid <<
" tower " << tower <<
" pseudostrip_in_TT "<< pseudostrip_in_TT
198 <<
" xtal_in_pseudostrip " << xtal_in_pseudostrip << std::endl;
200 rawEE[tccid - 1][tower - 1][pseudostrip_in_TT - 1][xtal_in_pseudostrip - 1] = rawId;
201 NbrawEE[tccid - 1][tower - 1][pseudostrip_in_TT - 1]++;
206 unsigned int run[2] = {0, 0}, irun = 0;
209 for (
auto const & iov: iovs) {
210 std::shared_ptr<EcalTPGStripStatus> payload = fetchPayload( std::get<1>(iov) );
211 run[irun] = std::get<0>(iov);
216 for(itSt = stripMap.begin(); itSt != stripMap.end(); ++itSt) {
217 if(itSt->second > 0) {
218 int ID = itSt->first/8;
219 if(irun == 0 && istat < 100) {
223 if(istat == 100)
std::cout <<
" limit on number of strips reached, stop keeping others" << std::endl;
227 for(
int is = 0; is < istat; is++) {
240 int pseudostrip = strip & 0x7;
242 int tt = strip & 0x7F;
244 int tccid = strip & 0x7F;
245 int NbXtalInStrip = NbrawEE[tccid - 1][tt - 1][pseudostrip - 1];
246 if(NbXtalInStrip != NXtal)
std::cout <<
" Strip TCC " << tccid <<
" TT " << tt <<
" ST " << pseudostrip
247 <<
" Nx Xtals " << NbXtalInStrip << std::endl;
248 for(
int Xtal = 0; Xtal < NbXtalInStrip; Xtal++) {
249 uint32_t rawId = rawEE[tccid - 1][tt - 1][pseudostrip - 1][Xtal];
254 int iz = detid.
zside();
257 endc_m->Fill(x + 0.5, y + 0.5, 1.);
261 endc_p->Fill(x + 0.5, y + 0.5, 1.);
277 for(
int is = 0; is < istat; is++) {
282 int pseudostrip = strip & 0x7;
284 int tt = strip & 0x7F;
286 int tccid = strip & 0x7F;
287 int NbXtalInStrip = NbrawEE[tccid - 1][tt - 1][pseudostrip - 1];
288 if(NbXtalInStrip != NXtal)
std::cout <<
" Strip TCC " << tccid <<
" TT " << tt <<
" ST " << pseudostrip
289 <<
" Nx Xtals " << NbXtalInStrip << std::endl;
290 for(
int Xtal = 0; Xtal < NbXtalInStrip; Xtal++) {
291 uint32_t rawId = rawEE[tccid - 1][tt - 1][pseudostrip - 1][Xtal];
296 int iz = detid.
zside();
299 endc_m->Fill(x + 0.5, y + 0.5, -1.);
303 endc_p->Fill(x + 0.5, y + 0.5, -1.);
311 gStyle->SetPalette(1);
312 gStyle->SetOptStat(0);
313 const Int_t NRGBs = 5;
314 const Int_t NCont = 255;
316 Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
317 Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
318 Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
319 Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
320 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
321 gStyle->SetNumberContours(NCont);
325 TCanvas
canvas(
"c",
"c", w, h);
331 t1.SetTextSize(0.05);
332 t1.DrawLatex(0.5, 0.96, Form(
"Ecal TPGStripStatus, IOV %i - %i", run[1], run[0]));
334 float xmi[2] = {0.0, 0.5};
335 float xma[2] = {0.5, 1.0};
336 TPad** pad =
new TPad*;
338 pad[
obj] =
new TPad(Form(
"p_%i",
obj),Form(
"p_%i",
obj), xmi[
obj], 0.0, xma[obj], 0.94);
343 DrawEE(endc_m, -1.0, 1.0);
344 t1.SetTextSize(0.03);
345 t1.DrawLatex(0.15, 0.92, Form(
"new %i old %i", EEstat[0][0], EEstat[0][1]));
347 DrawEE(endc_p, -1.0, 1.0);
348 t1.DrawLatex(0.15, 0.92, Form(
"new %i old %i", EEstat[1][0], EEstat[1][1]));
351 canvas.SaveAs(ImageName.c_str());
363 EcalTPGStripStatusSummaryPlot() :
368 bool fill(
const std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs)
override {
370 auto iov = iovs.front();
371 std::shared_ptr < EcalTPGStripStatus > payload = fetchPayload(std::get < 1 > (iov));
372 unsigned int run = std::get < 0 > (iov);
382 align =
new TH2F(
"Ecal TPGStrip Status Summary",
"Total NumberOfMasked",
383 NbColumns, 0, NbColumns, NbRows, 0, NbRows);
392 align->Fill(0.5, 0.5, stripMap.size());
393 align->Fill(1.5, 0.5, NbMaskedTT);
399 gStyle->SetPalette(1);
400 gStyle->SetOptStat(0);
401 TCanvas
canvas(
"CC map",
"CC map", 1000, 1000);
405 t1.SetTextSize(0.04);
407 t1.DrawLatex(0.5, 0.96,Form(
"Endcap:Number of masked Trigger Strips, IOV %i", run));
410 TPad* pad =
new TPad(
"pad",
"pad", 0.0, 0.0, 1.0, 0.94);
417 align->GetXaxis()->SetTickLength(0.);
418 align->GetXaxis()->SetLabelSize(0.);
419 align->GetYaxis()->SetTickLength(0.);
420 align->GetYaxis()->SetLabelSize(0.);
423 canvas.SaveAs(ImageName.c_str());
static EEDetId detIdFromDenseIndex(uint32_t din)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
void DrawEE(TH2F *endc, 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)
void setSingleIov(bool flag)
uint32_t denseIndex() const
std::map< uint32_t, uint16_t > EcalTPGStripStatusMap
void drawTable(int nbRows, int nbColumns)
std::map< uint32_t, uint16_t >::const_iterator EcalTPGStripStatusMapIterator