CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
EcalDQMStatusWriter Class Reference

#include <EcalDQMStatusWriter.h>

Inheritance diagram for EcalDQMStatusWriter:
edm::EDAnalyzer

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 
 EcalDQMStatusWriter (const edm::ParameterSet &ps)
 
virtual ~EcalDQMStatusWriter ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

uint32_t convert (uint32_t c)
 
EcalDQMChannelStatusreadEcalDQMChannelStatusFromFile (const char *)
 
EcalDQMTowerStatusreadEcalDQMTowerStatusFromFile (const char *)
 

Private Attributes

std::vector< std::string > inpFileName_
 
std::vector< std::string > objectName_
 
std::vector< unsigned long long > since_
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 29 of file EcalDQMStatusWriter.h.

Constructor & Destructor Documentation

EcalDQMStatusWriter::EcalDQMStatusWriter ( const edm::ParameterSet ps)

Definition at line 31 of file EcalDQMStatusWriter.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), inpFileName_, objectName_, since_, convertXMLtoSQLite_cfg::toPut, and verbose_.

31  {
32 
33  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
34 
35  typedef std::vector<edm::ParameterSet> Parameters;
36  Parameters toPut = ps.getParameter<Parameters>("toPut");
37 
38  for ( Parameters::iterator itToPut=toPut.begin(); itToPut!=toPut.end(); itToPut++ ) {
39  inpFileName_.push_back(itToPut->getUntrackedParameter<std::string>("inputFile"));
40  objectName_.push_back(itToPut->getUntrackedParameter<std::string>("conditionType"));
41  since_.push_back(itToPut->getUntrackedParameter<unsigned int>("since"));
42  }
43 
44 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< unsigned long long > since_
vector< ParameterSet > Parameters
std::vector< std::string > inpFileName_
std::vector< std::string > objectName_
virtual EcalDQMStatusWriter::~EcalDQMStatusWriter ( )
inlinevirtual

Definition at line 34 of file EcalDQMStatusWriter.h.

34 {};

Member Function Documentation

void EcalDQMStatusWriter::analyze ( const edm::Event e,
const edm::EventSetup c 
)
inlinevirtual

Implements edm::EDAnalyzer.

Definition at line 36 of file EcalDQMStatusWriter.h.

36 {};
void EcalDQMStatusWriter::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 46 of file EcalDQMStatusWriter.cc.

References cond::service::PoolDBOutputService::appendSinceTime(), cond::service::PoolDBOutputService::beginOfTime(), gather_cfg::cout, cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::endOfTime(), i, Numbers::initGeometry(), inpFileName_, edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), objectName_, readEcalDQMChannelStatusFromFile(), readEcalDQMTowerStatusFromFile(), since_, ntuplemaker::status, and verbose_.

