CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EEStatusFlagsClient.cc
Go to the documentation of this file.
1 /*
2  * \file EEStatusFlagsClient.cc
3  *
4  * $Date: 2012/04/27 13:46:08 $
5  * $Revision: 1.51 $
6  * \author G. Della Ricca
7  *
8 */
9 
10 #include <memory>
11 #include <iostream>
12 #include <fstream>
13 #include <iomanip>
14 
16 
19 
20 #ifdef WITH_ECAL_COND_DB
23 #endif
24 
26 
29 
31 
33 
35 
36  // cloneME switch
37  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
38 
39  // verbose switch
40  verbose_ = ps.getUntrackedParameter<bool>("verbose", true);
41 
42  // debug switch
43  debug_ = ps.getUntrackedParameter<bool>("debug", false);
44 
45  // prefixME path
46  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
47 
48  // enableCleanup_ switch
49  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
50 
51  // vector of selected Super Modules (Defaults to all 18).
52  superModules_.reserve(18);
53  for ( unsigned int i = 1; i <= 18; i++ ) superModules_.push_back(i);
54  superModules_ = ps.getUntrackedParameter<std::vector<int> >("superModules", superModules_);
55 
56  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
57 
58  int ism = superModules_[i];
59 
60  h01_[ism-1] = 0;
61 
62  meh01_[ism-1] = 0;
63 
64  h02_[ism-1] = 0;
65 
66  meh02_[ism-1] = 0;
67 
68  h03_[ism-1] = 0;
69 
70  meh03_[ism-1] = 0;
71 
72  }
73 
74 }
75 
77 
78 }
79 
81 
83 
84  if ( debug_ ) std::cout << "EEStatusFlagsClient: beginJob" << std::endl;
85 
86  ievt_ = 0;
87  jevt_ = 0;
88 
89 }
90 
92 
93  if ( debug_ ) std::cout << "EEStatusFlagsClient: beginRun" << std::endl;
94 
95  jevt_ = 0;
96 
97  this->setup();
98 
99 }
100 
102 
103  if ( debug_ ) std::cout << "EEStatusFlagsClient: endJob, ievt = " << ievt_ << std::endl;
104 
105  this->cleanup();
106 
107 }
108 
110 
111  if ( debug_ ) std::cout << "EEStatusFlagsClient: endRun, jevt = " << jevt_ << std::endl;
112 
113  this->cleanup();
114 
115 }
116 
118 
119  dqmStore_->setCurrentFolder( prefixME_ + "/EEStatusFlagsClient" );
120 
121 }
122 
124 
125  if ( ! enableCleanup_ ) return;
126 
127  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
128 
129  int ism = superModules_[i];
130 
131  if ( cloneME_ ) {
132  if ( h01_[ism-1] ) delete h01_[ism-1];
133  if ( h02_[ism-1] ) delete h02_[ism-1];
134  if ( h03_[ism-1] ) delete h03_[ism-1];
135  }
136 
137  h01_[ism-1] = 0;
138  h02_[ism-1] = 0;
139  h03_[ism-1] = 0;
140 
141  meh01_[ism-1] = 0;
142  meh02_[ism-1] = 0;
143  meh03_[ism-1] = 0;
144 
145  }
146 
147  dqmStore_->setCurrentFolder( prefixME_ + "/EEStatusFlagsClient" );
148 
149 }
150 
151 #ifdef WITH_ECAL_COND_DB
152 bool EEStatusFlagsClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status) {
153 
154  status = true;
155 
156  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
157 
158  int ism = superModules_[i];
159 
160  if ( verbose_ ) {
161  std::cout << " " << Numbers::sEE(ism) << " (ism=" << ism << ")" << std::endl;
162  std::cout << std::endl;
163  UtilsClient::printBadChannels(meh01_[ism-1], UtilsClient::getHisto<TH2F*>(meh01_[ism-1]), true);
164  }
165 
166  if ( meh01_[ism-1] ) {
167  if ( meh01_[ism-1]->getEntries() != 0 ) status = false;
168  }
169 
170  }
171 
172  return true;
173 
174 }
175 #endif
176 
178 
179  ievt_++;
180  jevt_++;
181  if ( ievt_ % 10 == 0 ) {
182  if ( debug_ ) std::cout << "EEStatusFlagsClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
183  }
184 
185  uint32_t bits01 = 0;
187 
188  MonitorElement* me;
189 
190  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
191 
192  int ism = superModules_[i];
193 
194  me = dqmStore_->get( prefixME_ + "/EEStatusFlagsTask/FEStatus/EESFT front-end status " + Numbers::sEE(ism) );
195  h01_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h01_[ism-1] );
196  meh01_[ism-1] = me;
197 
198  me = dqmStore_->get( prefixME_ + "/EEStatusFlagsTask/FEStatus/EESFT front-end status bits " + Numbers::sEE(ism) );
199  h02_[ism-1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h02_[ism-1] );
200  meh02_[ism-1] = me;
201 
202  me = dqmStore_->get( prefixME_ + "/EEStatusFlagsTask/FEStatus/EESFT MEM front-end status " + Numbers::sEE(ism) );
203  h03_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h01_[ism-1] );
204  meh03_[ism-1] = me;
205 
206  for ( int ix = 1; ix <= 50; ix++ ) {
207  for ( int iy = 1; iy <= 50; iy++ ) {
208  if ( Masks::maskChannel(ism, ix, iy, bits01, EcalEndcap) ) {
209  if ( meh01_[ism-1] ) meh01_[ism-1]->setBinError( ix, iy, 0.01 );
210  }
211  }
212  }
213 
214  for ( int i = 1; i <= 10; i++ ) {
215  if ( Masks::maskPn(ism, i, bits01, EcalEndcap) ) {
216  int it = (i-1)/5 + 1;
217  if ( meh03_[ism-1] ) meh03_[ism-1]->setBinError( it, 1, 0.01 );
218  }
219  }
220 
221  }
222 
223 }
224 
Cache logicID vector from database.
T getUntrackedParameter(std::string const &, T const &) const
static std::string sEE(const unsigned ism)
Definition: Numbers.cc:226
int i
Definition: DBlmapReader.cc:9
static bool maskChannel(int ism, int i1, int i2, uint32_t bits, const EcalSubdetector subdet)
Definition: Masks.cc:60
std::vector< int > superModules_
Some &quot;id&quot; conversions.
void beginRun(void)
BeginRun.
static bool maskPn(int ism, int i1, uint32_t bits, const EcalSubdetector subdet)
Definition: Masks.cc:112
MonitorElement * meh01_[18]
static const int STATUS_FLAG_ERROR
virtual ~EEStatusFlagsClient()
Destructor.
void setup(void)
Setup.
void beginJob(void)
BeginJob.
MonitorElement * meh03_[18]
channel masking
void endRun(void)
EndRun.
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
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
void analyze(void)
Analyze.
Ecal Monitor Utils for Client.
void cleanup(void)
Cleanup.
void endJob(void)
EndJob.
tuple cout
Definition: gather_cfg.py:121
EEStatusFlagsClient(const edm::ParameterSet &ps)
Constructor.
tuple status
Definition: ntuplemaker.py:245
Definition: RunIOV.h:13
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:56
static void printBadChannels(const MonitorElement *me, TH1 *hi, bool positive_only=false)
Print the bad channels.
Definition: UtilsClient.cc:14
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
MonitorElement * meh02_[18]