CMS 3D CMS Logo

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

#include <PoolOutputModule.h>

Inheritance diagram for edm::PoolOutputModule:
edm::one::OutputModule< WatchInputFiles > edm::one::OutputModuleBase edm::EDConsumerBase edm::TimeoutPoolOutputModule dqmservices::JsonWritingTimeoutPoolOutputModule

Classes

struct  AuxItem
 
struct  OutputItem
 

Public Types

typedef std::array< AuxItem,
NumBranchTypes
AuxItemArray
 
enum  DropMetaData { DropNone, DropDroppedPrior, DropPrior, DropAll }
 
typedef std::vector< OutputItemOutputItemList
 
typedef std::array
< OutputItemList,
NumBranchTypes
OutputItemListArray
 
- Public Types inherited from edm::one::OutputModuleBase
typedef OutputModuleBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

AuxItemArray const & auxItems () const
 
std::string const & basketOrder () const
 
int const & basketSize () const
 
BranchChildren const & branchChildren () const
 
std::string const & catalog () const
 
std::string const & compressionAlgorithm () const
 
int const & compressionLevel () const
 
std::string const & currentFileName () const
 
DropMetaData const & dropMetaData () const
 
int eventAutoFlushSize () const
 
std::string const & fileName () const
 
int const & inputFileCount () const
 
std::string const & logicalFileName () const
 
unsigned int const & maxFileSize () const
 
std::string const & moduleLabel () const
 
PoolOutputModuleoperator= (PoolOutputModule const &)=delete
 
bool const & overrideInputFileSplitLevels () const
 
 PoolOutputModule (ParameterSet const &ps)
 
 PoolOutputModule (PoolOutputModule const &)=delete
 
OutputItemListArray const & selectedOutputItemList () const
 
int const & splitLevel () const
 
int const & treeMaxVirtualSize () const
 
int const & whyNotFastClonable () const
 
virtual ~PoolOutputModule ()
 
- Public Member Functions inherited from edm::one::OutputModule< WatchInputFiles >
 OutputModule (edm::ParameterSet const &iPSet)
 
- Public Member Functions inherited from edm::one::OutputModuleBase
BranchIDLists const * branchIDLists ()
 
std::array< bool,
NumBranchTypes > const & 
hasNewlyDroppedBranch () const
 
SelectedProductsForBranchType
const & 
keptProducts () const
 
int maxEvents () const
 
const ModuleDescriptionmoduleDescription () const
 
OutputModuleBaseoperator= (OutputModuleBase const &)=delete
 
 OutputModuleBase (ParameterSet const &pset)
 
 OutputModuleBase (OutputModuleBase const &)=delete
 
std::string const & processName () const
 
int remainingEvents () const
 
bool selected (BranchDescription const &desc) const
 
void selectProducts (ProductRegistry const &preg, ThinnedAssociationsHelper const &)
 
ThinnedAssociationsHelper const * thinnedAssociationsHelper () const
 
bool wantAllEvents () const
 
virtual ~OutputModuleBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescription (ParameterSetDescription &desc)
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::OutputModuleBase
static const std::string & baseType ()
 
static void fillDescription (ParameterSetDescription &desc)
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Protected Member Functions

virtual void doExtrasAfterCloseFile ()
 
virtual std::pair< std::string,
std::string > 
physicalAndLogicalNameForNewFile ()
 
virtual bool shouldWeCloseFile () const override
 allow inheriting classes to override but still be able to call this method in the overridden version More...
 
virtual void write (EventPrincipal const &e, ModuleCallingContext const *) override
 
- Protected Member Functions inherited from edm::one::OutputModuleBase
void configure (OutputModuleDescription const &desc)
 
ModuleDescription const & description () const
 
void doBeginJob ()
 
bool doBeginLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)
 
bool doBeginRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)
 
bool doEndRun (RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)
 
bool doEvent (EventPrincipal const &ep, EventSetup const &c, ActivityRegistry *, ModuleCallingContext const *)
 
void doPreallocate (PreallocationConfiguration const &)
 
std::map< BranchID::value_type,
BranchID::value_type > const & 
droppedBranchIDToKeptBranchID ()
 
ParameterSetID selectorConfig () const
 
void setEventSelectionInfo (std::map< std::string, std::vector< std::pair< std::string, int > > > const &outputModulePathPositions, bool anyProductProduced)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Types

typedef std::map< BranchID,
std::set< ParentageID > > 
BranchParents
 

Private Member Functions

void beginInputFile (FileBlock const &fb)
 
virtual void beginJob () override
 
void fillDependencyGraph ()
 
void fillSelectedItemList (BranchType branchtype, TTree *theInputTree)
 
void finishEndFile ()
 
virtual bool isFileOpen () const override
 
virtual void openFile (FileBlock const &fb) override
 
virtual void postForkReacquireResources (unsigned int iChildIndex, unsigned int iNumberOfChildren) override
 
virtual void reallyCloseFile () override
 
virtual void reallyOpenFile () override
 
virtual void respondToCloseInputFile (FileBlock const &fb) override
 
virtual void respondToOpenInputFile (FileBlock const &fb) override
 
void startEndFile ()
 
void updateBranchParents (EventPrincipal const &ep)
 
void writeBranchIDListRegistry ()
 
void writeFileFormatVersion ()
 
void writeFileIdentifier ()
 
void writeIndexIntoFile ()
 
