CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Attributes
DTEfficiencyTest Class Reference

#include <DTEfficiencyTest.h>

Inheritance diagram for DTEfficiencyTest:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 DTEfficiencyTest (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTEfficiencyTest ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze. More...
 
void beginJob ()
 BeginJob. More...
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 Analyze. More...
 
void bookHistos (const DTLayerId &ch, int firstWire, int lastWire)
 book the new ME More...
 
void bookHistos (int wh)
 book the summary histograms More...
 
void endJob ()
 Endjob. More...
 
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
 DQM Client Diagnostic. More...
 
std::string getMEName (std::string histoTag, const DTLayerId &lID)
 Get the ME name. More...
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Attributes

DQMStoredbe
 
std::map< DTLayerId,
MonitorElement * > 
EfficiencyHistos
 
edm::ESHandle< DTGeometrymuonGeom
 
int nevents
 
unsigned int nLumiSegs
 
edm::ParameterSet parameters
 
int percentual
 
int prescaleFactor
 
int run
 
std::map< DTLayerId,
MonitorElement * > 
UnassEfficiencyHistos
 
std::map< int, MonitorElement * > wheelHistos
 
std::map< int, MonitorElement * > wheelUnassHistos
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 40 of file DTEfficiencyTest.h.

Constructor & Destructor Documentation

DTEfficiencyTest::DTEfficiencyTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 34 of file DTEfficiencyTest.cc.

References cppFunctionSkipper::operator, Parameters::parameters, and dtDQMClient_cfg::prescaleFactor.

34  {
35 
36  edm::LogVerbatim ("efficiency") << "[DTEfficiencyTest]: Constructor";
37 
38  parameters = ps;
39 
41 
42  prescaleFactor = parameters.getUntrackedParameter<int>("diagnosticPrescale", 1);
43 
44  percentual = parameters.getUntrackedParameter<int>("BadSLpercentual", 10);
45 
46 }
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet parameters
DTEfficiencyTest::~DTEfficiencyTest ( )
virtual

Destructor.

Definition at line 48 of file DTEfficiencyTest.cc.

References nevents.

48  {
49 
50  edm::LogVerbatim ("efficiency") << "DTEfficiencyTest: analyzed " << nevents << " events";
51 
52 }

Member Function Documentation

void DTEfficiencyTest::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

Analyze.

Implements edm::EDAnalyzer.

Definition at line 80 of file DTEfficiencyTest.cc.

References nevents.

80  {
81 
82  nevents++;
83  edm::LogVerbatim ("efficiency") << "[DTEfficiencyTest]: "<<nevents<<" events";
84 }
void DTEfficiencyTest::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 55 of file DTEfficiencyTest.cc.

References nevents.

55  {
56 
57  edm::LogVerbatim ("efficiency") << "[DTEfficiencyTest]: BeginJob";
58 
59  nevents = 0;
60 
61 }
void DTEfficiencyTest::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 70 of file DTEfficiencyTest.cc.

References edm::LuminosityBlockBase::run(), and DTTTrigCorrFirst::run.

70  {
71 
72  edm::LogVerbatim ("efficiency") <<"[DTEfficiencyTest]: Begin of LS transition";
73 
74  // Get the run number
75  run = lumiSeg.run();
76 
77 }
void DTEfficiencyTest::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

Analyze.

Reimplemented from edm::EDAnalyzer.

Definition at line 63 of file DTEfficiencyTest.cc.

References edm::EventSetup::get().

63  {
64 
65  // Get the geometry
66  context.get<MuonGeometryRecord>().get(muonGeom);
67 
68 }
edm::ESHandle< DTGeometry > muonGeom
void DTEfficiencyTest::bookHistos ( const DTLayerId ch,
int  firstWire,
int  lastWire 
)
protected

book the new ME

Definition at line 387 of file DTEfficiencyTest.cc.

References DTLayerId::layer(), DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, DTSuperLayerId::superlayer(), DTLayerId::superlayerId(), and DTChamberId::wheel().

387  {
388 
389  stringstream wheel; wheel << lId.superlayerId().wheel();
390  stringstream station; station << lId.superlayerId().station();
391  stringstream sector; sector << lId.superlayerId().sector();
392  stringstream superLayer; superLayer << lId.superlayerId().superlayer();
393  stringstream layer; layer << lId.layer();
394 
395  string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str();
396  string EfficiencyHistoName = "Efficiency_" + HistoName;
397  string UnassEfficiencyHistoName = "UnassEfficiency_" + HistoName;
398 
399  dbe->setCurrentFolder("DT/Tests/DTEfficiency/Wheel" + wheel.str() +
400  "/Station" + station.str() +
401  "/Sector" + sector.str());
402 
403  EfficiencyHistos[lId] = dbe->book1D(EfficiencyHistoName.c_str(),EfficiencyHistoName.c_str(),lastWire-firstWire+1, firstWire-0.5, lastWire+0.5);
404  UnassEfficiencyHistos[lId] = dbe->book1D(UnassEfficiencyHistoName.c_str(),UnassEfficiencyHistoName.c_str(),lastWire-firstWire+1, firstWire-0.5, lastWire+0.5);
405 
406 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:942
std::map< DTLayerId, MonitorElement * > EfficiencyHistos
std::string HistoName
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
std::map< DTLayerId, MonitorElement * > UnassEfficiencyHistos
void DTEfficiencyTest::bookHistos ( int  wh)
protected

book the summary histograms

Definition at line 409 of file DTEfficiencyTest.cc.

409  {
410 
411  dbe->setCurrentFolder("DT/Tests/DTEfficiency/SummaryPlot");
412 
413  if(wheelHistos.find(3) == wheelHistos.end()){
414  string histoName = "ESummary_testFailedByAtLeastBadSL";
415  wheelHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,2);
416  wheelHistos[3]->setBinLabel(1,"Sector1",1);
417  wheelHistos[3]->setBinLabel(1,"Sector1",1);
418  wheelHistos[3]->setBinLabel(2,"Sector2",1);
419  wheelHistos[3]->setBinLabel(3,"Sector3",1);
420  wheelHistos[3]->setBinLabel(4,"Sector4",1);
421  wheelHistos[3]->setBinLabel(5,"Sector5",1);
422  wheelHistos[3]->setBinLabel(6,"Sector6",1);
423  wheelHistos[3]->setBinLabel(7,"Sector7",1);
424  wheelHistos[3]->setBinLabel(8,"Sector8",1);
425  wheelHistos[3]->setBinLabel(9,"Sector9",1);
426  wheelHistos[3]->setBinLabel(10,"Sector10",1);
427  wheelHistos[3]->setBinLabel(11,"Sector11",1);
428  wheelHistos[3]->setBinLabel(12,"Sector12",1);
429  wheelHistos[3]->setBinLabel(13,"Sector13",1);
430  wheelHistos[3]->setBinLabel(14,"Sector14",1);
431  wheelHistos[3]->setBinLabel(1,"Wheel-2",2);
432  wheelHistos[3]->setBinLabel(2,"Wheel-1",2);
433  wheelHistos[3]->setBinLabel(3,"Wheel0",2);
434  wheelHistos[3]->setBinLabel(4,"Wheel+1",2);
435  wheelHistos[3]->setBinLabel(5,"Wheel+2",2);
436  }
437  if(wheelUnassHistos.find(3) == wheelUnassHistos.end()){
438  string histoName = "UESummary_testFailedByAtLeastBadSL";
439  wheelUnassHistos[3] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,2);
440  wheelUnassHistos[3]->setBinLabel(1,"Sector1",1);
441  wheelUnassHistos[3]->setBinLabel(1,"Sector1",1);
442  wheelUnassHistos[3]->setBinLabel(2,"Sector2",1);
443  wheelUnassHistos[3]->setBinLabel(3,"Sector3",1);
444  wheelUnassHistos[3]->setBinLabel(4,"Sector4",1);
445  wheelUnassHistos[3]->setBinLabel(5,"Sector5",1);
446  wheelUnassHistos[3]->setBinLabel(6,"Sector6",1);
447  wheelUnassHistos[3]->setBinLabel(7,"Sector7",1);
448  wheelUnassHistos[3]->setBinLabel(8,"Sector8",1);
449  wheelUnassHistos[3]->setBinLabel(9,"Sector9",1);
450  wheelUnassHistos[3]->setBinLabel(10,"Sector10",1);
451  wheelUnassHistos[3]->setBinLabel(11,"Sector11",1);
452  wheelUnassHistos[3]->setBinLabel(12,"Sector12",1);
453  wheelUnassHistos[3]->setBinLabel(13,"Sector13",1);
454  wheelUnassHistos[3]->setBinLabel(14,"Sector14",1);
455  wheelUnassHistos[3]->setBinLabel(1,"Wheel-2",2);
456  wheelUnassHistos[3]->setBinLabel(2,"Wheel-1",2);
457  wheelUnassHistos[3]->setBinLabel(3,"Wheel0",2);
458  wheelUnassHistos[3]->setBinLabel(4,"Wheel+1",2);
459  wheelUnassHistos[3]->setBinLabel(5,"Wheel+2",2);
460  }
461 
462 
463  stringstream wheel; wheel <<wh;
464 
465  if(wheelHistos.find(wh) == wheelHistos.end()){
466  string histoName = "ESummary_testFailed_W" + wheel.str();
467  wheelHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
468  wheelHistos[wh]->setBinLabel(1,"Sector1",1);
469  wheelHistos[wh]->setBinLabel(2,"Sector2",1);
470  wheelHistos[wh]->setBinLabel(3,"Sector3",1);
471  wheelHistos[wh]->setBinLabel(4,"Sector4",1);
472  wheelHistos[wh]->setBinLabel(5,"Sector5",1);
473  wheelHistos[wh]->setBinLabel(6,"Sector6",1);
474  wheelHistos[wh]->setBinLabel(7,"Sector7",1);
475  wheelHistos[wh]->setBinLabel(8,"Sector8",1);
476  wheelHistos[wh]->setBinLabel(9,"Sector9",1);
477  wheelHistos[wh]->setBinLabel(10,"Sector10",1);
478  wheelHistos[wh]->setBinLabel(11,"Sector11",1);
479  wheelHistos[wh]->setBinLabel(12,"Sector12",1);
480  wheelHistos[wh]->setBinLabel(13,"Sector13",1);
481  wheelHistos[wh]->setBinLabel(14,"Sector14",1);
482  wheelHistos[wh]->setBinLabel(1,"MB1_SL1",2);
483  wheelHistos[wh]->setBinLabel(2,"MB1_SL2",2);
484  wheelHistos[wh]->setBinLabel(3,"MB1_SL3",2);
485  wheelHistos[wh]->setBinLabel(4,"MB2_SL1",2);
486  wheelHistos[wh]->setBinLabel(5,"MB2_SL2",2);
487  wheelHistos[wh]->setBinLabel(6,"MB2_SL3",2);
488  wheelHistos[wh]->setBinLabel(7,"MB3_SL1",2);
489  wheelHistos[wh]->setBinLabel(8,"MB3_SL2",2);
490  wheelHistos[wh]->setBinLabel(9,"MB3_SL3",2);
491  wheelHistos[wh]->setBinLabel(10,"MB4_SL1",2);
492  wheelHistos[wh]->setBinLabel(11,"MB4_SL3",2);
493  }
494  if(wheelUnassHistos.find(wh) == wheelUnassHistos.end()){
495  string histoName = "UESummary_testFailed_W" + wheel.str();
496  wheelUnassHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
497  wheelUnassHistos[wh]->setBinLabel(1,"Sector1",1);
498  wheelUnassHistos[wh]->setBinLabel(2,"Sector2",1);
499  wheelUnassHistos[wh]->setBinLabel(3,"Sector3",1);
500  wheelUnassHistos[wh]->setBinLabel(4,"Sector4",1);
501  wheelUnassHistos[wh]->setBinLabel(5,"Sector5",1);
502  wheelUnassHistos[wh]->setBinLabel(6,"Sector6",1);
503  wheelUnassHistos[wh]->setBinLabel(7,"Sector7",1);
504  wheelUnassHistos[wh]->setBinLabel(8,"Sector8",1);
505  wheelUnassHistos[wh]->setBinLabel(9,"Sector9",1);
506  wheelUnassHistos[wh]->setBinLabel(10,"Sector10",1);
507  wheelUnassHistos[wh]->setBinLabel(11,"Sector11",1);
508  wheelUnassHistos[wh]->setBinLabel(12,"Sector12",1);
509  wheelUnassHistos[wh]->setBinLabel(13,"Sector13",1);
510  wheelUnassHistos[wh]->setBinLabel(14,"Sector14",1);
511  wheelUnassHistos[wh]->setBinLabel(1,"MB1_SL1",2);
512  wheelUnassHistos[wh]->setBinLabel(2,"MB1_SL2",2);
513  wheelUnassHistos[wh]->setBinLabel(3,"MB1_SL3",2);
514  wheelUnassHistos[wh]->setBinLabel(4,"MB2_SL1",2);
515  wheelUnassHistos[wh]->setBinLabel(5,"MB2_SL2",2);
516  wheelUnassHistos[wh]->setBinLabel(6,"MB2_SL3",2);
517  wheelUnassHistos[wh]->setBinLabel(7,"MB3_SL1",2);
518  wheelUnassHistos[wh]->setBinLabel(8,"MB3_SL2",2);
519  wheelUnassHistos[wh]->setBinLabel(9,"MB3_SL3",2);
520  wheelUnassHistos[wh]->setBinLabel(10,"MB4_SL1",2);
521  wheelUnassHistos[wh]->setBinLabel(11,"MB4_SL3",2);
522  }
523 
524 }
std::map< int, MonitorElement * > wheelHistos
std::map< int, MonitorElement * > wheelUnassHistos
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1070
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
void DTEfficiencyTest::endJob ( void  )
protectedvirtual

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 351 of file DTEfficiencyTest.cc.

