CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ESSummaryClient.cc
Go to the documentation of this file.
1 #include <memory>
2 #include <iostream>
3 #include <fstream>
4 #include <iomanip>
5 
7 
8 using namespace std;
9 
11  ESClient(ps),
12  meReportSummary_(0),
13  meReportSummaryMap_(0)
14 {
15  for(unsigned iZ(0); iZ != 2; ++iZ)
16  for(unsigned iD(0); iD != 2; ++iD)
17  meReportSummaryContents_[iZ][iD] = 0;
18 }
19 
21 }
22 
24 
25  if ( debug_ ) cout << "ESSummaryClient: setup" << endl;
26 
27  _ibooker.setCurrentFolder( prefixME_ + "/EventInfo" );
28 
29  meReportSummary_ = _ibooker.bookFloat("reportSummary");
30 
31  _ibooker.setCurrentFolder( prefixME_ + "/EventInfo/reportSummaryContents" );
32 
33  char histo[200];
34 
35  for (int i=0 ; i<2; ++i){
36  for (int j=0 ; j<2; ++j){
37  int iz = (i==0)? 1:-1;
38  sprintf(histo, "EcalPreshower Z %d P %d", iz, j+1);
39  meReportSummaryContents_[i][j] = _ibooker.bookFloat(histo);
40  }
41  }
42 
43  _ibooker.setCurrentFolder( prefixME_ + "/EventInfo" );
44 
45  meReportSummaryMap_ = _ibooker.book2D("reportSummaryMap", "reportSummaryMap", 80, 0.5, 80.5, 80, 0.5, 80.5);
48 
49 }
50 
51 void
53 {
54  for ( int i = 0; i < 80; i++ ) {
55  for ( int j = 0; j < 80; j++ ) {
56  meReportSummaryMap_->setBinContent( i+1, j+1, -1. );
57  }
58  }
59 
60  char histo[200];
61 
62  float nDI_FedErr[80][80];
63  float DCC[80][80];
64  float eCount;
65 
67 
68  for (int i=0; i<80; ++i)
69  for (int j=0; j<80; ++j) {
70  nDI_FedErr[i][j] = -1;
71  DCC[i][j]=0;
72  }
73 
74  for (int i=0; i<2; ++i) {
75  for (int j=0; j<2; ++j) {
76 
77  int iz = (i==0)? 1:-1;
78 
79  sprintf(histo, "ES Integrity Errors Z %d P %d", iz, j+1);
80  me = _igetter.get(prefixME_ + "/ESIntegrityTask/" + histo);
81  if (me)
82  for (int x=0; x<40; ++x)
83  for (int y=0; y<40; ++y)
84  nDI_FedErr[i*40+x][(1-j)*40+y] = me->getBinContent(x+1, y+1);
85 
86  sprintf(histo, "ES Integrity Summary 1 Z %d P %d", iz, j+1);
87  me = _igetter.get(prefixME_ + "/ESIntegrityClient/" + histo);
88  if (me)
89  for (int x=0; x<40; ++x)
90  for (int y=0; y<40; ++y)
91  DCC[i*40+x][(1-j)*40+y] = me->getBinContent(x+1, y+1);
92 
93  sprintf(histo, "ES RecHit 2D Occupancy Z %d P %d", iz, j+1);
94  me = _igetter.get(prefixME_ + "/ESOccupancyTask/" + histo);
95  if (me)
96  eCount = me->getBinContent(40,40);
97  else
98  eCount = 1.;
99 
100  }
101  }
102 
103  //The global-summary
104  //ReportSummary Map
105  // ES+F ES-F
106  // ES+R ES-R
107  float nValidChannels=0;
108  float nGlobalErrors=0;
109  float nValidChannelsES[2][2]={};
110  float nGlobalErrorsES[2][2]={};
111 
112  for (int x=0; x<80; ++x) {
113  if (eCount < 1) break; //Fill reportSummaryMap after have 1 event
114  for (int y=0; y<80; ++y) {
115 
116  int z = (x<40) ? 0:1;
117  int p = (y>=40) ? 0:1;
118 
119  if (DCC[x][y]==0.) {
120  meReportSummaryMap_->setBinContent(x+1, y+1, -1.);
121  } else {
122  if (nDI_FedErr[x][y] >= 0) {
123  meReportSummaryMap_->setBinContent(x+1, y+1, 1-(nDI_FedErr[x][y]/eCount));
124 
125  nValidChannels++;
126  nGlobalErrors += nDI_FedErr[x][y]/eCount;
127 
128  nValidChannelsES[z][p]++;
129  nGlobalErrorsES[z][p] += nDI_FedErr[x][y]/eCount;
130  }
131  else {
132  meReportSummaryMap_->setBinContent(x+1, y+1, -1.);
133  }
134  }
135 
136  }
137  }
138 
139  for(unsigned iZ(0); iZ != 2; ++iZ){
140  for(unsigned iD(0); iD != 2; ++iD){
141  float reportSummaryES(-1.);
142  if(nValidChannelsES[iZ][iD] != 0)
143  reportSummaryES = 1. - nGlobalErrorsES[iZ][iD] / nValidChannelsES[iZ][iD];
144 
145  meReportSummaryContents_[iZ][iD]->Fill(reportSummaryES);
146  }
147  }
148 
149  float reportSummary(-1.);
150  if(nValidChannels != 0)
151  reportSummary = 1. - nGlobalErrors / nValidChannels;
152 
153  meReportSummary_->Fill(reportSummary);
154 }
155 
157 
158  fillReportSummary(_igetter);
159 
160  // The following overwrites the report summary if LS-based Good Channel Fraction histogram is available
161  // The source is turned off by default in ESIntegrityTask
162 
163  MonitorElement* source(_igetter.get(prefixME_+"/ESIntegrityTask/ES Good Channel Fraction"));
164  if (!source) return;
165 
166  meReportSummary_->Fill(-1.0);
167  for(unsigned iZ(0); iZ != 2; ++iZ)
168  for(unsigned iD(0); iD != 2; ++iD)
169  meReportSummaryContents_[iZ][iD]->Fill(-1.);
170 
171  for (int i=0; i<2; ++i)
172  for (int j=0; j<2; ++j)
173  meReportSummaryContents_[i][j]->Fill(source->getBinContent(i+1, j+1));
174 
175  meReportSummary_->Fill(source->getBinContent(3,3));
176 }
177 
178 void
180 {
181  fillReportSummary(_igetter);
182 }
int i
Definition: DBlmapReader.cc:9
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:304
ESSummaryClient(const edm::ParameterSet &ps)
Constructor.
virtual ~ESSummaryClient()
Destructor.
MonitorElement * meReportSummary_
void book(DQMStore::IBooker &) override
void endLumiAnalyze(DQMStore::IGetter &) override
Analyze.
void Fill(long long x)
MonitorElement * meReportSummaryContents_[2][2]
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::string prefixME_
Definition: ESClient.h:31
bool debug_
Definition: ESClient.h:34
int j
Definition: DBlmapReader.cc:9
void endJobAnalyze(DQMStore::IGetter &) override
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
MonitorElement * meReportSummaryMap_
double getBinContent(int binx) const
get content of bin (1-D)
tuple cout
Definition: gather_cfg.py:145
MonitorElement * bookFloat(Args &&...args)
Definition: DQMStore.h:109
void fillReportSummary(DQMStore::IGetter &)
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
static std::string const source
Definition: EdmProvDump.cc:43