CMS 3D CMS Logo

ShallowTree.h
Go to the documentation of this file.
1 #ifndef Shallow_Tree_h
2 #define Shallow_Tree_h
3 
28 
29 #include <string>
30 #include <vector>
31 #include <TTree.h>
32 
33 class ShallowTree : public edm::EDAnalyzer {
34 private:
35  void beginJob() override;
36  void analyze(const edm::Event&, const edm::EventSetup&) override;
37  void endJob() override{}
38 
39  template <class T>
40  void eat(edm::BranchDescription const* desc) {
41  consumes<T>(edm::InputTag(desc->moduleLabel(), desc->productInstanceName()));
42  }
43 
45  public:
46  virtual ~BranchConnector() {};
47  virtual void connect(const edm::Event&) = 0;
48  };
49 
50  template <class T>
52  private:
53  std::string ml; //module label
54  std::string pin; //product instance name
57  public:
59  void connect(const edm::Event&) override;
60  };
61 
63  TTree * tree_;
64  std::vector<BranchConnector*> connectors_;
65 
66 public:
67  explicit ShallowTree(const edm::ParameterSet& iConfig);// : pset(iConfig) {}
68 
69  enum LEAFTYPE {BOOL=1, BOOL_V,
75 };
76 
77 #endif
virtual void connect(const edm::Event &)=0
void eat(edm::BranchDescription const *desc)
Definition: ShallowTree.h:40
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: ShallowTree.cc:102
std::string const & moduleLabel() const
std::string const & productInstanceName() const
edm::Service< TFileService > fs_
Definition: ShallowTree.h:62
ShallowTree(const edm::ParameterSet &iConfig)
Definition: ShallowTree.cc:10
void beginJob() override
Definition: ShallowTree.cc:132
TTree * tree_
Definition: ShallowTree.h:63
long double T
void endJob() override
Definition: ShallowTree.h:37
std::vector< BranchConnector * > connectors_
Definition: ShallowTree.h:64