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

Public Member Functions

 DTEfficiencyTest (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTEfficiencyTest ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

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::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

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
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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 42 of file DTEfficiencyTest.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 36 of file DTEfficiencyTest.cc.

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

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

Destructor.

Definition at line 50 of file DTEfficiencyTest.cc.

References nevents.

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

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 82 of file DTEfficiencyTest.cc.

References nevents.

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 57 of file DTEfficiencyTest.cc.

References nevents.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 72 of file DTEfficiencyTest.cc.

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

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

Analyze.

Reimplemented from edm::EDAnalyzer.

Definition at line 65 of file DTEfficiencyTest.cc.

References edm::EventSetup::get().

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

book the new ME

Definition at line 389 of file DTEfficiencyTest.cc.

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

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

book the summary histograms

Definition at line 411 of file DTEfficiencyTest.cc.

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

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 353 of file DTEfficiencyTest.cc.

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

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 89 of file DTEfficiencyTest.cc.

References newFWLiteAna::bin, bookHistos(), postValidation_cfi::efficiency, lumiContext::fill, QReport::getBadChannels(), MonitorElement::getTH1F(), interpolateCardsSimple::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().

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

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

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

Member Data Documentation

DQMStore* DTEfficiencyTest::dbe
private

Definition at line 91 of file DTEfficiencyTest.h.

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

Definition at line 96 of file DTEfficiencyTest.h.

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

Definition at line 94 of file DTEfficiencyTest.h.

int DTEfficiencyTest::nevents
private

Definition at line 85 of file DTEfficiencyTest.h.

unsigned int DTEfficiencyTest::nLumiSegs
private

Definition at line 86 of file DTEfficiencyTest.h.

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

Definition at line 89 of file DTEfficiencyTest.h.

int DTEfficiencyTest::prescaleFactor
private

Definition at line 87 of file DTEfficiencyTest.h.

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

Definition at line 97 of file DTEfficiencyTest.h.

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

Definition at line 100 of file DTEfficiencyTest.h.

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

Definition at line 101 of file DTEfficiencyTest.h.