virtual void writeLuminosityBlock (LuminosityBlockPrincipal const &lb, ModuleCallingContext const *) override
 
void writeParameterSetRegistry ()
 
void writeParentageRegistry ()
 
void writeProcessHistoryRegistry ()
 
void writeProductDependencies ()
 
void writeProductDescriptionRegistry ()
 
virtual void writeRun (RunPrincipal const &r, ModuleCallingContext const *) override
 
void writeThinnedAssociationsHelper ()
 

Private Attributes

AuxItemArray auxItems_
 
std::string basketOrder_
 
int const basketSize_
 
BranchChildren branchChildren_
 
BranchParents branchParents_
 
std::string const catalog_
 
unsigned int childIndex_
 
std::string const compressionAlgorithm_
 
int const compressionLevel_
 
DropMetaData dropMetaData_
 
int const eventAutoFlushSize_
 
std::string const fileName_
 
bool initializedFromInput_
 
int inputFileCount_
 
std::string const logicalFileName_
 
unsigned int const maxFileSize_
 
std::string const moduleLabel_
 
unsigned int numberOfDigitsInIndex_
 
int outputFileCount_
 
bool overrideInputFileSplitLevels_
 
edm::propagate_const
< std::unique_ptr
< RootOutputFile > > 
rootOutputFile_
 
RootServiceChecker rootServiceChecker_
 
OutputItemListArray selectedOutputItemList_
 
int const splitLevel_
 
std::string statusFileName_
 
int const treeMaxVirtualSize_
 
int whyNotFastClonable_
 

Detailed Description

Definition at line 32 of file PoolOutputModule.h.

Member Typedef Documentation

Definition at line 68 of file PoolOutputModule.h.

typedef std::map<BranchID, std::set<ParentageID> > edm::PoolOutputModule::BranchParents
private

Definition at line 126 of file PoolOutputModule.h.

Definition at line 99 of file PoolOutputModule.h.

Definition at line 101 of file PoolOutputModule.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

edm::PoolOutputModule::PoolOutputModule ( ParameterSet const &  ps)
explicit

Definition at line 31 of file PoolOutputModule.cc.

References edm::errors::Configuration, DropAll, DropDroppedPrior, dropMetaData(), dropMetaData_, DropNone, DropPrior, edm::FileBlock::EventSelectionUsed, Exception, edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), moduleLabel_, statusFileName_, AlCaHLTBitMon_QueryRunRegistry::string, edm::one::OutputModuleBase::wantAllEvents(), and whyNotFastClonable_.

31  :
33  one::OutputModule<WatchInputFiles>(pset),
35  auxItems_(),
37  fileName_(pset.getUntrackedParameter<std::string>("fileName")),
38  logicalFileName_(pset.getUntrackedParameter<std::string>("logicalFileName")),
39  catalog_(pset.getUntrackedParameter<std::string>("catalog")),
40  maxFileSize_(pset.getUntrackedParameter<int>("maxSize")),
41  compressionLevel_(pset.getUntrackedParameter<int>("compressionLevel")),
42  compressionAlgorithm_(pset.getUntrackedParameter<std::string>("compressionAlgorithm")),
43  basketSize_(pset.getUntrackedParameter<int>("basketSize")),
44  eventAutoFlushSize_(pset.getUntrackedParameter<int>("eventAutoFlushCompressedSize")),
45  splitLevel_(std::min<int>(pset.getUntrackedParameter<int>("splitLevel") + 1, 99)),
46  basketOrder_(pset.getUntrackedParameter<std::string>("sortBaskets")),
47  treeMaxVirtualSize_(pset.getUntrackedParameter<int>("treeMaxVirtualSize")),
48  whyNotFastClonable_(pset.getUntrackedParameter<bool>("fastCloning") ? FileBlock::CanFastClone : FileBlock::DisabledInConfigFile),
50  moduleLabel_(pset.getParameter<std::string>("@module_label")),
51  initializedFromInput_(false),
53  inputFileCount_(0),
54  childIndex_(0U),
58  overrideInputFileSplitLevels_(pset.getUntrackedParameter<bool>("overrideInputFileSplitLevels")),
60  statusFileName_() {
61 
62  if (pset.getUntrackedParameter<bool>("writeStatusFile")) {
63  std::ostringstream statusfilename;
64  statusfilename << moduleLabel_ << '_' << getpid();
65  statusFileName_ = statusfilename.str();
66  }
67 
68  std::string dropMetaData(pset.getUntrackedParameter<std::string>("dropMetaData"));
69  if(dropMetaData.empty()) dropMetaData_ = DropNone;
70  else if(dropMetaData == std::string("NONE")) dropMetaData_ = DropNone;
71  else if(dropMetaData == std::string("DROPPED")) dropMetaData_ = DropDroppedPrior;
72  else if(dropMetaData == std::string("PRIOR")) dropMetaData_ = DropPrior;
73  else if(dropMetaData == std::string("ALL")) dropMetaData_ = DropAll;
74  else {
75  throw edm::Exception(errors::Configuration, "Illegal dropMetaData parameter value: ")
76  << dropMetaData << ".\n"
77  << "Legal values are 'NONE', 'DROPPED', 'PRIOR', and 'ALL'.\n";
78  }
79 
80  if (!wantAllEvents()) {
82  }
83 
84  // We don't use this next parameter, but we read it anyway because it is part
85  // of the configuration of this module. An external parser creates the
86  // configuration by reading this source code.
87  pset.getUntrackedParameterSet("dataset");
88  }
std::string const compressionAlgorithm_
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
std::string const catalog_
DropMetaData const & dropMetaData() const
BranchChildren branchChildren_
std::string const moduleLabel_
OutputItemListArray selectedOutputItemList_
BranchParents branchParents_
unsigned int numberOfDigitsInIndex_
OutputModuleBase(ParameterSet const &pset)
unsigned int const maxFileSize_
std::string const fileName_
std::string const logicalFileName_
RootServiceChecker rootServiceChecker_
edm::PoolOutputModule::~PoolOutputModule ( )
virtual

