CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
edm::RootOutputFile Class Reference

#include <RootOutputFile.h>

Public Types

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

Public Member Functions

void beginInputFile (FileBlock const &fb, int remainingEvents)
 
std::string const & fileName () const
 
void finishEndFile ()
 
void respondToCloseInputFile (FileBlock const &fb)
 
 RootOutputFile (PoolOutputModule *om, std::string const &fileName, std::string const &logicalFileName)
 
bool shouldWeCloseFile () const
 
void writeBranchIDListRegistry ()
 
void writeFileFormatVersion ()
 
void writeFileIdentifier ()
 
void writeIndexIntoFile ()
 
void writeLuminosityBlock (LuminosityBlockPrincipal const &lb)
 
void writeOne (EventPrincipal const &e)
 
void writeParameterSetRegistry ()
 
void writeParentageRegistry ()
 
void writeProcessConfigurationRegistry ()
 
void writeProcessHistoryRegistry ()
 
void writeProductDependencies ()
 
void writeProductDescriptionRegistry ()
 
void writeRun (RunPrincipal const &r)
 
 ~RootOutputFile ()
 

Private Member Functions

void fillBranches (BranchType const &branchType, Principal const &principal, StoredProductProvenanceVector *productProvenanceVecPtr)
 
void insertAncestors (ProductProvenance const &iGetParents, EventPrincipal const &principal, bool produced, std::set< StoredProductProvenance > &oToFill)
 
bool insertProductProvenance (const ProductProvenance &, std::set< StoredProductProvenance > &oToInsert)
 
void setBranchAliases (TTree *tree, Selections const &branches) const
 

Private Attributes

std::set< BranchIDbranchesWithStoredHistory_
 
bool canFastCloneAux_
 
bool dataTypeReported_
 
StoredProductProvenanceVector eventEntryInfoVector_
 
IndexIntoFile::EntryNumber_t eventEntryNumber_
 
RootOutputTree eventTree_
 
FileID fid_
 
std::string file_
 
boost::shared_ptr< TFile > filePtr_
 
IndexIntoFile indexIntoFile_
 
std::string logicalFile_
 
LuminosityBlockAuxiliary lumiAux_
 
IndexIntoFile::EntryNumber_t lumiEntryNumber_
 
RootOutputTree lumiTree_
 
TTree * metaDataTree_
 
PoolOutputModule const * om_
 
TTree * parameterSetsTree_
 
std::map< ParentageID,
unsigned int > 
parentageIDs_
 
TTree * parentageTree_
 
BranchListIndexes const * pBranchListIndexes_
 
EventAuxiliary const * pEventAux_
 
StoredProductProvenanceVectorpEventEntryInfoVector_
 
EventSelectionIDVector const * pEventSelectionIDs_
 
LuminosityBlockAuxiliary const * pLumiAux_
 
RunAuxiliary const * pRunAux_
 
JobReport::Token reportToken_
 
RunAuxiliary runAux_
 
IndexIntoFile::EntryNumber_t runEntryNumber_
 
RootOutputTree runTree_
 
RootOutputTreePtrArray treePointers_
 
int whyNotFastClonable_
 

Detailed Description

Definition at line 40 of file RootOutputFile.h.

Member Typedef Documentation

Definition at line 42 of file RootOutputFile.h.

Definition at line 43 of file RootOutputFile.h.

Definition at line 44 of file RootOutputFile.h.

Constructor & Destructor Documentation

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

Definition at line 65 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::BranchTypeToProductProvenanceBranchName(), edm::PoolOutputModule::catalog(), edm::PoolOutputModule::compressionAlgorithm(), edm::errors::Configuration, edm::createGlobalIdentifier(), cms::Digest::digest(), edm::PoolOutputModule::eventAutoFlushSize(), edm::poolNames::eventSelectionsBranchName(), eventTree_, edm::hlt::Exception, fid_, file_, filePtr_, edm::BranchDescription::fullClassName(), edm::BranchDescription::getInterface(), i, edm::InEvent, edm::BranchDescription::init(), edm::InLumi, edm::InRun, logicalFile_, lumiTree_, edm::RootOutputTree::makeTTree(), metaDataTree_, edm::poolNames::metaDataTreeName(), edm::PoolOutputModule::moduleLabel(), edm::BranchDescription::moduleLabel(), edm::NumBranchTypes, om_, parameterSetsTree_, edm::poolNames::parameterSetsTreeName(), parentageTree_, edm::poolNames::parentageTreeName(), pBranchListIndexes_, pEventAux_, pEventEntryInfoVector_, pEventSelectionIDs_, pLumiAux_, edm::BranchDescription::processName(), edm::BranchDescription::productInstanceName(), pRunAux_, reportToken_, runTree_, edm::PoolOutputModule::selectedOutputItemList(), edm::RootOutputTree::setAutoFlush(), edm::sort_all(), AlCaHLTBitMon_QueryRunRegistry::string, cms::MD5Result::toString(), treePointers_, and edm::BranchDescription::wrappedName().