46  {
47 
49 
51  if ( !dbservice.isAvailable() ){
52  std::cout << "PoolDBOutputService is unavailable" << std::endl;
53  return;
54  }
55 
56  for ( unsigned int i=0; i<objectName_.size(); i++ ) {
57 
58  bool toAppend;
59  cond::Time_t newTime;
60 
61  if ( dbservice->isNewTagRequest( objectName_[i]+std::string("Rcd") ) ) {
62  // This is the first object for this tag.
63  // Append mode should be off.
64  // newTime is the end of this new objects IOV.
65  toAppend = false;
66  newTime = dbservice->beginOfTime();
67  } else {
68  // There should already be an object in the DB for this tag.
69  // Append IOV mode should be on.
70  // newTime is the beginning of this new objects IOV.
71  toAppend = true;
72  newTime = (cond::Time_t) since_[i];
73  }
74 
75  std::cout << "Reading " << objectName_[i] << " from file and writing to DB with newTime " << newTime << std::endl;
76 
77  if (objectName_[i] == "EcalDQMChannelStatus") {
78 
80 
81  if ( !toAppend ) {
82  dbservice->createNewIOV<EcalDQMChannelStatus>(status, newTime, dbservice->endOfTime(), "EcalDQMChannelStatusRcd");
83  } else {
84  dbservice->appendSinceTime<EcalDQMChannelStatus>(status, newTime, "EcalDQMChannelStatusRcd");
85  }
86 
87  } else if (objectName_[i] == "EcalDQMTowerStatus") {
88 
90 
91  if ( !toAppend ) {
92  dbservice->createNewIOV<EcalDQMTowerStatus>(status, newTime, dbservice->endOfTime(), "EcalDQMTowerStatusRcd");
93  } else {
94  dbservice->appendSinceTime<EcalDQMTowerStatus>(status, newTime, "EcalDQMTowerStatusRcd");
95  }
96 
97  } else {
98 
99  std::cout << "Object " << objectName_[i] << " is not supported by this program." << std::endl;
100 
101  }
102 
103  }
104 
105 }
int i
Definition: DBlmapReader.cc:9
std::vector< unsigned long long > since_
EcalDQMTowerStatus * readEcalDQMTowerStatusFromFile(const char *)
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
unsigned long long Time_t
Definition: Time.h:16
bool isNewTagRequest(const std::string &recordName)
EcalDQMChannelStatus * readEcalDQMChannelStatusFromFile(const char *)
bool isAvailable() const
Definition: Service.h:47
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
std::vector< std::string > inpFileName_
static void initGeometry(const edm::EventSetup &setup, bool verbose=false)
Definition: Numbers.cc:50
std::vector< std::string > objectName_
tuple cout
Definition: gather_cfg.py:121
tuple status
Definition: ntuplemaker.py:245
uint32_t EcalDQMStatusWriter::convert ( uint32_t  c)
private

Definition at line 518 of file EcalDQMStatusWriter.cc.

References EcalDQMStatusHelper::LASER_MEAN_ERROR, EcalDQMStatusHelper::LASER_RMS_ERROR, EcalDQMStatusHelper::LASER_TIMING_MEAN_ERROR, EcalDQMStatusHelper::LASER_TIMING_RMS_ERROR, EcalDQMStatusHelper::LED_MEAN_ERROR, EcalDQMStatusHelper::LED_RMS_ERROR, EcalDQMStatusHelper::LED_TIMING_MEAN_ERROR, EcalDQMStatusHelper::LED_TIMING_RMS_ERROR, EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR, EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_RMS_ERROR, EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR, EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_RMS_ERROR, EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_MEAN_ERROR, EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_RMS_ERROR, EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR, EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR, EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING, EcalDQMStatusHelper::STATUS_FLAG_ERROR, EcalDQMStatusHelper::TESTPULSE_HIGH_GAIN_MEAN_ERROR, EcalDQMStatusHelper::TESTPULSE_HIGH_GAIN_RMS_ERROR, EcalDQMStatusHelper::TESTPULSE_LOW_GAIN_MEAN_ERROR, EcalDQMStatusHelper::TESTPULSE_LOW_GAIN_RMS_ERROR, EcalDQMStatusHelper::TESTPULSE_MIDDLE_GAIN_MEAN_ERROR, and EcalDQMStatusHelper::TESTPULSE_MIDDLE_GAIN_RMS_ERROR.

Referenced by readEcalDQMChannelStatusFromFile().

