CMS 3D CMS Logo

EDAnalyzer.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_EDAnalyzer_h
2 #define FWCore_Framework_EDAnalyzer_h
3 
12 
13 #include <string>
14 
15 // EDAnalyzer is the base class for all analyzer "modules".
16 
17 namespace edm {
18 
19  class ModuleCallingContext;
20  class PreallocationConfiguration;
21  class ActivityRegistry;
22  class ThinnedAssociationsHelper;
23 
24  namespace maker {
25  template <typename T>
27  }
28 
35  class EDAnalyzer : public EDConsumerBase {
36  public:
37  template <typename T>
38  friend class maker::ModuleHolderT;
39  template <typename T>
40  friend class WorkerT;
42 
44  ~EDAnalyzer() override;
45 
46  std::string workerType() const { return "WorkerT<EDAnalyzer>"; }
47 
48  static void fillDescriptions(ConfigurationDescriptions& descriptions);
49  static const std::string& baseType();
51 
52  // Warning: the returned moduleDescription will be invalid during construction
54 
55  static bool wantsProcessBlocks() { return false; }
56  static bool wantsInputProcessBlocks() { return false; }
57  static bool wantsGlobalRuns() { return true; }
58  static bool wantsGlobalLuminosityBlocks() { return true; }
59  static bool wantsStreamRuns() { return false; }
60  static bool wantsStreamLuminosityBlocks() { return false; };
61 
63 
66 
67  private:
69  //Needed by Worker but not something supported
71 
73  void doBeginJob();
74  void doEndJob();
79  bool doEndRun(RunTransitionInfo const&, ModuleCallingContext const*);
82  void doRespondToOpenInputFile(FileBlock const& fb);
83  void doRespondToCloseInputFile(FileBlock const& fb);
86 
88 
90 
91  virtual void analyze(Event const&, EventSetup const&) = 0;
92  virtual void beginJob() {}
93  virtual void endJob() {}
94  virtual void beginRun(Run const&, EventSetup const&) {}
95  virtual void endRun(Run const&, EventSetup const&) {}
96  virtual void beginLuminosityBlock(LuminosityBlock const&, EventSetup const&) {}
97  virtual void endLuminosityBlock(LuminosityBlock const&, EventSetup const&) {}
98  virtual void respondToOpenInputFile(FileBlock const&) {}
99  virtual void respondToCloseInputFile(FileBlock const&) {}
100 
101  bool hasAcquire() const { return false; }
102  bool hasAccumulator() const { return false; }
103 
107 
110 
111  std::function<void(BranchDescription const&)> callWhenNewProductsRegistered_;
112  };
113 } // namespace edm
114 
115 #endif
virtual void beginJob()
Definition: EDAnalyzer.h:92
virtual void endLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDAnalyzer.h:97
void doRespondToCloseOutputFile()
Definition: EDAnalyzer.h:84
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: EDAnalyzer.cc:97
virtual void respondToCloseInputFile(FileBlock const &)
Definition: EDAnalyzer.h:99
static bool wantsProcessBlocks()
Definition: EDAnalyzer.h:55
virtual void analyze(Event const &, EventSetup const &)=0
bool doEvent(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
Definition: EDAnalyzer.cc:32
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition: EDAnalyzer.cc:105
virtual void beginRun(Run const &, EventSetup const &)
Definition: EDAnalyzer.h:94
void doEndProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDAnalyzer.h:77
std::string workerType() const
Definition: EDAnalyzer.h:46
SharedResourcesAcquirer resourceAcquirer_
Definition: EDAnalyzer.h:106
virtual void beginLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDAnalyzer.h:96
~EDAnalyzer() override
Definition: EDAnalyzer.cc:27
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: EDAnalyzer.cc:99
static const std::string & baseType()
Definition: EDAnalyzer.cc:123
SerialTaskQueue runQueue_
Definition: EDAnalyzer.h:108
static void prevalidate(ConfigurationDescriptions &)
Definition: EDAnalyzer.cc:111
void doBeginJob()
Definition: EDAnalyzer.cc:44
std::function< void(BranchDescription const &)> callWhenNewProductsRegistered_
Definition: EDAnalyzer.h:111
bool hasAccumulator() const
Definition: EDAnalyzer.h:102
#define CMS_DEPRECATED
bool doEndLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDAnalyzer.cc:85
virtual void endJob()
Definition: EDAnalyzer.h:93
void doPreallocate(PreallocationConfiguration const &)
Definition: EDAnalyzer.h:72
bool hasAcquire() const
Definition: EDAnalyzer.h:101
ModuleDescription moduleDescription_
Definition: EDAnalyzer.h:105
void doAccessInputProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDAnalyzer.h:76
EDAnalyzer ModuleType
Definition: EDAnalyzer.h:41
ModuleDescription const & moduleDescription() const
Definition: EDAnalyzer.h:53
bool doBeginRun(RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDAnalyzer.cc:53
bool doEndRun(RunTransitionInfo const &, ModuleCallingContext const *)
Definition: EDAnalyzer.cc:63
SerialTaskQueue * globalLuminosityBlocksQueue()
Definition: EDAnalyzer.h:65
SerialTaskQueue * globalRunsQueue()
Definition: EDAnalyzer.h:64
static bool wantsStreamLuminosityBlocks()
Definition: EDAnalyzer.h:60
virtual void respondToOpenInputFile(FileBlock const &)
Definition: EDAnalyzer.h:98
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
Definition: EDAnalyzer.h:85
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
Definition: EDAnalyzer.cc:101
static bool wantsGlobalLuminosityBlocks()
Definition: EDAnalyzer.h:58
virtual void endRun(Run const &, EventSetup const &)
Definition: EDAnalyzer.h:95
void doBeginProcessBlock(ProcessBlockPrincipal const &, ModuleCallingContext const *)
Definition: EDAnalyzer.h:75
HLT enums.
void preActionBeforeRunEventAsync(WaitingTaskHolder, ModuleCallingContext const &, Principal const &) const
Definition: EDAnalyzer.h:70
SerialTaskQueue luminosityBlockQueue_
Definition: EDAnalyzer.h:109
static bool wantsInputProcessBlocks()
Definition: EDAnalyzer.h:56
static bool wantsGlobalRuns()
Definition: EDAnalyzer.h:57
static bool wantsStreamRuns()
Definition: EDAnalyzer.h:59
void registerProductsAndCallbacks(EDAnalyzer const *, ProductRegistry *reg)
Definition: EDAnalyzer.cc:113
SharedResourcesAcquirer & sharedResourcesAcquirer()
Definition: EDAnalyzer.h:89
bool doBeginLuminosityBlock(LumiTransitionInfo const &, ModuleCallingContext const *)
Definition: EDAnalyzer.cc:73
Definition: Run.h:45
void setModuleDescription(ModuleDescription const &md)
Definition: EDAnalyzer.h:104