65  :
66  file_(fileName),
67  logicalFile_(logicalFileName),
68  reportToken_(0),
69  om_(om),
71  canFastCloneAux_(false),
72  filePtr_(TFile::Open(file_.c_str(), "recreate", "", om_->compressionLevel())),
73  fid_(),
74  eventEntryNumber_(0LL),
75  lumiEntryNumber_(0LL),
76  runEntryNumber_(0LL),
78  metaDataTree_(0),
80  parentageTree_(0),
81  lumiAux_(),
82  runAux_(),
83  pEventAux_(0),
85  pRunAux_(&runAux_),
93  treePointers_(),
94  dataTypeReported_(false),
95  parentageIDs_(),
97 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,30,0)
98  if (om_->compressionAlgorithm() == std::string("ZLIB")) {
99  filePtr_->SetCompressionAlgorithm(ROOT::kZLIB);
100  } else if (om_->compressionAlgorithm() == std::string("LZMA")) {
101  filePtr_->SetCompressionAlgorithm(ROOT::kLZMA);
102  } else {
103  throw Exception(errors::Configuration) << "PoolOutputModule configured with unknown compression algorithm '" << om_->compressionAlgorithm() << "'\n"
104  << "Allowed compression algorithms are ZLIB and LZMA\n";
105  }
106 #endif
107  if (-1 != om->eventAutoFlushSize()) {
108  eventTree_.setAutoFlush(-1*om->eventAutoFlushSize());
109  }
111  pEventAux_, om_->auxItems()[InEvent].basketSize_);
113  pEventEntryInfoVector_, om_->auxItems()[InEvent].basketSize_);
115  pEventSelectionIDs_, om_->auxItems()[InEvent].basketSize_,false);
117  pBranchListIndexes_, om_->auxItems()[InEvent].basketSize_);
118 
120  pLumiAux_, om_->auxItems()[InLumi].basketSize_);
121 
123  pRunAux_, om_->auxItems()[InRun].basketSize_);
124 
126  treePointers_[InLumi] = &lumiTree_;
127  treePointers_[InRun] = &runTree_;
128 
129  for(int i = InEvent; i < NumBranchTypes; ++i) {
130  BranchType branchType = static_cast<BranchType>(i);
131  RootOutputTree *theTree = treePointers_[branchType];
132  for(OutputItemList::const_iterator it = om_->selectedOutputItemList()[branchType].begin(),
133  itEnd = om_->selectedOutputItemList()[branchType].end();
134  it != itEnd; ++it) {
135  it->product_ = 0;
136  BranchDescription const& desc = *it->branchDescription_;
137  desc.init();
138  theTree->addBranch(desc.branchName(),
139  desc.wrappedName(),
140  desc.getInterface(),
141  it->product_,
142  it->splitLevel_,
143  it->basketSize_,
144  it->branchDescription_->produced());
145  //make sure we always store product registry info for all branches we create
146  branchesWithStoredHistory_.insert(it->branchID());
147  }
148  }
149  // Don't split metadata tree or event description tree
153 
154  fid_ = FileID(createGlobalIdentifier());
155 
156  // For the Job Report, get a vector of branch names in the "Events" tree.
157  // Also create a hash of all the branch names in the "Events" tree
158  // in a deterministic order, except use the full class name instead of the friendly class name.
159  // To avoid extra string copies, we create a vector of pointers into the product registry,
160  // and use a custom comparison operator for sorting.
161  std::vector<std::string> branchNames;
162  std::vector<BranchDescription const*> branches;
163  branchNames.reserve(om_->selectedOutputItemList()[InEvent].size());
164  branches.reserve(om->selectedOutputItemList()[InEvent].size());
165  for(OutputItemList::const_iterator it = om_->selectedOutputItemList()[InEvent].begin(),
166  itEnd = om_->selectedOutputItemList()[InEvent].end();
167  it != itEnd; ++it) {
168  branchNames.push_back(it->branchDescription_->branchName());
169  branches.push_back(it->branchDescription_);
170  }
171  // Now sort the branches for the hash.
172  sort_all(branches, sorterForJobReportHash);
173  // Now, make a concatenated string.
174  std::ostringstream oss;
175  char const underscore = '_';
176  for(std::vector<BranchDescription const*>::const_iterator it = branches.begin(), itEnd = branches.end(); it != itEnd; ++it) {
177  BranchDescription const& bd = **it;
178  oss << bd.fullClassName() << underscore
179  << bd.moduleLabel() << underscore
180  << bd.productInstanceName() << underscore
181  << bd.processName() << underscore;
182  }
183  std::string stringrep = oss.str();
184  cms::Digest md5alg(stringrep);
185 
186  // Register the output file with the JobReport service
187  // and get back the token for it.
188  std::string moduleName = "PoolOutputModule";
189  Service<JobReport> reportSvc;
190  reportToken_ = reportSvc->outputFileOpened(
191  file_, logicalFile_, // PFN and LFN
192  om_->catalog(), // catalog
193  moduleName, // module class name
194  om_->moduleLabel(), // module label
195  fid_.fid(), // file id (guid)
196  std::string(), // data type (not yet known, so string is empty).
197  md5alg.digest().toString(), // branch hash
198  branchNames); // branch names being written
199  }
int i
Definition: DBlmapReader.cc:9
LuminosityBlockAuxiliary lumiAux_
std::string const & BranchTypeToAuxiliaryBranchName(BranchType const &branchType)
Definition: BranchType.cc:114
std::string const & parentageTreeName()
Definition: BranchType.cc:158
std::string const & catalog() const
std::string const & moduleLabel() const
int const & compressionLevel() const
OutputItemListArray const & selectedOutputItemList() const
std::string const & eventSelectionsBranchName()
Definition: BranchType.cc:237
void setAutoFlush(Long64_t size)
BranchType
Definition: BranchType.h:11
std::set< BranchID > branchesWithStoredHistory_
std::vector< EventSelectionID > EventSelectionIDVector
std::string const & parameterSetsTreeName()
Definition: BranchType.cc:245
std::string const & fileName() const
std::map< ParentageID, unsigned int > parentageIDs_
RootOutputTree eventTree_
std::vector< BranchListIndex > BranchListIndexes
PoolOutputModule const * om_
std::string const & compressionAlgorithm() const
IndexIntoFile::EntryNumber_t eventEntryNumber_
LuminosityBlockAuxiliary const * pLumiAux_
std::string logicalFile_
int const & splitLevel() const
std::string const & metaDataTreeName()
Definition: BranchType.cc:167
static TTree * makeTTree(TFile *filePtr, std::string const &name, int splitLevel)
int const & whyNotFastClonable() const
EventSelectionIDVector const * pEventSelectionIDs_
StoredProductProvenanceVector * pEventEntryInfoVector_
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
Definition: Algorithms.h:120
RootOutputTree runTree_
StoredProductProvenanceVector eventEntryInfoVector_
AuxItemArray const & auxItems() const
void addAuxiliary(std::string const &branchName, T const *&pAux, int bufSize, bool allowCloning=true)
std::vector< StoredProductProvenance > StoredProductProvenanceVector
IndexIntoFile indexIntoFile_
int const & treeMaxVirtualSize() const
IndexIntoFile::EntryNumber_t runEntryNumber_
EventAuxiliary const * pEventAux_
RunAuxiliary runAux_
std::string const & BranchTypeToProductProvenanceBranchName(BranchType const &BranchType)
Definition: BranchType.cc:130
std::string const & branchListIndexesBranchName()
Definition: BranchType.cc:241
RootOutputTreePtrArray treePointers_
BranchListIndexes const * pBranchListIndexes_
IndexIntoFile::EntryNumber_t lumiEntryNumber_
RootOutputTree lumiTree_
boost::shared_ptr< TFile > filePtr_
RunAuxiliary const * pRunAux_
JobReport::Token reportToken_
std::string createGlobalIdentifier()
edm::RootOutputFile::~RootOutputFile ( )
inline

Definition at line 47 of file RootOutputFile.h.

47 {}

Member Function Documentation

void edm::RootOutputFile::beginInputFile ( FileBlock const &  fb,
int  remainingEvents 
)

Definition at line 291 of file RootOutputFile.cc.

