CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EEBeamHodoClient.cc
Go to the documentation of this file.
1 /*
2  * \file EEBeamHodoClient.cc
3  *
4  * $Date: 2010/03/27 20:07:59 $
5  * $Revision: 1.41 $
6  * \author G. Della Ricca
7  * \author G. Franzoni
8  *
9 */
10 
11 #include <memory>
12 #include <iostream>
13 #include <fstream>
14 
16 
18 
21 
23 
25 
26  // cloneME switch
27  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
28 
29  // verbose switch
30  verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
31 
32  // debug switch
33  debug_ = ps.getUntrackedParameter<bool>("debug", false);
34 
35  // prefixME path
36  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
37 
38  // enableCleanup_ switch
39  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
40 
41  // vector of selected Super Modules (Defaults to all 18).
42  superModules_.reserve(18);
43  for ( unsigned int i = 1; i <= 18; i++ ) superModules_.push_back(i);
44  superModules_ = ps.getUntrackedParameter<std::vector<int> >("superModules", superModules_);
45 
46  for (int i=0; i<4; i++) {
47 
48  ho01_[i] = 0;
49  hr01_[i] = 0;
50 
51  }
52 
53  hp01_[0] = 0;
54  hp01_[1] = 0;
55 
56  hp02_ = 0;
57 
58  hs01_[0] = 0;
59  hs01_[1] = 0;
60 
61  hq01_[0] = 0;
62  hq01_[1] = 0;
63 
64  ht01_ = 0;
65 
66  hc01_[0] = 0;
67  hc01_[1] = 0;
68  hc01_[2] = 0;
69 
70  hm01_ = 0;
71 
72  he01_[0] = 0;
73  he01_[1] = 0;
74 
75  he02_[0] = 0;
76  he02_[1] = 0;
77 
78  he03_[0] = 0;
79  he03_[1] = 0;
80  he03_[2] = 0;
81 
82 }
83 
85 
86 }
87 
89 
91 
92  if ( debug_ ) std::cout << "EEBeamHodoClient: beginJob" << std::endl;
93 
94  ievt_ = 0;
95  jevt_ = 0;
96 
97 }
98 
100 
101  if ( debug_ ) std::cout << "EEBeamHodoClient: beginRun" << std::endl;
102 
103  jevt_ = 0;
104 
105  this->setup();
106 
107 }
108 
110 
111  if ( debug_ ) std::cout << "EEBeamHodoClient: endJob, ievt = " << ievt_ << std::endl;
112 
113  this->cleanup();
114 
115  if ( cloneME_ ) {
116 
117  for (int i=0; i<4; i++) {
118 
119  if ( ho01_[i] ) delete ho01_[i];
120  if ( hr01_[i] ) delete hr01_[i];
121 
122  }
123 
124  if ( hp01_[0] ) delete hp01_[0];
125  if ( hp01_[1] ) delete hp01_[1];
126 
127  if ( hp02_ ) delete hp02_;
128 
129  if ( hs01_[0] ) delete hs01_[0];
130  if ( hs01_[1] ) delete hs01_[1];
131 
132  if ( hq01_[0] ) delete hq01_[0];
133  if ( hq01_[1] ) delete hq01_[1];
134 
135  if ( ht01_ ) delete ht01_;
136 
137  if ( hc01_[0] ) delete hc01_[0];
138  if ( hc01_[1] ) delete hc01_[1];
139  if ( hc01_[2] ) delete hc01_[2];
140 
141  if ( hm01_ ) delete hm01_;
142 
143  if ( he01_[0] ) delete he01_[0];
144  if ( he01_[1] ) delete he01_[1];
145 
146  if ( he02_[0] ) delete he02_[0];
147  if ( he02_[1] ) delete he02_[1];
148 
149  if ( he03_[0] ) delete he03_[0];
150  if ( he03_[1] ) delete he03_[1];
151  if ( he03_[2] ) delete he03_[2];
152 
153  }
154 
155  for (int i=0; i<4; i++) {
156 
157  ho01_[i] = 0;
158  hr01_[i] = 0;
159 
160  }
161 
162  hp01_[0] = 0;
163  hp01_[1] = 0;
164 
165  hp02_ = 0;
166 
167  hs01_[0] = 0;
168  hs01_[1] = 0;
169 
170  hq01_[0] = 0;
171  hq01_[1] = 0;
172 
173  ht01_ = 0;
174 
175  hc01_[0] = 0;
176  hc01_[1] = 0;
177  hc01_[2] = 0;
178 
179  hm01_ = 0;
180 
181  he01_[0] = 0;
182  he01_[1] = 0;
183 
184  he02_[0] = 0;
185  he02_[1] = 0;
186 
187  he03_[0] = 0;
188  he03_[1] = 0;
189  he03_[2] = 0;
190 
191 }
192 
194 
195  if ( debug_ ) std::cout << "EEBeamHodoClient: endRun, jevt = " << jevt_ << std::endl;
196 
197  this->cleanup();
198 
199 }
200 
202 
203  dqmStore_->setCurrentFolder( prefixME_ + "/EEBeamHodoClient" );
204 
205 }
206 
208 
209  if ( ! enableCleanup_ ) return;
210 
211  dqmStore_->setCurrentFolder( prefixME_ + "/EEBeamHodoClient" );
212 
213 }
214 
215 #ifdef WITH_ECAL_COND_DB
216 bool EEBeamHodoClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status) {
217 
218  status = true;
219 
220  return true;
221 
222 }
223 #endif
224 
226 
227  ievt_++;
228  jevt_++;
229  if ( ievt_ % 10 == 0 ) {
230  if ( debug_ ) std::cout << "EEBeamHodoClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
231  }
232 
233  int smId = 1;
234 
235  char histo[200];
236 
237  MonitorElement* me;
238 
239  for (int i=0; i<4; i++) {
240 
241  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT occup %s %02d").c_str(), Numbers::sEE(smId).c_str(), i+1);
242  me = dqmStore_->get(histo);
243  ho01_[i] = UtilsClient::getHisto<TH1F*>( me, cloneME_, ho01_[i] );
244 
245  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT raw %s %02d").c_str(), Numbers::sEE(smId).c_str(), i+1);
246  me = dqmStore_->get(histo);
247  hr01_[i] = UtilsClient::getHisto<TH1F*>( me, cloneME_, hr01_[i] );
248 
249  }
250 
251  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT PosX rec %s").c_str(), Numbers::sEE(smId).c_str());
252  me = dqmStore_->get(histo);
253  hp01_[0] = UtilsClient::getHisto<TH1F*>( me, cloneME_, hp01_[0] );
254 
255  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT PosY rec %s").c_str(), Numbers::sEE(smId).c_str());
256  me = dqmStore_->get(histo);
257  hp01_[1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, hp01_[1] );
258 
259  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT PosYX rec %s").c_str(), Numbers::sEE(smId).c_str());
260  me = dqmStore_->get(histo);
261  hp02_ = UtilsClient::getHisto<TH2F*>( me, cloneME_, hp02_ );
262 
263  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT SloX %s").c_str(), Numbers::sEE(smId).c_str());
264  me = dqmStore_->get(histo);
265  hs01_[0] = UtilsClient::getHisto<TH1F*>( me, cloneME_, hs01_[0] );
266 
267  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT SloY %s").c_str(), Numbers::sEE(smId).c_str());
268  me = dqmStore_->get(histo);
269  hs01_[1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, hs01_[1] );
270 
271  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT QualX %s").c_str(), Numbers::sEE(smId).c_str());
272  me = dqmStore_->get(histo);
273  hq01_[0] = UtilsClient::getHisto<TH1F*>( me, cloneME_, hq01_[0] );
274 
275  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT QualY %s").c_str(), Numbers::sEE(smId).c_str());
276  me = dqmStore_->get(histo);
277  hq01_[1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, hq01_[1] );
278 
279  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT TDC rec %s").c_str(), Numbers::sEE(smId).c_str());
280  me = dqmStore_->get(histo);
281  ht01_ = UtilsClient::getHisto<TH1F*>( me, cloneME_, ht01_ );
282 
283  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT Hodo-Calo X vs Cry %s").c_str(), Numbers::sEE(smId).c_str());
284  me = dqmStore_->get(histo);
285  hc01_[0] = UtilsClient::getHisto<TH1F*>( me, cloneME_, hc01_[0] );
286 
287  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT Hodo-Calo Y vs Cry %s").c_str(), Numbers::sEE(smId).c_str());
288  me = dqmStore_->get(histo);
289  hc01_[1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, hc01_[1] );
290 
291  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT TDC-Calo vs Cry %s").c_str(), Numbers::sEE(smId).c_str());
292  me = dqmStore_->get(histo);
293  hc01_[2] = UtilsClient::getHisto<TH1F*>( me, cloneME_, hc01_[2] );
294 
295  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT Missing Collections %s").c_str(), Numbers::sEE(smId).c_str());
296  me = dqmStore_->get(histo);
297  hm01_ = UtilsClient::getHisto<TH1F*>( me, cloneME_, hm01_ );
298 
299  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT prof E1 vs X %s").c_str(), Numbers::sEE(smId).c_str());
300  me = dqmStore_->get(histo);
301  he01_[0] = UtilsClient::getHisto<TProfile*>( me, cloneME_, he01_[0] );
302 
303  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT prof E1 vs Y %s").c_str(), Numbers::sEE(smId).c_str());
304  me = dqmStore_->get(histo);
305  he01_[1] = UtilsClient::getHisto<TProfile*>( me, cloneME_, he01_[1] );
306 
307  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT his E1 vs X %s").c_str(), Numbers::sEE(smId).c_str());
308  me = dqmStore_->get(histo);
309  he02_[0] = UtilsClient::getHisto<TH2F*>( me, cloneME_, he02_[0] );
310 
311  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT his E1 vs Y %s").c_str(), Numbers::sEE(smId).c_str());
312  me = dqmStore_->get(histo);
313  he02_[1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, he02_[1] );
314 
315  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT PosX Hodo-Calo %s").c_str(), Numbers::sEE(smId).c_str());
316  me = dqmStore_->get(histo);
317  he03_[0] = UtilsClient::getHisto<TH1F*>( me, cloneME_, he03_[0] );
318 
319  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT PosY Hodo-Calo %s").c_str(), Numbers::sEE(smId).c_str());
320  me = dqmStore_->get(histo);
321  he03_[1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, he03_[1] );
322 
323  sprintf(histo, (prefixME_ + "/EEBeamHodoTask/EEBHT TimeMax TDC-Calo %s").c_str(), Numbers::sEE(smId).c_str());
324  me = dqmStore_->get(histo);
325  he03_[2] = UtilsClient::getHisto<TH1F*>( me, cloneME_, he03_[2] );
326 
327 }
328 
void analyze(void)
Analyze.
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< int > superModules_
Some &quot;id&quot; conversions.
static std::string sEE(const int ism)
Definition: Numbers.cc:199
std::string prefixME_
void endJob(void)
EndJob.
EEBeamHodoClient(const edm::ParameterSet &ps)
Constructor.
tuple histo
Definition: trackerHits.py:12
void cleanup(void)
Cleanup.
void beginJob(void)
BeginJob.
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1270
Ecal Monitor Utils for Client.
virtual ~EEBeamHodoClient()
Destructor.
void beginRun(void)
BeginRun.
DQMStore * dqmStore_
void setup(void)
Setup.
tuple cout
Definition: gather_cfg.py:41
tuple status
Definition: ntuplemaker.py:245
Definition: RunIOV.h:13
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237
TProfile * he01_[2]
void endRun(void)
EndRun.