CMS 3D CMS Logo

edm::RootOutputFile Class Reference

#include <IOPool/Output/src/RootOutputFile.h>

List of all members.

Public Types

typedef
PoolOutputModule::OutputItem 
OutputItem
typedef
PoolOutputModule::OutputItemList 
OutputItemList
typedef boost::array
< RootOutputTree *,
NumBranchTypes > 
RootOutputTreePtrArray

Public Member Functions

void beginInputFile (FileBlock const &fb, bool fastClone)
void finishEndFile ()
void respondToCloseInputFile (FileBlock const &fb)
 RootOutputFile (PoolOutputModule *om, std::string const &fileName, std::string const &logicalFileName)
bool shouldWeCloseFile () const
void writeEntryDescriptions ()
void writeEventHistory ()
void writeFileFormatVersion ()
void writeFileIdentifier ()
void writeFileIndex ()
void writeLuminosityBlock (LuminosityBlockPrincipal const &lb)
void writeModuleDescriptionRegistry ()
void writeOne (EventPrincipal const &e)
void writeParameterSetRegistry ()
void writeProcessConfigurationRegistry ()
void writeProcessHistoryRegistry ()
void writeProductDependencies ()
void writeProductDescriptionRegistry ()
void writeRun (RunPrincipal const &r)
 ~RootOutputFile ()

Private Types

typedef
EventEntryInfo::EntryInfoVector 
EventEntryInfoVector
typedef
LumiEntryInfo::EntryInfoVector 
LumiEntryInfoVector
typedef
RunEntryInfo::EntryInfoVector 
RunEntryInfoVector

Private Member Functions

template<typename T>
void fillBranches (BranchType const &branchType, Principal const &principal, std::vector< T > *entryInfoVecPtr)
void insertAncestors (const EventEntryInfo &iGetParents, const BranchMapper &iMapper, std::set< EventEntryInfo > &oToFill)
void setBranchAliases (TTree *tree, Selections const &branches) const

Static Private Member Functions

template<typename T>
static void insertAncestors (const T &iParents, const BranchMapper &iMapper, std::set< T > &oToFill)

Private Attributes

std::set< BranchIDbranchesWithStoredHistory_
bool currentlyFastCloning_
bool dataTypeReported_
TTree * entryDescriptionTree_
EventEntryInfoVector eventEntryInfoVector_
FileIndex::EntryNumber_t eventEntryNumber_
TTree * eventHistoryTree_
RootOutputTree eventTree_
FileID fid_
std::string file_
FileIndex fileIndex_
boost::shared_ptr< TFile > filePtr_
std::string logicalFile_
LumiEntryInfoVector lumiEntryInfoVector_
FileIndex::EntryNumber_t lumiEntryNumber_
RootOutputTree lumiTree_
TTree * metaDataTree_
PoolOutputModule const * om_
EventAuxiliary const * pEventAux_
EventEntryInfoVectorpEventEntryInfoVector_
History const * pHistory_
LuminosityBlockAuxiliary const * pLumiAux_
LumiEntryInfoVectorpLumiEntryInfoVector_
RunAuxiliary const * pRunAux_
RunEntryInfoVectorpRunEntryInfoVector_
JobReport::Token reportToken_
RunEntryInfoVector runEntryInfoVector_
FileIndex::EntryNumber_t runEntryNumber_
RootOutputTree runTree_
RootOutputTreePtrArray treePointers_


Detailed Description

Definition at line 41 of file RootOutputFile.h.


Member Typedef Documentation

typedef EventEntryInfo::EntryInfoVector edm::RootOutputFile::EventEntryInfoVector [private]

Definition at line 75 of file RootOutputFile.h.

typedef LumiEntryInfo::EntryInfoVector edm::RootOutputFile::LumiEntryInfoVector [private]

Definition at line 76 of file RootOutputFile.h.

typedef PoolOutputModule::OutputItem edm::RootOutputFile::OutputItem

Definition at line 43 of file RootOutputFile.h.

typedef PoolOutputModule::OutputItemList edm::RootOutputFile::OutputItemList

Definition at line 44 of file RootOutputFile.h.

typedef boost::array<RootOutputTree *, NumBranchTypes> edm::RootOutputFile::RootOutputTreePtrArray

Definition at line 45 of file RootOutputFile.h.

typedef RunEntryInfo::EntryInfoVector edm::RootOutputFile::RunEntryInfoVector [private]

Definition at line 77 of file RootOutputFile.h.


Constructor & Destructor Documentation

edm::RootOutputFile::RootOutputFile ( PoolOutputModule om,
std::string const &  fileName,
std::string const &  logicalFileName 
) [explicit]

Definition at line 66 of file RootOutputFile.cc.

