CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EBStatusFlagsClient.cc
Go to the documentation of this file.
1 /*
2  * \file EBStatusFlagsClient.cc
3  *
4  * $Date: 2012/04/27 13:45:59 $
5  * $Revision: 1.49 $
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 
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 36).
50  superModules_.reserve(36);
51  for ( unsigned int i = 1; i <= 36; 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 
60  meh01_[ism-1] = 0;
61 
62  h02_[ism-1] = 0;
63 
64  meh02_[ism-1] = 0;
65 
66  h03_[ism-1] = 0;
67 
68  meh03_[ism-1] = 0;
69 
70  }
71 
72 }
73 
75 
76 }
77 
79 
81 
82  if ( debug_ ) std::cout << "EBStatusFlagsClient: beginJob" << std::endl;
83 
84  ievt_ = 0;
85  jevt_ = 0;
86 
87 }
88 
90 
91  if ( debug_ ) std::cout << "EBStatusFlagsClient: beginRun" << std::endl;
92 
93  jevt_ = 0;
94 
95  this->setup();
96 
97 }
98 
100 
101  if ( debug_ ) std::cout << "EBStatusFlagsClient: endJob, ievt = " << ievt_ << std::endl;
102 
103  this->cleanup();
104 
105 }
106 
108 
109  if ( debug_ ) std::cout << "EBStatusFlagsClient: endRun, jevt = " << jevt_ << std::endl;
110 
111  this->cleanup();
112 
113 }
114 
116 
117  dqmStore_->setCurrentFolder( prefixME_ + "/EBStatusFlagsClient" );
118 
119 }
120 
122 
123  if ( ! enableCleanup_ ) return;
124 
125  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
126 
127  int ism = superModules_[i];
128 
129  if ( cloneME_ ) {
130  if ( h01_[ism-1] ) delete h01_[ism-1];
131  if ( h02_[ism-1] ) delete h02_[ism-1];
132  if ( h03_[ism-1] ) delete h03_[ism-1];
133  }
134 
135  h01_[ism-1] = 0;
136  h02_[ism-1] = 0;
137  h03_[ism-1] = 0;
138 
139  meh01_[ism-1] = 0;
140  meh02_[ism-1] = 0;
141  meh03_[ism-1] = 0;
142 
143  }
144 
145  dqmStore_->setCurrentFolder( prefixME_ + "/EBStatusFlagsClient" );
146 
147 }
148 
149 #ifdef WITH_ECAL_COND_DB
150 bool EBStatusFlagsClient::writeDb(EcalCondDBInterface* econn, RunIOV* runiov, MonRunIOV* moniov, bool& status) {
151 
152  status = true;
153 
154  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
155 
156  int ism = superModules_[i];
157 
158  if ( verbose_ ) {
159  std::cout << " " << Numbers::sEB(ism) << " (ism=" << ism << ")" << std::endl;
160  std::cout << std::endl;
161  UtilsClient::printBadChannels(meh01_[ism-1], UtilsClient::getHisto<TH2F*>(meh01_[ism-1]), true);
162  }
163 
164  if ( meh01_[ism-1] ) {
165  if ( meh01_[ism-1]->getEntries() != 0 ) status = false;
166  }
167 
168  }
169 
170  return true;
171 
172 }
173 #endif
174 
176 
177  ievt_++;
178  jevt_++;
179  if ( ievt_ % 10 == 0 ) {
180  if ( debug_ ) std::cout << "EBStatusFlagsClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
181  }
182 
183  uint32_t bits01 = 0;
185 
186  MonitorElement* me;
187 
188  for ( unsigned int i=0; i<superModules_.size(); i++ ) {
189 
190  int ism = superModules_[i];
191 
192  me = dqmStore_->get( prefixME_ + "/EBStatusFlagsTask/FEStatus/EBSFT front-end status " + Numbers::sEB(ism) );
193  h01_[ism-1] = UtilsClient::getHisto( me, cloneME_, h01_[ism-1] );
194  meh01_[ism-1] = me;
195 
196  me = dqmStore_->get( prefixME_ + "/EBStatusFlagsTask/FEStatus/EBSFT front-end status bits " + Numbers::sEB(ism) );
197  h02_[ism-1] = UtilsClient::getHisto( me, cloneME_, h02_[ism-1] );
198  meh02_[ism-1] = me;
199 
200  me = dqmStore_->get( prefixME_ + "/EBStatusFlagsTask/FEStatus/EBSFT MEM front-end status " + Numbers::sEB(ism) );
201  h03_[ism-1] = UtilsClient::getHisto( me, cloneME_, h01_[ism-1] );
202  meh03_[ism-1] = me;
203 
204  for ( int ie = 1; ie <= 85; ie++ ) {
205  for ( int ip = 1; ip <= 20; ip++ ) {
206  if ( Masks::maskChannel(ism, ie, ip, bits01, EcalBarrel) ) {
207  int iet = (ie-1)/5 + 1;
208  int ipt = (ip-1)/5 + 1;
209  if ( meh01_[ism-1] ) meh01_[ism-1]->setBinError( iet, ipt, 0.01 );
210  }
211  }
212  }
213 
214  for ( int i = 1; i <= 10; i++ ) {
215  if ( Masks::maskPn(ism, i, bits01, EcalBarrel) ) {
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 
void endRun(void)
EndRun.
void cleanup(void)
Cleanup.
Cache logicID vector from database.
T getUntrackedParameter(std::string const &, T const &) const
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
static T getHisto(const MonitorElement *me, bool clone=false, T ret=0)
Returns the histogram contained by the Monitor Element.
Definition: UtilsClient.h:91
Some &quot;id&quot; conversions.
static std::string sEB(const unsigned ism)
Definition: Numbers.cc:94
EBStatusFlagsClient(const edm::ParameterSet &ps)
Constructor.
std::vector< int > superModules_
static bool maskPn(int ism, int i1, uint32_t bits, const EcalSubdetector subdet)
Definition: Masks.cc:112
static const int STATUS_FLAG_ERROR
void beginRun(void)
BeginRun.
channel masking
MonitorElement * meh03_[36]
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
MonitorElement * meh01_[36]
MonitorElement * meh02_[36]
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 endJob(void)
EndJob.
Ecal Monitor Utils for Client.
void beginJob(void)
BeginJob.
void analyze(void)
Analyze.
virtual ~EBStatusFlagsClient()
Destructor.
void setup(void)
Setup.
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
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