71 return iStore.
book1D(iName, iHist);
74 void mergeTogether(TH1* iOriginal,TH1* iToAdd) {
75 if(iOriginal->CanExtendAllAxes() && iToAdd->CanExtendAllAxes()) {
78 if( -1 == iOriginal->Merge(&list)) {
79 edm::LogError(
"MergeFailure")<<
"Failed to merge DQM element "<<iOriginal->GetName();
82 if (iOriginal->GetNbinsX() == iToAdd->GetNbinsX() &&
83 iOriginal->GetXaxis()->GetXmin() == iToAdd->GetXaxis()->GetXmin() &&
84 iOriginal->GetXaxis()->GetXmax() == iToAdd->GetXaxis()->GetXmax() &&
85 iOriginal->GetNbinsY() == iToAdd->GetNbinsY() &&
86 iOriginal->GetYaxis()->GetXmin() == iToAdd->GetYaxis()->GetXmin() &&
87 iOriginal->GetYaxis()->GetXmax() == iToAdd->GetYaxis()->GetXmax() &&
88 iOriginal->GetNbinsZ() == iToAdd->GetNbinsZ() &&
89 iOriginal->GetZaxis()->GetXmin() == iToAdd->GetZaxis()->GetXmin() &&
90 iOriginal->GetZaxis()->GetXmax() == iToAdd->GetZaxis()->GetXmax() &&
94 iOriginal->Add(iToAdd);
96 edm::LogError(
"MergeFailure")<<
"Found histograms with different axis limits or different labels'"<<iOriginal->GetName()<<
"' not merged.";
103 mergeTogether(iElement->
getTH1F(),iHist);
106 return iStore.
book1S(iName, iHist);
109 mergeTogether(iElement->
getTH1S(),iHist);
112 return iStore.
book1DD(iName, iHist);
115 mergeTogether(iElement->
getTH1D(),iHist);
118 return iStore.
book2D(iName, iHist);
121 mergeTogether(iElement->
getTH2F(),iHist);
124 return iStore.
book2S(iName, iHist);
127 mergeTogether(iElement->
getTH2S(),iHist);
130 return iStore.
book2DD(iName, iHist);
133 mergeTogether(iElement->
getTH2D(),iHist);
136 return iStore.
book3D(iName, iHist);
139 mergeTogether(iElement->
getTH3F(),iHist);
144 void mergeWithElement(
MonitorElement* iElement, TProfile* iHist) {
150 void mergeWithElement(
MonitorElement* iElement, TProfile2D* iHist) {
161 void mergeWithElement(
MonitorElement* iElement, Long64_t& iValue) {
163 if(name.find(
"EventInfo/processedEvents") != std::string::npos) {
165 }
else if(name.find(
"EventInfo/iEvent") != std::string::npos ||
166 name.find(
"EventInfo/iLumiSection") != std::string::npos) {
168 iElement->
Fill(iValue);
172 iElement->
Fill(iValue);
183 iElement->
Fill(iValue);
190 iElement->
Fill(*iValue);
195 size_t index = oPath.find_last_of(
'/');
196 if(index == std::string::npos) {
198 oName = iFullName.c_str();
201 oName = iFullName.c_str()+index+1;
205 struct RunLumiToRange {
206 unsigned int m_run, m_lumi,m_historyIDIndex;
207 ULong64_t m_beginTime;
209 ULong64_t m_firstIndex, m_lastIndex;
213 class TreeReaderBase {
216 virtual ~TreeReaderBase() {}
219 return doRead(iIndex,iStore,iIsLumi);
221 virtual void setTree(TTree* iTree) =0;
229 class TreeObjectReader:
public TreeReaderBase {
231 TreeObjectReader():m_tree(0),m_fullName(0),m_buffer(0),m_tag(0){
234 m_tree->GetEntry(iIndex);
239 splitName(*m_fullName, path,name);
241 element = createElement(iStore,name,m_buffer);
244 mergeWithElement(element,m_buffer);
247 iStore.
tag(element,m_tag);
251 virtual void setTree(TTree* iTree)
override {
265 class TreeSimpleReader :
public TreeReaderBase {
267 TreeSimpleReader():m_tree(0),m_fullName(0),m_buffer(0),m_tag(0){
270 m_tree->GetEntry(iIndex);
275 splitName(*m_fullName, path,name);
277 element = createElement(iStore,name,m_buffer);
280 mergeWithElement(element, m_buffer);
283 iStore.
tag(element,m_tag);
287 virtual void setTree(TTree* iTree)
override {
323 processHistoryID_(phid), run_(run) { }
325 unsigned int run()
const {
return run_; }
328 return run_ < right.
run();
340 processHistoryID_(phid), run_(run), lumi_(lumi) { }
342 unsigned int run()
const {
return run_; }
343 unsigned int lumi()
const {
return lumi_; }
346 if (run_ == right.
run()) {
347 return lumi_ < right.
lumi();
349 return run_ < right.
run();
361 virtual std::shared_ptr<edm::RunAuxiliary> readRunAuxiliary_()
override ;
362 virtual std::shared_ptr<edm::LuminosityBlockAuxiliary> readLuminosityBlockAuxiliary_()
override ;
367 virtual std::unique_ptr<edm::FileBlock> readFile_()
override;
368 virtual void closeFile_()
override;
372 void readNextItemType();
373 bool setupFile(
unsigned int iIndex);
426 desc.
addUntracked<std::vector<std::string> >(
"fileNames")
427 ->setComment(
"Names of files to be processed.");
429 ->setComment(
"Just limit the process to the selected run.");
431 ->setComment(
"Skip the file if it is not valid");
433 ->setComment(
"An alternate file catalog to use instead of the standard site one.");
434 std::vector<edm::LuminosityBlockRange> defaultLumis;
435 desc.
addUntracked<std::vector<edm::LuminosityBlockRange> >(
"lumisToProcess",defaultLumis)
436 ->setComment(
"Skip any lumi inside the specified run:lumi range.");
445 m_catalog(iPSet.getUntrackedParameter<
std::vector<
std::
string> >(
"fileNames"),
446 iPSet.getUntrackedParameter<
std::
string>(
"overrideCatalog")),
449 m_presentlyOpenFileIndex(0),
452 m_lastSeenReducedPHID(),
454 m_lastSeenReducedPHID2(),
457 m_filterOnRun(iPSet.getUntrackedParameter<unsigned
int>(
"filterOnRun", 0)),
458 m_skipBadFiles(iPSet.getUntrackedParameter<bool>(
"skipBadFiles",
false)),
460 m_justOpenedFileSoNeedToGenerateRunTransition(
false),
461 m_shouldReadMEs(
true)
533 assert(
m_historyIDs.size() > runLumiRange.m_historyIDIndex);
536 return std::make_shared<edm::RunAuxiliary>(
m_runAux);
539 std::shared_ptr<edm::LuminosityBlockAuxiliary>
548 assert(
m_historyIDs.size() > runLumiRange.m_historyIDIndex);
552 return std::make_shared<edm::LuminosityBlockAuxiliary>(
m_lumiAux);
562 unsigned int runID =rpCache.
id().
run();
563 assert(runID == runLumiRange.m_run);
585 std::vector<MonitorElement*> allMEs = (*store).getAllContents(
"");
586 for(
auto const&
ME : allMEs) {
589 if (
ME->getLumiFlag())
continue;
590 if ( !(*store).isCollate() )
601 if(runLumiRange.m_lumi == 0) {
618 assert(runLumiRange.m_run == lbCache.
id().
run());
628 std::vector<MonitorElement*> allMEs = (*store).getAllContents(
"");
629 for(
auto const&
ME : allMEs) {
631 if (
ME->getLumiFlag()) {
650 std::unique_ptr<edm::FileBlock>
655 if(
m_file.get() ==
nullptr) {
672 m_file->GetUUID().AsString(),
673 std::vector<std::string>()
681 if(
m_file.get()==
nullptr) {
return; }
689 bool shouldContinue =
false;
692 shouldContinue =
false;
699 ULong64_t index = runLumiRange.m_firstIndex;
700 ULong64_t endIndex = runLumiRange.m_lastIndex+1;
701 for (; index != endIndex; ++
index)
703 bool isLumi = runLumiRange.m_lumi !=0;
705 reader->read(index,*store,isLumi);
717 (nextRunLumiRange.m_run == runLumiRange.m_run) &&
718 (nextRunLumiRange.m_lumi == runLumiRange.m_lumi) )
720 shouldContinue=
true;
721 runLumiRange = nextRunLumiRange;
724 }
while(shouldContinue);
745 runLumiRange.m_run=0;
748 bool shouldContinue =
false;
751 shouldContinue =
false;
768 (nextRunLumiRange.m_run == runLumiRange.m_run) &&
769 (nextRunLumiRange.m_lumi == runLumiRange.m_lumi) ) {
770 shouldContinue=
true;
774 }
while(shouldContinue);
790 if(
m_file.get() != 0 && iIndex > 0) {
797 std::auto_ptr<TFile> newFile;
804 ex <<
"\nInput file " <<
m_catalog.
fileNames()[iIndex] <<
" was not found, could not be opened, or is corrupted.\n";
809 if(not newFile->IsZombie()) {
821 if(0 != strcmp(newFile->GetTitle(),
"1")) {
823 ex<<
"Input file "<<
m_catalog.
fileNames()[iIndex].c_str() <<
" does not appear to be a DQM Root file.\n";
831 ex<<
"Input file "<<
m_catalog.
fileNames()[iIndex].c_str() <<
" appears to be corrupted since it does not have the proper internal structure.\n" 832 " Check to see if the file was closed properly.\n";
840 assert(0!=parameterSetTree);
848 for(
unsigned int index = 0; index != parameterSetTree->GetEntries();++
index)
850 parameterSetTree->GetEntry(index);
857 assert(0!=processHistoryTree);
858 unsigned int phIndex = 0;
864 std::string* pParameterSetIDBlob = ¶meterSetIDBlob;
874 std::vector<edm::ProcessConfiguration>
configs;
878 for(
unsigned int i=0;
i != processHistoryTree->GetEntries(); ++
i) {
879 processHistoryTree->GetEntry(
i);
881 if(not configs.empty()) {
891 configs.push_back(pc);
893 if(not configs.empty()) {
904 assert(0!=indicesTree);
911 indicesTree->SetBranchAddress(
kRunBranch,&temp.m_run);
912 indicesTree->SetBranchAddress(
kLumiBranch,&temp.m_lumi);
916 indicesTree->SetBranchAddress(
kTypeBranch,&temp.m_type);
917 indicesTree->SetBranchAddress(
kFirstIndex,&temp.m_firstIndex);
918 indicesTree->SetBranchAddress(
kLastIndex,&temp.m_lastIndex);
929 typedef std::map<RunLumiPHIDKey, std::list<unsigned int>::iterator > RunLumiToLastEntryMap;
930 RunLumiToLastEntryMap runLumiToLastEntryMap;
934 typedef std::map<RunPHIDKey, std::pair< std::list<unsigned int>::iterator, std::list<unsigned int>::iterator> > RunToFirstLastEntryMap;
935 RunToFirstLastEntryMap runToFirstLastEntryMap;
937 for (Long64_t index = 0; index != indicesTree->GetEntries(); ++
index)
939 indicesTree->GetEntry(index);
952 RunLumiToLastEntryMap::iterator itFind = runLumiToLastEntryMap.find(runLumi);
953 if (itFind == runLumiToLastEntryMap.end())
959 RunToFirstLastEntryMap::iterator itRunFirstLastEntryFind = runToFirstLastEntryMap.find(runKey);
960 bool needNewEntryInRunFirstLastEntryMap =
true;
961 if (itRunFirstLastEntryFind != runToFirstLastEntryMap.end())
963 needNewEntryInRunFirstLastEntryMap=
false;
967 itLastOfRun = itRunFirstLastEntryFind->second.second;
974 itLastOfRun = itRunFirstLastEntryFind->second.first;
977 std::list<unsigned int>::iterator iter =
m_orderedIndices.insert(itLastOfRun,index);
978 runLumiToLastEntryMap[runLumi]=iter;
979 if (needNewEntryInRunFirstLastEntryMap)
980 runToFirstLastEntryMap[runKey]=std::make_pair(iter,iter);
986 runToFirstLastEntryMap[runKey].second = iter;
992 runToFirstLastEntryMap[runKey].first = iter;
1000 std::list<unsigned int>::iterator itNext = itFind->second;
1002 std::list<unsigned int>::iterator iter =
m_orderedIndices.insert(itNext,index);
1003 RunToFirstLastEntryMap::iterator itRunFirstLastEntryFind = runToFirstLastEntryMap.find(runKey);
1004 if (itRunFirstLastEntryFind->second.second == itFind->second)
1007 itRunFirstLastEntryFind->second.second = iter;
1009 itFind->second = iter;
TH2S * getTH2S(void) const
TH1S * getTH1S(void) const
edm::InputSource::ItemType m_nextItemType
unsigned int m_lastSeenRun2
unsigned int lumi() const
MonitorElement * book2S(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2S histogram.
virtual 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)
virtual void closeFile_() override
TProfile2D * getTProfile2D(void) const
void logFileAction(char const *msg, char const *fileName) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
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
MonitorElement * book3D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ)
Book 3D histogram.
MonitorElement * book2DD(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D double histogram.
bool registerProcessHistory(ProcessHistory const &processHistory)
std::set< MonitorElement * > m_lumiElements
TH3F * getTH3F(void) const
TH1D * getTH1D(void) const
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
TH2D * getTH2D(void) const
MonitorElement * book1DD(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1S histogram.
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
unsigned int LuminosityBlockNumber_t
std::vector< edm::ProcessHistoryID > m_reducedHistoryIDs
MonitorElement * bookFloat(const char *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)
void tag(MonitorElement *me, unsigned int myTag)
virtual 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
std::vector< edm::ProcessHistoryID > m_historyIDs
edm::ProcessHistoryID const & processHistoryID() const
MonitorElement * bookString(const char *name, const char *value)
Book string.
edm::ProcessHistoryID processHistoryID_
void reportInputLumiSection(unsigned int run, unsigned int lumiSectId)
bool m_justOpenedFileSoNeedToGenerateRunTransition
virtual std::shared_ptr< edm::LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override
edm::InputFileCatalog m_catalog
edm::ProcessHistoryID m_lastSeenReducedPHID2
std::list< unsigned int > m_orderedIndices
std::auto_ptr< TFile > m_file
ProcessHistoryID const & reducedProcessHistoryID(ProcessHistoryID const &fullID) const
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
void setProcessHistoryID(ProcessHistoryID const &phid)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
virtual std::unique_ptr< edm::FileBlock > readFile_() override
const std::string getFullname(void) const
get full name of ME including Pathname
std::vector< TTree * > m_trees
static void registerFromString(std::string const &rep)
unsigned int m_lastSeenLumi2
int64_t getIntValue(void) const
std::vector< edm::LuminosityBlockRange > m_lumisToProcess
bool operator<(RunLumiPHIDKey const &right) const
bool search_all(ForwardSequence const &s, Datum const &d)
TH1F * getTH1F(void) const
LuminosityBlockNumber_t luminosityBlock() const
void addContext(std::string const &context)
virtual void readRun_(edm::RunPrincipal &rpCache) override
edm::ProcessHistoryID m_lastSeenReducedPHID
bool skipIt(edm::RunNumber_t, edm::LuminosityBlockNumber_t) const
TProfile * getTProfile(void) const
std::vector< EventRange > & sortAndRemoveOverlaps(std::vector< EventRange > &eventRange)
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)
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 &)
void setLumiFlag(void)
this ME is meant to be stored for each luminosity section
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
TH2F * getTH2F(void) const
MonitorElement * bookInt(const char *name)
Book int.
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
virtual void readEvent_(edm::EventPrincipal &) override
virtual void readLuminosityBlock_(edm::LuminosityBlockPrincipal &lbCache) override
ProcessHistoryID id() const
unsigned int m_lastSeenRun
void inputFileClosed(InputType inputType, Token fileToken)
edm::ProcessHistoryID processHistoryID_
MonitorElement * book1S(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1S histogram.
void setCurrentFolder(const std::string &fullpath)
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.
MonitorElement * bookProfile2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, const char *option="s")