21 #include <boost/ref.hpp>
22 #include <boost/bind.hpp>
23 #include <boost/function.hpp>
24 #include <boost/iterator/transform_iterator.hpp>
38 return std::count_if(cont.begin(),cont.end(),
39 boost::bind(std::greater<int>(),
63 result.reserve(which.size());
64 for (
unsigned int i=0;
i<which.size();
i++) {
65 result.push_back(cont[which[
i]].getStatusCode());
69 typedef boost::function<void(Container const & cont, std::vector<int>
const &
which, std::vector<float> &
result)>
CondExtractor;
80 std::vector<int>
const &
which()
const {
return m_which;}
118 std::vector<float> res;
119 extractor(m_what.how())(it,m_what.which(),res);
132 std::stringstream
ss;
140 unsigned int bits_1to5,
bits, mask;
142 bits_1to5 = mask & statusCode;
143 std::stringstream
ss;
146 case 1: ss<<
"["<< bits_1to5 <<
"]:" <<
"DAC settings problem, pedestal not in the design range, " <<
"Reco Action: standard reco.";
break;
147 case 2: ss<<
"["<< bits_1to5 <<
"]:" <<
"channel with no laser, ok elsewhere; " <<
"Reco Action: standard reco.";
break;
148 case 3: ss<<
"["<< bits_1to5 <<
"]:" <<
"noisy; " <<
"Reco Action: standard reco.";
break;
149 case 4: ss<<
"["<< bits_1to5 <<
"]:" <<
"very noisy; " <<
"Reco Action: special reco (to be decided).";
break;
150 case 5: ss<<
"["<< bits_1to5 <<
"]: reserved for more categories of noisy channels.";
break;
151 case 6: ss<<
"["<< bits_1to5 <<
"]: reserved for more categories of noisy channels.";
break;
152 case 7: ss<<
"["<< bits_1to5 <<
"]: reserved for more categories of noisy channels.";
break;
153 case 8: ss<<
"["<< bits_1to5 <<
"]:" <<
" channel at fixed gain 6 (or 6 and 1); " <<
"Reco Action: 3+5 or 3+1, special reco.";
break;
154 case 9: ss<<
"["<< bits_1to5 <<
"]:" <<
" channel at fixed gain 1; " <<
"Reco Action: 3+5 or 3+1, special reco.";
break;
155 case 10: ss<<
"["<< bits_1to5 <<
"]:" <<
" channel at fixed gain 0 (dead of type this); " <<
"Reco Action: recovery from neighbours.";
break;
156 case 11: ss<<
"["<< bits_1to5 <<
"]:" <<
" non responding isolated channel (dead of type other); " <<
"Reco Action: recovery from neighbours.";
break;
157 case 12: ss<<
"["<< bits_1to5 <<
"]:" <<
" channel and one or more neigbors not responding (e.g.: in a dead VFE 5x1 channel) " <<
"Reco Action: no recovery.";
break;
158 case 13: ss<<
"["<< bits_1to5 <<
"]:" <<
" channel in TT with no data link, TP data ok; " <<
"Reco Action: recovery from TP data.";
break;
159 case 14: ss<<
"["<< bits_1to5 <<
"]:" <<
" channel in TT with no data link and no TP data; " <<
"Reco Action: none.";
break;
161 ss<<
"no such bits can be set!";
166 if (statusCode & mask)
167 ss <<
" bit["<< bits <<
"]:" <<
" HV good/not good;";
170 if (statusCode & mask)
171 ss <<
" bit["<< bits <<
"]:" <<
" LV on/off;";
174 if (statusCode & mask)
175 ss <<
" bit["<< bits <<
"]:" <<
" DAQ in/out;";
178 if (statusCode & mask)
179 ss <<
" bit["<< bits <<
"]:" <<
" TP readout on/off;";
182 if (statusCode & mask)
183 ss <<
" bit["<< bits <<
"]:" <<
" Trigger in/out;";
186 if (statusCode & mask)
187 ss <<
" bit["<< bits <<
"]:" <<
" Temperature ok/not ok;";
190 if (statusCode & mask)
191 ss <<
" bit["<< bits <<
"]:" <<
" Humidity ok/not;";
199 void setErr(
unsigned int const & statusCode, std::vector< std::pair< std::string, unsigned int> > & vTotalWithErr){
200 unsigned int bits_1to5,
bits, mask;
203 bits_1to5 = mask & statusCode;
204 if ((bits_1to5 > 0) &&( bits_1to5 < 15)){
205 vTotalWithErr[bits_1to5].second += 1;
211 if (statusCode & mask)
212 vTotalWithErr[bits + 11].second += 1;
215 if (statusCode & mask)
216 vTotalWithErr[bits + 11].second += 1;
219 if (statusCode & mask)
220 vTotalWithErr[bits + 11].second += 1;
223 if (statusCode & mask)
224 vTotalWithErr[bits + 11].second += 1;
227 if (statusCode & mask)
228 vTotalWithErr[bits + 11].second += 1;
231 if (statusCode & mask)
232 vTotalWithErr[bits + 11].second += 1;
235 if (statusCode & mask)
236 vTotalWithErr[bits + 11].second += 1;
240 unsigned int stcode = 0,
index = 0, totalErrorCodes = 22;
241 std::stringstream
ss;
242 std::vector< std::pair< std::string, unsigned int > > vTotalWithErr(totalErrorCodes);
247 ss.str(
""); ss <<
" No errors. "; vTotalWithErr[
index].first = ss.str(); ++
index;
248 ss.str(
""); ss <<
"["<<
index <<
"]:" <<
"DAC settings problem, pedestal not in the design range, " <<
"Reco Action: standard reco."; vTotalWithErr[
index].first = ss.str(); ++
index;
249 ss.str(
""); ss <<
"["<< index <<
"]:" <<
"channel with no laser, ok elsewhere; " <<
"Reco Action: standard reco."; vTotalWithErr[
index].first = ss.str(); ++
index;
250 ss.str(
""); ss <<
"["<< index <<
"]:" <<
"noisy; " <<
"Reco Action: standard reco."; vTotalWithErr[
index].first = ss.str(); ++
index;
251 ss.str(
""); ss <<
"["<< index <<
"]:" <<
"very noisy; " <<
"Reco Action: special reco (to be decided)."; vTotalWithErr[
index].first = ss.str(); ++
index;
252 ss.str(
""); ss <<
"["<< index <<
"]: reserved for more categories of noisy channels."; vTotalWithErr[
index].first = ss.str(); ++
index;
253 ss.str(
""); ss <<
"["<< index <<
"]: reserved for more categories of noisy channels."; vTotalWithErr[
index].first = ss.str(); ++
index;
254 ss.str(
""); ss <<
"["<< index <<
"]: reserved for more categories of noisy channels."; vTotalWithErr[
index].first = ss.str(); ++
index;
255 ss.str(
""); ss <<
"["<< index <<
"]:" <<
" channel at fixed gain 6 (or 6 and 1); " <<
"Reco Action: 3+5 or 3+1, special reco."; vTotalWithErr[
index].first = ss.str(); ++
index;
256 ss.str(
""); ss <<
"["<< index <<
"]:" <<
" channel at fixed gain 1; " <<
"Reco Action: 3+5 or 3+1, special reco."; vTotalWithErr[
index].first = ss.str(); ++
index;
257 ss.str(
""); ss <<
"["<< index <<
"]:" <<
" channel at fixed gain 0 (dead of type this); " <<
"Reco Action: recovery from neighbours."; vTotalWithErr[
index].first = ss.str(); ++
index;
258 ss.str(
""); ss <<
"["<< index <<
"]:" <<
" non responding isolated channel (dead of type other); " <<
"Reco Action: recovery from neighbours."; vTotalWithErr[
index].first = ss.str(); ++
index;
259 ss.str(
""); ss <<
"["<< index <<
"]:" <<
" channel and one or more neigbors not responding (e.g.: in a dead VFE 5x1 channel) " <<
"Reco Action: no recovery."; vTotalWithErr[
index].first = ss.str(); ++
index;
260 ss.str(
""); ss <<
"["<< index <<
"]:" <<
" channel in TT with no data link, TP data ok; " <<
"Reco Action: recovery from TP data."; vTotalWithErr[
index].first = ss.str(); ++
index;
261 ss.str(
""); ss <<
"["<< index <<
"]:" <<
" channel in TT with no data link and no TP data; " <<
"Reco Action: none."; vTotalWithErr[
index].first = ss.str(); ++
index;
263 unsigned int bits = 6;
264 ss.str(
""); ss <<
" bit["<< bits++ <<
"]:" <<
" HV good/not good;"; vTotalWithErr[
index].first = ss.str(); ++
index;
265 ss.str(
""); ss <<
" bit["<< bits++ <<
"]:" <<
" LV on/off;"; vTotalWithErr[
index].first = ss.str(); ++
index;
266 ss.str(
""); ss <<
" bit["<< bits++ <<
"]:" <<
" DAQ in/out;"; vTotalWithErr[
index].first = ss.str(); ++
index;
267 ss.str(
""); ss <<
" bit["<< bits++ <<
"]:" <<
" TP readout on/off;"; vTotalWithErr[
index].first = ss.str(); ++
index;
268 ss.str(
""); ss <<
" bit["<< bits++ <<
"]:" <<
" Trigger in/out;"; vTotalWithErr[
index].first = ss.str(); ++
index;
269 ss.str(
""); ss <<
" bit["<< bits++ <<
"]:" <<
" Temperature ok/not ok;"; vTotalWithErr[
index].first = ss.str(); ++
index;
270 ss.str(
""); ss <<
" bit["<< bits++ <<
"]:" <<
" Humidity ok/not;"; vTotalWithErr[
index].first = ss.str(); ++
index;
275 for (std::vector<EcalChannelStatusCode>::const_iterator vIter = vItems.begin(); vIter != vItems.end(); ++vIter){
276 stcode = vIter->getStatusCode();
278 setErr(stcode, vTotalWithErr);
283 for (std::vector< std::pair< std::string, unsigned int > >::const_iterator iTotalErr = vTotalWithErr.begin(); iTotalErr != vTotalWithErr.end(); ++iTotalErr){
284 if (iTotalErr->second != 0)
285 ss <<
"Total:" << iTotalErr->second <<
" Error:" << iTotalErr->first << std::endl;
293 const std::vector<EcalChannelStatusCode> barrelItems =
object().barrelItems();
294 const std::vector<EcalChannelStatusCode> endcapItems =
object().endcapItems();
295 std::stringstream
ss;
297 ss << std::endl <<
"------Barrel Items: " << std::endl;
298 ss <<
"---Total: " << barrelItems.size() << std::endl;
299 ss <<
"---With errors: " <<
ecalcond::bad(barrelItems) << std::endl;
302 ss << std::endl <<
"------Endcap Items: " << std::endl;
303 ss <<
"---Total: " << endcapItems.size() << std::endl;
304 ss <<
"---With errors: " <<
ecalcond::bad(endcapItems) << std::endl;
348 std::vector<int>
const&,
349 std::vector<float>
const& )
const {
351 gStyle->SetPalette(1);
353 const Int_t NRGBs = 5;
354 const Int_t NCont = 255;
356 Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
357 Double_t
red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
358 Double_t
green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
359 Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
360 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
361 gStyle->SetNumberContours(NCont);
363 TCanvas
canvas(
"CC map",
"CC map",800,800);
364 TPad* padb =
new TPad(
"padb",
"padb", 0., 0.55, 1., 1.);
366 TPad* padem =
new TPad(
"padem",
"padem", 0., 0., 0.45, 0.45);
368 TPad* padep =
new TPad(
"padep",
"padep", 0.55, 0., 1., 0.45);
377 TH2F*
barrel =
new TH2F(
"EB",
"EB Channel Status",360,0,360, 171, -85,86);
378 TH2F* endc_p =
new TH2F(
"EE+",
"EE+ Channel Status",100,1,101,100,1,101);
379 TH2F* endc_m =
new TH2F(
"EE-",
"EE- Channel Status",100,1,101,100,1,101);
382 int thesign =
sign==1 ? 1:-1;
386 EBDetId id((ieta+1)*thesign, iphi+1);
387 barrel->Fill(iphi, ieta*thesign + thesign,
object()[
id.rawId()].getStatusCode());
398 endc_p->Fill(ix+1,iy+1,
object()[
id.rawId()].getStatusCode());
401 endc_m->Fill(ix+1,iy+1,
object()[
id.rawId()].getStatusCode());
407 TLine*
l =
new TLine(0., 0., 0., 0.);
411 barrel->SetMaximum(14);
412 barrel->SetMinimum(0);
413 barrel->Draw(
"colz");
414 for(
int i = 0;
i <17;
i++) {
415 Double_t
x = 20.+ (
i *20);
416 l =
new TLine(x,-85.,x,86.);
419 l =
new TLine(0.,0.,360.,0.);
421 int ixSectorsEE[202] = {
422 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 56, 56, 46, 46, 44, 44, 43, 43, 42, 42,
423 41, 41, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 46, 46, 56, 56, 58, 58, 59, 59,
424 60, 60, 61, 61, 62, 62, 0,101,101, 98, 98, 96, 96, 93, 93, 88, 88, 86, 86, 81,
425 81, 76, 76, 66, 66, 61, 61, 41, 41, 36, 36, 26, 26, 21, 21, 16, 16, 14, 14, 9,
426 9, 6, 6, 4, 4, 1, 1, 4, 4, 6, 6, 9, 9, 14, 14, 16, 16, 21, 21, 26,
427 26, 36, 36, 41, 41, 61, 61, 66, 66, 76, 76, 81, 81, 86, 86, 88, 88, 93, 93, 96,
428 96, 98, 98,101,101, 0, 62, 66, 66, 71, 71, 81, 81, 91, 91, 93, 0, 62, 66, 66,
429 91, 91, 98, 0, 58, 61, 61, 66, 66, 71, 71, 76, 76, 81, 81, 0, 51, 51, 0, 44,
430 41, 41, 36, 36, 31, 31, 26, 26, 21, 21, 0, 40, 36, 36, 11, 11, 4, 0, 40, 36,
431 36, 31, 31, 21, 21, 11, 11, 9, 0, 46, 46, 41, 41, 36, 36, 0, 56, 56, 61, 61, 66, 66};
433 int iySectorsEE[202] = {
434 51, 56, 56, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 61, 61, 60, 60, 59, 59, 58,
435 58, 56, 56, 46, 46, 44, 44, 43, 43, 42, 42, 41, 41, 40, 40, 41, 41, 42, 42, 43,
436 43, 44, 44, 46, 46, 51, 0, 51, 61, 61, 66, 66, 76, 76, 81, 81, 86, 86, 88, 88,
437 93, 93, 96, 96, 98, 98,101,101, 98, 98, 96, 96, 93, 93, 88, 88, 86, 86, 81, 81,
438 76, 76, 66, 66, 61, 61, 41, 41, 36, 36, 26, 26, 21, 21, 16, 16, 14, 14, 9, 9,
439 6, 6, 4, 4, 1, 1, 4, 4, 6, 6, 9, 9, 14, 14, 16, 16, 21, 21, 26, 26,
440 36, 36, 41, 41, 51, 0, 46, 46, 41, 41, 36, 36, 31, 31, 26, 26, 0, 51, 51, 56,
441 56, 61, 61, 0, 61, 61, 66, 66, 71, 71, 76, 76, 86, 86, 88, 0, 62,101, 0, 61,
442 61, 66, 66, 71, 71, 76, 76, 86, 86, 88, 0, 51, 51, 56, 56, 61, 61, 0, 46, 46,
443 41, 41, 36, 36, 31, 31, 26, 26, 0, 40, 31, 31, 16, 16, 6, 0, 40, 31, 31, 16, 16, 6};
447 endc_m->SetMaximum(14);
448 endc_m->SetMinimum(0);
449 endc_m->Draw(
"colz");
450 for (
int i=0;
i<201;
i=
i+1) {
451 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
452 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
453 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
454 ixSectorsEE[i+1], iySectorsEE[i+1]);
459 endc_p->SetMaximum(14);
460 endc_p->SetMinimum(0);
461 endc_p->Draw(
"colz");
462 for (
int i=0;
i<201;
i=
i+1) {
463 if ( (ixSectorsEE[
i]!=0 || iySectorsEE[
i]!=0) &&
464 (ixSectorsEE[
i+1]!=0 || iySectorsEE[
i+1]!=0) ) {
465 l->DrawLine(ixSectorsEE[
i], iySectorsEE[i],
466 ixSectorsEE[i+1], iySectorsEE[i+1]);
469 canvas.SaveAs(filename.c_str());
474 namespace condPython {
476 void defineWhat<cond::ecalcond::Container>() {
477 using namespace boost::python;
478 enum_<cond::ecalcond::How>(
"How")
487 class_<What>(
"What",init<>())
488 .def(
"set_how",&What::set_how)
489 .def(
"set_which",&What::set_which)
490 .def(
"how",&What::how, return_value_policy<copy_const_reference>())
491 .def(
"which",&
What::which, return_value_policy<copy_const_reference>())
void extractSuperModules(Container const &cont, std::vector< int > const &which, std::vector< float > &result)
std::string plot(std::string const &, std::string const &, std::vector< int > const &, std::vector< float > const &) const
tuple cont
load Luminosity info ##
EcalChannelStatus Container
void setErr(unsigned int const &statusCode, std::vector< std::pair< std::string, unsigned int > > &vTotalWithErr)
static const int kBarlRings
const Items & barrelItems() const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision bits
Code getStatusCode() const
return decoded status
boost::function< void(Container const &cont, std::vector< int > const &which, std::vector< float > &result)> CondExtractor
#define PYTHON_WRAPPER(_class, _name)
static std::string dumpXML(const EcalCondHeader &header, const EcalChannelStatus &record)
int bad(Items const &cont)
static const int kBarlWedges
std::string summary() const
static const int kEndcWedgesX
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Container::value_type value_type
std::string StCodeToStr(unsigned int const &statusCode)
static const int MAX_IPHI
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
static const int MAX_IETA
std::vector< Item > Items
void extractSingleChannel(Container const &cont, std::vector< int > const &which, std::vector< float > &result)
void extractBarrel(Container const &cont, std::vector< int > const &, std::vector< float > &result)
const Items & endcapItems() const
std::string getTotalErrors(const std::vector< EcalChannelStatusCode > &vItems)
void extractEndcap(Container const &cont, std::vector< int > const &, std::vector< float > &result)
void extractAll(Container const &cont, std::vector< int > const &, std::vector< float > &result)
static const int kEndcWedgesY