23 #include "THashList.h"
71 bool CheckBinLabels(
const TAxis* a1,
const TAxis * a2)
74 THashList *l1 = (
const_cast<TAxis*
>(a1))->GetLabels();
75 THashList *l2 = (
const_cast<TAxis*
>(a2))->GetLabels();
83 if (l1->GetSize() != l2->GetSize() ) {
86 for (
int i = 1;
i <= a1->GetNbins(); ++
i) {
87 TString label1 = a1->GetBinLabel(
i);
88 TString label2 = a2->GetBinLabel(
i);
89 if (label1 != label2) {
99 return iStore.
book1D(iName, iHist);
102 void mergeTogether(TH1* iOriginal,TH1* iToAdd) {
103 if(iOriginal->TestBit(TH1::kCanRebin)==
true && iToAdd->TestBit(TH1::kCanRebin) ==
true) {
106 if( -1 == iOriginal->Merge(&list)) {
107 edm::LogError(
"MergeFailure")<<
"Failed to merge DQM element "<<iOriginal->GetName();
110 if (iOriginal->GetNbinsX() == iToAdd->GetNbinsX() &&
111 iOriginal->GetXaxis()->GetXmin() == iToAdd->GetXaxis()->GetXmin() &&
112 iOriginal->GetXaxis()->GetXmax() == iToAdd->GetXaxis()->GetXmax() &&
113 iOriginal->GetNbinsY() == iToAdd->GetNbinsY() &&
114 iOriginal->GetYaxis()->GetXmin() == iToAdd->GetYaxis()->GetXmin() &&
115 iOriginal->GetYaxis()->GetXmax() == iToAdd->GetYaxis()->GetXmax() &&
116 iOriginal->GetNbinsZ() == iToAdd->GetNbinsZ() &&
117 iOriginal->GetZaxis()->GetXmin() == iToAdd->GetZaxis()->GetXmin() &&
118 iOriginal->GetZaxis()->GetXmax() == iToAdd->GetZaxis()->GetXmax() &&
119 CheckBinLabels(iOriginal->GetXaxis(),iToAdd->GetXaxis()) &&
120 CheckBinLabels(iOriginal->GetYaxis(),iToAdd->GetYaxis()) &&
121 CheckBinLabels(iOriginal->GetZaxis(),iToAdd->GetZaxis())) {
122 iOriginal->Add(iToAdd);
124 edm::LogError(
"MergeFailure")<<
"Found histograms with different axis limits or different labels'"<<iOriginal->GetName()<<
"' not merged.";
131 mergeTogether(iElement->
getTH1F(),iHist);
134 return iStore.
book1S(iName, iHist);
137 mergeTogether(iElement->
getTH1S(),iHist);
140 return iStore.
book1DD(iName, iHist);
143 mergeTogether(iElement->
getTH1D(),iHist);
146 return iStore.
book2D(iName, iHist);
149 mergeTogether(iElement->
getTH2F(),iHist);
152 return iStore.
book2S(iName, iHist);
155 mergeTogether(iElement->
getTH2S(),iHist);
158 return iStore.
book2DD(iName, iHist);
161 mergeTogether(iElement->
getTH2D(),iHist);
164 return iStore.
book3D(iName, iHist);
167 mergeTogether(iElement->
getTH3F(),iHist);
172 void mergeWithElement(
MonitorElement* iElement, TProfile* iHist) {
178 void mergeWithElement(
MonitorElement* iElement, TProfile2D* iHist) {
189 void mergeWithElement(
MonitorElement* iElement, Long64_t& iValue) {
191 if(name.find(
"EventInfo/processedEvents") != std::string::npos) {
193 }
else if(name.find(
"EventInfo/iEvent") != std::string::npos ||
194 name.find(
"EventInfo/iLumiSection") != std::string::npos) {
196 iElement->
Fill(iValue);
200 iElement->
Fill(iValue);
211 iElement->
Fill(iValue);
218 iElement->
Fill(*iValue);
223 size_t index = oPath.find_last_of(
'/');
224 if(index == std::string::npos) {
226 oName = iFullName.c_str();
229 oName = iFullName.c_str()+index+1;
233 struct RunLumiToRange {
234 unsigned int m_run, m_lumi,m_historyIDIndex;
235 ULong64_t m_beginTime;
237 ULong64_t m_firstIndex, m_lastIndex;
241 class TreeReaderBase {
244 virtual ~TreeReaderBase() {}
247 return doRead(iIndex,iStore,iIsLumi);
249 virtual void setTree(TTree* iTree) =0;
257 class TreeObjectReader:
public TreeReaderBase {
259 TreeObjectReader():m_tree(0),m_fullName(0),m_buffer(0),m_tag(0){
262 m_tree->GetEntry(iIndex);
267 splitName(*m_fullName, path,name);
269 element = createElement(iStore,name,m_buffer);
272 mergeWithElement(element,m_buffer);
275 iStore.
tag(element,m_tag);
279 virtual void setTree(TTree* iTree)
override {
293 class TreeSimpleReader :
public TreeReaderBase {
295 TreeSimpleReader():m_tree(0),m_fullName(0),m_buffer(0),m_tag(0){
298 m_tree->GetEntry(iIndex);
303 splitName(*m_fullName, path,name);
305 element = createElement(iStore,name,m_buffer);
308 mergeWithElement(element, m_buffer);
311 iStore.
tag(element,m_tag);
315 virtual void setTree(TTree* iTree)
override {
395 virtual std::unique_ptr<edm::FileBlock>
readFile_()
override;
454 desc.
addUntracked<std::vector<std::string> >(
"fileNames")
455 ->setComment(
"Names of files to be processed.");
457 ->setComment(
"Just limit the process to the selected run.");
459 ->setComment(
"Skip the file if it is not valid");
461 ->setComment(
"An alternate file catalog to use instead of the standard site one.");
462 std::vector<edm::LuminosityBlockRange> defaultLumis;
463 desc.
addUntracked<std::vector<edm::LuminosityBlockRange> >(
"lumisToProcess",defaultLumis)
464 ->setComment(
"Skip any lumi inside the specified run:lumi range.");
473 m_catalog(iPSet.getUntrackedParameter<std::vector<std::
string> >(
"fileNames"),
474 iPSet.getUntrackedParameter<std::
string>(
"overrideCatalog")),
477 m_presentlyOpenFileIndex(0),
479 m_treeReaders(
kNIndicies,boost::shared_ptr<TreeReaderBase>()),
480 m_lastSeenReducedPHID(),
482 m_lastSeenReducedPHID2(),
485 m_filterOnRun(iPSet.getUntrackedParameter<unsigned int>(
"filterOnRun", 0)),
486 m_skipBadFiles(iPSet.getUntrackedParameter<bool>(
"skipBadFiles",
false)),
488 m_justOpenedFileSoNeedToGenerateRunTransition(
false),
489 m_shouldReadMEs(
true)
561 assert(
m_historyIDs.size() > runLumiRange.m_historyIDIndex);
567 boost::shared_ptr<edm::LuminosityBlockAuxiliary>
576 assert(
m_historyIDs.size() > runLumiRange.m_historyIDIndex);
590 unsigned int runID =rpCache.
id().
run();
591 assert(runID == runLumiRange.m_run);
613 std::vector<MonitorElement*> allMEs = (*store).getAllContents(
"");
614 for(
auto const&
ME : allMEs) {
617 if (
ME->getLumiFlag())
continue;
618 if ( !(*store).isCollate() )
629 if(runLumiRange.m_lumi == 0) {
646 assert(runLumiRange.m_run == lbCache.
id().
run());
656 std::vector<MonitorElement*> allMEs = (*store).getAllContents(
"");
657 for(
auto const&
ME : allMEs) {
659 if (
ME->getLumiFlag()) {
678 std::unique_ptr<edm::FileBlock>
683 if(
m_file.get() ==
nullptr) {
700 m_file->GetUUID().AsString(),
701 std::vector<std::string>()
709 if(
m_file.get()==
nullptr) {
return; }
717 bool shouldContinue =
false;
720 shouldContinue =
false;
727 ULong64_t index = runLumiRange.m_firstIndex;
728 ULong64_t endIndex = runLumiRange.m_lastIndex+1;
729 for (; index != endIndex; ++
index)
731 bool isLumi = runLumiRange.m_lumi !=0;
733 reader->read(index,*store,isLumi);
743 (nextRunLumiRange.m_run == runLumiRange.m_run) &&
744 (nextRunLumiRange.m_lumi == runLumiRange.m_lumi) )
746 shouldContinue=
true;
747 runLumiRange = nextRunLumiRange;
750 }
while(shouldContinue);
771 runLumiRange.m_run=0;
774 bool shouldContinue =
false;
777 shouldContinue =
false;
794 (nextRunLumiRange.m_run == runLumiRange.m_run) &&
795 (nextRunLumiRange.m_lumi == runLumiRange.m_lumi) ) {
796 shouldContinue=
true;
800 }
while(shouldContinue);
816 if(
m_file.get() != 0 && iIndex > 0) {
823 std::auto_ptr<TFile> newFile;
830 ex <<
"\nInput file " <<
m_catalog.
fileNames()[iIndex] <<
" was not found, could not be opened, or is corrupted.\n";
835 if(not newFile->IsZombie()) {
847 if(0 != strcmp(newFile->GetTitle(),
"1")) {
849 ex<<
"Input file "<<
m_catalog.
fileNames()[iIndex].c_str() <<
" does not appear to be a DQM Root file.\n";
857 ex<<
"Input file "<<
m_catalog.
fileNames()[iIndex].c_str() <<
" appears to be corrupted since it does not have the proper internal structure.\n"
858 " Check to see if the file was closed properly.\n";
866 assert(0!=parameterSetTree);
874 for(
unsigned int index = 0; index != parameterSetTree->GetEntries();++
index)
876 parameterSetTree->GetEntry(index);
883 assert(0!=processHistoryTree);
884 unsigned int phIndex = 0;
890 std::string* pParameterSetIDBlob = ¶meterSetIDBlob;
900 std::vector<edm::ProcessConfiguration>
configs;
904 for(
unsigned int i=0;
i != processHistoryTree->GetEntries(); ++
i) {
905 processHistoryTree->GetEntry(
i);
907 if(not configs.empty()) {
917 configs.push_back(pc);
919 if(not configs.empty()) {
930 assert(0!=indicesTree);
937 indicesTree->SetBranchAddress(
kRunBranch,&temp.m_run);
938 indicesTree->SetBranchAddress(
kLumiBranch,&temp.m_lumi);
942 indicesTree->SetBranchAddress(
kTypeBranch,&temp.m_type);
943 indicesTree->SetBranchAddress(
kFirstIndex,&temp.m_firstIndex);
944 indicesTree->SetBranchAddress(
kLastIndex,&temp.m_lastIndex);
955 typedef std::map<RunLumiPHIDKey, std::list<unsigned int>::iterator > RunLumiToLastEntryMap;
956 RunLumiToLastEntryMap runLumiToLastEntryMap;
960 typedef std::map<RunPHIDKey, std::pair< std::list<unsigned int>::iterator, std::list<unsigned int>::iterator> > RunToFirstLastEntryMap;
961 RunToFirstLastEntryMap runToFirstLastEntryMap;
963 for (Long64_t index = 0; index != indicesTree->GetEntries(); ++
index)
965 indicesTree->GetEntry(index);
978 RunLumiToLastEntryMap::iterator itFind = runLumiToLastEntryMap.find(runLumi);
979 if (itFind == runLumiToLastEntryMap.end())
985 RunToFirstLastEntryMap::iterator itRunFirstLastEntryFind = runToFirstLastEntryMap.find(runKey);
986 bool needNewEntryInRunFirstLastEntryMap =
true;
987 if (itRunFirstLastEntryFind != runToFirstLastEntryMap.end())
989 needNewEntryInRunFirstLastEntryMap=
false;
993 itLastOfRun = itRunFirstLastEntryFind->second.second;
1000 itLastOfRun = itRunFirstLastEntryFind->second.first;
1003 std::list<unsigned int>::iterator iter =
m_orderedIndices.insert(itLastOfRun,index);
1004 runLumiToLastEntryMap[runLumi]=iter;
1005 if (needNewEntryInRunFirstLastEntryMap)
1006 runToFirstLastEntryMap[runKey]=std::make_pair(iter,iter);
1012 runToFirstLastEntryMap[runKey].second = iter;
1018 runToFirstLastEntryMap[runKey].first = iter;
1026 std::list<unsigned int>::iterator itNext = itFind->second;
1028 std::list<unsigned int>::iterator iter =
m_orderedIndices.insert(itNext,index);
1029 RunToFirstLastEntryMap::iterator itRunFirstLastEntryFind = runToFirstLastEntryMap.find(runKey);
1030 if (itRunFirstLastEntryFind->second.second == itFind->second)
1033 itRunFirstLastEntryFind->second.second = iter;
1035 itFind->second = iter;
const DQMRootSource & operator=(const DQMRootSource &)
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.
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 boost::shared_ptr< edm::LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override
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
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)
virtual boost::shared_ptr< edm::RunAuxiliary > readRunAuxiliary_() override
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
< trclass="colgroup">< tdclass="colgroup"colspan=5 > DT local reconstruction</td ></tr >< tr >< td >< ahref="classDTRecHit1DPair.html"> DTRecHit1DPair</a ></td >< td >< ahref="DataFormats_DTRecHit.html"> edm::RangeMap & lt
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 &)
volatile std::atomic< bool > shutdown_flag false
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)
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")