351  {
352 
353  edm::LogVerbatim ("efficiency") << "[DTEfficiencyTest] endjob called!";
354 
355  dbe->rmdir("DT/Tests/DTEfficiency");
356 
357 }
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:3051
void DTEfficiencyTest::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
)
protectedvirtual

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 87 of file DTEfficiencyTest.cc.

References newFWLiteAna::bin, bookHistos(), counter, postValidation_cfi::efficiency, lumiContext::fill, QReport::getBadChannels(), MonitorElement::getTH1F(), timingPdfMaker::histo, i, edm::LuminosityBlockBase::id(), j, DTLayerId::layer(), edm::LuminosityBlockID::luminosityBlock(), python.multivaluedict::map(), Parameters::parameters, dtDQMClient_cfg::prescaleFactor, DTChamberId::sector(), mathSSE::sqrt(), DTChamberId::station(), relativeConstraints::station, DTSuperLayerId::superlayer(), and DTChamberId::wheel().

87  {
88 
89  // counts number of updats (online mode) or number of events (standalone mode)
90  //nevents++;
91  // if running in standalone perform diagnostic only after a reasonalbe amount of events
92  //if ( parameters.getUntrackedParameter<bool>("runningStandalone", false) &&
93  // nevents%parameters.getUntrackedParameter<int>("diagnosticPrescale", 1000) != 0 ) return;
94 
95 
96  for(map<int, MonitorElement*> ::const_iterator histo = wheelHistos.begin();
97  histo != wheelHistos.end();
98  histo++) {
99  (*histo).second->Reset();
100  }
101 
102  for(map<int, MonitorElement*> ::const_iterator histo = wheelUnassHistos.begin();
103  histo != wheelUnassHistos.end();
104  histo++) {
105  (*histo).second->Reset();
106  }
107 
108  edm::LogVerbatim ("efficiency") <<"[DTEfficiencyTest]: End of LS transition, performing the DQM client operation";
109 
110  // counts number of lumiSegs
111  nLumiSegs = lumiSeg.id().luminosityBlock();
112 
113  // prescale factor
114  if ( nLumiSegs%prescaleFactor != 0 ) return;
115 
116  edm::LogVerbatim ("efficiency") <<"[DTEfficiencyTest]: "<<nLumiSegs<<" updates";
117 
118  vector<const DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
119  vector<const DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
120 
121  edm::LogVerbatim ("efficiency") << "[DTEfficiencyTest]: Efficiency tests results";
122 
123 
124  map <DTLayerId, vector<double> > LayerBadCells;
125  LayerBadCells.clear();
126  map <DTLayerId, vector<double> > LayerUnassBadCells;
127  LayerUnassBadCells.clear();
128  map <DTSuperLayerId, vector<double> > SuperLayerBadCells;
129  SuperLayerBadCells.clear();
130  map <DTSuperLayerId,vector<double> > SuperLayerUnassBadCells;
131  SuperLayerUnassBadCells.clear();
132  map <pair<int,int>, int> cmsHistos;
133  cmsHistos.clear();
134  map <pair<int,int>, bool> filled;
135  for(int i=-2; i<3; i++){
136  for(int j=1; j<15; j++){
137  filled[make_pair(i,j)]=false;
138  }
139  }
140  map <pair<int,int>, int> cmsUnassHistos;
141  cmsUnassHistos.clear();
142  map <pair<int,int>, bool> UnassFilled;
143  for(int i=-2; i<3; i++){
144  for(int j=1; j<15; j++){
145  UnassFilled[make_pair(i,j)]=false;
146  }
147  }
148 
149 
150 
151  // Loop over the chambers
152  for (; ch_it != ch_end; ++ch_it) {
153  DTChamberId chID = (*ch_it)->id();
154  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
155  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
156 
157  // Loop over the SuperLayers
158  for(; sl_it != sl_end; ++sl_it) {
159  DTSuperLayerId slID = (*sl_it)->id();
160  vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
161  vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
162 
163  // Loop over the layers
164  for(; l_it != l_end; ++l_it) {
165  DTLayerId lID = (*l_it)->id();
166 
167  stringstream wheel; wheel << chID.wheel();
168  stringstream station; station << chID.station();
169  stringstream sector; sector << chID.sector();
170  stringstream superLayer; superLayer << slID.superlayer();
171  stringstream layer; layer << lID.layer();
172 
173  string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str();
174 
175  // Get the ME produced by EfficiencyTask Source
176  MonitorElement * occupancy_histo = dbe->get(getMEName("hEffOccupancy", lID));
177  MonitorElement * unassOccupancy_histo = dbe->get(getMEName("hEffUnassOccupancy", lID));
178  MonitorElement * recSegmOccupancy_histo = dbe->get(getMEName("hRecSegmOccupancy", lID));
179 
180  // ME -> TH1F
181  if(occupancy_histo && unassOccupancy_histo && recSegmOccupancy_histo) {
182  TH1F * occupancy_histo_root = occupancy_histo->getTH1F();
183  TH1F * unassOccupancy_histo_root = unassOccupancy_histo->getTH1F();
184  TH1F * recSegmOccupancy_histo_root = recSegmOccupancy_histo->getTH1F();
185 
186  const int firstWire = muonGeom->layer(lID)->specificTopology().firstChannel();
187  const int lastWire = muonGeom->layer(lID)->specificTopology().lastChannel();
188 
189  // Loop over the TH1F bin and fill the ME to be used for the Quality Test
190  for(int bin=firstWire; bin <= lastWire; bin++) {
191  if((recSegmOccupancy_histo_root->GetBinContent(bin))!=0) {
192  //cout<<"book histos"<<endl;
193  if (EfficiencyHistos.find(lID) == EfficiencyHistos.end()) bookHistos(lID, firstWire, lastWire);
194  float efficiency = occupancy_histo_root->GetBinContent(bin) / recSegmOccupancy_histo_root->GetBinContent(bin);
195  float errorEff = sqrt(efficiency*(1-efficiency) / recSegmOccupancy_histo_root->GetBinContent(bin));
196  EfficiencyHistos.find(lID)->second->setBinContent(bin, efficiency);
197  EfficiencyHistos.find(lID)->second->setBinError(bin, errorEff);
198 
199  if (UnassEfficiencyHistos.find(lID) == EfficiencyHistos.end()) bookHistos(lID, firstWire, lastWire);
200  float unassEfficiency = unassOccupancy_histo_root->GetBinContent(bin) / recSegmOccupancy_histo_root->GetBinContent(bin);
201  float errorUnassEff = sqrt(unassEfficiency*(1-unassEfficiency) / recSegmOccupancy_histo_root->GetBinContent(bin));
202  UnassEfficiencyHistos.find(lID)->second->setBinContent(bin, unassEfficiency);
203  UnassEfficiencyHistos.find(lID)->second->setBinError(bin, errorUnassEff);
204  }
205  }
206  }
207  } // loop on layers
208  } // loop on superlayers
209  } //loop on chambers
210 
211 
212 
213  // Efficiency test
214  //cout<<"[DTEfficiencyTest]: Efficiency Tests results"<<endl;
215  string EfficiencyCriterionName = parameters.getUntrackedParameter<string>("EfficiencyTestName","EfficiencyInRange");
216  for(map<DTLayerId, MonitorElement*>::const_iterator hEff = EfficiencyHistos.begin();
217  hEff != EfficiencyHistos.end();
218  hEff++) {
219  const QReport * theEfficiencyQReport = (*hEff).second->getQReport(EfficiencyCriterionName);
220  double counter=0;
221  if(theEfficiencyQReport) {
222  vector<dqm::me_util::Channel> badChannels = theEfficiencyQReport->getBadChannels();
223  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
224  channel != badChannels.end(); channel++) {
225  edm::LogError ("efficiency") <<"LayerID : "<<getMEName("hEffOccupancy",(*hEff).first)<< " Bad efficiency channels: "<<(*channel).getBin()<<" Contents : "<<(*channel).getContents();
226  counter++;
227  }
228  LayerBadCells[(*hEff).first].push_back(counter);
229  LayerBadCells[(*hEff).first].push_back(muonGeom->layer((*hEff).first)->specificTopology().channels());
230  // FIXME: getMessage() sometimes returns and invalid string (null pointer inside QReport data member)
231  // edm::LogWarning ("efficiency") << "-------- "<<theEfficiencyQReport->getMessage()<<" ------- "<<theEfficiencyQReport->getStatus();
232  }
233  }
234 
235 
236 
237  // UnassEfficiency test
238  //cout<<"[DTEfficiencyTest]: UnassEfficiency Tests results"<<endl;
239  string UnassEfficiencyCriterionName = parameters.getUntrackedParameter<string>("UnassEfficiencyTestName","UnassEfficiencyInRange");
240  for(map<DTLayerId, MonitorElement*>::const_iterator hUnassEff = UnassEfficiencyHistos.begin();
241  hUnassEff != UnassEfficiencyHistos.end();
242  hUnassEff++) {
243  const QReport * theUnassEfficiencyQReport = (*hUnassEff).second->getQReport(UnassEfficiencyCriterionName);
244  double counter=0;
245  if(theUnassEfficiencyQReport) {
246  vector<dqm::me_util::Channel> badChannels = theUnassEfficiencyQReport->getBadChannels();
247  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
248  channel != badChannels.end(); channel++) {
249  edm::LogError ("efficiency") << "Bad unassEfficiency channels: "<<(*channel).getBin()<<" "<<(*channel).getContents();
250  counter++;
251  }
252  LayerUnassBadCells[(*hUnassEff).first].push_back(counter);
253  LayerUnassBadCells[(*hUnassEff).first].push_back(double(muonGeom->layer((*hUnassEff).first)->specificTopology().channels()));
254  // FIXME: getMessage() sometimes returns and invalid string (null pointer inside QReport data member)
255  // edm::LogWarning ("efficiency") << theUnassEfficiencyQReport->getMessage()<<" ------- "<<theUnassEfficiencyQReport->getStatus();
256  }
257  }
258 
259 
260  vector<const DTChamber*>::const_iterator ch2_it = muonGeom->chambers().begin();
261  vector<const DTChamber*>::const_iterator ch2_end = muonGeom->chambers().end();
262  for (; ch2_it != ch2_end; ++ch2_it) {
263  vector<const DTSuperLayer*>::const_iterator sl2_it = (*ch2_it)->superLayers().begin();
264  vector<const DTSuperLayer*>::const_iterator sl2_end = (*ch2_it)->superLayers().end();
265  // Loop over the SLs
266  for(; sl2_it != sl2_end; ++sl2_it) {
267  DTSuperLayerId sl = (*sl2_it)->id();
268  double superLayerBadC=0;
269  double superLayerTotC=0;
270  double superLayerUnassBadC=0;
271  double superLayerUnassTotC=0;
272  bool fill=false;
273  vector<const DTLayer*>::const_iterator l2_it = (*sl2_it)->layers().begin();
274  vector<const DTLayer*>::const_iterator l2_end = (*sl2_it)->layers().end();
275  // Loop over the Ls
276  for(; l2_it != l2_end; ++l2_it) {
277  DTLayerId layerId = (*l2_it)->id();
278  if(LayerBadCells.find(layerId) != LayerBadCells.end() &&
279  LayerUnassBadCells.find(layerId) != LayerUnassBadCells.end()){
280  fill=true;
281  superLayerBadC+=LayerBadCells[layerId][0];
282  superLayerTotC+=LayerBadCells[layerId][1];
283  superLayerUnassBadC+=LayerUnassBadCells[layerId][0];
284  superLayerUnassTotC+=LayerUnassBadCells[layerId][1];
285  }
286  }
287  if(fill){
288  SuperLayerBadCells[sl].push_back(superLayerBadC);
289  SuperLayerBadCells[sl].push_back(superLayerTotC);
290  SuperLayerUnassBadCells[sl].push_back(superLayerUnassBadC);
291  SuperLayerUnassBadCells[sl].push_back(superLayerUnassTotC);
292  }
293  }
294  }
295 
296 
297  for(map<DTSuperLayerId, vector<double> >::const_iterator SLBCells = SuperLayerBadCells.begin();
298  SLBCells != SuperLayerBadCells.end();
299  SLBCells++) {
300  if((*SLBCells).second[0]/(*SLBCells).second[1] > double(percentual/100)){
301  if(wheelHistos.find((*SLBCells).first.wheel()) == wheelHistos.end()) bookHistos((*SLBCells).first.wheel());
302  if(!((*SLBCells).first.station() == 4 && (*SLBCells).first.superlayer() == 3))
303  wheelHistos[(*SLBCells).first.wheel()]->Fill((*SLBCells).first.sector()-1,((*SLBCells).first.superlayer()-1)+3*((*SLBCells).first.station()-1));
304  else
305  wheelHistos[(*SLBCells).first.wheel()]->Fill((*SLBCells).first.sector()-1,10);
306  // fill the cms summary histo if the percentual of SL which have not passed the test
307  // is more than a predefined treshold
308  cmsHistos[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())]++;
309  if(((*SLBCells).first.sector()<13 &&
310  double(cmsHistos[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())])/11>double(percentual)/100 &&
311  filled[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())]==false) ||
312  ((*SLBCells).first.sector()>=13 &&
313  double(cmsHistos[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())])/2>double(percentual)/100 &&
314  filled[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())]==false)){
315  filled[make_pair((*SLBCells).first.wheel(),(*SLBCells).first.sector())]=true;
316  wheelHistos[3]->Fill((*SLBCells).first.sector()-1,(*SLBCells).first.wheel());
317  }
318  }
319  }
320 
321 
322  for(map<DTSuperLayerId, vector<double> >::const_iterator SLUBCells = SuperLayerUnassBadCells.begin();
323  SLUBCells != SuperLayerUnassBadCells.end();
324  SLUBCells++) {
325  if((*SLUBCells).second[0]/(*SLUBCells).second[1] > double(percentual/100)){
326  if(wheelUnassHistos.find((*SLUBCells).first.wheel()) == wheelUnassHistos.end()) bookHistos((*SLUBCells).first.wheel());
327  if(!((*SLUBCells).first.station() == 4 && (*SLUBCells).first.superlayer() == 3))
328  wheelUnassHistos[(*SLUBCells).first.wheel()]->Fill((*SLUBCells).first.sector()-1,((*SLUBCells).first.superlayer()-1)+3*((*SLUBCells).first.station()-1));
329  else
330  wheelUnassHistos[(*SLUBCells).first.wheel()]->Fill((*SLUBCells).first.sector()-1,10);
331  // fill the cms summary histo if the percentual of SL which have not passed the test
332  // is more than a predefined treshold
333  cmsUnassHistos[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())]++;
334  if(((*SLUBCells).first.sector()<13 &&
335  double(cmsUnassHistos[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())])/11>double(percentual)/100 &&
336  UnassFilled[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())]==false) ||
337  ((*SLUBCells).first.sector()>=13 &&
338  double(cmsUnassHistos[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())])/2>double(percentual)/100 &&
339  UnassFilled[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())]==false)){
340  UnassFilled[make_pair((*SLUBCells).first.wheel(),(*SLUBCells).first.sector())]=true;
341  wheelUnassHistos[3]->Fill((*SLUBCells).first.sector()-1,(*SLUBCells).first.wheel());
342  }
343  }
344  }
345 
346 
347 
348 }
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
string fill
Definition: lumiContext.py:319
std::map< int, MonitorElement * > wheelHistos
edm::ParameterSet parameters
int layer() const
Return the layer number.
Definition: DTLayerId.h:53
void bookHistos(const DTLayerId &ch, int firstWire, int lastWire)
book the new ME
std::map< int, MonitorElement * > wheelUnassHistos
T sqrt(T t)
Definition: SSEVec.h:48
int j
Definition: DBlmapReader.cc:9
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1696
const std::vector< DQMChannel > & getBadChannels(void) const
Definition: QReport.h:33
unsigned int nLumiSegs
int superlayer() const
Return the superlayer number (deprecated method name)
edm::ESHandle< DTGeometry > muonGeom
std::map< DTLayerId, MonitorElement * > EfficiencyHistos
TH1F * getTH1F(void) const
std::string HistoName
int sector() const
Definition: DTChamberId.h:61
static std::atomic< unsigned int > counter
int station() const
Return the station number.
Definition: DTChamberId.h:51
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
std::map< DTLayerId, MonitorElement * > UnassEfficiencyHistos
std::string getMEName(std::string histoTag, const DTLayerId &lID)
Get the ME name.
string DTEfficiencyTest::getMEName ( std::string  histoTag,
const DTLayerId lID 
)
protected