References edm::PoolOutputModule::basketOrder(), edm::FileBlock::BranchMismatch, edm::FileBlock::CanFastClone, canFastCloneAux_, edm::RootOutputTree::checkIfFastClonable(), edm::RootOutputTree::checkSplitLevelsAndBasketSizes(), eventTree_, edm::hlt::Exception, file_, edm::FileBlock::fileName(), edm::PoolOutputModule::inputFileCount(), edm::match(), edm::RootOutputTree::maybeFastCloneTree(), edm::errors::MismatchedInputFiles, edm::FileBlock::NoRootInputSource, om_, edm::FileBlock::OutputMaxEventsTooSmall, edm::PoolOutputModule::overrideInputFileSplitLevels(), reportToken_, edm::FileBlock::SplitLevelMismatch, edm::FileBlock::tree(), edm::PoolOutputModule::whyNotFastClonable(), edm::FileBlock::whyNotFastClonable(), and whyNotFastClonable_.

291  {
292 
293  // Reset per input file information
295  canFastCloneAux_ = false;
296 
297  if(fb.tree() != 0) {
298 
299  whyNotFastClonable_ |= fb.whyNotFastClonable();
300 
301  if(remainingEvents >= 0 && remainingEvents < fb.tree()->GetEntries()) {
303  }
304 
306  if(!match) {
308  // We may be fast copying. We must disable fast copying if the split levels
309  // or basket sizes do not match.
311  } else {
312  // We are using the input split levels and basket sizes from the first input file
313  // for copied output branches. In this case, we throw an exception if any branches
314  // have different split levels or basket sizes in a subsequent input file.
315  // If the mismatch is in the first file, there is a bug somewhere, so we assert.
316  assert(om_->inputFileCount() > 1);
317  throw Exception(errors::MismatchedInputFiles, "RootOutputFile::beginInputFile()") <<
318  "Merge failure because input file " << file_ << " has different ROOT split levels or basket sizes\n" <<
319  "than previous files. To allow merging in splite of this, use the configuration parameter\n" <<
320  "overrideInputFileSplitLevels=cms.untracked.bool(True)\n" <<
321  "in every PoolOutputModule.\n";
322  }
323  }
324 
325  // Since this check can be time consuming, we do it only if we would otherwise fast clone.
327  if(!eventTree_.checkIfFastClonable(fb.tree())) {
329  }
330  }
331  // We now check if we can fast copy the auxiliary branches.
332  // We can do so only if we can otherwise fast copy,
333  // the input file has the current format (these branches are in the Events Tree),
334  // there are no newly dropped or produced products,
335  // no metadata has been dropped,
336  // ID's have not been modified,
337  // and the branch list indexes do not need modification.
338 
339  // Note: Fast copy of the EventProductProvenance branch is unsafe
340  // unless we can enforce that the parentage information for a fully copied
341  // output file will be the same as for the input file, with nothing dropped.
342  // This has never been enforced, and, withthe EDAlias feature, it may no longer
343  // work by accident.
344  // So, for now, we do not enable fast cloning of the non-product branches.
345 /*
346  Service<ConstProductRegistry> reg;
347  canFastCloneAux_ = (whyNotFastClonable_ == FileBlock::CanFastClone) &&
348  fb.fileFormatVersion().noMetaDataTrees() &&
349  !om_->hasNewlyDroppedBranch()[InEvent] &&
350  !fb.hasNewlyDroppedBranch()[InEvent] &&
351  om_->dropMetaData() == PoolOutputModule::DropNone &&
352  !reg->anyProductProduced() &&
353  !fb.modifiedIDs() &&
354  fb.branchListIndexesUnchanged();
355 */
356 
357  // Report the fast copying status.
358  Service<JobReport> reportSvc;
359  reportSvc->reportFastCopyingStatus(reportToken_, fb.fileName(), whyNotFastClonable_ == FileBlock::CanFastClone);
360  } else {
362  }
363 
365 
366  // Possibly issue warning or informational message if we haven't fast cloned.
367  if(fb.tree() != 0 && whyNotFastClonable_ != FileBlock::CanFastClone) {
368  maybeIssueWarning(whyNotFastClonable_, fb.fileName(), file_);
369  }
370  }
bool const & overrideInputFileSplitLevels() const
bool checkSplitLevelsAndBasketSizes(TTree *inputTree) const
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName, BranchDescription::MatchMode m)
bool checkIfFastClonable(TTree *inputTree) const
RootOutputTree eventTree_
PoolOutputModule const * om_
std::string const & basketOrder() const
int const & whyNotFastClonable() const
void maybeFastCloneTree(bool canFastClone, bool canFastCloneAux, TTree *tree, std::string const &option)
int const & inputFileCount() const
JobReport::Token reportToken_
std::string const& edm::RootOutputFile::fileName ( ) const
inline

Definition at line 68 of file RootOutputFile.h.

References file_.

68 {return file_;}
void edm::RootOutputFile::fillBranches ( BranchType const &  branchType,
Principal const &  principal,
StoredProductProvenanceVector productProvenanceVecPtr 
)
private

Definition at line 689 of file RootOutputFile.cc.

References branchesWithStoredHistory_, revisionDML::branchType(), edm::FileBlock::CanFastClone, compareJSON::const, CommonMethods::cp(), edm::PoolOutputModule::DropDroppedPrior, edm::PoolOutputModule::dropMetaData(), edm::PoolOutputModule::DropNone, edm::PoolOutputModule::DropPrior, read312RV_cfg::fastCloning, edm::Principal::getForOutput(), i, edm::InEvent, insertAncestors(), insertProductProvenance(), om_, cmsRelvalreport::principal(), edm::es::produced, edm::OutputHandle::productProvenance(), edm::PoolOutputModule::selectedOutputItemList(), treePointers_, whyNotFastClonable_, and edm::OutputHandle::wrapper().

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

