test
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
< edm::propagate_const
< 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, ModuleCallingContext const *)
 
void writeOne (EventPrincipal const &e, ModuleCallingContext const *)
 
void writeParameterSetRegistry ()
 
void writeParentageRegistry ()
 
void writeProcessHistoryRegistry ()
 
void writeProductDependencies ()
 
void writeProductDescriptionRegistry ()
 
void writeRun (RunPrincipal const &r, ModuleCallingContext const *)
 
void writeThinnedAssociationsHelper ()
 
 ~RootOutputFile ()
 

Private Member Functions

std::shared_ptr< TFile const > filePtr () const
 
std::shared_ptr< TFile > & filePtr ()
 
void fillBranches (BranchType const &branchType, Principal const &principal, StoredProductProvenanceVector *productProvenanceVecPtr, ModuleCallingContext const *)
 
void insertAncestors (ProductProvenance const &iGetParents, EventPrincipal const &principal, bool produced, std::set< StoredProductProvenance > &oToFill, ModuleCallingContext const *)
 
bool insertProductProvenance (const ProductProvenance &, std::set< StoredProductProvenance > &oToInsert)
 
StoredProductProvenanceVector
const * 
pEventEntryInfoVector () const
 
StoredProductProvenanceVector *& pEventEntryInfoVector ()
 
