ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/ShallowTools/interface/ShallowTree.h
Revision: 1.1
Committed: Sat Aug 23 16:46:29 2008 UTC (16 years, 8 months ago) by bbetchar
Content type: text/plain
Branch: MAIN
CVS Tags: V03-00-02, V03-00-01, V03-00-00, V02-00-02, V02-00-01, V02-00-00, V01-01-01, V01-01-00, V01-00-01, V01-00-00, HEAD
Log Message:
*** empty log message ***

File Contents

# Content
1 #ifndef Shallow_Tree_h
2 #define Shallow_Tree_h
3
4 /** \class ShallowTree
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 * See the file python/test_cfg.py for an example configuration.
14 *
15 * See the file doc/README for more detailed documentation, including
16 * advantages, disadvantages, and use philosophy.
17 *
18 * $Date: 2008/08/07 $
19 * $Revision: 1.0 $
20 * \author Burt Betchart - University of Rochester <burton.andrew.betchart@cern.ch>
21 */
22
23 #include "FWCore/Framework/interface/Frameworkfwd.h"
24 #include "FWCore/Framework/interface/EDAnalyzer.h"
25 #include "FWCore/Framework/interface/Event.h"
26 #include "FWCore/ParameterSet/interface/ParameterSet.h"
27 #include "FWCore/ServiceRegistry/interface/Service.h"
28 #include "PhysicsTools/UtilAlgos/interface/TFileService.h"
29
30 #include <string>
31 #include <vector>
32 #include <TTree.h>
33
34 class ShallowTree : public edm::EDAnalyzer {
35 private:
36 virtual void beginJob(const edm::EventSetup&);
37 virtual void analyze(const edm::Event&, const edm::EventSetup&);
38 virtual void endJob(){}
39
40 class BranchConnector {
41 public:
42 virtual ~BranchConnector() {};
43 virtual void connect(const edm::Event&) = 0;
44 };
45
46 template <class T>
47 class TypedBranchConnector : public BranchConnector {
48 private:
49 std::string ml; //module label
50 std::string pin; //product instance name
51 T object_;
52 T* object_ptr_;
53 public:
54 TypedBranchConnector(edm::BranchDescription const*, std::string, TTree*);
55 void connect(const edm::Event&);
56 };
57
58 edm::Service<TFileService> fs;
59 TTree * tree;
60 std::vector<BranchConnector*> connectors;
61 edm::ParameterSet pset;
62
63 public:
64 explicit ShallowTree(const edm::ParameterSet& iConfig) : pset(iConfig) {}
65
66 enum LEAFTYPE {BOOL=1, BOOL_V,
67 SHORT, SHORT_V, U_SHORT, U_SHORT_V,
68 INT, INT_V, U_INT, U_INT_V,
69 FLOAT, FLOAT_V, DOUBLE, DOUBLE_V,
70 LONG, LONG_V, U_LONG, U_LONG_V };
71 };
72
73 #endif