CMS 3D CMS Logo

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