References edm::PoolOutputModule::basketSize(), branchesWithStoredHistory_, edm::PoolOutputModule::catalog_, edm::createGlobalIdentifier(), cms::Digest::digest(), entryDescriptionTree_, edm::poolNames::entryDescriptionTreeName(), edm::poolNames::eventHistoryBranchName(), eventHistoryTree_, edm::poolNames::eventHistoryTreeName(), eventTree_, edm::errors::FatalRootError, edm::FileID::fid(), fid_, file_, filePtr_, edm::BranchDescription::fullClassName(), i, edm::InEvent, edm::InLumi, edm::InRun, it, logicalFile_, lumiTree_, edm::RootOutputTree::makeTTree(), metaDataTree_, edm::poolNames::metaDataTreeName(), edm::BranchDescription::moduleLabel(), edm::PoolOutputModule::moduleLabel_, moduleName(), edm::NumBranchTypes, om_, pHistory_, edm::BranchDescription::processName(), edm::BranchDescription::productInstanceName(), reportToken_, runTree_, edm::PoolOutputModule::selectedOutputItemList(), edm::sort_all(), edm::sorterForJobReportHash(), edm::PoolOutputModule::splitLevel(), and treePointers_.

00066                                                                                                                   :
00067       file_(fileName),
00068       logicalFile_(logicalFileName),
00069       reportToken_(0),
00070       om_(om),
00071       currentlyFastCloning_(),
00072       filePtr_(TFile::Open(file_.c_str(), "recreate", "", om_->compressionLevel())),
00073       fid_(),
00074       fileIndex_(),
00075       eventEntryNumber_(0LL),
00076       lumiEntryNumber_(0LL),
00077       runEntryNumber_(0LL),
00078       metaDataTree_(0),
00079       entryDescriptionTree_(0),
00080       eventHistoryTree_(0),
00081       pEventAux_(0),
00082       pLumiAux_(0),
00083       pRunAux_(0),
00084       eventEntryInfoVector_(),
00085       lumiEntryInfoVector_(),
00086       runEntryInfoVector_(),
00087       pEventEntryInfoVector_(&eventEntryInfoVector_),
00088       pLumiEntryInfoVector_(&lumiEntryInfoVector_),
00089       pRunEntryInfoVector_(&runEntryInfoVector_),
00090       pHistory_(0),
00091       eventTree_(static_cast<EventPrincipal *>(0),
00092                  filePtr_, InEvent, pEventAux_, pEventEntryInfoVector_,
00093                  om_->basketSize(), om_->splitLevel(), om_->treeMaxVirtualSize()),
00094       lumiTree_(static_cast<LuminosityBlockPrincipal *>(0),
00095                 filePtr_, InLumi, pLumiAux_, pLumiEntryInfoVector_,
00096                 om_->basketSize(), om_->splitLevel(), om_->treeMaxVirtualSize()),
00097       runTree_(static_cast<RunPrincipal *>(0),
00098                filePtr_, InRun, pRunAux_, pRunEntryInfoVector_,
00099                om_->basketSize(), om_->splitLevel(), om_->treeMaxVirtualSize()),
00100       treePointers_(),
00101       dataTypeReported_(false) {
00102     treePointers_[InEvent] = &eventTree_;
00103     treePointers_[InLumi]  = &lumiTree_;
00104     treePointers_[InRun]   = &runTree_;
00105 
00106     for (int i = InEvent; i < NumBranchTypes; ++i) {
00107       BranchType branchType = static_cast<BranchType>(i);
00108       for (OutputItemList::const_iterator it = om_->selectedOutputItemList()[branchType].begin(),
00109           itEnd = om_->selectedOutputItemList()[branchType].end();
00110           it != itEnd; ++it) {
00111         treePointers_[branchType]->addBranch(*it->branchDescription_,
00112                                               it->product_,
00113                                               it->branchDescription_->produced());
00114         //make sure we always store product registry info for all branches we create
00115         branchesWithStoredHistory_.insert(it->branchID());
00116       }
00117     }
00118     // Don't split metadata tree or event description tree
00119     metaDataTree_         = RootOutputTree::makeTTree(filePtr_.get(), poolNames::metaDataTreeName(), 0);
00120     entryDescriptionTree_ = RootOutputTree::makeTTree(filePtr_.get(), poolNames::entryDescriptionTreeName(), 0);
00121 
00122     // Create the tree that will carry (event) History objects.
00123     eventHistoryTree_     = RootOutputTree::makeTTree(filePtr_.get(), poolNames::eventHistoryTreeName(), om_->splitLevel());
00124     if (!eventHistoryTree_)
00125       throw edm::Exception(edm::errors::FatalRootError) 
00126         << "Failed to create the tree for History objects\n";
00127 
00128     if (! eventHistoryTree_->Branch(poolNames::eventHistoryBranchName().c_str(), &pHistory_, om_->basketSize(), 0))
00129       throw edm::Exception(edm::errors::FatalRootError) 
00130         << "Failed to create a branch for Historys in the output file\n";
00131 
00132     fid_ = FileID(createGlobalIdentifier());
00133 
00134     // For the Job Report, get a vector of branch names in the "Events" tree.
00135     // Also create a hash of all the branch names in the "Events" tree
00136     // in a deterministic order, except use the full class name instead of the friendly class name.
00137     // To avoid extra string copies, we create a vector of pointers into the product registry,
00138     // and use a custom comparison operator for sorting.
00139     std::vector<std::string> branchNames;
00140     std::vector<BranchDescription const*> branches;
00141     branchNames.reserve(om_->selectedOutputItemList()[InEvent].size());
00142     branches.reserve(om->selectedOutputItemList()[InEvent].size());
00143     for (OutputItemList::const_iterator it = om_->selectedOutputItemList()[InEvent].begin(),
00144           itEnd = om_->selectedOutputItemList()[InEvent].end();
00145           it != itEnd; ++it) {
00146       branchNames.push_back(it->branchDescription_->branchName());
00147       branches.push_back(it->branchDescription_);
00148     }
00149     // Now sort the branches for the hash.
00150     sort_all(branches, sorterForJobReportHash);
00151     // Now, make a concatenated string.
00152     std::ostringstream oss;
00153     char const underscore = '_';
00154     for (std::vector<BranchDescription const*>::const_iterator it = branches.begin(), itEnd = branches.end(); it != itEnd; ++it) {
00155       BranchDescription const& bd = **it;
00156       oss <<  bd.fullClassName() << underscore
00157           << bd.moduleLabel() << underscore
00158           << bd.productInstanceName() << underscore
00159           << bd.processName() << underscore;
00160     }
00161     std::string stringrep = oss.str();
00162     cms::Digest md5alg(stringrep);
00163 
00164     // Register the output file with the JobReport service
00165     // and get back the token for it.
00166     std::string moduleName = "PoolOutputModule";
00167     Service<JobReport> reportSvc;
00168     reportToken_ = reportSvc->outputFileOpened(
00169                       file_, logicalFile_,  // PFN and LFN
00170                       om_->catalog_,  // catalog
00171                       moduleName,   // module class name
00172                       om_->moduleLabel_,  // module label
00173                       fid_.fid(), // file id (guid)
00174                       std::string(), // data type (not yet known, so string is empty).
00175                       md5alg.digest().toString(), // branch hash
00176                       branchNames); // branch names being written
00177   }

