CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
edm::EmbeddedRootSource Class Reference

#include <EmbeddedRootSource.h>

Inheritance diagram for edm::EmbeddedRootSource:
edm::VectorInputSource

Public Member Functions

bool bypassVersionCheck () const
 
 EmbeddedRootSource (ParameterSet const &pset, VectorInputSourceDescription const &desc)
 
unsigned int nStreams () const
 
ProductSelectorRules const & productSelectorRules () const
 
RunHelperBaserunHelper ()
 
bool skipBadFiles () const
 
int treeMaxVirtualSize () const
 
 ~EmbeddedRootSource () override
 
- Public Member Functions inherited from edm::VectorInputSource
void doBeginJob ()
 Called at beginning of job. More...
 
void doEndJob ()
 Called at end of job. More...
 
void dropUnwantedBranches (std::vector< std::string > const &wantedBranches)
 
template<typename T >
size_t loopOverEvents (EventPrincipal &cache, size_t &fileNameHash, size_t number, T eventOperator, CLHEP::HepRandomEngine *=nullptr, EventID const *id=nullptr, bool recycleFiles=true)
 
template<typename T , typename Iterator >
size_t loopSpecified (EventPrincipal &cache, size_t &fileNameHash, Iterator const &begin, Iterator const &end, T eventOperator)
 
ProcessHistoryRegistry const & processHistoryRegistry () const
 
ProcessHistoryRegistryprocessHistoryRegistryForUpdate ()
 
std::shared_ptr< ProductRegistry const > productRegistry () const
 
std::shared_ptr< ProductRegistry > & productRegistry ()
 
ProductRegistryproductRegistryUpdate ()
 
 VectorInputSource (ParameterSet const &pset, VectorInputSourceDescription const &desc)
 
virtual ~VectorInputSource ()
 

Static Public Member Functions

