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) {
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) {
352 virtual boost::shared_ptr<edm::RunPrincipal>
readRun_(boost::shared_ptr<edm::RunPrincipal> rpCache);
353 virtual boost::shared_ptr<edm::LuminosityBlockPrincipal>
readLuminosityBlock_( boost::shared_ptr<edm::LuminosityBlockPrincipal> lbCache);
356 virtual std::unique_ptr<edm::FileBlock>
readFile_();
410 desc.
addUntracked<std::vector<std::string> >(
"fileNames")
411 ->setComment(
"Names of files to be processed.");
413 ->setComment(
"Just limit the process to the selected run.");
415 ->setComment(
"An alternate file catalog to use instead of the standard site one.");
423 m_catalog(iPSet.getUntrackedParameter<std::vector<std::
string> >(
"fileNames"),
424 iPSet.getUntrackedParameter<std::
string>(
"overrideCatalog")),
427 m_presentlyOpenFileIndex(0),
429 m_treeReaders(
kNIndicies,boost::shared_ptr<TreeReaderBase>()),
430 m_lastSeenReducedPHID(),
432 m_lastSeenReducedPHID2(),
435 m_filterOnRun(iPSet.getUntrackedParameter<unsigned int>(
"filterOnRun", 0)),
436 m_justOpenedFileSoNeedToGenerateRunTransition(
false),
437 m_shouldReadMEs(
true)
506 assert(
m_historyIDs.size() > runLumiRange.m_historyIDIndex);
512 boost::shared_ptr<edm::LuminosityBlockAuxiliary>
521 assert(
m_historyIDs.size() > runLumiRange.m_historyIDIndex);
528 boost::shared_ptr<edm::RunPrincipal>
535 unsigned int runID =rpCache->id().run();
536 assert(runID == runLumiRange.m_run);
558 std::vector<MonitorElement*> allMEs = (*store).getAllContents(
"");
559 for(
auto const&
ME : allMEs) {
562 if (
ME->getLumiFlag())
continue;
563 if ( !(*store).isCollate() )
574 if(runLumiRange.m_lumi == 0) {
581 rpCache->fillRunPrincipal();
585 boost::shared_ptr<edm::LuminosityBlockPrincipal>
590 assert(runLumiRange.m_run == lbCache->id().run());
591 assert(runLumiRange.m_lumi == lbCache->id().luminosityBlock());
600 std::vector<MonitorElement*> allMEs = (*store).getAllContents(
"");
601 for(
auto const&
ME : allMEs) {
603 if (
ME->getLumiFlag()) {
619 lbCache->fillLuminosityBlockPrincipal();
623 std::unique_ptr<edm::FileBlock>
637 m_file->GetUUID().AsString(),
638 std::vector<std::string>()
653 bool shouldContinue =
false;
656 shouldContinue =
false;
660 ULong64_t index = runLumiRange.m_firstIndex;
661 ULong64_t endIndex = runLumiRange.m_lastIndex+1;
662 for (; index != endIndex; ++
index)
664 bool isLumi = runLumiRange.m_lumi !=0;
666 reader->read(index,*store,isLumi);
684 (nextRunLumiRange.m_run == runLumiRange.m_run) &&
685 (nextRunLumiRange.m_lumi == runLumiRange.m_lumi) )
687 shouldContinue=
true;
688 runLumiRange = nextRunLumiRange;
691 }
while(shouldContinue);
712 runLumiRange.m_run=0;
715 bool shouldContinue =
false;
718 shouldContinue =
false;
732 (nextRunLumiRange.m_run == runLumiRange.m_run) &&
733 (nextRunLumiRange.m_lumi == runLumiRange.m_lumi) ) {
734 shouldContinue=
true;
738 }
while(shouldContinue);
754 if(
m_file.get() != 0 && iIndex > 0) {
765 ex <<
"\nInput file " <<
m_catalog.
fileNames()[iIndex] <<
" was not found, could not be opened, or is corrupted.\n";
768 if(not
m_file->IsZombie()) {
777 if(0 != strcmp(
m_file->GetTitle(),
"1")) {
779 ex<<
"Input file "<<
m_catalog.
fileNames()[iIndex].c_str() <<
" does not appear to be a DQM Root file.\n";
786 ex<<
"Input file "<<
m_catalog.
fileNames()[iIndex].c_str() <<
" appears to be corrupted since it does not have the proper internal structure.\n"
787 " Check to see if the file was closed properly.\n";
792 assert(0!=parameterSetTree);
800 for(
unsigned int index = 0; index != parameterSetTree->GetEntries();++
index)
802 parameterSetTree->GetEntry(index);
811 assert(0!=processHistoryTree);
812 unsigned int phIndex = 0;
818 std::string* pParameterSetIDBlob = ¶meterSetIDBlob;
831 std::vector<edm::ProcessConfiguration>
configs;
835 for(
unsigned int i=0;
i != processHistoryTree->GetEntries(); ++
i) {
836 processHistoryTree->GetEntry(
i);
838 if(not configs.empty()) {
849 configs.push_back(pc);
851 if(not configs.empty()) {
862 assert(0!=indicesTree);
869 indicesTree->SetBranchAddress(
kRunBranch,&temp.m_run);
870 indicesTree->SetBranchAddress(
kLumiBranch,&temp.m_lumi);
874 indicesTree->SetBranchAddress(
kTypeBranch,&temp.m_type);
875 indicesTree->SetBranchAddress(
kFirstIndex,&temp.m_firstIndex);
876 indicesTree->SetBranchAddress(
kLastIndex,&temp.m_lastIndex);
887 typedef std::map<RunLumiPHIDKey, std::list<unsigned int>::iterator > RunLumiToLastEntryMap;
888 RunLumiToLastEntryMap runLumiToLastEntryMap;
892 typedef std::map<RunPHIDKey, std::pair< std::list<unsigned int>::iterator, std::list<unsigned int>::iterator> > RunToFirstLastEntryMap;
893 RunToFirstLastEntryMap runToFirstLastEntryMap;
895 for (Long64_t index = 0; index != indicesTree->GetEntries(); ++
index)
897 indicesTree->GetEntry(index);
910 RunLumiToLastEntryMap::iterator itFind = runLumiToLastEntryMap.find(runLumi);
911 if (itFind == runLumiToLastEntryMap.end())
917 RunToFirstLastEntryMap::iterator itRunFirstLastEntryFind = runToFirstLastEntryMap.find(runKey);
918 bool needNewEntryInRunFirstLastEntryMap =
true;
919 if (itRunFirstLastEntryFind != runToFirstLastEntryMap.end())
921 needNewEntryInRunFirstLastEntryMap=
false;
925 itLastOfRun = itRunFirstLastEntryFind->second.second;
932 itLastOfRun = itRunFirstLastEntryFind->second.first;
935 std::list<unsigned int>::iterator iter =
m_orderedIndices.insert(itLastOfRun,index);
936 runLumiToLastEntryMap[runLumi]=iter;
937 if (needNewEntryInRunFirstLastEntryMap)
938 runToFirstLastEntryMap[runKey]=std::make_pair(iter,iter);
944 runToFirstLastEntryMap[runKey].second = iter;
950 runToFirstLastEntryMap[runKey].first = iter;
958 std::list<unsigned int>::iterator itNext = itFind->second;
960 std::list<unsigned int>::iterator iter =
m_orderedIndices.insert(itNext,index);
961 RunToFirstLastEntryMap::iterator itRunFirstLastEntryFind = runToFirstLastEntryMap.find(runKey);
962 if (itRunFirstLastEntryFind->second.second == itFind->second)
965 itRunFirstLastEntryFind->second.second = iter;
967 itFind->second = iter;
const DQMRootSource & operator=(const DQMRootSource &)
virtual boost::shared_ptr< edm::LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_()
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 boost::shared_ptr< edm::RunPrincipal > readRun_(boost::shared_ptr< edm::RunPrincipal > rpCache)
virtual boost::shared_ptr< edm::LuminosityBlockPrincipal > readLuminosityBlock_(boost::shared_ptr< edm::LuminosityBlockPrincipal > lbCache)
edm::JobReport::Token m_jrToken
virtual void closeFile_()
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
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
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.
static ThreadSafeRegistry * instance()
MonitorElement * book2DD(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D double histogram.
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)
std::set< MonitorElement * > m_lumiElements
virtual boost::shared_ptr< edm::RunAuxiliary > readRunAuxiliary_()
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.
bool insertMapped(value_type const &v)
std::vector< edm::ProcessHistoryID > m_reducedHistoryIDs
MonitorElement * bookFloat(const char *name)
Book float.
void tag(MonitorElement *me, unsigned int myTag)
virtual edm::InputSource::ItemType getNextItemType()
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
void inputFileClosed(Token fileToken)
MonitorElement * bookString(const char *name, const char *value)
Book string.
edm::ProcessHistoryID processHistoryID_
bool m_justOpenedFileSoNeedToGenerateRunTransition
edm::InputFileCatalog m_catalog
edm::ProcessHistoryID m_lastSeenReducedPHID2
std::list< unsigned int > m_orderedIndices
std::auto_ptr< TFile > m_file
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")
const std::string getFullname(void) const
get full name of ME including Pathname
void reportInputRunNumber(unsigned int run)
std::vector< TTree * > m_trees
virtual edm::EventPrincipal * readEvent_(edm::EventPrincipal &)
unsigned int m_lastSeenLumi2
int64_t getIntValue(void) const
std::string toString() const
bool operator<(RunLumiPHIDKey const &right) const
TH1F * getTH1F(void) const
void addContext(std::string const &context)
edm::ProcessHistoryID m_lastSeenReducedPHID
virtual std::unique_ptr< edm::FileBlock > readFile_()
TProfile * getTProfile(void) const
void reportInputLumiSection(unsigned int run, unsigned int lumiSectId)
RunPHIDKey(edm::ProcessHistoryID const &phid, unsigned int run)
void setupFile(unsigned int iIndex)
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.
ProcessHistoryID id() const
unsigned int m_lastSeenRun
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)
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
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")