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

#include <DTChamberEfficiencyClient.h>

Inheritance diagram for DTChamberEfficiencyClient:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 DTChamberEfficiencyClient (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTChamberEfficiencyClient ()
 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)
 
void beginJob ()
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 DQM Client Diagnostic. More...
 
void beginRun (const edm::Run &run, const edm::EventSetup &setup)
 
void bookHistos ()
 book the report summary More...
 
void endJob ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
 
void endRun (edm::Run const &run, edm::EventSetup const &c)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Attributes

DQMStoredbe
 
std::map< int, MonitorElement * > EffDistrPerWh
 
MonitorElementglobalEffDistr
 
MonitorElementglobalEffSummary
 
edm::ESHandle< DTGeometrymuonGeom
 
int nevents
 
unsigned int nLumiSegs
 
int prescaleFactor
 
MonitorElementsummaryHistos [5][2]
 

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 37 of file DTChamberEfficiencyClient.h.

Constructor & Destructor Documentation

DTChamberEfficiencyClient::DTChamberEfficiencyClient ( const edm::ParameterSet ps)

Constructor.

Definition at line 27 of file DTChamberEfficiencyClient.cc.

References edm::ParameterSet::getUntrackedParameter(), cppFunctionSkipper::operator, and dtDQMClient_cfg::prescaleFactor.

28 {
29 
30  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
31  << "DTChamberEfficiencyClient: Constructor called";
32 
34 
35  prescaleFactor = pSet.getUntrackedParameter<int>("diagnosticPrescale", 1);
36 }
DTChamberEfficiencyClient::~DTChamberEfficiencyClient ( )
virtual

Destructor.

Definition at line 38 of file DTChamberEfficiencyClient.cc.

