CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
DTEfficiencyTest Class Reference

#include <DTEfficiencyTest.h>

Inheritance diagram for DTEfficiencyTest:
DQMEDHarvester edm::one::EDProducer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources, edm::EndLuminosityBlockProducer > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 DTEfficiencyTest (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTEfficiencyTest ()
 Destructor. More...
 
- Public Member Functions inherited from DQMEDHarvester
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 DQMEDHarvester (void)
 
virtual void endJob () final
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &, edm::EventSetup const &) override final
 
virtual void endRun (edm::Run const &, edm::EventSetup const &) override
 
virtual void produce (edm::Event &, edm::EventSetup const &) override final
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources, edm::EndLuminosityBlockProducer >
 EDProducer ()=default
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void beginRun (const edm::Run &r, const edm::EventSetup &c)
 beginrun More...
 
void bookHistos (DQMStore::IBooker &, const DTLayerId &ch, int firstWire, int lastWire)
 book the new ME More...
 
void bookHistos (DQMStore::IBooker &, int wh)
 book the summary histograms More...
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &)
 
void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 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

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::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Definition at line 45 of file DTEfficiencyTest.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 35 of file DTEfficiencyTest.cc.

References metProducer_cfi::parameters.

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

Destructor.

Definition at line 47 of file DTEfficiencyTest.cc.

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

Member Function Documentation

void DTEfficiencyTest::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
protected

beginrun

Definition at line 54 of file DTEfficiencyTest.cc.

References edm::EventSetup::get().

54  {
55 
56  edm::LogVerbatim ("efficiency") << "[DTEfficiencyTest]: Begin run";
57 
58  nevents = 0;
59 
60  // Get the geometry
61  context.get<MuonGeometryRecord>().get(muonGeom);
62 
63 }
edm::ESHandle< DTGeometry > muonGeom
void DTEfficiencyTest::bookHistos ( DQMStore::IBooker ibooker,
const DTLayerId ch,
int  firstWire,
int  lastWire 
)
protected

book the new ME

Definition at line 355 of file DTEfficiencyTest.cc.

References DQMStore::IBooker::book1D(), DTLayerId::layer(), DTChamberId::sector(), DQMStore::IBooker::setCurrentFolder(), DTChamberId::station(), relativeConstraints::station, DTSuperLayerId::superlayer(), DTLayerId::superlayerId(), DTChamberId::wheel(), and makeMuonMisalignmentScenario::wheel.

355  {
356 
357  stringstream wheel; wheel << lId.superlayerId().wheel();
358  stringstream station; station << lId.superlayerId().station();
359  stringstream sector; sector << lId.superlayerId().sector();
360  stringstream superLayer; superLayer << lId.superlayerId().superlayer();
361  stringstream layer; layer << lId.layer();
362 
363  string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str();
364  string EfficiencyHistoName = "Efficiency_" + HistoName;
365  string UnassEfficiencyHistoName = "UnassEfficiency_" + HistoName;
366 
367  ibooker.setCurrentFolder("DT/Tests/DTEfficiency/Wheel" + wheel.str() +
368  "/Station" + station.str() +
369  "/Sector" + sector.str());
370 
371  EfficiencyHistos[lId] = ibooker.book1D(EfficiencyHistoName.c_str(),EfficiencyHistoName.c_str(),lastWire-firstWire+1, firstWire-0.5, lastWire+0.5);
372  UnassEfficiencyHistos[lId] = ibooker.book1D(UnassEfficiencyHistoName.c_str(),UnassEfficiencyHistoName.c_str(),lastWire-firstWire+1, firstWire-0.5, lastWire+0.5);
373 
374 }
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
std::map< DTLayerId, MonitorElement * > EfficiencyHistos
std::string HistoName
std::map< DTLayerId, MonitorElement * > UnassEfficiencyHistos
void DTEfficiencyTest::bookHistos ( DQMStore::IBooker ibooker,
int  wh 
)
protected