void setBranchAliases (TTree *tree, SelectedProducts 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_
 
edm::propagate_const
< std::shared_ptr< TFile > > 
filePtr_
 
IndexIntoFile indexIntoFile_
 
std::string logicalFile_
 
LuminosityBlockAuxiliary lumiAux_
 
IndexIntoFile::EntryNumber_t lumiEntryNumber_
 
RootOutputTree lumiTree_
 
edm::propagate_const< TTree * > metaDataTree_
 
edm::propagate_const
< PoolOutputModule * > 
om_
 
edm::propagate_const< TTree * > parameterSetsTree_
 
std::map< ParentageID,
unsigned int > 
parentageIDs_
 
edm::propagate_const< TTree * > parentageTree_
 
BranchListIndexes const * pBranchListIndexes_
 
EventAuxiliary const * pEventAux_
 
edm::propagate_const
< StoredProductProvenanceVector * > 
pEventEntryInfoVector_
 
EventSelectionIDVector const * pEventSelectionIDs_
 
LuminosityBlockAuxiliary const * pLumiAux_
 
ProcessHistoryRegistry processHistoryRegistry_
 
RunAuxiliary const * pRunAux_
 
JobReport::Token reportToken_
 
RunAuxiliary runAux_
 
IndexIntoFile::EntryNumber_t runEntryNumber_
 
RootOutputTree runTree_
 
RootOutputTreePtrArray treePointers_
 
int whyNotFastClonable_
 
edm::propagate_const< TClass * > wrapperBaseTClass_
 

Detailed Description

Definition at line 45 of file RootOutputFile.h.

Member Typedef Documentation

Definition at line 47 of file RootOutputFile.h.

Definition at line 48 of file RootOutputFile.h.

Definition at line 49 of file RootOutputFile.h.

Constructor & Destructor Documentation

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

Definition at line 77 of file RootOutputFile.cc.

References edm::RootOutputTree::addAuxiliary(), edm::RootOutputTree::addBranch(), branchesWithStoredHistory_, edm::poolNames::branchListIndexesBranchName(), edm::BranchDescription::branchName(), revisionDML::branchType(), edm::BranchTypeToAuxiliaryBranchName(), edm::BranchTypeToProductProvenanceBranchName(), edm::errors::Configuration, edm::createGlobalIdentifier(), cms::Digest::digest(), edm::PoolOutputModule::eventAutoFlushSize(), edm::poolNames::eventSelectionsBranchName(), eventTree_, Exception, fid_, file_, filePtr_, edm::BranchDescription::fullClassName(), edm::propagate_const< T >::get(), i, edm::InEvent, edm::InLumi, edm::InRun, logicalFile_, lumiTree_, edm::RootOutputTree::makeTTree(), metaDataTree_, edm::poolNames::metaDataTreeName(), edm::BranchDescription::moduleLabel(), edm::moduleName(), 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().

77  :
78  file_(fileName),
79  logicalFile_(logicalFileName),
80  reportToken_(0),
81  om_(om),
82  whyNotFastClonable_(om_->whyNotFastClonable()),
83  canFastCloneAux_(false),
84  filePtr_(openTFile(file_.c_str(), om_->compressionLevel())),
85  fid_(),
86  eventEntryNumber_(0LL),
87  lumiEntryNumber_(0LL),
88  runEntryNumber_(0LL),
90  metaDataTree_(nullptr),
91  parameterSetsTree_(nullptr),
92  parentageTree_(nullptr),
93  lumiAux_(),
94  runAux_(),
95  pEventAux_(nullptr),
97  pRunAux_(&runAux_),
100  pBranchListIndexes_(nullptr),
101  pEventSelectionIDs_(nullptr),
102  eventTree_(filePtr(), InEvent, om_->splitLevel(), om_->treeMaxVirtualSize()),
103  lumiTree_(filePtr(), InLumi, om_->splitLevel(), om_->treeMaxVirtualSize()),
104  runTree_(filePtr(), InRun, om_->splitLevel(), om_->treeMaxVirtualSize()),
105  treePointers_(),
106  dataTypeReported_(false),
108  parentageIDs_(),
110  wrapperBaseTClass_(TClass::GetClass("edm::WrapperBase")) {
111  if (om_->compressionAlgorithm() == std::string("ZLIB")) {
112  filePtr_->SetCompressionAlgorithm(ROOT::kZLIB);
113  } else if (om_->compressionAlgorithm() == std::string("LZMA")) {
114  filePtr_->SetCompressionAlgorithm(ROOT::kLZMA);
115  } else {
116  throw Exception(errors::Configuration) << "PoolOutputModule configured with unknown compression algorithm '" << om_->compressionAlgorithm() << "'\n"
117  << "Allowed compression algorithms are ZLIB and LZMA\n";
118  }
119  if (-1 != om->eventAutoFlushSize()) {
120  eventTree_.setAutoFlush(-1*om->eventAutoFlushSize());
121  }
123  pEventAux_, om_->auxItems()[InEvent].basketSize_);
125  pEventEntryInfoVector(), om_->auxItems()[InEvent].basketSize_);
127  pEventSelectionIDs_, om_->auxItems()[InEvent].basketSize_,false);
129  pBranchListIndexes_, om_->auxItems()[InEvent].basketSize_);
130 
132  pLumiAux_, om_->auxItems()[InLumi].basketSize_);
133 
135  pRunAux_, om_->auxItems()[InRun].basketSize_);
136 
138  treePointers_[InLumi] = &lumiTree_;
139  treePointers_[InRun] = &runTree_;
140 
141  for(int i = InEvent; i < NumBranchTypes; ++i) {
142  BranchType branchType = static_cast<BranchType>(i);
143  RootOutputTree *theTree = treePointers_[branchType];
144  for(auto const& item : om_->selectedOutputItemList()[branchType]) {
145  item.product_ = nullptr;
146  BranchDescription const& desc = *item.branchDescription_;
147  theTree->addBranch(desc.branchName(),
148  desc.wrappedName(),
149  item.product_,
150  item.splitLevel_,
151  item.basketSize_,
152  item.branchDescription_->produced());
153  //make sure we always store product registry info for all branches we create
154  branchesWithStoredHistory_.insert(item.branchID());
155  }
156  }
157  // Don't split metadata tree or event description tree
161 
162  fid_ = FileID(createGlobalIdentifier());
163 
164  // For the Job Report, get a vector of branch names in the "Events" tree.
165  // Also create a hash of all the branch names in the "Events" tree
166  // in a deterministic order, except use the full class name instead of the friendly class name.
167  // To avoid extra string copies, we create a vector of pointers into the product registry,
168  // and use a custom comparison operator for sorting.
169  std::vector<std::string> branchNames;
170  std::vector<BranchDescription const*> branches;
171  branchNames.reserve(om_->selectedOutputItemList()[InEvent].size());
172  branches.reserve(om->selectedOutputItemList()[InEvent].size());
173  for(auto const& item : om_->selectedOutputItemList()[InEvent]) {
174  branchNames.push_back(item.branchDescription_->branchName());
175  branches.push_back(item.branchDescription_);
176  }
177  // Now sort the branches for the hash.
178  sort_all(branches, sorterForJobReportHash);
179  // Now, make a concatenated string.
180  std::ostringstream oss;
181  char const underscore = '_';
182  for(auto const& branch : branches) {
183  BranchDescription const& bd = *branch;
184  oss << bd.fullClassName() << underscore
185  << bd.moduleLabel() << underscore
186  << bd.productInstanceName() << underscore
187  << bd.processName() << underscore;
188  }
189  std::string stringrep = oss.str();
190  cms::Digest md5alg(stringrep);
191 
192  // Register the output file with the JobReport service
193  // and get back the token for it.
194  std::string moduleName = "PoolOutputModule";
195  Service<JobReport> reportSvc;
196  reportToken_ = reportSvc->outputFileOpened(
197  file_, logicalFile_, // PFN and LFN
198  om_->catalog(), // catalog
199  moduleName, // module class name
200  om_->moduleLabel(), // module label
201  fid_.fid(), // file id (guid)
202  std::string(), // data type (not yet known, so string is empty).
203  md5alg.digest().toString(), // branch hash
204  branchNames); // branch names being written
205  }
int i
Definition: DBlmapReader.cc:9
LuminosityBlockAuxiliary lumiAux_
std::string const & BranchTypeToAuxiliaryBranchName(BranchType const &branchType)
Definition: BranchType.cc:115
std::string const & parentageTreeName()
Definition: BranchType.cc:159
edm::propagate_const< TTree * > metaDataTree_
ProcessHistoryRegistry processHistoryRegistry_
std::string const & eventSelectionsBranchName()
Definition: BranchType.cc:243
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:251
std::string const & fileName() const
std::map< ParentageID, unsigned int > parentageIDs_
std::shared_ptr< TFile const > filePtr() const
RootOutputTree eventTree_
std::vector< BranchListIndex > BranchListIndexes
std::string moduleName(Provenance const &provenance)
Definition: Provenance.cc:27
edm::propagate_const< PoolOutputModule * > om_
IndexIntoFile::EntryNumber_t eventEntryNumber_
LuminosityBlockAuxiliary const * pLumiAux_
edm::propagate_const< std::shared_ptr< TFile > > filePtr_
std::string logicalFile_
std::string const & metaDataTreeName()
Definition: BranchType.cc:168
edm::propagate_const< TClass * > wrapperBaseTClass_
static TTree * makeTTree(TFile *filePtr, std::string const &name, int splitLevel)
element_type const * get() const
EventSelectionIDVector const * pEventSelectionIDs_
edm::propagate_const< TTree * > parameterSetsTree_
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
Definition: Algorithms.h:120
edm::propagate_const< StoredProductProvenanceVector * > pEventEntryInfoVector_
RootOutputTree runTree_
StoredProductProvenanceVector eventEntryInfoVector_
edm::propagate_const< TTree * > parentageTree_
void addAuxiliary(std::string const &branchName, T const *&pAux, int bufSize, bool allowCloning=true)
std::vector< StoredProductProvenance > StoredProductProvenanceVector
IndexIntoFile indexIntoFile_
IndexIntoFile::EntryNumber_t runEntryNumber_
EventAuxiliary const * pEventAux_
RunAuxiliary runAux_
std::string const & BranchTypeToProductProvenanceBranchName(BranchType const &BranchType)
Definition: BranchType.cc:131
StoredProductProvenanceVector const * pEventEntryInfoVector() const
std::string const & branchListIndexesBranchName()
Definition: BranchType.cc:247
RootOutputTreePtrArray treePointers_
BranchListIndexes const * pBranchListIndexes_
IndexIntoFile::EntryNumber_t lumiEntryNumber_
RootOutputTree lumiTree_
RunAuxiliary const * pRunAux_
JobReport::Token reportToken_
std::string createGlobalIdentifier()
edm::RootOutputFile::~RootOutputFile ( )
inline

