1 #include "../interface/EcalCondDBWriter.h"
10 #include "TObjArray.h"
15 setBit(
int& _bitArray,
unsigned _iBit)
17 _bitArray |= (0x1 << _iBit);
21 getBit(
int& _bitArray,
unsigned _iBit)
23 return (_bitArray & (0x1 << _iBit)) != 0;
28 location_(_ps.getUntrackedParameter<std::
string>(
"location")),
29 runType_(_ps.getUntrackedParameter<std::
string>(
"runType")),
30 runGeneralTag_(_ps.getUntrackedParameter<std::
string>(
"runGeneralTag")),
31 monRunGeneralTag_(_ps.getUntrackedParameter<std::
string>(
"monRunGeneralTag")),
32 inputRootFiles_(_ps.getUntrackedParameter<std::vector<std::
string> >(
"inputRootFiles")),
33 summaryWriter_(_ps.getUntrackedParameterSet(
"workerParams")),
34 verbosity_(_ps.getUntrackedParameter<int>(
"verbosity")),
38 throw cms::Exception(
"Configuration") <<
"No input ROOT file given";
46 std::auto_ptr<EcalCondDBInterface>
db(0);
51 db = std::auto_ptr<EcalCondDBInterface>(
new EcalCondDBInterface(DBName, userName, password));
53 catch(std::runtime_error& re){
56 db = std::auto_ptr<EcalCondDBInterface>(
new EcalCondDBInterface(hostName, DBName, userName, password, hostPort));
58 catch(std::runtime_error& re2){
87 for(
unsigned iC(0); iC <
nTasks; ++iC)
88 if(workers_[iC]) workers_[iC]->setVerbosity(
verbosity_);
96 catch(std::runtime_error&
e){
100 for(
unsigned iC(0); iC <
nTasks; ++iC)
122 TPRegexp pat(
"DQM_V[0-9]+(?:|_[0-9a-zA-Z]+)_R([0-9]+)");
123 std::auto_ptr<TObjArray> matches(pat.MatchS(fileName.c_str()));
124 if(matches->GetEntries() == 0)
125 throw cms::Exception(
"Configuration") <<
"Input file " << fileName <<
" is not an DQM output";
128 runNumber = TString(matches->At(1)->GetName()).Atoi();
129 else if(TString(matches->At(1)->GetName()).Atoi() !=
runNumber)
130 throw cms::Exception(
"Configuration") <<
"Input files disagree in run number";
138 unsigned processedEvents(0);
141 std::vector<std::string> dirs(dqmStore.
getSubdirs());
142 for(
unsigned iD(0); iD < dirs.size(); ++iD){
143 if(!dqmStore.
dirExists(dirs[iD] +
"/EventInfo"))
continue;
145 MonitorElement* timeStampME(dqmStore.
get(dirs[iD] +
"/EventInfo/runStartTimeStamp"));
147 double timeStampValue(timeStampME->getFloatValue());
149 uint64_t microseconds((timeStampValue - seconds) * 1.e6);
150 timeStampInFile = (seconds << 32) | microseconds;
157 if(timeStampInFile != 0 && processedEvents != 0){
158 if(
verbosity_ > 1)
edm::LogInfo(
"EcalDQM") <<
" Event info found; timestamp=" << timeStampInFile <<
" processedEvents=" << processedEvents;
170 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";
212 catch(std::runtime_error& e){
232 catch(std::runtime_error& e){
245 catch(std::runtime_error& e){
257 for(
unsigned iC(0); iC <
nTasks; ++iC){
258 if(!
getBit(taskList, iC))
continue;
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)
std::vector< std::string > getSubdirs(void) const
EcalCondDBWriter(edm::ParameterSet const &)
void cd(void)
go to top directory (ie. root)
#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)
virtual void retrieveSource(DQMStore const &)
void setRunNumber(run_t run)
EcalCondDBInterface * db_
void setTaskList(int _list)
void setSubRunEnd(const Tm &end)
void setSubRunNumber(subrun_t subrun)
void analyze(edm::Event const &, edm::EventSetup const &)
void setMonVersionDef(const MonVersionDef &ver)
void setSubRunStart(const Tm &start)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
void setLocationDef(const LocationDef &locDef)
void setBit(int &_bitArray, unsigned _iBit)
std::vector< std::string > inputRootFiles_
bool dirExists(const std::string &path) const
true if directory exists
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 setMonitoringVersion(std::string ver)
std::string const & getName() const
void insertMonRunIOV(MonRunIOV *iov)
ecaldqm::DBWriterWorker * workers_[nTasks]
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)