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
 
ProcessHistoryRegistryprocessHistoryRegistryForUpdate ()
 
ProductRegistryproductRegistryUpdate ()
 
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 > & productRegistry ()
 
std::shared_ptr< ProductRegistry const > productRegistry () const
 
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_
 
const int treeMaxVirtualSize_
 

Detailed Description

Definition at line 34 of file EmbeddedRootSource.h.

Constructor & Destructor Documentation

◆ EmbeddedRootSource()

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_)) {}

◆ ~EmbeddedRootSource()

edm::EmbeddedRootSource::~EmbeddedRootSource ( )
override

Definition at line 39 of file EmbeddedRootSource.cc.

39 {}

Member Function Documentation

◆ beginJob()

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

Implements edm::VectorInputSource.

Definition at line 41 of file EmbeddedRootSource.cc.

41 {}

◆ bypassVersionCheck()

bool edm::EmbeddedRootSource::bypassVersionCheck ( ) const
inline

Definition at line 43 of file EmbeddedRootSource.h.

43 { return bypassVersionCheck_; }

References bypassVersionCheck_.

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

◆ closeFile_()

void edm::EmbeddedRootSource::closeFile_ ( )
privatevirtual

Definition at line 48 of file EmbeddedRootSource.cc.

48 { fileSequence_->closeFile_(); }

References fileSequence_.

◆ dropUnwantedBranches_()

void edm::EmbeddedRootSource::dropUnwantedBranches_ ( std::vector< std::string > const &  wantedBranches)
overrideprivatevirtual

Implements edm::VectorInputSource.

Definition at line 64 of file EmbeddedRootSource.cc.

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  }

References MicroEventContent_cff::branch, productSelectorRules_, muonDTDigis_cfi::pset, cmsCodeRulesChecker::rules, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ endJob()

void edm::EmbeddedRootSource::endJob ( void  )
overrideprivatevirtual

Implements edm::VectorInputSource.

Definition at line 43 of file EmbeddedRootSource.cc.

43  {
44  fileSequence_->endJob();
46  }

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

◆ fillDescriptions()

void edm::EmbeddedRootSource::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 76 of file EmbeddedRootSource.cc.

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  }

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

◆ nStreams()

unsigned int edm::EmbeddedRootSource::nStreams ( ) const
inline

Definition at line 44 of file EmbeddedRootSource.h.

44 { return nStreams_; }

References nStreams_.

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

◆ processHistoryRegistryForUpdate()

ProcessHistoryRegistry& edm::VectorInputSource::processHistoryRegistryForUpdate
inline

Definition at line 57 of file VectorInputSource.h.

57 { return *processHistoryRegistry_; }

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

◆ productRegistryUpdate()

ProductRegistry& edm::VectorInputSource::productRegistryUpdate
inline

Definition at line 55 of file VectorInputSource.h.

55 { return *productRegistry_; }

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

◆ productSelectorRules()

ProductSelectorRules const& edm::EmbeddedRootSource::productSelectorRules ( ) const
inline

Definition at line 46 of file EmbeddedRootSource.h.

46 { return productSelectorRules_; }

References productSelectorRules_.

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

◆ readOneEvent()

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.

54  {
55  return fileSequence_->readOneEvent(cache, fileNameHash, engine, id, recycleFiles);
56  }

References utilities::cache(), and fileSequence_.

◆ readOneSpecified()

void edm::EmbeddedRootSource::readOneSpecified ( EventPrincipal cache,
size_t &  fileNameHash,
SecondaryEventIDAndFileInfo const &  id 
)
overrideprivatevirtual

Implements edm::VectorInputSource.

Definition at line 58 of file EmbeddedRootSource.cc.

60  {
61  fileSequence_->readOneSpecified(cache, fileNameHash, id);
62  }

References utilities::cache(), and fileSequence_.

◆ runHelper()

RunHelperBase* edm::EmbeddedRootSource::runHelper ( )
inline

Definition at line 47 of file EmbeddedRootSource.h.

47 { return runHelper_.get(); }

References runHelper_.

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

◆ skipBadFiles()

bool edm::EmbeddedRootSource::skipBadFiles ( ) const
inline

Definition at line 42 of file EmbeddedRootSource.h.

42 { return skipBadFiles_; }

References skipBadFiles_.

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

◆ treeMaxVirtualSize()

int edm::EmbeddedRootSource::treeMaxVirtualSize ( ) const
inline