Definition at line 229 of file PoolOutputModule.cc.

229  {
230  }
edm::PoolOutputModule::PoolOutputModule ( PoolOutputModule const &  )
delete

Member Function Documentation

AuxItemArray const& edm::PoolOutputModule::auxItems ( ) const
inline

Definition at line 69 of file PoolOutputModule.h.

References auxItems_.

69 {return auxItems_;}
std::string const& edm::PoolOutputModule::basketOrder ( ) const
inline

Definition at line 46 of file PoolOutputModule.h.

References basketOrder_.

46 {return basketOrder_;}
int const& edm::PoolOutputModule::basketSize ( ) const
inline

Definition at line 43 of file PoolOutputModule.h.

References basketSize_.

Referenced by fillSelectedItemList().

43 {return basketSize_;}
void edm::PoolOutputModule::beginInputFile ( FileBlock const &  fb)
private

Definition at line 186 of file PoolOutputModule.cc.

References isFileOpen(), edm::one::OutputModuleBase::remainingEvents(), and rootOutputFile_.

Referenced by openFile(), and respondToOpenInputFile().

186  {
187  if(isFileOpen()) {
188  rootOutputFile_->beginInputFile(fb, remainingEvents());
189  }
190  }
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
virtual bool isFileOpen() const override
void edm::PoolOutputModule::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::OutputModuleBase.

Definition at line 90 of file PoolOutputModule.cc.

90  {
91  }
BranchChildren const& edm::PoolOutputModule::branchChildren ( ) const
inline

Definition at line 105 of file PoolOutputModule.h.

References branchChildren_.

105 {return branchChildren_;}
BranchChildren branchChildren_
std::string const& edm::PoolOutputModule::catalog ( ) const
inline

Definition at line 50 of file PoolOutputModule.h.

References catalog_.

50 {return catalog_;}
std::string const catalog_
std::string const& edm::PoolOutputModule::compressionAlgorithm ( ) const
inline

Definition at line 42 of file PoolOutputModule.h.

References compressionAlgorithm_.

42 {return compressionAlgorithm_;}
std::string const compressionAlgorithm_
int const& edm::PoolOutputModule::compressionLevel ( ) const
inline

Definition at line 41 of file PoolOutputModule.h.

References compressionLevel_.

41 {return compressionLevel_;}
std::string const & edm::PoolOutputModule::currentFileName ( ) const

Definition at line 93 of file PoolOutputModule.cc.

References rootOutputFile_.

Referenced by edm::TimeoutPoolOutputModule::shouldWeCloseFile().

93  {
94  return rootOutputFile_->fileName();
95  }
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
void edm::PoolOutputModule::doExtrasAfterCloseFile ( )
protectedvirtual

Reimplemented in dqmservices::JsonWritingTimeoutPoolOutputModule.

Definition at line 285 of file PoolOutputModule.cc.

Referenced by reallyCloseFile().

285 {}
DropMetaData const& edm::PoolOutputModule::dropMetaData ( ) const
inline

Definition at line 49 of file PoolOutputModule.h.

References dropMetaData_.

Referenced by PoolOutputModule().

49 {return dropMetaData_;}
int edm::PoolOutputModule::eventAutoFlushSize ( ) const
inline

Definition at line 44 of file PoolOutputModule.h.

References eventAutoFlushSize_.

Referenced by edm::RootOutputFile::RootOutputFile().

44 {return eventAutoFlushSize_;}
std::string const& edm::PoolOutputModule::fileName ( ) const
inline

Definition at line 39 of file PoolOutputModule.h.

References fileName_.

Referenced by physicalAndLogicalNameForNewFile().

39 {return fileName_;}
std::string const fileName_
void edm::PoolOutputModule::fillDependencyGraph ( )
private

Definition at line 344 of file PoolOutputModule.cc.

References branchChildren_, branchParents_, edm::ParentageRegistry::getMapped(), i, edm::BranchChildren::insertChild(), edm::ParentageRegistry::instance(), j, parents, and edm::Parentage::parents().

Referenced by reallyCloseFile().

344  {
345  for(BranchParents::const_iterator i = branchParents_.begin(), iEnd = branchParents_.end();
346  i != iEnd; ++i) {
347  BranchID const& child = i->first;
348  std::set<ParentageID> const& eIds = i->second;
349  for(std::set<ParentageID>::const_iterator it = eIds.begin(), itEnd = eIds.end();
350  it != itEnd; ++it) {
351  Parentage entryDesc;
352  ParentageRegistry::instance()->getMapped(*it, entryDesc);
353  std::vector<BranchID> const& parents = entryDesc.parents();
354  for(std::vector<BranchID>::const_iterator j = parents.begin(), jEnd = parents.end();
355  j != jEnd; ++j) {
356  branchChildren_.insertChild(*j, child);
357  }
358  }
359  }
360  }
int i
Definition: DBlmapReader.cc:9
TPRegexp parents
Definition: eve_filter.cc:21
BranchChildren branchChildren_
void insertChild(BranchID parent, BranchID child)
bool getMapped(key_type const &k, value_type &result) const
int j
Definition: DBlmapReader.cc:9
BranchParents branchParents_
static ParentageRegistry * instance()
void edm::PoolOutputModule::fillDescription ( ParameterSetDescription desc)
static