book the summary histograms

Definition at line 376 of file DTEfficiencyTest.cc.

References DQMStore::IBooker::book2D(), MonitorElement::setBinLabel(), DQMStore::IBooker::setCurrentFolder(), and makeMuonMisalignmentScenario::wheel.

376  {
377 
378  ibooker.setCurrentFolder("DT/Tests/DTEfficiency/SummaryPlot");
379 
380  if(wheelHistos.find(3) == wheelHistos.end()){
381  string histoName = "ESummary_testFailedByAtLeastBadSL";
382  wheelHistos[3] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,2);
383  wheelHistos[3]->setBinLabel(1,"Sector1",1);
384  wheelHistos[3]->setBinLabel(1,"Sector1",1);
385  wheelHistos[3]->setBinLabel(2,"Sector2",1);
386  wheelHistos[3]->setBinLabel(3,"Sector3",1);
387  wheelHistos[3]->setBinLabel(4,"Sector4",1);
388  wheelHistos[3]->setBinLabel(5,"Sector5",1);
389  wheelHistos[3]->setBinLabel(6,"Sector6",1);
390  wheelHistos[3]->setBinLabel(7,"Sector7",1);
391  wheelHistos[3]->setBinLabel(8,"Sector8",1);
392  wheelHistos[3]->setBinLabel(9,"Sector9",1);
393  wheelHistos[3]->setBinLabel(10,"Sector10",1);
394  wheelHistos[3]->setBinLabel(11,"Sector11",1);
395  wheelHistos[3]->setBinLabel(12,"Sector12",1);
396  wheelHistos[3]->setBinLabel(13,"Sector13",1);
397  wheelHistos[3]->setBinLabel(14,"Sector14",1);
398  wheelHistos[3]->setBinLabel(1,"Wheel-2",2);
399  wheelHistos[3]->setBinLabel(2,"Wheel-1",2);
400  wheelHistos[3]->setBinLabel(3,"Wheel0",2);
401  wheelHistos[3]->setBinLabel(4,"Wheel+1",2);
402  wheelHistos[3]->setBinLabel(5,"Wheel+2",2);
403  }
404  if(wheelUnassHistos.find(3) == wheelUnassHistos.end()){
405  string histoName = "UESummary_testFailedByAtLeastBadSL";
406  wheelUnassHistos[3] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,2);
407  wheelUnassHistos[3]->setBinLabel(1,"Sector1",1);
408  wheelUnassHistos[3]->setBinLabel(1,"Sector1",1);
409  wheelUnassHistos[3]->setBinLabel(2,"Sector2",1);
410  wheelUnassHistos[3]->setBinLabel(3,"Sector3",1);
411  wheelUnassHistos[3]->setBinLabel(4,"Sector4",1);
412  wheelUnassHistos[3]->setBinLabel(5,"Sector5",1);
413  wheelUnassHistos[3]->setBinLabel(6,"Sector6",1);
414  wheelUnassHistos[3]->setBinLabel(7,"Sector7",1);
415  wheelUnassHistos[3]->setBinLabel(8,"Sector8",1);
416  wheelUnassHistos[3]->setBinLabel(9,"Sector9",1);
417  wheelUnassHistos[3]->setBinLabel(10,"Sector10",1);
418  wheelUnassHistos[3]->setBinLabel(11,"Sector11",1);
419  wheelUnassHistos[3]->setBinLabel(12,"Sector12",1);
420  wheelUnassHistos[3]->setBinLabel(13,"Sector13",1);
421  wheelUnassHistos[3]->setBinLabel(14,"Sector14",1);
422  wheelUnassHistos[3]->setBinLabel(1,"Wheel-2",2);
423  wheelUnassHistos[3]->setBinLabel(2,"Wheel-1",2);
424  wheelUnassHistos[3]->setBinLabel(3,"Wheel0",2);
425  wheelUnassHistos[3]->setBinLabel(4,"Wheel+1",2);
426  wheelUnassHistos[3]->setBinLabel(5,"Wheel+2",2);
427  }
428 
429 
430  stringstream wheel; wheel <<wh;
431 
432  if(wheelHistos.find(wh) == wheelHistos.end()){
433  string histoName = "ESummary_testFailed_W" + wheel.str();
434  wheelHistos[wh] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
435  wheelHistos[wh]->setBinLabel(1,"Sector1",1);
436  wheelHistos[wh]->setBinLabel(2,"Sector2",1);
437  wheelHistos[wh]->setBinLabel(3,"Sector3",1);
438  wheelHistos[wh]->setBinLabel(4,"Sector4",1);
439  wheelHistos[wh]->setBinLabel(5,"Sector5",1);
440  wheelHistos[wh]->setBinLabel(6,"Sector6",1);
441  wheelHistos[wh]->setBinLabel(7,"Sector7",1);
442  wheelHistos[wh]->setBinLabel(8,"Sector8",1);
443  wheelHistos[wh]->setBinLabel(9,"Sector9",1);
444  wheelHistos[wh]->setBinLabel(10,"Sector10",1);
445  wheelHistos[wh]->setBinLabel(11,"Sector11",1);
446  wheelHistos[wh]->setBinLabel(12,"Sector12",1);
447  wheelHistos[wh]->setBinLabel(13,"Sector13",1);
448  wheelHistos[wh]->setBinLabel(14,"Sector14",1);
449  wheelHistos[wh]->setBinLabel(1,"MB1_SL1",2);
450  wheelHistos[wh]->setBinLabel(2,"MB1_SL2",2);
451  wheelHistos[wh]->setBinLabel(3,"MB1_SL3",2);
452  wheelHistos[wh]->setBinLabel(4,"MB2_SL1",2);
453  wheelHistos[wh]->setBinLabel(5,"MB2_SL2",2);
454  wheelHistos[wh]->setBinLabel(6,"MB2_SL3",2);
455  wheelHistos[wh]->setBinLabel(7,"MB3_SL1",2);
456  wheelHistos[wh]->setBinLabel(8,"MB3_SL2",2);
457  wheelHistos[wh]->setBinLabel(9,"MB3_SL3",2);
458  wheelHistos[wh]->setBinLabel(10,"MB4_SL1",2);
459  wheelHistos[wh]->setBinLabel(11,"MB4_SL3",2);
460  }
461  if(wheelUnassHistos.find(wh) == wheelUnassHistos.end()){
462  string histoName = "UESummary_testFailed_W" + wheel.str();
463  wheelUnassHistos[wh] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11);
464  wheelUnassHistos[wh]->setBinLabel(1,"Sector1",1);
465  wheelUnassHistos[wh]->setBinLabel(2,"Sector2",1);
466  wheelUnassHistos[wh]->setBinLabel(3,"Sector3",1);
467  wheelUnassHistos[wh]->setBinLabel(4,"Sector4",1);
468  wheelUnassHistos[wh]->setBinLabel(5,"Sector5",1);
469  wheelUnassHistos[wh]->setBinLabel(6,"Sector6",1);
470  wheelUnassHistos[wh]->setBinLabel(7,"Sector7",1);
471  wheelUnassHistos[wh]->setBinLabel(8,"Sector8",1);
472  wheelUnassHistos[wh]->setBinLabel(9,"Sector9",1);
473  wheelUnassHistos[wh]->setBinLabel(10,"Sector10",1);
474  wheelUnassHistos[wh]->setBinLabel(11,"Sector11",1);
475  wheelUnassHistos[wh]->setBinLabel(12,"Sector12",1);
476  wheelUnassHistos[wh]->setBinLabel(13,"Sector13",1);
477  wheelUnassHistos[wh]->setBinLabel(14,"Sector14",1);
478  wheelUnassHistos[wh]->setBinLabel(1,"MB1_SL1",2);
479  wheelUnassHistos[wh]->setBinLabel(2,"MB1_SL2",2);
480  wheelUnassHistos[wh]->setBinLabel(3,"MB1_SL3",2);
481  wheelUnassHistos[wh]->setBinLabel(4,"MB2_SL1",2);
482  wheelUnassHistos[wh]->setBinLabel(5,"MB2_SL2",2);
483  wheelUnassHistos[wh]->setBinLabel(6,"MB2_SL3",2);
484  wheelUnassHistos[wh]->setBinLabel(7,"MB3_SL1",2);
485  wheelUnassHistos[wh]->setBinLabel(8,"MB3_SL2",2);
486  wheelUnassHistos[wh]->setBinLabel(9,"MB3_SL3",2);
487  wheelUnassHistos[wh]->setBinLabel(10,"MB4_SL1",2);
488  wheelUnassHistos[wh]->setBinLabel(11,"MB4_SL3",2);
489  }
490 
491 }
std::map< int, MonitorElement * > wheelHistos
std::map< int, MonitorElement * > wheelUnassHistos
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
void DTEfficiencyTest::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
protectedvirtual

