1 |
kukartse |
1.1 |
{
|
2 |
|
|
TChain ch_ttbar("ttljets");
|
3 |
|
|
ch_ttbar . Add("TTJets-madgraph_Fall08_IDEAL_V9_v2_14may2009.root");
|
4 |
|
|
|
5 |
|
|
// selection
|
6 |
|
|
#include "cuts.C"
|
7 |
|
|
the_cut = "";
|
8 |
|
|
|
9 |
|
|
// when copying, include all branches
|
10 |
|
|
ch_ttbar . SetBranchStatus("*",0);
|
11 |
|
|
/*
|
12 |
|
|
ch_ttbar . SetBranchStatus("lepton_energy",0);
|
13 |
|
|
ch_ttbar . SetBranchStatus("lepton_eta",0);
|
14 |
|
|
ch_ttbar . SetBranchStatus("lepton_phi",0);
|
15 |
|
|
ch_ttbar . SetBranchStatus("lepton_pt",0);
|
16 |
|
|
*/
|
17 |
|
|
ch_ttbar . SetBranchStatus("*_energy",1);
|
18 |
|
|
ch_ttbar . SetBranchStatus("*_eta",1);
|
19 |
|
|
ch_ttbar . SetBranchStatus("*_phi",1);
|
20 |
|
|
ch_ttbar . SetBranchStatus("*_pt",1);
|
21 |
|
|
|
22 |
|
|
// output file
|
23 |
|
|
TFile * out_file = new TFile("./sample.root", "RECREATE");
|
24 |
|
|
|
25 |
|
|
// create new TTrees from the input
|
26 |
|
|
TTree * t_sig = ch_ttbar . CopyTree(the_cut);
|
27 |
|
|
|
28 |
|
|
TTree * _data = t_sig->CopyTree("","",10000,0);
|
29 |
|
|
|
30 |
|
|
// define new TTree names
|
31 |
|
|
_data.SetName("data");
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
out_file->cd();
|
35 |
|
|
_data->Write();
|
36 |
|
|
|
37 |
|
|
out_file->Write();
|
38 |
|
|
delete out_file;
|
39 |
|
|
}
|
40 |
|
|
|