Definition at line 52 of file RootOutputFile.h.

52 {}

Member Function Documentation

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

Definition at line 297 of file RootOutputFile.cc.

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

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

Definition at line 73 of file RootOutputFile.h.

References file_.

73 {return file_;}
std::shared_ptr<TFile const> edm::RootOutputFile::filePtr ( ) const
inlineprivate

Definition at line 100 of file RootOutputFile.h.

References filePtr_, and edm::get_underlying_safe().

100 {return get_underlying_safe(filePtr_);}
edm::propagate_const< std::shared_ptr< TFile > > filePtr_
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
std::shared_ptr<TFile>& edm::RootOutputFile::filePtr ( )
inlineprivate

Definition at line 101 of file RootOutputFile.h.

References filePtr_, and edm::get_underlying_safe().

101 {return get_underlying_safe(filePtr_);}
edm::propagate_const< std::shared_ptr< TFile > > filePtr_
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
void edm::RootOutputFile::fillBranches ( BranchType const &  branchType,
Principal const &  principal,
StoredProductProvenanceVector productProvenanceVecPtr,
ModuleCallingContext const *  mcc 
)
private

Definition at line 685 of file RootOutputFile.cc.

References assert(), branchesWithStoredHistory_, revisionDML::branchType(), edm::FileBlock::CanFastClone, compareJSON::const, CommonMethods::cp(), edm::PoolOutputModule::DropDroppedPrior, edm::PoolOutputModule::DropNone, edm::PoolOutputModule::DropPrior, read312RV_cfg::fastCloning, edm::Principal::getForOutput(), edm::getWrapperBasePtr(), edm::InEvent, insertAncestors(), insertProductProvenance(), mps_monitormerge::items, eostools::move(), hltrates_dqm_sourceclient-live_cfg::offset, om_, AlCaHLTBitMon_ParallelJobs::p, cmsRelvalreport::principal(), edm::es::produced, edm::OutputHandle::productProvenance(), treePointers_, whyNotFastClonable_, edm::OutputHandle::wrapper(), and wrapperBaseTClass_.

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

689  {
690 
691  std::vector<std::unique_ptr<WrapperBase> > dummies;
692 
694 
695  OutputItemList const& items = om_->selectedOutputItemList()[branchType];
696 
697  std::set<StoredProductProvenance> provenanceToKeep;
698 
699  // Loop over EDProduct branches, fill the provenance, and write the branch.
700  for(auto const& item : items) {
701 
702  BranchID const& id = item.branchDescription_->branchID();
703  branchesWithStoredHistory_.insert(id);
704 
705  bool produced = item.branchDescription_->produced();
706  bool keepProvenance = productProvenanceVecPtr != nullptr &&
707  (om_->dropMetaData() == PoolOutputModule::DropNone ||
708  om_->dropMetaData() == PoolOutputModule::DropDroppedPrior ||
709  (om_->dropMetaData() == PoolOutputModule::DropPrior && produced));
710  bool getProd = (produced || !fastCloning ||
711  treePointers_[branchType]->uncloned(item.branchDescription_->branchName()));
712 
713  WrapperBase const* product = nullptr;
714  OutputHandle const oh = principal.getForOutput(id, getProd, mcc);
715  if(keepProvenance && oh.productProvenance()) {
716  insertProductProvenance(*oh.productProvenance(),provenanceToKeep);
717  //provenanceToKeep.insert(*oh.productProvenance());
718  EventPrincipal const& eventPrincipal = dynamic_cast<EventPrincipal const&>(principal);
719  assert(eventPrincipal.productProvenanceRetrieverPtr());
720  insertAncestors(*oh.productProvenance(), eventPrincipal, produced, provenanceToKeep, mcc);
721  }
722  product = oh.wrapper();
723  if(getProd) {
724  if(product == nullptr) {
725  // No product with this ID is in the event.
726  // Add a null product.
727  TClass* cp = TClass::GetClass(item.branchDescription_->wrappedName().c_str());
728  int offset = cp->GetBaseClassOffset(wrapperBaseTClass_);
729  void* p = cp->New();
730  std::unique_ptr<WrapperBase> dummy = getWrapperBasePtr(p, offset);
731  product = dummy.get();
732  dummies.emplace_back(std::move(dummy));
733  }
734  item.product_ = product;
735  }
736  }
737 
738  if(productProvenanceVecPtr != nullptr) productProvenanceVecPtr->assign(provenanceToKeep.begin(), provenanceToKeep.end());
739  treePointers_[branchType]->fillTree();
740  if(productProvenanceVecPtr != nullptr) productProvenanceVecPtr->clear();
741  }
assert(m_qm.get())
std::set< BranchID > branchesWithStoredHistory_
edm::propagate_const< PoolOutputModule * > om_
void insertAncestors(ProductProvenance const &iGetParents, EventPrincipal const &principal, bool produced, std::set< StoredProductProvenance > &oToFill, ModuleCallingContext const *)
def move
Definition: eostools.py:510
PoolOutputModule::OutputItemList OutputItemList
edm::propagate_const< TClass * > wrapperBaseTClass_
eventsetup::produce::Produce produced
Definition: ESProducts.cc:20
string const
Definition: compareJSON.py:14
bool insertProductProvenance(const ProductProvenance &, std::set< StoredProductProvenance > &oToInsert)
std::unique_ptr< WrapperBase > getWrapperBasePtr(void *p, int offset)
RootOutputTreePtrArray treePointers_
void edm::RootOutputFile::finishEndFile ( )