Definition at line 363 of file PoolOutputModule.cc.

References edm::ParameterSetDescription::addUntracked(), edm::OutputModule::fillDescription(), edm::ParameterSetDescription::setAllowAnything(), edm::ParameterSetDescription::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by fillDescriptions().

363  {
364  std::string defaultString;
365 
366  desc.setComment("Writes runs, lumis, and events into EDM/ROOT files.");
367  desc.addUntracked<std::string>("fileName")
368  ->setComment("Name of output file.");
369  desc.addUntracked<std::string>("logicalFileName", defaultString)
370  ->setComment("Passed to job report. Otherwise unused by module.");
371  desc.addUntracked<std::string>("catalog", defaultString)
372  ->setComment("Passed to job report. Otherwise unused by module.");
373  desc.addUntracked<int>("maxSize", 0x7f000000)
374  ->setComment("Maximum output file size, in kB.\n"
375  "If over maximum, new output file will be started at next input file transition.");
376  desc.addUntracked<int>("compressionLevel", 7)
377  ->setComment("ROOT compression level of output file.");
378  desc.addUntracked<std::string>("compressionAlgorithm", "ZLIB")
379  ->setComment("Algorithm used to compress data in the ROOT output file, allowed values are ZLIB and LZMA");
380  desc.addUntracked<int>("basketSize", 16384)
381  ->setComment("Default ROOT basket size in output file.");
382  desc.addUntracked<int>("eventAutoFlushCompressedSize",-1)->setComment("Set ROOT auto flush stored data size (in bytes) for event TTree. The value sets how large the compressed buffer is allowed to get. The uncompressed buffer can be quite a bit larger than this depending on the average compression ratio. The value of -1 just uses ROOT's default value. The value of 0 turns off this feature.");
383  desc.addUntracked<int>("splitLevel", 99)
384  ->setComment("Default ROOT branch split level in output file.");
385  desc.addUntracked<std::string>("sortBaskets", std::string("sortbasketsbyoffset"))
386  ->setComment("Legal values: 'sortbasketsbyoffset', 'sortbasketsbybranch', 'sortbasketsbyentry'.\n"
387  "Used by ROOT when fast copying. Affects performance.");
388  desc.addUntracked<int>("treeMaxVirtualSize", -1)
389  ->setComment("Size of ROOT TTree TBasket cache. Affects performance.");
390  desc.addUntracked<bool>("fastCloning", true)
391  ->setComment("True: Allow fast copying, if possible.\n"
392  "False: Disable fast copying.");
393  desc.addUntracked<bool>("overrideInputFileSplitLevels", false)
394  ->setComment("False: Use branch split levels and basket sizes from input file, if possible.\n"
395  "True: Always use specified or default split levels and basket sizes.");
396  desc.addUntracked<bool>("writeStatusFile", false)
397  ->setComment("Write a status file. Intended for use by workflow management.");
398  desc.addUntracked<std::string>("dropMetaData", defaultString)
399  ->setComment("Determines handling of per product per event metadata. Options are:\n"
400  "'NONE': Keep all of it.\n"
401  "'DROPPED': Keep it for products produced in current process and all kept products. Drop it for dropped products produced in prior processes.\n"
402  "'PRIOR': Keep it for products produced in current process. Drop it for products produced in prior processes.\n"
403  "'ALL': Drop all of it.");
404  ParameterSetDescription dataSet;
405  dataSet.setAllowAnything();
406  desc.addUntracked<ParameterSetDescription>("dataset", dataSet)
407  ->setComment("PSet is only used by Data Operations and not by this module.");
408 
410  }
static void fillDescription(ParameterSetDescription &desc)
void edm::PoolOutputModule::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 413 of file PoolOutputModule.cc.

References edm::ConfigurationDescriptions::add(), and fillDescription().

413  {
416  descriptions.add("edmOutput", desc);
417  }
static void fillDescription(ParameterSetDescription &desc)
void edm::PoolOutputModule::fillSelectedItemList ( BranchType  branchtype,
TTree *  theInputTree 
)
private

Definition at line 145 of file PoolOutputModule.cc.

References auxItems_, basketSize(), edm::BranchDescription::basketSize(), edm::PoolOutputModule::AuxItem::basketSize_, edm::PoolOutputModule::OutputItem::basketSize_, edm::BranchDescription::branchName(), revisionDML::branchType(), edm::BranchTypeToAuxiliaryBranchName(), edm::BranchDescription::invalidBasketSize, edm::BranchDescription::invalidSplitLevel, edm::one::OutputModuleBase::keptProducts(), overrideInputFileSplitLevels_, parseEventContent::prod, edm::BranchDescription::produced(), selectedOutputItemList_, edm::sort_all(), splitLevel(), edm::BranchDescription::splitLevel(), and edm::PoolOutputModule::OutputItem::splitLevel_.

Referenced by respondToOpenInputFile().

