CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
edm::VectorInputSource Class Referenceabstract

#include <VectorInputSource.h>

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

Public Member Functions

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

Private Member Functions

virtual void beginJob ()=0
 
void clearEventPrincipal (EventPrincipal &cache)
 
virtual void dropUnwantedBranches_ (std::vector< std::string > const &wantedBranches)=0
 
virtual void endJob ()=0
 
virtual bool readOneEvent (EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id, bool recycleFiles)=0
 
virtual void readOneSpecified (EventPrincipal &cache, size_t &fileNameHash, SecondaryEventIDAndFileInfo const &event)=0
 
void readOneSpecified (EventPrincipal &cache, size_t &fileNameHash, EventID const &event)
 
void throwIfOverLimit (unsigned int consecutiveRejections) const
 

Private Attributes

unsigned int consecutiveRejectionsLimit_
 
edm::propagate_const
< std::unique_ptr
< ProcessHistoryRegistry > > 
processHistoryRegistry_
 
edm::propagate_const
< std::shared_ptr
< ProductRegistry > > 
productRegistry_
 

Detailed Description

Definition at line 27 of file VectorInputSource.h.

Constructor & Destructor Documentation

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

Definition at line 12 of file VectorInputSource.cc.

13  : productRegistry_(desc.productRegistry_),
14  processHistoryRegistry_(new ProcessHistoryRegistry),
15  consecutiveRejectionsLimit_(pset.getUntrackedParameter<unsigned int>("consecutiveRejectionsLimit", 100)) {}
edm::propagate_const< std::unique_ptr< ProcessHistoryRegistry > > processHistoryRegistry_
unsigned int consecutiveRejectionsLimit_
edm::propagate_const< std::shared_ptr< ProductRegistry > > productRegistry_
edm::VectorInputSource::~VectorInputSource ( )
virtual

Definition at line 17 of file VectorInputSource.cc.

17 {}

Member Function Documentation

virtual void edm::VectorInputSource::beginJob ( )
privatepure virtual

Implemented in edm::EmbeddedRootSource.

Referenced by doBeginJob().

void edm::VectorInputSource::clearEventPrincipal ( EventPrincipal cache)
private

Definition at line 23 of file VectorInputSource.cc.

References edm::EventPrincipal::clearEventPrincipal().

Referenced by loopOverEvents(), and loopSpecified().

23 { cache.clearEventPrincipal(); }
def cache
Definition: utilities.py:3
void edm::VectorInputSource::doBeginJob ( )

Called at beginning of job.

Definition at line 25 of file VectorInputSource.cc.

References beginJob().

25 { this->beginJob(); }
virtual void beginJob()=0
void edm::VectorInputSource::doEndJob ( )

Called at end of job.

Definition at line 27 of file VectorInputSource.cc.

References endJob().

27 { this->endJob(); }
virtual void endJob()=0
void edm::VectorInputSource::dropUnwantedBranches ( std::vector< std::string > const &  wantedBranches)

Definition at line 19 of file VectorInputSource.cc.

References dropUnwantedBranches_().

19  {
20  this->dropUnwantedBranches_(wantedBranches);
21  }
virtual void dropUnwantedBranches_(std::vector< std::string > const &wantedBranches)=0
virtual void edm::VectorInputSource::dropUnwantedBranches_ ( std::vector< std::string > const &  wantedBranches)
privatepure virtual

Implemented in edm::EmbeddedRootSource.

Referenced by dropUnwantedBranches().

virtual void edm::VectorInputSource::endJob ( )
privatepure virtual

Implemented in edm::EmbeddedRootSource.

Referenced by doEndJob().

template<typename T >
size_t edm::VectorInputSource::loopOverEvents ( EventPrincipal cache,
size_t &  fileNameHash,
size_t  number,
T  eventOperator,
CLHEP::HepRandomEngine *  engine = nullptr,
EventID const *  id = nullptr,
bool  recycleFiles = true 
)

Definition at line 85 of file VectorInputSource.h.

References clearEventPrincipal(), consecutiveRejectionsLimit_, newFWLiteAna::found, mps_fire::i, readOneEvent(), and throwIfOverLimit().

91  {
92  size_t i = 0U;
93  unsigned int consecutiveRejections = 0U;
94  while (i < number) {
96  bool found = readOneEvent(cache, fileNameHash, engine, id, recycleFiles);
97  if (!found)
98  break;
99  bool used = eventOperator(cache, fileNameHash);
100  if (used) {
101  ++i;
102  consecutiveRejections = 0U;
103  } else if (consecutiveRejectionsLimit_ > 0) {
104  ++consecutiveRejections;
105  throwIfOverLimit(consecutiveRejections);
106  }
107  }
108  return i;
109  }
void clearEventPrincipal(EventPrincipal &cache)
virtual bool readOneEvent(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id, bool recycleFiles)=0
unsigned int consecutiveRejectionsLimit_
void throwIfOverLimit(unsigned int consecutiveRejections) const
def cache
Definition: utilities.py:3
template<typename T , typename Iterator >
size_t edm::VectorInputSource::loopSpecified ( EventPrincipal cache,
size_t &  fileNameHash,
Iterator const &  begin,
Iterator const &  end,
T  eventOperator 
)

