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 Types | Private Member Functions | Private Attributes
EcalCondDBReader Class Reference

#include <EcalCondDBReader.h>

Inheritance diagram for EcalCondDBReader:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 EcalCondDBReader (edm::ParameterSet const &)
 
 ~EcalCondDBReader ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

enum  Tasks {
  Integrity = 0, Cosmic = 1, Laser = 2, Pedestal = 3,
  Presample = 4, TestPulse = 5, BeamCalo = 6, BeamHodo = 7,
  TriggerPrimitives = 8, Cluster = 9, Timing = 10, Led = 11,
  RawData = 12, Occupancy = 13, nTasks = 14
}
 

Private Member Functions

void analyze (edm::Event const &, edm::EventSetup const &)
 

Private Attributes

EcalCondDBInterfacedb_
 
bool executed_
 
std::string formula_
 
ecaldqm::MESetmeSet_
 
MonRunIOV monIOV_
 
int verbosity_
 
ecaldqm::DBReaderWorkerworker_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 13 of file EcalCondDBReader.h.

Member Enumeration Documentation

Enumerator
Integrity 
Cosmic 
Laser 
Pedestal 
Presample 
TestPulse 
BeamCalo 
BeamHodo 
TriggerPrimitives 
Cluster 
Timing 
Led 
RawData 
Occupancy 
nTasks 

Definition at line 22 of file EcalCondDBReader.h.

Constructor & Destructor Documentation

EcalCondDBReader::EcalCondDBReader ( edm::ParameterSet const &  _ps)

Definition at line 9 of file EcalCondDBReader.cc.

References ecaldqm::MESet::book(), EcalCondDB::db, db_, alignCSCRings::e, cppFunctionSkipper::exception, edm::hlt::Exception, EcalCondDBInterface::fetchMonRunIOV(), EcalCondDBInterface::fetchRunIOV(), RunIOV::getRunTag(), edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), meSet_, monIOV_, convertSQLiteXML::runNumber, MonRunTag::setGeneralTag(), MonVersionDef::setMonitoringVersion(), MonRunTag::setMonVersionDef(), AlCaHLTBitMon_QueryRunRegistry::string, table, verbosity_, and worker_.

