1 |
#ifndef NTUPLER_BASE
|
2 |
#define NTUPLER_BASE
|
3 |
|
4 |
#include <map>
|
5 |
|
6 |
#include "TTree.h"
|
7 |
#include "TFile.h"
|
8 |
#include "TString.h"
|
9 |
|
10 |
using namespace std;
|
11 |
|
12 |
class NtuplerBase {
|
13 |
|
14 |
public :
|
15 |
|
16 |
NtuplerBase(const char * fname,
|
17 |
const char * treename );
|
18 |
|
19 |
NtuplerBase(TFile * f_rhs,
|
20 |
const char * treename );
|
21 |
|
22 |
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 |
void makeBranch( const char*&, void*, const char*& );
|
34 |
void makeBranch( TString brname, Float_t *addr);
|
35 |
void makeBranch( TString brname, Int_t *addr);
|
36 |
|
37 |
map<TString,Int_t> intVars;
|
38 |
map<TString,Float_t> floatVars;
|
39 |
|
40 |
protected :
|
41 |
TFile * f;
|
42 |
TTree * t;
|
43 |
|
44 |
};
|
45 |
|
46 |
#endif
|