Definition at line 608 of file RootOutputFile.cc.

References revisionDML::branchType(), filePtr_, i, edm::InEvent, metaDataTree_, edm::NumBranchTypes, om_, parameterSetsTree_, parentageTree_, reportToken_, setBranchAliases(), MainPageGenerator::tree, treePointers_, and edm::RootOutputTree::writeTTree().

608  {
609  metaDataTree_->SetEntries(-1);
612 
614 
615  // Create branch aliases for all the branches in the
616  // events/lumis/runs trees. The loop is over all types of data
617  // products.
618  for(int i = InEvent; i < NumBranchTypes; ++i) {
619  BranchType branchType = static_cast<BranchType>(i);
620  setBranchAliases(treePointers_[branchType]->tree(), om_->keptProducts()[branchType]);
621  treePointers_[branchType]->writeTree();
622  }
623 
624  // close the file -- mfp
625  // Just to play it safe, zero all pointers to objects in the TFile to be closed.
626  metaDataTree_ = parentageTree_ = nullptr;
627  for(auto& treePointer : treePointers_) {
628  treePointer->close();
629  treePointer = nullptr;
630  }
631  filePtr_->Close();
632  filePtr_ = nullptr; // propagate_const<T> has no reset() function
633 
634  // report that file has been closed
635  Service<JobReport> reportSvc;
636  reportSvc->outputFileClosed(reportToken_);
637 
638  }
int i
Definition: DBlmapReader.cc:9
edm::propagate_const< TTree * > metaDataTree_
BranchType
Definition: BranchType.h:11
edm::propagate_const< PoolOutputModule * > om_
edm::propagate_const< std::shared_ptr< TFile > > filePtr_
edm::propagate_const< TTree * > parameterSetsTree_
void setBranchAliases(TTree *tree, SelectedProducts const &branches) const
edm::propagate_const< TTree * > parentageTree_
static void writeTTree(TTree *tree)
RootOutputTreePtrArray treePointers_
JobReport::Token reportToken_
void edm::RootOutputFile::insertAncestors ( ProductProvenance const &  iGetParents,
EventPrincipal const &  principal,
bool  produced,
std::set< StoredProductProvenance > &  oToFill,
ModuleCallingContext const *  mcc 
)
private

Definition at line 660 of file RootOutputFile.cc.

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

Referenced by fillBranches().

664  {
665  assert(om_->dropMetaData() != PoolOutputModule::DropAll);
666  assert(produced || om_->dropMetaData() != PoolOutputModule::DropPrior);
667  if(om_->dropMetaData() == PoolOutputModule::DropDroppedPrior && !produced) return;
668  ProductProvenanceRetriever const& iMapper = *principal.productProvenanceRetrieverPtr();
669  std::vector<BranchID> const& parentIDs = iGetParents.parentage().parents();
670  for(auto const& parentID : parentIDs) {
671  branchesWithStoredHistory_.insert(parentID);
672  ProductProvenance const* info = iMapper.branchIDToProvenance(parentID);
673  if(info) {
674  if(om_->dropMetaData() == PoolOutputModule::DropNone ||
675  principal.getProvenance(info->branchID(), mcc).product().produced()) {
676  if(insertProductProvenance(*info,oToFill) ) {
677  //haven't seen this one yet
678  insertAncestors(*info, principal, produced, oToFill, mcc);
679  }
680  }
681  }
682  }
683  }
static const TGPicture * info(bool iBackgroundIsBlack)
assert(m_qm.get())
std::set< BranchID > branchesWithStoredHistory_
edm::propagate_const< PoolOutputModule * > om_
void insertAncestors(ProductProvenance const &iGetParents, EventPrincipal const &principal, bool produced, std::set< StoredProductProvenance > &oToFill, ModuleCallingContext const *)
eventsetup::produce::Produce produced
Definition: ESProducts.cc:20
bool insertProductProvenance(const ProductProvenance &, std::set< StoredProductProvenance > &oToInsert)
bool edm::RootOutputFile::insertProductProvenance ( const ProductProvenance ,
std::set< StoredProductProvenance > &  oToInsert 
)
private