518  {
519 
520  if ( chStatus == 1 || (chStatus >= 8 && chStatus <= 12 )) {
521 
522  chStatus = 0;
537  chStatus |= 1 << EcalDQMStatusHelper::LASER_MEAN_ERROR;
538  chStatus |= 1 << EcalDQMStatusHelper::LASER_RMS_ERROR;
541  chStatus |= 1 << EcalDQMStatusHelper::LED_MEAN_ERROR;
542  chStatus |= 1 << EcalDQMStatusHelper::LED_RMS_ERROR;
545 
546  } else if ( chStatus == 2 ) {
547 
548  chStatus = 0;
549  chStatus |= 1 << EcalDQMStatusHelper::LASER_MEAN_ERROR;
550  chStatus |= 1 << EcalDQMStatusHelper::LASER_RMS_ERROR;
553  chStatus |= 1 << EcalDQMStatusHelper::LED_MEAN_ERROR;
554  chStatus |= 1 << EcalDQMStatusHelper::LED_RMS_ERROR;
557 
558  } else if ( chStatus == 3 ) {
559 
560  chStatus = 0;
570 
571  } else if ( chStatus == 4 ) {
572 
573  chStatus = 0;
582 
583  } else if ( chStatus == 13 || chStatus == 14 ) {
584 
585  chStatus = 0;
587 
588  } else if ( (chStatus&0x3f) == 13 || (chStatus&0x7f) == 13 ||
589  (chStatus&0x3f) == 14 || (chStatus&0x7f) == 14 ) {
590 
591  chStatus = 0;
606  chStatus |= 1 << EcalDQMStatusHelper::LASER_MEAN_ERROR;
607  chStatus |= 1 << EcalDQMStatusHelper::LASER_RMS_ERROR;
610  chStatus |= 1 << EcalDQMStatusHelper::LED_MEAN_ERROR;
611  chStatus |= 1 << EcalDQMStatusHelper::LED_RMS_ERROR;
615 
616  }
617 
618  return( chStatus );
619 
620 }
static const int LED_MEAN_ERROR
static const int PEDESTAL_MIDDLE_GAIN_RMS_ERROR
static const int LASER_MEAN_ERROR
static const int TESTPULSE_LOW_GAIN_RMS_ERROR
static const int PHYSICS_BAD_CHANNEL_WARNING
static const int LASER_TIMING_RMS_ERROR
static const int PEDESTAL_HIGH_GAIN_MEAN_ERROR
static const int PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR
static const int TESTPULSE_MIDDLE_GAIN_MEAN_ERROR
static const int PEDESTAL_LOW_GAIN_RMS_ERROR
static const int PEDESTAL_HIGH_GAIN_RMS_ERROR
static const int STATUS_FLAG_ERROR
static const int TESTPULSE_MIDDLE_GAIN_RMS_ERROR
static const int TESTPULSE_HIGH_GAIN_RMS_ERROR
static const int LED_TIMING_MEAN_ERROR
static const int PEDESTAL_LOW_GAIN_MEAN_ERROR
static const int TESTPULSE_LOW_GAIN_MEAN_ERROR
static const int LED_TIMING_RMS_ERROR
static const int PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR
static const int LASER_TIMING_MEAN_ERROR
static const int LED_RMS_ERROR
static const int PEDESTAL_MIDDLE_GAIN_MEAN_ERROR
static const int TESTPULSE_HIGH_GAIN_MEAN_ERROR
static const int LASER_RMS_ERROR
EcalDQMChannelStatus * EcalDQMStatusWriter::readEcalDQMChannelStatusFromFile ( const char *  inputFile)
private

Definition at line 107 of file EcalDQMStatusWriter.cc.

References convert(), gather_cfg::cout, EcalBarrel, EcalCondObjectContainer< T >::end(), edm::hlt::Exception, EcalCondObjectContainer< T >::find(), EcalDQMStatusDictionary::getDictionary(), i, errorMatrix2Lands_multiChannel::id, compare_using_db::ifile, getHLTprescales::index, ecalpyutils::ism(), Numbers::iSM(), combine::key, geometryCSVtoXML::line, python.rootplot.argparse::module, EcalCondObjectContainer< T >::setValue(), EBDetId::SMCRYSTALMODE, ntuplemaker::status, EBDetId::unhashIndex(), EEDetId::validDetId(), and verbose_.

Referenced by beginRun().