static void fillDescriptions (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginJob () override
 
virtual void closeFile_ ()
 
void dropUnwantedBranches_ (std::vector< std::string > const &wantedBranches) override
 
void endJob () override
 
bool readOneEvent (EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id, bool recycleFiles) override
 
void readOneSpecified (EventPrincipal &cache, size_t &fileNameHash, SecondaryEventIDAndFileInfo const &id) override
 

Private Attributes

bool bypassVersionCheck_
 
InputFileCatalog catalog_
 
edm::propagate_const< std::unique_ptr< RootEmbeddedFileSequence > > fileSequence_
 
unsigned int nStreams_
 
ProductSelectorRules productSelectorRules_
 
RootServiceChecker rootServiceChecker_
 
std::unique_ptr< RunHelperBaserunHelper_
 
bool skipBadFiles_
 
int const treeMaxVirtualSize_
 

Detailed Description

Definition at line 34 of file EmbeddedRootSource.h.

Constructor & Destructor Documentation

edm::EmbeddedRootSource::EmbeddedRootSource ( ParameterSet const &  pset,
VectorInputSourceDescription const &  desc 
)
explicit

Definition at line 16 of file EmbeddedRootSource.cc.

17  : VectorInputSource(pset, desc),
19  nStreams_(desc.allocations_->numberOfStreams()),
20  // The default value provided as the second argument to the getUntrackedParameter function call
21  // is not used when the ParameterSet has been validated and the parameters are not optional
22  // in the description. This is currently true when PoolSource is the primary input source.
23  // The modules that use PoolSource as a SecSource have not defined their fillDescriptions function
24  // yet, so the ParameterSet does not get validated yet. As soon as all the modules with a SecSource
25  // have defined descriptions, the defaults in the getUntrackedParameterSet function calls can
26  // and should be deleted from the code.
27  //
28  skipBadFiles_(pset.getUntrackedParameter<bool>("skipBadFiles", false)),
29  bypassVersionCheck_(pset.getUntrackedParameter<bool>("bypassVersionCheck", false)),
30  treeMaxVirtualSize_(pset.getUntrackedParameter<int>("treeMaxVirtualSize", -1)),
31  productSelectorRules_(pset, "inputCommands", "InputSource"),
32  runHelper_(new DefaultRunHelper()),
33  catalog_(pset.getUntrackedParameter<std::vector<std::string> >("fileNames"),
34  pset.getUntrackedParameter<std::string>("overrideCatalog", std::string())),
35  // Note: fileSequence_ needs to be initialized last, because it uses data members
36  // initialized previously in its own initialization.
37  fileSequence_(new RootEmbeddedFileSequence(pset, *this, catalog_)) {}
std::unique_ptr< RunHelperBase > runHelper_
VectorInputSource(ParameterSet const &pset, VectorInputSourceDescription const &desc)
RootServiceChecker rootServiceChecker_
ProductSelectorRules productSelectorRules_
edm::propagate_const< std::unique_ptr< RootEmbeddedFileSequence > > fileSequence_
edm::EmbeddedRootSource::~EmbeddedRootSource ( )
override

Definition at line 39 of file EmbeddedRootSource.cc.

39 {}

Member Function Documentation

void edm::EmbeddedRootSource::beginJob ( void  )
overrideprivatevirtual

Implements edm::VectorInputSource.

Definition at line 41 of file EmbeddedRootSource.cc.

41 {}
bool edm::EmbeddedRootSource::bypassVersionCheck ( ) const
inline
void edm::EmbeddedRootSource::closeFile_ ( )
privatevirtual

Definition at line 48 of file EmbeddedRootSource.cc.

References fileSequence_.

48 { fileSequence_->closeFile(); }
edm::propagate_const< std::unique_ptr< RootEmbeddedFileSequence > > fileSequence_
void edm::EmbeddedRootSource::dropUnwantedBranches_ ( std::vector< std::string > const &  wantedBranches)
overrideprivatevirtual

Implements edm::VectorInputSource.

Definition at line 64 of file EmbeddedRootSource.cc.

References edm::ParameterSet::addUntrackedParameter(), MicroEventContent_cff::branch, productSelectorRules_, muonDTDigis_cfi::pset, cmsCodeRulesChecker::rules, and AlCaHLTBitMon_QueryRunRegistry::string.

64  {
65  std::vector<std::string> rules;
66  rules.reserve(wantedBranches.size() + 1);
67  rules.emplace_back("drop *");
68  for (std::string const& branch : wantedBranches) {
69  rules.push_back("keep " + branch + "_*");
70  }
72  pset.addUntrackedParameter("inputCommands", rules);
73  productSelectorRules_ = ProductSelectorRules(pset, "inputCommands", "InputSource");
74  }
ProductSelectorRules productSelectorRules_
void edm::EmbeddedRootSource::endJob ( void  )
overrideprivatevirtual

Implements edm::VectorInputSource.

Definition at line 43 of file EmbeddedRootSource.cc.

References fileSequence_, and edm::InputFile::reportReadBranches().

43  {
44  fileSequence_->endJob();
46  }
static void reportReadBranches()
Definition: InputFile.cc:106
edm::propagate_const< std::unique_ptr< RootEmbeddedFileSequence > > fileSequence_
void edm::EmbeddedRootSource::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 76 of file EmbeddedRootSource.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), edm::ProductSelectorRules::fillDescription(), edm::RootEmbeddedFileSequence::fillDescription(), edm::ParameterSetDescription::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

76  {
78 
79  std::vector<std::string> defaultStrings;
80  desc.setComment("Reads EDM/Root files for mixing.");
81  desc.addUntracked<std::vector<std::string> >("fileNames")->setComment("Names of files to be processed.");
82  desc.addUntracked<std::string>("overrideCatalog", std::string());
83  desc.addUntracked<bool>("skipBadFiles", false)
84  ->setComment(
85  "True: Ignore any missing or unopenable input file.\n"
86  "False: Throw exception if missing or unopenable input file.");
87  desc.addUntracked<bool>("bypassVersionCheck", false)
88  ->setComment(
89  "True: Bypass release version check.\n"
90  "False: Throw exception if reading file in a release prior to the release in which the file was written.");
91  desc.addUntracked<int>("treeMaxVirtualSize", -1)
92  ->setComment("Size of ROOT TTree TBasket cache. Affects performance.");
93 
94  ProductSelectorRules::fillDescription(desc, "inputCommands");
96 
97  descriptions.add("source", desc);
98  }
static void fillDescription(ParameterSetDescription &desc, char const *parameterName, std::vector< std::string > const &defaultStrings=defaultSelectionStrings())
static void fillDescription(ParameterSetDescription &desc)
unsigned int edm::EmbeddedRootSource::nStreams ( ) const
inline

