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  * \author G. Della Ricca
5  *
6 */
7 
8 #include <memory>
9 #include <iostream>
10 #include <fstream>
11 #include <iomanip>
12 
14 
17 
18 #ifdef WITH_ECAL_COND_DB
21 #endif
22 
24 
27 
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 
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 << "EEStatusFlagsClient: beginJob" << std::endl;
83 
84  ievt_ = 0;
85  jevt_ = 0;
86 
87 }
88 
90 
91  if ( debug_ ) std::cout << "EEStatusFlagsClient: beginRun" << std::endl;
92 
93  jevt_ = 0;
94 
95  this->setup();
96 
97 }
98 
100 
101  if ( debug_ ) std::cout << "EEStatusFlagsClient: endJob, ievt = " << ievt_ << std::endl;
102 
103  this->cleanup();
104 
105 }
106 
108 
109  if ( debug_ ) std::cout << "EEStatusFlagsClient: endRun, jevt = " << jevt_ << std::endl;
110 
111  this->cleanup();
112 
113 }
114 
116 
117  dqmStore_->setCurrentFolder( prefixME_ + "/EEStatusFlagsClient" );
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_ + "/EEStatusFlagsClient" );
146 
147 }
148 
149 #ifdef WITH_ECAL_COND_DB
150 bool EEStatusFlagsClient::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::sEE(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 << "EEStatusFlagsClient: 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_ + "/EEStatusFlagsTask/FEStatus/EESFT front-end status " + Numbers::sEE(ism) );
193  h01_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h01_[ism-1] );
194  meh01_[ism-1] = me;
195 
196  me = dqmStore_->get( prefixME_ + "/EEStatusFlagsTask/FEStatus/EESFT front-end status bits " + Numbers::sEE(ism) );
197  h02_[ism-1] = UtilsClient::getHisto<TH1F*>( me, cloneME_, h02_[ism-1] );
198  meh02_[ism-1] = me;
199 
200  me = dqmStore_->get( prefixME_ + "/EEStatusFlagsTask/FEStatus/EESFT MEM front-end status " + Numbers::sEE(ism) );
201  h03_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h01_[ism-1] );
202  meh03_[ism-1] = me;
203 
204  for ( int ix = 1; ix <= 50; ix++ ) {
205  for ( int iy = 1; iy <= 50; iy++ ) {
206  if ( Masks::maskChannel(ism, ix, iy, bits01, EcalEndcap) ) {
207  if ( meh01_[ism-1] ) meh01_[ism-1]->setBinError( ix, iy, 0.01 );
208  }
209  }
210  }
211 
212  for ( int i = 1; i <= 10; i++ ) {
213  if ( Masks::maskPn(ism, i, bits01, EcalEndcap) ) {
214  int it = (i-1)/5 + 1;
215  if ( meh03_[ism-1] ) meh03_[ism-1]->setBinError( it, 1, 0.01 );
216  }
217  }
218 
219  }
220 
221 }
222 
Cache logicID vector from database.
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
static bool maskChannel(int ism, int i1, int i2, uint32_t bits, const EcalSubdetector subdet)
Definition: Masks.cc:57
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:109
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:1624
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:585
MonitorElement * meh02_[18]