107  {
108 
110 
111  std::vector<EcalDQMStatusDictionary::codeDef> dictionary;
113 
114  // barrel
115  for ( int ism=1; ism<=36; ism++ ) {
116  int jsm = Numbers::iSM(ism, EcalBarrel);
117  for ( int ic=1; ic<=1700; ic++ ) {
119  status->setValue(id, 0);
120  }
121  }
122 
123  // endcap
124  for ( int ix=1; ix<=100; ix++ ) {
125  for ( int iy=1; iy<=100; iy++ ) {
126  if ( EEDetId::validDetId(ix, iy, +1) ) {
127  EEDetId id(ix, iy, +1);
128  status->setValue(id, 0);
129  }
130  if ( EEDetId::validDetId(ix, iy, -1) ) {
131  EEDetId id(ix, iy, -1);
132  status->setValue(id, 0);
133  }
134  }
135  }
136 
137  std::cout << "Reading channel status from file " << inputFile << std::endl;
138  FILE *ifile = fopen( inputFile ,"r" );
139 
140  if ( !ifile ) throw cms::Exception ("Cannot open file") ;
141 
142  char line[256];
143 
144  int ii = 0;
145  while ( fgets(line, 255, ifile) ) {
146 
147  std::stringstream stream;
148 
149  ii++;
150  std::string key;
151  stream << line;
152  if ( verbose_ ) std::cout << line;
153  stream >> key;
154 
155  if ( key.size() == 0 || strcmp(key.c_str(), " ") == 0 || strncmp(key.c_str(), "#", 1) == 0 ) {
156 
157  // skip comments
158 
159  } else if ( strcmp(key.c_str(), "EB") == 0 ) {
160 
161  int index;
162  uint32_t code;
163  stream >> index >> code;
164 
165  EBDetId id = EBDetId::unhashIndex(index);
166  code = convert(code);
167 
169  if ( it != status->end() ) code |= it->getStatusCode();
170  status->setValue(id, code);
171 
172  } else if ( strcmp(key.c_str(), "EE") == 0 ) {
173 
174  int ix, iy, iz;
175  uint32_t code;
176  stream >> ix >> iy >> iz >> code;
177 
178  EEDetId id(ix, iy, iz);
179  code = convert(code);
180 
182  if ( it != status->end() ) code |= it->getStatusCode();
183  status->setValue(id, code);
184 
185  } else if ( strcmp(key.c_str(), "Crystal") == 0 ) {
186 
187  std::string module;
188  stream >> module;
189 
190  if ( strncmp(module.c_str(), "EB+", 3) == 0 || strncmp(module.c_str(), "EB-", 3) == 0 ) {
191 
192 #if 0
193  int ie, ip;
194  std::string token;
195  stream >> ie >> ip >> token;
196 
197  int sm = atoi( module.substr(2, module.size()-2).c_str() );
198 
199  int ism = (sm>=1&&sm<=18) ? sm+18 : -sm;
200  int jsm = Numbers::iSM(ism, EcalBarrel);
201  int ic = 20*(ie-1)+(ip-1)+1;
202 #else
203  int ic;
204  std::string token;
205  stream >> ic >> token;
206 
207  int sm = atoi( module.substr(2, module.size()-2).c_str() );
208 
209  int ism = (sm>=1&&sm<=18) ? sm+18 : -sm;
210  int jsm = Numbers::iSM(ism, EcalBarrel);
211 #endif
212 
214  uint32_t code = 0;
215  for ( unsigned int i=0; i<dictionary.size(); i++ ) {
216  if ( strcmp(token.c_str(), dictionary[i].desc) == 0 ) {
217  code = dictionary[i].code;
218  }
219  }
220  if ( code == 0 ) {
221  std::cout << " --> not found in the dictionary: " << token << std::endl;
222  continue;
223  }
224 
226  if ( it != status->end() ) code |= it->getStatusCode();
227  status->setValue(id, code);
228 
229  } else if ( strncmp(module.c_str(), "EE+", 3) == 0 || strncmp(module.c_str(), "EE-", 3) == 0 ) {
230 
231 #if 0
232  int jx, jy;
233  std::string token;
234  stream >> jx >> jy >> token;
235 #else
236  int index;
237  std::string token;
238  stream >> index >> token;
239  int jx = index/1000;
240  int jy = index%1000;
241 #endif
242 
243  int sm = atoi( module.substr(2, module.size()-2).c_str() );
244 
245  int ism = 0;
246  if( sm == -99 ) sm = -1;
247  if( sm == +99 ) sm = +1;
248  switch ( sm ) {
249  case -7: ism = 1; break;
250  case -8: ism = 2; break;
251  case -9: ism = 3; break;
252  case -1: ism = 4; break;
253  case -2: ism = 5; break;
254  case -3: ism = 6; break;
255  case -4: ism = 7; break;
256  case -5: ism = 8; break;
257  case -6: ism = 9; break;
258  case +7: ism = 10; break;
259  case +8: ism = 11; break;
260  case +9: ism = 12; break;
261  case +1: ism = 13; break;
262  case +2: ism = 14; break;
263  case +3: ism = 15; break;
264  case +4: ism = 16; break;
265  case +5: ism = 17; break;
266  case +6: ism = 18; break;
267  }
268 
269  EEDetId id(jx, jy, (ism>=1&&ism<=9)?-1:+1);
270  uint32_t code = 0;
271  for ( unsigned int i=0; i<dictionary.size(); i++ ) {
272  if ( strcmp(token.c_str(), dictionary[i].desc) == 0 ) {
273  code = dictionary[i].code;
274  }
275  }
276  if ( code == 0 ) {
277  std::cout << " --> not found in the dictionary: " << token << std::endl;
278  continue;
279  }
280 
282  if ( it != status->end() ) code |= it->getStatusCode();
283  status->setValue(id, code);
284 
285  } else {
286 
287  std:: cout << "--> unknown token at line #" << ii << " : " << line;
288 
289  }
290 
291  } else if ( strcmp(key.c_str(), "TT") == 0 ) {
292 
293  // see readEcalDQMTowerStatusFromFile
294 
295  } else if ( strcmp(key.c_str(), "PN") == 0 || strcmp(key.c_str(), "MemCh") == 0 || strcmp(key.c_str(), "MemTT") == 0 ) {
296 
297  std::cout << "--> unsupported key at line #" << ii << " : " << line;
298 
299  } else {
300 
301  std:: cout << "--> skipped line #" << ii << " : " << line;
302 
303  }
304 
305  }
306 
307  fclose(ifile);
308 
309  return status;
310 
311 }
int i
Definition: DBlmapReader.cc:9
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.cc:562
void setValue(const uint32_t id, const Item &item)
EcalDQMChannelStatusMap EcalDQMChannelStatus
static void getDictionary(std::vector< codeDef > &dict)
uint32_t convert(uint32_t c)
std::vector< Item >::const_iterator const_iterator
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.cc:12
list key
Definition: combine.py:13
static unsigned iSM(const unsigned ism, const EcalSubdetector subdet)
Definition: Numbers.cc:246
const_iterator find(uint32_t rawId) const
tuple cout
Definition: gather_cfg.py:121
const_iterator end() const
tuple status
Definition: ntuplemaker.py:245
static const int SMCRYSTALMODE
Definition: EBDetId.h:146
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:56
EcalDQMTowerStatus * EcalDQMStatusWriter::readEcalDQMTowerStatusFromFile ( const char *  inputFile)
private