edm::RootOutputFile::~RootOutputFile (  )  [inline]

Definition at line 48 of file RootOutputFile.h.

00048 {}


Member Function Documentation

void edm::RootOutputFile::beginInputFile ( FileBlock const &  fb,
bool  fastClone 
)

Definition at line 179 of file RootOutputFile.cc.

References edm::RootOutputTree::beginInputFile(), edm::RootOutputTree::checkSplitLevelAndBasketSize(), currentlyFastCloning_, eventTree_, edm::FileBlock::fastClonable(), edm::RootOutputTree::fastCloneTree(), edm::PoolOutputModule::fastCloning(), om_, and edm::FileBlock::tree().

00179                                                                          {
00180 
00181     currentlyFastCloning_ = om_->fastCloning() && fb.fastClonable() && fastClone;
00182     if (currentlyFastCloning_) currentlyFastCloning_ = eventTree_.checkSplitLevelAndBasketSize(fb.tree());
00183 
00184     eventTree_.beginInputFile(currentlyFastCloning_);
00185     eventTree_.fastCloneTree(fb.tree());
00186   }

template<typename T>
void edm::RootOutputFile::fillBranches ( BranchType const &  branchType,
Principal const &  principal,
std::vector< T > *  entryInfoVecPtr 
) [inline, private]

Definition at line 142 of file RootOutputFile.h.

References branchesWithStoredHistory_, edm::Principal::branchMapperPtr(), currentlyFastCloning_, edm::PoolOutputModule::dropMetaData(), edm::productstatus::dropped(), dummy, edm::OutputHandle< T >::entryInfo(), edm::Principal::getForOutput(), i, edm::InEvent, insertAncestors(), keep, edm::productstatus::neverCreated(), om_, edm::PoolOutputModule::selectedOutputItemList(), treePointers_, and edm::OutputHandle< T >::wrapper().

Referenced by writeLuminosityBlock(), writeOne(), and writeRun().

