67 THashList* l1 = (
const_cast<TAxis*
>(a1))->GetLabels();
68 THashList* l2 = (
const_cast<TAxis*
>(
a2))->GetLabels();
77 if (l1->GetSize() != l2->GetSize()) {
81 for (
int i = 1;
i <= a1->GetNbins(); ++
i) {
82 std::string_view
label1 = a1->GetBinLabel(
i);
83 std::string_view
label2 =
a2->GetBinLabel(
i);
94 if (
original->CanExtendAllAxes() &&
toAdd->CanExtendAllAxes()) {
104 original->GetXaxis()->GetXmin() ==
toAdd->GetXaxis()->GetXmin() &&
105 original->GetXaxis()->GetXmax() ==
toAdd->GetXaxis()->GetXmax() &&
107 original->GetYaxis()->GetXmin() ==
toAdd->GetYaxis()->GetXmin() &&
108 original->GetYaxis()->GetXmax() ==
toAdd->GetYaxis()->GetXmax() &&
110 original->GetZaxis()->GetXmin() ==
toAdd->GetZaxis()->GetXmin() &&
111 original->GetZaxis()->GetXmax() ==
toAdd->GetZaxis()->GetXmax() &&
117 edm::LogError(
"MergeFailure") <<
"Found histograms with different axis limits or different labels '" 118 <<
original->GetName() <<
"' not merged.";
161 if (
m_rescope == MonitorElementData::Scope::LUMI) {
163 key.scope_ =
lumi == 0 ? MonitorElementData::Scope::RUN : MonitorElementData::Scope::LUMI;
165 }
else if (
m_rescope == MonitorElementData::Scope::RUN) {
167 key.scope_ = MonitorElementData::Scope::RUN;
169 }
else if (
m_rescope == MonitorElementData::Scope::JOB) {
171 key.scope_ = MonitorElementData::Scope::JOB;
174 assert(!
"Invalid Scope in rescope option.");
179 virtual void setTree(TTree* iTree) = 0;
335 std::shared_ptr<edm::FileBlock> readFile_()
override;
336 std::shared_ptr<edm::RunAuxiliary> readRunAuxiliary_()
override;
337 std::shared_ptr<edm::LuminosityBlockAuxiliary> readLuminosityBlockAuxiliary_()
override;
347 bool isRunOrLumiTransition()
const;
348 void readNextItemType();
409 desc.addUntracked<std::vector<std::string>>(
"fileNames")->setComment(
"Names of files to be processed.");
410 desc.addUntracked<
unsigned int>(
"filterOnRun", 0)->setComment(
"Just limit the process to the selected run.");
413 "Accumulate histograms more coarsely." 414 " Options: \"\": keep unchanged, \"RUN\": turn LUMI histograms into RUN histograms, \"JOB\": turn everything " 415 "into JOB histograms.");
416 desc.addUntracked<
bool>(
"skipBadFiles",
false)->setComment(
"Skip the file if it is not valid");
418 ->setComment(
"An alternate file catalog to use instead of the standard site one.");
419 std::vector<edm::LuminosityBlockRange> defaultLumis;
420 desc.addUntracked<std::vector<edm::LuminosityBlockRange>>(
"lumisToProcess", defaultLumis)
421 ->setComment(
"Skip any lumi inside the specified run:lumi range.");
432 m_skipBadFiles(iPSet.getUntrackedParameter<
bool>(
"skipBadFiles",
false)),
433 m_filterOnRun(iPSet.getUntrackedParameter<unsigned
int>(
"filterOnRun", 0)),
435 iPSet.getUntrackedParameter<
std::
string>(
"overrideCatalog")),
439 {
"", MonitorElementData::Scope::LUMI},
440 {
"LUMI", MonitorElementData::Scope::LUMI},
441 {
"RUN", MonitorElementData::Scope::RUN},
442 {
"JOB", MonitorElementData::Scope::JOB}}[iPSet.getUntrackedParameter<
std::string>(
"reScope",
"JOB")]),
444 m_treeReaders(
kNIndicies, std::shared_ptr<TreeReaderBase>()),
446 m_openFiles(std::vector<OpenFileInfo>()),
447 m_fileMetadatas(std::vector<FileMetadata>()) {
450 if (m_catalog.fileNames(0).empty()) {
470 produces<DQMToken, edm::Transition::BeginRun>(
"DQMGenerationRecoRun");
471 produces<DQMToken, edm::Transition::BeginLuminosityBlock>(
"DQMGenerationRecoLumi");
476 if (
file.m_file &&
file.m_file->IsOpen()) {
494 TFile*
file =
nullptr;
497 std::list<std::string> exInfo;
499 bool isGoodFile(
true);
501 const std::vector<std::string>& fNames = fileitem.fileNames();
502 for (std::vector<std::string>::const_iterator it = fNames.begin(); it != fNames.end(); ++it) {
505 file = TFile::Open(it->c_str());
509 if (
e != std::exception_ptr()) {
511 std::rethrow_exception(
e);
520 ex <<
"\nInput file " << *it <<
" was not found, could not be opened, or is corrupted.\n";
522 for (
auto const&
s : exInfo)
529 for (
auto const&
s :
e.additionalInfo())
537 lfn = fileitem.logicalFileName();
543 ex <<
"Input file " << *it <<
" could not be opened.\n";
546 for (
auto const&
s : exInfo)
564 guid = std::make_unique<std::string>(
file->GetUUID().AsString());
574 if (strcmp(
file->GetTitle(),
"1") != 0) {
576 ex <<
"Input file " << fNames[0] <<
" does not appear to be a DQM Root file.\n";
581 assert(indicesTree !=
nullptr);
593 for (Long64_t
index = 0;
index != indicesTree->GetEntries(); ++
index) {
594 indicesTree->GetEntry(
index);
608 unsigned int run = 0;
609 auto toadd = std::vector<FileMetadata>();
617 toadd.push_back(
dummy);
622 if (!toadd.empty()) {
638 return std::make_shared<edm::FileBlock>();
645 return std::make_shared<edm::RunAuxiliary>(runAux);
653 return std::make_shared<edm::LuminosityBlockAuxiliary>(lumiAux);
702 ULong64_t endIndex =
metadata.m_lastIndex + 1;
748 std::unique_ptr<DQMToken> product = std::make_unique<DQMToken>();
753 std::unique_ptr<DQMToken> product = std::make_unique<DQMToken>();
767 if (
run >= lumiToProcess.startRun() &&
run <= lumiToProcess.endRun()) {
768 if (
lumi >= lumiToProcess.startLumi() &&
lumi <= lumiToProcess.endLumi()) {
770 }
else if (
lumi == 0) {
edm::InputSource::ItemType m_nextItemType
LuminosityBlockID id() const
LuminosityBlockNumber_t luminosityBlock() const
std::unique_ptr< TFile > m_file
std::shared_ptr< edm::RunAuxiliary > readRunAuxiliary_() override
static void logFileAction(char const *msg, std::string const &fileName)
MonitorElementData::Scope m_rescope
void reportInputRunNumber(unsigned int run)
void fillLuminosityBlockPrincipal(ProcessHistory const *processHistory, DelayedReader *reader=nullptr)
static void mergeTogether(TH1 *original, TH1 *toAdd)
ProcessHistoryID const & processHistoryID() const
virtual ~TreeReaderBase()
edm::propagate_const< std::unique_ptr< TH1 > > object_
void setTree(TTree *iTree) override
OpenFileInfo(TFile *file, edm::JobReport::Token jrToken)
void read(ULong64_t iIndex, DQMStore *dqmstore, int run, int lumi) override
std::vector< OpenFileInfo > m_openFiles
static bool CheckBinLabels(const TAxis *a1, const TAxis *a2)
MonitorElementData::Key makeKey(std::string const &fullname, int run, int lumi)
unsigned int m_filterOnRun
void beginLuminosityBlock(edm::LuminosityBlock &lumi) override
Log< level::Error, false > LogError
unsigned int LuminosityBlockNumber_t
unsigned int m_currentIndex
Token inputFileOpened(std::string const &physicalFileName, std::string const &logicalFileName, std::string const &catalog, std::string const &inputType, std::string const &inputSourceClassName, std::string const &moduleLabel, std::string const &guid, std::vector< std::string > const &branchNames)
~DQMRootSource() override
MonitorElement * findOrRecycle(MonitorElementData::Key const &)
virtual void read(ULong64_t iIndex, DQMStore *dqmstore, int run, int lumi)=0
edm::InputSource::ItemType getNextItemType() override
void addDefault(ParameterSetDescription const &psetDescription)
void setTree(TTree *iTree) override
void beginRun(edm::Run &run) override
void reportInputLumiSection(unsigned int run, unsigned int lumiSectId)
std::shared_ptr< edm::LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override
edm::InputFileCatalog m_catalog
void addAdditionalInfo(std::string const &info)
bool isRunOrLumiTransition() const
dqm::harvesting::MonitorElement MonitorElement
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void read(ULong64_t iIndex, DQMStore *dqmstore, int run, int lumi) override
std::vector< std::shared_ptr< TreeReaderBase > > m_treeReaders
TreeStringReader(MonitorElementData::Kind kind, MonitorElementData::Scope rescope)
std::vector< edm::LuminosityBlockRange > m_lumisToProcess
void readRun_(edm::RunPrincipal &rpCache) override
void addContext(std::string const &context)
TreeObjectReader(MonitorElementData::Kind kind, MonitorElementData::Scope rescope)
virtual void setTree(TTree *iTree)=0
void setException(std::exception_ptr e)
void setTree(TTree *iTree) override
MonitorElement * putME(MonitorElement *me)
void read(ULong64_t iIndex, DQMStore *dqmstore, int run, int lumi) override
void logFileAction(char const *msg, char const *fileName) const
TreeReaderBase(MonitorElementData::Kind kind, MonitorElementData::Scope rescope)
std::vector< EventRange > & sortAndRemoveOverlaps(std::vector< EventRange > &eventRange)
std::exception_ptr getException()
MonitorElementData::Kind m_kind
Log< level::System, true > LogAbsolute
bool keepIt(edm::RunNumber_t, edm::LuminosityBlockNumber_t) const
dqm::harvesting::DQMStore DQMStore
LuminosityBlockAuxiliary const & aux() const
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=nullptr)
DQMRootSource(edm::ParameterSet const &, const edm::InputSourceDescription &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void readEvent_(edm::EventPrincipal &) override
void readLuminosityBlock_(edm::LuminosityBlockPrincipal &lbCache) override
void inputFileClosed(InputType inputType, Token fileToken)
edm::JobReport::Token m_jrToken
MonitorElementData::Scope m_rescope
std::vector< FileMetadata > m_fileMetadatas
std::shared_ptr< edm::FileBlock > readFile_() override
TreeSimpleReader(MonitorElementData::Kind kind, MonitorElementData::Scope rescope)