ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/LJMet/MultivariateAnalysis/root/make_training_sample.C
Revision: 1.7
Committed: Fri May 15 21:48:58 2009 UTC (16 years ago) by kukartse
Content type: text/plain
Branch: MAIN
Changes since 1.6: +41 -30 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 kukartse 1.1 {
2 kukartse 1.7 TChain ch_ttbar("ttljets");
3     TChain ch_w("ttljets");
4     TChain ch_z("ttljets");
5     TChain ch_tW("ttljets"); // single top
6     TChain ch_t("ttljets"); // single top
7     TChain ch_s("ttljets"); // single top
8     TChain ch_qcd("ttljets");
9     ch_ttbar . Add("TTJets-madgraph_Fall08_IDEAL_V9_v2_14may2009.root");
10     ch_w . Add("Wjets-madgraph_Winter09_IDEAL_V11_FastSim_v1.root");
11     ch_z . Add("Zjets-madgraph_Winter09_IDEAL_V11_FastSim_v1.root");
12     ch_t . Add("SingleTop_tChannel_Summer08_IDEAL_V9_v1.root");
13     ch_tW. Add("SingleTop_tWChannel_Summer08_IDEAL_V9_v1.root");
14     ch_s . Add("SingleTop_sChannel_Summer08_IDEAL_V9_v1.root");
15     ch_qcd . Add("InclusiveMuPt15_Summer08_IDEAL_V9_v1_14may2009.root");
16 kukartse 1.1
17    
18     // selection
19 kukartse 1.2 #include "cuts.C"
20 kukartse 1.7 the_cut = cut4;
21     TCut the_qcd_cut = cut4_qcd;
22 kukartse 1.1
23     // when copying, include all branches
24 kukartse 1.7 ch_ttbar . SetBranchStatus("*",1);
25     ch_w . SetBranchStatus("*",1);
26     ch_z . SetBranchStatus("*",1);
27     ch_qcd . SetBranchStatus("*",1);
28 kukartse 1.1
29     // create new TTrees from the input
30 kukartse 1.7 TTree * t_sig = ch_ttbar . CopyTree(the_cut);
31     TTree * t_wjets = ch_w . CopyTree(the_cut);
32     TTree * t_zjets = ch_z . CopyTree(the_cut);
33     TTree * t_t = ch_t . CopyTree(the_cut);
34     TTree * t_tW = ch_tW . CopyTree(the_cut);
35     TTree * t_s = ch_s . CopyTree(the_cut);
36     TTree * t_qcd = ch_qcd . CopyTree(the_qcd_cut);
37     //
38 kukartse 1.4 TTree * _sig = t_sig->CopyTree("","",52630,330);
39 kukartse 1.7 TTree * _wjets = t_wjets->CopyTree("","",13177,0);
40     TTree * _zjets = t_zjets->CopyTree("","",2351,0);
41     TTree * _t = t_t ->CopyTree("","",672,0);
42     TTree * _tW = t_tW->CopyTree("","",457,0);
43     TTree * _s = t_s ->CopyTree("","",23,0);
44 kukartse 1.1 _wjets -> CopyAddresses(_zjets);
45     _wjets -> CopyEntries(_zjets);
46 kukartse 1.7 _wjets -> CopyAddresses(_t);
47     _wjets -> CopyEntries(_t);
48     _wjets -> CopyAddresses(_tW);
49     _wjets -> CopyEntries(_tW);
50     _wjets -> CopyAddresses(_s);
51     _wjets -> CopyEntries(_s);
52     TTree * _qcd = t_qcd->CopyTree("","");
53 kukartse 1.1
54    
55     // define new TTree names
56     _sig.SetName("ttbar");
57     _wjets.SetName("wjets");
58 kukartse 1.3 _qcd.SetName("qcd");
59 kukartse 1.1 //_sig->Print();
60     //_wjets->Print();
61     //_qcd->Print();
62    
63     // output file
64 kukartse 1.7 TFile * out_file = new TFile("/uscms_data/d1/lpcljm/MVA/Summer08/training/muon_jets_training-wfastsim-summer08-15may2009.root", "RECREATE");
65 kukartse 1.3 //TFile * out_file = new TFile("./tmva_training-summer08-25feb2009.root", "RECREATE");
66 kukartse 1.1 out_file->cd();
67     _sig->Write();
68     _wjets->Write();
69 kukartse 1.3 _qcd->Write();
70 kukartse 1.1
71     out_file->Write();
72     delete out_file;
73     }
74