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
ShallowTree::BranchConnector
Definition: ShallowTree.h:44
ShallowTree::connectors_
std::vector< BranchConnector * > connectors_
Definition: ShallowTree.h:65
ShallowTree::SHORT_V
Definition: ShallowTree.h:74
edm::BranchDescription::productInstanceName
std::string const & productInstanceName() const
Definition: BranchDescription.h:81
ShallowTree::endJob
void endJob() override
Definition: ShallowTree.h:37
ShallowTree::DOUBLE
Definition: ShallowTree.h:83
ShallowTree::TypedBranchConnector
Definition: ShallowTree.h:51
ShallowTree::BranchConnector::~BranchConnector
virtual ~BranchConnector()
Definition: ShallowTree.h:46
ShallowTree::U_INT
Definition: ShallowTree.h:79
ShallowTree::BOOL
Definition: ShallowTree.h:71
ShallowTree::TypedBranchConnector::object_ptr_
T * object_ptr_
Definition: ShallowTree.h:56
ShallowTree::U_SHORT
Definition: ShallowTree.h:75
ShallowTree::TypedBranchConnector::ml
std::string ml
Definition: ShallowTree.h:53
ShallowTree::U_SHORT_V
Definition: ShallowTree.h:76
EDAnalyzer.h
ShallowTree::CHAR_V
Definition: ShallowTree.h:90
ShallowTree::eat
void eat(edm::BranchDescription const *desc)
Definition: ShallowTree.h:40
ShallowTree::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: ShallowTree.cc:169
edm::EDAnalyzer
Definition: EDAnalyzer.h:29
ShallowTree::LEAFTYPE
LEAFTYPE
Definition: ShallowTree.h:70
ShallowTree::INT
Definition: ShallowTree.h:77
ShallowTree::U_CHAR_V
Definition: ShallowTree.h:92
ShallowTree::FLOAT_V
Definition: ShallowTree.h:82
ShallowTree::TypedBranchConnector::TypedBranchConnector
TypedBranchConnector(edm::BranchDescription const *, std::string, TTree *)
Definition: ShallowTree.cc:184
ShallowTree::TypedBranchConnector::pin
std::string pin
Definition: ShallowTree.h:54
Service.h
ShallowTree::U_LONG
Definition: ShallowTree.h:87
ShallowTree::U_LONG_V
Definition: ShallowTree.h:88
ShallowTree::BOOL_V
Definition: ShallowTree.h:72
ShallowTree::BranchConnector::connect
virtual void connect(const edm::Event &)=0
ShallowTree::ShallowTree
ShallowTree(const edm::ParameterSet &iConfig)
Definition: ShallowTree.cc:10
ShallowTree::U_INT_V
Definition: ShallowTree.h:80
ShallowTree::SHORT
Definition: ShallowTree.h:73
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TFileService.h
ShallowTree::INT_V
Definition: ShallowTree.h:78
edm::ParameterSet
Definition: ParameterSet.h:36
ShallowTree::DOUBLE_V
Definition: ShallowTree.h:84
Event.h
ShallowTree::U_CHAR
Definition: ShallowTree.h:91
edm::Service< TFileService >
ShallowTree::fs_
edm::Service< TFileService > fs_
Definition: ShallowTree.h:63
ShallowTree::TypedBranchConnector::connect
void connect(const edm::Event &) override
Definition: ShallowTree.cc:177
edm::EventSetup
Definition: EventSetup.h:57
ShallowTree::FLOAT
Definition: ShallowTree.h:81
ShallowTree::tree_
TTree * tree_
Definition: ShallowTree.h:64
InputTag.h
ShallowTree::LONG
Definition: ShallowTree.h:85
ShallowTree::beginJob
void beginJob() override
Definition: ShallowTree.cc:198
ShallowTree
Definition: ShallowTree.h:33
Frameworkfwd.h
edm::BranchDescription::moduleLabel
std::string const & moduleLabel() const
Definition: BranchDescription.h:72
T
long double T
Definition: Basic3DVectorLD.h:48
ShallowTree::CHAR
Definition: ShallowTree.h:89
edm::BranchDescription
Definition: BranchDescription.h:32
ParameterSet.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
ShallowTree::TypedBranchConnector::object_
T object_
Definition: ShallowTree.h:55
ShallowTree::LONG_V
Definition: ShallowTree.h:86