Definition at line 44 of file EmbeddedRootSource.h.

Referenced by edm::RootEmbeddedFileSequence::makeRootFile().

44 { return nStreams_; }
ProductSelectorRules const& edm::EmbeddedRootSource::productSelectorRules ( ) const
inline

Definition at line 46 of file EmbeddedRootSource.h.

Referenced by edm::RootEmbeddedFileSequence::makeRootFile().

46 { return productSelectorRules_; }
ProductSelectorRules productSelectorRules_
bool edm::EmbeddedRootSource::readOneEvent ( EventPrincipal cache,
size_t &  fileNameHash,
CLHEP::HepRandomEngine *  engine,
EventID const *  id,
bool  recycleFiles 
)
overrideprivatevirtual

Implements edm::VectorInputSource.

Definition at line 50 of file EmbeddedRootSource.cc.

References fileSequence_.

54  {
55  return fileSequence_->readOneEvent(cache, fileNameHash, engine, id, recycleFiles);
56  }
def cache(function)
Definition: utilities.py:3
edm::propagate_const< std::unique_ptr< RootEmbeddedFileSequence > > fileSequence_
void edm::EmbeddedRootSource::readOneSpecified ( EventPrincipal cache,
size_t &  fileNameHash,
SecondaryEventIDAndFileInfo const &  id 
)
overrideprivatevirtual

Implements edm::VectorInputSource.

Definition at line 58 of file EmbeddedRootSource.cc.

References fileSequence_.

60  {
61  fileSequence_->readOneSpecified(cache, fileNameHash, id);
62  }
def cache(function)
Definition: utilities.py:3
edm::propagate_const< std::unique_ptr< RootEmbeddedFileSequence > > fileSequence_
RunHelperBase* edm::EmbeddedRootSource::runHelper ( )
inline

Definition at line 47 of file EmbeddedRootSource.h.

References bk::beginJob(), utilities::cache(), and fillDescriptions().

Referenced by edm::RootEmbeddedFileSequence::makeRootFile().

47 { return runHelper_.get(); }
std::unique_ptr< RunHelperBase > runHelper_
bool edm::EmbeddedRootSource::skipBadFiles ( ) const
inline
int edm::EmbeddedRootSource::treeMaxVirtualSize ( ) const
inline

Definition at line 45 of file EmbeddedRootSource.h.

Referenced by edm::RootEmbeddedFileSequence::makeRootFile().

45 { return treeMaxVirtualSize_; }

Member Data Documentation

bool edm::EmbeddedRootSource::bypassVersionCheck_
private

Definition at line 67 of file EmbeddedRootSource.h.

InputFileCatalog edm::EmbeddedRootSource::catalog_
private

Definition at line 72 of file EmbeddedRootSource.h.

edm::propagate_const<std::unique_ptr<RootEmbeddedFileSequence> > edm::EmbeddedRootSource::fileSequence_
private

Definition at line 73 of file EmbeddedRootSource.h.

Referenced by closeFile_(), endJob(), readOneEvent(), and readOneSpecified().

unsigned int edm::EmbeddedRootSource::nStreams_
private

Definition at line 65 of file EmbeddedRootSource.h.

ProductSelectorRules edm::EmbeddedRootSource::productSelectorRules_
private

Definition at line 69 of file EmbeddedRootSource.h.

Referenced by dropUnwantedBranches_().

RootServiceChecker edm::EmbeddedRootSource::rootServiceChecker_
private

Definition at line 63 of file EmbeddedRootSource.h.

std::unique_ptr<RunHelperBase> edm::EmbeddedRootSource::runHelper_
private

Definition at line 70 of file EmbeddedRootSource.h.

bool edm::EmbeddedRootSource::skipBadFiles_
private

Definition at line 66 of file EmbeddedRootSource.h.

int const edm::EmbeddedRootSource::treeMaxVirtualSize_
private

Definition at line 68 of file EmbeddedRootSource.h.