692  {
693 
694  typedef std::vector<std::pair<TClass*, void const*> > Dummies;
695  Dummies dummies;
696 
698 
700 
701  std::set<StoredProductProvenance> provenanceToKeep;
702 
703  // Loop over EDProduct branches, fill the provenance, and write the branch.
704  for(OutputItemList::const_iterator i = items.begin(), iEnd = items.end(); i != iEnd; ++i) {
705 
706  BranchID const& id = i->branchDescription_->branchID();
707  branchesWithStoredHistory_.insert(id);
708 
709  bool produced = i->branchDescription_->produced();
710  bool keepProvenance = productProvenanceVecPtr != 0 &&
714  bool getProd = (produced || !fastCloning ||
715  treePointers_[branchType]->uncloned(i->branchDescription_->branchName()));
716 
717  void const* product = 0;
718  OutputHandle const oh = principal.getForOutput(id, getProd);
719  if(keepProvenance && oh.productProvenance()) {
720  insertProductProvenance(*oh.productProvenance(),provenanceToKeep);
721  //provenanceToKeep.insert(*oh.productProvenance());
722  EventPrincipal const& eventPrincipal = dynamic_cast<EventPrincipal const&>(principal);
723  assert(eventPrincipal.branchMapperPtr());
724  insertAncestors(*oh.productProvenance(), eventPrincipal, produced, provenanceToKeep);
725  }
726  product = oh.wrapper();
727  if(getProd) {
728  if(product == 0) {
729  // No product with this ID is in the event.
730  // Add a null product.
731  TClass* cp = gROOT->GetClass(i->branchDescription_->wrappedName().c_str());
732  product = cp->New();
733  dummies.emplace_back(cp, product);
734  }
735  i->product_ = product;
736  }
737  }
738 
739  if(productProvenanceVecPtr != 0) productProvenanceVecPtr->assign(provenanceToKeep.begin(), provenanceToKeep.end());
740  treePointers_[branchType]->fillTree();
741  if(productProvenanceVecPtr != 0) productProvenanceVecPtr->clear();
742  for(Dummies::iterator it = dummies.begin(), itEnd = dummies.end(); it != itEnd; ++it) {
743  it->first->Destructor(const_cast<void *>(it->second));
744  }
745  }
int i
Definition: DBlmapReader.cc:9
DropMetaData const & dropMetaData() const
void insertAncestors(ProductProvenance const &iGetParents, EventPrincipal const &principal, bool produced, std::set< StoredProductProvenance > &oToFill)
OutputItemListArray const & selectedOutputItemList() const
std::set< BranchID > branchesWithStoredHistory_
PoolOutputModule const * om_
PoolOutputModule::OutputItemList OutputItemList
eventsetup::produce::Produce produced
Definition: ESProducts.cc:21
string const
Definition: compareJSON.py:14
bool insertProductProvenance(const ProductProvenance &, std::set< StoredProductProvenance > &oToInsert)
RootOutputTreePtrArray treePointers_
void edm::RootOutputFile::finishEndFile ( )

Definition at line 610 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().

610  {
611  metaDataTree_->SetEntries(-1);
614 
616 
617  // Create branch aliases for all the branches in the
618  // events/lumis/runs trees. The loop is over all types of data
619  // products.
620  for(int i = InEvent; i < NumBranchTypes; ++i) {
621  BranchType branchType = static_cast<BranchType>(i);
623  treePointers_[branchType]->writeTree();
624  }
625 
626  // close the file -- mfp
627  // Just to play it safe, zero all pointers to objects in the TFile to be closed.
629  for(RootOutputTreePtrArray::iterator it = treePointers_.begin(), itEnd = treePointers_.end(); it != itEnd; ++it) {
630  (*it)->close();
631  (*it) = 0;
632  }
633  filePtr_->Close();
634  filePtr_.reset();
635 
636  // report that file has been closed
637  Service<JobReport> reportSvc;
638  reportSvc->outputFileClosed(reportToken_);
639 
640  }
int i
Definition: DBlmapReader.cc:9
SelectionsArray const & keptProducts() const
Definition: OutputModule.h:61
void setBranchAliases(TTree *tree, Selections const &branches) const
BranchType
Definition: BranchType.h:11
PoolOutputModule const * om_
static void writeTTree(TTree *tree)
RootOutputTreePtrArray treePointers_
boost::shared_ptr< TFile > filePtr_
JobReport::Token reportToken_
void edm::RootOutputFile::insertAncestors ( ProductProvenance const &  iGetParents,
EventPrincipal const &  principal,
bool  produced,
std::set< StoredProductProvenance > &  oToFill 
)
private

Definition at line 664 of file RootOutputFile.cc.

References branchesWithStoredHistory_, edm::ProductProvenance::branchID(), edm::BranchMapper::branchIDToProvenance(), edm::EventPrincipal::branchMapperPtr(), edm::PoolOutputModule::DropAll, edm::PoolOutputModule::DropDroppedPrior, edm::PoolOutputModule::dropMetaData(), edm::PoolOutputModule::DropNone, edm::PoolOutputModule::DropPrior, edm::EventPrincipal::getProvenance(), info, insertProductProvenance(), om_, edm::ProductProvenance::parentage(), edm::Parentage::parents(), and edm::es::produced.

Referenced by fillBranches().

667  {
671  BranchMapper const& iMapper = *principal.branchMapperPtr();
672  std::vector<BranchID> const& parentIDs = iGetParents.parentage().parents();
673  for(std::vector<BranchID>::const_iterator it = parentIDs.begin(), itEnd = parentIDs.end();
674  it != itEnd; ++it) {
675  branchesWithStoredHistory_.insert(*it);
676  ProductProvenance const* info = iMapper.branchIDToProvenance(*it);
677  if(info) {
679  principal.getProvenance(info->branchID()).product().produced()) {
680  if(insertProductProvenance(*info,oToFill) ) {
681  //haven't seen this one yet
682  insertAncestors(*info, principal, produced, oToFill);
683  }
684  }
685  }
686  }
687  }
DropMetaData const & dropMetaData() const
void insertAncestors(ProductProvenance const &iGetParents, EventPrincipal const &principal, bool produced, std::set< StoredProductProvenance > &oToFill)
std::set< BranchID > branchesWithStoredHistory_
PoolOutputModule const * om_
eventsetup::produce::Produce produced
Definition: ESProducts.cc:21
bool insertProductProvenance(const ProductProvenance &, std::set< StoredProductProvenance > &oToInsert)
bool edm::RootOutputFile::insertProductProvenance ( const ProductProvenance ,
std::set< StoredProductProvenance > &  oToInsert 
)
private

Definition at line 748 of file RootOutputFile.cc.

References edm::ProductProvenance::branchID(), edm::StoredProductProvenance::branchID_, edm::hlt::Exception, i, edm::BranchID::id(), edm::errors::LogicError, edm::ProductProvenance::parentageID(), edm::StoredProductProvenance::parentageIDIndex_, and parentageIDs_.

Referenced by fillBranches(), and insertAncestors().

749  {
750  StoredProductProvenance toStore;
751  toStore.branchID_ = iProv.branchID().id();
752  std::set<edm::StoredProductProvenance>::iterator itFound = oToInsert.find(toStore);
753  if(itFound == oToInsert.end()) {
754  //get the index to the ParentageID or insert a new value if not already present
755  std::pair<std::map<edm::ParentageID,unsigned int>::iterator,bool> i = parentageIDs_.insert(std::make_pair(iProv.parentageID(),static_cast<unsigned int>(parentageIDs_.size())));
756  toStore.parentageIDIndex_ = i.first->second;
757  if(toStore.parentageIDIndex_ >= parentageIDs_.size()) {
759  << "RootOutputFile::insertProductProvenance\n"
760  << "The parentage ID index value " << toStore.parentageIDIndex_ << " is out of bounds. The maximum value is currently " << parentageIDs_.size()-1 << ".\n"
761  << "This should never happen.\n"
762  << "Please report this to the framework hypernews forum 'hn-cms-edmFramework@cern.ch'.\n";
763  }
764 
765  oToInsert.insert(toStore);
766  return true;
767  }
768  return false;
769  }
int i
Definition: DBlmapReader.cc:9
std::map< ParentageID, unsigned int > parentageIDs_
void edm::RootOutputFile::respondToCloseInputFile ( FileBlock const &  fb)

