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  * \author G. Della Ricca
5  * \author F. Cossutti
6  *
7 */
8 
9 #include <memory>
10 #include <iostream>
11 #include <fstream>
12 #include <iomanip>
13 #include <vector>
14 
16 
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 36).
49  superModules_.reserve(36);
50  for ( unsigned int i = 1; i <= 36; 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 << "EBCosmicClient: beginJob" << std::endl;
78 
79  ievt_ = 0;
80  jevt_ = 0;
81 
82 }
83 
85 
86  if ( debug_ ) std::cout << "EBCosmicClient: beginRun" << std::endl;
87 
88  jevt_ = 0;
89 
90  this->setup();
91 
92 }
93 
95 
96  if ( debug_ ) std::cout << "EBCosmicClient: endJob, ievt = " << ievt_ << std::endl;
97 
98  this->cleanup();
99 
100 }
101 
103 
104  if ( debug_ ) std::cout << "EBCosmicClient: 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 EBCosmicClient::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 << "EBCosmicClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
156  }
157 
158  MonitorElement* me;
159 
160  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
161 
162  int ism = superModules_[i];
163 
164  me = dqmStore_->get( prefixME_ + "/EBCosmicTask/Sel/EBCT energy sel " + Numbers::sEB(ism) );
165  h01_[ism-1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h01_[ism-1] );
166  meh01_[ism-1] = me;
167 
168  me = dqmStore_->get( prefixME_ + "/EBCosmicTask/Spectrum/EBCT 1x1 energy spectrum " + Numbers::sEB(ism) );
169  h02_[ism-1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h02_[ism-1] );
170  meh02_[ism-1] = me;
171 
172  me = dqmStore_->get( prefixME_ + "/EBCosmicTask/Spectrum/EBCT 3x3 energy spectrum " + Numbers::sEB(ism) );
173  h03_[ism-1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h03_[ism-1] );
174  meh03_[ism-1] = me;
175 
176  }
177 
178 }
179 
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:91
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:1623
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.