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
 
virtual ~EmbeddedRootSource ()
 
- 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)
 
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

virtual void beginJob () override
 
virtual void closeFile_ ()
 
virtual void dropUnwantedBranches_ (std::vector< std::string > const &wantedBranches) override
 
virtual void endJob () override
 
virtual bool readOneEvent (EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id) override
 
virtual 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.

16  :
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_)) {
38  }
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 ( )
virtual

Definition at line 40 of file EmbeddedRootSource.cc.

40 {}

Member Function Documentation

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

Implements edm::VectorInputSource.

Definition at line 43 of file EmbeddedRootSource.cc.

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

Definition at line 52 of file EmbeddedRootSource.cc.

References fileSequence_.

52  {
53  fileSequence_->closeFile_();
54  }
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 67 of file EmbeddedRootSource.cc.

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

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

Implements edm::VectorInputSource.

Definition at line 47 of file EmbeddedRootSource.cc.

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

47  {
48  fileSequence_->endJob();
50  }
static void reportReadBranches()
Definition: InputFile.cc:120
edm::propagate_const< std::unique_ptr< RootEmbeddedFileSequence > > fileSequence_
void edm::EmbeddedRootSource::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 80 of file EmbeddedRootSource.cc.

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

80  {
81 
83 
84  std::vector<std::string> defaultStrings;
85  desc.setComment("Reads EDM/Root files for mixing.");
86  desc.addUntracked<std::vector<std::string> >("fileNames")
87  ->setComment("Names of files to be processed.");
88  desc.addUntracked<std::string>("overrideCatalog", std::string());
89  desc.addUntracked<bool>("skipBadFiles", false)
90  ->setComment("True: Ignore any missing or unopenable input file.\n"
91  "False: Throw exception if missing or unopenable input file.");
92  desc.addUntracked<bool>("bypassVersionCheck", false)
93  ->setComment("True: Bypass release version check.\n"
94  "False: Throw exception if reading file in a release prior to the release in which the file was written.");
95  desc.addUntracked<int>("treeMaxVirtualSize", -1)
96  ->setComment("Size of ROOT TTree TBasket cache. Affects performance.");
97 
98  ProductSelectorRules::fillDescription(desc, "inputCommands");
100 
101  descriptions.add("source", desc);
102  }
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 
)
overrideprivatevirtual

Implements edm::VectorInputSource.

Definition at line 57 of file EmbeddedRootSource.cc.

References fileSequence_.

57  {
58  return fileSequence_->readOneEvent(cache, fileNameHash, engine, id);
59  }
def cache(function)
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 62 of file EmbeddedRootSource.cc.

References fileSequence_.

62  {
63  fileSequence_->readOneSpecified(cache, fileNameHash, id);
64  }
def cache(function)
edm::propagate_const< std::unique_ptr< RootEmbeddedFileSequence > > fileSequence_
RunHelperBase* edm::EmbeddedRootSource::runHelper ( )
inline

Definition at line 47 of file EmbeddedRootSource.h.

References bk::beginJob(), and helperFunctions::cache().

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().

Member Data Documentation

bool edm::EmbeddedRootSource::bypassVersionCheck_
private

Definition at line 63 of file EmbeddedRootSource.h.

InputFileCatalog edm::EmbeddedRootSource::catalog_
private

Definition at line 68 of file EmbeddedRootSource.h.

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

Definition at line 69 of file EmbeddedRootSource.h.

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

unsigned int edm::EmbeddedRootSource::nStreams_
private

Definition at line 61 of file EmbeddedRootSource.h.

ProductSelectorRules edm::EmbeddedRootSource::productSelectorRules_
private

Definition at line 65 of file EmbeddedRootSource.h.

Referenced by dropUnwantedBranches_().

RootServiceChecker edm::EmbeddedRootSource::rootServiceChecker_
private

Definition at line 59 of file EmbeddedRootSource.h.

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

Definition at line 66 of file EmbeddedRootSource.h.

bool edm::EmbeddedRootSource::skipBadFiles_
private

Definition at line 62 of file EmbeddedRootSource.h.

int const edm::EmbeddedRootSource::treeMaxVirtualSize_
private

Definition at line 64 of file EmbeddedRootSource.h.