Definition at line 372 of file RootOutputFile.cc.

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

372  {
376  }
RootOutputTree eventTree_
RootOutputTree runTree_
RootOutputTree lumiTree_
void edm::RootOutputFile::setBranchAliases ( TTree *  tree,
Selections const &  branches 
) const
private

Definition at line 643 of file RootOutputFile.cc.

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

Referenced by finishEndFile().

643  {
644  if(tree && tree->GetNbranches() != 0) {
645  for(Selections::const_iterator i = branches.begin(), iEnd = branches.end();
646  i != iEnd; ++i) {
647  BranchDescription const& pd = **i;
648  std::string const& full = pd.branchName() + "obj";
649  if(pd.branchAliases().empty()) {
650  std::string const& alias =
651  (pd.productInstanceName().empty() ? pd.moduleLabel() : pd.productInstanceName());
652  tree->SetAlias(alias.c_str(), full.c_str());
653  } else {
654  std::set<std::string>::const_iterator it = pd.branchAliases().begin(), itEnd = pd.branchAliases().end();
655  for(; it != itEnd; ++it) {
656  tree->SetAlias((*it).c_str(), full.c_str());
657  }
658  }
659  }
660  }
661  }
int i
Definition: DBlmapReader.cc:9
Definition: GenABIO.cc:193
bool edm::RootOutputFile::shouldWeCloseFile ( ) const

Definition at line 378 of file RootOutputFile.cc.

References filePtr_, edm::PoolOutputModule::maxFileSize(), om_, and findQualityFiles::size.

378  {
379  unsigned int const oneK = 1024;
380  Long64_t size = filePtr_->GetSize()/oneK;
381  return(size >= om_->maxFileSize());
382  }
unsigned int const & maxFileSize() const
PoolOutputModule const * om_
boost::shared_ptr< TFile > filePtr_
tuple size
Write out results.
void edm::RootOutputFile::writeBranchIDListRegistry ( )

Definition at line 548 of file RootOutputFile.cc.

References b, edm::PoolOutputModule::basketSize(), edm::poolNames::branchIDListBranchName(), edm::OutputModule::branchIDLists(), metaDataTree_, om_, and AlCaHLTBitMon_ParallelJobs::p.

548  {
549  BranchIDLists const* p = om_->branchIDLists();
550  TBranch* b = metaDataTree_->Branch(poolNames::branchIDListBranchName().c_str(), &p, om_->basketSize(), 0);
551  assert(b);
552  b->Fill();
553  }
int const & basketSize() const
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
PoolOutputModule const * om_
double b
Definition: hdecay.h:120
BranchIDLists const * branchIDLists() const
std::string const & branchIDListBranchName()
Definition: BranchType.cc:207
void edm::RootOutputFile::writeFileFormatVersion ( )

Definition at line 489 of file RootOutputFile.cc.

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

489  {
490  FileFormatVersion fileFormatVersion(getFileFormatVersion());
491  FileFormatVersion* pFileFmtVsn = &fileFormatVersion;
492  TBranch* b = metaDataTree_->Branch(poolNames::fileFormatVersionBranchName().c_str(), &pFileFmtVsn, om_->basketSize(), 0);
493  assert(b);
494  b->Fill();
495  }
int const & basketSize() const
std::string const & fileFormatVersionBranchName()
Definition: BranchType.cc:212
PoolOutputModule const * om_
int getFileFormatVersion()
double b
Definition: hdecay.h:120
void edm::RootOutputFile::writeFileIdentifier ( )

Definition at line 497 of file RootOutputFile.cc.

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

497  {
498  FileID* fidPtr = &fid_;
499  TBranch* b = metaDataTree_->Branch(poolNames::fileIdentifierBranchName().c_str(), &fidPtr, om_->basketSize(), 0);
500  assert(b);
501  b->Fill();
502  }
int const & basketSize() const
PoolOutputModule const * om_
double b
Definition: hdecay.h:120
std::string const & fileIdentifierBranchName()
Definition: BranchType.cc:217
void edm::RootOutputFile::writeIndexIntoFile ( )

Definition at line 504 of file RootOutputFile.cc.

References cms::Exception::addContext(), b, edm::PoolOutputModule::basketSize(), edm::RootOutputTree::checkEntriesInReadBranches(), eventEntryNumber_, eventTree_, indexIntoFile_, edm::poolNames::indexIntoFileBranchName(), metaDataTree_, om_, edm::errors::OtherCMS, and edm::IndexIntoFile::sortVector_Run_Or_Lumi_Entries().

504  {
507  ex << "The number of entries in at least one output TBranch whose entries\n"
508  "were copied from the input does not match the number of events\n"
509  "recorded in IndexIntoFile. This might (or might not) indicate a\n"
510  "problem related to fast copy.";
511  ex.addContext("Calling RootOutputFile::writeIndexIntoFile");
512  throw ex;
513  }
515  IndexIntoFile* iifPtr = &indexIntoFile_;
516  TBranch* b = metaDataTree_->Branch(poolNames::indexIntoFileBranchName().c_str(), &iifPtr, om_->basketSize(), 0);
517  assert(b);
518  b->Fill();
519  }
int const & basketSize() const
void sortVector_Run_Or_Lumi_Entries()
RootOutputTree eventTree_
PoolOutputModule const * om_
IndexIntoFile::EntryNumber_t eventEntryNumber_
std::string const & indexIntoFileBranchName()
Definition: BranchType.cc:227
bool checkEntriesInReadBranches(Long64_t expectedNumberOfEntries) const
double b
Definition: hdecay.h:120
IndexIntoFile indexIntoFile_
void edm::RootOutputFile::writeLuminosityBlock ( LuminosityBlockPrincipal const &  lb)

Definition at line 426 of file RootOutputFile.cc.

References edm::IndexIntoFile::addEntry(), edm::LuminosityBlockPrincipal::aux(), edm::detail::ThreadSafeRegistry< KEY, T, E >::extra(), fillBranches(), indexIntoFile_, edm::InLumi, edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), lumiAux_, lumiEntryNumber_, edm::LuminosityBlockAuxiliary::luminosityBlock(), lumiTree_, edm::RootOutputTree::optimizeBaskets(), edm::Principal::processHistoryID(), edm::LuminosityBlockAuxiliary::run(), and edm::LuminosityBlockAuxiliary::setProcessHistoryID().