9  :
10  db_(0),
11  monIOV_(),
12  worker_(0),
13  formula_(_ps.getUntrackedParameter<std::string>("formula")),
14  meSet_(ecaldqm::createMESet(_ps.getUntrackedParameterSet("plot"))),
15  verbosity_(_ps.getUntrackedParameter<int>("verbosity")),
16  executed_(false)
17 {
18  std::string table(_ps.getUntrackedParameter<std::string>("table"));
19  edm::ParameterSet const& workerParams(_ps.getUntrackedParameterSet("workerParams"));
20 
21  if(table == "CrystalConsistency") worker_ = new ecaldqm::CrystalConsistencyReader(workerParams);
22  if(table == "TTConsistency") worker_ = new ecaldqm::TTConsistencyReader(workerParams);
23  if(table == "MemChConsistency") worker_ = new ecaldqm::MemChConsistencyReader(workerParams);
24  if(table == "MemTTConsistency") worker_ = new ecaldqm::MemTTConsistencyReader(workerParams);
25  if(table == "LaserBlue") worker_ = new ecaldqm::LaserBlueReader(workerParams);
26  if(table == "TimingLaserBlueCrystal") worker_ = new ecaldqm::TimingLaserBlueCrystalReader(workerParams);
27  if(table == "PNBlue") worker_ = new ecaldqm::PNBlueReader(workerParams);
28  if(table == "LaserGreen") worker_ = new ecaldqm::LaserGreenReader(workerParams);
29  if(table == "TimingLaserGreenCrystal") worker_ = new ecaldqm::TimingLaserGreenCrystalReader(workerParams);
30  if(table == "PNGreen") worker_ = new ecaldqm::PNGreenReader(workerParams);
31  if(table == "LaserIRed") worker_ = new ecaldqm::LaserIRedReader(workerParams);
32  if(table == "TimingLaserIRedCrystal") worker_ = new ecaldqm::TimingLaserIRedCrystalReader(workerParams);
33  if(table == "PNIRed") worker_ = new ecaldqm::PNIRedReader(workerParams);
34  if(table == "LaserRed") worker_ = new ecaldqm::LaserRedReader(workerParams);
35  if(table == "TimingLaserRedCrystal") worker_ = new ecaldqm::TimingLaserRedCrystalReader(workerParams);
36  if(table == "PNRed") worker_ = new ecaldqm::PNRedReader(workerParams);
37  if(table == "Pedestals") worker_ = new ecaldqm::PedestalsReader(workerParams);
38  if(table == "PNPed") worker_ = new ecaldqm::PNPedReader(workerParams);
39  if(table == "PedestalsOnline") worker_ = new ecaldqm::PedestalsOnlineReader(workerParams);
40  if(table == "TestPulse") worker_ = new ecaldqm::TestPulseReader(workerParams);
41  if(table == "PulseShape") worker_ = new ecaldqm::PulseShapeReader(workerParams);
42  if(table == "PNMGPA") worker_ = new ecaldqm::PNMGPAReader(workerParams);
43  if(table == "TimingCrystal") worker_ = new ecaldqm::TimingCrystalReader(workerParams);
44  if(table == "Led1") worker_ = new ecaldqm::Led1Reader(workerParams);
45  if(table == "TimingLed1Crystal") worker_ = new ecaldqm::TimingLed1CrystalReader(workerParams);
46  if(table == "Led2") worker_ = new ecaldqm::Led2Reader(workerParams);
47  if(table == "TimingLed2Crystal") worker_ = new ecaldqm::TimingLed2CrystalReader(workerParams);
48  if(table == "Occupancy") worker_ = new ecaldqm::OccupancyReader(workerParams);
49 
50  if(!worker_)
51  throw cms::Exception("Configuration") << "Invalid worker type";
52 
54 
55  std::string DBName(_ps.getUntrackedParameter<std::string>("DBName"));
56  std::string hostName(_ps.getUntrackedParameter<std::string>("hostName"));
57  int hostPort(_ps.getUntrackedParameter<int>("hostPort"));
58  std::string userName(_ps.getUntrackedParameter<std::string>("userName"));
59  std::string password(_ps.getUntrackedParameter<std::string>("password"));
60 
61  std::auto_ptr<EcalCondDBInterface> db(0);
62 
63  if(verbosity_ > 0) edm::LogInfo("EcalDQM") << "Establishing DB connection";
64 
65  try{
66  db = std::auto_ptr<EcalCondDBInterface>(new EcalCondDBInterface(DBName, userName, password));
67  }
68  catch(std::runtime_error& re){
69  if(hostName != ""){
70  try{
71  db = std::auto_ptr<EcalCondDBInterface>(new EcalCondDBInterface(hostName, DBName, userName, password, hostPort));
72  }
73  catch(std::runtime_error& re2){
74  throw cms::Exception("DBError") << re2.what();
75  }
76  }
77  else
78  throw cms::Exception("DBError") << re.what();
79  }
80 
81  db_ = db.release();
82 
83  std::string location(_ps.getUntrackedParameter<std::string>("location"));
84  int runNumber(_ps.getUntrackedParameter<int>("runNumber"));
85  std::string monRunGeneralTag(_ps.getUntrackedParameter<std::string>("monRunGeneralTag"));
86 
87  if(verbosity_ > 0) edm::LogInfo("EcalDQM") << "Initializing DB entry";
88 
89  RunTag runTag;
90 
91  try{
92  runTag = db_->fetchRunIOV(location, runNumber).getRunTag();
93  }
94  catch(std::exception&){
95  edm::LogError("EcalDQM") << "Cannot fetch RunIOV for location=" << location << " runNumber=" << runNumber;
96  throw;
97  }
98 
99  MonVersionDef versionDef;
100  versionDef.setMonitoringVersion("test01"); // the only mon_ver in mon_version_def table as of September 2012
101  MonRunTag monTag;
102  monTag.setMonVersionDef(versionDef);
103  monTag.setGeneralTag(monRunGeneralTag);
104 
105  try{
106  monIOV_ = db_->fetchMonRunIOV(&runTag, &monTag, runNumber, 1);
107  }
108  catch(std::runtime_error& e){
109  edm::LogError("EcalDQM") << "Cannot fetch MonRunIOV for location=" << location << " runNumber=" << runNumber << " monVersion=test01 monRunGeneralTag=" << monRunGeneralTag;
110  throw;
111  }
112 
113  if(verbosity_ > 0) edm::LogInfo("EcalDQM") << " Done.";
114 }
ecaldqm::MESet * meSet_
ecaldqm::DBReaderWorker * worker_
Definition: RunTag.h:13
tuple db
Definition: EcalCondDB.py:151
RunIOV fetchRunIOV(RunTag *tag, run_t run)
EcalCondDBInterface * db_
void setGeneralTag(std::string tag)
Definition: MonRunTag.cc:33
RunTag getRunTag() const
Definition: RunIOV.cc:96
virtual void book(DQMStore &)
Definition: MESet.h:42
void setMonVersionDef(const MonVersionDef &ver)
Definition: MonRunTag.cc:49
#define table(NAME)
Definition: DbCore.h:49
std::string formula_
MonRunIOV fetchMonRunIOV(RunTag *runtag, MonRunTag *montag, run_t run, subrun_t monrun)
void setMonitoringVersion(std::string ver)
MESet * createMESet(edm::ParameterSet const &)
Definition: MESetUtils.cc:19
EcalCondDBReader::~EcalCondDBReader ( )

