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);
84 if (label1 != label2) {
94 if (original->CanExtendAllAxes() && toAdd->CanExtendAllAxes()) {
97 if (original->Merge(&list) == -1) {
98 edm::LogError(
"MergeFailure") <<
"Failed to merge DQM element " << original->GetName();
103 if (original->GetNbinsX() == toAdd->GetNbinsX() &&
104 original->GetXaxis()->GetXmin() == toAdd->GetXaxis()->GetXmin() &&
105 original->GetXaxis()->GetXmax() == toAdd->GetXaxis()->GetXmax() &&
106 original->GetNbinsY() == toAdd->GetNbinsY() &&
107 original->GetYaxis()->GetXmin() == toAdd->GetYaxis()->GetXmin() &&
108 original->GetYaxis()->GetXmax() == toAdd->GetYaxis()->GetXmax() &&
109 original->GetNbinsZ() == toAdd->GetNbinsZ() &&
110 original->GetZaxis()->GetXmin() == toAdd->GetZaxis()->GetXmin() &&
111 original->GetZaxis()->GetXmax() == toAdd->GetZaxis()->GetXmax() &&
115 original->Add(toAdd);
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)),
428 m_catalog(iPSet.getUntrackedParameter<std::
vector<std::
string>>(
"fileNames"),
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")]),
444 if (m_catalog.fileNames(0).empty()) {
462 produces<DQMToken, edm::Transition::BeginRun>(
"DQMGenerationRecoRun");
463 produces<DQMToken, edm::Transition::BeginLuminosityBlock>(
"DQMGenerationRecoLumi");
468 if (
file.m_file &&
file.m_file->IsOpen()) {
489 std::list<std::string> exInfo;
491 bool isGoodFile(
true);
493 const std::vector<std::string>& fNames = fileitem.fileNames();
494 for (std::vector<std::string>::const_iterator it = fNames.begin(); it != fNames.end(); ++it) {
497 file = TFile::Open(it->c_str());
501 if (e != std::exception_ptr()) {
503 std::rethrow_exception(e);
512 ex <<
"\nInput file " << *it <<
" was not found, could not be opened, or is corrupted.\n";
514 for (
auto const&
s : exInfo)
526 if (file && !file->IsZombie()) {
529 lfn = fileitem.logicalFileName();
535 ex <<
"Input file " << *it <<
" could not be opened.\n";
538 for (
auto const&
s : exInfo)
556 guid = std::make_unique<std::string>(file->GetUUID().AsString());
557 std::transform(guid->begin(), guid->end(), guid->begin(), (int (*)(int))std::toupper);
566 if (strcmp(file->GetTitle(),
"1") != 0) {
568 ex <<
"Input file " << fNames[0] <<
" does not appear to be a DQM Root file.\n";
572 TTree* indicesTree =
dynamic_cast<TTree*
>(file->Get(
kIndicesTree));
573 assert(indicesTree !=
nullptr);
585 for (Long64_t
index = 0;
index != indicesTree->GetEntries(); ++
index) {
586 indicesTree->GetEntry(
index);
600 unsigned int run = 0;
601 auto toadd = std::vector<FileMetadata>();
603 if (run < metadata.m_run && metadata.m_lumi != 0) {
606 dummy.
m_run = metadata.m_run;
609 toadd.push_back(dummy);
611 run = metadata.m_run;
614 if (!toadd.empty()) {
616 m_fileMetadatas.insert(m_fileMetadatas.end(), toadd.begin(), toadd.end());
617 std::stable_sort(m_fileMetadatas.begin(), m_fileMetadatas.end());
624 if (m_fileMetadatas.empty())
630 return std::make_shared<edm::FileBlock>();
637 return std::make_shared<edm::RunAuxiliary>(runAux);
645 return std::make_shared<edm::LuminosityBlockAuxiliary>(lumiAux);
652 if (metadata.
m_lumi == 0) {
691 reader->setTree(tree);
696 for (; index != endIndex; ++
index) {
731 if (previousMetadata.
m_run != metadata.
m_run) {
733 }
else if (previousMetadata.
m_lumi != metadata.
m_lumi) {
740 std::unique_ptr<DQMToken> product = std::make_unique<DQMToken>();
745 std::unique_ptr<DQMToken> product = std::make_unique<DQMToken>();
759 if (run >= lumiToProcess.startRun() && run <= lumiToProcess.endRun()) {
760 if (lumi >= lumiToProcess.startLumi() && lumi <= lumiToProcess.endLumi()) {
762 }
else if (lumi == 0) {
m_openFiles(std::vector< OpenFileInfo >())
edm::InputSource::ItemType m_nextItemType
std::unique_ptr< TFile > m_file
std::shared_ptr< edm::RunAuxiliary > readRunAuxiliary_() override
MonitorElementData::Scope m_rescope
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
m_fileMetadatas(std::vector< FileMetadata >())
void logFileAction(char const *msg, char const *fileName) const
void reportInputRunNumber(unsigned int run)
m_nextItemType(edm::InputSource::IsFile)
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)
LuminosityBlockAuxiliary const & aux() const
unsigned int m_filterOnRun
void beginLuminosityBlock(edm::LuminosityBlock &lumi) override
Log< level::Error, false > LogError
bool keepIt(edm::RunNumber_t, edm::LuminosityBlockNumber_t) const
unsigned int LuminosityBlockNumber_t
unsigned int m_currentIndex
std::list< std::string > const & additionalInfo() const
const DQMRootSource & operator=(const DQMRootSource &)=delete
m_treeReaders(kNIndicies, std::shared_ptr< TreeReaderBase >())
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 set(std::string path, Path::Type type)
void setTree(TTree *iTree) override
void beginRun(edm::Run &run) override
void put(std::unique_ptr< PROD > product)
Put a new product.
void reportInputLumiSection(unsigned int run, unsigned int lumiSectId)
edm::LuminosityBlockID id_
std::shared_ptr< edm::LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override
edm::InputFileCatalog m_catalog
tuple key
prepare the HTCondor submission files and eventually submit them
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
LuminosityBlockNumber_t luminosityBlock() const
void put(std::unique_ptr< PROD > product)
Put a new product.
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
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
dqm::harvesting::DQMStore DQMStore
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
LuminosityBlockID id() const
TreeSimpleReader(MonitorElementData::Kind kind, MonitorElementData::Scope rescope)