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
DTChamberEfficiencyTest Class Reference

#include <DTChamberEfficiencyTest.h>

Inheritance diagram for DTChamberEfficiencyTest:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 DTChamberEfficiencyTest (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTChamberEfficiencyTest ()
 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 &run, const edm::EventSetup &setup)
 BeginRun. More...
 
void bookHistos (const DTChamberId &ch)
 book the new ME More...
 
void bookHistos ()
 book the report summary 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 DTChamberId &chID)
 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
 
edm::ESHandle< DTGeometrymuonGeom
 
int nevents
 
unsigned int nLumiSegs
 
edm::ParameterSet parameters
 
int prescaleFactor
 
int run
 
std::map< int, MonitorElement * > summaryHistos
 
std::map< std::string,
MonitorElement * > 
xEfficiencyHistos
 
std::map< std::string,
MonitorElement * > 
xVSyEffHistos
 
std::map< std::string,
MonitorElement * > 
yEfficiencyHistos
 

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 DTChamberEfficiencyTest.h.

Constructor & Destructor Documentation

DTChamberEfficiencyTest::DTChamberEfficiencyTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 34 of file DTChamberEfficiencyTest.cc.

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

34  {
35 
36  edm::LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyTest") << "[DTChamberEfficiencyTest]: Constructor";
37 
38  parameters = ps;
39 
41 
42  prescaleFactor = parameters.getUntrackedParameter<int>("diagnosticPrescale", 1);
43 
44 }
T getUntrackedParameter(std::string const &, T const &) const
DTChamberEfficiencyTest::~DTChamberEfficiencyTest ( )
virtual

Destructor.

Definition at line 48 of file DTChamberEfficiencyTest.cc.

References nevents.

48  {
49 
50  edm::LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyTest") << "DTChamberEfficiencyTest: analyzed " << nevents << " events";
51 
52 }

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 91 of file DTChamberEfficiencyTest.cc.

References nevents.

91  {
92 
93  nevents++;
94  edm::LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyTest") << "[DTChamberEfficiencyTest]: "<<nevents<<" events";
95 
96 }
void DTChamberEfficiencyTest::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 55 of file DTChamberEfficiencyTest.cc.

References nevents.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 64 of file DTChamberEfficiencyTest.cc.

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

64  {
65 
66  edm::LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyTest") <<"[DTChamberEfficiencyTest]: Begin of LS transition";
67 
68  // Get the run number
69  run = lumiSeg.run();
70 
71 }
void DTChamberEfficiencyTest::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
protectedvirtual

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 74 of file DTChamberEfficiencyTest.cc.

References bookHistos(), and edm::EventSetup::get().

74  {
75 
76  // Get the DT Geometry
77  setup.get<MuonGeometryRecord>().get(muonGeom);
78 
79  // Loop over all the chambers
80  vector<const DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
81  vector<const DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
82  for (; ch_it != ch_end; ++ch_it) {
83  // histo booking
84  bookHistos((*ch_it)->id());
85  }
86 
87  //summary histo booking
88  bookHistos();
89 }
void bookHistos()
book the report summary
const T & get() const
Definition: EventSetup.h:55
edm::ESHandle< DTGeometry > muonGeom
void DTChamberEfficiencyTest::bookHistos ( const DTChamberId ch)
protected

book the new ME

Definition at line 257 of file DTChamberEfficiencyTest.cc.

References DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, and DTChamberId::wheel().

