67 return iStore.
book1D(iName, iHist);
70 void mergeTogether(TH1* iOriginal,TH1* iToAdd) {
71 if(iOriginal->TestBit(TH1::kCanRebin)==
true && iToAdd->TestBit(TH1::kCanRebin) ==
true) {
74 if( -1 == iOriginal->Merge(&list)) {
75 edm::LogError(
"MergeFailure")<<
"Failed to merge DQM element "<<iOriginal->GetName();
78 if (iOriginal->GetNbinsX() == iToAdd->GetNbinsX() &&
79 iOriginal->GetXaxis()->GetXmin() == iToAdd->GetXaxis()->GetXmin() &&
80 iOriginal->GetXaxis()->GetXmax() == iToAdd->GetXaxis()->GetXmax() &&
81 iOriginal->GetNbinsY() == iToAdd->GetNbinsY() &&
82 iOriginal->GetYaxis()->GetXmin() == iToAdd->GetYaxis()->GetXmin() &&
83 iOriginal->GetYaxis()->GetXmax() == iToAdd->GetYaxis()->GetXmax() &&
84 iOriginal->GetNbinsZ() == iToAdd->GetNbinsZ() &&
85 iOriginal->GetZaxis()->GetXmin() == iToAdd->GetZaxis()->GetXmin() &&
86 iOriginal->GetZaxis()->GetXmax() == iToAdd->GetZaxis()->GetXmax()) {
87 iOriginal->Add(iToAdd);
89 edm::LogError(
"MergeFailure")<<
"Found histograms with different axis limits '"<<iOriginal->GetName()<<
"' not merged.";
95 mergeTogether(iElement->
getTH1F(),iHist);
98 return iStore.
book1S(iName, iHist);
101 mergeTogether(iElement->
getTH1S(),iHist);
104 return iStore.
book1DD(iName, iHist);
107 mergeTogether(iElement->
getTH1D(),iHist);
110 return iStore.
book2D(iName, iHist);
113 mergeTogether(iElement->
getTH2F(),iHist);
116 return iStore.
book2S(iName, iHist);
119 mergeTogether(iElement->
getTH2S(),iHist);
122 return iStore.
book2DD(iName, iHist);
125 mergeTogether(iElement->
getTH2D(),iHist);
128 return iStore.
book3D(iName, iHist);
131 mergeTogether(iElement->
getTH3F(),iHist);
136 void mergeWithElement(
MonitorElement* iElement, TProfile* iHist) {
142 void mergeWithElement(
MonitorElement* iElement, TProfile2D* iHist) {
153 void mergeWithElement(
MonitorElement* iElement, Long64_t& iValue) {
155 if(name.find(
"EventInfo/processedEvents") != std::string::npos) {
158 if(name.find(
"EventInfo/iEvent") != std::string::npos ||
159 name.find(
"EventInfo/iLumiSection") != std::string::npos) {
161 iElement->
Fill(iValue);
184 size_t index = oPath.find_last_of(
'/');
185 if(index == std::string::npos) {
187 oName = iFullName.c_str();
190 oName = iFullName.c_str()+index+1;
194 struct RunLumiToRange {
195 unsigned int m_run, m_lumi,m_historyIDIndex;
196 ULong64_t m_beginTime;
198 ULong64_t m_firstIndex, m_lastIndex;
202 class TreeReaderBase {
205 virtual ~TreeReaderBase() {}
208 return doRead(iIndex,iStore,iIsLumi);
210 virtual void setTree(TTree* iTree) =0;
218 class TreeObjectReader:
public TreeReaderBase {
220 TreeObjectReader():m_tree(0),m_fullName(0),m_buffer(0),m_tag(0){
223 m_tree->GetEntry(iIndex);
228 splitName(*m_fullName, path,name);
230 element = createElement(iStore,name,m_buffer);
233 mergeWithElement(element,m_buffer);
236 iStore.
tag(element,m_tag);
240 virtual void setTree(TTree* iTree)
override {
254 class TreeSimpleReader :
public TreeReaderBase {
256 TreeSimpleReader():m_tree(0),m_fullName(0),m_buffer(),m_tag(0){
259 m_tree->GetEntry(iIndex);
264 splitName(*m_fullName, path,name);
266 element = createElement(iStore,name,m_buffer);
269 mergeWithElement(element, m_buffer);
272 iStore.
tag(element,m_tag);
276 virtual void setTree(TTree* iTree)
override {
356 virtual std::unique_ptr<edm::FileBlock>
readFile_()
override;
411 desc.
addUntracked<std::vector<std::string> >(
"fileNames")
412 ->setComment(
"Names of files to be processed.");
414 ->setComment(
"Just limit the process to the selected run.");
416 ->setComment(
"Skip the file is it is not valid");
418 ->setComment(
"An alternate file catalog to use instead of the standard site one.");
426 m_catalog(iPSet.getUntrackedParameter<std::vector<std::
string> >(
"fileNames"),
427 iPSet.getUntrackedParameter<std::
string>(
"overrideCatalog")),
430 m_presentlyOpenFileIndex(0),
432 m_treeReaders(
kNIndicies,boost::shared_ptr<TreeReaderBase>()),
433 m_lastSeenReducedPHID(),
435 m_lastSeenReducedPHID2(),
438 m_filterOnRun(iPSet.getUntrackedParameter<unsigned int>(
"filterOnRun", 0)),
439 m_skipBadFiles(iPSet.getUntrackedParameter<bool>(
"skipBadFiles",
false)),
440 m_justOpenedFileSoNeedToGenerateRunTransition(
false),
441 m_shouldReadMEs(
true)
509 assert(
m_historyIDs.size() > runLumiRange.m_historyIDIndex);
515 boost::shared_ptr<edm::LuminosityBlockAuxiliary>
524 assert(
m_historyIDs.size() > runLumiRange.m_historyIDIndex);
538 unsigned int runID =rpCache.
id().
run();
539 assert(runID == runLumiRange.m_run);
561 std::vector<MonitorElement*> allMEs = (*store).getAllContents(
"");
562 for(
auto const&
ME : allMEs) {
565 if (
ME->getLumiFlag())
continue;
566 if ( !(*store).isCollate() )
577 if(runLumiRange.m_lumi == 0) {
592 assert(runLumiRange.m_run == lbCache.
id().
run());
602 std::vector<MonitorElement*> allMEs = (*store).getAllContents(
"");
603 for(
auto const&
ME : allMEs) {
605 if (
ME->getLumiFlag()) {
624 std::unique_ptr<edm::FileBlock>
630 if(
m_file.get() ==
nullptr) {
645 m_file->GetUUID().AsString(),
646 std::vector<std::string>()
654 if(
m_file.get()==
nullptr) {
return; }
662 bool shouldContinue =
false;
665 shouldContinue =
false;
669 ULong64_t index = runLumiRange.m_firstIndex;
670 ULong64_t endIndex = runLumiRange.m_lastIndex+1;
671 for (; index != endIndex; ++
index)
673 bool isLumi = runLumiRange.m_lumi !=0;
675 reader->read(index,*store,isLumi);
693 (nextRunLumiRange.m_run == runLumiRange.m_run) &&
694 (nextRunLumiRange.m_lumi == runLumiRange.m_lumi) )
696 shouldContinue=
true;
697 runLumiRange = nextRunLumiRange;
700 }
while(shouldContinue);
721 runLumiRange.m_run=0;
724 bool shouldContinue =
false;
727 shouldContinue =
false;
741 (nextRunLumiRange.m_run == runLumiRange.m_run) &&
742 (nextRunLumiRange.m_lumi == runLumiRange.m_lumi) ) {
743 shouldContinue=
true;
747 }
while(shouldContinue);
763 if(
m_file.get() != 0 && iIndex > 0) {
770 std::auto_ptr<TFile> newFile;
777 ex <<
"\nInput file " <<
m_catalog.
fileNames()[iIndex] <<
" was not found, could not be opened, or is corrupted.\n";
782 if(not newFile->IsZombie()) {
794 if(0 != strcmp(newFile->GetTitle(),
"1")) {
796 ex<<
"Input file "<<
m_catalog.
fileNames()[iIndex].c_str() <<
" does not appear to be a DQM Root file.\n";
804 ex<<
"Input file "<<
m_catalog.
fileNames()[iIndex].c_str() <<
" appears to be corrupted since it does not have the proper internal structure.\n"
805 " Check to see if the file was closed properly.\n";
813 assert(0!=parameterSetTree);
821 for(
unsigned int index = 0; index != parameterSetTree->GetEntries();++
index)
823 parameterSetTree->GetEntry(index);
830 assert(0!=processHistoryTree);
831 unsigned int phIndex = 0;
837 std::string* pParameterSetIDBlob = ¶meterSetIDBlob;
847 std::vector<edm::ProcessConfiguration>
configs;
851 for(
unsigned int i=0;
i != processHistoryTree->GetEntries(); ++
i) {
852 processHistoryTree->GetEntry(
i);
854 if(not configs.empty()) {
864 configs.push_back(pc);
866 if(not configs.empty()) {
877 assert(0!=indicesTree);
884 indicesTree->SetBranchAddress(
kRunBranch,&temp.m_run);
885 indicesTree->SetBranchAddress(
kLumiBranch,&temp.m_lumi);
889 indicesTree->SetBranchAddress(
kTypeBranch,&temp.m_type);
890 indicesTree->SetBranchAddress(
kFirstIndex,&temp.m_firstIndex);
891 indicesTree->SetBranchAddress(
kLastIndex,&temp.m_lastIndex);
902 typedef std::map<RunLumiPHIDKey, std::list<unsigned int>::iterator > RunLumiToLastEntryMap;
903 RunLumiToLastEntryMap runLumiToLastEntryMap;
907 typedef std::map<RunPHIDKey, std::pair< std::list<unsigned int>::iterator, std::list<unsigned int>::iterator> > RunToFirstLastEntryMap;
908 RunToFirstLastEntryMap runToFirstLastEntryMap;
910 for (Long64_t index = 0; index != indicesTree->GetEntries(); ++
index)
912 indicesTree->GetEntry(index);
925 RunLumiToLastEntryMap::iterator itFind = runLumiToLastEntryMap.find(runLumi);
926 if (itFind == runLumiToLastEntryMap.end())
932 RunToFirstLastEntryMap::iterator itRunFirstLastEntryFind = runToFirstLastEntryMap.find(runKey);
933 bool needNewEntryInRunFirstLastEntryMap =
true;
934 if (itRunFirstLastEntryFind != runToFirstLastEntryMap.end())
936 needNewEntryInRunFirstLastEntryMap=
false;
940 itLastOfRun = itRunFirstLastEntryFind->second.second;
947 itLastOfRun = itRunFirstLastEntryFind->second.first;
950 std::list<unsigned int>::iterator iter =
m_orderedIndices.insert(itLastOfRun,index);
951 runLumiToLastEntryMap[runLumi]=iter;
952 if (needNewEntryInRunFirstLastEntryMap)
953 runToFirstLastEntryMap[runKey]=std::make_pair(iter,iter);
959 runToFirstLastEntryMap[runKey].second = iter;
965 runToFirstLastEntryMap[runKey].first = iter;
973 std::list<unsigned int>::iterator itNext = itFind->second;
975 std::list<unsigned int>::iterator iter =
m_orderedIndices.insert(itNext,index);
976 RunToFirstLastEntryMap::iterator itRunFirstLastEntryFind = runToFirstLastEntryMap.find(runKey);
977 if (itRunFirstLastEntryFind->second.second == itFind->second)
980 itRunFirstLastEntryFind->second.second = iter;
982 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< 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)
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
bool operator<(RunLumiPHIDKey const &right) const
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
TProfile * getTProfile(void) const
RunPHIDKey(edm::ProcessHistoryID const &phid, unsigned int run)
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")