CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
37  public:
38  template <typename T>
39  friend class maker::ModuleHolderT;
40  template <typename T>
41  friend class WorkerT;
43 
44  EDProducer();
45  ~EDProducer() override;
46 
47  static void fillDescriptions(ConfigurationDescriptions& descriptions);
48  static void prevalidate(ConfigurationDescriptions& descriptions);
49  static const std::string& baseType();
50 
51  // Warning: the returned moduleDescription will be invalid during construction
52  ModuleDescription const& moduleDescription() const { return moduleDescription_; }
53 
54  static bool wantsProcessBlocks() { return false; }
55  static bool wantsInputProcessBlocks() { return false; }
56  static bool wantsGlobalRuns() { return true; }
57  static bool wantsGlobalLuminosityBlocks() { return true; }
58  static bool wantsStreamRuns() { return false; }
59  static bool wantsStreamLuminosityBlocks() { return false; };
60 
61  SerialTaskQueue* globalRunsQueue() { return &runQueue_; }
62  SerialTaskQueue* globalLuminosityBlocksQueue() { return &luminosityBlockQueue_; }
63 
64  private:
65  bool doEvent(EventTransitionInfo const&, ActivityRegistry*, ModuleCallingContext const*);
66  //Needed by WorkerT but not supported
68 
70  void doBeginJob();
71  void doEndJob();
75  void doBeginRun(RunTransitionInfo const&, ModuleCallingContext const*);
76  void doEndRun(RunTransitionInfo const&, ModuleCallingContext const*);
77  void doBeginLuminosityBlock(LumiTransitionInfo const&, ModuleCallingContext const*);
78  void doEndLuminosityBlock(LumiTransitionInfo const&, ModuleCallingContext const*);
79  void doRespondToOpenInputFile(FileBlock const& fb);
80  void doRespondToCloseInputFile(FileBlock const& fb);
84  registerProducts(module, reg, moduleDescription_);
85  }
86 
87  std::string workerType() const { return "WorkerT<EDProducer>"; }
88 
89  SharedResourcesAcquirer& sharedResourcesAcquirer() { return resourceAcquirer_; }
90 
91  virtual void produce(Event&, EventSetup const&) = 0;
92  virtual void beginJob() {}
93  virtual void endJob() {}
94 
95  virtual void beginRun(Run const& /* iR */, EventSetup const& /* iE */) {}
96  virtual void endRun(Run const& /* iR */, EventSetup const& /* iE */) {}
97  virtual void beginLuminosityBlock(LuminosityBlock const& /* iL */, EventSetup const& /* iE */) {}
98  virtual void endLuminosityBlock(LuminosityBlock const& /* iL */, EventSetup const& /* iE */) {}
99  virtual void respondToOpenInputFile(FileBlock const&) {}
100  virtual void respondToCloseInputFile(FileBlock const&) {}
101 
102  bool hasAcquire() const { return false; }
103  bool hasAccumulator() const { return false; }
104 
105  void setModuleDescription(ModuleDescription const& md) { moduleDescription_ = md; }
107  std::vector<BranchID> previousParentage_;
112  };
113 } // namespace edm
114 
115 #endif
virtual void endJob()
Definition: EDProducer.h:93
virtual void beginRun(Run const &, EventSetup const &)
Definition: EDProducer.h:95
void doPreallocate(PreallocationConfiguration const &)
Definition: EDProducer.h:69
EDProducer ModuleType
Definition: EDProducer.h:42
SerialTaskQueue * globalLuminosityBlocksQueue()
Definition: EDProducer.h:62
static bool wantsStreamLuminosityBlocks()
Definition: EDProducer.h:59
static bool wantsStreamRuns()
Definition: EDProducer.h:58
virtual void respondToCloseInputFile(FileBlock const &)
Definition: EDProducer.h:100
virtual void beginJob()
Definition: EDProducer.h:92
ParentageID previousParentageId_
Definition: EDProducer.h:111
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
Definition: EDProducer.h:82
static bool wantsProcessBlocks()
Definition: EDProducer.h:54
SerialTaskQueue luminosityBlockQueue_
Definition: EDProducer.h:110
ModuleDescription const & moduleDescription() const
Definition: EDProducer.h:52
std::vector< BranchID > previousParentage_
Definition: EDProducer.h:107
void setModuleDescription(ModuleDescription const &md)
Definition: EDProducer.h:105
static bool wantsGlobalLuminosityBlocks()
Definition: EDProducer.h:57
SerialTaskQueue runQueue_
Definition: EDProducer.h:109
void doEndProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDProducer.h:74
void doRespondToCloseOutputFile()
Definition: EDProducer.h:81
void registerProductsAndCallbacks(EDProducer *module, ProductRegistry *reg)
Definition: EDProducer.h:83
#define CMS_DEPRECATED
virtual void endLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDProducer.h:98
static bool wantsInputProcessBlocks()
Definition: EDProducer.h:55
bool hasAcquire() const
Definition: EDProducer.h:102
ModuleDescription moduleDescription_
Definition: EDProducer.h:106
std::string workerType() const
Definition: EDProducer.h:87
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDProducer.h:73
void doBeginProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDProducer.h:72
static bool wantsGlobalRuns()
Definition: EDProducer.h:56
bool hasAccumulator() const
Definition: EDProducer.h:103
virtual void endRun(Run const &, EventSetup const &)
Definition: EDProducer.h:96
virtual void beginLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDProducer.h:97
SerialTaskQueue * globalRunsQueue()
Definition: EDProducer.h:61
void preActionBeforeRunEventAsync(WaitingTaskHolder, ModuleCallingContext const &, Principal const &) const
Definition: EDProducer.h:67
SharedResourcesAcquirer resourceAcquirer_
Definition: EDProducer.h:108
SharedResourcesAcquirer & sharedResourcesAcquirer()
Definition: EDProducer.h:89
virtual void respondToOpenInputFile(FileBlock const &)
Definition: EDProducer.h:99
Definition: Run.h:45
tuple module
Definition: callgraph.py:69