Definition at line 289 of file DQMRootSource.cc.
DQMRootSource::DQMRootSource | ( | edm::ParameterSet const & | iPSet, |
const edm::InputSourceDescription & | iDesc | ||
) |
Definition at line 380 of file DQMRootSource.cc.
References edm::InputFileCatalog::fileNames(), edm::InputSource::IsStop, kFloatIndex, kIntIndex, kStringIndex, kTH1DIndex, kTH1FIndex, kTH1SIndex, kTH2DIndex, kTH2FIndex, kTH2SIndex, kTH3FIndex, kTProfile2DIndex, kTProfileIndex, m_catalog, m_fileIndex, m_nextItemType, and m_treeReaders.
: edm::InputSource(iPSet,iDesc), m_catalog(iPSet.getUntrackedParameter<std::vector<std::string> >("fileNames"), iPSet.getUntrackedParameter<std::string>("overrideCatalog")), m_nextItemType(edm::InputSource::IsFile), m_fileIndex(0), m_presentlyOpenFileIndex(0), m_trees(kNIndicies,static_cast<TTree*>(0)), m_treeReaders(kNIndicies,boost::shared_ptr<TreeReaderBase>()), m_lastSeenRun(0), m_filterOnRun(iPSet.getUntrackedParameter<unsigned int>("filterOnRun", 0)), m_justOpenedFileSoNeedToGenerateRunTransition(false), m_doNotReadRemainingPartsOfFileSinceFrameworkTerminating(false), m_shouldReadMEs(true), m_shouldResetRunMEs(true), m_shouldResetLumiMEs(true) { if(m_fileIndex ==m_catalog.fileNames().size()) { m_nextItemType=edm::InputSource::IsStop; } else{ m_treeReaders[kIntIndex].reset(new TreeSimpleReader<Long64_t>()); m_treeReaders[kFloatIndex].reset(new TreeSimpleReader<double>()); m_treeReaders[kStringIndex].reset(new TreeObjectReader<std::string>()); m_treeReaders[kTH1FIndex].reset(new TreeObjectReader<TH1F>()); m_treeReaders[kTH1SIndex].reset(new TreeObjectReader<TH1S>()); m_treeReaders[kTH1DIndex].reset(new TreeObjectReader<TH1D>()); m_treeReaders[kTH2FIndex].reset(new TreeObjectReader<TH2F>()); m_treeReaders[kTH2SIndex].reset(new TreeObjectReader<TH2S>()); m_treeReaders[kTH2DIndex].reset(new TreeObjectReader<TH2D>()); m_treeReaders[kTH3FIndex].reset(new TreeObjectReader<TH3F>()); m_treeReaders[kTProfileIndex].reset(new TreeObjectReader<TProfile>()); m_treeReaders[kTProfile2DIndex].reset(new TreeObjectReader<TProfile2D>()); } }
DQMRootSource::~DQMRootSource | ( | ) | [virtual] |
Definition at line 421 of file DQMRootSource.cc.
References edm::InputFileCatalog::fileNames(), logFileAction(), m_catalog, m_file, and m_presentlyOpenFileIndex.
{ if(m_file.get() != 0 && m_file->IsOpen()) { m_file->Close(); logFileAction(" Closed file ", m_catalog.fileNames()[m_presentlyOpenFileIndex].c_str()); } }
DQMRootSource::DQMRootSource | ( | const DQMRootSource & | ) | [private] |
void DQMRootSource::closeFile_ | ( | ) | [private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 633 of file DQMRootSource.cc.
References m_doNotReadRemainingPartsOfFileSinceFrameworkTerminating, m_jrToken, m_orderedIndices, m_presentIndexItr, and readElements().
{ //std::cout <<"closeFile_"<<std::endl; //when going from one file to the next the framework does not call // 'endRun' or 'endLumi' until it looks to see if the other file contains // a new run or lumi. If the other file doesn't then if(not m_doNotReadRemainingPartsOfFileSinceFrameworkTerminating) { std::list<unsigned int>::iterator lastItr; while(m_presentIndexItr != m_orderedIndices.end()) { //if the last item in the file has no entries then readElement // will not advance so we have to do it ourselves lastItr = m_presentIndexItr; readElements(); if(lastItr == m_presentIndexItr) { ++m_presentIndexItr; } } } edm::Service<edm::JobReport> jr; jr->inputFileClosed(m_jrToken); }
void DQMRootSource::endLuminosityBlock | ( | edm::LuminosityBlock & | iLumi | ) | [protected, virtual] |
Reimplemented from edm::InputSource.
Definition at line 620 of file DQMRootSource.cc.
{
//std::cout <<"DQMRootSource::endLumi"<<std::endl;
}
void DQMRootSource::endRun | ( | edm::Run & | iRun | ) | [protected, virtual] |
Reimplemented from edm::InputSource.
Definition at line 624 of file DQMRootSource.cc.
References m_doNotReadRemainingPartsOfFileSinceFrameworkTerminating.
{ //std::cout <<"DQMRootSource::endRun"<<std::endl; //NOTE: the framework will call endRun before closeFile in the case //where the frameworks is terminating m_doNotReadRemainingPartsOfFileSinceFrameworkTerminating=true; }
void DQMRootSource::fillDescriptions | ( | edm::ConfigurationDescriptions & | descriptions | ) | [static] |
Reimplemented from edm::InputSource.
Definition at line 367 of file DQMRootSource.cc.
References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::addUntracked().
{ edm::ParameterSetDescription desc; desc.addUntracked<std::vector<std::string> >("fileNames") ->setComment("Names of files to be processed."); desc.addUntracked<unsigned int>("filterOnRun",0) ->setComment("Just limit the process to the selected run."); desc.addUntracked<std::string>("overrideCatalog",std::string()) ->setComment("An alternate file catalog to use instead of the standard site one."); descriptions.addDefault(desc); }
edm::InputSource::ItemType DQMRootSource::getNextItemType | ( | ) | [private, virtual] |
Implements edm::InputSource.
Definition at line 455 of file DQMRootSource.cc.
References m_nextItemType.
{ //std::cout <<"getNextItemType "<<m_nextItemType<<std::endl; return m_nextItemType; }
void DQMRootSource::logFileAction | ( | char const * | msg, |
char const * | fileName | ||
) | const [private] |
Definition at line 1003 of file DQMRootSource.cc.
References convertXMLtoSQLite_cfg::fileName, and edm::FlushMessageLog().
Referenced by setupFile(), and ~DQMRootSource().
{ edm::LogAbsolute("fileAction") << std::setprecision(0) << edm::TimeOfDay() << msg << fileName; edm::FlushMessageLog(); }
const DQMRootSource& DQMRootSource::operator= | ( | const DQMRootSource & | ) | [private] |
void DQMRootSource::readElements | ( | ) | [private] |
Definition at line 654 of file DQMRootSource.cc.
References getHLTprescales::index, kNoTypesStored, m_orderedIndices, m_presentIndexItr, m_runlumiToRange, m_shouldReadMEs, m_treeReaders, and matplotRender::reader.
Referenced by closeFile_(), readLuminosityBlock_(), and readRun_().
{ edm::Service<DQMStore> store; RunLumiToRange runLumiRange = m_runlumiToRange[*m_presentIndexItr]; bool shouldContinue = false; do { shouldContinue = false; if(runLumiRange.m_type == kNoTypesStored) {continue;} boost::shared_ptr<TreeReaderBase> reader = m_treeReaders[runLumiRange.m_type]; ULong64_t index = runLumiRange.m_firstIndex; ULong64_t endIndex = runLumiRange.m_lastIndex+1; for (; index != endIndex; ++index) { bool isLumi = runLumiRange.m_lumi !=0; if (m_shouldReadMEs) reader->read(index,*store,isLumi); // if (isLumi) // { // std::cout << runLumiRange.m_run << " " << runLumiRange.m_lumi << " lumi element "<< element->getFullname()<<" "<<index<< " " << runLumiRange.m_type << std::endl; // m_lumiElements.insert(element); // } // else // { // std::cout << runLumiRange.m_run << " " << runLumiRange.m_lumi << " run element "<< element->getFullname()<<" "<<index<< " " << runLumiRange.m_type << std::endl; // m_runElements.insert(element); // } } ++m_presentIndexItr; if (m_presentIndexItr != m_orderedIndices.end()) { //are there more parts to this same run/lumi? const RunLumiToRange nextRunLumiRange = m_runlumiToRange[*m_presentIndexItr]; //continue to the next item if that item is either if ( (nextRunLumiRange.m_run == runLumiRange.m_run) && (nextRunLumiRange.m_lumi == runLumiRange.m_lumi) ) { shouldContinue= true; runLumiRange = nextRunLumiRange; } } } while(shouldContinue); }
edm::EventPrincipal * DQMRootSource::readEvent_ | ( | ) | [private, virtual] |
boost::shared_ptr< edm::FileBlock > DQMRootSource::readFile_ | ( | ) | [private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 597 of file DQMRootSource.cc.
References edm::InputFileCatalog::fileNames(), edm::InputFileCatalog::logicalFileNames(), m_catalog, m_doNotReadRemainingPartsOfFileSinceFrameworkTerminating, m_file, m_fileIndex, m_jrToken, readNextItemType(), and setupFile().
{ //std::cout <<"readFile_"<<std::endl; setupFile(m_fileIndex); ++m_fileIndex; readNextItemType(); edm::Service<edm::JobReport> jr; m_jrToken = jr->inputFileOpened(m_catalog.fileNames()[m_fileIndex-1], m_catalog.logicalFileNames()[m_fileIndex-1], std::string(), std::string(), "DQMRootSource", "source", m_file->GetUUID().AsString(),//edm::createGlobalIdentifier(), std::vector<std::string>() ); m_doNotReadRemainingPartsOfFileSinceFrameworkTerminating = false; return boost::shared_ptr<edm::FileBlock>(new edm::FileBlock); }
boost::shared_ptr< edm::LuminosityBlockPrincipal > DQMRootSource::readLuminosityBlock_ | ( | boost::shared_ptr< edm::LuminosityBlockPrincipal > | lbCache | ) | [private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 564 of file DQMRootSource.cc.
References m_presentIndexItr, m_runlumiToRange, m_shouldResetLumiMEs, readElements(), and readNextItemType().
{ //NOTE: need to reset all lumi block elements at this point edm::Service<DQMStore> store; std::vector<MonitorElement*> allMEs = (*store).getAllContents(""); std::vector<MonitorElement*>::iterator it = allMEs.begin(); std::vector<MonitorElement*>::iterator itEnd = allMEs.end(); if (m_shouldResetLumiMEs) for( ; it != itEnd; ++it) { // We do not want to reset Run Products here! if ((*it)->getLumiFlag()) { // std::cout <<"RESETTING "<<(*it)->getName()<<std::endl; (*it)->Reset(); } } readNextItemType(); //std::cout <<"readLuminosityBlock_"<<std::endl; RunLumiToRange runLumiRange = m_runlumiToRange[*m_presentIndexItr]; if (runLumiRange.m_run == lbCache->id().run() && runLumiRange.m_lumi == lbCache->id().luminosityBlock()) readElements(); edm::Service<edm::JobReport> jr; jr->reportInputLumiSection(lbCache->id().run(),lbCache->id().luminosityBlock()); lbCache->fillLuminosityBlockPrincipal(); return lbCache; }
boost::shared_ptr< edm::LuminosityBlockAuxiliary > DQMRootSource::readLuminosityBlockAuxiliary_ | ( | ) | [private, virtual] |
Implements edm::InputSource.
Definition at line 488 of file DQMRootSource.cc.
References m_historyIDs, m_lumiAux, m_nextIndexItr, m_orderedIndices, m_runlumiToRange, and edm::LuminosityBlockAuxiliary::setProcessHistoryID().
{ //std::cout <<"readLuminosityBlockAuxiliary_"<<std::endl; assert(m_nextIndexItr != m_orderedIndices.end()); const RunLumiToRange runLumiRange = m_runlumiToRange[*m_nextIndexItr]; m_lumiAux = edm::LuminosityBlockAuxiliary(edm::LuminosityBlockID(runLumiRange.m_run,runLumiRange.m_lumi), edm::Timestamp(runLumiRange.m_beginTime), edm::Timestamp(runLumiRange.m_endTime)); assert(m_historyIDs.size() > runLumiRange.m_historyIDIndex); //std::cout <<"lumi "<<m_lumiAux.beginTime().value()<<" "<<runLumiRange.m_beginTime<<std::endl; m_lumiAux.setProcessHistoryID(m_historyIDs[runLumiRange.m_historyIDIndex]); return boost::shared_ptr<edm::LuminosityBlockAuxiliary>(new edm::LuminosityBlockAuxiliary(m_lumiAux)); }
void DQMRootSource::readNextItemType | ( | ) | [private] |
Definition at line 697 of file DQMRootSource.cc.
References edm::InputFileCatalog::fileNames(), edm::LuminosityBlockAuxiliary::id(), edm::RunAuxiliary::id(), edm::InputSource::IsFile, edm::InputSource::IsLumi, edm::InputSource::IsRun, edm::InputSource::IsStop, m_catalog, m_fileIndex, m_justOpenedFileSoNeedToGenerateRunTransition, m_lastSeenRun, m_lumiAux, m_nextIndexItr, m_nextItemType, m_orderedIndices, m_runAux, and m_runlumiToRange.
Referenced by readFile_(), readLuminosityBlock_(), and readRun_().
{ //Do the work of actually figuring out where next to go RunLumiToRange runLumiRange = m_runlumiToRange[*m_nextIndexItr]; if (m_nextItemType !=edm::InputSource::IsFile) { assert (m_nextIndexItr != m_orderedIndices.end()); if(runLumiRange.m_lumi ==0) { //std::cout <<"reading run "<<runLumiRange.m_run<<std::endl; m_runAux.id() = edm::RunID(runLumiRange.m_run); } else { if(m_nextItemType == edm::InputSource::IsRun) { //std::cout <<" proceeding with dummy run"; m_nextItemType = edm::InputSource::IsLumi; return; } //std::cout <<"reading lumi "<<runLumiRange.m_run<<","<<runLumiRange.m_lumi<<std::endl; m_lumiAux.id() = edm::LuminosityBlockID(runLumiRange.m_run,runLumiRange.m_lumi); } ++m_nextIndexItr; } else { //NOTE: the following causes the iterator to move to before //'begin' but that is OK since the first thing in the 'do while' //loop is to advance the iterator which puts us at the first entry //in the file runLumiRange.m_run=0; } bool shouldContinue = false; do { shouldContinue = false; if (m_nextIndexItr == m_orderedIndices.end()) { //go to next file m_nextItemType = edm::InputSource::IsFile; //std::cout <<"going to next file"<<std::endl; if(m_fileIndex == m_catalog.fileNames().size()) { m_nextItemType = edm::InputSource::IsStop; } break; } const RunLumiToRange nextRunLumiRange = m_runlumiToRange[*m_nextIndexItr]; //continue to the next item if that item is the same run or lumi as we just did if( (nextRunLumiRange.m_run == runLumiRange.m_run) && ( nextRunLumiRange.m_lumi == runLumiRange.m_lumi) ) { shouldContinue= true; runLumiRange = nextRunLumiRange; ++m_nextIndexItr; //std::cout <<" advancing " <<nextRunLumiRange.m_run<<" "<<nextRunLumiRange.m_lumi<<std::endl; } } while(shouldContinue); if(m_nextIndexItr != m_orderedIndices.end()) { if(m_runlumiToRange[*m_nextIndexItr].m_lumi == 0 && (m_justOpenedFileSoNeedToGenerateRunTransition || m_lastSeenRun != m_runlumiToRange[*m_nextIndexItr].m_run) ) { m_nextItemType = edm::InputSource::IsRun; //std::cout <<" next is run"<<std::endl; } else { if(m_runlumiToRange[*m_nextIndexItr].m_run != m_lastSeenRun || m_justOpenedFileSoNeedToGenerateRunTransition ) { //we have to create a dummy Run since we switched to a lumi in a new run //std::cout <<" next is dummy run "<<m_justOpenedFileSoNeedToGenerateRunTransition<<std::endl; m_nextItemType = edm::InputSource::IsRun; } else { m_nextItemType = edm::InputSource::IsLumi; } } } }
boost::shared_ptr< edm::RunPrincipal > DQMRootSource::readRun_ | ( | boost::shared_ptr< edm::RunPrincipal > | rpCache | ) | [private, virtual] |
We should indeed be sure to reset all histograms after a run transition, but we should definitely avoid doing it using a local, private copy of the actual content of the DQMStore. Clients are completely free to delete/add MonitorElements from the DQMStore and the local copy stored in the std::set will never notice it until it will try to reset a deleted object. That's why the resetting directly queries the DQMStore for its current content.
Reimplemented from edm::InputSource.
Definition at line 504 of file DQMRootSource.cc.
References m_filterOnRun, m_justOpenedFileSoNeedToGenerateRunTransition, m_lastSeenRun, m_orderedIndices, m_presentIndexItr, m_runlumiToRange, m_shouldReadMEs, m_shouldResetLumiMEs, m_shouldResetRunMEs, readElements(), and readNextItemType().
{ m_justOpenedFileSoNeedToGenerateRunTransition = false; unsigned int runID =rpCache->id().run(); unsigned int lastRunID = m_lastSeenRun; m_shouldReadMEs = (m_filterOnRun == 0 || (m_filterOnRun != 0 && m_filterOnRun == runID)); m_shouldResetRunMEs = m_shouldReadMEs; m_shouldResetLumiMEs = m_shouldReadMEs; // std::cout <<"readRun_"<<std::endl; // std::cout <<"m_shouldReadMEs " << m_shouldReadMEs <<std::endl; // std::cout <<"m_shouldResetRunMEs " << m_shouldResetRunMEs <<std::endl; // std::cout <<"m_shouldResetLumiMEs " << m_shouldResetLumiMEs <<std::endl; m_lastSeenRun = runID; readNextItemType(); //NOTE: need to reset all run elements at this point if(lastRunID != runID && m_shouldResetRunMEs) { edm::Service<DQMStore> store; std::vector<MonitorElement*> allMEs = (*store).getAllContents(""); std::vector<MonitorElement*>::iterator it = allMEs.begin(); std::vector<MonitorElement*>::iterator itEnd = allMEs.end(); for(; it != itEnd; ++it) { // We do not want to reset here Lumi products, since a dedicated // resetting is done at every lumi transition. if ((*it)->getLumiFlag()) continue; // std::cout <<"RESETTING "<<(*it)->getFullname()<<std::endl; (*it)->Reset(); } } if(m_presentIndexItr != m_orderedIndices.end()) { RunLumiToRange runLumiRange = m_runlumiToRange[*m_presentIndexItr]; //NOTE: it is possible to have an Run when all we have stored is lumis if(runLumiRange.m_lumi == 0 && runLumiRange.m_run == rpCache->id().run()) { readElements(); } } edm::Service<edm::JobReport> jr; jr->reportInputRunNumber(rpCache->id().run()); rpCache->fillRunPrincipal(); return rpCache; }
boost::shared_ptr< edm::RunAuxiliary > DQMRootSource::readRunAuxiliary_ | ( | ) | [private, virtual] |
Implements edm::InputSource.
Definition at line 461 of file DQMRootSource.cc.
References getHLTprescales::index, m_historyIDs, m_nextIndexItr, m_orderedIndices, m_runAux, m_runlumiToRange, and edm::RunAuxiliary::setProcessHistoryID().
{ //std::cout <<"readRunAuxiliary_"<<std::endl; assert(m_nextIndexItr != m_orderedIndices.end()); unsigned int index = *m_nextIndexItr; RunLumiToRange runLumiRange = m_runlumiToRange[index]; //NOTE: this could be a lumi instead of the actual run. We need to find the time for the run // so we will scan forward while (runLumiRange.m_lumi !=0 && ++index<m_runlumiToRange.size()) { const RunLumiToRange& next = m_runlumiToRange[index]; if (runLumiRange.m_run == next.m_run) runLumiRange = next; else break; } //NOTE: the setBeginTime and setEndTime functions of RunAuxiliary only work if the previous value was invalid // therefore we must copy m_runAux = edm::RunAuxiliary(runLumiRange.m_run,edm::Timestamp(runLumiRange.m_beginTime),edm::Timestamp(runLumiRange.m_endTime)); assert(m_historyIDs.size() > runLumiRange.m_historyIDIndex); //std::cout <<"readRunAuxiliary_ "<<m_historyIDs[runLumiRange.m_historyIDIndex]<<std::endl; m_runAux.setProcessHistoryID(m_historyIDs[runLumiRange.m_historyIDIndex]); return boost::shared_ptr<edm::RunAuxiliary>( new edm::RunAuxiliary(m_runAux) ); }
void DQMRootSource::setupFile | ( | unsigned int | iIndex | ) | [private] |
Definition at line 775 of file DQMRootSource.cc.
References cms::Exception::addContext(), cmsPerfCommons::configs, cms::Digest::digest(), edm::InputFileCatalog::fileNames(), edm::errors::FileOpenError, edm::errors::FileReadError, i, edm::ProcessHistory::id(), getHLTprescales::index, edm::detail::ThreadSafeRegistry< KEY, T, E >::insertMapped(), instance, kBeginTimeBranch, kEndTimeBranch, kFirstIndex, kIndicesTree, kLastIndex, kLumiBranch, kMetaDataDirectoryAbsolute, kNIndicies, kParameterSetBranch, kParameterSetTree, kPHIndexBranch, kProcessConfigurationParameterSetIDBranch, kProcessConfigurationPassID, kProcessConfigurationProcessNameBranch, kProcessConfigurationReleaseVersion, kProcessHistoryIndexBranch, kProcessHistoryTree, kRunBranch, kTypeBranch, kTypeNames, logFileAction(), m_catalog, m_file, m_historyIDs, m_justOpenedFileSoNeedToGenerateRunTransition, m_nextIndexItr, m_orderedIndices, m_presentIndexItr, m_presentlyOpenFileIndex, m_runlumiToRange, m_treeReaders, m_trees, and groupFilesInBlocks::temp.
Referenced by readFile_().
{ if(m_file.get() != 0 && iIndex > 0) { m_file->Close(); logFileAction(" Closed file ", m_catalog.fileNames()[iIndex-1].c_str()); } logFileAction(" Initiating request to open file ", m_catalog.fileNames()[iIndex].c_str()); m_presentlyOpenFileIndex = iIndex; try { m_file = std::auto_ptr<TFile>(TFile::Open(m_catalog.fileNames()[iIndex].c_str())); } catch(cms::Exception const& e) { edm::Exception ex(edm::errors::FileOpenError,"",e); ex.addContext("Opening DQM Root file"); ex <<"\nInput file " << m_catalog.fileNames()[iIndex] << " was not found, could not be opened, or is corrupted.\n"; throw ex; } if(not m_file->IsZombie()) { logFileAction(" Successfully opened file ", m_catalog.fileNames()[iIndex].c_str()); } else { edm::Exception ex(edm::errors::FileOpenError); ex<<"Input file "<<m_catalog.fileNames()[iIndex].c_str() <<" could not be opened.\n"; ex.addContext("Opening DQM Root file"); throw ex; } //Check file format version, which is encoded in the Title of the TFile if(0 != strcmp(m_file->GetTitle(),"1")) { edm::Exception ex(edm::errors::FileReadError); ex<<"Input file "<<m_catalog.fileNames()[iIndex].c_str() <<" does not appear to be a DQM Root file.\n"; } //Get meta Data TDirectory* metaDir = m_file->GetDirectory(kMetaDataDirectoryAbsolute); if(0==metaDir) { edm::Exception ex(edm::errors::FileReadError); ex<<"Input file "<<m_catalog.fileNames()[iIndex].c_str() <<" appears to be corrupted since it does not have the proper internal structure.\n" " Check to see if the file was closed properly.\n"; ex.addContext("Opening DQM Root file"); throw ex; } TTree* parameterSetTree = dynamic_cast<TTree*>(metaDir->Get(kParameterSetTree)); assert(0!=parameterSetTree); edm::pset::Registry* psr = edm::pset::Registry::instance(); assert(0!=psr); { std::string blob; std::string* pBlob = &blob; parameterSetTree->SetBranchAddress(kParameterSetBranch,&pBlob); for(unsigned int index = 0; index != parameterSetTree->GetEntries();++index) { parameterSetTree->GetEntry(index); cms::Digest dg(blob); edm::ParameterSetID psID(dg.digest().toString()); edm::ParameterSet temp(blob,psID); } } { TTree* processHistoryTree = dynamic_cast<TTree*>(metaDir->Get(kProcessHistoryTree)); assert(0!=processHistoryTree); unsigned int phIndex = 0; processHistoryTree->SetBranchAddress(kPHIndexBranch,&phIndex); std::string processName; std::string* pProcessName = &processName; processHistoryTree->SetBranchAddress(kProcessConfigurationProcessNameBranch,&pProcessName); std::string parameterSetIDBlob; std::string* pParameterSetIDBlob = ¶meterSetIDBlob; processHistoryTree->SetBranchAddress(kProcessConfigurationParameterSetIDBranch,&pParameterSetIDBlob); std::string releaseVersion; std::string* pReleaseVersion = &releaseVersion; processHistoryTree->SetBranchAddress(kProcessConfigurationReleaseVersion,&pReleaseVersion); std::string passID; std::string* pPassID = &passID; processHistoryTree->SetBranchAddress(kProcessConfigurationPassID,&pPassID); edm::ProcessConfigurationRegistry* pcr = edm::ProcessConfigurationRegistry::instance(); assert(0!=pcr); edm::ProcessHistoryRegistry* phr = edm::ProcessHistoryRegistry::instance(); assert(0!=phr); std::vector<edm::ProcessConfiguration> configs; configs.reserve(5); for(unsigned int i=0; i != processHistoryTree->GetEntries(); ++i) { processHistoryTree->GetEntry(i); if(phIndex==0) { if(not configs.empty()) { edm::ProcessHistory ph(configs); m_historyIDs.push_back(ph.id()); phr->insertMapped(ph); } configs.clear(); } edm::ParameterSetID psetID(parameterSetIDBlob); edm::ProcessConfiguration pc(processName, psetID,releaseVersion,passID); pcr->insertMapped(pc); configs.push_back(pc); } if(not configs.empty()) { edm::ProcessHistory ph(configs); m_historyIDs.push_back(ph.id()); phr->insertMapped( ph); //std::cout <<"inserted "<<ph.id()<<std::endl; } } //Setup the indices TTree* indicesTree = dynamic_cast<TTree*>(m_file->Get(kIndicesTree)); assert(0!=indicesTree); m_runlumiToRange.clear(); m_runlumiToRange.reserve(indicesTree->GetEntries()); m_orderedIndices.clear(); RunLumiToRange temp; indicesTree->SetBranchAddress(kRunBranch,&temp.m_run); indicesTree->SetBranchAddress(kLumiBranch,&temp.m_lumi); indicesTree->SetBranchAddress(kBeginTimeBranch,&temp.m_beginTime); indicesTree->SetBranchAddress(kEndTimeBranch,&temp.m_endTime); indicesTree->SetBranchAddress(kProcessHistoryIndexBranch,&temp.m_historyIDIndex); indicesTree->SetBranchAddress(kTypeBranch,&temp.m_type); indicesTree->SetBranchAddress(kFirstIndex,&temp.m_firstIndex); indicesTree->SetBranchAddress(kLastIndex,&temp.m_lastIndex); //Need to reorder items since if there was a merge done the same Run //and/or Lumi can appear multiple times but we want to process them //all at once //We use a std::list for m_orderedIndices since inserting into the //middle of a std::list does not disrupt the iterators to already //existing entries //The Map is used to see if a Run/Lumi pair has appeared before typedef std::map<std::pair<unsigned int, unsigned int>, std::list<unsigned int>::iterator > RunLumiToLastEntryMap; RunLumiToLastEntryMap runLumiToLastEntryMap; //Need to group all lumis for the same run together and move the run //entry to the beginning typedef std::map<unsigned int, std::pair< std::list<unsigned int>::iterator, std::list<unsigned int>::iterator> > RunToFirstLastEntryMap; RunToFirstLastEntryMap runToFirstLastEntryMap; for (Long64_t index = 0; index != indicesTree->GetEntries(); ++index) { indicesTree->GetEntry(index); // std::cout <<"read r:"<<temp.m_run // <<" l:"<<temp.m_lumi // <<" b:"<<temp.m_beginTime // <<" e:"<<temp.m_endTime // <<" fi:" << temp.m_firstIndex // <<" li:" << temp.m_lastIndex // <<" type:" << temp.m_type << std::endl; m_runlumiToRange.push_back(temp); std::pair<unsigned int, unsigned int> runLumi(temp.m_run,temp.m_lumi); RunLumiToLastEntryMap::iterator itFind = runLumiToLastEntryMap.find(runLumi); if (itFind == runLumiToLastEntryMap.end()) { //does not already exist //does the run for this already exist? std::list<unsigned int>::iterator itLastOfRun = m_orderedIndices.end(); RunToFirstLastEntryMap::iterator itRunFirstLastEntryFind = runToFirstLastEntryMap.find(temp.m_run); bool needNewEntryInRunFirstLastEntryMap = true; if (itRunFirstLastEntryFind != runToFirstLastEntryMap.end()) { needNewEntryInRunFirstLastEntryMap=false; if (temp.m_lumi!=0) { //lumis go to the end itLastOfRun = itRunFirstLastEntryFind->second.second; //we want to insert after this one so must advance the iterator ++itLastOfRun; } else { //runs go at the beginning itLastOfRun = itRunFirstLastEntryFind->second.first; } } std::list<unsigned int>::iterator iter = m_orderedIndices.insert(itLastOfRun,index); runLumiToLastEntryMap[runLumi]=iter; if (needNewEntryInRunFirstLastEntryMap) runToFirstLastEntryMap[temp.m_run]=std::make_pair(iter,iter); else { if(temp.m_lumi!=0) { //lumis go at end runToFirstLastEntryMap[temp.m_run].second = iter; } else { //since we haven't yet seen this run/lumi combination it means we haven't yet seen // a run so we can put this first runToFirstLastEntryMap[temp.m_run].first = iter; } } } else { //We need to do a merge since the run/lumi already appeared. Put it after the existing entry //std::cout <<" found a second instance of "<<runLumi.first<<" "<<runLumi.second<<" at "<<index<<std::endl; std::list<unsigned int>::iterator itNext = itFind->second; ++itNext; std::list<unsigned int>::iterator iter = m_orderedIndices.insert(itNext,index); RunToFirstLastEntryMap::iterator itRunFirstLastEntryFind = runToFirstLastEntryMap.find(temp.m_run); if (itRunFirstLastEntryFind->second.second == itFind->second) { //if the previous one was the last in the run, we need to update to make this one the last itRunFirstLastEntryFind->second.second = iter; } itFind->second = iter; } } m_nextIndexItr = m_orderedIndices.begin(); m_presentIndexItr = m_orderedIndices.begin(); if(m_nextIndexItr != m_orderedIndices.end()) { for( size_t index = 0; index < kNIndicies; ++index) { m_trees[index] = dynamic_cast<TTree*>(m_file->Get(kTypeNames[index])); assert(0!=m_trees[index]); m_treeReaders[index]->setTree(m_trees[index]); } } //After a file open, the framework expects to see a new 'IsRun' //m_lastSeenRun = 0; m_justOpenedFileSoNeedToGenerateRunTransition=true; }
Definition at line 329 of file DQMRootSource.cc.
Referenced by DQMRootSource(), readFile_(), readNextItemType(), setupFile(), and ~DQMRootSource().
Definition at line 347 of file DQMRootSource.cc.
Referenced by closeFile_(), endRun(), and readFile_().
std::auto_ptr<TFile> DQMRootSource::m_file [private] |
Definition at line 339 of file DQMRootSource.cc.
Referenced by readFile_(), setupFile(), and ~DQMRootSource().
size_t DQMRootSource::m_fileIndex [private] |
Definition at line 334 of file DQMRootSource.cc.
Referenced by DQMRootSource(), readFile_(), and readNextItemType().
unsigned int DQMRootSource::m_filterOnRun [private] |
Definition at line 345 of file DQMRootSource.cc.
Referenced by readRun_().
std::vector<edm::ProcessHistoryID> DQMRootSource::m_historyIDs [private] |
Definition at line 353 of file DQMRootSource.cc.
Referenced by readLuminosityBlockAuxiliary_(), readRunAuxiliary_(), and setupFile().
Definition at line 355 of file DQMRootSource.cc.
Referenced by closeFile_(), and readFile_().
bool DQMRootSource::m_justOpenedFileSoNeedToGenerateRunTransition [private] |
Definition at line 346 of file DQMRootSource.cc.
Referenced by readNextItemType(), readRun_(), and setupFile().
unsigned int DQMRootSource::m_lastSeenRun [private] |
Definition at line 344 of file DQMRootSource.cc.
Referenced by readNextItemType(), and readRun_().
Definition at line 331 of file DQMRootSource.cc.
Referenced by readLuminosityBlockAuxiliary_(), and readNextItemType().
std::set<MonitorElement*> DQMRootSource::m_lumiElements [private] |
Definition at line 351 of file DQMRootSource.cc.
std::list<unsigned int>::iterator DQMRootSource::m_nextIndexItr [private] |
Definition at line 336 of file DQMRootSource.cc.
Referenced by readLuminosityBlockAuxiliary_(), readNextItemType(), readRunAuxiliary_(), and setupFile().
Definition at line 332 of file DQMRootSource.cc.
Referenced by DQMRootSource(), getNextItemType(), and readNextItemType().
std::list<unsigned int> DQMRootSource::m_orderedIndices [private] |
Definition at line 343 of file DQMRootSource.cc.
Referenced by closeFile_(), readElements(), readLuminosityBlockAuxiliary_(), readNextItemType(), readRun_(), readRunAuxiliary_(), and setupFile().
std::list<unsigned int>::iterator DQMRootSource::m_presentIndexItr [private] |
Definition at line 337 of file DQMRootSource.cc.
Referenced by closeFile_(), readElements(), readLuminosityBlock_(), readRun_(), and setupFile().
size_t DQMRootSource::m_presentlyOpenFileIndex [private] |
Definition at line 335 of file DQMRootSource.cc.
Referenced by setupFile(), and ~DQMRootSource().
edm::RunAuxiliary DQMRootSource::m_runAux [private] |
Definition at line 330 of file DQMRootSource.cc.
Referenced by readNextItemType(), and readRunAuxiliary_().
std::set<MonitorElement*> DQMRootSource::m_runElements [private] |
Definition at line 352 of file DQMRootSource.cc.
std::vector<RunLumiToRange> DQMRootSource::m_runlumiToRange [private] |
Definition at line 338 of file DQMRootSource.cc.
Referenced by readElements(), readLuminosityBlock_(), readLuminosityBlockAuxiliary_(), readNextItemType(), readRun_(), readRunAuxiliary_(), and setupFile().
bool DQMRootSource::m_shouldReadMEs [private] |
Definition at line 348 of file DQMRootSource.cc.
Referenced by readElements(), and readRun_().
bool DQMRootSource::m_shouldResetLumiMEs [private] |
Definition at line 350 of file DQMRootSource.cc.
Referenced by readLuminosityBlock_(), and readRun_().
bool DQMRootSource::m_shouldResetRunMEs [private] |
Definition at line 349 of file DQMRootSource.cc.
Referenced by readRun_().
std::vector<boost::shared_ptr<TreeReaderBase> > DQMRootSource::m_treeReaders [private] |
Definition at line 341 of file DQMRootSource.cc.
Referenced by DQMRootSource(), readElements(), and setupFile().
std::vector<TTree*> DQMRootSource::m_trees [private] |
Definition at line 340 of file DQMRootSource.cc.
Referenced by setupFile().