Implements DQMEDHarvester.

Definition at line 323 of file DTEfficiencyTest.cc.

323  {
324 
325  edm::LogVerbatim ("efficiency") << "[DTEfficiencyTest] endjob called!";
326 }
void DTEfficiencyTest::dqmEndLuminosityBlock ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protectedvirtual

DQM Client Diagnostic.

Reimplemented from DQMEDHarvester.

Definition at line 65 of file DTEfficiencyTest.cc.

References stringResolutionProvider_cfi::bin, bookHistos(), PostProcessor_cff::efficiency, lumiContext::fill, DQMStore::IGetter::get(), QReport::getBadChannels(), MonitorElement::getTH1F(), trackerHits::histo, mps_fire::i, edm::LuminosityBlockBase::id(), DTLayerId::layer(), edm::LuminosityBlockID::luminosityBlock(), genParticles_cff::map, metProducer_cfi::parameters, DTChamberId::sector(), mathSSE::sqrt(), DTChamberId::station(), relativeConstraints::station, DTSuperLayerId::superlayer(), DTChamberId::wheel(), and makeMuonMisalignmentScenario::wheel.

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

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

329  {
330 
331  stringstream wheel; wheel << lID.superlayerId().wheel();
332  stringstream station; station << lID.superlayerId().station();
333  stringstream sector; sector << lID.superlayerId().sector();
334  stringstream superLayer; superLayer << lID.superlayerId().superlayer();
335  stringstream layer; layer << lID.layer();
336 
337  string folderRoot = parameters.getUntrackedParameter<string>("folderRoot", "Collector/FU0/");
338  string folderName =
339  folderRoot + "DT/DTEfficiencyTask/Wheel" + wheel.str() +
340  "/Station" + station.str() +
341  "/Sector" + sector.str() +
342  "/SuperLayer" + superLayer.str() + "/";
343 
344  string histoname = folderName + histoTag
345  + "_W" + wheel.str()
346  + "_St" + station.str()
347  + "_Sec" + sector.str()
348  + "_SL" + superLayer.str()
349  + "_L" + layer.str();
350 
351  return histoname;
352 
353 }
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

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

Definition at line 89 of file DTEfficiencyTest.h.

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

Definition at line 87 of file DTEfficiencyTest.h.

int DTEfficiencyTest::nevents
private

Definition at line 80 of file DTEfficiencyTest.h.

unsigned int DTEfficiencyTest::nLumiSegs
private

Definition at line 81 of file DTEfficiencyTest.h.

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

Definition at line 84 of file DTEfficiencyTest.h.

int DTEfficiencyTest::prescaleFactor
private

Definition at line 82 of file DTEfficiencyTest.h.

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

Definition at line 90 of file DTEfficiencyTest.h.

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

Definition at line 93 of file DTEfficiencyTest.h.

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

Definition at line 94 of file DTEfficiencyTest.h.