00145                                                 {
00146 
00147     std::vector<boost::shared_ptr<EDProduct> > dummies;
00148 
00149     bool const fastCloning = (branchType == InEvent) && currentlyFastCloning_;
00150     
00151     OutputItemList const& items = om_->selectedOutputItemList()[branchType];
00152 
00153     std::set<T> keep;
00154 
00155     std::set<T> keepPlusAncestors;
00156 
00157     // Loop over EDProduct branches, fill the provenance, and write the branch.
00158     for (OutputItemList::const_iterator i = items.begin(), iEnd = items.end(); i != iEnd; ++i) {
00159 
00160       BranchID const& id = i->branchDescription_->branchID();
00161       branchesWithStoredHistory_.insert(id);
00162        
00163       bool getProd = (i->branchDescription_->produced() ||
00164          !fastCloning || treePointers_[branchType]->uncloned(i->branchDescription_->branchName()));
00165 
00166       EDProduct const* product = 0;
00167       OutputHandle<T> const oh = principal.getForOutput<T>(id, getProd);
00168       if (!oh.entryInfo()) {
00169         // No product with this ID is in the event.
00170         // Create and write the provenance.
00171         if (i->branchDescription_->produced()) {
00172           keep.insert(T(i->branchDescription_->branchID(),
00173                       productstatus::neverCreated(),
00174                       i->branchDescription_->moduleDescriptionID()));
00175           keepPlusAncestors.insert(T(i->branchDescription_->branchID(),
00176                               productstatus::neverCreated(),
00177                               i->branchDescription_->moduleDescriptionID()));
00178         } else {
00179           keep.insert(T(i->branchDescription_->branchID(),
00180                       productstatus::dropped(),
00181                       i->branchDescription_->moduleDescriptionID()));
00182           keepPlusAncestors.insert(T(i->branchDescription_->branchID(),
00183                               productstatus::dropped(),
00184                               i->branchDescription_->moduleDescriptionID()));
00185         }
00186       } else {
00187         product = oh.wrapper();
00188         keep.insert(*oh.entryInfo());
00189         keepPlusAncestors.insert(*oh.entryInfo());
00190         assert(principal.branchMapperPtr());
00191         insertAncestors(*oh.entryInfo(),*principal.branchMapperPtr(),keepPlusAncestors);
00192       }
00193       if (getProd) {
00194         if (product == 0) {
00195           // No product with this ID is in the event.
00196           // Add a null product.
00197           TClass *cp = gROOT->GetClass(i->branchDescription_->wrappedName().c_str());
00198           boost::shared_ptr<EDProduct> dummy(static_cast<EDProduct *>(cp->New()));
00199           dummies.push_back(dummy);
00200           product = dummy.get();
00201         }
00202         i->product_ = product;
00203       }
00204     }
00205      
00206     if (om_->dropMetaData()) {
00207       entryInfoVecPtr->assign(keep.begin(),keep.end());
00208     } else {
00209       entryInfoVecPtr->assign(keepPlusAncestors.begin(),keepPlusAncestors.end());
00210     }
00211     treePointers_[branchType]->fillTree();
00212     entryInfoVecPtr->clear();
00213   }

void edm::RootOutputFile::finishEndFile (  ) 

Definition at line 377 of file RootOutputFile.cc.

References entryDescriptionTree_, filePtr_, i, edm::InEvent, edm::OutputModule::keptProducts(), metaDataTree_, edm::NumBranchTypes, om_, reportToken_, setBranchAliases(), tree, treePointers_, and edm::RootOutputTree::writeTTree().

00377                                      { 
00378     metaDataTree_->SetEntries(-1);
00379     RootOutputTree::writeTTree(metaDataTree_);
00380 
00381     RootOutputTree::writeTTree(entryDescriptionTree_);
00382 
00383     // Create branch aliases for all the branches in the
00384     // events/lumis/runs trees. The loop is over all types of data
00385     // products.
00386     for (int i = InEvent; i < NumBranchTypes; ++i) {
00387       BranchType branchType = static_cast<BranchType>(i);
00388       setBranchAliases(treePointers_[branchType]->tree(), om_->keptProducts()[branchType]);
00389       treePointers_[branchType]->writeTree();
00390     }
00391 
00392     // close the file -- mfp
00393     filePtr_->Close();
00394     filePtr_.reset();
00395 
00396     // report that file has been closed
00397     Service<JobReport> reportSvc;
00398     reportSvc->outputFileClosed(reportToken_);
00399 
00400   }

void edm::RootOutputFile::insertAncestors ( const EventEntryInfo iGetParents,
const BranchMapper iMapper,
std::set< EventEntryInfo > &  oToFill 
) [private]

Definition at line 423 of file RootOutputFile.cc.

References branchesWithStoredHistory_, edm::BranchMapper::branchToEntryInfo(), edm::EventEntryInfo::entryDescription(), info, insertAncestors(), it, and edm::EventEntryDescription::parents().

00425                                                                          {
00426       const std::vector<BranchID>& parentIDs = iGetParents.entryDescription().parents();
00427       for(std::vector<BranchID>::const_iterator it=parentIDs.begin(), itEnd = parentIDs.end();
00428           it != itEnd; ++it) {
00429          branchesWithStoredHistory_.insert(*it);
00430          boost::shared_ptr<EventEntryInfo> info = iMapper.branchToEntryInfo(*it);
00431          if(info) {
00432             if(oToFill.insert(*info).second) {
00433                //haven't seen this one yet
00434                insertAncestors(*info, iMapper, oToFill);
00435             }
00436          }
00437       }
00438    }

template<typename T>
void edm::RootOutputFile::insertAncestors ( const T &  iParents,
const BranchMapper iMapper,
std::set< T > &  oToFill 
) [inline, static, private]

Definition at line 133 of file RootOutputFile.h.

Referenced by fillBranches(), and insertAncestors().

00135                                                             {
00136       //do nothing
00137    }

void edm::RootOutputFile::respondToCloseInputFile ( FileBlock const &  fb  ) 

Definition at line 188 of file RootOutputFile.cc.

References eventTree_, lumiTree_, runTree_, and edm::RootOutputTree::setEntries().

00188                                                                {
00189     eventTree_.setEntries();
00190     lumiTree_.setEntries();
00191     runTree_.setEntries();
00192   }

void edm::RootOutputFile::setBranchAliases ( TTree *  tree,
Selections const &  branches 
) const [private]

Definition at line 403 of file RootOutputFile.cc.

References Selections::begin(), edm::BranchDescription::branchAliases(), edm::BranchDescription::branchName(), Selections::end(), full, i, it, edm::BranchDescription::moduleLabel(), and edm::BranchDescription::productInstanceName().

