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

Public Member Functions

 DTChamberEfficiencyClient (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTChamberEfficiencyClient ()
 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)
 
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::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Private Attributes

DQMStoredbe
 
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
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 

Detailed Description

Definition at line 39 of file DTChamberEfficiencyClient.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 29 of file DTChamberEfficiencyClient.cc.

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

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

Destructor.

Definition at line 40 of file DTChamberEfficiencyClient.cc.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 77 of file DTChamberEfficiencyClient.cc.

References nevents.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 46 of file DTChamberEfficiencyClient.cc.

References bookHistos(), and nevents.

47 {
48  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
49  << "DTChamberEfficiencyClient: BeginJob";
50 
51  nevents = 0;
52 
53  bookHistos();
54 
55  return;
56 }
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 58 of file DTChamberEfficiencyClient.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 66 of file DTChamberEfficiencyClient.cc.

References edm::EventSetup::get().

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

book the report summary

Definition at line 222 of file DTChamberEfficiencyClient.cc.

223 {
224 
225  dbe->setCurrentFolder("DT/05-ChamberEff");
226  globalEffSummary = dbe->book2D("EfficiencyGlbSummary","Efficiency Summary",12,1,13,5,-2,3);
227  globalEffSummary->setAxisTitle("sector",1);
228  globalEffSummary->setAxisTitle("wheel",2);
229 
230 
231 
232  for(int wh=-2; wh<=2; wh++){
233  stringstream wheel; wheel << wh;
234  string histoNameAll = "EfficiencyMap_All_W" + wheel.str();
235  string histoTitleAll = "Efficiency map for all segments for wheel " + wheel.str();
236 
237  string histoNameQual = "EfficiencyMap_Qual_W" + wheel.str();
238  string histoTitleQual = "Efficiency map for quality segments for wheel " + wheel.str();
239 
240 
241  dbe->setCurrentFolder("DT/05-ChamberEff");
242 
243  summaryHistos[wh+2][0] = dbe->book2D(histoNameAll.c_str(),histoTitleAll.c_str(),14,1.,15.,4,1.,5.);
244  summaryHistos[wh+2][0]->setAxisTitle("Sector",1);
245  summaryHistos[wh+2][0]->setBinLabel(1,"MB1",2);
246  summaryHistos[wh+2][0]->setBinLabel(2,"MB2",2);
247  summaryHistos[wh+2][0]->setBinLabel(3,"MB3",2);
248  summaryHistos[wh+2][0]->setBinLabel(4,"MB4",2);
249 
250  dbe->setCurrentFolder("DT/05-ChamberEff/HighQual");
251 
252  summaryHistos[wh+2][1] = dbe->book2D(histoNameQual.c_str(),histoTitleQual.c_str(),14,1.,15.,4,1.,5.);
253  summaryHistos[wh+2][1]->setAxisTitle("Sector",1);
254  summaryHistos[wh+2][1]->setBinLabel(1,"MB1",2);
255  summaryHistos[wh+2][1]->setBinLabel(2,"MB2",2);
256  summaryHistos[wh+2][1]->setBinLabel(3,"MB3",2);
257  summaryHistos[wh+2][1]->setBinLabel(4,"MB4",2);
258  }
259 
260  return;
261 }
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)
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:642
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:232
void DTChamberEfficiencyClient::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 215 of file DTChamberEfficiencyClient.cc.

216 {
217  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
218  << "DTChamberEfficiencyClient: endJob";
219  return;
220 }
void DTChamberEfficiencyClient::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 86 of file DTChamberEfficiencyClient.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 93 of file DTChamberEfficiencyClient.cc.

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