426  {
427  // Auxiliary branch
428  // NOTE: lumiAux_ must be filled before calling fillBranches since it gets written out in that routine.
429  lumiAux_ = lb.aux();
430  // Use the updated process historyID
431  lumiAux_.setProcessHistoryID(lb.processHistoryID());
432  // Store the reduced ID in the IndexIntoFile
433  ProcessHistoryID reducedPHID = ProcessHistoryRegistry::instance()->extra().reduceProcessHistoryID(lb.processHistoryID());
434  // Add lumi to index.
437  fillBranches(InLumi, lb, 0);
438  lumiTree_.optimizeBaskets(10ULL*1024*1024);
439  }
LuminosityBlockAuxiliary lumiAux_
static ThreadSafeRegistry * instance()
void fillBranches(BranchType const &branchType, Principal const &principal, StoredProductProvenanceVector *productProvenanceVecPtr)
void setProcessHistoryID(ProcessHistoryID const &phid)
LuminosityBlockNumber_t luminosityBlock() const
void addEntry(ProcessHistoryID const &processHistoryID, RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, EntryNumber_t entry)
Hash< ProcessHistoryType > ProcessHistoryID
IndexIntoFile indexIntoFile_
IndexIntoFile::EntryNumber_t lumiEntryNumber_
RootOutputTree lumiTree_
void optimizeBaskets(ULong64_t size)
void edm::RootOutputFile::writeOne ( EventPrincipal const &  e)

Definition at line 384 of file RootOutputFile.cc.

References edm::IndexIntoFile::addEntry(), edm::EventPrincipal::aux(), edm::EventPrincipal::branchListIndexes(), dtTPAnalyzer_cfg::dataType, dataTypeReported_, edm::EventID::event(), edm::EventAuxiliary::event(), eventEntryNumber_, edm::EventPrincipal::eventSelectionIDs(), edm::detail::ThreadSafeRegistry< KEY, T, E >::extra(), fillBranches(), edm::EventPrincipal::id(), indexIntoFile_, edm::InEvent, edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), 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(), AlCaHLTBitMon_QueryRunRegistry::string, and edm::OutputModule::wantAllEvents().

384  {
385  // Auxiliary branch
386  pEventAux_ = &e.aux();
387 
388  // Because getting the data may cause an exception to be thrown we want to do that
389  // first before writing anything to the file about this event
390  // NOTE: pEventAux_, pBranchListIndexes_, pEventSelectionIDs_, and pEventEntryInfoVector_
391  // must be set before calling fillBranches since they get written out in that routine.
392  assert(pEventAux_->processHistoryID() == e.processHistoryID());
393  pBranchListIndexes_ = &e.branchListIndexes();
394 
395  // Note: The EventSelectionIDVector should have a one to one correspondence with the processes in the process history.
396  // Therefore, a new entry should be added if and only if the current process has been added to the process history,
397  // which is done if and only if there is a produced product.
399  EventSelectionIDVector esids = e.eventSelectionIDs();
400  if (reg->anyProductProduced() || !om_->wantAllEvents()) {
401  esids.push_back(om_->selectorConfig());
402  }
403  pEventSelectionIDs_ = &esids;
405 
406  // Add the dataType to the job report if it hasn't already been done
407  if(!dataTypeReported_) {
408  Service<JobReport> reportSvc;
409  std::string dataType("MC");
410  if(pEventAux_->isRealData()) dataType = "Data";
411  reportSvc->reportDataType(reportToken_, dataType);
412  dataTypeReported_ = true;
413  }
414 
415  // Store the reduced ID in the IndexIntoFile
416  ProcessHistoryID reducedPHID = ProcessHistoryRegistry::instance()->extra().reduceProcessHistoryID(e.processHistoryID());
417  // Add event to index
420 
421  // Report event written
422  Service<JobReport> reportSvc;
423  reportSvc->eventWrittenToFile(reportToken_, e.id().run(), e.id().event());
424  }
bool isRealData() const
static ThreadSafeRegistry * instance()
RunNumber_t run() const
std::vector< EventSelectionID > EventSelectionIDVector
LuminosityBlockNumber_t luminosityBlock() const
bool wantAllEvents() const
Definition: OutputModule.h:71
PoolOutputModule const * om_
IndexIntoFile::EntryNumber_t eventEntryNumber_
void fillBranches(BranchType const &branchType, Principal const &principal, StoredProductProvenanceVector *productProvenanceVecPtr)
void addEntry(ProcessHistoryID const &processHistoryID, RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, EntryNumber_t entry)
Hash< ProcessHistoryType > ProcessHistoryID
EventSelectionIDVector const * pEventSelectionIDs_
StoredProductProvenanceVector * pEventEntryInfoVector_
IndexIntoFile indexIntoFile_
ProcessHistoryID const & processHistoryID() const
EventAuxiliary const * pEventAux_
BranchListIndexes const * pBranchListIndexes_
EventNumber_t event() const
JobReport::Token reportToken_
ParameterSetID selectorConfig() const
Definition: OutputModule.h:92
void edm::RootOutputFile::writeParameterSetRegistry ( )

Definition at line 555 of file RootOutputFile.cc.

References b, edm::PoolOutputModule::basketSize(), edm::detail::ThreadSafeRegistry< KEY, T, E >::begin(), edm::detail::ThreadSafeRegistry< KEY, T, E >::end(), edm::poolNames::idToParameterSetBlobsBranchName(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), om_, and parameterSetsTree_.

555  {
556  std::pair<ParameterSetID, ParameterSetBlob> idToBlob;
557  std::pair<ParameterSetID, ParameterSetBlob>* pIdToBlob = &idToBlob;
558  TBranch* b = parameterSetsTree_->Branch(poolNames::idToParameterSetBlobsBranchName().c_str(),&pIdToBlob,om_->basketSize(), 0);
559 
561  itEnd = pset::Registry::instance()->end();
562  it != itEnd;
563  ++it) {
564  idToBlob.first = it->first;
565  idToBlob.second.pset() = it->second.toString();
566 
567  b->Fill();
568  }
569  }
std::string const & idToParameterSetBlobsBranchName()
Definition: BranchType.cc:249
int const & basketSize() const
static ThreadSafeRegistry * instance()
PoolOutputModule const * om_
collection_type::const_iterator const_iterator
double b
Definition: hdecay.h:120
void edm::RootOutputFile::writeParentageRegistry ( )

Definition at line 456 of file RootOutputFile.cc.

References edm::PoolOutputModule::basketSize(), edm::hlt::Exception, edm::errors::FatalRootError, edm::detail::ThreadSafeRegistry< KEY, T, E >::getMapped(), edm::detail::ThreadSafeRegistry< KEY, T, E >::insertMapped(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), om_, edm::poolNames::parentageBranchName(), parentageIDs_, and parentageTree_.

