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:
DQMEDHarvester edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 DTChamberEfficiencyTest (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTChamberEfficiencyTest ()
 Destructor. More...
 
- Public Member Functions inherited from DQMEDHarvester
virtual void analyze (edm::Event const &, edm::EventSetup const &) final
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDHarvester (void)
 
virtual void endJob () final
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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 bookHistos (DQMStore::IBooker &, const DTChamberId &ch)
 book the new ME More...
 
void bookHistos (DQMStore::IBooker &)
 book the report summary More...
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 DQM Client Diagnostic. More...
 
std::string getMEName (std::string histoTag, const DTChamberId &chID)
 Get the ME name. More...
 
- Protected Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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

bool bookingdone
 
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::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Definition at line 44 of file DTChamberEfficiencyTest.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 35 of file DTChamberEfficiencyTest.cc.

References cmsHarvester::nevents, Parameters::parameters, and dtDQMClient_cfg::prescaleFactor.

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

Destructor.

Definition at line 51 of file DTChamberEfficiencyTest.cc.

References cmsHarvester::nevents.

51  {
52 
53  edm::LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyTest") << "DTChamberEfficiencyTest: analyzed " << nevents << " events";
54 
55 }

Member Function Documentation

void DTChamberEfficiencyTest::bookHistos ( DQMStore::IBooker ibooker,
const DTChamberId ch 
)
protected

book the new ME

Definition at line 220 of file DTChamberEfficiencyTest.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), DTChamberId::sector(), DQMStore::IBooker::setCurrentFolder(), DTChamberId::station(), relativeConstraints::station, and DTChamberId::wheel().

220  {
221 
222  stringstream wheel; wheel << chId.wheel();
223  stringstream station; station << chId.station();
224  stringstream sector; sector << chId.sector();
225 
226  string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
227  string xEfficiencyHistoName = "xEfficiency_" + HistoName;
228  string yEfficiencyHistoName = "yEfficiency_" + HistoName;
229  string xVSyEffHistoName = "xVSyEff_" + HistoName;
230 
231  ibooker.setCurrentFolder("DT/01-DTChamberEfficiency/Wheel" + wheel.str() +
232  "/Sector" + sector.str() +
233  "/Station" + station.str());
234 
235  xEfficiencyHistos[HistoName] = ibooker.book1D(xEfficiencyHistoName.c_str(),xEfficiencyHistoName.c_str(),25,-250.,250.);
236  yEfficiencyHistos[HistoName] = ibooker.book1D(yEfficiencyHistoName.c_str(),yEfficiencyHistoName.c_str(),25,-250.,250.);
237  xVSyEffHistos[HistoName] = ibooker.book2D(xVSyEffHistoName.c_str(),xVSyEffHistoName.c_str(),25,-250.,250., 25,-250.,250.);
238 
239 }
std::map< std::string, MonitorElement * > yEfficiencyHistos
std::map< std::string, MonitorElement * > xEfficiencyHistos
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
std::string HistoName
std::map< std::string, MonitorElement * > xVSyEffHistos
void DTChamberEfficiencyTest::bookHistos ( DQMStore::IBooker ibooker)
protected

book the report summary

Definition at line 241 of file DTChamberEfficiencyTest.cc.

References DQMStore::IBooker::book2D(), MonitorElement::setAxisTitle(), and DQMStore::IBooker::setCurrentFolder().

241  {
242 
243  for(int wh=-2; wh<=2; wh++){
244  stringstream wheel; wheel << wh;
245  string histoName = "chEfficiencySummary_W" + wheel.str();
246 
247  ibooker.setCurrentFolder("DT/01-DTChamberEfficiency");
248  summaryHistos[wh] = ibooker.book2D(histoName.c_str(),histoName.c_str(),12,1,13,4,1,5);
249  summaryHistos[wh]->setAxisTitle("Sector",1);
250  summaryHistos[wh]->setBinLabel(1,"MB1",2);
251  summaryHistos[wh]->setBinLabel(2,"MB2",2);
252  summaryHistos[wh]->setBinLabel(3,"MB3",2);
253  summaryHistos[wh]->setBinLabel(4,"MB4",2);
254  }
255 
256 }
std::map< int, MonitorElement * > summaryHistos
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
void DTChamberEfficiencyTest::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
overrideprotectedvirtual

Implements DQMEDHarvester.

