CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTOfflineSummaryClients.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author M. Pelliccioni - INFN Torino
5  *
6  * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my
7  *
8  */
9 
10 
12 
13 // Framework
18 
22 
23 #include <string>
24 #include <cmath>
25 
26 using namespace edm;
27 using namespace std;
28 
29 
31 
32  LogVerbatim("DTDQM|DTMonitorClient|DTOfflineSummaryClients") << "[DTOfflineSummaryClients]: Constructor";
33 
34  bookingdone = 0;
35 
36 }
37 
39  LogVerbatim ("DTDQM|DTMonitorClient|DTOfflineSummaryClients") << "DTOfflineSummaryClients: analyzed " << nevents << " events";
40 
41 }
42 
43 
45 
47  edm::LuminosityBlock const & lumiSeg, edm::EventSetup const & context) {
48 
49  LogVerbatim("DTDQM|DTMonitorClient|DTOfflineSummaryClients")
50  << "[DTOfflineSummaryClients]: End of LS transition" << endl;
51 
52 }
53 
55 
56  LogVerbatim ("DTDQM|DTMonitorClient|DTOfflineSummaryClients") <<"[DTOfflineSummaryClients]: end job. Performin client operation";
57 
58  // book the summary histos
59 
60  ibooker.setCurrentFolder("DT/EventInfo");
61  summaryReport = ibooker.bookFloat("reportSummary");
62  // Initialize to 1 so that no alarms are thrown at the beginning of the run
63  summaryReport->Fill(1.);
64 
65  summaryReportMap = ibooker.book2D("reportSummaryMap","DT Report Summary Map",12,1,13,5,-2,3);
66  summaryReportMap->setAxisTitle("sector",1);
67  summaryReportMap->setAxisTitle("wheel",2);
68 
69  ibooker.setCurrentFolder("DT/EventInfo/reportSummaryContents");
70 
71  for(int wheel = -2; wheel != 3; ++wheel) {
72  stringstream streams;
73  streams << "DT_Wheel" << wheel;
74  string meName = streams.str();
75 
76  theSummaryContents.push_back(ibooker.bookFloat(meName));
77  // Initialize to 1 so that no alarms are thrown at the beginning of the run
78  theSummaryContents[wheel+2]->Fill(1.);
79  }
80 
81  // reset the monitor elements
83  summaryReport->Fill(0.);
84  for(int ii = 0; ii != 5; ++ii) {
85  theSummaryContents[ii]->Fill(0.);
86  }
87 
88  // Fill the map using, at the moment, only the information from DT chamber efficiency
89  // problems at a granularity smaller than the chamber are ignored
90  for(int wheel=-2; wheel<=2; wheel++) { // loop over wheels
91  // retrieve the chamber efficiency summary
92  stringstream str;
93  str << "DT/05-ChamberEff/EfficiencyMap_All_W" << wheel;
94  MonitorElement * segmentWheelSummary = igetter.get(str.str());
95  if(segmentWheelSummary != 0) {
96 
97  float nFailingChambers = 0.;
98 
99  for(int sector=1; sector<=12; sector++) { // loop over sectors
100 
101  double meaneff = 0.;
102  double errorsum = 0.;
103 
104  for(int station = 1; station != 5; ++station) { // loop over stations
105 
106  const double tmpefficiency = segmentWheelSummary->getBinContent(sector, station);
107  const double tmpvariance = pow(segmentWheelSummary->getBinError(sector, station),2);
108 
109  if(tmpefficiency == 0 || tmpvariance == 0){
110  nFailingChambers++;
111  continue;
112  }
113 
114  meaneff += tmpefficiency/tmpvariance;
115  errorsum += 1./tmpvariance;
116 
117  if(tmpefficiency < 0.2) nFailingChambers++;
118 
119  LogTrace("DTDQM|DTMonitorClient|DTOfflineSummaryClients")
120  << "Wheel: " << wheel << " Stat: " << station << " Sect: " << sector << " status: " << meaneff/errorsum << endl;
121  }
122 
123  const double eff_result = meaneff/errorsum;
124 
125  if(eff_result > 0.7) summaryReportMap->Fill(sector,wheel,1.);
126  else if(eff_result < 0.7 && eff_result > 0.5) summaryReportMap->Fill(sector,wheel,0.6);
127  else if(eff_result < 0.5 && eff_result > 0.3) summaryReportMap->Fill(sector,wheel,0.4);
128  else if(eff_result < 0.3 && eff_result > 0.) summaryReportMap->Fill(sector,wheel,0.15);
129 
130  }
131  theSummaryContents[wheel+2]->Fill((48.-nFailingChambers)/48.);
132  summaryReport->Fill(summaryReport->getFloatValue() + theSummaryContents[wheel+2]->getFloatValue()/5.);
133  } else {
134  LogWarning("DTDQM|DTMonitorClient|DTOfflineSummaryClients")
135  << " [DTOfflineSummaryClients] Segment Summary not found with name: " << str.str() << endl;
136  }
137  }
138 
139 }
140 
141 
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:304
int ii
Definition: cuy.py:588
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
void Fill(long long x)
double getFloatValue(void) const
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
EndLumi.
#define LogTrace(id)
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
EndJob.
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
std::vector< MonitorElement * > theSummaryContents
double getBinContent(int binx) const
get content of bin (1-D)
DTOfflineSummaryClients(const edm::ParameterSet &ps)
Constructor.
MonitorElement * bookFloat(Args &&...args)
Definition: DQMStore.h:109
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void Reset(void)
reset ME (ie. contents, errors, etc)
virtual ~DTOfflineSummaryClients()
Destructor.
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
Definition: Run.h:43