39 {
40  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
41  << "DTChamberEfficiencyClient: Destructor called";
42 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 75 of file DTChamberEfficiencyClient.cc.

References nevents.

76 {
77 
78  nevents++;
79  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
80  << "[DTChamberEfficiencyClient]: " << nevents << " events";
81  return;
82 }
void DTChamberEfficiencyClient::beginJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 44 of file DTChamberEfficiencyClient.cc.

References bookHistos(), and nevents.

45 {
46  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
47  << "DTChamberEfficiencyClient: BeginJob";
48 
49  nevents = 0;
50 
51  bookHistos();
52 
53  return;
54 }
void bookHistos()
book the report summary
void DTChamberEfficiencyClient::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protectedvirtual

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 56 of file DTChamberEfficiencyClient.cc.

57 {
58  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
59  << "[DTChamberEfficiencyClient]: Begin of LS transition";
60 
61  return;
62 }
void DTChamberEfficiencyClient::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 64 of file DTChamberEfficiencyClient.cc.

References edm::EventSetup::get().

65 {
66  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
67  << "DTChamberEfficiencyClient: beginRun";
68 
69  // Get the DT Geometry
70  setup.get<MuonGeometryRecord>().get(muonGeom);
71 
72  return;
73 }
const T & get() const
Definition: EventSetup.h:55
edm::ESHandle< DTGeometry > muonGeom
void DTChamberEfficiencyClient::bookHistos ( )
protected

book the report summary

Definition at line 232 of file DTChamberEfficiencyClient.cc.

233 {
234 
235  dbe->setCurrentFolder("DT/05-ChamberEff");
236  globalEffSummary = dbe->book2D("EfficiencyGlbSummary","Efficiency Summary",12,1,13,5,-2,3);
237  globalEffSummary->setAxisTitle("sector",1);
238  globalEffSummary->setAxisTitle("wheel",2);
239 
240  globalEffDistr = dbe->book1D("TotalEfficiency","Total efficiency",51,0.,1.02);
241  globalEffDistr -> setAxisTitle("Eff",1);
242 
243  for(int wh=-2; wh<=2; wh++){
244  stringstream wheel; wheel << wh;
245  string histoNameAll = "EfficiencyMap_All_W" + wheel.str();
246  string histoTitleAll = "Efficiency map for all segments for wheel " + wheel.str();
247 
248  string histoNameQual = "EfficiencyMap_Qual_W" + wheel.str();
249  string histoTitleQual = "Efficiency map for quality segments for wheel " + wheel.str();
250 
251  string histoNameEff = "Efficiency_W" + wheel.str();
252  string histoTitleEff = "Segment efficiency, wheel " + wheel.str();
253 
254  dbe->setCurrentFolder("DT/05-ChamberEff");
255 
256  summaryHistos[wh+2][0] = dbe->book2D(histoNameAll.c_str(),histoTitleAll.c_str(),14,1.,15.,4,1.,5.);
257  summaryHistos[wh+2][0]->setAxisTitle("Sector",1);
258  summaryHistos[wh+2][0]->setBinLabel(1,"MB1",2);
259  summaryHistos[wh+2][0]->setBinLabel(2,"MB2",2);
260  summaryHistos[wh+2][0]->setBinLabel(3,"MB3",2);
261  summaryHistos[wh+2][0]->setBinLabel(4,"MB4",2);
262 
263  EffDistrPerWh[wh+2] = dbe -> book1D(histoNameEff.c_str(),histoTitleEff.c_str(),51,0.,1.02);
264  EffDistrPerWh[wh+2] -> setAxisTitle("Eff",1);
265 
266  dbe->setCurrentFolder("DT/05-ChamberEff/HighQual");
267 
268  summaryHistos[wh+2][1] = dbe->book2D(histoNameQual.c_str(),histoTitleQual.c_str(),14,1.,15.,4,1.,5.);
269  summaryHistos[wh+2][1]->setAxisTitle("Sector",1);
270  summaryHistos[wh+2][1]->setBinLabel(1,"MB1",2);
271  summaryHistos[wh+2][1]->setBinLabel(2,"MB2",2);
272  summaryHistos[wh+2][1]->setBinLabel(3,"MB3",2);
273  summaryHistos[wh+2][1]->setBinLabel(4,"MB4",2);
274 
275  }
276 
277  return;
278 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
std::map< int, MonitorElement * > EffDistrPerWh
MonitorElement * summaryHistos[5][2]
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:1082
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
void DTChamberEfficiencyClient::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 225 of file DTChamberEfficiencyClient.cc.

226 {
227  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
228  << "DTChamberEfficiencyClient: endJob";
229  return;
230 }
void DTChamberEfficiencyClient::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 84 of file DTChamberEfficiencyClient.cc.

85 {
86  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
87  << "DTChamberEfficiencyClient: endluminosityBlock";
88 }
void DTChamberEfficiencyClient::endRun ( edm::Run const &  run,
edm::EventSetup const &  c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 91 of file DTChamberEfficiencyClient.cc.

References HcalObjRepresent::Fill(), MonitorElement::getBinContent(), MonitorElement::getBinError(), MonitorElement::getTH2F(), j, gen::k, LogTrace, funct::pow(), mathSSE::sqrt(), and relativeConstraints::station.

92 {
93  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
94  << "DTChamberEfficiencyClient: endRun";
95  // reset the global summary
97 
98  //Loop over the wheels
99  for(int wheel=-2;wheel<=2;wheel++){
100  stringstream wheel_str; wheel_str << wheel;
101 
102  // Get the ME produced by EfficiencyTask Source
103  // All means no selection on segments, Qual means segments with at least 12 hits
104  MonitorElement* MECountAll = dbe->get("DT/05-ChamberEff/Task/hCountSectVsChamb_All_W" + wheel_str.str());
105  MonitorElement* MECountQual = dbe->get("DT/05-ChamberEff/Task/hCountSectVsChamb_Qual_W" + wheel_str.str());
106  MonitorElement* MEExtrap = dbe->get("DT/05-ChamberEff/Task/hExtrapSectVsChamb_W" + wheel_str.str());
107 
108  //get the TH2F
109  if(!MECountAll || !(MECountAll->getTH2F())) {
110  edm::LogWarning("DTChamberEfficiencyClient") << "ME not available" << std::endl;
111  return;
112  }
113 
114  TH2F* hCountAll = MECountAll->getTH2F();
115  TH2F* hCountQual = MECountQual->getTH2F();
116  TH2F* hExtrap = MEExtrap->getTH2F();
117 
118 
119 
120  const int nBinX = summaryHistos[wheel+2][0]->getNbinsX();
121  const int nBinY = summaryHistos[wheel+2][0]->getNbinsY();
122 
123  for(int j=1;j<=nBinX;j++){
124  for(int k=1;k<=nBinY;k++){
125  summaryHistos[wheel+2][0]->setBinContent(j,k,0.);
126  summaryHistos[wheel+2][1]->setBinContent(j,k,0.);
127 
128  const float numerAll = hCountAll->GetBinContent(j,k);
129  const float numerQual = hCountQual->GetBinContent(j,k);
130  const float denom = hExtrap->GetBinContent(j,k);
131 
132  if(denom != 0.){
133  const float effAll= numerAll/denom;
134  const float eff_error_All = sqrt((effAll+effAll*effAll)/denom);
135 
136  const float effQual= numerQual/denom;
137  const float eff_error_Qual = sqrt((effQual+effQual*effQual)/denom);
138 
139  //if(wheel == 2 && k == 2 && j == 2) cout << "Eff ch " << effAll << " " << lumiSeg.id() << endl;
140 
141  summaryHistos[wheel+2][0]->setBinContent(j,k,effAll);
142  summaryHistos[wheel+2][0]->setBinError(j,k,eff_error_All);
143 
144  summaryHistos[wheel+2][1]->setBinContent(j,k,effQual);
145  summaryHistos[wheel+2][1]->setBinError(j,k,eff_error_Qual);
146 
147  // Fill 1D eff distributions
148  globalEffDistr -> Fill(effAll);
149  EffDistrPerWh[wheel+2] -> Fill(effAll);
150 
151  }
152  }
153  }
154  }
155 
156  // fill the global eff. summary
157  // problems at a granularity smaller than the chamber are ignored
158  for(int wheel=-2; wheel<=2; wheel++) { // loop over wheels
159  // retrieve the chamber efficiency summary
160  MonitorElement * segmentWheelSummary = summaryHistos[wheel+2][0];
161  if(segmentWheelSummary != 0) {
162 
163  for(int sector=1; sector<=12; sector++) { // loop over sectors
164  float nFailingChambers = 0.;
165 
166  double meaneff = 0.;
167  double errorsum = 0.;
168 
169  for(int station = 1; station != 5; ++station) { // loop over stations
170 
171  const double tmpefficiency = segmentWheelSummary->getBinContent(sector, station);
172  const double tmpvariance = pow(segmentWheelSummary->getBinError(sector, station),2);
173 
174  //if(wheel == 2 && sector == 9) cout << "ch " << station << " " << tmpefficiency << " " << tmpvariance << " " << lumiSeg.id() << endl;
175 
176  if(tmpefficiency < 0.2 || tmpvariance == 0){
177  nFailingChambers++;
178  continue;
179  }
180 
181  meaneff += tmpefficiency/tmpvariance;
182  errorsum += 1./tmpvariance;
183 
184  LogTrace("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
185  << "Wheel: " << wheel << " Stat: " << station
186  << " Sect: " << sector << " status: " << meaneff/errorsum << endl;
187  }
188 
189  if(sector == 4 || sector == 10) {
190  int whichSector = (sector == 4) ? 13 : 14;
191 
192  const double tmpefficiency = segmentWheelSummary->getBinContent(whichSector, 4);
193  const double tmpvariance = pow(segmentWheelSummary->getBinError(whichSector, 4),2);
194 
195  if(tmpefficiency > 0.2 && tmpvariance != 0) {
196  meaneff += tmpefficiency/tmpvariance;
197  errorsum += 1./tmpvariance;
198  }
199  else nFailingChambers++;
200 
201  }
202 
203  double eff_result = 0;
204  if(errorsum != 0) eff_result = meaneff/errorsum;
205 
206  if(nFailingChambers != 0) {
207  if(sector != 4 && sector != 10) eff_result = eff_result*(4.-nFailingChambers)/4.;
208  else eff_result = eff_result*(5.-nFailingChambers)/5.;
209  }
210 
211  if(eff_result > 0.7) globalEffSummary->Fill(sector,wheel,1.);
212  else if(eff_result < 0.7 && eff_result > 0.5) globalEffSummary->Fill(sector,wheel,0.6);
213  else if(eff_result < 0.5 && eff_result > 0.3) globalEffSummary->Fill(sector,wheel,0.4);
214  else if(eff_result < 0.3 && eff_result > 0.) globalEffSummary->Fill(sector,wheel,0.15);
215 
216  //if(wheel == 2 && sector == 9) cout << "eff_result " << eff_result << endl;
217  //if(wheel == 2 && sector == 9) cout << "nfail " << nFailingChambers++ << endl;
218 
219  }
220  }
221  }
222  return;
223 }
void setBinContent(int binx, double content)
set content of bin (1-D)
int getNbinsY(void) const
get # of bins in Y-axis
void Fill(long long x)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
T sqrt(T t)
Definition: SSEVec.h:48
int j
Definition: DBlmapReader.cc:9
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1708
#define LogTrace(id)
int k[5][pyjets_maxn]
std::map< int, MonitorElement * > EffDistrPerWh
double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
MonitorElement * summaryHistos[5][2]
double getBinContent(int binx) const
get content of bin (1-D)
int getNbinsX(void) const
get # of bins in X-axis
TH2F * getTH2F(void) const
void Reset(void)
reset ME (ie. contents, errors, etc)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40

Member Data Documentation

DQMStore* DTChamberEfficiencyClient::dbe
private

Definition at line 69 of file DTChamberEfficiencyClient.h.

std::map<int, MonitorElement*> DTChamberEfficiencyClient::EffDistrPerWh
private

Definition at line 78 of file DTChamberEfficiencyClient.h.

MonitorElement* DTChamberEfficiencyClient::globalEffDistr
private

Definition at line 77 of file DTChamberEfficiencyClient.h.

MonitorElement* DTChamberEfficiencyClient::globalEffSummary
private

Definition at line 75 of file DTChamberEfficiencyClient.h.

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

Definition at line 71 of file DTChamberEfficiencyClient.h.

int DTChamberEfficiencyClient::nevents
private

Definition at line 65 of file DTChamberEfficiencyClient.h.

unsigned int DTChamberEfficiencyClient::nLumiSegs
private

Definition at line 66 of file DTChamberEfficiencyClient.h.

int DTChamberEfficiencyClient::prescaleFactor
private

Definition at line 67 of file DTChamberEfficiencyClient.h.

MonitorElement* DTChamberEfficiencyClient::summaryHistos[5][2]
private

Definition at line 74 of file DTChamberEfficiencyClient.h.