Definition at line 744 of file RootOutputFile.cc.

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

Referenced by fillBranches(), and insertAncestors().

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

Definition at line 102 of file RootOutputFile.h.

References edm::get_underlying_safe(), and pEventEntryInfoVector_.

Referenced by RootOutputFile().

std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
edm::propagate_const< StoredProductProvenanceVector * > pEventEntryInfoVector_
StoredProductProvenanceVector*& edm::RootOutputFile::pEventEntryInfoVector ( )
inlineprivate

Definition at line 103 of file RootOutputFile.h.

References edm::get_underlying_safe(), and pEventEntryInfoVector_.

std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
edm::propagate_const< StoredProductProvenanceVector * > pEventEntryInfoVector_
void edm::RootOutputFile::respondToCloseInputFile ( FileBlock const &  fb)

Definition at line 378 of file RootOutputFile.cc.

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

378  {
382  }
RootOutputTree eventTree_
RootOutputTree runTree_
RootOutputTree lumiTree_
void edm::RootOutputFile::setBranchAliases ( TTree *  tree,
SelectedProducts const &  branches 
) const
private

Definition at line 641 of file RootOutputFile.cc.

References HLT_25ns10e33_v2_cff::alias, edm::BranchDescription::branchAliases(), edm::BranchDescription::branchName(), full, edm::BranchDescription::moduleLabel(), edm::BranchDescription::productInstanceName(), corrVsCorr::selection, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by finishEndFile().

641  {
642  if(tree && tree->GetNbranches() != 0) {
643  for(auto const& selection : branches) {
644  BranchDescription const& pd = *selection;
645  std::string const& full = pd.branchName() + "obj";
646  if(pd.branchAliases().empty()) {
647  std::string const& alias =
648  (pd.productInstanceName().empty() ? pd.moduleLabel() : pd.productInstanceName());
649  tree->SetAlias(alias.c_str(), full.c_str());
650  } else {
651  for(auto const& alias : pd.branchAliases()) {
652  tree->SetAlias(alias.c_str(), full.c_str());
653  }
654  }
655  }
656  }
657  }
selection
main part
Definition: corrVsCorr.py:98
Definition: GenABIO.cc:180
bool edm::RootOutputFile::shouldWeCloseFile ( ) const

Definition at line 384 of file RootOutputFile.cc.

References filePtr_, om_, and findQualityFiles::size.

384  {
385  unsigned int const oneK = 1024;
386  Long64_t size = filePtr_->GetSize()/oneK;
387  return(size >= om_->maxFileSize());
388  }
edm::propagate_const< PoolOutputModule * > om_
edm::propagate_const< std::shared_ptr< TFile > > filePtr_
tuple size
Write out results.
void edm::RootOutputFile::writeBranchIDListRegistry ( )

Definition at line 542 of file RootOutputFile.cc.

References assert(), b, edm::poolNames::branchIDListBranchName(), metaDataTree_, om_, and AlCaHLTBitMon_ParallelJobs::p.

542  {
543  BranchIDLists const* p = om_->branchIDLists();
544  TBranch* b = metaDataTree_->Branch(poolNames::branchIDListBranchName().c_str(), &p, om_->basketSize(), 0);
545  assert(b);
546  b->Fill();
547  }
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
assert(m_qm.get())
edm::propagate_const< TTree * > metaDataTree_
edm::propagate_const< PoolOutputModule * > om_
double b
Definition: hdecay.h:120
std::string const & branchIDListBranchName()
Definition: BranchType.cc:208
void edm::RootOutputFile::writeFileFormatVersion ( )

Definition at line 499 of file RootOutputFile.cc.

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

499  {
500  FileFormatVersion fileFormatVersion(getFileFormatVersion());
501  FileFormatVersion* pFileFmtVsn = &fileFormatVersion;
502  TBranch* b = metaDataTree_->Branch(poolNames::fileFormatVersionBranchName().c_str(), &pFileFmtVsn, om_->basketSize(), 0);
503  assert(b);
504  b->Fill();
505  }
assert(m_qm.get())
std::string const & fileFormatVersionBranchName()
Definition: BranchType.cc:218
edm::propagate_const< TTree * > metaDataTree_
edm::propagate_const< PoolOutputModule * > om_
int getFileFormatVersion()
double b
Definition: hdecay.h:120
void edm::RootOutputFile::writeFileIdentifier ( )

Definition at line 507 of file RootOutputFile.cc.

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

507  {
508  FileID* fidPtr = &fid_;
509  TBranch* b = metaDataTree_->Branch(poolNames::fileIdentifierBranchName().c_str(), &fidPtr, om_->basketSize(), 0);
510  assert(b);
511  b->Fill();
512  }
assert(m_qm.get())
edm::propagate_const< TTree * > metaDataTree_
edm::propagate_const< PoolOutputModule * > om_
double b
Definition: hdecay.h:120
std::string const & fileIdentifierBranchName()
Definition: BranchType.cc:223
void edm::RootOutputFile::writeIndexIntoFile ( )

Definition at line 514 of file RootOutputFile.cc.

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

