ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Betchart/TopRefTuple/interface/TreeMaker.h
Revision: 1.1
Committed: Fri Nov 9 18:33:25 2012 UTC (12 years, 5 months ago) by bbetchar
Content type: text/plain
Branch: MAIN
CVS Tags: V00-02-00, V00-01-05, V00-01-04, V00-01-03, V00-01-02, V00-01-01, V00-01-00
Log Message:
Rename MakeTree-->TreeMaker

File Contents

# User Rev Content
1 bbetchar 1.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/07 21:53:09 $
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*, std::string, TTree*);
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