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  * \author G. Della Ricca
5  * \author F. Cossutti
6  *
7 */
8 
9 #include <memory>
10 #include <iostream>
11 #include <fstream>
12 #include <iomanip>
13 
15 
18 
19 #ifdef WITH_ECAL_COND_DB
23 #endif
24 
27 
29 
31 
32  // cloneME switch
33  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
34 
35  // verbose switch
36  verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
37 
38  // debug switch
39  debug_ = ps.getUntrackedParameter<bool>("debug", false);
40 
41  // prefixME path
42  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
43 
44  // enableCleanup_ switch
45  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
46 
47  // vector of selected Super Modules (Defaults to all 18).
48  superModules_.reserve(18);
49  for ( unsigned int i = 1; i <= 18; i++ ) superModules_.push_back(i);
50  superModules_ = ps.getUntrackedParameter<std::vector<int> >("superModules", superModules_);
51 
52  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
53 
54  int ism = superModules_[i];
55 
56  h01_[ism-1] = 0;
57  h02_[ism-1] = 0;
58  h03_[ism-1] = 0;
59 
60  meh01_[ism-1] = 0;
61  meh02_[ism-1] = 0;
62  meh03_[ism-1] = 0;
63 
64  }
65 
66 }
67 
69 
70 }
71 
73 
75 
76  if ( debug_ ) std::cout << "EECosmicClient: beginJob" << std::endl;
77 
78  ievt_ = 0;
79  jevt_ = 0;
80 
81 }
82 
84 
85  if ( debug_ ) std::cout << "EECosmicClient: beginRun" << std::endl;
86 
87  jevt_ = 0;
88 
89  this->setup();
90 
91 }
92 
94 
95  if ( debug_ ) std::cout << "EECosmicClient: endJob, ievt = " << ievt_ << std::endl;
96 
97  this->cleanup();
98 
99 }
100 
102 
103  if ( debug_ ) std::cout << "EECosmicClient: endRun, jevt = " << jevt_ << std::endl;
104 
105  this->cleanup();
106 
107 }
108 
110 
111 }
112 
114 
115  if ( ! enableCleanup_ ) return;
116 
117  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
118 
119  int ism = superModules_[i];
120 
121  if ( cloneME_ ) {
122  if ( h01_[ism-1] ) delete h01_[ism-1];
123  if ( h02_[ism-1] ) delete h02_[ism-1];
124  if ( h03_[ism-1] ) delete h03_[ism-1];
125  }
126 
127  h01_[ism-1] = 0;
128  h02_[ism-1] = 0;
129  h03_[ism-1] = 0;
130 
131  meh01_[ism-1] = 0;
132  meh02_[ism-1] = 0;
133  meh03_[ism-1] = 0;
134 
135  }
136 
137 }
138 
139 #ifdef WITH_ECAL_COND_DB
140 bool EECosmicClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status) {
141 
142  status = true;
143 
144  return true;
145 
146 }
147 #endif
148 
150 
151  ievt_++;
152  jevt_++;
153  if ( ievt_ % 10 == 0 ) {
154  if ( debug_ ) std::cout << "EECosmicClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
155  }
156 
157  MonitorElement* me;
158 
159  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
160 
161  int ism = superModules_[i];
162 
163  me = dqmStore_->get( prefixME_ + "/EECosmicTask/Sel/EECT energy sel " + Numbers::sEE(ism) );
164  h01_[ism-1] = UtilsClient::getHisto( me, cloneME_, h01_[ism-1] );
165  meh01_[ism-1] = me;
166 
167  me = dqmStore_->get( prefixME_ + "/EECosmicTask/Spectrum/EECT 1x1 energy spectrum " + Numbers::sEE(ism) );
168  h02_[ism-1] = UtilsClient::getHisto( me, cloneME_, h02_[ism-1] );
169  meh02_[ism-1] = me;
170 
171  me = dqmStore_->get( prefixME_ + "/EECosmicTask/Spectrum/EECT 3x3 energy spectrum " + Numbers::sEE(ism) );
172  h03_[ism-1] = UtilsClient::getHisto( me, cloneME_, h03_[ism-1] );
173  meh03_[ism-1] = me;
174 
175  }
176 
177 }
178 
void endRun(void)
EndRun.
void beginRun(void)
BeginRun.
Cache logicID vector from database.
virtual ~EECosmicClient()
Destructor.
T getUntrackedParameter(std::string const &, T const &) const
static std::string sEE(const unsigned ism)
Definition: Numbers.cc:223
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:89
std::string prefixME_
Some &quot;id&quot; conversions.
std::vector< int > superModules_
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:1623
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:121
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]