Definition at line 291 of file DQMRootSource.cc.
DQMRootSource::DQMRootSource | ( | edm::ParameterSet const & | iPSet, |
const edm::InputSourceDescription & | iDesc | ||
) |
Definition at line 421 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_lastSeenReducedPHID(), m_lastSeenRun(0), m_lastSeenReducedPHID2(), m_lastSeenRun2(0), m_lastSeenLumi2(0), m_filterOnRun(iPSet.getUntrackedParameter<unsigned int>("filterOnRun", 0)), m_justOpenedFileSoNeedToGenerateRunTransition(false), m_shouldReadMEs(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 463 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 645 of file DQMRootSource.cc.
References m_jrToken.
{ edm::Service<edm::JobReport> jr; jr->inputFileClosed(m_jrToken); }
void DQMRootSource::fillDescriptions | ( | edm::ConfigurationDescriptions & | descriptions | ) | [static] |
Reimplemented from edm::InputSource.
Definition at line 408 of file DQMRootSource.cc.
References edm::ConfigurationDescriptions::addDefault(), edm::ParameterSetDescription::addUntracked(), and AlCaHLTBitMon_QueryRunRegistry::string.
{ 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 491 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 985 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 650 of file DQMRootSource.cc.
References getHLTprescales::index, kNoTypesStored, m_orderedIndices, m_presentIndexItr, m_reducedHistoryIDs, m_runlumiToRange, m_shouldReadMEs, m_treeReaders, and matplotRender::reader.
Referenced by readLuminosityBlock_(), and readRun_().
{ edm::Service<DQMStore> store; RunLumiToRange runLumiRange = m_runlumiToRange[*m_presentIndexItr]; bool shouldContinue = false; do { shouldContinue = false; ++m_presentIndexItr; 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); // } } 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 ( (m_reducedHistoryIDs.at(nextRunLumiRange.m_historyIDIndex) == m_reducedHistoryIDs.at(runLumiRange.m_historyIDIndex)) && (nextRunLumiRange.m_run == runLumiRange.m_run) && (nextRunLumiRange.m_lumi == runLumiRange.m_lumi) ) { shouldContinue= true; runLumiRange = nextRunLumiRange; } } } while(shouldContinue); }
edm::EventPrincipal * DQMRootSource::readEvent_ | ( | edm::EventPrincipal & | ) | [private, virtual] |
std::unique_ptr< edm::FileBlock > DQMRootSource::readFile_ | ( | ) | [private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 624 of file DQMRootSource.cc.
References edm::InputFileCatalog::fileNames(), edm::InputFileCatalog::logicalFileNames(), m_catalog, m_file, m_fileIndex, m_jrToken, readNextItemType(), setupFile(), and AlCaHLTBitMon_QueryRunRegistry::string.
{ //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>() ); return std::unique_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 586 of file DQMRootSource.cc.
References m_lastSeenLumi2, m_lastSeenReducedPHID2, m_lastSeenRun2, m_orderedIndices, m_presentIndexItr, m_reducedHistoryIDs, m_runlumiToRange, m_shouldReadMEs, readElements(), and readNextItemType().
{ assert(m_presentIndexItr != m_orderedIndices.end()); RunLumiToRange runLumiRange = m_runlumiToRange[*m_presentIndexItr]; assert(runLumiRange.m_run == lbCache->id().run()); assert(runLumiRange.m_lumi == lbCache->id().luminosityBlock()); //NOTE: need to reset all lumi block elements at this point if( ( m_lastSeenLumi2 != runLumiRange.m_lumi || m_lastSeenRun2 != runLumiRange.m_run || m_lastSeenReducedPHID2 != m_reducedHistoryIDs.at(runLumiRange.m_historyIDIndex) ) && m_shouldReadMEs) { edm::Service<DQMStore> store; std::vector<MonitorElement*> allMEs = (*store).getAllContents(""); for(auto const& ME : allMEs) { // We do not want to reset Run Products here! if (ME->getLumiFlag()) { ME->Reset(); } } m_lastSeenReducedPHID2 = m_reducedHistoryIDs.at(runLumiRange.m_historyIDIndex); m_lastSeenRun2 = runLumiRange.m_run; m_lastSeenLumi2 = runLumiRange.m_lumi; } readNextItemType(); //std::cout <<"readLuminosityBlock_"<<std::endl; 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 513 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 694 of file DQMRootSource.cc.
References edm::InputFileCatalog::fileNames(), edm::InputSource::IsFile, edm::InputSource::IsLumi, edm::InputSource::IsRun, edm::InputSource::IsStop, m_catalog, m_fileIndex, m_justOpenedFileSoNeedToGenerateRunTransition, m_lastSeenReducedPHID, m_lastSeenRun, m_nextIndexItr, m_nextItemType, m_orderedIndices, m_reducedHistoryIDs, and m_runlumiToRange.
Referenced by readFile_(), readLuminosityBlock_(), and readRun_().
{ //Do the work of actually figuring out where next to go assert (m_nextIndexItr != m_orderedIndices.end()); RunLumiToRange runLumiRange = m_runlumiToRange[*m_nextIndexItr]; if (m_nextItemType != edm::InputSource::IsFile) { if (runLumiRange.m_lumi != 0 && m_nextItemType == edm::InputSource::IsRun) { m_nextItemType = edm::InputSource::IsLumi; return; } ++m_nextIndexItr; } else { //NOTE: the following makes the iterator not be advanced in the //do while loop below. 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( (m_reducedHistoryIDs.at(nextRunLumiRange.m_historyIDIndex) == m_reducedHistoryIDs.at(runLumiRange.m_historyIDIndex) ) && (nextRunLumiRange.m_run == runLumiRange.m_run) && (nextRunLumiRange.m_lumi == runLumiRange.m_lumi) ) { shouldContinue= true; ++m_nextIndexItr; //std::cout <<" advancing " <<nextRunLumiRange.m_run<<" "<<nextRunLumiRange.m_lumi<<std::endl; } } while(shouldContinue); if(m_nextIndexItr != m_orderedIndices.end()) { if (m_justOpenedFileSoNeedToGenerateRunTransition || m_lastSeenRun != m_runlumiToRange[*m_nextIndexItr].m_run || m_lastSeenReducedPHID != m_reducedHistoryIDs.at(m_runlumiToRange[*m_nextIndexItr].m_historyIDIndex) ) { 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] |
If the collate option is not set for the DQMStore, 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 529 of file DQMRootSource.cc.
References m_filterOnRun, m_justOpenedFileSoNeedToGenerateRunTransition, m_lastSeenReducedPHID, m_lastSeenRun, m_orderedIndices, m_presentIndexItr, m_reducedHistoryIDs, m_runlumiToRange, m_shouldReadMEs, readElements(), and readNextItemType().
{ assert(m_presentIndexItr != m_orderedIndices.end()); RunLumiToRange runLumiRange = m_runlumiToRange[*m_presentIndexItr]; m_justOpenedFileSoNeedToGenerateRunTransition = false; unsigned int runID =rpCache->id().run(); assert(runID == runLumiRange.m_run); m_shouldReadMEs = (m_filterOnRun == 0 || (m_filterOnRun != 0 && m_filterOnRun == runID)); // std::cout <<"readRun_"<<std::endl; // std::cout <<"m_shouldReadMEs " << m_shouldReadMEs <<std::endl; //NOTE: need to reset all run elements at this point if( m_lastSeenRun != runID || m_lastSeenReducedPHID != m_reducedHistoryIDs.at(runLumiRange.m_historyIDIndex) ) { if (m_shouldReadMEs) { edm::Service<DQMStore> store; std::vector<MonitorElement*> allMEs = (*store).getAllContents(""); for(auto const& ME : allMEs) { // We do not want to reset here Lumi products, since a dedicated // resetting is done at every lumi transition. if (ME->getLumiFlag()) continue; if ( !(*store).isCollate() ) ME->Reset(); } } m_lastSeenReducedPHID = m_reducedHistoryIDs.at(runLumiRange.m_historyIDIndex); m_lastSeenRun = runID; } readNextItemType(); //NOTE: it is possible to have a Run when all we have stored is lumis if(runLumiRange.m_lumi == 0) { 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 497 of file DQMRootSource.cc.
References 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()); RunLumiToRange runLumiRange = m_runlumiToRange[*m_nextIndexItr]; //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 752 of file DQMRootSource.cc.
References cms::Exception::addContext(), electronStore::configs, cms::Digest::digest(), edm::detail::ThreadSafeRegistry< KEY, T, E >::extra(), 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_reducedHistoryIDs, m_runlumiToRange, m_treeReaders, m_trees, AlCaHLTBitMon_QueryRunRegistry::string, 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); m_historyIDs.clear(); m_reducedHistoryIDs.clear(); 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); m_reducedHistoryIDs.push_back(phr->extra().reduceProcessHistoryID(ph.id())); } 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); m_reducedHistoryIDs.push_back(phr->extra().reduceProcessHistoryID(ph.id())); //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<RunLumiPHIDKey, 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<RunPHIDKey, 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); RunLumiPHIDKey runLumi(m_reducedHistoryIDs.at(temp.m_historyIDIndex), temp.m_run, temp.m_lumi); RunPHIDKey runKey(m_reducedHistoryIDs.at(temp.m_historyIDIndex), temp.m_run); 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(runKey); 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[runKey]=std::make_pair(iter,iter); else { if(temp.m_lumi!=0) { //lumis go at end runToFirstLastEntryMap[runKey].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[runKey].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(runKey); 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_justOpenedFileSoNeedToGenerateRunTransition=true; }
Definition at line 368 of file DQMRootSource.cc.
Referenced by DQMRootSource(), readFile_(), readNextItemType(), setupFile(), and ~DQMRootSource().
std::auto_ptr<TFile> DQMRootSource::m_file [private] |
Definition at line 378 of file DQMRootSource.cc.
Referenced by readFile_(), setupFile(), and ~DQMRootSource().
size_t DQMRootSource::m_fileIndex [private] |
Definition at line 373 of file DQMRootSource.cc.
Referenced by DQMRootSource(), readFile_(), and readNextItemType().
unsigned int DQMRootSource::m_filterOnRun [private] |
Definition at line 388 of file DQMRootSource.cc.
Referenced by readRun_().
std::vector<edm::ProcessHistoryID> DQMRootSource::m_historyIDs [private] |
Definition at line 393 of file DQMRootSource.cc.
Referenced by readLuminosityBlockAuxiliary_(), readRunAuxiliary_(), and setupFile().
Definition at line 396 of file DQMRootSource.cc.
Referenced by closeFile_(), and readFile_().
bool DQMRootSource::m_justOpenedFileSoNeedToGenerateRunTransition [private] |
Definition at line 389 of file DQMRootSource.cc.
Referenced by readNextItemType(), readRun_(), and setupFile().
unsigned int DQMRootSource::m_lastSeenLumi2 [private] |
Definition at line 387 of file DQMRootSource.cc.
Referenced by readLuminosityBlock_().
Definition at line 383 of file DQMRootSource.cc.
Referenced by readNextItemType(), and readRun_().
Definition at line 385 of file DQMRootSource.cc.
Referenced by readLuminosityBlock_().
unsigned int DQMRootSource::m_lastSeenRun [private] |
Definition at line 384 of file DQMRootSource.cc.
Referenced by readNextItemType(), and readRun_().
unsigned int DQMRootSource::m_lastSeenRun2 [private] |
Definition at line 386 of file DQMRootSource.cc.
Referenced by readLuminosityBlock_().
Definition at line 370 of file DQMRootSource.cc.
Referenced by readLuminosityBlockAuxiliary_().
std::set<MonitorElement*> DQMRootSource::m_lumiElements [private] |
Definition at line 391 of file DQMRootSource.cc.
std::list<unsigned int>::iterator DQMRootSource::m_nextIndexItr [private] |
Definition at line 375 of file DQMRootSource.cc.
Referenced by readLuminosityBlockAuxiliary_(), readNextItemType(), readRunAuxiliary_(), and setupFile().
Definition at line 371 of file DQMRootSource.cc.
Referenced by DQMRootSource(), getNextItemType(), and readNextItemType().
std::list<unsigned int> DQMRootSource::m_orderedIndices [private] |
Definition at line 382 of file DQMRootSource.cc.
Referenced by readElements(), readLuminosityBlock_(), readLuminosityBlockAuxiliary_(), readNextItemType(), readRun_(), readRunAuxiliary_(), and setupFile().
std::list<unsigned int>::iterator DQMRootSource::m_presentIndexItr [private] |
Definition at line 376 of file DQMRootSource.cc.
Referenced by readElements(), readLuminosityBlock_(), readRun_(), and setupFile().
size_t DQMRootSource::m_presentlyOpenFileIndex [private] |
Definition at line 374 of file DQMRootSource.cc.
Referenced by setupFile(), and ~DQMRootSource().
std::vector<edm::ProcessHistoryID> DQMRootSource::m_reducedHistoryIDs [private] |
Definition at line 394 of file DQMRootSource.cc.
Referenced by readElements(), readLuminosityBlock_(), readNextItemType(), readRun_(), and setupFile().
edm::RunAuxiliary DQMRootSource::m_runAux [private] |
Definition at line 369 of file DQMRootSource.cc.
Referenced by readRunAuxiliary_().
std::set<MonitorElement*> DQMRootSource::m_runElements [private] |
Definition at line 392 of file DQMRootSource.cc.
std::vector<RunLumiToRange> DQMRootSource::m_runlumiToRange [private] |
Definition at line 377 of file DQMRootSource.cc.
Referenced by readElements(), readLuminosityBlock_(), readLuminosityBlockAuxiliary_(), readNextItemType(), readRun_(), readRunAuxiliary_(), and setupFile().
bool DQMRootSource::m_shouldReadMEs [private] |
Definition at line 390 of file DQMRootSource.cc.
Referenced by readElements(), readLuminosityBlock_(), and readRun_().
std::vector<boost::shared_ptr<TreeReaderBase> > DQMRootSource::m_treeReaders [private] |
Definition at line 380 of file DQMRootSource.cc.
Referenced by DQMRootSource(), readElements(), and setupFile().
std::vector<TTree*> DQMRootSource::m_trees [private] |
Definition at line 379 of file DQMRootSource.cc.
Referenced by setupFile().