Definition at line 45 of file EmbeddedRootSource.h.

45 { return treeMaxVirtualSize_; }

References treeMaxVirtualSize_.

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

Member Data Documentation

◆ bypassVersionCheck_

bool edm::EmbeddedRootSource::bypassVersionCheck_
private

Definition at line 67 of file EmbeddedRootSource.h.

Referenced by bypassVersionCheck().

◆ catalog_

InputFileCatalog edm::EmbeddedRootSource::catalog_
private

Definition at line 72 of file EmbeddedRootSource.h.

◆ fileSequence_

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

◆ nStreams_

unsigned int edm::EmbeddedRootSource::nStreams_
private

Definition at line 65 of file EmbeddedRootSource.h.

Referenced by nStreams().

◆ productSelectorRules_

ProductSelectorRules edm::EmbeddedRootSource::productSelectorRules_
private

Definition at line 69 of file EmbeddedRootSource.h.

Referenced by dropUnwantedBranches_(), and productSelectorRules().

◆ rootServiceChecker_

RootServiceChecker edm::EmbeddedRootSource::rootServiceChecker_
private

Definition at line 63 of file EmbeddedRootSource.h.

◆ runHelper_

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

Definition at line 70 of file EmbeddedRootSource.h.

Referenced by runHelper().

◆ skipBadFiles_

bool edm::EmbeddedRootSource::skipBadFiles_
private

Definition at line 66 of file EmbeddedRootSource.h.

Referenced by skipBadFiles().

◆ treeMaxVirtualSize_

const int edm::EmbeddedRootSource::treeMaxVirtualSize_
private

Definition at line 68 of file EmbeddedRootSource.h.

Referenced by treeMaxVirtualSize().

edm::VectorInputSource::processHistoryRegistry_
edm::propagate_const< std::unique_ptr< ProcessHistoryRegistry > > processHistoryRegistry_
Definition: VectorInputSource.h:80
MicroEventContent_cff.branch
branch
Definition: MicroEventContent_cff.py:152
edm::EmbeddedRootSource::treeMaxVirtualSize_
const int treeMaxVirtualSize_
Definition: EmbeddedRootSource.h:68
edm::EmbeddedRootSource::catalog_
InputFileCatalog catalog_
Definition: EmbeddedRootSource.h:72
edm::InputFile::reportReadBranches
static void reportReadBranches()
Definition: InputFile.cc:106
edm::EmbeddedRootSource::runHelper_
std::unique_ptr< RunHelperBase > runHelper_
Definition: EmbeddedRootSource.h:70
edm::EmbeddedRootSource::nStreams_
unsigned int nStreams_
Definition: EmbeddedRootSource.h:65
edm::VectorInputSource::productRegistry_
edm::propagate_const< std::shared_ptr< ProductRegistry > > productRegistry_
Definition: VectorInputSource.h:79
edm::EmbeddedRootSource::skipBadFiles_
bool skipBadFiles_
Definition: EmbeddedRootSource.h:66
utilities.cache
def cache(function)
Definition: utilities.py:3
edm::EmbeddedRootSource::productSelectorRules_
ProductSelectorRules productSelectorRules_
Definition: EmbeddedRootSource.h:69
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ParameterSet
Definition: Functions.h:16
edm::ProductSelectorRules::fillDescription
static void fillDescription(ParameterSetDescription &desc, char const *parameterName, std::vector< std::string > const &defaultStrings=defaultSelectionStrings())
Definition: ProductSelectorRules.cc:202
edm::EmbeddedRootSource::rootServiceChecker_
RootServiceChecker rootServiceChecker_
Definition: EmbeddedRootSource.h:63
edm::EmbeddedRootSource::bypassVersionCheck_
bool bypassVersionCheck_
Definition: EmbeddedRootSource.h:67
edm::VectorInputSource::VectorInputSource
VectorInputSource(ParameterSet const &pset, VectorInputSourceDescription const &desc)
Definition: VectorInputSource.cc:12
ParameterSetDescription
edm::RootEmbeddedFileSequence::fillDescription
static void fillDescription(ParameterSetDescription &desc)
Definition: RootEmbeddedFileSequence.cc:327
edm::EmbeddedRootSource::fileSequence_
edm::propagate_const< std::unique_ptr< RootEmbeddedFileSequence > > fileSequence_
Definition: EmbeddedRootSource.h:73
cmsCodeRulesChecker.rules
rules
Definition: cmsCodeRulesChecker.py:152
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27