11 #include "TObjArray.h" 15 void setBit(
int &_bitArray,
unsigned _iBit) { _bitArray |= (0x1 << _iBit); }
17 bool getBit(
int &_bitArray,
unsigned _iBit) {
return (_bitArray & (0
x1 << _iBit)) != 0; }
22 location_(_ps.getUntrackedParameter<
std::
string>(
"location")),
23 runType_(_ps.getUntrackedParameter<
std::
string>(
"runType")),
24 runGeneralTag_(_ps.getUntrackedParameter<
std::
string>(
"runGeneralTag")),
25 monRunGeneralTag_(_ps.getUntrackedParameter<
std::
string>(
"monRunGeneralTag")),
26 summaryWriter_(_ps.getUntrackedParameterSet(
"workerParams")),
27 verbosity_(_ps.getUntrackedParameter<
int>(
"verbosity")),
29 std::vector<std::string> inputRootFiles(_ps.
getUntrackedParameter<std::vector<std::string>>(
"inputRootFiles"));
31 if (inputRootFiles.empty())
32 throw cms::Exception(
"Configuration") <<
"No input ROOT file given";
35 edm::LogInfo(
"EcalDQM") <<
"Initializing DQMStore from input ROOT files";
39 for (
unsigned iF(0); iF < inputRootFiles.size(); ++iF) {
45 TPRegexp
pat(
"DQM_V[0-9]+(?:|_[0-9a-zA-Z]+)_R([0-9]+)");
46 std::unique_ptr<TObjArray>
matches(pat.MatchS(fileName.c_str()));
47 if (matches->GetEntries() == 0)
48 throw cms::Exception(
"Configuration") <<
"Input file " << fileName <<
" is not an DQM output";
51 runNumber_ = TString(matches->At(1)->GetName()).Atoi();
52 else if (TString(matches->At(1)->GetName()).Atoi() !=
runNumber_)
53 throw cms::Exception(
"Configuration") <<
"Input files disagree in run number";
64 std::unique_ptr<EcalCondDBInterface> db(
nullptr);
70 db = std::unique_ptr<EcalCondDBInterface>(
new EcalCondDBInterface(DBName, userName, password));
71 }
catch (std::runtime_error &re) {
72 if (!hostName.empty()) {
74 db = std::unique_ptr<EcalCondDBInterface>(
76 }
catch (std::runtime_error &re2) {
91 workers_[
Cosmic] =
nullptr;
105 for (
unsigned iC(0); iC <
nTasks; ++iC)
113 }
catch (std::runtime_error &
e) {
117 for (
unsigned iC(0); iC <
nTasks; ++iC)
131 unsigned processedEvents(0);
135 for (
unsigned iD(0); iD <
dirs.size(); ++iD) {
141 double timeStampValue(timeStampME->getFloatValue());
143 uint64_t microseconds((timeStampValue - seconds) * 1.e6);
144 timeStampInFile = (seconds << 32) | microseconds;
151 if (timeStampInFile != 0 && processedEvents != 0) {
153 edm::LogInfo(
"EcalDQM") <<
" Event info found; timestamp=" << timeStampInFile
154 <<
" processedEvents=" << processedEvents;
168 for (
unsigned iC(0); iC <
nTasks; ++iC) {
190 }
catch (std::runtime_error &
e) {
193 if (timeStampInFile == 0)
194 throw cms::Exception(
"Initialization") <<
"Time stamp for the run could not be found";
211 }
catch (std::runtime_error &e) {
233 }
catch (std::runtime_error &e) {
245 }
catch (std::runtime_error &e) {
259 for (
unsigned iC(0); iC <
nTasks; ++iC) {
260 if (!
getBit(taskList, iC))
274 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)
int64_t getIntValue() const
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 &)
std::string monRunGeneralTag_
void setRunIOV(const RunIOV &iov)
void setProcessedEvents(unsigned _n)
~EcalCondDBWriter() override
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)
#define DEFINE_FWK_MODULE(type)
RunIOV fetchRunIOV(RunTag *tag, run_t run) noexcept(false)
EcalCondDBInterface * db_
void setTaskList(int _list)
void setSubRunEnd(const Tm &end)
void setSubRunNumber(subrun_t subrun)
void insertRunIOV(RunIOV *iov) noexcept(false)
bool open(std::string const &filename, bool overwrite=false, std::string const &path="", std::string const &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
void setMonVersionDef(const MonVersionDef &ver)
void setSubRunStart(const Tm &start)
void setLocationDef(const LocationDef &locDef)
void setBit(int &_bitArray, unsigned _iBit)
MonitorElement * get(std::string const &path)
unsigned long long uint64_t
void setRunType(std::string runtype)
bool dirExists(std::string const &path)
void setMonRunTag(const MonRunTag &tag)
void retrieveSource(DQMStore::IGetter &)
void setMonitoringVersion(std::string ver)
std::string const & getName() const
ecaldqm::DBWriterWorker * workers_[nTasks]
std::vector< std::string > getSubdirs()
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
void setLocation(std::string loc)
ecaldqm::SummaryWriter summaryWriter_
void setGeneralTag(std::string tag)
bool getBit(int &_bitArray, unsigned _iBit)
void setOutcome(int _outcome)