#include <RootOutputFile.h>
Definition at line 39 of file RootOutputFile.h.
Definition at line 41 of file RootOutputFile.h.
Definition at line 42 of file RootOutputFile.h.
typedef boost::array<RootOutputTree*, NumBranchTypes> edm::RootOutputFile::RootOutputTreePtrArray |
Definition at line 43 of file RootOutputFile.h.
edm::RootOutputFile::RootOutputFile | ( | PoolOutputModule * | om, |
std::string const & | fileName, | ||
std::string const & | logicalFileName | ||
) | [explicit] |
Definition at line 62 of file RootOutputFile.cc.
References edm::RootOutputTree::addAuxiliary(), edm::RootOutputTree::addBranch(), edm::PoolOutputModule::auxItems(), branchesWithStoredHistory_, edm::poolNames::branchListIndexesBranchName(), edm::BranchDescription::branchName(), revisionDML::branchType(), edm::BranchTypeToAuxiliaryBranchName(), edm::BranchTypeToBranchEntryInfoBranchName(), edm::PoolOutputModule::catalog(), edm::createGlobalIdentifier(), cms::Digest::digest(), edm::PoolOutputModule::eventAutoFlushSize(), edm::poolNames::eventSelectionsBranchName(), eventTree_, fid_, file_, filePtr_, edm::BranchDescription::fullClassName(), i, edm::InEvent, edm::BranchDescription::init(), edm::InLumi, edm::InRun, logicalFile_, lumiTree_, edm::RootOutputTree::makeTTree(), metaDataTree_, edm::poolNames::metaDataTreeName(), edm::BranchDescription::moduleLabel(), edm::PoolOutputModule::moduleLabel(), edm::NumBranchTypes, om_, parameterSetsTree_, edm::poolNames::parameterSetsTreeName(), parentageTree_, edm::poolNames::parentageTreeName(), pBranchListIndexes_, pEventAux_, pEventEntryInfoVector_, pEventSelectionIDs_, pLumiAux_, pLumiEntryInfoVector_, edm::BranchDescription::processName(), edm::BranchDescription::productInstanceName(), pRunAux_, pRunEntryInfoVector_, reportToken_, runTree_, edm::PoolOutputModule::selectedOutputItemList(), edm::RootOutputTree::setAutoFlush(), edm::sort_all(), treePointers_, and edm::BranchDescription::wrappedName().
: file_(fileName), logicalFile_(logicalFileName), reportToken_(0), om_(om), whyNotFastClonable_(om_->whyNotFastClonable()), canFastCloneAux_(false), filePtr_(TFile::Open(file_.c_str(), "recreate", "", om_->compressionLevel())), fid_(), eventEntryNumber_(0LL), lumiEntryNumber_(0LL), runEntryNumber_(0LL), indexIntoFile_(), metaDataTree_(0), parameterSetsTree_(0), parentageTree_(0), lumiAux_(), runAux_(), pEventAux_(0), pLumiAux_(&lumiAux_), pRunAux_(&runAux_), eventEntryInfoVector_(), lumiEntryInfoVector_(), runEntryInfoVector_(), pEventEntryInfoVector_(&eventEntryInfoVector_), pLumiEntryInfoVector_(&lumiEntryInfoVector_), pRunEntryInfoVector_(&runEntryInfoVector_), pBranchListIndexes_(0), pEventSelectionIDs_(0), eventTree_(filePtr_, InEvent, om_->basketSize(), om_->splitLevel(), om_->treeMaxVirtualSize()), lumiTree_(filePtr_, InLumi, om_->basketSize(), om_->splitLevel(), om_->treeMaxVirtualSize()), runTree_(filePtr_, InRun, om_->basketSize(), om_->splitLevel(), om_->treeMaxVirtualSize()), treePointers_(), dataTypeReported_(false), parentageIDs_(), branchesWithStoredHistory_() { if (-1 != om->eventAutoFlushSize()) { eventTree_.setAutoFlush(-1*om->eventAutoFlushSize()); } eventTree_.addAuxiliary<EventAuxiliary>(BranchTypeToAuxiliaryBranchName(InEvent), pEventAux_, om_->auxItems()[InEvent].basketSize_); eventTree_.addAuxiliary<ProductProvenanceVector>(BranchTypeToBranchEntryInfoBranchName(InEvent), pEventEntryInfoVector_, om_->auxItems()[InEvent].basketSize_); eventTree_.addAuxiliary<EventSelectionIDVector>(poolNames::eventSelectionsBranchName(), pEventSelectionIDs_, om_->auxItems()[InEvent].basketSize_); eventTree_.addAuxiliary<BranchListIndexes>(poolNames::branchListIndexesBranchName(), pBranchListIndexes_, om_->auxItems()[InEvent].basketSize_); lumiTree_.addAuxiliary<LuminosityBlockAuxiliary>(BranchTypeToAuxiliaryBranchName(InLumi), pLumiAux_, om_->auxItems()[InLumi].basketSize_); lumiTree_.addAuxiliary<ProductProvenanceVector>(BranchTypeToBranchEntryInfoBranchName(InLumi), pLumiEntryInfoVector_, om_->auxItems()[InLumi].basketSize_); runTree_.addAuxiliary<RunAuxiliary>(BranchTypeToAuxiliaryBranchName(InRun), pRunAux_, om_->auxItems()[InRun].basketSize_); runTree_.addAuxiliary<ProductProvenanceVector>(BranchTypeToBranchEntryInfoBranchName(InRun), pRunEntryInfoVector_, om_->auxItems()[InRun].basketSize_); treePointers_[InEvent] = &eventTree_; treePointers_[InLumi] = &lumiTree_; treePointers_[InRun] = &runTree_; for(int i = InEvent; i < NumBranchTypes; ++i) { BranchType branchType = static_cast<BranchType>(i); RootOutputTree *theTree = treePointers_[branchType]; for(OutputItemList::const_iterator it = om_->selectedOutputItemList()[branchType].begin(), itEnd = om_->selectedOutputItemList()[branchType].end(); it != itEnd; ++it) { BranchDescription const& desc = *it->branchDescription_; desc.init(); theTree->addBranch(desc.branchName(), desc.wrappedName(), it->product_, it->splitLevel_, it->basketSize_, it->branchDescription_->produced()); //make sure we always store product registry info for all branches we create branchesWithStoredHistory_.insert(it->branchID()); } } // Don't split metadata tree or event description tree metaDataTree_ = RootOutputTree::makeTTree(filePtr_.get(), poolNames::metaDataTreeName(), 0); parentageTree_ = RootOutputTree::makeTTree(filePtr_.get(), poolNames::parentageTreeName(), 0); parameterSetsTree_ = RootOutputTree::makeTTree(filePtr_.get(), poolNames::parameterSetsTreeName(), 0); fid_ = FileID(createGlobalIdentifier()); // For the Job Report, get a vector of branch names in the "Events" tree. // Also create a hash of all the branch names in the "Events" tree // in a deterministic order, except use the full class name instead of the friendly class name. // To avoid extra string copies, we create a vector of pointers into the product registry, // and use a custom comparison operator for sorting. std::vector<std::string> branchNames; std::vector<BranchDescription const*> branches; branchNames.reserve(om_->selectedOutputItemList()[InEvent].size()); branches.reserve(om->selectedOutputItemList()[InEvent].size()); for(OutputItemList::const_iterator it = om_->selectedOutputItemList()[InEvent].begin(), itEnd = om_->selectedOutputItemList()[InEvent].end(); it != itEnd; ++it) { branchNames.push_back(it->branchDescription_->branchName()); branches.push_back(it->branchDescription_); } // Now sort the branches for the hash. sort_all(branches, sorterForJobReportHash); // Now, make a concatenated string. std::ostringstream oss; char const underscore = '_'; for(std::vector<BranchDescription const*>::const_iterator it = branches.begin(), itEnd = branches.end(); it != itEnd; ++it) { BranchDescription const& bd = **it; oss << bd.fullClassName() << underscore << bd.moduleLabel() << underscore << bd.productInstanceName() << underscore << bd.processName() << underscore; } std::string stringrep = oss.str(); cms::Digest md5alg(stringrep); // Register the output file with the JobReport service // and get back the token for it. std::string moduleName = "PoolOutputModule"; Service<JobReport> reportSvc; reportToken_ = reportSvc->outputFileOpened( file_, logicalFile_, // PFN and LFN om_->catalog(), // catalog moduleName, // module class name om_->moduleLabel(), // module label fid_.fid(), // file id (guid) std::string(), // data type (not yet known, so string is empty). md5alg.digest().toString(), // branch hash branchNames); // branch names being written }
edm::RootOutputFile::~RootOutputFile | ( | ) | [inline] |
Definition at line 46 of file RootOutputFile.h.
{}
void edm::RootOutputFile::beginInputFile | ( | FileBlock const & | fb, |
int | remainingEvents | ||
) |
Definition at line 281 of file RootOutputFile.cc.
References edm::PoolOutputModule::basketOrder(), edm::FileBlock::branchListIndexesUnchanged(), edm::FileBlock::CanFastClone, canFastCloneAux_, edm::RootOutputTree::checkIfFastClonable(), edm::RootOutputTree::checkSplitLevelsAndBasketSizes(), edm::PoolOutputModule::dropMetaData(), edm::PoolOutputModule::DropNone, eventTree_, Exception, file_, edm::FileBlock::fileFormatVersion(), edm::FileBlock::fileName(), edm::OutputModule::hasNewlyDroppedBranch(), edm::FileBlock::hasNewlyDroppedBranch(), edm::InEvent, edm::PoolOutputModule::inputFileCount(), edm::match(), edm::RootOutputTree::maybeFastCloneTree(), edm::errors::MismatchedInputFiles, edm::FileFormatVersion::noMetaDataTrees(), edm::FileBlock::NoRootInputSource, om_, edm::PoolOutputModule::overrideInputFileSplitLevels(), reportToken_, edm::FileBlock::tree(), edm::PoolOutputModule::whyNotFastClonable(), edm::FileBlock::whyNotFastClonable(), and whyNotFastClonable_.
{ // Reset per input file information whyNotFastClonable_ = om_->whyNotFastClonable(); canFastCloneAux_ = false; if(fb.tree() != 0) { whyNotFastClonable_ |= fb.whyNotFastClonable(); if(remainingEvents >= 0 && remainingEvents < fb.tree()->GetEntries()) { whyNotFastClonable_ |= FileBlock::OutputMaxEventsTooSmall; } bool match = eventTree_.checkSplitLevelsAndBasketSizes(fb.tree()); if(!match) { if(om_->overrideInputFileSplitLevels()) { // We may be fast copying. We must disable fast copying if the split levels // or basket sizes do not match. whyNotFastClonable_ |= FileBlock::SplitLevelMismatch; } else { // We are using the input split levels and basket sizes from the first input file // for copied output branches. In this case, we throw an exception if any branches // have different split levels or basket sizes in a subsequent input file. // If the mismatch is in the first file, there is a bug somewhere, so we assert. assert(om_->inputFileCount() > 1); throw Exception(errors::MismatchedInputFiles, "RootOutputFile::beginInputFile()") << "Merge failure because input file " << file_ << " has different ROOT split levels or basket sizes\n" << "than previous files. To allow merging in splite of this, use the configuration parameter\n" << "overrideInputFileSplitLevels=cms.untracked.bool(True)\n" << "in every PoolOutputModule.\n"; } } // Since this check can be time consuming, we do it only if we would otherwise fast clone. if(whyNotFastClonable_ == FileBlock::CanFastClone) { if(!eventTree_.checkIfFastClonable(fb.tree())) { whyNotFastClonable_ |= FileBlock::BranchMismatch; } } // We now check if we can fast copy the auxiliary branches. // We can do so only if we can otherwise fast copy, // the input file has the current format (these branches are in the Events Tree), // there are no newly dropped or produced products, // and the branch list indexes do not need modification. Service<ConstProductRegistry> reg; canFastCloneAux_ = (whyNotFastClonable_ == FileBlock::CanFastClone) && fb.fileFormatVersion().noMetaDataTrees() && !om_->hasNewlyDroppedBranch()[InEvent] && !fb.hasNewlyDroppedBranch()[InEvent] && om_->dropMetaData() == PoolOutputModule::DropNone && !reg->anyProductProduced() && fb.branchListIndexesUnchanged(); // Report the fast copying status. Service<JobReport> reportSvc; reportSvc->reportFastCopyingStatus(reportToken_, fb.fileName(), whyNotFastClonable_ == FileBlock::CanFastClone); } else { whyNotFastClonable_ |= FileBlock::NoRootInputSource; } eventTree_.maybeFastCloneTree(whyNotFastClonable_ == FileBlock::CanFastClone, canFastCloneAux_, fb.tree(), om_->basketOrder()); // Possibly issue warning or informational message if we haven't fast cloned. if(fb.tree() != 0 && whyNotFastClonable_ != FileBlock::CanFastClone) { maybeIssueWarning(whyNotFastClonable_, fb.fileName(), file_); } }
std::string const& edm::RootOutputFile::fileName | ( | ) | const [inline] |
void edm::RootOutputFile::fillBranches | ( | BranchType const & | branchType, |
Principal const & | principal, | ||
ProductProvenanceVector * | productProvenanceVecPtr | ||
) | [private] |
Definition at line 630 of file RootOutputFile.cc.
References branchesWithStoredHistory_, edm::Principal::branchMapperPtr(), revisionDML::branchType(), edm::FileBlock::CanFastClone, CommonMethods::cp(), edm::PoolOutputModule::DropDroppedPrior, edm::PoolOutputModule::dropMetaData(), edm::PoolOutputModule::DropNone, edm::PoolOutputModule::DropPrior, edm::Principal::getForOutput(), i, edm::InEvent, insertAncestors(), om_, parentageIDs_, cmsRelvalreport::principal(), edm::es::produced, edm::OutputHandle::productProvenance(), edm::PoolOutputModule::selectedOutputItemList(), treePointers_, whyNotFastClonable_, and edm::OutputHandle::wrapper().
Referenced by writeLuminosityBlock(), writeOne(), and writeRun().
{ std::vector<boost::shared_ptr<EDProduct> > dummies; bool const fastCloning = (branchType == InEvent) && (whyNotFastClonable_ == FileBlock::CanFastClone); OutputItemList const& items = om_->selectedOutputItemList()[branchType]; std::set<ProductProvenance> provenanceToKeep; // Loop over EDProduct branches, fill the provenance, and write the branch. for(OutputItemList::const_iterator i = items.begin(), iEnd = items.end(); i != iEnd; ++i) { BranchID const& id = i->branchDescription_->branchID(); branchesWithStoredHistory_.insert(id); bool produced = i->branchDescription_->produced(); bool keepProvenance = om_->dropMetaData() == PoolOutputModule::DropNone || om_->dropMetaData() == PoolOutputModule::DropDroppedPrior || (om_->dropMetaData() == PoolOutputModule::DropPrior && produced); bool getProd = (produced || !fastCloning || treePointers_[branchType]->uncloned(i->branchDescription_->branchName())); EDProduct const* product = 0; OutputHandle const oh = principal.getForOutput(id, getProd); if(keepProvenance && oh.productProvenance()) { provenanceToKeep.insert(*oh.productProvenance()); assert(principal.branchMapperPtr()); insertAncestors(*oh.productProvenance(), principal, produced, provenanceToKeep); } product = oh.wrapper(); if(getProd) { if(product == 0) { // No product with this ID is in the event. // Add a null product. TClass* cp = gROOT->GetClass(i->branchDescription_->wrappedName().c_str()); boost::shared_ptr<EDProduct> dummy(static_cast<EDProduct*>(cp->New())); dummies.push_back(dummy); product = dummy.get(); } i->product_ = product; } } for(std::set<ProductProvenance>::const_iterator it = provenanceToKeep.begin(), itEnd=provenanceToKeep.end(); it != itEnd; ++it) { parentageIDs_.insert(it->parentageID()); } productProvenanceVecPtr->assign(provenanceToKeep.begin(), provenanceToKeep.end()); treePointers_[branchType]->fillTree(); productProvenanceVecPtr->clear(); }
void edm::RootOutputFile::finishEndFile | ( | ) |
Definition at line 551 of file RootOutputFile.cc.
References revisionDML::branchType(), filePtr_, i, edm::InEvent, edm::OutputModule::keptProducts(), metaDataTree_, edm::NumBranchTypes, om_, parameterSetsTree_, parentageTree_, reportToken_, setBranchAliases(), diffTreeTool::tree, treePointers_, and edm::RootOutputTree::writeTTree().
{ metaDataTree_->SetEntries(-1); RootOutputTree::writeTTree(metaDataTree_); RootOutputTree::writeTTree(parameterSetsTree_); RootOutputTree::writeTTree(parentageTree_); // Create branch aliases for all the branches in the // events/lumis/runs trees. The loop is over all types of data // products. for(int i = InEvent; i < NumBranchTypes; ++i) { BranchType branchType = static_cast<BranchType>(i); setBranchAliases(treePointers_[branchType]->tree(), om_->keptProducts()[branchType]); treePointers_[branchType]->writeTree(); } // close the file -- mfp // Just to play it safe, zero all pointers to objects in the TFile to be closed. metaDataTree_ = parentageTree_ = 0; for(RootOutputTreePtrArray::iterator it = treePointers_.begin(), itEnd = treePointers_.end(); it != itEnd; ++it) { (*it)->close(); (*it) = 0; } filePtr_->Close(); filePtr_.reset(); // report that file has been closed Service<JobReport> reportSvc; reportSvc->outputFileClosed(reportToken_); }
void edm::RootOutputFile::insertAncestors | ( | ProductProvenance const & | iGetParents, |
Principal const & | principal, | ||
bool | produced, | ||
std::set< ProductProvenance > & | oToFill | ||
) | [private] |
Definition at line 605 of file RootOutputFile.cc.
References branchesWithStoredHistory_, edm::BranchMapper::branchIDToProvenance(), edm::Principal::branchMapperPtr(), edm::PoolOutputModule::DropAll, edm::PoolOutputModule::DropDroppedPrior, edm::PoolOutputModule::dropMetaData(), edm::PoolOutputModule::DropNone, edm::PoolOutputModule::DropPrior, edm::Principal::getProvenance(), info, om_, edm::ProductProvenance::parentage(), edm::Parentage::parents(), and edm::es::produced.
Referenced by fillBranches().
{ assert(om_->dropMetaData() != PoolOutputModule::DropAll); assert(produced || om_->dropMetaData() != PoolOutputModule::DropPrior); if(om_->dropMetaData() == PoolOutputModule::DropDroppedPrior && !produced) return; BranchMapper const& iMapper = *principal.branchMapperPtr(); std::vector<BranchID> const& parentIDs = iGetParents.parentage().parents(); for(std::vector<BranchID>::const_iterator it = parentIDs.begin(), itEnd = parentIDs.end(); it != itEnd; ++it) { branchesWithStoredHistory_.insert(*it); boost::shared_ptr<ProductProvenance> info = iMapper.branchIDToProvenance(*it); if(info) { if(om_->dropMetaData() == PoolOutputModule::DropNone || principal.getProvenance(info->branchID()).product().produced()) { if(oToFill.insert(*info).second) { //haven't seen this one yet insertAncestors(*info, principal, produced, oToFill); } } } } }
void edm::RootOutputFile::respondToCloseInputFile | ( | FileBlock const & | fb | ) |
Definition at line 350 of file RootOutputFile.cc.
References eventTree_, lumiTree_, runTree_, and edm::RootOutputTree::setEntries().
{ eventTree_.setEntries(); lumiTree_.setEntries(); runTree_.setEntries(); }
void edm::RootOutputFile::setBranchAliases | ( | TTree * | tree, |
Selections const & | branches | ||
) | const [private] |
Definition at line 584 of file RootOutputFile.cc.
References edm::BranchDescription::branchAliases(), edm::BranchDescription::branchName(), full, i, edm::BranchDescription::moduleLabel(), and edm::BranchDescription::productInstanceName().
Referenced by finishEndFile().
{ if(tree && tree->GetNbranches() != 0) { for(Selections::const_iterator i = branches.begin(), iEnd = branches.end(); i != iEnd; ++i) { BranchDescription const& pd = **i; std::string const& full = pd.branchName() + "obj"; if(pd.branchAliases().empty()) { std::string const& alias = (pd.productInstanceName().empty() ? pd.moduleLabel() : pd.productInstanceName()); tree->SetAlias(alias.c_str(), full.c_str()); } else { std::set<std::string>::const_iterator it = pd.branchAliases().begin(), itEnd = pd.branchAliases().end(); for(; it != itEnd; ++it) { tree->SetAlias((*it).c_str(), full.c_str()); } } } } }
bool edm::RootOutputFile::shouldWeCloseFile | ( | ) | const |
Definition at line 356 of file RootOutputFile.cc.
References filePtr_, edm::PoolOutputModule::maxFileSize(), om_, and findQualityFiles::size.
void edm::RootOutputFile::writeBranchIDListRegistry | ( | ) |
Definition at line 496 of file RootOutputFile.cc.
References b, edm::PoolOutputModule::basketSize(), edm::poolNames::branchIDListBranchName(), edm::detail::ThreadSafeIndexedRegistry< T, E >::instance(), metaDataTree_, om_, and L1TEmulatorMonitor_cff::p.
{ BranchIDListRegistry::collection_type* p = &BranchIDListRegistry::instance()->data(); TBranch* b = metaDataTree_->Branch(poolNames::branchIDListBranchName().c_str(), &p, om_->basketSize(), 0); assert(b); b->Fill(); }
void edm::RootOutputFile::writeFileFormatVersion | ( | ) |
Definition at line 446 of file RootOutputFile.cc.
References b, edm::PoolOutputModule::basketSize(), edm::poolNames::fileFormatVersionBranchName(), edm::getFileFormatVersion(), metaDataTree_, and om_.
{ FileFormatVersion fileFormatVersion(getFileFormatVersion()); FileFormatVersion* pFileFmtVsn = &fileFormatVersion; TBranch* b = metaDataTree_->Branch(poolNames::fileFormatVersionBranchName().c_str(), &pFileFmtVsn, om_->basketSize(), 0); assert(b); b->Fill(); }
void edm::RootOutputFile::writeFileIdentifier | ( | ) |
Definition at line 454 of file RootOutputFile.cc.
References b, edm::PoolOutputModule::basketSize(), fid_, edm::poolNames::fileIdentifierBranchName(), metaDataTree_, and om_.
{ FileID* fidPtr = &fid_; TBranch* b = metaDataTree_->Branch(poolNames::fileIdentifierBranchName().c_str(), &fidPtr, om_->basketSize(), 0); assert(b); b->Fill(); }
void edm::RootOutputFile::writeIndexIntoFile | ( | ) |
Definition at line 461 of file RootOutputFile.cc.
References b, edm::PoolOutputModule::basketSize(), indexIntoFile_, edm::poolNames::indexIntoFileBranchName(), metaDataTree_, om_, and edm::IndexIntoFile::sortVector_Run_Or_Lumi_Entries().
{ indexIntoFile_.sortVector_Run_Or_Lumi_Entries(); IndexIntoFile* iifPtr = &indexIntoFile_; TBranch* b = metaDataTree_->Branch(poolNames::indexIntoFileBranchName().c_str(), &iifPtr, om_->basketSize(), 0); assert(b); b->Fill(); }
void edm::RootOutputFile::writeLuminosityBlock | ( | LuminosityBlockPrincipal const & | lb | ) |
Definition at line 402 of file RootOutputFile.cc.
References edm::IndexIntoFile::addEntry(), edm::LuminosityBlockPrincipal::aux(), fillBranches(), indexIntoFile_, edm::InLumi, lumiAux_, lumiEntryNumber_, edm::LuminosityBlockAuxiliary::luminosityBlock(), lumiTree_, edm::RootOutputTree::optimizeBaskets(), pLumiEntryInfoVector_, edm::Principal::processHistoryID(), edm::LuminosityBlockAuxiliary::run(), and edm::LuminosityBlockAuxiliary::setProcessHistoryID().
{ // Auxiliary branch // NOTE: lumiAux_ must be filled before calling fillBranches since it gets written out in that routine. lumiAux_ = lb.aux(); // Use the updated process historyID lumiAux_.setProcessHistoryID(lb.processHistoryID()); // Add lumi to index. indexIntoFile_.addEntry(lb.processHistoryID(), lumiAux_.run(), lumiAux_.luminosityBlock(), 0U, lumiEntryNumber_); ++lumiEntryNumber_; fillBranches(InLumi, lb, pLumiEntryInfoVector_); lumiTree_.optimizeBaskets(10ULL*1024*1024); }
void edm::RootOutputFile::writeOne | ( | EventPrincipal const & | e | ) |
Definition at line 362 of file RootOutputFile.cc.
References edm::IndexIntoFile::addEntry(), edm::EventPrincipal::aux(), edm::EventPrincipal::branchListIndexes(), dtT0WireCalibration_cfg::dataType, dataTypeReported_, edm::EventID::event(), edm::EventAuxiliary::event(), eventEntryNumber_, edm::EventPrincipal::eventSelectionIDs(), fillBranches(), edm::EventPrincipal::id(), indexIntoFile_, edm::InEvent, edm::EventAuxiliary::isRealData(), edm::EventAuxiliary::luminosityBlock(), om_, pBranchListIndexes_, pEventAux_, pEventEntryInfoVector_, pEventSelectionIDs_, edm::EventAuxiliary::processHistoryID(), edm::Principal::processHistoryID(), reportToken_, edm::EventID::run(), edm::EventAuxiliary::run(), edm::OutputModule::selectorConfig(), and edm::OutputModule::wantAllEvents().
{ // Auxiliary branch pEventAux_ = &e.aux(); // Because getting the data may cause an exception to be thrown we want to do that // first before writing anything to the file about this event // NOTE: pEventAux_, pBranchListIndexes_, pEventSelectionIDs_, and pEventEntryInfoVector_ // must be set before calling fillBranches since they get written out in that routine. assert(pEventAux_->processHistoryID() == e.processHistoryID()); pBranchListIndexes_ = &e.branchListIndexes(); // Note: The EventSelectionIDVector should have a one to one correspondence with the processes in the process history. // Therefore, a new entry should be added if and only if the current process has been added to the process history, // which is done if and only if there is a produced product. Service<ConstProductRegistry> reg; EventSelectionIDVector esids = e.eventSelectionIDs(); if (reg->anyProductProduced() || !om_->wantAllEvents()) { esids.push_back(om_->selectorConfig()); } pEventSelectionIDs_ = &esids; fillBranches(InEvent, e, pEventEntryInfoVector_); // Add the dataType to the job report if it hasn't already been done if(!dataTypeReported_) { Service<JobReport> reportSvc; std::string dataType("MC"); if(pEventAux_->isRealData()) dataType = "Data"; reportSvc->reportDataType(reportToken_, dataType); dataTypeReported_ = true; } // Add event to index indexIntoFile_.addEntry(e.processHistoryID(), pEventAux_->run(), pEventAux_->luminosityBlock(), pEventAux_->event(), eventEntryNumber_); ++eventEntryNumber_; // Report event written Service<JobReport> reportSvc; reportSvc->eventWrittenToFile(reportToken_, e.id().run(), e.id().event()); }
void edm::RootOutputFile::writeParameterSetRegistry | ( | ) |
Definition at line 503 of file RootOutputFile.cc.
References b, edm::PoolOutputModule::basketSize(), edm::poolNames::idToParameterSetBlobsBranchName(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), om_, and parameterSetsTree_.
{ std::pair<ParameterSetID, ParameterSetBlob> idToBlob; std::pair<ParameterSetID, ParameterSetBlob>* pIdToBlob = &idToBlob; TBranch* b = parameterSetsTree_->Branch(poolNames::idToParameterSetBlobsBranchName().c_str(),&pIdToBlob,om_->basketSize(), 0); for(pset::Registry::const_iterator it = pset::Registry::instance()->begin(), itEnd = pset::Registry::instance()->end(); it != itEnd; ++it) { idToBlob.first = it->first; idToBlob.second.pset() = it->second.toString(); b->Fill(); } }
void edm::RootOutputFile::writeParentageRegistry | ( | ) |
Definition at line 428 of file RootOutputFile.cc.
References edm::PoolOutputModule::basketSize(), edm::detail::ThreadSafeRegistry< KEY, T, E >::begin(), edm::detail::ThreadSafeRegistry< KEY, T, E >::end(), Exception, edm::errors::FatalRootError, i, edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), om_, edm::poolNames::parentageBranchName(), parentageIDs_, and parentageTree_.
{ Parentage const* desc(0); if(!parentageTree_->Branch(poolNames::parentageBranchName().c_str(), &desc, om_->basketSize(), 0)) throw Exception(errors::FatalRootError) << "Failed to create a branch for Parentages in the output file"; ParentageRegistry& ptReg = *ParentageRegistry::instance(); std::set<ParentageID>::const_iterator pidend = parentageIDs_.end(); for(ParentageRegistry::const_iterator i = ptReg.begin(), e = ptReg.end(); i != e; ++i) { if(parentageIDs_.find(i->first) != pidend) { desc = &(i->second); parentageTree_->Fill(); } } }
void edm::RootOutputFile::writeProcessConfigurationRegistry | ( | ) |
Definition at line 469 of file RootOutputFile.cc.
References b, edm::PoolOutputModule::basketSize(), i, edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), metaDataTree_, om_, L1TEmulatorMonitor_cff::p, edm::poolNames::processConfigurationBranchName(), and edm::sort_all().
{ typedef ProcessConfigurationRegistry::collection_type Map; Map const& procConfigMap = ProcessConfigurationRegistry::instance()->data(); ProcessConfigurationVector procConfigVector; for(Map::const_iterator i = procConfigMap.begin(), e = procConfigMap.end(); i != e; ++i) { procConfigVector.push_back(i->second); } sort_all(procConfigVector); ProcessConfigurationVector* p = &procConfigVector; TBranch* b = metaDataTree_->Branch(poolNames::processConfigurationBranchName().c_str(), &p, om_->basketSize(), 0); assert(b); b->Fill(); }
void edm::RootOutputFile::writeProcessHistoryRegistry | ( | ) |
Definition at line 483 of file RootOutputFile.cc.
References b, edm::PoolOutputModule::basketSize(), i, edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), metaDataTree_, om_, L1TEmulatorMonitor_cff::p, and edm::poolNames::processHistoryBranchName().
{ typedef ProcessHistoryRegistry::collection_type Map; Map const& procHistoryMap = ProcessHistoryRegistry::instance()->data(); ProcessHistoryVector procHistoryVector; for(Map::const_iterator i = procHistoryMap.begin(), e = procHistoryMap.end(); i != e; ++i) { procHistoryVector.push_back(i->second); } ProcessHistoryVector* p = &procHistoryVector; TBranch* b = metaDataTree_->Branch(poolNames::processHistoryBranchName().c_str(), &p, om_->basketSize(), 0); assert(b); b->Fill(); }
void edm::RootOutputFile::writeProductDependencies | ( | ) |
Definition at line 543 of file RootOutputFile.cc.
References b, edm::PoolOutputModule::basketSize(), edm::OutputModule::branchChildren(), metaDataTree_, om_, and edm::poolNames::productDependenciesBranchName().
{ BranchChildren& pDeps = const_cast<BranchChildren&>(om_->branchChildren()); BranchChildren* ppDeps = &pDeps; TBranch* b = metaDataTree_->Branch(poolNames::productDependenciesBranchName().c_str(), &ppDeps, om_->basketSize(), 0); assert(b); b->Fill(); }
void edm::RootOutputFile::writeProductDescriptionRegistry | ( | ) |
Definition at line 519 of file RootOutputFile.cc.
References b, edm::PoolOutputModule::basketSize(), branchesWithStoredHistory_, end, metaDataTree_, om_, and edm::poolNames::productDescriptionBranchName().
{ // Make a local copy of the ProductRegistry, removing any transient or pruned products. typedef ProductRegistry::ProductList ProductList; Service<ConstProductRegistry> reg; ProductRegistry pReg(reg->productList()); ProductList& pList = const_cast<ProductList &>(pReg.productList()); std::set<BranchID>::iterator end = branchesWithStoredHistory_.end(); for(ProductList::iterator it = pList.begin(); it != pList.end();) { if(branchesWithStoredHistory_.find(it->second.branchID()) == end) { // avoid invalidating iterator on deletion ProductList::iterator itCopy = it; ++it; pList.erase(itCopy); } else { ++it; } } ProductRegistry* ppReg = &pReg; TBranch* b = metaDataTree_->Branch(poolNames::productDescriptionBranchName().c_str(), &ppReg, om_->basketSize(), 0); assert(b); b->Fill(); }
void edm::RootOutputFile::writeRun | ( | RunPrincipal const & | r | ) |
Definition at line 415 of file RootOutputFile.cc.
References edm::IndexIntoFile::addEntry(), edm::RunPrincipal::aux(), fillBranches(), indexIntoFile_, edm::InRun, edm::RootOutputTree::optimizeBaskets(), edm::Principal::processHistoryID(), pRunEntryInfoVector_, edm::RunAuxiliary::run(), runAux_, runEntryNumber_, runTree_, and edm::RunAuxiliary::setProcessHistoryID().
{ // Auxiliary branch // NOTE: runAux_ must be filled before calling fillBranches since it gets written out in that routine. runAux_ = r.aux(); // Use the updated process historyID runAux_.setProcessHistoryID(r.processHistoryID()); // Add run to index. indexIntoFile_.addEntry(r.processHistoryID(), runAux_.run(), 0U, 0U, runEntryNumber_); ++runEntryNumber_; fillBranches(InRun, r, pRunEntryInfoVector_); runTree_.optimizeBaskets(10ULL*1024*1024); }
std::set<BranchID> edm::RootOutputFile::branchesWithStoredHistory_ [private] |
Definition at line 126 of file RootOutputFile.h.
Referenced by fillBranches(), insertAncestors(), RootOutputFile(), and writeProductDescriptionRegistry().
bool edm::RootOutputFile::canFastCloneAux_ [private] |
Definition at line 97 of file RootOutputFile.h.
Referenced by beginInputFile().
bool edm::RootOutputFile::dataTypeReported_ [private] |
Definition at line 124 of file RootOutputFile.h.
Referenced by writeOne().
Definition at line 112 of file RootOutputFile.h.
Definition at line 100 of file RootOutputFile.h.
Referenced by writeOne().
Definition at line 120 of file RootOutputFile.h.
Referenced by beginInputFile(), respondToCloseInputFile(), and RootOutputFile().
FileID edm::RootOutputFile::fid_ [private] |
Definition at line 99 of file RootOutputFile.h.
Referenced by RootOutputFile(), and writeFileIdentifier().
std::string edm::RootOutputFile::file_ [private] |
Definition at line 92 of file RootOutputFile.h.
Referenced by beginInputFile(), fileName(), and RootOutputFile().
boost::shared_ptr<TFile> edm::RootOutputFile::filePtr_ [private] |
Definition at line 98 of file RootOutputFile.h.
Referenced by finishEndFile(), RootOutputFile(), and shouldWeCloseFile().
Definition at line 103 of file RootOutputFile.h.
Referenced by writeIndexIntoFile(), writeLuminosityBlock(), writeOne(), and writeRun().
std::string edm::RootOutputFile::logicalFile_ [private] |
Definition at line 93 of file RootOutputFile.h.
Referenced by RootOutputFile().
Definition at line 107 of file RootOutputFile.h.
Referenced by writeLuminosityBlock().
Definition at line 113 of file RootOutputFile.h.
Definition at line 101 of file RootOutputFile.h.
Referenced by writeLuminosityBlock().
RootOutputTree edm::RootOutputFile::lumiTree_ [private] |
Definition at line 121 of file RootOutputFile.h.
Referenced by respondToCloseInputFile(), RootOutputFile(), and writeLuminosityBlock().
TTree* edm::RootOutputFile::metaDataTree_ [private] |
Definition at line 104 of file RootOutputFile.h.
Referenced by finishEndFile(), RootOutputFile(), writeBranchIDListRegistry(), writeFileFormatVersion(), writeFileIdentifier(), writeIndexIntoFile(), writeProcessConfigurationRegistry(), writeProcessHistoryRegistry(), writeProductDependencies(), and writeProductDescriptionRegistry().
PoolOutputModule const* edm::RootOutputFile::om_ [private] |
Definition at line 95 of file RootOutputFile.h.
Referenced by beginInputFile(), fillBranches(), finishEndFile(), insertAncestors(), RootOutputFile(), shouldWeCloseFile(), writeBranchIDListRegistry(), writeFileFormatVersion(), writeFileIdentifier(), writeIndexIntoFile(), writeOne(), writeParameterSetRegistry(), writeParentageRegistry(), writeProcessConfigurationRegistry(), writeProcessHistoryRegistry(), writeProductDependencies(), and writeProductDescriptionRegistry().
TTree* edm::RootOutputFile::parameterSetsTree_ [private] |
Definition at line 105 of file RootOutputFile.h.
Referenced by finishEndFile(), RootOutputFile(), and writeParameterSetRegistry().
std::set<ParentageID> edm::RootOutputFile::parentageIDs_ [private] |
Definition at line 125 of file RootOutputFile.h.
Referenced by fillBranches(), and writeParentageRegistry().
TTree* edm::RootOutputFile::parentageTree_ [private] |
Definition at line 106 of file RootOutputFile.h.
Referenced by finishEndFile(), RootOutputFile(), and writeParentageRegistry().
BranchListIndexes const* edm::RootOutputFile::pBranchListIndexes_ [private] |
Definition at line 118 of file RootOutputFile.h.
Referenced by RootOutputFile(), and writeOne().
EventAuxiliary const* edm::RootOutputFile::pEventAux_ [private] |
Definition at line 109 of file RootOutputFile.h.
Referenced by RootOutputFile(), and writeOne().
Definition at line 115 of file RootOutputFile.h.
Referenced by RootOutputFile(), and writeOne().
EventSelectionIDVector const* edm::RootOutputFile::pEventSelectionIDs_ [private] |
Definition at line 119 of file RootOutputFile.h.
Referenced by RootOutputFile(), and writeOne().
LuminosityBlockAuxiliary const* edm::RootOutputFile::pLumiAux_ [private] |
Definition at line 110 of file RootOutputFile.h.
Referenced by RootOutputFile().
Definition at line 116 of file RootOutputFile.h.
Referenced by RootOutputFile(), and writeLuminosityBlock().
RunAuxiliary const* edm::RootOutputFile::pRunAux_ [private] |
Definition at line 111 of file RootOutputFile.h.
Referenced by RootOutputFile().
Definition at line 117 of file RootOutputFile.h.
Referenced by RootOutputFile(), and writeRun().
Definition at line 94 of file RootOutputFile.h.
Referenced by beginInputFile(), finishEndFile(), RootOutputFile(), and writeOne().
RunAuxiliary edm::RootOutputFile::runAux_ [private] |
Definition at line 108 of file RootOutputFile.h.
Referenced by writeRun().
Definition at line 114 of file RootOutputFile.h.
Definition at line 102 of file RootOutputFile.h.
Referenced by writeRun().
RootOutputTree edm::RootOutputFile::runTree_ [private] |
Definition at line 122 of file RootOutputFile.h.
Referenced by respondToCloseInputFile(), RootOutputFile(), and writeRun().
Definition at line 123 of file RootOutputFile.h.
Referenced by fillBranches(), finishEndFile(), and RootOutputFile().
int edm::RootOutputFile::whyNotFastClonable_ [private] |
Definition at line 96 of file RootOutputFile.h.
Referenced by beginInputFile(), and fillBranches().