ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Betchart/TopRefTuple/interface/TreeMaker.h
Revision: 1.2
Committed: Sun Jan 13 23:26:33 2013 UTC (12 years, 3 months ago) by bbetchar
Content type: text/plain
Branch: MAIN
CVS Tags: V00-03-02, V00-03-01, V00-02-02, V00-02-01, HEAD
Changes since 1.1: +2 -2 lines
Log Message:
use gInterpreter->GenerateDictionary rather than REFLEX for special cases.

File Contents

# Content
1 #ifndef TREEMAKER_H
2 #define TREEMAKER_H
3
4 /** \class TreeMaker
5 *
6 * Makes a tree out of C++ standard types and vectors of C++ standard types
7 *
8 * This class, which is an EDAnalyzer, takes the same "keep" and
9 * "drop" outputCommands parameter as the PoolOutputSource, making a
10 * tree of the selected variables, which it obtains from the EDM
11 * tree.
12 *
13 * $Date: 2012/11/09 18:33:25 $
14 * $Revision: 1.1 $
15 * \author Burt Betchart - University of Rochester <burton.andrew.betchart@cern.ch>
16 */
17
18 #include "FWCore/Framework/interface/Frameworkfwd.h"
19 #include "FWCore/Framework/interface/EDAnalyzer.h"
20 #include "FWCore/Framework/interface/Event.h"
21 #include "FWCore/ParameterSet/interface/ParameterSet.h"
22 #include "FWCore/ServiceRegistry/interface/Service.h"
23 #include "CommonTools/UtilAlgos/interface/TFileService.h"
24
25 #include <string>
26 #include <vector>
27 #include <TTree.h>
28
29 class TreeMaker : public edm::EDAnalyzer {
30 private:
31 virtual void beginJob();
32 virtual void analyze(const edm::Event&, const edm::EventSetup&);
33 virtual void endJob(){}
34
35 class BranchConnector {
36 public:
37 virtual ~BranchConnector() {};
38 virtual void connect(const edm::Event&) = 0;
39 };
40
41 template <class T>
42 class TypedBranchConnector : public BranchConnector {
43 private:
44 std::string ml; //module label
45 std::string pin; //product instance name
46 T object_;
47 T* object_ptr_;
48 public:
49 TypedBranchConnector(edm::BranchDescription const*, TTree*, std::string t, std::string inc);
50 void connect(const edm::Event&);
51 };
52
53 edm::Service<TFileService> fs;
54 TTree * tree;
55 std::vector<BranchConnector*> connectors;
56 edm::ParameterSet pset;
57
58 public:
59 explicit TreeMaker(const edm::ParameterSet& iConfig) : pset(iConfig) {}
60 };
61
62 #endif