1 |
khahn |
1.1 |
#ifndef NTUPLER_BASE
|
2 |
|
|
#define NTUPLER_BASE
|
3 |
|
|
|
4 |
dkralph |
1.3 |
#include <map>
|
5 |
|
|
|
6 |
khahn |
1.1 |
#include "TTree.h"
|
7 |
dkralph |
1.3 |
#include "TFile.h"
|
8 |
|
|
#include "TString.h"
|
9 |
|
|
|
10 |
|
|
using namespace std;
|
11 |
khahn |
1.1 |
|
12 |
|
|
class NtuplerBase {
|
13 |
|
|
|
14 |
|
|
public :
|
15 |
|
|
|
16 |
|
|
NtuplerBase(const char * fname,
|
17 |
|
|
const char * treename );
|
18 |
|
|
|
19 |
khahn |
1.2 |
NtuplerBase(TFile * f_rhs,
|
20 |
|
|
const char * treename );
|
21 |
|
|
|
22 |
khahn |
1.1 |
NtuplerBase(const char * fname,
|
23 |
|
|
const char * treename,
|
24 |
|
|
const char * brname,
|
25 |
|
|
void * addr,
|
26 |
|
|
const char * varlist );
|
27 |
|
|
|
28 |
|
|
inline void Fill() { t->Fill(); };
|
29 |
|
|
inline void WriteClose() { f->cd(); t->Write(); f->Close(); };
|
30 |
|
|
inline TTree * getTree() { return t; };
|
31 |
|
|
inline TFile * getFile() { return f; };
|
32 |
|
|
|
33 |
dkralph |
1.3 |
void makeBranch( const char*&, void*, const char*& );
|
34 |
|
|
void makeBranch( TString brname, Float_t *addr);
|
35 |
|
|
void makeBranch( TString brname, Int_t *addr);
|
36 |
khahn |
1.1 |
|
37 |
dkralph |
1.3 |
map<TString,Int_t> intVars;
|
38 |
|
|
map<TString,Float_t> floatVars;
|
39 |
khahn |
1.1 |
|
40 |
|
|
protected :
|
41 |
|
|
TFile * f;
|
42 |
|
|
TTree * t;
|
43 |
|
|
|
44 |
|
|
};
|
45 |
|
|
|
46 |
|
|
#endif
|