1 |
#include<iostream>
|
2 |
#include<math.h>
|
3 |
#include<string>
|
4 |
|
5 |
#include "TSystem.h"
|
6 |
#include "TFile.h"
|
7 |
#include "TTree.h"
|
8 |
#include "TChain.h"
|
9 |
#include "TH1F.h"
|
10 |
|
11 |
#include "SusyEvent.h"
|
12 |
#include "TreeObjects.h"
|
13 |
|
14 |
class TreeWriter {
|
15 |
public :
|
16 |
TreeWriter(std::string inputName, std::string outputName, int loggingVerbosity_);
|
17 |
TreeWriter(TChain* inputName, std::string outputName, int loggingVerbosity_);
|
18 |
void Init( std::string outputName, int loggingVerbosity_ );
|
19 |
virtual ~TreeWriter();
|
20 |
virtual void Loop();
|
21 |
|
22 |
void SetProcessNEvents(int nEvents) { processNEvents = nEvents; }
|
23 |
void SetReportEvents(unsigned int nEvents) { reportEvery = nEvents; }
|
24 |
void SetLoggingVerbosity(unsigned int logVerb) { loggingVerbosity = logVerb; }
|
25 |
void SkimEvents(bool skim_){ skim = skim_; }
|
26 |
void PileUpWeightFile( std::string pileupFileName );
|
27 |
|
28 |
TChain* inputTree;
|
29 |
susy::Event* event;
|
30 |
|
31 |
TFile* outFile;
|
32 |
TTree* tree;
|
33 |
TH1F* eventNumbers;
|
34 |
|
35 |
private:
|
36 |
int processNEvents; // number of events to be processed
|
37 |
unsigned int reportEvery;
|
38 |
bool skim; // true by default. eg. nJets, jet.pt, etc
|
39 |
unsigned int loggingVerbosity;
|
40 |
// 0: no output
|
41 |
// 1: only steps are shown
|
42 |
// 2: object multiplicity shown
|
43 |
// 3: detailed object info shown
|
44 |
|
45 |
// important dataset information
|
46 |
TH1F* pileupHisto;
|
47 |
|
48 |
// variables which will be stored in the tree
|
49 |
std::vector<tree::Photon> photon;
|
50 |
std::vector<tree::Jet> jet;
|
51 |
std::vector<tree::Particle> electron;
|
52 |
std::vector<tree::Particle> muon;
|
53 |
std::vector<tree::Particle> genElectron;
|
54 |
std::vector<tree::Particle> genPhoton;
|
55 |
|
56 |
float met;
|
57 |
float met_phi;
|
58 |
float type1met;
|
59 |
float type1met_phi;
|
60 |
float ht;
|
61 |
int nVertex;
|
62 |
double weight;
|
63 |
};
|
64 |
|