94 {
95  LogVerbatim ("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
96  << "DTChamberEfficiencyClient: endRun";
97  // reset the global summary
99 
100  //Loop over the wheels
101  for(int wheel=-2;wheel<=2;wheel++){
102  stringstream wheel_str; wheel_str << wheel;
103 
104  // Get the ME produced by EfficiencyTask Source
105  // All means no selection on segments, Qual means segments with at least 12 hits
106  MonitorElement* MECountAll = dbe->get("DT/05-ChamberEff/Task/hCountSectVsChamb_All_W" + wheel_str.str());
107  MonitorElement* MECountQual = dbe->get("DT/05-ChamberEff/Task/hCountSectVsChamb_Qual_W" + wheel_str.str());
108  MonitorElement* MEExtrap = dbe->get("DT/05-ChamberEff/Task/hExtrapSectVsChamb_W" + wheel_str.str());
109 
110  //get the TH2F
111  TH2F* hCountAll = MECountAll->getTH2F();
112  TH2F* hCountQual = MECountQual->getTH2F();
113  TH2F* hExtrap = MEExtrap->getTH2F();
114 
115  const int nBinX = summaryHistos[wheel+2][0]->getNbinsX();
116  const int nBinY = summaryHistos[wheel+2][0]->getNbinsY();
117 
118  for(int j=1;j<=nBinX;j++){
119  for(int k=1;k<=nBinY;k++){
120  summaryHistos[wheel+2][0]->setBinContent(j,k,0.);
121  summaryHistos[wheel+2][1]->setBinContent(j,k,0.);
122 
123  const float numerAll = hCountAll->GetBinContent(j,k);
124  const float numerQual = hCountQual->GetBinContent(j,k);
125  const float denom = hExtrap->GetBinContent(j,k);
126 
127  if(denom != 0.){
128  const float effAll= numerAll/denom;
129  const float eff_error_All = sqrt((effAll+effAll*effAll)/denom);
130 
131  const float effQual= numerQual/denom;
132  const float eff_error_Qual = sqrt((effQual+effQual*effQual)/denom);
133 
134  //if(wheel == 2 && k == 2 && j == 2) cout << "Eff ch " << effAll << " " << lumiSeg.id() << endl;
135 
136  summaryHistos[wheel+2][0]->setBinContent(j,k,effAll);
137  summaryHistos[wheel+2][0]->setBinError(j,k,eff_error_All);
138 
139  summaryHistos[wheel+2][1]->setBinContent(j,k,effQual);
140  summaryHistos[wheel+2][1]->setBinError(j,k,eff_error_Qual);
141  }
142  }
143  }
144  }
145 
146  // fill the global eff. summary
147  // problems at a granularity smaller than the chamber are ignored
148  for(int wheel=-2; wheel<=2; wheel++) { // loop over wheels
149  // retrieve the chamber efficiency summary
150  MonitorElement * segmentWheelSummary = summaryHistos[wheel+2][0];
151  if(segmentWheelSummary != 0) {
152 
153  for(int sector=1; sector<=12; sector++) { // loop over sectors
154  float nFailingChambers = 0.;
155 
156  double meaneff = 0.;
157  double errorsum = 0.;
158 
159  for(int station = 1; station != 5; ++station) { // loop over stations
160 
161  const double tmpefficiency = segmentWheelSummary->getBinContent(sector, station);
162  const double tmpvariance = pow(segmentWheelSummary->getBinError(sector, station),2);
163 
164  //if(wheel == 2 && sector == 9) cout << "ch " << station << " " << tmpefficiency << " " << tmpvariance << " " << lumiSeg.id() << endl;
165 
166  if(tmpefficiency < 0.2 || tmpvariance == 0){
167  nFailingChambers++;
168  continue;
169  }
170 
171  meaneff += tmpefficiency/tmpvariance;
172  errorsum += 1./tmpvariance;
173 
174  LogTrace("DTDQM|DTMonitorClient|DTChamberEfficiencyClient")
175  << "Wheel: " << wheel << " Stat: " << station
176  << " Sect: " << sector << " status: " << meaneff/errorsum << endl;
177  }
178 
179  if(sector == 4 || sector == 10) {
180  int whichSector = (sector == 4) ? 13 : 14;
181 
182  const double tmpefficiency = segmentWheelSummary->getBinContent(whichSector, 4);
183  const double tmpvariance = pow(segmentWheelSummary->getBinError(whichSector, 4),2);
184 
185  if(tmpefficiency > 0.2 && tmpvariance != 0) {
186  meaneff += tmpefficiency/tmpvariance;
187  errorsum += 1./tmpvariance;
188  }
189  else nFailingChambers++;
190 
191  }
192 
193  double eff_result = 0;
194  if(errorsum != 0) eff_result = meaneff/errorsum;
195 
196  if(nFailingChambers != 0) {
197  if(sector != 4 && sector != 10) eff_result = eff_result*(4.-nFailingChambers)/4.;
198  else eff_result = eff_result*(5.-nFailingChambers)/5.;
199  }
200 
201  if(eff_result > 0.7) globalEffSummary->Fill(sector,wheel,1.);
202  else if(eff_result < 0.7 && eff_result > 0.5) globalEffSummary->Fill(sector,wheel,0.6);
203  else if(eff_result < 0.5 && eff_result > 0.3) globalEffSummary->Fill(sector,wheel,0.4);
204  else if(eff_result < 0.3 && eff_result > 0.) globalEffSummary->Fill(sector,wheel,0.15);
205 
206  //if(wheel == 2 && sector == 9) cout << "eff_result " << eff_result << endl;
207  //if(wheel == 2 && sector == 9) cout << "nfail " << nFailingChambers++ << endl;
208 
209  }
210  }
211  }
212  return;
213 }
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)
T sqrt(T t)
Definition: SSEVec.h:28
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:1265
#define LogTrace(id)
int k[5][pyjets_maxn]
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 71 of file DTChamberEfficiencyClient.h.

MonitorElement* DTChamberEfficiencyClient::globalEffSummary
private

Definition at line 77 of file DTChamberEfficiencyClient.h.

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

Definition at line 73 of file DTChamberEfficiencyClient.h.

int DTChamberEfficiencyClient::nevents
private

Definition at line 67 of file DTChamberEfficiencyClient.h.

unsigned int DTChamberEfficiencyClient::nLumiSegs
private

Definition at line 68 of file DTChamberEfficiencyClient.h.

int DTChamberEfficiencyClient::prescaleFactor
private

Definition at line 69 of file DTChamberEfficiencyClient.h.

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

Definition at line 76 of file DTChamberEfficiencyClient.h.