Definition at line 193 of file DTChamberEfficiencyTest.cc.

193  {
194 
195  edm::LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyTest") << "[DTChamberEfficiencyTest] endjob called!";
196 
197 }
void DTChamberEfficiencyTest::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 57 of file DTChamberEfficiencyTest.cc.

References bookHistos(), edm::EventSetup::get(), DQMStore::IGetter::get(), 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.

58  {
59 
60  if (!bookingdone) {
61 
62  // Get the DT Geometry
63  context.get<MuonGeometryRecord>().get(muonGeom);
64 
65  // Loop over all the chambers
66  vector<const DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
67  vector<const DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
68  for (; ch_it != ch_end; ++ch_it) {
69  // histo booking
70  bookHistos(ibooker,(*ch_it)->id());
71  }
72 
73  //summary histo booking
74  bookHistos(ibooker);
75 
76  }
77 
78  bookingdone = 1;
79 
80  edm::LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyTest") <<"[DTChamberEfficiencyTest]: End of LS transition, performing the DQM client operation";
81 
82  // counts number of lumiSegs
83  nLumiSegs = lumiSeg.id().luminosityBlock();
84 
85  // prescale factor
86  if ( nLumiSegs%prescaleFactor != 0 ) return;
87 
88  edm::LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyTest") <<"[DTChamberEfficiencyTest]: "<<nLumiSegs<<" updates";
89 
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 ("DTDQM|DTMonitorClient|DTChamberEfficiencyTest") << "[DTChamberEfficiencyTest]: ChamberEfficiency tests results";
95 
96  // Loop over the chambers
97  for (; ch_it != ch_end; ++ch_it) {
98  DTChamberId chID = (*ch_it)->id();
99 
100  stringstream wheel; wheel << chID.wheel();
101  stringstream station; station << chID.station();
102  stringstream sector; sector << chID.sector();
103 
104  string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
105 
106  // Get the ME produced by EfficiencyTask Source
107 
108  MonitorElement * GoodSegDen_histo = igetter.get(getMEName("hEffGoodSegVsPosDen", chID));
109  MonitorElement * GoodCloseSegNum_histo = igetter.get(getMEName("hEffGoodCloseSegVsPosNum", chID));
110 
111  // ME -> TH1F
112  if(GoodSegDen_histo && GoodCloseSegNum_histo) {
113  TH2F * GoodSegDen_histo_root = GoodSegDen_histo->getTH2F();
114  TH2F * GoodCloseSegNum_histo_root = GoodCloseSegNum_histo->getTH2F();
115 
116  int lastBinX=(*GoodSegDen_histo_root).GetNbinsX();
117  TH1D* proxN=GoodCloseSegNum_histo_root->ProjectionX();
118  TH1D* proxD=GoodSegDen_histo_root->ProjectionX();
119 
120  int lastBinY=(*GoodSegDen_histo_root).GetNbinsY();
121  TH1D* proyN=GoodCloseSegNum_histo_root->ProjectionY();
122  TH1D* proyD=GoodSegDen_histo_root->ProjectionY();
123 
124  for(int xBin=1; xBin<=lastBinX; xBin++) {
125  if(proxD->GetBinContent(xBin)!=0){
126  float Xefficiency = proxN->GetBinContent(xBin) / proxD->GetBinContent(xBin);
127  xEfficiencyHistos.find(HistoName)->second->setBinContent(xBin, Xefficiency);
128  }
129 
130  for(int yBin=1; yBin<=lastBinY; yBin++) {
131  if(GoodSegDen_histo_root->GetBinContent(xBin, yBin)!=0){
132  float XvsYefficiency = GoodCloseSegNum_histo_root->GetBinContent(xBin, yBin) / GoodSegDen_histo_root->GetBinContent(xBin, yBin);
133  xVSyEffHistos.find(HistoName)->second->setBinContent(xBin, yBin, XvsYefficiency);
134  }
135  }
136 
137  }
138 
139  for(int yBin=1; yBin<=lastBinY; yBin++) {
140  if(proyD->GetBinContent(yBin)!=0){
141  float Yefficiency = proyN->GetBinContent(yBin) / proyD->GetBinContent(yBin);
142  yEfficiencyHistos.find(HistoName)->second->setBinContent(yBin, Yefficiency);
143  }
144  }
145  }
146  } // loop on chambers
147 
148 
149  // ChamberEfficiency test on X axis
150  string XEfficiencyCriterionName = parameters.getUntrackedParameter<string>("XEfficiencyTestName","ChEfficiencyInRangeX");
151  for(map<string, MonitorElement*>::const_iterator hXEff = xEfficiencyHistos.begin();
152  hXEff != xEfficiencyHistos.end();
153  hXEff++) {
154  const QReport * theXEfficiencyQReport = (*hXEff).second->getQReport(XEfficiencyCriterionName);
155  if(theXEfficiencyQReport) {
156  vector<dqm::me_util::Channel> badChannels = theXEfficiencyQReport->getBadChannels();
157  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
158  channel != badChannels.end(); channel++) {
159  edm::LogError ("DTDQM|DTMonitorClient|DTChamberEfficiencyTest") << "Chamber : " << (*hXEff).first << " Bad XChamberEfficiency channels: "<<(*channel).getBin()<<" Contents : "<<(*channel).getContents();
160  }
161  }
162  }
163 
164 
165  // ChamberEfficiency test on Y axis
166  string YEfficiencyCriterionName = parameters.getUntrackedParameter<string>("YEfficiencyTestName","ChEfficiencyInRangeY");
167  for(map<string, MonitorElement*>::const_iterator hYEff = yEfficiencyHistos.begin();
168  hYEff != yEfficiencyHistos.end();
169  hYEff++) {
170  const QReport * theYEfficiencyQReport = (*hYEff).second->getQReport(YEfficiencyCriterionName);
171  if(theYEfficiencyQReport) {
172  vector<dqm::me_util::Channel> badChannels = theYEfficiencyQReport->getBadChannels();
173  for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
174  channel != badChannels.end(); channel++) {
175  edm::LogError ("DTDQM|DTMonitorClient|DTChamberEfficiencyTest") << "Chamber : " << (*hYEff).first <<" Bad YChamberEfficiency channels: "<<(*channel).getBin()<<" Contents : "<<(*channel).getContents();
176  }
177  }
178  }
179 
180  //Fill the report summary histos
181  for(int wh=-2; wh<=2; wh++){
182  for(int sec=1; sec<=12; sec++){
183  for(int st=1; st<=4; st++){
184 
185  summaryHistos[wh]->Fill(sec,st,1);
186 
187  }
188  }
189  }
190 
191 }
std::map< std::string, MonitorElement * > yEfficiencyHistos
void bookHistos(DQMStore::IBooker &, const DTChamberId &ch)
book the new ME
T getUntrackedParameter(std::string const &, T const &) const
std::map< std::string, MonitorElement * > xEfficiencyHistos
tuple yBin
Definition: cuy.py:891
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:302
std::map< int, MonitorElement * > summaryHistos
std::string getMEName(std::string histoTag, const DTChamberId &chID)
Get the ME name.
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 199 of file DTChamberEfficiencyTest.cc.

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

