65 return iStore.
book1D(iName, iHist);
68 void mergeTogether(TH1* iOriginal,TH1* iToAdd) {
69 if(iOriginal->TestBit(TH1::kCanRebin)==
true && iToAdd->TestBit(TH1::kCanRebin) ==
true) {
72 if( -1 == iOriginal->Merge(&list)) {
73 edm::LogError(
"MergeFailure")<<
"Failed to merge DQM element "<<iOriginal->GetName();
76 if (iOriginal->GetNbinsX() == iToAdd->GetNbinsX() &&
77 iOriginal->GetXaxis()->GetXmin() == iToAdd->GetXaxis()->GetXmin() &&
78 iOriginal->GetXaxis()->GetXmax() == iToAdd->GetXaxis()->GetXmax() &&
79 iOriginal->GetNbinsY() == iToAdd->GetNbinsY() &&
80 iOriginal->GetYaxis()->GetXmin() == iToAdd->GetYaxis()->GetXmin() &&
81 iOriginal->GetYaxis()->GetXmax() == iToAdd->GetYaxis()->GetXmax() &&
82 iOriginal->GetNbinsZ() == iToAdd->GetNbinsZ() &&
83 iOriginal->GetZaxis()->GetXmin() == iToAdd->GetZaxis()->GetXmin() &&
84 iOriginal->GetZaxis()->GetXmax() == iToAdd->GetZaxis()->GetXmax()) {
85 iOriginal->Add(iToAdd);
87 edm::LogError(
"MergeFailure")<<
"Found histograms with different axis limits '"<<iOriginal->GetName()<<
"' not merged.";
93 mergeTogether(iElement->
getTH1F(),iHist);
96 return iStore.
book1S(iName, iHist);
99 mergeTogether(iElement->
getTH1S(),iHist);
102 return iStore.
book1DD(iName, iHist);
105 mergeTogether(iElement->
getTH1D(),iHist);
108 return iStore.
book2D(iName, iHist);
111 mergeTogether(iElement->
getTH2F(),iHist);
114 return iStore.
book2S(iName, iHist);
117 mergeTogether(iElement->
getTH2S(),iHist);
120 return iStore.
book2DD(iName, iHist);
123 mergeTogether(iElement->
getTH2D(),iHist);
126 return iStore.
book3D(iName, iHist);
129 mergeTogether(iElement->
getTH3F(),iHist);
134 void mergeWithElement(
MonitorElement* iElement, TProfile* iHist) {
140 void mergeWithElement(
MonitorElement* iElement, TProfile2D* iHist) {
151 void mergeWithElement(
MonitorElement* iElement, Long64_t& iValue) {
153 if(name.find(
"EventInfo/processedEvents") != std::string::npos) {
156 if(name.find(
"EventInfo/iEvent") != std::string::npos ||
157 name.find(
"EventInfo/iLumiSection") != std::string::npos) {
159 iElement->
Fill(iValue);
180 void splitName(
const std::string& iFullName, std::string& oPath,
const char*& oName) {
182 size_t index = oPath.find_last_of(
'/');
183 if(index == std::string::npos) {
184 oPath = std::string();
185 oName = iFullName.c_str();
188 oName = iFullName.c_str()+index+1;
192 struct RunLumiToRange {
193 unsigned int m_run, m_lumi,m_historyIDIndex;
194 ULong64_t m_beginTime;
196 ULong64_t m_firstIndex, m_lastIndex;
200 class TreeReaderBase {
203 virtual ~TreeReaderBase() {}
206 return doRead(iIndex,iStore,iIsLumi);
208 virtual void setTree(TTree* iTree) =0;
216 class TreeObjectReader:
public TreeReaderBase {
218 TreeObjectReader():m_tree(0),m_fullName(0),m_buffer(0),m_tag(0){
221 m_tree->GetEntry(iIndex);
226 splitName(*m_fullName, path,name);
228 element = createElement(iStore,name,m_buffer);
231 mergeWithElement(element,m_buffer);
234 iStore.
tag(element,m_tag);
238 virtual void setTree(TTree* iTree) {
246 std::string* m_fullName;
252 class TreeSimpleReader :
public TreeReaderBase {
254 TreeSimpleReader():m_tree(0),m_fullName(0),m_buffer(),m_tag(0){
257 m_tree->GetEntry(iIndex);
262 splitName(*m_fullName, path,name);
264 element = createElement(iStore,name,m_buffer);
267 mergeWithElement(element, m_buffer);
270 iStore.
tag(element,m_tag);
274 virtual void setTree(TTree* iTree) {
282 std::string* m_fullName;
313 virtual boost::shared_ptr<edm::RunPrincipal>
readRun_(boost::shared_ptr<edm::RunPrincipal> rpCache);
314 virtual boost::shared_ptr<edm::LuminosityBlockPrincipal>
readLuminosityBlock_( boost::shared_ptr<edm::LuminosityBlockPrincipal> lbCache);
317 virtual boost::shared_ptr<edm::FileBlock>
readFile_();
369 desc.
addUntracked<std::vector<std::string> >(
"fileNames")
370 ->setComment(
"Names of files to be processed.");
372 ->setComment(
"Just limit the process to the selected run.");
373 desc.
addUntracked<std::string>(
"overrideCatalog",std::string())
374 ->setComment(
"An alternate file catalog to use instead of the standard site one.");
382 m_catalog(iPSet.getUntrackedParameter<std::vector<std::string> >(
"fileNames"),
383 iPSet.getUntrackedParameter<std::string>(
"overrideCatalog")),
386 m_presentlyOpenFileIndex(0),
388 m_treeReaders(
kNIndicies,boost::shared_ptr<TreeReaderBase>()),
390 m_filterOnRun(iPSet.getUntrackedParameter<unsigned int>(
"filterOnRun", 0)),
391 m_justOpenedFileSoNeedToGenerateRunTransition(
false),
392 m_doNotReadRemainingPartsOfFileSinceFrameworkTerminating(
false),
393 m_shouldReadMEs(
true),
394 m_shouldResetRunMEs(
true),
395 m_shouldResetLumiMEs(
true)
446 void operator()(
void*) {}
472 if (runLumiRange.m_run == next.m_run)
481 assert(
m_historyIDs.size() > runLumiRange.m_historyIDIndex);
487 boost::shared_ptr<edm::LuminosityBlockAuxiliary>
496 assert(
m_historyIDs.size() > runLumiRange.m_historyIDIndex);
503 boost::shared_ptr<edm::RunPrincipal>
507 unsigned int runID =rpCache->id().run();
533 std::vector<MonitorElement*> allMEs = (*store).getAllContents(
"");
534 std::vector<MonitorElement*>::iterator it = allMEs.begin();
535 std::vector<MonitorElement*>::iterator itEnd = allMEs.end();
536 for(; it != itEnd; ++it)
540 if ((*it)->getLumiFlag())
550 if(runLumiRange.m_lumi == 0 &&
551 runLumiRange.m_run == rpCache->id().run()) {
559 rpCache->fillRunPrincipal();
563 boost::shared_ptr<edm::LuminosityBlockPrincipal>
568 std::vector<MonitorElement*> allMEs = (*store).getAllContents(
"");
569 std::vector<MonitorElement*>::iterator it = allMEs.begin();
570 std::vector<MonitorElement*>::iterator itEnd = allMEs.end();
572 for( ; it != itEnd; ++it)
575 if ((*it)->getLumiFlag())
585 if (runLumiRange.m_run == lbCache->id().run() &&
586 runLumiRange.m_lumi == lbCache->id().luminosityBlock())
592 lbCache->fillLuminosityBlockPrincipal();
596 boost::shared_ptr<edm::FileBlock>
610 m_file->GetUUID().AsString(),
611 std::vector<std::string>()
639 std::list<unsigned int>::iterator lastItr;
657 bool shouldContinue =
false;
660 shouldContinue =
false;
663 ULong64_t index = runLumiRange.m_firstIndex;
664 ULong64_t endIndex = runLumiRange.m_lastIndex+1;
665 for (; index != endIndex; ++
index)
667 bool isLumi = runLumiRange.m_lumi !=0;
669 reader->read(index,*store,isLumi);
687 if ( (nextRunLumiRange.m_run == runLumiRange.m_run) &&
688 (nextRunLumiRange.m_lumi == runLumiRange.m_lumi) )
690 shouldContinue=
true;
691 runLumiRange = nextRunLumiRange;
694 }
while(shouldContinue);
705 if(runLumiRange.m_lumi ==0) {
725 runLumiRange.m_run=0;
728 bool shouldContinue =
false;
731 shouldContinue =
false;
744 if( (nextRunLumiRange.m_run == runLumiRange.m_run) && (
745 nextRunLumiRange.m_lumi == runLumiRange.m_lumi) ) {
746 shouldContinue=
true;
747 runLumiRange = nextRunLumiRange;
752 }
while(shouldContinue);
771 std::string
const streamerInfo = std::string(
"StreamerInfo");
777 if(
m_file.get() != 0 && iIndex > 0) {
788 ex <<
"\nInput file " <<
m_catalog.
fileNames()[iIndex] <<
" was not found, could not be opened, or is corrupted.\n";
791 if(not
m_file->IsZombie()) {
800 if(0 != strcmp(
m_file->GetTitle(),
"1")) {
802 ex<<
"Input file "<<
m_catalog.
fileNames()[iIndex].c_str() <<
" does not appear to be a DQM Root file.\n";
809 ex<<
"Input file "<<
m_catalog.
fileNames()[iIndex].c_str() <<
" appears to be corrupted since it does not have the proper internal structure.\n"
810 " Check to see if the file was closed properly.\n";
815 assert(0!=parameterSetTree);
821 std::string* pBlob = &blob;
823 for(
unsigned int index = 0; index != parameterSetTree->GetEntries();++
index)
825 parameterSetTree->GetEntry(index);
834 assert(0!=processHistoryTree);
835 unsigned int phIndex = 0;
837 std::string processName;
838 std::string* pProcessName = &processName;
840 std::string parameterSetIDBlob;
841 std::string* pParameterSetIDBlob = ¶meterSetIDBlob;
843 std::string releaseVersion;
844 std::string* pReleaseVersion = &releaseVersion;
847 std::string* pPassID = &passID;
854 std::vector<edm::ProcessConfiguration>
configs;
856 for(
unsigned int i=0;
i != processHistoryTree->GetEntries(); ++
i) {
857 processHistoryTree->GetEntry(
i);
859 if(not configs.empty()) {
869 configs.push_back(pc);
871 if(not configs.empty()) {
881 assert(0!=indicesTree);
888 indicesTree->SetBranchAddress(
kRunBranch,&temp.m_run);
889 indicesTree->SetBranchAddress(
kLumiBranch,&temp.m_lumi);
893 indicesTree->SetBranchAddress(
kTypeBranch,&temp.m_type);
894 indicesTree->SetBranchAddress(
kFirstIndex,&temp.m_firstIndex);
895 indicesTree->SetBranchAddress(
kLastIndex,&temp.m_lastIndex);
906 typedef std::map<std::pair<unsigned int, unsigned int>, std::list<unsigned int>::iterator > RunLumiToLastEntryMap;
907 RunLumiToLastEntryMap runLumiToLastEntryMap;
911 typedef std::map<unsigned int, std::pair< std::list<unsigned int>::iterator, std::list<unsigned int>::iterator> > RunToFirstLastEntryMap;
912 RunToFirstLastEntryMap runToFirstLastEntryMap;
914 for (Long64_t index = 0; index != indicesTree->GetEntries(); ++
index)
916 indicesTree->GetEntry(index);
926 std::pair<unsigned int, unsigned int> runLumi(temp.m_run,temp.m_lumi);
928 RunLumiToLastEntryMap::iterator itFind = runLumiToLastEntryMap.find(runLumi);
929 if (itFind == runLumiToLastEntryMap.end())
934 RunToFirstLastEntryMap::iterator itRunFirstLastEntryFind = runToFirstLastEntryMap.find(temp.m_run);
935 bool needNewEntryInRunFirstLastEntryMap =
true;
936 if (itRunFirstLastEntryFind != runToFirstLastEntryMap.end())
938 needNewEntryInRunFirstLastEntryMap=
false;
942 itLastOfRun = itRunFirstLastEntryFind->second.second;
949 itLastOfRun = itRunFirstLastEntryFind->second.first;
952 std::list<unsigned int>::iterator iter =
m_orderedIndices.insert(itLastOfRun,index);
953 runLumiToLastEntryMap[runLumi]=iter;
954 if (needNewEntryInRunFirstLastEntryMap)
955 runToFirstLastEntryMap[temp.m_run]=std::make_pair(iter,iter);
961 runToFirstLastEntryMap[temp.m_run].second = iter;
967 runToFirstLastEntryMap[temp.m_run].first = iter;
975 std::list<unsigned int>::iterator itNext = itFind->second;
977 std::list<unsigned int>::iterator iter =
m_orderedIndices.insert(itNext,index);
978 RunToFirstLastEntryMap::iterator itRunFirstLastEntryFind = runToFirstLastEntryMap.find(temp.m_run);
979 if (itRunFirstLastEntryFind->second.second == itFind->second)
982 itRunFirstLastEntryFind->second.second = iter;
984 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
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)
bool m_doNotReadRemainingPartsOfFileSinceFrameworkTerminating
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
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.
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
static ThreadSafeRegistry * instance()
std::list< unsigned int >::iterator m_presentIndexItr
unsigned int m_filterOnRun
std::set< MonitorElement * > m_runElements
TH2D * getTH2D(void) const
bool m_shouldResetLumiMEs
MonitorElement * book1DD(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1S histogram.
MonitorElement * bookFloat(const char *name)
Book float.
void tag(MonitorElement *me, unsigned int myTag)
virtual edm::InputSource::ItemType getNextItemType()
std::vector< RunLumiToRange > m_runlumiToRange
virtual void endLuminosityBlock(edm::LuminosityBlock &)
void addDefault(ParameterSetDescription const &psetDescription)
edm::LuminosityBlockAuxiliary m_lumiAux
std::vector< edm::ProcessHistoryID > m_historyIDs
void inputFileClosed(Token fileToken)
MonitorElement * bookString(const char *name, const char *value)
Book string.
bool m_justOpenedFileSoNeedToGenerateRunTransition
edm::InputFileCatalog m_catalog
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
int64_t getIntValue(void) const
std::string toString() const
TH1F * getTH1F(void) const
void addContext(std::string const &context)
TProfile * getTProfile(void) const
void reportInputLumiSection(unsigned int run, unsigned int lumiSectId)
void setupFile(unsigned int iIndex)
std::list< unsigned int >::iterator m_nextIndexItr
void setProcessHistoryID(ProcessHistoryID const &phid)
virtual edm::EventPrincipal * readEvent_()
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.
bool insertMapped(value_type const &v)
ProcessHistoryID id() const
unsigned int m_lastSeenRun
virtual boost::shared_ptr< edm::FileBlock > readFile_()
virtual void endRun(edm::Run &)
MonitorElement * book1S(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1S histogram.
void setCurrentFolder(const std::string &fullpath)
LuminosityBlockID const & id() const
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")