Get the ME name.

Definition at line 360 of file DTEfficiencyTest.cc.

References DTLayerId::layer(), Parameters::parameters, DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, DTSuperLayerId::superlayer(), DTLayerId::superlayerId(), and DTChamberId::wheel().

360  {
361 
362  stringstream wheel; wheel << lID.superlayerId().wheel();
363  stringstream station; station << lID.superlayerId().station();
364  stringstream sector; sector << lID.superlayerId().sector();
365  stringstream superLayer; superLayer << lID.superlayerId().superlayer();
366  stringstream layer; layer << lID.layer();
367 
368  string folderRoot = parameters.getUntrackedParameter<string>("folderRoot", "Collector/FU0/");
369  string folderName =
370  folderRoot + "DT/DTEfficiencyTask/Wheel" + wheel.str() +
371  "/Station" + station.str() +
372  "/Sector" + sector.str() +
373  "/SuperLayer" + superLayer.str() + "/";
374 
375  string histoname = folderName + histoTag
376  + "_W" + wheel.str()
377  + "_St" + station.str()
378  + "_Sec" + sector.str()
379  + "_SL" + superLayer.str()
380  + "_L" + layer.str();
381 
382  return histoname;
383 
384 }
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet parameters
int layer() const
Return the layer number.
Definition: DTLayerId.h:53
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:59
int superlayer() const
Return the superlayer number (deprecated method name)
int sector() const
Definition: DTChamberId.h:61
int station() const
Return the station number.
Definition: DTChamberId.h:51
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45