199  {
200 
201  stringstream wheel; wheel << chID.wheel();
202  stringstream station; station << chID.station();
203  stringstream sector; sector << chID.sector();
204 
205  string folderRoot = parameters.getUntrackedParameter<string>("folderRoot", "Collector/FU0/");
206  string folderName =
207  folderRoot + "DT/01-DTChamberEfficiency/Task/Wheel" + wheel.str() +
208  "/Sector" + sector.str() +
209  "/Station" + station.str() + "/";
210 
211  string histoname = folderName + histoTag
212  + "_W" + wheel.str()
213  + "_St" + station.str()
214  + "_Sec" + sector.str();
215 
216  return histoname;
217 
218 }
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

bool DTChamberEfficiencyTest::bookingdone
private

Definition at line 79 of file DTChamberEfficiencyTest.h.

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

Definition at line 82 of file DTChamberEfficiencyTest.h.

int DTChamberEfficiencyTest::nevents
private

Definition at line 74 of file DTChamberEfficiencyTest.h.

unsigned int DTChamberEfficiencyTest::nLumiSegs
private

Definition at line 75 of file DTChamberEfficiencyTest.h.

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

Definition at line 76 of file DTChamberEfficiencyTest.h.

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

Definition at line 87 of file DTChamberEfficiencyTest.h.

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

Definition at line 84 of file DTChamberEfficiencyTest.h.

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

Definition at line 86 of file DTChamberEfficiencyTest.h.

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

Definition at line 85 of file DTChamberEfficiencyTest.h.