Referenced by finishEndFile().

00403                                                                                 {
00404     if (tree && tree->GetNbranches() != 0) {
00405       for (Selections::const_iterator i = branches.begin(), iEnd = branches.end();
00406           i != iEnd; ++i) {
00407         BranchDescription const& pd = **i;
00408         std::string const& full = pd.branchName() + "obj";
00409         if (pd.branchAliases().empty()) {
00410           std::string const& alias =
00411               (pd.productInstanceName().empty() ? pd.moduleLabel() : pd.productInstanceName());
00412           tree->SetAlias(alias.c_str(), full.c_str());
00413         } else {
00414           std::set<std::string>::const_iterator it = pd.branchAliases().begin(), itEnd = pd.branchAliases().end();
00415           for (; it != itEnd; ++it) {
00416             tree->SetAlias((*it).c_str(), full.c_str());
00417           }
00418         }
00419       }
00420     }
00421   }

bool edm::RootOutputFile::shouldWeCloseFile (  )  const

Definition at line 194 of file RootOutputFile.cc.

References filePtr_, edm::PoolOutputModule::maxFileSize_, om_, and size.

00194                                                {
00195     unsigned int const oneK = 1024;
00196     Long64_t size = filePtr_->GetSize()/oneK;
00197     return(size >= om_->maxFileSize_);
00198   }

void edm::RootOutputFile::writeEntryDescriptions (  ) 

Definition at line 264 of file RootOutputFile.cc.

References edm::PoolOutputModule::basketSize(), edm::detail::ThreadSafeRegistry< KEY, T, E >::begin(), e, edm::detail::ThreadSafeRegistry< KEY, T, E >::end(), edm::poolNames::entryDescriptionBranchName(), edm::poolNames::entryDescriptionIDBranchName(), entryDescriptionTree_, edm::errors::FatalRootError, i, edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), and om_.

00264                                               {
00265     EntryDescriptionID const* hash(0);
00266     EventEntryDescription const*   desc(0);
00267     
00268     if (!entryDescriptionTree_->Branch(poolNames::entryDescriptionIDBranchName().c_str(), 
00269                                         &hash, om_->basketSize(), 0))
00270       throw edm::Exception(edm::errors::FatalRootError) 
00271         << "Failed to create a branch for EntryDescriptionIDs in the output file";
00272 
00273     if (!entryDescriptionTree_->Branch(poolNames::entryDescriptionBranchName().c_str(), 
00274                                         &desc, om_->basketSize(), 0))
00275       throw edm::Exception(edm::errors::FatalRootError) 
00276         << "Failed to create a branch for EventEntryDescriptions in the output file";
00277 
00278     EntryDescriptionRegistry& edreg = *EntryDescriptionRegistry::instance();
00279     for (EntryDescriptionRegistry::const_iterator
00280            i = edreg.begin(),
00281            e = edreg.end();
00282          i != e;
00283          ++i) {
00284         hash = const_cast<EntryDescriptionID*>(&(i->first)); // cast needed because keys are const
00285         desc = &(i->second);
00286         entryDescriptionTree_->Fill();
00287       }
00288   }

void edm::RootOutputFile::writeEventHistory (  ) 

Definition at line 313 of file RootOutputFile.cc.

References eventHistoryTree_, and edm::RootOutputTree::writeTTree().

void edm::RootOutputFile::writeFileFormatVersion (  ) 

Definition at line 290 of file RootOutputFile.cc.

References b, edm::PoolOutputModule::basketSize(), edm::fileFormatVersion, edm::poolNames::fileFormatVersionBranchName(), edm::getFileFormatVersion(), metaDataTree_, and om_.

00290                                               {
00291     FileFormatVersion fileFormatVersion(getFileFormatVersion());
00292     FileFormatVersion * pFileFmtVsn = &fileFormatVersion;
00293     TBranch* b = metaDataTree_->Branch(poolNames::fileFormatVersionBranchName().c_str(), &pFileFmtVsn, om_->basketSize(), 0);
00294     assert(b);
00295     b->Fill();
00296   }

void edm::RootOutputFile::writeFileIdentifier (  ) 

Definition at line 298 of file RootOutputFile.cc.

References b, edm::PoolOutputModule::basketSize(), fid_, edm::poolNames::fileIdentifierBranchName(), metaDataTree_, and om_.

00298                                            {
00299     FileID *fidPtr = &fid_;
00300     TBranch* b = metaDataTree_->Branch(poolNames::fileIdentifierBranchName().c_str(), &fidPtr, om_->basketSize(), 0);
00301     assert(b);
00302     b->Fill();
00303   }

void edm::RootOutputFile::writeFileIndex (  ) 

Definition at line 305 of file RootOutputFile.cc.

References b, edm::PoolOutputModule::basketSize(), fileIndex_, edm::poolNames::fileIndexBranchName(), metaDataTree_, om_, and edm::FileIndex::sortBy_Run_Lumi_Event().

00305                                       {
00306     fileIndex_.sortBy_Run_Lumi_Event();
00307     FileIndex *findexPtr = &fileIndex_;
00308     TBranch* b = metaDataTree_->Branch(poolNames::fileIndexBranchName().c_str(), &findexPtr, om_->basketSize(), 0);
00309     assert(b);
00310     b->Fill();
00311   }

