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 > & productRegistry ()
 
std::shared_ptr< ProductRegistry const > productRegistry () const
 
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
 
void readOneSpecified (EventPrincipal &cache, size_t &fileNameHash, EventID const &event)
 
virtual void readOneSpecified (EventPrincipal &cache, size_t &fileNameHash, SecondaryEventIDAndFileInfo const &event)=0
 
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)) {}

◆ ~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.

23 { cache.clearEventPrincipal(); }

References utilities::cache().

Referenced by loopOverEvents(), and loopSpecified().

◆ doBeginJob()

void edm::VectorInputSource::doBeginJob ( )

Called at beginning of job.

Definition at line 25 of file VectorInputSource.cc.

25 { this->beginJob(); }

References beginJob().

◆ doEndJob()

void edm::VectorInputSource::doEndJob ( )

Called at end of job.

Definition at line 27 of file VectorInputSource.cc.

27 { this->endJob(); }

References endJob().

◆ dropUnwantedBranches()

void edm::VectorInputSource::dropUnwantedBranches ( std::vector< std::string > const &  wantedBranches)

Definition at line 19 of file VectorInputSource.cc.

19  {
20  this->dropUnwantedBranches_(wantedBranches);
21  }

References dropUnwantedBranches_().

◆ 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.

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  }

References utilities::cache(), clearEventPrincipal(), consecutiveRejectionsLimit_, newFWLiteAna::found, mps_fire::i, contentValuesFiles::number, readOneEvent(), throwIfOverLimit(), and mitigatedMETSequence_cff::U.

◆ 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.

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  }

References utilities::cache(), clearEventPrincipal(), mps_fire::end, mps_fire::i, readOneSpecified(), and mitigatedMETSequence_cff::U.

◆ processHistoryRegistry()

ProcessHistoryRegistry const& edm::VectorInputSource::processHistoryRegistry ( ) const
inline

Definition at line 56 of file VectorInputSource.h.

56 { return *processHistoryRegistry_; }

References processHistoryRegistry_.

◆ processHistoryRegistryForUpdate()

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

Definition at line 57 of file VectorInputSource.h.

57 { return *processHistoryRegistry_; }

References processHistoryRegistry_.

◆ productRegistry() [1/2]

std::shared_ptr<ProductRegistry>& edm::VectorInputSource::productRegistry ( )
inline

Definition at line 54 of file VectorInputSource.h.

References edm::get_underlying_safe(), and productRegistry_.

◆ productRegistry() [2/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_.

◆ productRegistryUpdate()

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

Definition at line 55 of file VectorInputSource.h.

55 { return *productRegistry_; }

References 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]

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

Definition at line 68 of file VectorInputSource.h.

68  {
69  SecondaryEventIDAndFileInfo info(event, fileNameHash);
70  readOneSpecified(cache, fileNameHash, info);
71  }

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

◆ readOneSpecified() [2/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().

◆ throwIfOverLimit()

void edm::VectorInputSource::throwIfOverLimit ( unsigned int  consecutiveRejections) const
private

Definition at line 29 of file VectorInputSource.cc.

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  }

References consecutiveRejectionsLimit_, and Exception.

Referenced by loopOverEvents().

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

edm::VectorInputSource::dropUnwantedBranches_
virtual void dropUnwantedBranches_(std::vector< std::string > const &wantedBranches)=0
mps_fire.i
i
Definition: mps_fire.py:428
edm::VectorInputSource::consecutiveRejectionsLimit_
unsigned int consecutiveRejectionsLimit_
Definition: VectorInputSource.h:81
edm::VectorInputSource::processHistoryRegistry_
edm::propagate_const< std::unique_ptr< ProcessHistoryRegistry > > processHistoryRegistry_
Definition: VectorInputSource.h:80
edm::VectorInputSource::readOneEvent
virtual bool readOneEvent(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id, bool recycleFiles)=0
edm::VectorInputSource::readOneSpecified
virtual void readOneSpecified(EventPrincipal &cache, size_t &fileNameHash, SecondaryEventIDAndFileInfo const &event)=0
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
edm::get_underlying_safe
constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
Definition: get_underlying_safe.h:41
edm::VectorInputSource::clearEventPrincipal
void clearEventPrincipal(EventPrincipal &cache)
Definition: VectorInputSource.cc:23
Iterator
Definition: DQMStoreStats.h:94
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
contentValuesFiles.number
number
Definition: contentValuesFiles.py:53
edm::VectorInputSource::throwIfOverLimit
void throwIfOverLimit(unsigned int consecutiveRejections) const
Definition: VectorInputSource.cc:29
mps_fire.end
end
Definition: mps_fire.py:242
edm::VectorInputSource::productRegistry_
edm::propagate_const< std::shared_ptr< ProductRegistry > > productRegistry_
Definition: VectorInputSource.h:79
utilities.cache
def cache(function)
Definition: utilities.py:3
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
Exception
Definition: hltDiff.cc:245
edm::VectorInputSource::endJob
virtual void endJob()=0
edm::VectorInputSource::beginJob
virtual void beginJob()=0
event
Definition: event.py:1
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27