257  {
258 
259  stringstream wheel; wheel << chId.wheel();
260  stringstream station; station << chId.station();
261  stringstream sector; sector << chId.sector();
262 
263  string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
264  string xEfficiencyHistoName = "xEfficiency_" + HistoName;
265  string yEfficiencyHistoName = "yEfficiency_" + HistoName;
266  string xVSyEffHistoName = "xVSyEff_" + HistoName;
267 
268  dbe->setCurrentFolder("DT/01-DTChamberEfficiency/Wheel" + wheel.str() +
269  "/Sector" + sector.str() +
270  "/Station" + station.str());
271 
272  xEfficiencyHistos[HistoName] = dbe->book1D(xEfficiencyHistoName.c_str(),xEfficiencyHistoName.c_str(),25,-250.,250.);
273  yEfficiencyHistos[HistoName] = dbe->book1D(yEfficiencyHistoName.c_str(),yEfficiencyHistoName.c_str(),25,-250.,250.);
274  xVSyEffHistos[HistoName] = dbe->book2D(xVSyEffHistoName.c_str(),xVSyEffHistoName.c_str(),25,-250.,250., 25,-250.,250.);
275 
276 }
std::map< std::string, MonitorElement * > yEfficiencyHistos
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:942
std::map< std::string, MonitorElement * > xEfficiencyHistos
std::string HistoName
std::map< std::string, MonitorElement * > xVSyEffHistos
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 DTChamberEfficiencyTest::bookHistos ( )
protected

book the report summary

Definition at line 279 of file DTChamberEfficiencyTest.cc.

279  {
280 
281  for(int wh=-2; wh<=2; wh++){
282  stringstream wheel; wheel << wh;
283  string histoName = "chEfficiencySummary_W" + wheel.str();
284  dbe->setCurrentFolder("DT/01-DTChamberEfficiency");
285  summaryHistos[wh] = dbe->book2D(histoName.c_str(),histoName.c_str(),12,1,13,4,1,5);
286  summaryHistos[wh]->setAxisTitle("Sector",1);
287  summaryHistos[wh]->setBinLabel(1,"MB1",2);
288  summaryHistos[wh]->setBinLabel(2,"MB2",2);
289  summaryHistos[wh]->setBinLabel(3,"MB3",2);
290  summaryHistos[wh]->setBinLabel(4,"MB4",2);
291  }
292 
293 }
std::map< int, MonitorElement * > summaryHistos
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 DTChamberEfficiencyTest::endJob ( void  )
protectedvirtual

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 226 of file DTChamberEfficiencyTest.cc.

226  {
227 
228  edm::LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyTest") << "[DTChamberEfficiencyTest] endjob called!";
229 
230 }
void DTChamberEfficiencyTest::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
)
protectedvirtual

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 99 of file DTChamberEfficiencyTest.cc.

References QReport::getBadChannels(), MonitorElement::getTH2F(), edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), Parameters::parameters, dtDQMClient_cfg::prescaleFactor, DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, DTChamberId::wheel(), and cuy::yBin.