void edm::RootOutputFile::writeLuminosityBlock ( LuminosityBlockPrincipal const &  lb  ) 

Definition at line 246 of file RootOutputFile.cc.

References edm::FileIndex::addEntry(), edm::LuminosityBlockPrincipal::aux(), fileIndex_, fillBranches(), edm::InLumi, lumiEntryNumber_, edm::LuminosityBlockAuxiliary::luminosityBlock(), pLumiAux_, pLumiEntryInfoVector_, and edm::LuminosityBlockAuxiliary::run().

00246                                                                               {
00247     // Auxiliary branch
00248     pLumiAux_ = &lb.aux();
00249     // Add lumi to index.
00250     fileIndex_.addEntry(pLumiAux_->run(), pLumiAux_->luminosityBlock(), 0U, lumiEntryNumber_);
00251     ++lumiEntryNumber_;
00252     fillBranches(InLumi, lb, pLumiEntryInfoVector_);
00253   }

void edm::RootOutputFile::writeModuleDescriptionRegistry (  ) 

Definition at line 328 of file RootOutputFile.cc.

References b, edm::PoolOutputModule::basketSize(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), metaDataTree_, edm::poolNames::moduleDescriptionMapBranchName(), and om_.

00328                                                       { 
00329     ModuleDescriptionMap *pModDescMap = &ModuleDescriptionRegistry::instance()->data();
00330     TBranch* b = metaDataTree_->Branch(poolNames::moduleDescriptionMapBranchName().c_str(), &pModDescMap, om_->basketSize(), 0);
00331     assert(b);
00332     b->Fill();
00333   }

void edm::RootOutputFile::writeOne ( EventPrincipal const &  e  ) 

Definition at line 200 of file RootOutputFile.cc.

References edm::FileIndex::addEntry(), edm::EventPrincipal::aux(), HLT_VtxMuL3::dataType, dataTypeReported_, lat::endl(), edm::EventID::event(), edm::EventAuxiliary::event(), eventEntryNumber_, eventHistoryTree_, edm::errors::FatalRootError, fileIndex_, fillBranches(), edm::EventPrincipal::history(), edm::EventPrincipal::id(), edm::InEvent, edm::EventAuxiliary::isRealData(), edm::EventAuxiliary::luminosityBlock(), om_, pEventAux_, pEventEntryInfoVector_, pHistory_, edm::Principal::processHistoryID(), edm::EventAuxiliary::processHistoryID_, reportToken_, edm::EventID::run(), edm::EventAuxiliary::run(), and edm::OutputModule::selectorConfig().

00200                                                        {
00201     // Auxiliary branch
00202     pEventAux_ = &e.aux();
00203    
00204     // Store an invailid process history ID in EventAuxiliary for obsolete field.
00205     pEventAux_->processHistoryID_ = ProcessHistoryID();
00206     
00207     // Because getting the data may cause an exception to be thrown we want to do that
00208     // first before writing anything to the file about this event
00209     // NOTE: pEventAux_ must be set before calling fillBranches since it gets written out
00210     // in that routine.
00211     fillBranches(InEvent, e, pEventEntryInfoVector_);
00212      
00213     // History branch
00214     History historyForOutput(e.history());
00215     historyForOutput.addEntry(om_->selectorConfig());
00216     //NOTE: EventPrincipal::processHistoryID has the real value since we just injected a dummy
00217     // value for processHistoryID into the EventAuxilliary
00218     historyForOutput.setProcessHistoryID(e.processHistoryID());
00219     pHistory_ = &historyForOutput;
00220     int sz = eventHistoryTree_->Fill();
00221     if ( sz <= 0)
00222       throw edm::Exception(edm::errors::FatalRootError) 
00223         << "Failed to fill the History tree for event: " << e.id()
00224         << "\nTTree::Fill() returned " << sz << " bytes written." << std::endl;
00225 
00226     // Add the dataType to the job report if it hasn't already been done
00227     if(!dataTypeReported_) {
00228       Service<JobReport> reportSvc;
00229       std::string dataType("MC");
00230       if(pEventAux_->isRealData())  dataType = "Data";
00231       reportSvc->reportDataType(reportToken_,dataType);
00232       dataTypeReported_ = true;
00233     }
00234 
00235     pHistory_ = & e.history();
00236 
00237     // Add event to index
00238     fileIndex_.addEntry(pEventAux_->run(), pEventAux_->luminosityBlock(), pEventAux_->event(), eventEntryNumber_);
00239     ++eventEntryNumber_;
00240 
00241     // Report event written 
00242     Service<JobReport> reportSvc;
00243     reportSvc->eventWrittenToFile(reportToken_, e.id().run(), e.id().event());
00244   }

void edm::RootOutputFile::writeParameterSetRegistry (  ) 

Definition at line 335 of file RootOutputFile.cc.

References b, edm::PoolOutputModule::basketSize(), edm::pset::fill(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), metaDataTree_, om_, and edm::poolNames::parameterSetMapBranchName().