145  {
146 
147  SelectedProducts const& keptVector = keptProducts()[branchType];
149  AuxItem& auxItem = auxItems_[branchType];
150 
151  // Fill AuxItem
152  if (theInputTree != nullptr && !overrideInputFileSplitLevels_) {
153  TBranch* auxBranch = theInputTree->GetBranch(BranchTypeToAuxiliaryBranchName(branchType).c_str());
154  if (auxBranch) {
155  auxItem.basketSize_ = auxBranch->GetBasketSize();
156  } else {
157  auxItem.basketSize_ = basketSize_;
158  }
159  } else {
160  auxItem.basketSize_ = basketSize_;
161  }
162 
163  // Fill outputItemList with an entry for each branch.
164  for(SelectedProducts::const_iterator it = keptVector.begin(), itEnd = keptVector.end(); it != itEnd; ++it) {
167 
168  BranchDescription const& prod = **it;
169  TBranch* theBranch = ((!prod.produced() && theInputTree != nullptr && !overrideInputFileSplitLevels_) ? theInputTree->GetBranch(prod.branchName().c_str()) : 0);
170 
171  if(theBranch != nullptr) {
172  splitLevel = theBranch->GetSplitLevel();
173  basketSize = theBranch->GetBasketSize();
174  } else {
175  splitLevel = (prod.splitLevel() == BranchDescription::invalidSplitLevel ? splitLevel_ : prod.splitLevel());
176  basketSize = (prod.basketSize() == BranchDescription::invalidBasketSize ? basketSize_ : prod.basketSize());
177  }
178  outputItemList.emplace_back(&prod, splitLevel, basketSize);
179  }
180 
181  // Sort outputItemList to allow fast copying.
182  // The branches in outputItemList must be in the same order as in the input tree, with all new branches at the end.
183  sort_all(outputItemList, OutputItem::Sorter(theInputTree));
184  }
std::string const & BranchTypeToAuxiliaryBranchName(BranchType const &branchType)
Definition: BranchType.cc:115
int const & basketSize() const
static int const invalidSplitLevel
static int const invalidBasketSize
std::vector< OutputItem > OutputItemList
OutputItemListArray selectedOutputItemList_
SelectedProductsForBranchType const & keptProducts() const
int const & splitLevel() const
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
Definition: Algorithms.h:120
std::vector< BranchDescription const * > SelectedProducts
void edm::PoolOutputModule::finishEndFile ( )
private

Definition at line 284 of file PoolOutputModule.cc.

References rootOutputFile_.

Referenced by reallyCloseFile().

284 { rootOutputFile_->finishEndFile(); rootOutputFile_ = nullptr; } // propagate_const<T> has no reset() function
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
int const& edm::PoolOutputModule::inputFileCount ( ) const
inline

Definition at line 53 of file PoolOutputModule.h.

References inputFileCount_.

bool edm::PoolOutputModule::isFileOpen ( ) const
overrideprivatevirtual

Reimplemented from edm::one::OutputModuleBase.

Definition at line 286 of file PoolOutputModule.cc.

References rootOutputFile_.

Referenced by beginInputFile(), and openFile().

286 { return rootOutputFile_.get() != nullptr; }
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
std::string const& edm::PoolOutputModule::logicalFileName ( ) const
inline

Definition at line 40 of file PoolOutputModule.h.

References logicalFileName_.

Referenced by physicalAndLogicalNameForNewFile().

40 {return logicalFileName_;}
std::string const logicalFileName_
unsigned int const& edm::PoolOutputModule::maxFileSize ( ) const
inline

Definition at line 52 of file PoolOutputModule.h.

References maxFileSize_.

52 {return maxFileSize_;}
unsigned int const maxFileSize_
std::string const& edm::PoolOutputModule::moduleLabel ( ) const
inline

Definition at line 51 of file PoolOutputModule.h.

References moduleLabel_.

51 {return moduleLabel_;}
std::string const moduleLabel_
void edm::PoolOutputModule::openFile ( FileBlock const &  fb)
overrideprivatevirtual

Reimplemented from edm::one::OutputModuleBase.

Definition at line 192 of file PoolOutputModule.cc.

References beginInputFile(), isFileOpen(), and reallyOpenFile().

192  {
193  if(!isFileOpen()) {
194  reallyOpenFile();
196  }
197  }
virtual void reallyOpenFile() override
virtual bool isFileOpen() const override
void beginInputFile(FileBlock const &fb)
PoolOutputModule& edm::PoolOutputModule::operator= ( PoolOutputModule const &  )
delete
bool const& edm::PoolOutputModule::overrideInputFileSplitLevels ( ) const
inline

Definition at line 48 of file PoolOutputModule.h.

References overrideInputFileSplitLevels_.

std::pair< std::string, std::string > edm::PoolOutputModule::physicalAndLogicalNameForNewFile ( )
protectedvirtual

Reimplemented in dqmservices::JsonWritingTimeoutPoolOutputModule.

Definition at line 290 of file PoolOutputModule.cc.

References childIndex_, relativeConstraints::empty, Exception, fileName(), inputFileCount_, logicalFileName(), edm::errors::LogicError, numberOfDigitsInIndex_, hltrates_dqm_sourceclient-live_cfg::offset, outputFileCount_, AlCaHLTBitMon_QueryRunRegistry::string, and createPayload::suffix.

Referenced by reallyOpenFile().

