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 
58  public:
60  void connect(const edm::Event&) override;
61  };
62 
64  TTree* tree_;
65  std::vector<BranchConnector*> connectors_;
66 
67 public:
68  explicit ShallowTree(const edm::ParameterSet& iConfig); // : pset(iConfig) {}
69 
70  enum LEAFTYPE {
71  BOOL = 1,
77  INT,
93  };
94 };
95 
96 #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:169
std::string const & moduleLabel() const
std::string const & productInstanceName() const
edm::Service< TFileService > fs_
Definition: ShallowTree.h:63
ShallowTree(const edm::ParameterSet &iConfig)
Definition: ShallowTree.cc:10
void beginJob() override
Definition: ShallowTree.cc:198
TTree * tree_
Definition: ShallowTree.h:64
long double T
void endJob() override
Definition: ShallowTree.h:37
std::vector< BranchConnector * > connectors_
Definition: ShallowTree.h:65