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 
9 
10 #include <string>
11 
12 // EDAnalyzer is the base class for all analyzer "modules".
13 
14 namespace edm {
15 
16  class ModuleCallingContext;
17  class PreallocationConfiguration;
18  class ActivityRegistry;
19  class ProductRegistry;
20  class ThinnedAssociationsHelper;
21  class WaitingTask;
22 
23  namespace maker {
24  template<typename T> class ModuleHolderT;
25  }
26 
27  class EDAnalyzer : public EDConsumerBase {
28  public:
29  template <typename T> friend class maker::ModuleHolderT;
30  template <typename T> friend class WorkerT;
32 
33  EDAnalyzer();
34  ~EDAnalyzer() override;
35 
36  std::string workerType() const {return "WorkerT<EDAnalyzer>";}
37 
38  static void fillDescriptions(ConfigurationDescriptions& descriptions);
39  static const std::string& baseType();
40  static void prevalidate(ConfigurationDescriptions& );
41 
42  // Warning: the returned moduleDescription will be invalid during construction
43  ModuleDescription const& moduleDescription() const { return moduleDescription_; }
44 
45  void callWhenNewProductsRegistered(std::function<void(BranchDescription const&)> const& func);
46 
47  private:
48  bool doEvent(EventPrincipal const& ep, EventSetup const& c,
49  ActivityRegistry* act,
50  ModuleCallingContext const* mcc);
51  //Needed by Worker but not something supported
52  void preActionBeforeRunEventAsync(WaitingTask* iTask, ModuleCallingContext const& iModuleCallingContext, Principal const& iPrincipal) const {}
53 
55  void doBeginJob();
56  void doEndJob();
57  bool doBeginRun(RunPrincipal const& rp, EventSetup const& c,
58  ModuleCallingContext const* mcc);
59  bool doEndRun(RunPrincipal const& rp, EventSetup const& c,
60  ModuleCallingContext const* mcc);
61  bool doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
62  ModuleCallingContext const* mcc);
63  bool doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
64  ModuleCallingContext const* mcc);
65  void doRespondToOpenInputFile(FileBlock const& fb);
66  void doRespondToCloseInputFile(FileBlock const& fb);
69 
70  void registerProductsAndCallbacks(EDAnalyzer const*, ProductRegistry* reg);
71 
73  return resourceAcquirer_;
74  }
75 
76  virtual void analyze(Event const&, EventSetup const&) = 0;
77  virtual void beginJob(){}
78  virtual void endJob(){}
79  virtual void beginRun(Run const&, EventSetup const&){}
80  virtual void endRun(Run const&, EventSetup const&){}
81  virtual void beginLuminosityBlock(LuminosityBlock const&, EventSetup const&){}
82  virtual void endLuminosityBlock(LuminosityBlock const&, EventSetup const&){}
83  virtual void respondToOpenInputFile(FileBlock const&) {}
84  virtual void respondToCloseInputFile(FileBlock const&) {}
85 
87  moduleDescription_ = md;
88  }
91 
92  std::function<void(BranchDescription const&)> callWhenNewProductsRegistered_;
93  };
94 }
95 
96 #endif
virtual void beginJob()
Definition: EDAnalyzer.h:77
virtual void endLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDAnalyzer.h:82
std::string workerType() const
Definition: EDAnalyzer.h:36
def analyze(function, filename, filter=None)
Definition: Profiling.py:11
virtual void respondToCloseInputFile(FileBlock const &)
Definition: EDAnalyzer.h:84
virtual void beginRun(Run const &, EventSetup const &)
Definition: EDAnalyzer.h:79
SharedResourcesAcquirer resourceAcquirer_
Definition: EDAnalyzer.h:90
virtual void beginLuminosityBlock(LuminosityBlock const &, EventSetup const &)
Definition: EDAnalyzer.h:81
ModuleDescription const & moduleDescription() const
Definition: EDAnalyzer.h:43
std::function< void(BranchDescription const &)> callWhenNewProductsRegistered_
Definition: EDAnalyzer.h:92
virtual void endJob()
Definition: EDAnalyzer.h:78
void doPreallocate(PreallocationConfiguration const &)
Definition: EDAnalyzer.h:54
ModuleDescription moduleDescription_
Definition: EDAnalyzer.h:89
EDAnalyzer ModuleType
Definition: EDAnalyzer.h:31
virtual void respondToOpenInputFile(FileBlock const &)
Definition: EDAnalyzer.h:83
void preActionBeforeRunEventAsync(WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const
Definition: EDAnalyzer.h:52
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
Definition: EDAnalyzer.h:67
virtual void endRun(Run const &, EventSetup const &)
Definition: EDAnalyzer.h:80
HLT enums.
SharedResourcesAcquirer & sharedResourcesAcquirer()
Definition: EDAnalyzer.h:72
Definition: Run.h:43
void setModuleDescription(ModuleDescription const &md)
Definition: EDAnalyzer.h:86