456  {
457  Parentage const* desc(0);
458 
459  if(!parentageTree_->Branch(poolNames::parentageBranchName().c_str(),
460  &desc, om_->basketSize(), 0))
462  << "Failed to create a branch for Parentages in the output file";
463 
464 
465  //NOTE: for some reason the empty Parentage is not added to the registry some of the time
467  ptReg.insertMapped(Parentage());
468 
469  std::vector<ParentageID> orderedIDs(parentageIDs_.size());
470  for(std::map<ParentageID,unsigned int>::const_iterator it = parentageIDs_.begin(),
471  itEnd = parentageIDs_.end();
472  it != itEnd;
473  ++it) {
474  orderedIDs[it->second]=it->first;
475  }
476  //now put them into the TTree in the correct order
477  for(std::vector<ParentageID>::const_iterator it = orderedIDs.begin(),
478  itEnd = orderedIDs.end();
479  it != itEnd;
480  ++it) {
481  desc = ptReg.getMapped(*it);
482  //NOTE: some old format files have missing Parentage info
483  // so a null value of desc can't be fatal.
484  // Root will default construct an object in that case.
485  parentageTree_->Fill();
486  }
487  }
int const & basketSize() const
static ThreadSafeRegistry * instance()
edm::detail::ThreadSafeRegistry< edm::ParentageID, edm::Parentage > ParentageRegistry
std::map< ParentageID, unsigned int > parentageIDs_
PoolOutputModule const * om_
std::string const & parentageBranchName()
Definition: BranchType.cc:162
void edm::RootOutputFile::writeProcessConfigurationRegistry ( )

Definition at line 521 of file RootOutputFile.cc.

References b, edm::PoolOutputModule::basketSize(), edm::detail::ThreadSafeRegistry< KEY, T, E >::data(), alignCSCRings::e, i, edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), metaDataTree_, om_, AlCaHLTBitMon_ParallelJobs::p, edm::poolNames::processConfigurationBranchName(), and edm::sort_all().

521  {
523  Map const& procConfigMap = ProcessConfigurationRegistry::instance()->data();
524  ProcessConfigurationVector procConfigVector;
525  for(Map::const_iterator i = procConfigMap.begin(), e = procConfigMap.end(); i != e; ++i) {
526  procConfigVector.push_back(i->second);
527  }
528  sort_all(procConfigVector);
529  ProcessConfigurationVector* p = &procConfigVector;
530  TBranch* b = metaDataTree_->Branch(poolNames::processConfigurationBranchName().c_str(), &p, om_->basketSize(), 0);
531  assert(b);
532  b->Fill();
533  }
int i
Definition: DBlmapReader.cc:9
int const & basketSize() const
static ThreadSafeRegistry * instance()
ProcessConfigurationRegistry::vector_type ProcessConfigurationVector
std::map< key_type, value_type > collection_type
PoolOutputModule const * om_
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
Definition: Algorithms.h:120
double b
Definition: hdecay.h:120
std::string const & processConfigurationBranchName()
Definition: BranchType.cc:202
collection_type & data()
Provide access to the contained collection.
void edm::RootOutputFile::writeProcessHistoryRegistry ( )

Definition at line 535 of file RootOutputFile.cc.

References b, edm::PoolOutputModule::basketSize(), edm::detail::ThreadSafeRegistry< KEY, T, E >::data(), alignCSCRings::e, i, edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), metaDataTree_, om_, AlCaHLTBitMon_ParallelJobs::p, and edm::poolNames::processHistoryBranchName().

535  {
537  Map const& procHistoryMap = ProcessHistoryRegistry::instance()->data();
538  ProcessHistoryVector procHistoryVector;
539  for(Map::const_iterator i = procHistoryMap.begin(), e = procHistoryMap.end(); i != e; ++i) {
540  procHistoryVector.push_back(i->second);
541  }
542  ProcessHistoryVector* p = &procHistoryVector;
543  TBranch* b = metaDataTree_->Branch(poolNames::processHistoryBranchName().c_str(), &p, om_->basketSize(), 0);
544  assert(b);
545  b->Fill();
546  }
int i
Definition: DBlmapReader.cc:9
int const & basketSize() const
static ThreadSafeRegistry * instance()
std::map< key_type, value_type > collection_type
PoolOutputModule const * om_
ProcessHistoryRegistry::vector_type ProcessHistoryVector
std::string const & processHistoryBranchName()
Definition: BranchType.cc:197
double b
Definition: hdecay.h:120
collection_type & data()
Provide access to the contained collection.
void edm::RootOutputFile::writeProductDependencies ( )

Definition at line 602 of file RootOutputFile.cc.

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

602  {
603  BranchChildren& pDeps = const_cast<BranchChildren&>(om_->branchChildren());
604  BranchChildren* ppDeps = &pDeps;
605  TBranch* b = metaDataTree_->Branch(poolNames::productDependenciesBranchName().c_str(), &ppDeps, om_->basketSize(), 0);
606  assert(b);
607  b->Fill();
608  }
int const & basketSize() const
PoolOutputModule const * om_
BranchChildren const & branchChildren() const
Definition: OutputModule.h:69
double b
Definition: hdecay.h:120
std::string const & productDependenciesBranchName()
Definition: BranchType.cc:177
void edm::RootOutputFile::writeProductDescriptionRegistry ( )

Definition at line 571 of file RootOutputFile.cc.

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

571  {
572  // Make a local copy of the ProductRegistry, removing any transient or pruned products.
573  typedef ProductRegistry::ProductList ProductList;
575  ProductRegistry pReg(reg->productList());
576  ProductList& pList = const_cast<ProductList &>(pReg.productList());
577  for(auto const& prod : pList) {
578  if(prod.second.branchID() != prod.second.originalBranchID()) {
579  if(branchesWithStoredHistory_.find(prod.second.branchID()) != branchesWithStoredHistory_.end()) {
580  branchesWithStoredHistory_.insert(prod.second.originalBranchID());
581  }
582  }
583  }
584  std::set<BranchID>::iterator end = branchesWithStoredHistory_.end();
585  for(ProductList::iterator it = pList.begin(); it != pList.end();) {
586  if(branchesWithStoredHistory_.find(it->second.branchID()) == end) {
587  // avoid invalidating iterator on deletion
588  ProductList::iterator itCopy = it;
589  ++it;
590  pList.erase(itCopy);
591 
592  } else {
593  ++it;
594  }
595  }
596 
597  ProductRegistry* ppReg = &pReg;
598  TBranch* b = metaDataTree_->Branch(poolNames::productDescriptionBranchName().c_str(), &ppReg, om_->basketSize(), 0);
599  assert(b);
600  b->Fill();
601  }
int const & basketSize() const
std::map< BranchKey, BranchDescription > ProductList
std::set< BranchID > branchesWithStoredHistory_
PoolOutputModule const * om_
#define end
Definition: vmac.h:38
double b
Definition: hdecay.h:120
std::string const & productDescriptionBranchName()
Definition: BranchType.cc:172
void edm::RootOutputFile::writeRun ( RunPrincipal const &  r)

