CMS 3D CMS Logo

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

◆ VectorInputSource()

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_

◆ ~VectorInputSource()

edm::VectorInputSource::~VectorInputSource ( )
virtual

Definition at line 17 of file VectorInputSource.cc.

17 {}

Member Function Documentation

◆ beginJob()

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

Implemented in edm::EmbeddedRootSource.

Referenced by doBeginJob().

◆ clearEventPrincipal()

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

Definition at line 23 of file VectorInputSource.cc.

References utilities::cache().

Referenced by loopOverEvents(), and loopSpecified().

23 { cache.clearEventPrincipal(); }
def cache(function)
Definition: utilities.py:3

◆ doBeginJob()

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

◆ doEndJob()

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

◆ dropUnwantedBranches()

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

◆ dropUnwantedBranches_()

virtual void edm::VectorInputSource::dropUnwantedBranches_ ( std::vector< std::string > const &  wantedBranches)
privatepure virtual

Implemented in edm::EmbeddedRootSource.

Referenced by dropUnwantedBranches().

◆ endJob()

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

Implemented in edm::EmbeddedRootSource.

Referenced by doEndJob().

◆ loopOverEvents()

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 utilities::cache(), clearEventPrincipal(), consecutiveRejectionsLimit_, newFWLiteAna::found, mps_fire::i, contentValuesFiles::number, readOneEvent(), throwIfOverLimit(), and mitigatedMETSequence_cff::U.

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)
void throwIfOverLimit(unsigned int consecutiveRejections) const
virtual bool readOneEvent(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id, bool recycleFiles)=0
unsigned int consecutiveRejectionsLimit_
def cache(function)
Definition: utilities.py:3

◆ loopSpecified()

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 utilities::cache(), clearEventPrincipal(), mps_fire::i, readOneSpecified(), and mitigatedMETSequence_cff::U.

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)
def cache(function)
Definition: utilities.py:3
virtual void readOneSpecified(EventPrincipal &cache, size_t &fileNameHash, SecondaryEventIDAndFileInfo const &event)=0

◆ processHistoryRegistry()

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_

◆ processHistoryRegistryForUpdate()

ProcessHistoryRegistry& edm::VectorInputSource::processHistoryRegistryForUpdate ( )
inline

Definition at line 57 of file VectorInputSource.h.

References processHistoryRegistry_.

57 { return *processHistoryRegistry_; }
edm::propagate_const< std::unique_ptr< ProcessHistoryRegistry > > processHistoryRegistry_

◆ productRegistry() [1/2]

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_

◆ productRegistry() [2/2]

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_

◆ productRegistryUpdate()

ProductRegistry& edm::VectorInputSource::productRegistryUpdate ( )
inline

Definition at line 55 of file VectorInputSource.h.

References productRegistry_.

55 { return *productRegistry_; }
edm::propagate_const< std::shared_ptr< ProductRegistry > > productRegistry_

◆ readOneEvent()

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

◆ readOneSpecified() [1/2]

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

Implemented in edm::EmbeddedRootSource.

Referenced by loopSpecified(), and readOneSpecified().

◆ readOneSpecified() [2/2]

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

Definition at line 68 of file VectorInputSource.h.

References utilities::cache(), info(), and readOneSpecified().

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

◆ throwIfOverLimit()

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

◆ consecutiveRejectionsLimit_

unsigned int edm::VectorInputSource::consecutiveRejectionsLimit_
private

Definition at line 81 of file VectorInputSource.h.

Referenced by loopOverEvents(), and throwIfOverLimit().

◆ processHistoryRegistry_

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

Definition at line 80 of file VectorInputSource.h.

Referenced by processHistoryRegistry(), and processHistoryRegistryForUpdate().

◆ productRegistry_

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

Definition at line 79 of file VectorInputSource.h.

Referenced by productRegistry(), and productRegistryUpdate().