00335                                                  { 
00336     typedef std::map<ParameterSetID, ParameterSetBlob> ParameterSetMap;
00337     ParameterSetMap psetMap;
00338     pset::fill(pset::Registry::instance(), psetMap);
00339     ParameterSetMap *pPsetMap = &psetMap;
00340     TBranch* b = metaDataTree_->Branch(poolNames::parameterSetMapBranchName().c_str(), &pPsetMap, om_->basketSize(), 0);
00341     assert(b);
00342     b->Fill();
00343   }

void edm::RootOutputFile::writeProcessConfigurationRegistry (  ) 

Definition at line 317 of file RootOutputFile.cc.

00317                                                          {
00318     // We don't do this yet; currently we're storing a slightly bloated ProcessHistoryRegistry.
00319   }

void edm::RootOutputFile::writeProcessHistoryRegistry (  ) 

Definition at line 321 of file RootOutputFile.cc.

References b, edm::PoolOutputModule::basketSize(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), metaDataTree_, om_, and edm::poolNames::processHistoryMapBranchName().

00321                                                    { 
00322     ProcessHistoryMap *pProcHistMap = &ProcessHistoryRegistry::instance()->data();
00323     TBranch* b = metaDataTree_->Branch(poolNames::processHistoryMapBranchName().c_str(), &pProcHistMap, om_->basketSize(), 0);
00324     assert(b);
00325     b->Fill();
00326   }

void edm::RootOutputFile::writeProductDependencies (  ) 

Definition at line 369 of file RootOutputFile.cc.

References b, edm::PoolOutputModule::basketSize(), edm::OutputModule::branchChildren(), metaDataTree_, om_, and edm::poolNames::productDependenciesBranchName().

00369                                                 { 
00370     BranchChildren& pDeps = const_cast<BranchChildren&>(om_->branchChildren());
00371     BranchChildren * ppDeps = &pDeps;
00372     TBranch* b = metaDataTree_->Branch(poolNames::productDependenciesBranchName().c_str(), &ppDeps, om_->basketSize(), 0);
00373     assert(b);
00374     b->Fill();
00375   }

void edm::RootOutputFile::writeProductDescriptionRegistry (  ) 

Definition at line 345 of file RootOutputFile.cc.

References b, edm::PoolOutputModule::basketSize(), branchesWithStoredHistory_, end, it, metaDataTree_, om_, and edm::poolNames::productDescriptionBranchName().

00345                                                        { 
00346     // Make a local copy of the ProductRegistry, removing any transient or pruned products.
00347     typedef ProductRegistry::ProductList ProductList;
00348     edm::Service<edm::ConstProductRegistry> reg;
00349     ProductRegistry pReg(reg->productList(), reg->nextID());
00350     ProductList & pList  = const_cast<ProductList &>(pReg.productList());
00351     std::set<BranchID>::iterator end = branchesWithStoredHistory_.end();
00352     for (ProductList::iterator it = pList.begin(); it != pList.end(); ) {
00353       if (branchesWithStoredHistory_.find(it->second.branchID()) == end) {
00354         // avoid invalidating iterator on deletion
00355         ProductList::iterator itCopy = it;
00356         ++it;
00357         pList.erase(itCopy);
00358         
00359       } else {
00360         ++it;
00361       }
00362     }
00363 
00364     ProductRegistry * ppReg = &pReg;
00365     TBranch* b = metaDataTree_->Branch(poolNames::productDescriptionBranchName().c_str(), &ppReg, om_->basketSize(), 0);
00366     assert(b);
00367     b->Fill();
00368   } 

void edm::RootOutputFile::writeRun ( RunPrincipal const &  r  ) 

Definition at line 255 of file RootOutputFile.cc.

References edm::FileIndex::addEntry(), edm::RunPrincipal::aux(), fileIndex_, fillBranches(), edm::InRun, pRunAux_, pRunEntryInfoVector_, edm::RunAuxiliary::run(), and runEntryNumber_.

00255                                                      {
00256     // Auxiliary branch
00257     pRunAux_ = &r.aux();
00258     // Add run to index.
00259     fileIndex_.addEntry(pRunAux_->run(), 0U, 0U, runEntryNumber_);
00260     ++runEntryNumber_;
00261     fillBranches(InRun, r, pRunEntryInfoVector_);
00262   }


Member Data Documentation

std::set<BranchID> edm::RootOutputFile::branchesWithStoredHistory_ [private]

Definition at line 128 of file RootOutputFile.h.

Referenced by fillBranches(), insertAncestors(), RootOutputFile(), and writeProductDescriptionRegistry().

bool edm::RootOutputFile::currentlyFastCloning_ [private]

Definition at line 103 of file RootOutputFile.h.

Referenced by beginInputFile(), and fillBranches().

bool edm::RootOutputFile::dataTypeReported_ [private]

Definition at line 127 of file RootOutputFile.h.

Referenced by writeOne().

TTree* edm::RootOutputFile::entryDescriptionTree_ [private]

Definition at line 111 of file RootOutputFile.h.

Referenced by finishEndFile(), RootOutputFile(), and writeEntryDescriptions().

EventEntryInfoVector edm::RootOutputFile::eventEntryInfoVector_ [private]

Definition at line 116 of file RootOutputFile.h.