Definition at line 116 of file EcalCondDBReader.cc.

References meSet_, and worker_.

117 {
118  delete worker_;
119  delete meSet_;
120 }
ecaldqm::MESet * meSet_
ecaldqm::DBReaderWorker * worker_

Member Function Documentation

void EcalCondDBReader::analyze ( edm::Event const &  ,
edm::EventSetup const &   
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 123 of file EcalCondDBReader.cc.

References db_, executed_, formula_, meSet_, monIOV_, ecaldqm::DBReaderWorker::run(), ecaldqm::MESet::setBinContent(), makeHLTPrescaleTable::values, and worker_.

124 {
125  if(executed_) return;
126 
127  std::map<DetId, double> values(worker_->run(db_, monIOV_, formula_));
128  for(std::map<DetId, double>::const_iterator vItr(values.begin()); vItr != values.end(); ++vItr)
129  meSet_->setBinContent(vItr->first, vItr->second);
130 
131  executed_ = true;
132 }
ecaldqm::MESet * meSet_
ecaldqm::DBReaderWorker * worker_
EcalCondDBInterface * db_
virtual void setBinContent(DetId const &, double)
Definition: MESet.h:52
std::string formula_
virtual std::map< DetId, double > run(EcalCondDBInterface *, MonRunIOV &, std::string const &)=0

Member Data Documentation

EcalCondDBInterface* EcalCondDBReader::db_
private

Definition at line 40 of file EcalCondDBReader.h.

Referenced by analyze(), and EcalCondDBReader().

bool EcalCondDBReader::executed_
private

Definition at line 47 of file EcalCondDBReader.h.

Referenced by analyze().

std::string EcalCondDBReader::formula_
private

Definition at line 43 of file EcalCondDBReader.h.

Referenced by analyze().

ecaldqm::MESet* EcalCondDBReader::meSet_
private

Definition at line 44 of file EcalCondDBReader.h.

Referenced by analyze(), EcalCondDBReader(), and ~EcalCondDBReader().

MonRunIOV EcalCondDBReader::monIOV_
private

Definition at line 41 of file EcalCondDBReader.h.

Referenced by analyze(), and EcalCondDBReader().

int EcalCondDBReader::verbosity_
private

Definition at line 46 of file EcalCondDBReader.h.

Referenced by EcalCondDBReader().

ecaldqm::DBReaderWorker* EcalCondDBReader::worker_
private

Definition at line 42 of file EcalCondDBReader.h.

Referenced by analyze(), EcalCondDBReader(), and ~EcalCondDBReader().