Definition at line 313 of file EcalDQMStatusWriter.cc.

References abs, gather_cfg::cout, Numbers::crystals(), EcalBarrel, EcalCondTowerObjectContainer< T >::end(), edm::hlt::Exception, EcalCondTowerObjectContainer< T >::find(), EcalDQMStatusDictionary::getDictionary(), i, errorMatrix2Lands_multiChannel::id, compare_using_db::ifile, ecalpyutils::ism(), combine::key, geometryCSVtoXML::line, python.rootplot.argparse::module, EcalCondTowerObjectContainer< T >::setValue(), ntuplemaker::status, EcalTrigTowerDetId::validDetId(), EcalScDetId::validDetId(), and verbose_.

Referenced by beginRun().

313  {
314 
316 
317  std::vector<EcalDQMStatusDictionary::codeDef> dictionary;
319 
320  // barrel
321  for ( int ix=1; ix<=17; ix++ ) {
322  for ( int iy=1; iy<=72; iy++ ) {
323  if ( EcalTrigTowerDetId::validDetId(+1, EcalBarrel, ix, iy) ) {
324  EcalTrigTowerDetId id(+1, EcalBarrel, ix, iy);
325  status->setValue(id, 0);
326  }
327  if ( EcalTrigTowerDetId::validDetId(-1, EcalBarrel, ix, iy) ) {
328  EcalTrigTowerDetId id(-1, EcalBarrel, ix, iy);
329  status->setValue(id, 0);
330  }
331  }
332  }
333 
334  // endcap
335  for ( int ix=1; ix<=20; ix++ ) {
336  for ( int iy=1; iy<=20; iy++ ) {
337  if ( EcalScDetId::validDetId(ix, iy, +1) ) {
338  EcalScDetId id(ix, iy, +1);
339  status->setValue(id, 0);
340  }
341  if ( EcalScDetId::validDetId(ix, iy, -1) ) {
342  EcalScDetId id(ix, iy, -1);
343  status->setValue(id, 0);
344  }
345  }
346  }
347 
348  std::cout << "Reading tower status from file " << inputFile << std::endl;
349  FILE *ifile = fopen( inputFile ,"r" );
350 
351  if ( !ifile ) throw cms::Exception ("Cannot open file") ;
352 
353  char line[256];
354 
355  int ii = 0;
356  while ( fgets(line, 255, ifile) ) {
357 
358  std::stringstream stream;
359 
360  ii++;
361  std::string key;
362  stream << line;
363  if ( verbose_ ) std::cout << line;
364  stream >> key;
365 
366  if ( key.size() == 0 || strcmp(key.c_str(), " ") == 0 || strncmp(key.c_str(), "#", 1) == 0 ) {
367 
368  // skip comments
369 
370  } else if ( strcmp(key.c_str(), "EB") == 0 ) {
371 
372  // see readEcalDQMChannelStatusFromFile
373 
374  } else if ( strcmp(key.c_str(), "EE") == 0 ) {
375 
376  // see readEcalDQMChannelStatusFromFile
377 
378  } else if ( strcmp(key.c_str(), "Crystal") == 0 ) {
379 
380  // see readEcalDQMChannelStatusFromFile
381 
382  } else if ( strcmp(key.c_str(), "TT") == 0 ) {
383 
384  std::string module;
385  stream >> module;
386 
387  if ( strncmp(module.c_str(), "EB+", 3) == 0 || strncmp(module.c_str(), "EB-", 3) == 0 ) {
388 
389  int itt;
390  std::string token;
391  stream >> itt >> token;
392 
393  if ( itt >= 1 && itt <= 68 ) {
394 
395  int sm = atoi( module.substr(2, module.size()-2).c_str() );
396 
397  int iet = (itt-1)/4+1;
398  int ipt = (itt-1)%4+1;
399 
400  if ( sm<0 ) {
401  ipt = ipt+(std::abs(sm)-1)*4-2;
402  if ( ipt < 1 ) ipt = ipt+72;
403  if ( ipt > 72 ) ipt = ipt-72;
404  } else {
405  ipt = (5-ipt)+(std::abs(sm)-1)*4-2;
406  if ( ipt < 1 ) ipt = ipt+72;
407  if ( ipt > 72 ) ipt = ipt-72;
408  }
409 
410  EcalTrigTowerDetId id((sm<0)?-1:+1, EcalBarrel, iet, ipt);
411  uint32_t code = 0;
412  for ( unsigned int i=0; i<dictionary.size(); i++ ) {
413  if ( strcmp(token.c_str(), dictionary[i].desc) == 0 ) {
414  code = dictionary[i].code;
415  }
416  }
417  if ( code == 0 ) {
418  std::cout << " --> not found in the dictionary: " << token << std::endl;
419  continue;
420  }
421 
422  EcalDQMTowerStatus::const_iterator it = status->find(id);
423  if ( it != status->end() ) code |= it->getStatusCode();
424  status->setValue(id, code);
425 
426  } else {
427 
428  std::cout << "--> unsupported configuration at line #" << ii << " : " << line;
429 
430  }
431 
432  } else if ( strncmp(module.c_str(), "EE+", 3) == 0 || strncmp(module.c_str(), "EE-", 3) == 0 ) {
433 
434  int isc;
435  std::string token;
436  stream >> isc >> token;
437 
438  if ( isc >= 1 && isc <= 68 ) {
439 
440  int sm = atoi( module.substr(2, module.size()-2).c_str() );
441 
442  int ism = 0;
443  switch ( sm ) {
444  case -7: ism = 1; break;
445  case -8: ism = 2; break;
446  case -9: ism = 3; break;
447  case -1: ism = 4; break;
448  case -2: ism = 5; break;
449  case -3: ism = 6; break;
450  case -4: ism = 7; break;
451  case -5: ism = 8; break;
452  case -6: ism = 9; break;
453  case +7: ism = 10; break;
454  case +8: ism = 11; break;
455  case +9: ism = 12; break;
456  case +1: ism = 13; break;
457  case +2: ism = 14; break;
458  case +3: ism = 15; break;
459  case +4: ism = 16; break;
460  case +5: ism = 17; break;
461  case +6: ism = 18; break;
462  }
463 
464  int idcc = (ism>=1&&ism<=9) ? ism : ism-9+45;
465 
466  std::vector<DetId>* crystals = Numbers::crystals(idcc, isc);
467 
468  for ( unsigned int i=0; i<crystals->size(); i++ ) {
469 
470  EcalScDetId id = ((EEDetId) (*crystals)[i]).sc();
471  uint32_t code = 0;
472  for ( unsigned int i=0; i<dictionary.size(); i++ ) {
473  if ( strcmp(token.c_str(), dictionary[i].desc) == 0 ) {
474  code = dictionary[i].code;
475  }
476  }
477  if ( code == 0 ) {
478  std::cout << " --> not found in the dictionary: " << token << std::endl;
479  continue;
480  }
481 
482  EcalDQMTowerStatus::const_iterator it = status->find(id);
483  if ( it != status->end() ) code |= it->getStatusCode();
484  status->setValue(id, code);
485 
486  }
487 
488  } else {
489 
490  std::cout << "--> unsupported configuration at line #" << ii << " : " << line;
491 
492  }
493 
494  } else {
495 
496  std:: cout << "--> unknown token at line #" << ii << " : " << line;
497 
498  }
499 
500  } else if ( strcmp(key.c_str(), "PN") == 0 || strcmp(key.c_str(), "MemCh") == 0 || strcmp(key.c_str(), "MemTT") == 0 ) {
501 
502  std::cout << "--> unsupported key at line #" << ii << " : " << line;
503 
504  } else {
505 
506  std:: cout << "--> skipped line #" << ii << " : " << line;
507 
508  }
509 
510  }
511 
512  fclose(ifile);
513 
514  return status;
515 
516 }
static bool validDetId(int ix, int iy, int iz)
Definition: EcalScDetId.cc:63
int i
Definition: DBlmapReader.cc:9
#define abs(x)
Definition: mlp_lapack.h:159
void setValue(const uint32_t id, const Item &item)
const_iterator find(uint32_t rawId) const
static std::vector< DetId > * crystals(const EcalTrigTowerDetId &id)
Definition: Numbers.cc:585
static void getDictionary(std::vector< codeDef > &dict)
EcalDQMTowerStatusMap EcalDQMTowerStatus
static bool validDetId(int iz, EcalSubdetector sd, int i, int j)
check if a valid index combination
list key
Definition: combine.py:13
tuple cout
Definition: gather_cfg.py:121
std::vector< Item >::const_iterator const_iterator
tuple status
Definition: ntuplemaker.py:245
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:56

Member Data Documentation

std::vector<std::string> EcalDQMStatusWriter::inpFileName_
private

Definition at line 49 of file EcalDQMStatusWriter.h.

Referenced by beginRun(), and EcalDQMStatusWriter().

std::vector<std::string> EcalDQMStatusWriter::objectName_
private

Definition at line 48 of file EcalDQMStatusWriter.h.

Referenced by beginRun(), and EcalDQMStatusWriter().

std::vector<unsigned long long> EcalDQMStatusWriter::since_
private

Definition at line 50 of file EcalDQMStatusWriter.h.

Referenced by beginRun(), and EcalDQMStatusWriter().

bool EcalDQMStatusWriter::verbose_
private