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;
329 std::shared_ptr<edm::FileBlock>
readFile_()
override;
403 desc.addUntracked<std::vector<std::string>>(
"fileNames")->setComment(
"Names of files to be processed.");
404 desc.addUntracked<
unsigned int>(
"filterOnRun", 0)->setComment(
"Just limit the process to the selected run.");
407 "Accumulate histograms more coarsely." 408 " Options: \"\": keep unchanged, \"RUN\": turn LUMI histograms into RUN histograms, \"JOB\": turn everything " 409 "into JOB histograms.");
410 desc.addUntracked<
bool>(
"skipBadFiles",
false)->setComment(
"Skip the file if it is not valid");
412 ->setComment(
"An alternate file catalog to use instead of the standard site one.");
413 std::vector<edm::LuminosityBlockRange> defaultLumis;
414 desc.addUntracked<std::vector<edm::LuminosityBlockRange>>(
"lumisToProcess", defaultLumis)
415 ->setComment(
"Skip any lumi inside the specified run:lumi range.");
426 m_skipBadFiles(iPSet.getUntrackedParameter<
bool>(
"skipBadFiles",
false)),
427 m_filterOnRun(iPSet.getUntrackedParameter<unsigned
int>(
"filterOnRun", 0)),
429 iPSet.getUntrackedParameter<
std::
string>(
"overrideCatalog")),
433 {
"", MonitorElementData::Scope::LUMI},
434 {
"LUMI", MonitorElementData::Scope::LUMI},
435 {
"RUN", MonitorElementData::Scope::RUN},
436 {
"JOB", MonitorElementData::Scope::JOB}}[iPSet.getUntrackedParameter<
std::string>(
"reScope",
"JOB")]),
438 m_treeReaders(
kNIndicies, std::shared_ptr<TreeReaderBase>()),
440 m_openFiles(std::vector<OpenFileInfo>()),
441 m_fileMetadatas(std::vector<FileMetadata>()) {
444 if (m_catalog.fileNames(0).empty()) {
464 produces<DQMToken, edm::Transition::BeginRun>(
"DQMGenerationRecoRun");
465 produces<DQMToken, edm::Transition::BeginLuminosityBlock>(
"DQMGenerationRecoLumi");
470 if (
file.m_file &&
file.m_file->IsOpen()) {
491 std::list<std::string> exInfo;
493 bool isGoodFile(
true);
495 const std::vector<std::string>& fNames = fileitem.fileNames();
496 for (std::vector<std::string>::const_iterator it = fNames.begin(); it != fNames.end(); ++it) {
499 file = TFile::Open(it->c_str());
503 if (
e != std::exception_ptr()) {
505 std::rethrow_exception(
e);
514 ex <<
"\nInput file " << *it <<
" was not found, could not be opened, or is corrupted.\n";
516 for (
auto const&
s : exInfo)
523 for (
auto const&
s :
e.additionalInfo())
531 lfn = fileitem.logicalFileName();
537 ex <<
"Input file " << *it <<
" could not be opened.\n";
540 for (
auto const&
s : exInfo)
558 guid = std::make_unique<std::string>(
file->GetUUID().AsString());
568 if (strcmp(
file->GetTitle(),
"1") != 0) {
570 ex <<
"Input file " << fNames[0] <<
" does not appear to be a DQM Root file.\n";
575 assert(indicesTree !=
nullptr);
587 for (Long64_t
index = 0;
index != indicesTree->GetEntries(); ++
index) {
588 indicesTree->GetEntry(
index);
602 unsigned int run = 0;
603 auto toadd = std::vector<FileMetadata>();
607 FileMetadata
dummy{};
611 toadd.push_back(
dummy);
616 if (!toadd.empty()) {
632 return std::make_shared<edm::FileBlock>();
639 return std::make_shared<edm::RunAuxiliary>(runAux);
647 return std::make_shared<edm::LuminosityBlockAuxiliary>(lumiAux);
696 ULong64_t endIndex =
metadata.m_lastIndex + 1;
720 return previousMetadata.m_run !=
metadata.m_run || previousMetadata.m_lumi !=
metadata.m_lumi;
733 if (previousMetadata.m_run !=
metadata.m_run) {
735 }
else if (previousMetadata.m_lumi !=
metadata.m_lumi) {
742 std::unique_ptr<DQMToken> product = std::make_unique<DQMToken>();
747 std::unique_ptr<DQMToken> product = std::make_unique<DQMToken>();
761 if (
run >= lumiToProcess.startRun() &&
run <= lumiToProcess.endRun()) {
762 if (
lumi >= lumiToProcess.startLumi() &&
lumi <= lumiToProcess.endLumi()) {
764 }
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
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
const DQMRootSource & operator=(const DQMRootSource &)=delete
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
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
OpenFileInfo & operator=(OpenFileInfo &&)=default
void addContext(std::string const &context)
void readRun_(edm::RunPrincipal &rpCache) override
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)