Member Data Documentation

DQMStore* DTEfficiencyTest::dbe
private

Definition at line 89 of file DTEfficiencyTest.h.

std::map< DTLayerId , MonitorElement* > DTEfficiencyTest::EfficiencyHistos
private

Definition at line 94 of file DTEfficiencyTest.h.

edm::ESHandle<DTGeometry> DTEfficiencyTest::muonGeom
private

Definition at line 92 of file DTEfficiencyTest.h.

int DTEfficiencyTest::nevents
private

Definition at line 83 of file DTEfficiencyTest.h.

unsigned int DTEfficiencyTest::nLumiSegs
private

Definition at line 84 of file DTEfficiencyTest.h.

edm::ParameterSet DTEfficiencyTest::parameters
private
int DTEfficiencyTest::percentual
private

Definition at line 87 of file DTEfficiencyTest.h.

int DTEfficiencyTest::prescaleFactor
private

Definition at line 85 of file DTEfficiencyTest.h.

int DTEfficiencyTest::run
private
std::map< DTLayerId , MonitorElement* > DTEfficiencyTest::UnassEfficiencyHistos
private

Definition at line 95 of file DTEfficiencyTest.h.

std::map< int, MonitorElement* > DTEfficiencyTest::wheelHistos
private

Definition at line 98 of file DTEfficiencyTest.h.

std::map< int, MonitorElement* > DTEfficiencyTest::wheelUnassHistos
private

Definition at line 99 of file DTEfficiencyTest.h.