290  {
291  if(inputFileCount_ == 0) {
293  << "Attempt to open output file before input file. "
294  << "Please report this to the core framework developers.\n";
295  }
296  std::string suffix(".root");
298  bool ext = (offset == fileName().size() - suffix.size());
299  if(!ext) suffix.clear();
300  std::string fileBase(ext ? fileName().substr(0, offset) : fileName());
301  std::ostringstream ofilename;
302  std::ostringstream lfilename;
303  ofilename << fileBase;
304  lfilename << logicalFileName();
306  ofilename << '_' << std::setw(numberOfDigitsInIndex_) << std::setfill('0') << childIndex_;
307  if(!logicalFileName().empty()) {
308  lfilename << '_' << std::setw(numberOfDigitsInIndex_) << std::setfill('0') << childIndex_;
309  }
310  }
311  if(outputFileCount_) {
312  ofilename << std::setw(3) << std::setfill('0') << outputFileCount_;
313  if(!logicalFileName().empty()) {
314  lfilename << std::setw(3) << std::setfill('0') << outputFileCount_;
315  }
316  }
317  ofilename << suffix;
319 
320  return std::make_pair(ofilename.str(), lfilename.str());
321  }
std::string const & fileName() const
uint16_t size_type
std::string const & logicalFileName() const
unsigned int numberOfDigitsInIndex_
void edm::PoolOutputModule::postForkReacquireResources ( unsigned int  iChildIndex,
unsigned int  iNumberOfChildren 
)
overrideprivatevirtual

Reimplemented from edm::one::OutputModuleBase.

Definition at line 218 of file PoolOutputModule.cc.

References childIndex_, and numberOfDigitsInIndex_.

218  {
219  childIndex_ = iChildIndex;
220  while (iNumberOfChildren != 0) {
222  iNumberOfChildren /= 10;
223  }
224  if (numberOfDigitsInIndex_ == 0) {
225  numberOfDigitsInIndex_ = 3; // Protect against zero iNumberOfChildren
226  }
227  }
unsigned int numberOfDigitsInIndex_
void edm::PoolOutputModule::reallyCloseFile ( )
overrideprivatevirtual

Reimplemented from edm::one::OutputModuleBase.

Definition at line 250 of file PoolOutputModule.cc.

References branchChildren_, branchParents_, edm::BranchChildren::clear(), doExtrasAfterCloseFile(), fillDependencyGraph(), finishEndFile(), startEndFile(), writeBranchIDListRegistry(), writeFileFormatVersion(), writeFileIdentifier(), writeIndexIntoFile(), writeParameterSetRegistry(), writeParentageRegistry(), writeProcessHistoryRegistry(), writeProductDependencies(), writeProductDescriptionRegistry(), and writeThinnedAssociationsHelper().

250  {
252  branchParents_.clear();
254  startEndFile();
265  finishEndFile();
266 
268  }
BranchChildren branchChildren_
virtual void doExtrasAfterCloseFile()
BranchParents branchParents_
void edm::PoolOutputModule::reallyOpenFile ( )
overrideprivatevirtual

Reimplemented from edm::one::OutputModuleBase.

Definition at line 323 of file PoolOutputModule.cc.

References cscdqm::h::names, physicalAndLogicalNameForNewFile(), and rootOutputFile_.

Referenced by openFile().

323  {
325  rootOutputFile_ = std::make_unique<RootOutputFile>(this, names.first, names.second); // propagate_const<T> has no reset() function
326  }
virtual std::pair< std::string, std::string > physicalAndLogicalNameForNewFile()
static const HistoName names[]
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
void edm::PoolOutputModule::respondToCloseInputFile ( FileBlock const &  fb)
overrideprivatevirtual

Definition at line 214 of file PoolOutputModule.cc.

References rootOutputFile_.

214  {
215  if(rootOutputFile_) rootOutputFile_->respondToCloseInputFile(fb);
216  }
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
void edm::PoolOutputModule::respondToOpenInputFile ( FileBlock const &  fb)
overrideprivatevirtual

Definition at line 199 of file PoolOutputModule.cc.

References beginInputFile(), revisionDML::branchType(), fillSelectedItemList(), i, edm::InEvent, initializedFromInput_, edm::InLumi, inputFileCount_, edm::FileBlock::lumiTree(), edm::NumBranchTypes, edm::FileBlock::runTree(), and edm::FileBlock::tree().

199  {
200  if(!initializedFromInput_) {
201  for(int i = InEvent; i < NumBranchTypes; ++i) {
202  BranchType branchType = static_cast<BranchType>(i);
203  TTree* theInputTree = (branchType == InEvent ? fb.tree() :
204  (branchType == InLumi ? fb.lumiTree() :
205  fb.runTree()));
206  fillSelectedItemList(branchType, theInputTree);
207  }
208  initializedFromInput_ = true;
209  }
210  ++inputFileCount_;
212  }
int i
Definition: DBlmapReader.cc:9
BranchType
Definition: BranchType.h:11
void fillSelectedItemList(BranchType branchtype, TTree *theInputTree)
void beginInputFile(FileBlock const &fb)
OutputItemListArray const& edm::PoolOutputModule::selectedOutputItemList ( ) const
inline

Definition at line 103 of file PoolOutputModule.h.

References selectedOutputItemList_.

Referenced by edm::RootOutputFile::RootOutputFile().

103 {return selectedOutputItemList_;}
OutputItemListArray selectedOutputItemList_
bool edm::PoolOutputModule::shouldWeCloseFile ( ) const
overrideprotectedvirtual

