CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EECosmicClient.cc
Go to the documentation of this file.
1 /*
2  * \file EECosmicClient.cc
3  *
4  * $Date: 2010/08/04 08:20:13 $
5  * $Revision: 1.71 $
6  * \author G. Della Ricca
7  * \author F. Cossutti
8  *
9 */
10 
11 #include <memory>
12 #include <iostream>
13 #include <fstream>
14 #include <iomanip>
15 
17 
19 
20 #ifdef WITH_ECAL_COND_DB
24 #endif
25 
28 
30 
32 
33  // cloneME switch
34  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
35 
36  // verbose switch
37  verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
38 
39  // debug switch
40  debug_ = ps.getUntrackedParameter<bool>("debug", false);
41 
42  // prefixME path
43  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
44 
45  // enableCleanup_ switch
46  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
47 
48  // vector of selected Super Modules (Defaults to all 18).
49  superModules_.reserve(18);
50  for ( unsigned int i = 1; i <= 18; i++ ) superModules_.push_back(i);
51  superModules_ = ps.getUntrackedParameter<std::vector<int> >("superModules", superModules_);
52 
53  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
54 
55  int ism = superModules_[i];
56 
57  h01_[ism-1] = 0;
58  h02_[ism-1] = 0;
59  h03_[ism-1] = 0;
60 
61  meh01_[ism-1] = 0;
62  meh02_[ism-1] = 0;
63  meh03_[ism-1] = 0;
64 
65  }
66 
67 }
68 
70 
71 }
72 
74 
76 
77  if ( debug_ ) std::cout << "EECosmicClient: beginJob" << std::endl;
78 
79  ievt_ = 0;
80  jevt_ = 0;
81 
82 }
83 
85 
86  if ( debug_ ) std::cout << "EECosmicClient: beginRun" << std::endl;
87 
88  jevt_ = 0;
89 
90  this->setup();
91 
92 }
93 
95 
96  if ( debug_ ) std::cout << "EECosmicClient: endJob, ievt = " << ievt_ << std::endl;
97 
98  this->cleanup();
99 
100 }
101 
103 
104  if ( debug_ ) std::cout << "EECosmicClient: endRun, jevt = " << jevt_ << std::endl;
105 
106  this->cleanup();
107 
108 }
109 
111 
112 }
113 
115 
116  if ( ! enableCleanup_ ) return;
117 
118  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
119 
120  int ism = superModules_[i];
121 
122  if ( cloneME_ ) {
123  if ( h01_[ism-1] ) delete h01_[ism-1];
124  if ( h02_[ism-1] ) delete h02_[ism-1];
125  if ( h03_[ism-1] ) delete h03_[ism-1];
126  }
127 
128  h01_[ism-1] = 0;
129  h02_[ism-1] = 0;
130  h03_[ism-1] = 0;
131 
132  meh01_[ism-1] = 0;
133  meh02_[ism-1] = 0;
134  meh03_[ism-1] = 0;
135 
136  }
137 
138 }
139 
140 #ifdef WITH_ECAL_COND_DB
141 bool EECosmicClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status) {
142 
143  status = true;
144 
145  return true;
146 
147 }
148 #endif
149 
151 
152  ievt_++;
153  jevt_++;
154  if ( ievt_ % 10 == 0 ) {
155  if ( debug_ ) std::cout << "EECosmicClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
156  }
157 
158  char histo[200];
159 
160  MonitorElement* me;
161 
162  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
163 
164  int ism = superModules_[i];
165 
166  sprintf(histo, (prefixME_ + "/EECosmicTask/Sel/EECT energy sel %s").c_str(), Numbers::sEE(ism).c_str());
167  me = dqmStore_->get(histo);
168  h01_[ism-1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h01_[ism-1] );
169  meh01_[ism-1] = me;
170 
171  sprintf(histo, (prefixME_ + "/EECosmicTask/Spectrum/EECT 1x1 energy spectrum %s").c_str(), Numbers::sEE(ism).c_str());
172  me = dqmStore_->get(histo);
173  h02_[ism-1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h02_[ism-1] );
174  meh02_[ism-1] = me;
175 
176  sprintf(histo, (prefixME_ + "/EECosmicTask/Spectrum/EECT 3x3 energy spectrum %s").c_str(), Numbers::sEE(ism).c_str());
177  me = dqmStore_->get(histo);
178  h03_[ism-1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h03_[ism-1] );
179  meh03_[ism-1] = me;
180 
181  }
182 
183 }
184 
void endRun(void)
EndRun.
void beginRun(void)
BeginRun.
Cache logicID vector from database.
virtual ~EECosmicClient()
Destructor.
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
TH1F * h02_[18]
std::string prefixME_
Some &quot;id&quot; conversions.
std::vector< int > superModules_
static std::string sEE(const int ism)
Definition: Numbers.cc:199
TProfile2D * h01_[18]
tuple histo
Definition: trackerHits.py:12
MonitorElement * meh02_[18]
TH1F * h03_[18]
void endJob(void)
EndJob.
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.
DQMStore * dqmStore_
void cleanup(void)
Cleanup.
void analyze(void)
Analyze.
EECosmicClient(const edm::ParameterSet &ps)
Constructor.
MonitorElement * meh01_[18]
tuple cout
Definition: gather_cfg.py:41
tuple status
Definition: ntuplemaker.py:245
Definition: RunIOV.h:13
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:47
void setup(void)
Setup.
void beginJob(void)
BeginJob.
MonitorElement * meh03_[18]