72 return iStore.
book1D(iName, iHist);
75 void mergeTogether(TH1* iOriginal,TH1* iToAdd) {
76 if(iOriginal->CanExtendAllAxes() && iToAdd->CanExtendAllAxes()) {
79 if( -1 == iOriginal->Merge(&list)) {
80 edm::LogError(
"MergeFailure")<<
"Failed to merge DQM element "<<iOriginal->GetName();
83 if (iOriginal->GetNbinsX() == iToAdd->GetNbinsX() &&
84 iOriginal->GetXaxis()->GetXmin() == iToAdd->GetXaxis()->GetXmin() &&
85 iOriginal->GetXaxis()->GetXmax() == iToAdd->GetXaxis()->GetXmax() &&
86 iOriginal->GetNbinsY() == iToAdd->GetNbinsY() &&
87 iOriginal->GetYaxis()->GetXmin() == iToAdd->GetYaxis()->GetXmin() &&
88 iOriginal->GetYaxis()->GetXmax() == iToAdd->GetYaxis()->GetXmax() &&
89 iOriginal->GetNbinsZ() == iToAdd->GetNbinsZ() &&
90 iOriginal->GetZaxis()->GetXmin() == iToAdd->GetZaxis()->GetXmin() &&
91 iOriginal->GetZaxis()->GetXmax() == iToAdd->GetZaxis()->GetXmax() &&
95 iOriginal->Add(iToAdd);
97 edm::LogError(
"MergeFailure")<<
"Found histograms with different axis limits or different labels'"<<iOriginal->GetName()<<
"' not merged.";
104 mergeTogether(iElement->
getTH1F(),iHist);
107 return iStore.
book1S(iName, iHist);
110 mergeTogether(iElement->
getTH1S(),iHist);
113 return iStore.
book1DD(iName, iHist);
116 mergeTogether(iElement->
getTH1D(),iHist);
119 return iStore.
book2D(iName, iHist);
122 mergeTogether(iElement->
getTH2F(),iHist);
125 return iStore.
book2S(iName, iHist);
128 mergeTogether(iElement->
getTH2S(),iHist);
131 return iStore.
book2DD(iName, iHist);
134 mergeTogether(iElement->
getTH2D(),iHist);
137 return iStore.
book3D(iName, iHist);
140 mergeTogether(iElement->
getTH3F(),iHist);
145 void mergeWithElement(
MonitorElement* iElement, TProfile* iHist) {
151 void mergeWithElement(
MonitorElement* iElement, TProfile2D* iHist) {
162 void mergeWithElement(
MonitorElement* iElement, Long64_t& iValue) {
164 if(name.find(
"EventInfo/processedEvents") != std::string::npos) {
166 }
else if(name.find(
"EventInfo/iEvent") != std::string::npos ||
167 name.find(
"EventInfo/iLumiSection") != std::string::npos) {
169 iElement->
Fill(iValue);
173 iElement->
Fill(iValue);
184 iElement->
Fill(iValue);
191 iElement->
Fill(*iValue);
196 size_t index = oPath.find_last_of(
'/');
197 if(index == std::string::npos) {
199 oName = iFullName.c_str();
202 oName = iFullName.c_str()+index+1;
206 struct RunLumiToRange {
207 unsigned int m_run, m_lumi,m_historyIDIndex;
208 ULong64_t m_beginTime;
210 ULong64_t m_firstIndex, m_lastIndex;
214 class TreeReaderBase {
217 virtual ~TreeReaderBase() {}
220 return doRead(iIndex,iStore,iIsLumi);
222 virtual void setTree(TTree* iTree) =0;
230 class TreeObjectReader:
public TreeReaderBase {
235 m_tree->GetEntry(iIndex);
237 if(
nullptr == element) {
240 splitName(*m_fullName, path,name);
242 element = createElement(iStore,name,m_buffer);
245 mergeWithElement(element,m_buffer);
248 iStore.
tag(element,m_tag);
252 void setTree(TTree* iTree)
override {
266 class TreeSimpleReader :
public TreeReaderBase {
268 TreeSimpleReader():m_tree(
nullptr),m_fullName(
nullptr),m_buffer(0),m_tag(0){
271 m_tree->GetEntry(iIndex);
273 if(
nullptr == element) {
276 splitName(*m_fullName, path,name);
278 element = createElement(iStore,name,m_buffer);
281 mergeWithElement(element, m_buffer);
284 iStore.
tag(element,m_tag);
288 void setTree(TTree* iTree)
override {
324 processHistoryID_(phid), run_(run) { }
326 unsigned int run()
const {
return run_; }
329 return run_ < right.
run();
341 processHistoryID_(phid), run_(run), lumi_(lumi) { }
343 unsigned int run()
const {
return run_; }
344 unsigned int lumi()
const {
return lumi_; }
347 if (run_ == right.
run()) {
348 return lumi_ < right.
lumi();
350 return run_ < right.
run();
362 std::shared_ptr<edm::RunAuxiliary> readRunAuxiliary_()
override ;
363 std::shared_ptr<edm::LuminosityBlockAuxiliary> readLuminosityBlockAuxiliary_()
override ;
368 std::unique_ptr<edm::FileBlock> readFile_()
override;
369 void closeFile_()
override;
373 void readNextItemType();
374 bool setupFile(
unsigned int iIndex);
427 desc.
addUntracked<std::vector<std::string> >(
"fileNames")
428 ->setComment(
"Names of files to be processed.");
430 ->setComment(
"Just limit the process to the selected run.");
432 ->setComment(
"Skip the file if it is not valid");
434 ->setComment(
"An alternate file catalog to use instead of the standard site one.");
435 std::vector<edm::LuminosityBlockRange> defaultLumis;
436 desc.
addUntracked<std::vector<edm::LuminosityBlockRange> >(
"lumisToProcess",defaultLumis)
437 ->setComment(
"Skip any lumi inside the specified run:lumi range.");
446 m_catalog(iPSet.getUntrackedParameter<
std::vector<
std::
string> >(
"fileNames"),
447 iPSet.getUntrackedParameter<
std::
string>(
"overrideCatalog")),
450 m_presentlyOpenFileIndex(0),
453 m_lastSeenReducedPHID(),
455 m_lastSeenReducedPHID2(),
458 m_filterOnRun(iPSet.getUntrackedParameter<unsigned
int>(
"filterOnRun", 0)),
459 m_skipBadFiles(iPSet.getUntrackedParameter<
bool>(
"skipBadFiles",
false)),
461 m_justOpenedFileSoNeedToGenerateRunTransition(
false),
462 m_shouldReadMEs(
true)
534 assert(
m_historyIDs.size() > runLumiRange.m_historyIDIndex);
537 return std::make_shared<edm::RunAuxiliary>(
m_runAux);
540 std::shared_ptr<edm::LuminosityBlockAuxiliary>
549 assert(
m_historyIDs.size() > runLumiRange.m_historyIDIndex);
553 return std::make_shared<edm::LuminosityBlockAuxiliary>(
m_lumiAux);
563 unsigned int runID =rpCache.
id().
run();
564 assert(runID == runLumiRange.m_run);
586 std::vector<MonitorElement*> allMEs = (*store).getAllContents(
"");
587 for(
auto const&
ME : allMEs) {
590 if (
ME->getLumiFlag())
continue;
591 if ( !(*store).isCollate() )
602 if(runLumiRange.m_lumi == 0) {
619 assert(runLumiRange.m_run == lbCache.
id().
run());
629 std::vector<MonitorElement*> allMEs = (*store).getAllContents(
"");
630 for(
auto const&
ME : allMEs) {
632 if (
ME->getLumiFlag()) {
651 std::unique_ptr<edm::FileBlock>
656 if(
m_file.get() ==
nullptr) {
673 m_file->GetUUID().AsString(),
674 std::vector<std::string>()
682 if(
m_file.get()==
nullptr) {
return; }
690 bool shouldContinue =
false;
693 shouldContinue =
false;
700 ULong64_t index = runLumiRange.m_firstIndex;
701 ULong64_t endIndex = runLumiRange.m_lastIndex+1;
702 for (; index != endIndex; ++
index)
704 bool isLumi = runLumiRange.m_lumi !=0;
706 reader->read(index,*store,isLumi);
718 (nextRunLumiRange.m_run == runLumiRange.m_run) &&
719 (nextRunLumiRange.m_lumi == runLumiRange.m_lumi) )
721 shouldContinue=
true;
722 runLumiRange = nextRunLumiRange;
725 }
while(shouldContinue);
746 runLumiRange.m_run=0;
749 bool shouldContinue =
false;
752 shouldContinue =
false;
769 (nextRunLumiRange.m_run == runLumiRange.m_run) &&
770 (nextRunLumiRange.m_lumi == runLumiRange.m_lumi) ) {
771 shouldContinue=
true;
775 }
while(shouldContinue);
791 if(
m_file.get() !=
nullptr && iIndex > 0) {
798 std::unique_ptr<TFile> newFile;
805 TDirectory::TContext contextEraser;
811 if(e != std::exception_ptr()) {
813 std::rethrow_exception(e);
820 ex <<
"\nInput file " <<
m_catalog.
fileNames()[iIndex] <<
" was not found, could not be opened, or is corrupted.\n";
825 if(not newFile->IsZombie()) {
837 if(0 != strcmp(newFile->GetTitle(),
"1")) {
839 ex<<
"Input file "<<
m_catalog.
fileNames()[iIndex].c_str() <<
" does not appear to be a DQM Root file.\n";
844 if(
nullptr==metaDir) {
847 ex<<
"Input file "<<
m_catalog.
fileNames()[iIndex].c_str() <<
" appears to be corrupted since it does not have the proper internal structure.\n" 848 " Check to see if the file was closed properly.\n";
856 assert(
nullptr!=parameterSetTree);
859 assert(
nullptr!=psr);
864 for(
unsigned int index = 0; index != parameterSetTree->GetEntries();++
index)
866 parameterSetTree->GetEntry(index);
873 assert(
nullptr!=processHistoryTree);
874 unsigned int phIndex = 0;
880 std::string* pParameterSetIDBlob = ¶meterSetIDBlob;
890 std::vector<edm::ProcessConfiguration>
configs;
894 for(
unsigned int i=0;
i != processHistoryTree->GetEntries(); ++
i) {
895 processHistoryTree->GetEntry(
i);
897 if(not configs.empty()) {
907 configs.push_back(pc);
909 if(not configs.empty()) {
920 assert(
nullptr!=indicesTree);
927 indicesTree->SetBranchAddress(
kRunBranch,&temp.m_run);
928 indicesTree->SetBranchAddress(
kLumiBranch,&temp.m_lumi);
932 indicesTree->SetBranchAddress(
kTypeBranch,&temp.m_type);
933 indicesTree->SetBranchAddress(
kFirstIndex,&temp.m_firstIndex);
934 indicesTree->SetBranchAddress(
kLastIndex,&temp.m_lastIndex);
945 typedef std::map<RunLumiPHIDKey, std::list<unsigned int>::iterator > RunLumiToLastEntryMap;
946 RunLumiToLastEntryMap runLumiToLastEntryMap;
950 typedef std::map<RunPHIDKey, std::pair< std::list<unsigned int>::iterator, std::list<unsigned int>::iterator> > RunToFirstLastEntryMap;
951 RunToFirstLastEntryMap runToFirstLastEntryMap;
953 for (Long64_t index = 0; index != indicesTree->GetEntries(); ++
index)
955 indicesTree->GetEntry(index);
968 RunLumiToLastEntryMap::iterator itFind = runLumiToLastEntryMap.find(runLumi);
969 if (itFind == runLumiToLastEntryMap.end())
975 RunToFirstLastEntryMap::iterator itRunFirstLastEntryFind = runToFirstLastEntryMap.find(runKey);
976 bool needNewEntryInRunFirstLastEntryMap =
true;
977 if (itRunFirstLastEntryFind != runToFirstLastEntryMap.end())
979 needNewEntryInRunFirstLastEntryMap=
false;
983 itLastOfRun = itRunFirstLastEntryFind->second.second;
990 itLastOfRun = itRunFirstLastEntryFind->second.first;
993 std::list<unsigned int>::iterator iter =
m_orderedIndices.insert(itLastOfRun,index);
994 runLumiToLastEntryMap[runLumi]=iter;
995 if (needNewEntryInRunFirstLastEntryMap)
996 runToFirstLastEntryMap[runKey]=std::make_pair(iter,iter);
1002 runToFirstLastEntryMap[runKey].second = iter;
1008 runToFirstLastEntryMap[runKey].first = iter;
1016 std::list<unsigned int>::iterator itNext = itFind->second;
1018 std::list<unsigned int>::iterator iter =
m_orderedIndices.insert(itNext,index);
1019 RunToFirstLastEntryMap::iterator itRunFirstLastEntryFind = runToFirstLastEntryMap.find(runKey);
1020 if (itRunFirstLastEntryFind->second.second == itFind->second)
1023 itRunFirstLastEntryFind->second.second = iter;
1025 itFind->second = iter;
1034 assert(
nullptr!=
m_trees[index]);
MonitorElement * book2D(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
MonitorElement * bookProfile2D(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s")
TProfile * getTProfile() const
edm::InputSource::ItemType m_nextItemType
unsigned int m_lastSeenRun2
unsigned int lumi() const
int64_t getIntValue() const
std::shared_ptr< edm::RunAuxiliary > readRunAuxiliary_() override
static void logFileAction(char const *msg, std::string const &fileName)
edm::JobReport::Token m_jrToken
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
TProfile2D * getTProfile2D() const
void closeFile_() override
void logFileAction(char const *msg, char const *fileName) const
edm::RunAuxiliary m_runAux
void reportInputRunNumber(unsigned int run)
std::vector< edm::RunNumber_t > m_runsToProcess
std::vector< boost::shared_ptr< TreeReaderBase > > m_treeReaders
edm::ProcessHistoryID const & processHistoryID() const
bool registerProcessHistory(ProcessHistory const &processHistory)
std::set< MonitorElement * > m_lumiElements
MonitorElement * book1DD(char_string const &name, char_string const &title, int nchX, double lowX, double highX)
Book 1S histogram.
size_t m_presentlyOpenFileIndex
std::list< unsigned int >::iterator m_presentIndexItr
unsigned int m_filterOnRun
bool operator<(RunPHIDKey const &right) const
std::set< MonitorElement * > m_runElements
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
MonitorElement * bookInt(char_string const &name)
Book int.
MonitorElement * book1D(char_string const &name, char_string const &title, int const nchX, double const lowX, double const highX)
Book 1D histogram.
unsigned int LuminosityBlockNumber_t
std::vector< edm::ProcessHistoryID > m_reducedHistoryIDs
MonitorElement * bookFloat(char_string const &name)
Book float.
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
void tag(MonitorElement *me, unsigned int myTag)
MonitorElement * book2DD(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
edm::InputSource::ItemType getNextItemType() override
void fillLuminosityBlockPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
std::vector< RunLumiToRange > m_runlumiToRange
void addDefault(ParameterSetDescription const &psetDescription)
edm::LuminosityBlockAuxiliary m_lumiAux
void setLumiFlag()
this ME is meant to be stored for each luminosity section
std::vector< edm::ProcessHistoryID > m_historyIDs
edm::ProcessHistoryID const & processHistoryID() const
edm::ProcessHistoryID processHistoryID_
MonitorElement * get(std::string const &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
void reportInputLumiSection(unsigned int run, unsigned int lumiSectId)
bool m_justOpenedFileSoNeedToGenerateRunTransition
std::shared_ptr< edm::LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override
edm::InputFileCatalog m_catalog
edm::ProcessHistoryID m_lastSeenReducedPHID2
std::list< unsigned int > m_orderedIndices
ProcessHistoryID const & reducedProcessHistoryID(ProcessHistoryID const &fullID) const
void setProcessHistoryID(ProcessHistoryID const &phid)
std::unique_ptr< edm::FileBlock > readFile_() override
MonitorElement * bookString(char_string const &name, char_string const &value)
Book string.
std::vector< TTree * > m_trees
const std::string getFullname() const
get full name of ME including Pathname
MonitorElement * book2S(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2S histogram.
static void registerFromString(std::string const &rep)
void setCurrentFolder(std::string const &fullpath)
MonitorElement * bookProfile(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, char const *option="s")
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
unsigned int m_lastSeenLumi2
std::vector< edm::LuminosityBlockRange > m_lumisToProcess
bool operator<(RunLumiPHIDKey const &right) const
bool search_all(ForwardSequence const &s, Datum const &d)
LuminosityBlockNumber_t luminosityBlock() const
void addContext(std::string const &context)
void readRun_(edm::RunPrincipal &rpCache) override
void setException(std::exception_ptr e)
std::unique_ptr< TFile > m_file
edm::ProcessHistoryID m_lastSeenReducedPHID
bool skipIt(edm::RunNumber_t, edm::LuminosityBlockNumber_t) const
MonitorElement * book1S(char_string const &name, char_string const &title, int nchX, double lowX, double highX)
Book 1S histogram.
std::vector< EventRange > & sortAndRemoveOverlaps(std::vector< EventRange > &eventRange)
std::exception_ptr getException()
RunPHIDKey(edm::ProcessHistoryID const &phid, unsigned int run)
bool binary_search_all(ForwardSequence const &s, Datum const &d)
wrappers for std::binary_search
bool lessThan(EventRange const &lh, EventRange const &rh)
MonitorElement * book3D(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ)
Book 3D histogram.
RunLumiPHIDKey(edm::ProcessHistoryID const &phid, unsigned int run, unsigned int lumi)
std::list< unsigned int >::iterator m_nextIndexItr
void setProcessHistoryID(ProcessHistoryID const &phid)
DQMRootSource(edm::ParameterSet const &, const edm::InputSourceDescription &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void readEvent_(edm::EventPrincipal &) override
void readLuminosityBlock_(edm::LuminosityBlockPrincipal &lbCache) override
ProcessHistoryID id() const
unsigned int m_lastSeenRun
void inputFileClosed(InputType inputType, Token fileToken)
edm::ProcessHistoryID processHistoryID_
static Registry * instance()
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
LuminosityBlockID id() const
bool setupFile(unsigned int iIndex)
static bool CheckBinLabels(const TAxis *a1, const TAxis *a2)
Check the consistency of the axis labels.