514  {
517  ex << "The number of entries in at least one output TBranch whose entries\n"
518  "were copied from the input does not match the number of events\n"
519  "recorded in IndexIntoFile. This might (or might not) indicate a\n"
520  "problem related to fast copy.";
521  ex.addContext("Calling RootOutputFile::writeIndexIntoFile");
522  throw ex;
523  }
525  IndexIntoFile* iifPtr = &indexIntoFile_;
526  TBranch* b = metaDataTree_->Branch(poolNames::indexIntoFileBranchName().c_str(), &iifPtr, om_->basketSize(), 0);
527  assert(b);
528  b->Fill();
529  }
assert(m_qm.get())
edm::propagate_const< TTree * > metaDataTree_
void sortVector_Run_Or_Lumi_Entries()
RootOutputTree eventTree_
edm::propagate_const< PoolOutputModule * > om_
IndexIntoFile::EntryNumber_t eventEntryNumber_
std::string const & indexIntoFileBranchName()
Definition: BranchType.cc:233
bool checkEntriesInReadBranches(Long64_t expectedNumberOfEntries) const
double b
Definition: hdecay.h:120
IndexIntoFile indexIntoFile_
void edm::RootOutputFile::writeLuminosityBlock ( LuminosityBlockPrincipal const &  lb,
ModuleCallingContext const *  mcc 
)

Definition at line 435 of file RootOutputFile.cc.

References edm::IndexIntoFile::addEntry(), edm::LuminosityBlockPrincipal::aux(), fillBranches(), edm::LuminosityBlockPrincipal::id(), indexIntoFile_, edm::InLumi, lumiAux_, lumiEntryNumber_, edm::LuminosityBlockID::luminosityBlock(), edm::LuminosityBlockAuxiliary::luminosityBlock(), lumiTree_, edm::RootOutputTree::optimizeBaskets(), edm::Principal::processHistory(), edm::Principal::processHistoryID(), processHistoryRegistry_, edm::ProcessHistoryRegistry::reducedProcessHistoryID(), edm::ProcessHistoryRegistry::registerProcessHistory(), reportToken_, edm::LuminosityBlockID::run(), edm::LuminosityBlockAuxiliary::run(), and edm::LuminosityBlockAuxiliary::setProcessHistoryID().

435  {
436  // Auxiliary branch
437  // NOTE: lumiAux_ must be filled before calling fillBranches since it gets written out in that routine.
438  lumiAux_ = lb.aux();
439  // Use the updated process historyID
440  lumiAux_.setProcessHistoryID(lb.processHistoryID());
441  // Store the process history.
442  processHistoryRegistry_.registerProcessHistory(lb.processHistory());
443  // Store the reduced ID in the IndexIntoFile
444  ProcessHistoryID reducedPHID = processHistoryRegistry_.reducedProcessHistoryID(lb.processHistoryID());
445  // Add lumi to index.
448  fillBranches(InLumi, lb, nullptr, mcc);
449  lumiTree_.optimizeBaskets(10ULL*1024*1024);
450 
451  Service<JobReport> reportSvc;
452  reportSvc->reportLumiSection(reportToken_, lb.id().run(), lb.id().luminosityBlock());
453  }
void fillBranches(BranchType const &branchType, Principal const &principal, StoredProductProvenanceVector *productProvenanceVecPtr, ModuleCallingContext const *)
LuminosityBlockAuxiliary lumiAux_
bool registerProcessHistory(ProcessHistory const &processHistory)
ProcessHistoryRegistry processHistoryRegistry_
ProcessHistoryID const & reducedProcessHistoryID(ProcessHistoryID const &fullID) const
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)
JobReport::Token reportToken_
void edm::RootOutputFile::writeOne ( EventPrincipal const &  e,
ModuleCallingContext const *  mcc 
)

Definition at line 390 of file RootOutputFile.cc.

