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 
8 
10 
11 using namespace edm;
12 using namespace std;
13 
15 
16  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
17  verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
18  debug_ = ps.getUntrackedParameter<bool>("debug", false);
19  prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
20  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
21 
22 }
23 
25 }
26 
28 
29  dqmStore_ = dqmStore;
30 
31  if ( debug_ ) cout << "ESSummaryClient: beginJob" << endl;
32 
33  ievt_ = 0;
34  jevt_ = 0;
35 
36  char histo[200];
37 
38  MonitorElement* me;
39 
40  dqmStore_->setCurrentFolder( prefixME_ + "/EventInfo" );
41 
42  sprintf(histo, "reportSummary");
43  me = dqmStore_->get(prefixME_ + "/EventInfo/" + histo);
44  if ( me ) {
45  dqmStore_->removeElement(me->getName());
46  }
47  me = dqmStore_->bookFloat(histo);
48  me->Fill(-1.0);
49 
50  dqmStore_->setCurrentFolder( prefixME_ + "/EventInfo/reportSummaryContents" );
51 
52  for (int i=0 ; i<2; ++i){
53  for (int j=0 ; j<2; ++j){
54  int iz = (i==0)? 1:-1;
55  sprintf(histo, "EcalPreshower Z %d P %d", iz, j+1);
56  me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryContents/" + histo);
57  if(me){
58  dqmStore_->removeElement(me->getName());
59  }
60  me = dqmStore_->bookFloat(histo);
61  me->Fill(-1.0);
62  }
63  }
64 
65  dqmStore_->setCurrentFolder( prefixME_ + "/EventInfo" );
66 
67  sprintf(histo, "reportSummaryMap");
68  me = dqmStore_->get(prefixME_ + "/EventInfo/" + histo);
69  if ( me ) {
70  dqmStore_->removeElement(me->getName());
71  }
72  me = dqmStore_->book2D(histo, histo, 80, 0.5, 80.5, 80, 0.5, 80.5);
73  me->setAxisTitle("Si X", 1);
74  me->setAxisTitle("Si Y", 2);
75 
76  for ( int i = 0; i < 80; i++ ) {
77  for ( int j = 0; j < 80; j++ ) {
78  me->setBinContent( i+1, j+1, -1. );
79  }
80  }
81 
82 }
83 
85 
86  if ( debug_ ) cout << "ESSummaryClient: beginRun" << endl;
87 
88  jevt_ = 0;
89 
90  this->setup();
91 
92 }
93 
95 
96  if ( debug_ ) cout << "ESSummaryClient: endJob, ievt = " << ievt_ << endl;
97 
98  this->cleanup();
99 
100 }
101 
103 
104  if ( debug_ ) cout << "ESSummaryClient: endRun, jevt = " << jevt_ << endl;
105 
106  this->cleanup();
107 
108 }
109 
111 
112 }
113 
115 
116  if ( ! enableCleanup_ ) return;
117 
118 }
119 
121 
122  char histo[200];
123 
124  float nDI_FedErr[80][80];
125  float DCC[80][80];
126  float eCount;
127 
128  MonitorElement* me;
129 
130  for (int i=0; i<80; ++i)
131  for (int j=0; j<80; ++j) {
132  nDI_FedErr[i][j] = -1;
133  DCC[i][j]=0;
134  }
135 
136  for (int i=0; i<2; ++i) {
137  for (int j=0; j<2; ++j) {
138 
139  int iz = (i==0)? 1:-1;
140 
141  sprintf(histo, "ES Integrity Errors Z %d P %d", iz, j+1);
142  me = dqmStore_->get(prefixME_ + "/ESIntegrityTask/" + histo);
143  if (me)
144  for (int x=0; x<40; ++x)
145  for (int y=0; y<40; ++y)
146  nDI_FedErr[i*40+x][(1-j)*40+y] = me->getBinContent(x+1, y+1);
147 
148  sprintf(histo, "ES Integrity Summary 1 Z %d P %d", iz, j+1);
149  me = dqmStore_->get(prefixME_ + "/ESIntegrityClient/" + histo);
150  if (me)
151  for (int x=0; x<40; ++x)
152  for (int y=0; y<40; ++y)
153  DCC[i*40+x][(1-j)*40+y] = me->getBinContent(x+1, y+1);
154 
155  sprintf(histo, "ES RecHit 2D Occupancy Z %d P %d", iz, j+1);
156  me = dqmStore_->get(prefixME_ + "/ESOccupancyTask/" + histo);
157  if (me)
158  eCount = me->getBinContent(40,40);
159  else
160  eCount = 1.;
161 
162  }
163  }
164 
165  //The global-summary
166  //ReportSummary Map
167  // ES+F ES-F
168  // ES+R ES-R
169  float nValidChannels=0;
170  float nGlobalErrors=0;
171  float nValidChannelsES[2][2]={};
172  float nGlobalErrorsES[2][2]={};
173 
174  me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryMap");
175  if (me) {
176  for (int x=0; x<80; ++x) {
177  if (eCount < 1) break; //Fill reportSummaryMap after have 1 event
178  for (int y=0; y<80; ++y) {
179 
180  int z = (x<40) ? 0:1;
181  int p = (y>=40) ? 0:1;
182 
183  if (DCC[x][y]==0.) {
184  me->setBinContent(x+1, y+1, -1.);
185  } else {
186  if (nDI_FedErr[x][y] >= 0) {
187  me->setBinContent(x+1, y+1, 1-(nDI_FedErr[x][y]/eCount));
188 
189  nValidChannels++;
190  nGlobalErrors += nDI_FedErr[x][y]/eCount;
191 
192  nValidChannelsES[z][p]++;
193  nGlobalErrorsES[z][p] += nDI_FedErr[x][y]/eCount;
194  }
195  else {
196  me->setBinContent(x+1, y+1, -1.);
197  }
198  }
199 
200  }
201  }
202  }
203 
204  for (int i=0; i<2; ++i) {
205  for (int j=0; j<2; ++j) {
206  int iz = (i==0)? 1:-1;
207  float reportSummaryES = -1.;
208  if (nValidChannelsES[i][j] != 0)
209  reportSummaryES = 1.0 - nGlobalErrorsES[i][j]/nValidChannelsES[i][j];
210  sprintf(histo, "EcalPreshower Z %d P %d", iz, j+1);
211  me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummaryContents/" + histo);
212  if ( me ) me->Fill(reportSummaryES);
213  }
214  }
215 
216  //Return ratio of good channels
217  float reportSummary = -1.0;
218  if ( nValidChannels != 0 )
219  reportSummary = 1.0 - nGlobalErrors/nValidChannels;
220  me = dqmStore_->get(prefixME_ + "/EventInfo/reportSummary");
221  if ( me ) me->Fill(reportSummary);
222 
223 }
224 
225 void ESSummaryClient::softReset(bool flag) {
226 }
227 
229 
230  char histo[200];
231  MonitorElement* me = 0;
232  MonitorElement* me_report = 0;
233  sprintf(histo, "ES Good Channel Fraction");
234  me = dqmStore_->get(prefixME_+"/ESIntegrityTask/"+histo);
235  if (!me) return;
236  for (int i=0; i<2; ++i) {
237  for (int j=0; j<2; ++j) {
238  int iz = (i==0)? 1:-1;
239  sprintf(histo, "EcalPreshower Z %d P %d", iz, j+1);
240  me_report = dqmStore_->get(prefixME_+"/EventInfo/reportSummaryContents/" + histo);
241  if (me_report) {
242  me_report->Fill(me->getBinContent(i+1, j+1));
243  }
244  }
245  }
246  me_report = dqmStore_->get(prefixME_ + "/EventInfo/reportSummary");
247  if ( me_report ) me_report->Fill(me->getBinContent(3,3));
248 
249 }
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
int i
Definition: DBlmapReader.cc:9
void setBinContent(int binx, double content)
set content of bin (1-D)
void endLumiAnalyze()
EndLumiAnalyze.
ESSummaryClient(const edm::ParameterSet &ps)
Constructor.
void endJob(void)
EndJob.
static void cleanup(const Factory::MakerMap::value_type &v)
Definition: Factory.cc:12
virtual ~ESSummaryClient()
Destructor.
float float float z
void Fill(long long x)
void beginRun(void)
BeginRun.
void beginJob(DQMStore *dqmStore)
BeginJob.
int j
Definition: DBlmapReader.cc:9
void cleanup(void)
Cleanup.
double getBinContent(int binx) const
get content of bin (1-D)
void analyze(void)
Analyze.
tuple cout
Definition: gather_cfg.py:121
void softReset(bool flag)
SoftReset.
Definition: DDAxes.h:10
void endRun(void)
EndRun.
void setup(void)
Setup.
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")