allow inheriting classes to override but still be able to call this method in the overridden version

Reimplemented from edm::one::OutputModuleBase.

Reimplemented in edm::TimeoutPoolOutputModule.

Definition at line 287 of file PoolOutputModule.cc.

References rootOutputFile_.

Referenced by edm::TimeoutPoolOutputModule::shouldWeCloseFile().

287 { return rootOutputFile_->shouldWeCloseFile(); }
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
int const& edm::PoolOutputModule::splitLevel ( ) const
inline

Definition at line 45 of file PoolOutputModule.h.

References splitLevel_.

Referenced by fillSelectedItemList().

45 {return splitLevel_;}
void edm::PoolOutputModule::startEndFile ( )
private

Definition at line 272 of file PoolOutputModule.cc.

Referenced by reallyCloseFile().

272 { }
int const& edm::PoolOutputModule::treeMaxVirtualSize ( ) const
inline

Definition at line 47 of file PoolOutputModule.h.

References treeMaxVirtualSize_.

47 {return treeMaxVirtualSize_;}
void edm::PoolOutputModule::updateBranchParents ( EventPrincipal const &  ep)
private

Definition at line 329 of file PoolOutputModule.cc.

References edm::Principal::begin(), branchChildren_, branchParents_, edm::Principal::end(), i, and edm::BranchChildren::insertEmpty().

Referenced by write().

329  {
330  for(EventPrincipal::const_iterator i = ep.begin(), iEnd = ep.end(); i != iEnd; ++i) {
331  if((*i) && (*i)->productProvenancePtr() != nullptr) {
332  BranchID const& bid = (*i)->branchDescription().branchID();
333  BranchParents::iterator it = branchParents_.find(bid);
334  if(it == branchParents_.end()) {
335  it = branchParents_.insert(std::make_pair(bid, std::set<ParentageID>())).first;
336  }
337  it->second.insert((*i)->productProvenancePtr()->parentageID());
339  }
340  }
341  }
int i
Definition: DBlmapReader.cc:9
BranchChildren branchChildren_
void insertEmpty(BranchID parent)
BranchParents branchParents_
boost::filter_iterator< FilledProductPtr, ProductHolderCollection::const_iterator > const_iterator
Definition: Principal.h:58
int const& edm::PoolOutputModule::whyNotFastClonable ( ) const
inline

Definition at line 54 of file PoolOutputModule.h.

References whyNotFastClonable_.

void edm::PoolOutputModule::write ( EventPrincipal const &  e,
ModuleCallingContext const *  mcc 
)
overrideprotectedvirtual

Implements edm::one::OutputModuleBase.

Reimplemented in edm::TimeoutPoolOutputModule.

Definition at line 232 of file PoolOutputModule.cc.

References edm::EventPrincipal::id(), rootOutputFile_, statusFileName_, and updateBranchParents().

Referenced by edm::TimeoutPoolOutputModule::write().

232  {
234  rootOutputFile_->writeOne(e, mcc);
235  if (!statusFileName_.empty()) {
236  std::ofstream statusFile(statusFileName_.c_str());
237  statusFile << e.id() << " time: " << std::setprecision(3) << TimeOfDay() << '\n';
238  statusFile.close();
239  }
240  }
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
void updateBranchParents(EventPrincipal const &ep)
void edm::PoolOutputModule::writeBranchIDListRegistry ( )
private

Definition at line 281 of file PoolOutputModule.cc.

References rootOutputFile_.

Referenced by reallyCloseFile().

281 { rootOutputFile_->writeBranchIDListRegistry(); }
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
void edm::PoolOutputModule::writeFileFormatVersion ( )
private

Definition at line 274 of file PoolOutputModule.cc.

References rootOutputFile_.

Referenced by reallyCloseFile().

274 { rootOutputFile_->writeFileFormatVersion(); }
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
void edm::PoolOutputModule::writeFileIdentifier ( )
private

Definition at line 275 of file PoolOutputModule.cc.

References rootOutputFile_.

Referenced by reallyCloseFile().

275 { rootOutputFile_->writeFileIdentifier(); }
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
void edm::PoolOutputModule::writeIndexIntoFile ( )
private

Definition at line 276 of file PoolOutputModule.cc.

References rootOutputFile_.

Referenced by reallyCloseFile().

276 { rootOutputFile_->writeIndexIntoFile(); }
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
void edm::PoolOutputModule::writeLuminosityBlock ( LuminosityBlockPrincipal const &  lb,
ModuleCallingContext const *  mcc 
)
overrideprivatevirtual

Implements edm::one::OutputModuleBase.

Definition at line 242 of file PoolOutputModule.cc.

References rootOutputFile_.

242  {
243  rootOutputFile_->writeLuminosityBlock(lb, mcc);
244  }
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
void edm::PoolOutputModule::writeParameterSetRegistry ( )
private

Definition at line 278 of file PoolOutputModule.cc.

References rootOutputFile_.

Referenced by reallyCloseFile().

278 { rootOutputFile_->writeParameterSetRegistry(); }
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
void edm::PoolOutputModule::writeParentageRegistry ( )
private

Definition at line 280 of file PoolOutputModule.cc.

References rootOutputFile_.

Referenced by reallyCloseFile().

280 { rootOutputFile_->writeParentageRegistry(); }
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
void edm::PoolOutputModule::writeProcessHistoryRegistry ( )
private

Definition at line 277 of file PoolOutputModule.cc.

