13 #include "TObjArray.h"
17 void setBit(
int &_bitArray,
unsigned _iBit) { _bitArray |= (0x1 << _iBit); }
19 bool getBit(
int &_bitArray,
unsigned _iBit) {
return (_bitArray & (0x1 << _iBit)) != 0; }
24 location_(_ps.getUntrackedParameter<std::
string>(
"location")),
25 runType_(_ps.getUntrackedParameter<std::
string>(
"runType")),
26 runGeneralTag_(_ps.getUntrackedParameter<std::
string>(
"runGeneralTag")),
27 monRunGeneralTag_(_ps.getUntrackedParameter<std::
string>(
"monRunGeneralTag")),
28 summaryWriter_(_ps.getUntrackedParameterSet(
"workerParams")),
29 verbosity_(_ps.getUntrackedParameter<int>(
"verbosity")),
31 std::vector<std::string> inputRootFiles(_ps.
getUntrackedParameter<std::vector<std::string>>(
"inputRootFiles"));
33 if (inputRootFiles.empty())
34 throw cms::Exception(
"Configuration") <<
"No input ROOT file given";
37 edm::LogInfo(
"EcalDQM") <<
"Initializing DQMStore from input ROOT files";
41 for (
unsigned iF(0); iF < inputRootFiles.size(); ++iF) {
47 TPRegexp pat(
"DQM_V[0-9]+(?:|_[0-9a-zA-Z]+)_R([0-9]+)");
48 std::unique_ptr<TObjArray> matches(pat.MatchS(fileName.c_str()));
49 if (matches->GetEntries() == 0)
50 throw cms::Exception(
"Configuration") <<
"Input file " << fileName <<
" is not an DQM output";
53 runNumber_ = TString(matches->At(1)->GetName()).Atoi();
54 else if (TString(matches->At(1)->GetName()).Atoi() !=
runNumber_)
55 throw cms::Exception(
"Configuration") <<
"Input files disagree in run number";
66 std::unique_ptr<EcalCondDBInterface>
db(
nullptr);
72 db = std::make_unique<EcalCondDBInterface>(DBName, userName, password);
73 }
catch (std::runtime_error &re) {
74 if (!hostName.empty()) {
76 db = std::make_unique<EcalCondDBInterface>(hostName, DBName, userName, password, hostPort);
77 }
catch (std::runtime_error &re2) {
92 workers_[
Cosmic] =
nullptr;
106 for (
unsigned iC(0); iC <
nTasks; ++iC)
114 }
catch (std::runtime_error &
e) {
118 for (
unsigned iC(0); iC <
nTasks; ++iC)
123 for (
unsigned iC(0); iC <
nTasks; ++iC)
138 unsigned processedEvents(0);
142 for (
unsigned iD(0); iD <
dirs.size(); ++iD) {
148 double timeStampValue(timeStampME->getFloatValue());
150 uint64_t microseconds((timeStampValue - seconds) * 1.e6);
151 timeStampInFile = (seconds << 32) | microseconds;
158 if (timeStampInFile != 0 && processedEvents != 0) {
160 edm::LogInfo(
"EcalDQM") <<
" Event info found; timestamp=" << timeStampInFile
161 <<
" processedEvents=" << processedEvents;
175 for (
unsigned iC(0); iC <
nTasks; ++iC) {
197 }
catch (std::runtime_error &
e) {
200 if (timeStampInFile == 0)
201 throw cms::Exception(
"Initialization") <<
"Time stamp for the run could not be found";
218 }
catch (std::runtime_error &e) {
240 }
catch (std::runtime_error &e) {
252 }
catch (std::runtime_error &e) {
266 for (
unsigned iC(0); iC <
nTasks; ++iC) {
267 if (!
getBit(taskList, iC))
281 edm::LogInfo(
"EcalDQM") <<
"Registering the outcome of DB writing";
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
MonRunIOV fetchMonRunIOV(RunTag *runtag, MonRunTag *montag, run_t run, subrun_t monrun) noexcept(false)
void insertMonRunIOV(MonRunIOV *iov) noexcept(false)
EcalCondDBWriter(edm::ParameterSet const &)
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
#define DEFINE_FWK_MODULE(type)
std::string monRunGeneralTag_
void setRunIOV(const RunIOV &iov)
void setProcessedEvents(unsigned _n)
virtual int64_t getIntValue() const
~EcalCondDBWriter() override
virtual bool dirExists(std::string const &path) const
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)
RunIOV fetchRunIOV(RunTag *tag, run_t run) noexcept(false)
EcalCondDBInterface * db_
virtual MonitorElement * get(std::string const &fullpath) const
void setTaskList(int _list)
void setSubRunEnd(const Tm &end)
void setSubRunNumber(subrun_t subrun)
void insertRunIOV(RunIOV *iov) noexcept(false)
void setMonVersionDef(const MonVersionDef &ver)
void setSubRunStart(const Tm &start)
void setLocationDef(const LocationDef &locDef)
void setBit(int &_bitArray, unsigned _iBit)
Log< level::Info, false > LogInfo
void beginRun(edm::Run const &, edm::EventSetup const &) override
unsigned long long uint64_t
void setRunType(std::string runtype)
void setMonRunTag(const MonRunTag &tag)
void retrieveSource(DQMStore::IGetter &)
void setMonitoringVersion(std::string ver)
std::string const & getName() const
ecaldqm::DBWriterWorker * workers_[nTasks]
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
void setLocation(std::string loc)
ecaldqm::SummaryWriter summaryWriter_
void setSetupObjects(edm::EventSetup const &)
void setGeneralTag(std::string tag)
bool getBit(int &_bitArray, unsigned _iBit)
void setOutcome(int _outcome)
DQM_DEPRECATED bool open(std::string const &filename, bool overwrite=false, std::string const &path="", std::string const &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)