References edm::IndexIntoFile::addEntry(), assert(), edm::EventPrincipal::aux(), edm::EventPrincipal::branchListIndexes(), dtTPAnalyzer_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::Principal::processHistory(), edm::EventAuxiliary::processHistoryID(), edm::Principal::processHistoryID(), processHistoryRegistry_, edm::ProcessHistoryRegistry::reducedProcessHistoryID(), edm::ProcessHistoryRegistry::registerProcessHistory(), reportToken_, edm::EventID::run(), edm::EventAuxiliary::run(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 556 of file RootOutputFile.cc.

References b, edm::poolNames::idToParameterSetBlobsBranchName(), edm::pset::Registry::instance(), om_, parameterSetsTree_, and TrackValidation_cff::pset.

556  {
557  std::pair<ParameterSetID, ParameterSetBlob> idToBlob;
558  std::pair<ParameterSetID, ParameterSetBlob>* pIdToBlob = &idToBlob;
559  TBranch* b = parameterSetsTree_->Branch(poolNames::idToParameterSetBlobsBranchName().c_str(),&pIdToBlob,om_->basketSize(), 0);
560 
561  for(auto const& pset : *pset::Registry::instance()) {
562  idToBlob.first = pset.first;
563  idToBlob.second.pset() = pset.second.toString();
564 
565  b->Fill();
566  }
567  }
std::string const & idToParameterSetBlobsBranchName()
Definition: BranchType.cc:255
edm::propagate_const< PoolOutputModule * > om_
edm::propagate_const< TTree * > parameterSetsTree_
double b
Definition: hdecay.h:120
static Registry * instance()
Definition: Registry.cc:12
void edm::RootOutputFile::writeParentageRegistry ( )

Definition at line 475 of file RootOutputFile.cc.

References Exception, edm::errors::FatalRootError, edm::ParentageRegistry::getMapped(), edm::ParentageRegistry::instance(), om_, edm::poolNames::parentageBranchName(), parentageIDs_, and parentageTree_.

475  {
476  Parentage const* desc(nullptr);
477 
478  if(!parentageTree_->Branch(poolNames::parentageBranchName().c_str(),
479  &desc, om_->basketSize(), 0))
481  << "Failed to create a branch for Parentages in the output file";
482 
483  ParentageRegistry& ptReg = *ParentageRegistry::instance();
484 
485  std::vector<ParentageID> orderedIDs(parentageIDs_.size());
486  for(auto const& parentageID : parentageIDs_) {
487  orderedIDs[parentageID.second] = parentageID.first;
488  }
489  //now put them into the TTree in the correct order
490  for(auto const& orderedID : orderedIDs) {
491  desc = ptReg.getMapped(orderedID);
492  //NOTE: some old format files have missing Parentage info
493  // so a null value of desc can't be fatal.
494  // Root will default construct an object in that case.
495  parentageTree_->Fill();
496  }
497  }
std::map< ParentageID, unsigned int > parentageIDs_
edm::propagate_const< PoolOutputModule * > om_
std::string const & parentageBranchName()
Definition: BranchType.cc:163
edm::propagate_const< TTree * > parentageTree_
static ParentageRegistry * instance()
void edm::RootOutputFile::writeProcessHistoryRegistry ( )

Definition at line 531 of file RootOutputFile.cc.

References assert(), b, metaDataTree_, om_, AlCaHLTBitMon_ParallelJobs::p, edm::poolNames::processHistoryBranchName(), and processHistoryRegistry_.

531  {
532  ProcessHistoryVector procHistoryVector;
533  for(auto const& ph : processHistoryRegistry_) {
534  procHistoryVector.push_back(ph.second);
535  }
536  ProcessHistoryVector* p = &procHistoryVector;
537  TBranch* b = metaDataTree_->Branch(poolNames::processHistoryBranchName().c_str(), &p, om_->basketSize(), 0);
538  assert(b);
539  b->Fill();
540  }
std::vector< ProcessHistory > ProcessHistoryVector
assert(m_qm.get())
edm::propagate_const< TTree * > metaDataTree_
ProcessHistoryRegistry processHistoryRegistry_
edm::propagate_const< PoolOutputModule * > om_
std::string const & processHistoryBranchName()
Definition: BranchType.cc:198
double b
Definition: hdecay.h:120
void edm::RootOutputFile::writeProductDependencies ( )

Definition at line 600 of file RootOutputFile.cc.

References assert(), b, metaDataTree_, om_, and edm::poolNames::productDependenciesBranchName().

600  {
601  BranchChildren& pDeps = const_cast<BranchChildren&>(om_->branchChildren());
602  BranchChildren* ppDeps = &pDeps;
603  TBranch* b = metaDataTree_->Branch(poolNames::productDependenciesBranchName().c_str(), &ppDeps, om_->basketSize(), 0);
604  assert(b);
605  b->Fill();
606  }
assert(m_qm.get())
edm::propagate_const< TTree * > metaDataTree_
edm::propagate_const< PoolOutputModule * > om_
double b
Definition: hdecay.h:120
std::string const & productDependenciesBranchName()
Definition: BranchType.cc:178
void edm::RootOutputFile::writeProductDescriptionRegistry ( )

Definition at line 569 of file RootOutputFile.cc.

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

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

Definition at line 455 of file RootOutputFile.cc.

References edm::IndexIntoFile::addEntry(), edm::RunPrincipal::aux(), fillBranches(), indexIntoFile_, edm::InRun, edm::RootOutputTree::optimizeBaskets(), edm::Principal::processHistory(), edm::Principal::processHistoryID(), processHistoryRegistry_, edm::ProcessHistoryRegistry::reducedProcessHistoryID(), edm::ProcessHistoryRegistry::registerProcessHistory(), reportToken_, edm::RunAuxiliary::run(), edm::RunPrincipal::run(), runAux_, runEntryNumber_, runTree_, and edm::RunAuxiliary::setProcessHistoryID().

455  {
456  // Auxiliary branch
457  // NOTE: runAux_ must be filled before calling fillBranches since it gets written out in that routine.
458  runAux_ = r.aux();
459  // Use the updated process historyID
460  runAux_.setProcessHistoryID(r.processHistoryID());
461  // Store the process history.
463  // Store the reduced ID in the IndexIntoFile
464  ProcessHistoryID reducedPHID = processHistoryRegistry_.reducedProcessHistoryID(r.processHistoryID());
465  // Add run to index.
466  indexIntoFile_.addEntry(reducedPHID, runAux_.run(), 0U, 0U, runEntryNumber_);
467  ++runEntryNumber_;
468  fillBranches(InRun, r, nullptr, mcc);
469  runTree_.optimizeBaskets(10ULL*1024*1024);
470 
471  Service<JobReport> reportSvc;
472  reportSvc->reportRunNumber(reportToken_, r.run());
473  }
void fillBranches(BranchType const &branchType, Principal const &principal, StoredProductProvenanceVector *productProvenanceVecPtr, ModuleCallingContext const *)
bool registerProcessHistory(ProcessHistory const &processHistory)
ProcessHistoryRegistry processHistoryRegistry_
ProcessHistoryID const & reducedProcessHistoryID(ProcessHistoryID const &fullID) const
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
JobReport::Token reportToken_
void edm::RootOutputFile::writeThinnedAssociationsHelper ( )

Definition at line 549 of file RootOutputFile.cc.

References assert(), b, metaDataTree_, om_, AlCaHLTBitMon_ParallelJobs::p, and edm::poolNames::thinnedAssociationsHelperBranchName().

549  {
550  ThinnedAssociationsHelper const* p = om_->thinnedAssociationsHelper();
551  TBranch* b = metaDataTree_->Branch(poolNames::thinnedAssociationsHelperBranchName().c_str(), &p, om_->basketSize(), 0);
552  assert(b);
553  b->Fill();
554  }
assert(m_qm.get())
edm::propagate_const< TTree * > metaDataTree_
edm::propagate_const< PoolOutputModule * > om_
double b
Definition: hdecay.h:120
std::string const & thinnedAssociationsHelperBranchName()
Definition: BranchType.cc:213

Member Data Documentation

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

Definition at line 113 of file RootOutputFile.h.

Referenced by beginInputFile().

bool edm::RootOutputFile::dataTypeReported_
private

Definition at line 136 of file RootOutputFile.h.

Referenced by writeOne().

StoredProductProvenanceVector edm::RootOutputFile::eventEntryInfoVector_
private

Definition at line 128 of file RootOutputFile.h.

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

Definition at line 116 of file RootOutputFile.h.

Referenced by writeIndexIntoFile(), and writeOne().

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

Definition at line 115 of file RootOutputFile.h.

Referenced by RootOutputFile(), and writeFileIdentifier().

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

Definition at line 108 of file RootOutputFile.h.

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

edm::propagate_const<std::shared_ptr<TFile> > edm::RootOutputFile::filePtr_
private

Definition at line 114 of file RootOutputFile.h.

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

IndexIntoFile edm::RootOutputFile::indexIntoFile_
private

Definition at line 119 of file RootOutputFile.h.

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

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

Definition at line 109 of file RootOutputFile.h.

Referenced by RootOutputFile().

LuminosityBlockAuxiliary edm::RootOutputFile::lumiAux_
private

Definition at line 123 of file RootOutputFile.h.

Referenced by writeLuminosityBlock().

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

Definition at line 117 of file RootOutputFile.h.

Referenced by writeLuminosityBlock().

RootOutputTree edm::RootOutputFile::lumiTree_
private

Definition at line 133 of file RootOutputFile.h.

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

edm::propagate_const<TTree*> edm::RootOutputFile::metaDataTree_
private
edm::propagate_const<PoolOutputModule*> edm::RootOutputFile::om_
private
edm::propagate_const<TTree*> edm::RootOutputFile::parameterSetsTree_
private

Definition at line 121 of file RootOutputFile.h.

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

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

Definition at line 138 of file RootOutputFile.h.

Referenced by insertProductProvenance(), and writeParentageRegistry().

edm::propagate_const<TTree*> edm::RootOutputFile::parentageTree_
private

Definition at line 122 of file RootOutputFile.h.

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

BranchListIndexes const* edm::RootOutputFile::pBranchListIndexes_
private

Definition at line 130 of file RootOutputFile.h.

Referenced by RootOutputFile(), and writeOne().

EventAuxiliary const* edm::RootOutputFile::pEventAux_
private

Definition at line 125 of file RootOutputFile.h.

Referenced by RootOutputFile(), and writeOne().

edm::propagate_const<StoredProductProvenanceVector*> edm::RootOutputFile::pEventEntryInfoVector_
private

Definition at line 129 of file RootOutputFile.h.

Referenced by pEventEntryInfoVector(), and writeOne().

EventSelectionIDVector const* edm::RootOutputFile::pEventSelectionIDs_
private

Definition at line 131 of file RootOutputFile.h.

Referenced by RootOutputFile(), and writeOne().

LuminosityBlockAuxiliary const* edm::RootOutputFile::pLumiAux_
private

Definition at line 126 of file RootOutputFile.h.

Referenced by RootOutputFile().

ProcessHistoryRegistry edm::RootOutputFile::processHistoryRegistry_
private
RunAuxiliary const* edm::RootOutputFile::pRunAux_
private

Definition at line 127 of file RootOutputFile.h.

Referenced by RootOutputFile().

JobReport::Token edm::RootOutputFile::reportToken_
private
RunAuxiliary edm::RootOutputFile::runAux_
private

Definition at line 124 of file RootOutputFile.h.

Referenced by writeRun().

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

Definition at line 118 of file RootOutputFile.h.

Referenced by writeRun().

RootOutputTree edm::RootOutputFile::runTree_
private

Definition at line 134 of file RootOutputFile.h.

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

RootOutputTreePtrArray edm::RootOutputFile::treePointers_
private

Definition at line 135 of file RootOutputFile.h.

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

int edm::RootOutputFile::whyNotFastClonable_
private

Definition at line 112 of file RootOutputFile.h.

Referenced by beginInputFile(), and fillBranches().

edm::propagate_const<TClass*> edm::RootOutputFile::wrapperBaseTClass_
private

Definition at line 140 of file RootOutputFile.h.

Referenced by fillBranches().