99  {
100 
101  // counts number of updats (online mode) or number of events (standalone mode)
102  //nevents++;
103  // if running in standalone perform diagnostic only after a reasonalbe amount of events
104  //if ( parameters.getUntrackedParameter<bool>("runningStandalone", false) &&
105  // nevents%parameters.getUntrackedParameter<int>("diagnosticPrescale", 1000) != 0 ) return;
106  //edm::LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyTest") << "[DTChamberEfficiencyTest]: "<<nevents<<" updates";
107 
108  edm::LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyTest") <<"[DTChamberEfficiencyTest]: 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 ("DTDQM|DTMonitorClient|DTChamberEfficiencyTest") <<"[DTChamberEfficiencyTest]: "<<nLumiSegs<<" updates";
117 
118 
119  vector<const DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
120  vector<const DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
121 
122  edm::LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyTest") << "[DTChamberEfficiencyTest]: ChamberEfficiency tests results";
123 
124  // Loop over the chambers
125  for (; ch_it != ch_end; ++ch_it) {
126  DTChamberId chID = (*ch_it)->id();
127 
128  stringstream wheel; wheel << chID.wheel();
129  stringstream station; station << chID.station();
130  stringstream sector; sector << chID.sector();
131 
132  string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
133 
134  // Get the ME produced by EfficiencyTask Source
135  MonitorElement * GoodSegDen_histo = dbe->get(getMEName("hEffGoodSegVsPosDen", chID));
136  MonitorElement * GoodCloseSegNum_histo = dbe->get(getMEName("hEffGoodCloseSegVsPosNum", chID));
137 
138  // ME -> TH1F
139  if(GoodSegDen_histo && GoodCloseSegNum_histo) {
140  TH2F * GoodSegDen_histo_root = GoodSegDen_histo->getTH2F();
141  TH2F * GoodCloseSegNum_histo_root = GoodCloseSegNum_histo->getTH2F();
142 
143  int lastBinX=(*GoodSegDen_histo_root).GetNbinsX();
144  TH1D* proxN=GoodCloseSegNum_histo_root->ProjectionX();
145  TH1D* proxD=GoodSegDen_histo_root->ProjectionX();
146 
147  int lastBinY=(*GoodSegDen_histo_root).GetNbinsY();
148  TH1D* proyN=GoodCloseSegNum_histo_root->ProjectionY();
149  TH1D* proyD=GoodSegDen_histo_root->ProjectionY();
150 
151  for(int xBin=1; xBin<=lastBinX; xBin++) {
152  if(proxD->GetBinContent(xBin)!=0){
153  float Xefficiency = proxN->GetBinContent(xBin) / proxD->GetBinContent(xBin);
154  xEfficiencyHistos.find(HistoName)->second->setBinContent(xBin, Xefficiency);
155  }
156 
157  for(int yBin=1; yBin<=lastBinY; yBin++) {
158  if(GoodSegDen_histo_root->GetBinContent(xBin, yBin)!=0){
159  float XvsYefficiency = GoodCloseSegNum_histo_root->GetBinContent(xBin, yBin) / GoodSegDen_histo_root->GetBinContent(xBin, yBin);
160  xVSyEffHistos.find(HistoName)->second->setBinContent(xBin, yBin, XvsYefficiency);
161  }
162  }
163 
164  }
165 
166  for(int yBin=1; yBin<=lastBinY; yBin++) {
167  if(proyD->GetBinContent(yBin)!=0){
168  float Yefficiency = proyN->GetBinContent(yBin) / proyD->GetBinContent(yBin);
169  yEfficiencyHistos.find(HistoName)->second->setBinContent(yBin, Yefficiency);
170  }
171  }
172  }
173  } // loop on chambers
174 
175 
176  // ChamberEfficiency test on X axis
177  string XEfficiencyCriterionName = parameters.getUntrackedParameter<string>("XEfficiencyTestName","ChEfficiencyInRangeX");
178  for(map<string, MonitorElement*>::const_iterator hXEff = xEfficiencyHistos.begin();
179  hXEff != xEfficiencyHistos.end();
180  hXEff++) {
181  const QReport * theXEfficiencyQReport = (*hXEff).second->getQReport(XEfficiencyCriterionName);
182  if(theXEfficiencyQReport) {
183  vector<dqm::me_util::Channel> badChannels = theXEfficiencyQReport->getBadChannels();
184  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
185  channel != badChannels.end(); channel++) {
186  edm::LogError ("DTDQM|DTMonitorClient|DTChamberEfficiencyTest") << "Chamber : " << (*hXEff).first << " Bad XChamberEfficiency channels: "<<(*channel).getBin()<<" Contents : "<<(*channel).getContents();
187  }
188  // FIXME: getMessage() sometimes returns and invalid string (null pointer inside QReport data member)
189  // edm::LogWarning ("DTDQM|DTMonitorClient|DTChamberEfficiencyTest") << "-------- Chamber : "<<(*hXEff).first<<" "<<theXEfficiencyQReport->getMessage()<<" ------- "<<theXEfficiencyQReport->getStatus();
190  }
191  }
192 
193 
194  // ChamberEfficiency test on Y axis
195  string YEfficiencyCriterionName = parameters.getUntrackedParameter<string>("YEfficiencyTestName","ChEfficiencyInRangeY");
196  for(map<string, MonitorElement*>::const_iterator hYEff = yEfficiencyHistos.begin();
197  hYEff != yEfficiencyHistos.end();
198  hYEff++) {
199  const QReport * theYEfficiencyQReport = (*hYEff).second->getQReport(YEfficiencyCriterionName);
200  if(theYEfficiencyQReport) {
201  vector<dqm::me_util::Channel> badChannels = theYEfficiencyQReport->getBadChannels();
202  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
203  channel != badChannels.end(); channel++) {
204  edm::LogError ("DTDQM|DTMonitorClient|DTChamberEfficiencyTest") << "Chamber : " << (*hYEff).first <<" Bad YChamberEfficiency channels: "<<(*channel).getBin()<<" Contents : "<<(*channel).getContents();
205  }
206  // FIXME: getMessage() sometimes returns and invalid string (null pointer inside QReport data member)
207  // edm::LogWarning ("DTDQM|DTMonitorClient|DTChamberEfficiencyTest") << "-------- Chamber : "<<(*hYEff).first<<" "<<theYEfficiencyQReport->getMessage()<<" ------- "<<theYEfficiencyQReport->getStatus();
208  }
209  }
210 
211  //Fill the report summary histos
212  for(int wh=-2; wh<=2; wh++){
213  for(int sec=1; sec<=12; sec++){
214  for(int st=1; st<=4; st++){
215 
216  summaryHistos[wh]->Fill(sec,st,1);
217 
218  }
219  }
220  }
221 
222 }
std::map< std::string, MonitorElement * > yEfficiencyHistos
T getUntrackedParameter(std::string const &, T const &) const
std::map< std::string, MonitorElement * > xEfficiencyHistos
tuple yBin
Definition: cuy.py:891
std::map< int, MonitorElement * > summaryHistos
std::string getMEName(std::string histoTag, const DTChamberId &chID)
Get the ME name.
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
std::string HistoName
int sector() const
Definition: DTChamberId.h:61
std::map< std::string, MonitorElement * > xVSyEffHistos
int station() const
Return the station number.
Definition: DTChamberId.h:51
TH2F * getTH2F(void) const
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
edm::ESHandle< DTGeometry > muonGeom
string DTChamberEfficiencyTest::getMEName ( std::string  histoTag,
const DTChamberId chID 
)
protected