Definition at line 441 of file RootOutputFile.cc.

References edm::IndexIntoFile::addEntry(), edm::RunPrincipal::aux(), edm::detail::ThreadSafeRegistry< KEY, T, E >::extra(), fillBranches(), indexIntoFile_, edm::InRun, edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), edm::RootOutputTree::optimizeBaskets(), edm::Principal::processHistoryID(), edm::RunAuxiliary::run(), runAux_, runEntryNumber_, runTree_, and edm::RunAuxiliary::setProcessHistoryID().

441  {
442  // Auxiliary branch
443  // NOTE: runAux_ must be filled before calling fillBranches since it gets written out in that routine.
444  runAux_ = r.aux();
445  // Use the updated process historyID
446  runAux_.setProcessHistoryID(r.processHistoryID());
447  // Store the reduced ID in the IndexIntoFile
448  ProcessHistoryID reducedPHID = ProcessHistoryRegistry::instance()->extra().reduceProcessHistoryID(r.processHistoryID());
449  // Add run to index.
450  indexIntoFile_.addEntry(reducedPHID, runAux_.run(), 0U, 0U, runEntryNumber_);
451  ++runEntryNumber_;
452  fillBranches(InRun, r, 0);
453  runTree_.optimizeBaskets(10ULL*1024*1024);
454  }
static ThreadSafeRegistry * instance()
void fillBranches(BranchType const &branchType, Principal const &principal, StoredProductProvenanceVector *productProvenanceVecPtr)
void addEntry(ProcessHistoryID const &processHistoryID, RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, EntryNumber_t entry)
Hash< ProcessHistoryType > ProcessHistoryID
RootOutputTree runTree_
IndexIntoFile indexIntoFile_
IndexIntoFile::EntryNumber_t runEntryNumber_
RunAuxiliary runAux_
void setProcessHistoryID(ProcessHistoryID const &phid)
Definition: RunAuxiliary.h:36
void optimizeBaskets(ULong64_t size)
RunNumber_t run() const
Definition: RunAuxiliary.h:41

Member Data Documentation

std::set<BranchID> edm::RootOutputFile::branchesWithStoredHistory_
private
bool edm::RootOutputFile::canFastCloneAux_
private

Definition at line 100 of file RootOutputFile.h.

Referenced by beginInputFile().

bool edm::RootOutputFile::dataTypeReported_
private

Definition at line 123 of file RootOutputFile.h.

Referenced by writeOne().

StoredProductProvenanceVector edm::RootOutputFile::eventEntryInfoVector_
private

Definition at line 115 of file RootOutputFile.h.

IndexIntoFile::EntryNumber_t edm::RootOutputFile::eventEntryNumber_
private

Definition at line 103 of file RootOutputFile.h.

Referenced by writeIndexIntoFile(), and writeOne().

RootOutputTree edm::RootOutputFile::eventTree_
private
FileID edm::RootOutputFile::fid_
private

Definition at line 102 of file RootOutputFile.h.

Referenced by RootOutputFile(), and writeFileIdentifier().

std::string edm::RootOutputFile::file_
private

Definition at line 95 of file RootOutputFile.h.

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

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

Definition at line 101 of file RootOutputFile.h.

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

IndexIntoFile edm::RootOutputFile::indexIntoFile_
private

Definition at line 106 of file RootOutputFile.h.

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

std::string edm::RootOutputFile::logicalFile_
private

Definition at line 96 of file RootOutputFile.h.

Referenced by RootOutputFile().

LuminosityBlockAuxiliary edm::RootOutputFile::lumiAux_
private

Definition at line 110 of file RootOutputFile.h.

Referenced by writeLuminosityBlock().

IndexIntoFile::EntryNumber_t edm::RootOutputFile::lumiEntryNumber_
private

Definition at line 104 of file RootOutputFile.h.

Referenced by writeLuminosityBlock().

RootOutputTree edm::RootOutputFile::lumiTree_
private

Definition at line 120 of file RootOutputFile.h.

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

TTree* edm::RootOutputFile::metaDataTree_
private
PoolOutputModule const* edm::RootOutputFile::om_
private
TTree* edm::RootOutputFile::parameterSetsTree_
private

Definition at line 108 of file RootOutputFile.h.

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

std::map<ParentageID,unsigned int> edm::RootOutputFile::parentageIDs_
private

Definition at line 124 of file RootOutputFile.h.

Referenced by insertProductProvenance(), and writeParentageRegistry().

TTree* edm::RootOutputFile::parentageTree_
private

Definition at line 109 of file RootOutputFile.h.

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

BranchListIndexes const* edm::RootOutputFile::pBranchListIndexes_
private

Definition at line 117 of file RootOutputFile.h.

Referenced by RootOutputFile(), and writeOne().

EventAuxiliary const* edm::RootOutputFile::pEventAux_
private

Definition at line 112 of file RootOutputFile.h.

Referenced by RootOutputFile(), and writeOne().

StoredProductProvenanceVector* edm::RootOutputFile::pEventEntryInfoVector_
private

Definition at line 116 of file RootOutputFile.h.

Referenced by RootOutputFile(), and writeOne().

EventSelectionIDVector const* edm::RootOutputFile::pEventSelectionIDs_
private

Definition at line 118 of file RootOutputFile.h.

Referenced by RootOutputFile(), and writeOne().

LuminosityBlockAuxiliary const* edm::RootOutputFile::pLumiAux_
private

Definition at line 113 of file RootOutputFile.h.

Referenced by RootOutputFile().

RunAuxiliary const* edm::RootOutputFile::pRunAux_
private

Definition at line 114 of file RootOutputFile.h.

Referenced by RootOutputFile().

JobReport::Token edm::RootOutputFile::reportToken_
private

Definition at line 97 of file RootOutputFile.h.

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

RunAuxiliary edm::RootOutputFile::runAux_
private

Definition at line 111 of file RootOutputFile.h.

Referenced by writeRun().

IndexIntoFile::EntryNumber_t edm::RootOutputFile::runEntryNumber_
private

Definition at line 105 of file RootOutputFile.h.

Referenced by writeRun().

RootOutputTree edm::RootOutputFile::runTree_
private

Definition at line 121 of file RootOutputFile.h.

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

RootOutputTreePtrArray edm::RootOutputFile::treePointers_
private

Definition at line 122 of file RootOutputFile.h.

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

int edm::RootOutputFile::whyNotFastClonable_
private

Definition at line 99 of file RootOutputFile.h.

Referenced by beginInputFile(), and fillBranches().