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: 2011/08/30 09:29:44 $
5  * $Revision: 1.73 $
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 
20 
21 #ifdef WITH_ECAL_COND_DB
25 #endif
26 
29 
31 
33 
34  // cloneME switch
35  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
36 
37  // verbose switch
38  verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
39 
40  // debug switch
41  debug_ = ps.getUntrackedParameter<bool>("debug", false);
42 
43  // prefixME path
44  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
45 
46  // enableCleanup_ switch
47  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
48 
49  // vector of selected Super Modules (Defaults to all 18).
50  superModules_.reserve(18);
51  for ( unsigned int i = 1; i <= 18; i++ ) superModules_.push_back(i);
52  superModules_ = ps.getUntrackedParameter<std::vector<int> >("superModules", superModules_);
53 
54  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
55 
56  int ism = superModules_[i];
57 
58  h01_[ism-1] = 0;
59  h02_[ism-1] = 0;
60  h03_[ism-1] = 0;
61 
62  meh01_[ism-1] = 0;
63  meh02_[ism-1] = 0;
64  meh03_[ism-1] = 0;
65 
66  }
67 
68 }
69 
71 
72 }
73 
75 
77 
78  if ( debug_ ) std::cout << "EECosmicClient: beginJob" << std::endl;
79 
80  ievt_ = 0;
81  jevt_ = 0;
82 
83 }
84 
86 
87  if ( debug_ ) std::cout << "EECosmicClient: beginRun" << std::endl;
88 
89  jevt_ = 0;
90 
91  this->setup();
92 
93 }
94 
96 
97  if ( debug_ ) std::cout << "EECosmicClient: endJob, ievt = " << ievt_ << std::endl;
98 
99  this->cleanup();
100 
101 }
102 
104 
105  if ( debug_ ) std::cout << "EECosmicClient: endRun, jevt = " << jevt_ << std::endl;
106 
107  this->cleanup();
108 
109 }
110 
112 
113 }
114 
116 
117  if ( ! enableCleanup_ ) return;
118 
119  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
120 
121  int ism = superModules_[i];
122 
123  if ( cloneME_ ) {
124  if ( h01_[ism-1] ) delete h01_[ism-1];
125  if ( h02_[ism-1] ) delete h02_[ism-1];
126  if ( h03_[ism-1] ) delete h03_[ism-1];
127  }
128 
129  h01_[ism-1] = 0;
130  h02_[ism-1] = 0;
131  h03_[ism-1] = 0;
132 
133  meh01_[ism-1] = 0;
134  meh02_[ism-1] = 0;
135  meh03_[ism-1] = 0;
136 
137  }
138 
139 }
140 
141 #ifdef WITH_ECAL_COND_DB
142 bool EECosmicClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status) {
143 
144  status = true;
145 
146  return true;
147 
148 }
149 #endif
150 
152 
153  ievt_++;
154  jevt_++;
155  if ( ievt_ % 10 == 0 ) {
156  if ( debug_ ) std::cout << "EECosmicClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
157  }
158 
159  MonitorElement* me;
160 
161  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
162 
163  int ism = superModules_[i];
164 
165  me = dqmStore_->get( prefixME_ + "/EECosmicTask/Sel/EECT energy sel " + Numbers::sEE(ism) );
166  h01_[ism-1] = UtilsClient::getHisto( me, cloneME_, h01_[ism-1] );
167  meh01_[ism-1] = me;
168 
169  me = dqmStore_->get( prefixME_ + "/EECosmicTask/Spectrum/EECT 1x1 energy spectrum " + Numbers::sEE(ism) );
170  h02_[ism-1] = UtilsClient::getHisto( me, cloneME_, h02_[ism-1] );
171  meh02_[ism-1] = me;
172 
173  me = dqmStore_->get( prefixME_ + "/EECosmicTask/Spectrum/EECT 3x3 energy spectrum " + Numbers::sEE(ism) );
174  h03_[ism-1] = UtilsClient::getHisto( me, cloneME_, h03_[ism-1] );
175  meh03_[ism-1] = me;
176 
177  }
178 
179 }
180 
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]
static T getHisto(const MonitorElement *me, bool clone=false, T ret=0)
Returns the histogram contained by the Monitor Element.
Definition: UtilsClient.h:91
std::string prefixME_
Some &quot;id&quot; conversions.
std::vector< int > superModules_
static std::string sEE(const int ism)
Definition: Numbers.cc:205
TProfile2D * h01_[18]
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:1265
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:56
void setup(void)
Setup.
void beginJob(void)
BeginJob.
MonitorElement * meh03_[18]