Get the ME name.

Definition at line 235 of file DTChamberEfficiencyTest.cc.

References Parameters::parameters, DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, and DTChamberId::wheel().

235  {
236 
237  stringstream wheel; wheel << chID.wheel();
238  stringstream station; station << chID.station();
239  stringstream sector; sector << chID.sector();
240 
241  string folderRoot = parameters.getUntrackedParameter<string>("folderRoot", "Collector/FU0/");
242  string folderName =
243  folderRoot + "DT/01-DTChamberEfficiency/Task/Wheel" + wheel.str() +
244  "/Sector" + sector.str() +
245  "/Station" + station.str() + "/";
246 
247  string histoname = folderName + histoTag
248  + "_W" + wheel.str()
249  + "_St" + station.str()
250  + "_Sec" + sector.str();
251 
252  return histoname;
253 
254 }
T getUntrackedParameter(std::string const &, T const &) const
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* DTChamberEfficiencyTest::dbe
private

Definition at line 89 of file DTChamberEfficiencyTest.h.

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

Definition at line 92 of file DTChamberEfficiencyTest.h.

int DTChamberEfficiencyTest::nevents
private

Definition at line 84 of file DTChamberEfficiencyTest.h.

unsigned int DTChamberEfficiencyTest::nLumiSegs
private

Definition at line 85 of file DTChamberEfficiencyTest.h.

edm::ParameterSet DTChamberEfficiencyTest::parameters
private
int DTChamberEfficiencyTest::prescaleFactor
private

Definition at line 86 of file DTChamberEfficiencyTest.h.

int DTChamberEfficiencyTest::run
private
std::map< int, MonitorElement* > DTChamberEfficiencyTest::summaryHistos
private

Definition at line 97 of file DTChamberEfficiencyTest.h.

std::map< std::string , MonitorElement* > DTChamberEfficiencyTest::xEfficiencyHistos
private

Definition at line 94 of file DTChamberEfficiencyTest.h.

std::map< std::string , MonitorElement* > DTChamberEfficiencyTest::xVSyEffHistos
private

Definition at line 96 of file DTChamberEfficiencyTest.h.

std::map< std::string , MonitorElement* > DTChamberEfficiencyTest::yEfficiencyHistos
private

Definition at line 95 of file DTChamberEfficiencyTest.h.