FileIndex::EntryNumber_t edm::RootOutputFile::eventEntryNumber_ [private]

Definition at line 107 of file RootOutputFile.h.

Referenced by writeOne().

TTree* edm::RootOutputFile::eventHistoryTree_ [private]

Definition at line 112 of file RootOutputFile.h.

Referenced by RootOutputFile(), writeEventHistory(), and writeOne().

RootOutputTree edm::RootOutputFile::eventTree_ [private]

Definition at line 123 of file RootOutputFile.h.

Referenced by beginInputFile(), respondToCloseInputFile(), and RootOutputFile().

FileID edm::RootOutputFile::fid_ [private]

Definition at line 105 of file RootOutputFile.h.

Referenced by RootOutputFile(), and writeFileIdentifier().

std::string edm::RootOutputFile::file_ [private]

Definition at line 99 of file RootOutputFile.h.

Referenced by RootOutputFile().

FileIndex edm::RootOutputFile::fileIndex_ [private]

Definition at line 106 of file RootOutputFile.h.

Referenced by writeFileIndex(), writeLuminosityBlock(), writeOne(), and writeRun().

boost::shared_ptr<TFile> edm::RootOutputFile::filePtr_ [private]

Definition at line 104 of file RootOutputFile.h.

Referenced by finishEndFile(), RootOutputFile(), and shouldWeCloseFile().

std::string edm::RootOutputFile::logicalFile_ [private]

Definition at line 100 of file RootOutputFile.h.

Referenced by RootOutputFile().

LumiEntryInfoVector edm::RootOutputFile::lumiEntryInfoVector_ [private]

Definition at line 117 of file RootOutputFile.h.

FileIndex::EntryNumber_t edm::RootOutputFile::lumiEntryNumber_ [private]

Definition at line 108 of file RootOutputFile.h.

Referenced by writeLuminosityBlock().

RootOutputTree edm::RootOutputFile::lumiTree_ [private]

Definition at line 124 of file RootOutputFile.h.

Referenced by respondToCloseInputFile(), and RootOutputFile().

TTree* edm::RootOutputFile::metaDataTree_ [private]

Definition at line 110 of file RootOutputFile.h.

Referenced by finishEndFile(), RootOutputFile(), writeFileFormatVersion(), writeFileIdentifier(), writeFileIndex(), writeModuleDescriptionRegistry(), writeParameterSetRegistry(), writeProcessHistoryRegistry(), writeProductDependencies(), and writeProductDescriptionRegistry().

PoolOutputModule const* edm::RootOutputFile::om_ [private]

Definition at line 102 of file RootOutputFile.h.

Referenced by beginInputFile(), fillBranches(), finishEndFile(), RootOutputFile(), shouldWeCloseFile(), writeEntryDescriptions(), writeFileFormatVersion(), writeFileIdentifier(), writeFileIndex(), writeModuleDescriptionRegistry(), writeOne(), writeParameterSetRegistry(), writeProcessHistoryRegistry(), writeProductDependencies(), and writeProductDescriptionRegistry().

EventAuxiliary const* edm::RootOutputFile::pEventAux_ [private]

Definition at line 113 of file RootOutputFile.h.

Referenced by writeOne().

EventEntryInfoVector* edm::RootOutputFile::pEventEntryInfoVector_ [private]

Definition at line 119 of file RootOutputFile.h.

Referenced by writeOne().

History const* edm::RootOutputFile::pHistory_ [private]

Definition at line 122 of file RootOutputFile.h.

Referenced by RootOutputFile(), and writeOne().

LuminosityBlockAuxiliary const* edm::RootOutputFile::pLumiAux_ [private]

Definition at line 114 of file RootOutputFile.h.

Referenced by writeLuminosityBlock().

LumiEntryInfoVector* edm::RootOutputFile::pLumiEntryInfoVector_ [private]

Definition at line 120 of file RootOutputFile.h.

Referenced by writeLuminosityBlock().

RunAuxiliary const* edm::RootOutputFile::pRunAux_ [private]

Definition at line 115 of file RootOutputFile.h.

Referenced by writeRun().

RunEntryInfoVector* edm::RootOutputFile::pRunEntryInfoVector_ [private]

Definition at line 121 of file RootOutputFile.h.

Referenced by writeRun().

JobReport::Token edm::RootOutputFile::reportToken_ [private]

Definition at line 101 of file RootOutputFile.h.

Referenced by finishEndFile(), RootOutputFile(), and writeOne().

RunEntryInfoVector edm::RootOutputFile::runEntryInfoVector_ [private]

Definition at line 118 of file RootOutputFile.h.

FileIndex::EntryNumber_t edm::RootOutputFile::runEntryNumber_ [private]

Definition at line 109 of file RootOutputFile.h.

Referenced by writeRun().

RootOutputTree edm::RootOutputFile::runTree_ [private]

Definition at line 125 of file RootOutputFile.h.

Referenced by respondToCloseInputFile(), and RootOutputFile().

RootOutputTreePtrArray edm::RootOutputFile::treePointers_ [private]

Definition at line 126 of file RootOutputFile.h.

Referenced by fillBranches(), finishEndFile(), and RootOutputFile().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:44:14 2009 for CMSSW by  doxygen 1.5.4