References rootOutputFile_.

Referenced by reallyCloseFile().

277 { rootOutputFile_->writeProcessHistoryRegistry(); }
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
void edm::PoolOutputModule::writeProductDependencies ( )
private

Definition at line 283 of file PoolOutputModule.cc.

References rootOutputFile_.

Referenced by reallyCloseFile().

283 { rootOutputFile_->writeProductDependencies(); }
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
void edm::PoolOutputModule::writeProductDescriptionRegistry ( )
private

Definition at line 279 of file PoolOutputModule.cc.

References rootOutputFile_.

Referenced by reallyCloseFile().

279 { rootOutputFile_->writeProductDescriptionRegistry(); }
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
void edm::PoolOutputModule::writeRun ( RunPrincipal const &  r,
ModuleCallingContext const *  mcc 
)
overrideprivatevirtual

Implements edm::one::OutputModuleBase.

Definition at line 246 of file PoolOutputModule.cc.

References rootOutputFile_.

246  {
247  rootOutputFile_->writeRun(r, mcc);
248  }
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_
void edm::PoolOutputModule::writeThinnedAssociationsHelper ( )
private

Definition at line 282 of file PoolOutputModule.cc.

References rootOutputFile_.

Referenced by reallyCloseFile().

282 { rootOutputFile_->writeThinnedAssociationsHelper(); }
edm::propagate_const< std::unique_ptr< RootOutputFile > > rootOutputFile_

Member Data Documentation

AuxItemArray edm::PoolOutputModule::auxItems_
private

Definition at line 147 of file PoolOutputModule.h.

Referenced by auxItems(), and fillSelectedItemList().

std::string edm::PoolOutputModule::basketOrder_
private

Definition at line 158 of file PoolOutputModule.h.

Referenced by basketOrder().

int const edm::PoolOutputModule::basketSize_
private

Definition at line 155 of file PoolOutputModule.h.

Referenced by basketSize().

BranchChildren edm::PoolOutputModule::branchChildren_
private
BranchParents edm::PoolOutputModule::branchParents_
private

Definition at line 168 of file PoolOutputModule.h.

Referenced by fillDependencyGraph(), reallyCloseFile(), and updateBranchParents().

std::string const edm::PoolOutputModule::catalog_
private

Definition at line 151 of file PoolOutputModule.h.

Referenced by catalog().

unsigned int edm::PoolOutputModule::childIndex_
private
std::string const edm::PoolOutputModule::compressionAlgorithm_
private

Definition at line 154 of file PoolOutputModule.h.

Referenced by compressionAlgorithm().

int const edm::PoolOutputModule::compressionLevel_
private

Definition at line 153 of file PoolOutputModule.h.

Referenced by compressionLevel().

DropMetaData edm::PoolOutputModule::dropMetaData_
private

Definition at line 161 of file PoolOutputModule.h.

Referenced by dropMetaData(), and PoolOutputModule().

int const edm::PoolOutputModule::eventAutoFlushSize_
private

Definition at line 156 of file PoolOutputModule.h.

Referenced by eventAutoFlushSize().

std::string const edm::PoolOutputModule::fileName_
private

Definition at line 149 of file PoolOutputModule.h.

Referenced by fileName().

bool edm::PoolOutputModule::initializedFromInput_
private

Definition at line 163 of file PoolOutputModule.h.

Referenced by respondToOpenInputFile().

int edm::PoolOutputModule::inputFileCount_
private
std::string const edm::PoolOutputModule::logicalFileName_
private

Definition at line 150 of file PoolOutputModule.h.

Referenced by logicalFileName().

unsigned int const edm::PoolOutputModule::maxFileSize_
private

Definition at line 152 of file PoolOutputModule.h.

Referenced by maxFileSize().

std::string const edm::PoolOutputModule::moduleLabel_
private
unsigned int edm::PoolOutputModule::numberOfDigitsInIndex_
private
int edm::PoolOutputModule::outputFileCount_
private

Definition at line 164 of file PoolOutputModule.h.

Referenced by physicalAndLogicalNameForNewFile().

bool edm::PoolOutputModule::overrideInputFileSplitLevels_
private

Definition at line 170 of file PoolOutputModule.h.

Referenced by fillSelectedItemList(), and overrideInputFileSplitLevels().

edm::propagate_const<std::unique_ptr<RootOutputFile> > edm::PoolOutputModule::rootOutputFile_
private
RootServiceChecker edm::PoolOutputModule::rootServiceChecker_
private

Definition at line 146 of file PoolOutputModule.h.

OutputItemListArray edm::PoolOutputModule::selectedOutputItemList_
private

Definition at line 148 of file PoolOutputModule.h.

Referenced by fillSelectedItemList(), and selectedOutputItemList().

int const edm::PoolOutputModule::splitLevel_
private

Definition at line 157 of file PoolOutputModule.h.

Referenced by splitLevel().

std::string edm::PoolOutputModule::statusFileName_
private

Definition at line 172 of file PoolOutputModule.h.

Referenced by PoolOutputModule(), and write().

int const edm::PoolOutputModule::treeMaxVirtualSize_
private

Definition at line 159 of file PoolOutputModule.h.

Referenced by treeMaxVirtualSize().

int edm::PoolOutputModule::whyNotFastClonable_
private

Definition at line 160 of file PoolOutputModule.h.

Referenced by PoolOutputModule(), and whyNotFastClonable().