1 #include "../interface/EcalCondDBWriter.h"
11 #include "TObjArray.h"
16 setBit(
int& _bitArray,
unsigned _iBit)
18 _bitArray |= (0x1 << _iBit);
22 getBit(
int& _bitArray,
unsigned _iBit)
24 return (_bitArray & (0x1 << _iBit)) != 0;
30 location_(_ps.getUntrackedParameter<std::
string>(
"location")),
31 runType_(_ps.getUntrackedParameter<std::
string>(
"runType")),
32 runGeneralTag_(_ps.getUntrackedParameter<std::
string>(
"runGeneralTag")),
33 monRunGeneralTag_(_ps.getUntrackedParameter<std::
string>(
"monRunGeneralTag")),
34 summaryWriter_(_ps.getUntrackedParameterSet(
"workerParams")),
35 verbosity_(_ps.getUntrackedParameter<int>(
"verbosity")),
38 std::vector<std::string> inputRootFiles(_ps.
getUntrackedParameter<std::vector<std::string> >(
"inputRootFiles"));
40 if(inputRootFiles.size() == 0)
41 throw cms::Exception(
"Configuration") <<
"No input ROOT file given";
47 for(
unsigned iF(0); iF < inputRootFiles.size(); ++iF){
52 TPRegexp pat(
"DQM_V[0-9]+(?:|_[0-9a-zA-Z]+)_R([0-9]+)");
53 std::auto_ptr<TObjArray> matches(pat.MatchS(fileName.c_str()));
54 if(matches->GetEntries() == 0)
55 throw cms::Exception(
"Configuration") <<
"Input file " << fileName <<
" is not an DQM output";
58 runNumber_ = TString(matches->At(1)->GetName()).Atoi();
59 else if(TString(matches->At(1)->GetName()).Atoi() !=
runNumber_)
60 throw cms::Exception(
"Configuration") <<
"Input files disagree in run number";
71 std::auto_ptr<EcalCondDBInterface>
db(0);
76 db = std::auto_ptr<EcalCondDBInterface>(
new EcalCondDBInterface(DBName, userName, password));
78 catch(std::runtime_error& re){
81 db = std::auto_ptr<EcalCondDBInterface>(
new EcalCondDBInterface(hostName, DBName, userName, password, hostPort));
83 catch(std::runtime_error& re2){
112 for(
unsigned iC(0); iC <
nTasks; ++iC)
113 if(workers_[iC]) workers_[iC]->setVerbosity(
verbosity_);
121 catch(std::runtime_error&
e){
125 for(
unsigned iC(0); iC <
nTasks; ++iC)
139 unsigned processedEvents(0);
142 std::vector<std::string> dirs(_igetter.
getSubdirs());
143 for(
unsigned iD(0); iD < dirs.size(); ++iD){
144 if(!_igetter.
dirExists(dirs[iD] +
"/EventInfo"))
continue;
146 MonitorElement* timeStampME(_igetter.
get(dirs[iD] +
"/EventInfo/runStartTimeStamp"));
148 double timeStampValue(timeStampME->getFloatValue());
150 uint64_t microseconds((timeStampValue - seconds) * 1.e6);
151 timeStampInFile = (seconds << 32) | microseconds;
158 if(timeStampInFile != 0 && processedEvents != 0){
159 if(
verbosity_ > 1)
edm::LogInfo(
"EcalDQM") <<
" Event info found; timestamp=" << timeStampInFile <<
" processedEvents=" << processedEvents;
171 for(
unsigned iC(0); iC <
nTasks; ++iC){
191 catch(std::runtime_error&
e){
194 if(timeStampInFile == 0)
195 throw cms::Exception(
"Initialization") <<
"Time stamp for the run could not be found";
213 catch(std::runtime_error& e){
233 catch(std::runtime_error& e){
246 catch(std::runtime_error& e){
258 for(
unsigned iC(0); iC <
nTasks; ++iC){
259 if(!
getBit(taskList, iC))
continue;
static const char runNumber_[]
void setRunTypeDef(const RunTypeDef &runTypeDef)
T getUntrackedParameter(std::string const &, T const &) const
void setRunStart(const Tm &start)
bool run(EcalCondDBInterface *, MonRunIOV &) override
void insertRunIOV(RunIOV *iov)
EcalCondDBWriter(edm::ParameterSet const &)
MonitorElement * get(const std::string &path)
#define DEFINE_FWK_MODULE(type)
std::string monRunGeneralTag_
void setRunIOV(const RunIOV &iov)
void setProcessedEvents(unsigned _n)
RunIOV fetchRunIOV(RunTag *tag, run_t run)
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
std::string runGeneralTag_
void setGeneralTag(std::string tag)
void setRunTag(const RunTag &tag)
void setRunNumber(run_t run)
EcalCondDBInterface * db_
void setTaskList(int _list)
void setSubRunEnd(const Tm &end)
void setSubRunNumber(subrun_t subrun)
void setMonVersionDef(const MonVersionDef &ver)
void setSubRunStart(const Tm &start)
void setLocationDef(const LocationDef &locDef)
void setBit(int &_bitArray, unsigned _iBit)
bool dirExists(const std::string &path)
unsigned long long uint64_t
void setRunType(std::string runtype)
int64_t getIntValue(void) const
void setMonRunTag(const MonRunTag &tag)
MonRunIOV fetchMonRunIOV(RunTag *runtag, MonRunTag *montag, run_t run, subrun_t monrun)
void retrieveSource(DQMStore::IGetter &)
void setMonitoringVersion(std::string ver)
std::vector< std::string > getSubdirs(void)
std::string const & getName() const
void insertMonRunIOV(MonRunIOV *iov)
ecaldqm::DBWriterWorker * workers_[nTasks]
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
bool open(const std::string &filename, bool overwrite=false, const std::string &path="", const std::string &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
void setLocation(std::string loc)
ecaldqm::SummaryWriter summaryWriter_
volatile std::atomic< bool > shutdown_flag false
void setGeneralTag(std::string tag)
bool getBit(int &_bitArray, unsigned _iBit)
void setOutcome(int _outcome)