CMS 3D CMS Logo

EDProducer.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_EDProducer_h
2 #define FWCore_Framework_EDProducer_h
3 
4 /*----------------------------------------------------------------------
5 
6 EDProducer: The base class of "modules" whose main purpose is to insert new
7 EDProducts into an Event.
8 
9 
10 ----------------------------------------------------------------------*/
11 
20 
21 #include <string>
22 #include <vector>
23 
24 namespace edm {
25 
26  class ModuleCallingContext;
27  class PreallocationConfiguration;
28  class ActivityRegistry;
29  class ThinnedAssociationsHelper;
30 
31  namespace maker {
32  template <typename T>
33  class ModuleHolderT;
34  }
35 
42  class EDProducer : public ProducerBase, public EDConsumerBase {
43  public:
44  template <typename T>
45  friend class maker::ModuleHolderT;
46  template <typename T>
47  friend class WorkerT;
49 
51  ~EDProducer() override;
52 
53  static void fillDescriptions(ConfigurationDescriptions& descriptions);
54  static void prevalidate(ConfigurationDescriptions& descriptions);
55  static const std::string& baseType();
56 
57  // Warning: the returned moduleDescription will be invalid during construction
59 
60  static bool wantsProcessBlocks() { return false; }
61  static bool wantsInputProcessBlocks() { return false; }
62  static bool wantsGlobalRuns() { return true; }
63  static bool wantsGlobalLuminosityBlocks() { return true; }
64  static bool wantsStreamRuns() { return false; }
65  static bool wantsStreamLuminosityBlocks() { return false; };
66 
69 
70  private:
72  //Needed by WorkerT but not supported
74 
76  void doBeginJob();
77  void doEndJob();
82  void doEndRun(RunTransitionInfo const&, ModuleCallingContext const*);
85  void doRespondToOpenInputFile(FileBlock const& fb);
86  void doRespondToCloseInputFile(FileBlock const& fb);
91  }
92 
93  std::string workerType() const { return "WorkerT<EDProducer>"; }
94 
96 
97  virtual void produce(Event&, EventSetup const&) = 0;
98  virtual void beginJob() {}
99  virtual void endJob() {}
100 
101  virtual void beginRun(Run const& /* iR */, EventSetup const& /* iE */) {}
102  virtual void endRun(Run const& /* iR */, EventSetup const& /* iE */) {}
103  virtual void beginLuminosityBlock(LuminosityBlock const& /* iL */, EventSetup const& /* iE */) {}
104  virtual void endLuminosityBlock(LuminosityBlock const& /* iL */, EventSetup const& /* iE */) {}
105  virtual void respondToOpenInputFile(FileBlock const&) {}
106  virtual void respondToCloseInputFile(FileBlock const&) {}
107 
108  bool hasAcquire() const { return false; }
109  bool hasAccumulator() const { return false; }
110 
113  std::vector<BranchID> previousParentage_;
118  };
119 } // namespace edm
120 
121 #endif
virtual void endJob()
Definition: EDProducer.h:99
virtual void beginRun(Run const &, EventSetup const &)
Definition: EDProducer.h:101
void doPreallocate(PreallocationConfiguration const &)
Definition: EDProducer.h:75
EDProducer ModuleType
Definition: EDProducer.h:48
SerialTaskQueue * globalLuminosityBlocksQueue()
Definition: EDProducer.h:68
static bool wantsStreamLuminosityBlocks()
Definition: EDProducer.h:65
void preActionBeforeRunEventAsync(WaitingTaskHolder, ModuleCallingContext const &, Principal const &) const
Definition: EDProducer.h:73
static const std::string & baseType()
Definition: EDProducer.cc:111
static bool wantsStreamRuns()
Definition: EDProducer.h:64
void registerProducts(ProducerBase *, ProductRegistry *, ModuleDescription const &)
Definition: ProducerBase.cc:57
virtual void respondToCloseInputFile(FileBlock const &)
Definition: EDProducer.h:106
~EDProducer() override
Definition: EDProducer.cc:25
void doEndRun(RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducer.cc:60
void doBeginLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducer.cc:71
virtual void beginJob()
Definition: EDProducer.h:98
ParentageID previousParentageId_
Definition: EDProducer.h:117
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
Definition: EDProducer.h:88
static bool wantsProcessBlocks()
Definition: EDProducer.h:60
SerialTaskQueue luminosityBlockQueue_
Definition: EDProducer.h:116
std::vector< BranchID > previousParentage_
Definition: EDProducer.h:113
void setModuleDescription(ModuleDescription const &md)
Definition: EDProducer.h:111
static bool wantsGlobalLuminosityBlocks()
Definition: EDProducer.h:63
SerialTaskQueue runQueue_
Definition: EDProducer.h:115
void doEndProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDProducer.h:80
void doRespondToCloseOutputFile()
Definition: EDProducer.h:87
bool doEvent(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
Definition: EDProducer.cc:27
void doBeginJob()
Definition: EDProducer.cc:41
bool hasAccumulator() const
Definition: EDProducer.h:109
bool hasAcquire() const
Definition: EDProducer.h:108
void registerProductsAndCallbacks(EDProducer *module, ProductRegistry *reg)
Definition: EDProducer.h:89
#define CMS_DEPRECATED
std::string workerType() const
Definition: EDProducer.h:93
virtual void endLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDProducer.h:104
static void prevalidate(ConfigurationDescriptions &descriptions)
Definition: EDProducer.cc:107
static bool wantsInputProcessBlocks()
Definition: EDProducer.h:61
ModuleDescription moduleDescription_
Definition: EDProducer.h:112
void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDProducer.h:79
void doBeginProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDProducer.h:78
static bool wantsGlobalRuns()
Definition: EDProducer.h:62
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: EDProducer.cc:101
virtual void endRun(Run const &, EventSetup const &)
Definition: EDProducer.h:102
virtual void beginLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDProducer.h:103
SerialTaskQueue * globalRunsQueue()
Definition: EDProducer.h:67
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: EDProducer.cc:97
void doEndLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducer.cc:84
HLT enums.
void doBeginRun(RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDProducer.cc:49
SharedResourcesAcquirer resourceAcquirer_
Definition: EDProducer.h:114
ModuleDescription const & moduleDescription() const
Definition: EDProducer.h:58
SharedResourcesAcquirer & sharedResourcesAcquirer()
Definition: EDProducer.h:95
virtual void respondToOpenInputFile(FileBlock const &)
Definition: EDProducer.h:105
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: EDProducer.cc:99
Definition: Run.h:45
virtual void produce(Event &, EventSetup const &)=0