test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VectorInputSource.h
Go to the documentation of this file.
1 #ifndef FWCore_Sources_VectorInputSource_h
2 #define FWCore_Sources_VectorInputSource_h
3 
4 /*----------------------------------------------------------------------
5 VectorInputSource: Abstract interface for vector input sources.
6 ----------------------------------------------------------------------*/
7 
13 
14 #include <memory>
15 #include <string>
16 #include <vector>
17 
18 namespace CLHEP {
19  class HepRandomEngine;
20 }
21 
22 namespace edm {
23  class EventPrincipal;
24  struct VectorInputSourceDescription;
25  class EventID;
26  class ParameterSet;
28  public:
30  virtual ~VectorInputSource();
31 
32  template<typename T>
33  size_t loopOverEvents(EventPrincipal& cache, size_t& fileNameHash, size_t number, T eventOperator, CLHEP::HepRandomEngine* = nullptr, EventID const* id = nullptr);
34 
35  template<typename T, typename Iterator>
36  size_t loopSpecified(EventPrincipal& cache, size_t& fileNameHash, Iterator const& begin, Iterator const& end, T eventOperator);
37 
38  void dropUnwantedBranches(std::vector<std::string> const& wantedBranches);
39  //
41  void doBeginJob();
42 
44  void doEndJob();
45 
46  std::shared_ptr<ProductRegistry const> productRegistry() const {return get_underlying_safe(productRegistry_);}
47  std::shared_ptr<ProductRegistry>& productRegistry() {return get_underlying_safe(productRegistry_);}
51 
52  private:
53 
55 
56  private:
57  virtual bool readOneEvent(EventPrincipal& cache, size_t& fileNameHash, CLHEP::HepRandomEngine*, EventID const* id) = 0;
58  virtual void readOneSpecified(EventPrincipal& cache, size_t& fileNameHash, SecondaryEventIDAndFileInfo const& event) = 0;
59  void readOneSpecified(EventPrincipal& cache, size_t& fileNameHash, EventID const& event) {
60  SecondaryEventIDAndFileInfo info(event, fileNameHash);
61  readOneSpecified(cache, fileNameHash, info);
62  }
63 
64  virtual void dropUnwantedBranches_(std::vector<std::string> const& wantedBranches) = 0;
65  virtual void beginJob() = 0;
66  virtual void endJob() = 0;
67 
70  };
71 
72  template<typename T>
73  size_t VectorInputSource::loopOverEvents(EventPrincipal& cache, size_t& fileNameHash, size_t number, T eventOperator, CLHEP::HepRandomEngine* engine, EventID const* id) {
74  size_t i = 0U;
75  for(; i < number; ++i) {
76  clearEventPrincipal(cache);
77  bool found = readOneEvent(cache, fileNameHash, engine, id);
78  if(!found) break;
79  eventOperator(cache, fileNameHash);
80  }
81  return i;
82  }
83 
84  template<typename T, typename Iterator>
85  size_t VectorInputSource::loopSpecified(EventPrincipal& cache, size_t& fileNameHash, Iterator const& begin, Iterator const& end, T eventOperator) {
86  size_t i = 0U;
87  for(Iterator iter = begin; iter != end; ++iter) {
88  clearEventPrincipal(cache);
89  readOneSpecified(cache, fileNameHash, *iter);
90  eventOperator(cache, fileNameHash);
91  ++i;
92  }
93  return i;
94  }
95 }
96 #endif
ProductRegistry & productRegistryUpdate()
int i
Definition: DBlmapReader.cc:9
static const TGPicture * info(bool iBackgroundIsBlack)
ProcessHistoryRegistry & processHistoryRegistryForUpdate()
ProcessHistoryRegistry const & processHistoryRegistry() const
void dropUnwantedBranches(std::vector< std::string > const &wantedBranches)
void clearEventPrincipal(EventPrincipal &cache)
VectorInputSource(ParameterSet const &pset, VectorInputSourceDescription const &desc)
void doEndJob()
Called at end of job.
edm::propagate_const< std::unique_ptr< ProcessHistoryRegistry > > processHistoryRegistry_
size_t loopOverEvents(EventPrincipal &cache, size_t &fileNameHash, size_t number, T eventOperator, CLHEP::HepRandomEngine *=nullptr, EventID const *id=nullptr)
std::shared_ptr< ProductRegistry const > productRegistry() const
void readOneSpecified(EventPrincipal &cache, size_t &fileNameHash, EventID const &event)
#define end
Definition: vmac.h:37
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::shared_ptr< ProductRegistry > & productRegistry()
virtual bool readOneEvent(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *, EventID const *id)=0
size_t loopSpecified(EventPrincipal &cache, size_t &fileNameHash, Iterator const &begin, Iterator const &end, T eventOperator)
void doBeginJob()
Called at beginning of job.
#define begin
Definition: vmac.h:30
virtual void dropUnwantedBranches_(std::vector< std::string > const &wantedBranches)=0
edm::propagate_const< std::shared_ptr< ProductRegistry > > productRegistry_
long double T
virtual void beginJob()=0
virtual void endJob()=0
virtual void readOneSpecified(EventPrincipal &cache, size_t &fileNameHash, SecondaryEventIDAndFileInfo const &event)=0