Definition at line 112 of file VectorInputSource.h.

References clearEventPrincipal(), dataset::end, mps_fire::i, and readOneSpecified().

113  {
114  size_t i = 0U;
115  for (Iterator iter = begin; iter != end; ++iter) {
117  readOneSpecified(cache, fileNameHash, *iter);
118  eventOperator(cache, fileNameHash);
119  ++i;
120  }
121  return i;
122  }
void clearEventPrincipal(EventPrincipal &cache)
string end
Definition: dataset.py:937
def cache
Definition: utilities.py:3
virtual void readOneSpecified(EventPrincipal &cache, size_t &fileNameHash, SecondaryEventIDAndFileInfo const &event)=0
ProcessHistoryRegistry const& edm::VectorInputSource::processHistoryRegistry ( ) const
inline

Definition at line 56 of file VectorInputSource.h.

References processHistoryRegistry_.

56 { return *processHistoryRegistry_; }
edm::propagate_const< std::unique_ptr< ProcessHistoryRegistry > > processHistoryRegistry_
ProcessHistoryRegistry& edm::VectorInputSource::processHistoryRegistryForUpdate ( )
inline

Definition at line 57 of file VectorInputSource.h.

References processHistoryRegistry_.

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

57 { return *processHistoryRegistry_; }
edm::propagate_const< std::unique_ptr< ProcessHistoryRegistry > > processHistoryRegistry_
std::shared_ptr<ProductRegistry const> edm::VectorInputSource::productRegistry ( ) const
inline

Definition at line 53 of file VectorInputSource.h.

References edm::get_underlying_safe(), and productRegistry_.

constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
edm::propagate_const< std::shared_ptr< ProductRegistry > > productRegistry_
std::shared_ptr<ProductRegistry>& edm::VectorInputSource::productRegistry ( )
inline

Definition at line 54 of file VectorInputSource.h.

References edm::get_underlying_safe(), and productRegistry_.

constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
edm::propagate_const< std::shared_ptr< ProductRegistry > > productRegistry_
ProductRegistry& edm::VectorInputSource::productRegistryUpdate ( )
inline

Definition at line 55 of file VectorInputSource.h.

References productRegistry_.

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

55 { return *productRegistry_; }
edm::propagate_const< std::shared_ptr< ProductRegistry > > productRegistry_
virtual bool edm::VectorInputSource::readOneEvent ( EventPrincipal cache,
size_t &  fileNameHash,
CLHEP::HepRandomEngine *  ,
EventID const *  id,
bool  recycleFiles 
)
privatepure virtual

Implemented in edm::EmbeddedRootSource.

Referenced by loopOverEvents().

virtual void edm::VectorInputSource::readOneSpecified ( EventPrincipal cache,
size_t &  fileNameHash,
SecondaryEventIDAndFileInfo const &  event 
)
privatepure virtual

Implemented in edm::EmbeddedRootSource.

Referenced by loopSpecified(), and readOneSpecified().

void edm::VectorInputSource::readOneSpecified ( EventPrincipal cache,
size_t &  fileNameHash,
EventID const &  event 
)
inlineprivate

Definition at line 68 of file VectorInputSource.h.

References info(), and readOneSpecified().

68  {
69  SecondaryEventIDAndFileInfo info(event, fileNameHash);
70  readOneSpecified(cache, fileNameHash, info);
71  }
static const TGPicture * info(bool iBackgroundIsBlack)
def cache
Definition: utilities.py:3
virtual void readOneSpecified(EventPrincipal &cache, size_t &fileNameHash, SecondaryEventIDAndFileInfo const &event)=0
void edm::VectorInputSource::throwIfOverLimit ( unsigned int  consecutiveRejections) const
private

Definition at line 29 of file VectorInputSource.cc.

References consecutiveRejectionsLimit_, and Exception.

Referenced by loopOverEvents().

29  {
30  if (consecutiveRejections >= consecutiveRejectionsLimit_) {
31  throw cms::Exception("LogicError")
32  << "VectorInputSource::loopOverEvents() read " << consecutiveRejections
33  << " consecutive pileup events that were rejected by the eventOperator. "
34  << "This is likely a sign of misconfiguration (of e.g. the adjusted-to pileup probability profile). "
35  << "If you know what you're doing, this exception can be turned off by setting consecutiveRejectionsLimit=0.";
36  }
37  }
unsigned int consecutiveRejectionsLimit_

Member Data Documentation

unsigned int edm::VectorInputSource::consecutiveRejectionsLimit_
private

Definition at line 81 of file VectorInputSource.h.

Referenced by loopOverEvents(), and throwIfOverLimit().

edm::propagate_const<std::unique_ptr<ProcessHistoryRegistry> > edm::VectorInputSource::processHistoryRegistry_
private

Definition at line 80 of file VectorInputSource.h.

Referenced by processHistoryRegistry(), and processHistoryRegistryForUpdate().

edm::propagate_const<std::shared_ptr<ProductRegistry> > edm::VectorInputSource::productRegistry_
private

Definition at line 79 of file VectorInputSource.h.

Referenced by productRegistry(), and productRegistryUpdate().