ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/LJMet/MultivariateAnalysis/root/make_training_sample_electron.C
Revision: 1.1
Committed: Wed Apr 29 22:03:08 2009 UTC (16 years ago) by kukartse
Content type: text/plain
Branch: MAIN
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 kukartse 1.1 {
2     TChain chain("ttljets");
3     chain . Add("TTJets-madgraph_Fall08_IDEAL_V9_v2_ejets_dr03.root");
4    
5     TChain chain2("ttljets");
6     chain2 . Add("Wjets-madgraph_Winter09_IDEAL_V11_FastSim_v1_ejets_dr03.root");
7    
8     TChain chain21("ttljets");
9     chain21 . Add("Zjets-madgraph_Winter09_IDEAL_V11_FastSim_v1_ejets_dr03.root");
10    
11     TChain chain_qcd1("ttljets");
12     chain_qcd1 . Add("QCD_BCtoE_Pt20to30_Summer08_IDEAL_V11_redigi_v1_ejets_dr03.root");
13     TChain chain_qcd2("ttljets");
14     chain_qcd2 . Add("QCD_BCtoE_Pt30to80_Summer08_IDEAL_V11_redigi_v1_ejets_dr03.root");
15     TChain chain_qcd3("ttljets");
16     chain_qcd3 . Add("QCD_BCtoE_Pt80to170_Summer08_IDEAL_V11_redigi_v1_ejets_dr03.root");
17     TChain chain_qcd4("ttljets");
18     chain_qcd4 . Add("QCD_EMenriched_Pt20to30_Summer08_IDEAL_V11_redigi_v2_ejets_dr03.root");
19     TChain chain_qcd5("ttljets");
20     chain_qcd5 . Add("QCD_EMenriched_Pt30to80_Summer08_IDEAL_V11_redigi_v2_ejets_dr03.root");
21     TChain chain_qcd6("ttljets");
22     chain_qcd6 . Add("QCD_EMenriched_Pt80to170_Summer08_IDEAL_V11_redigi_v1_ejets_dr03.root");
23    
24     // selection
25     #include "cuts.C"
26     the_cut = cut3_electrons;
27     TCut the_qcd_cut = cut3_rev_electrons;
28    
29     // when copying, include all branches
30     chain . SetBranchStatus("*",1);
31     chain2 . SetBranchStatus("*",1);
32     chain21 . SetBranchStatus("*",1);
33     chain_qcd1 . SetBranchStatus("*",1);
34     chain_qcd2 . SetBranchStatus("*",1);
35     chain_qcd3 . SetBranchStatus("*",1);
36     chain_qcd4 . SetBranchStatus("*",1);
37     chain_qcd5 . SetBranchStatus("*",1);
38     chain_qcd6 . SetBranchStatus("*",1);
39    
40     // create new TTrees from the input
41     TTree * t_sig = chain . CopyTree(the_cut);
42     TTree * t_wjets = chain2 . CopyTree(the_cut);
43     TTree * t_zjets = chain21 . CopyTree(the_cut);
44     TTree * t_qcd1 = chain_qcd1 . CopyTree(the_qcd_cut);
45     TTree * t_qcd2 = chain_qcd2 . CopyTree(the_qcd_cut);
46     TTree * t_qcd3 = chain_qcd3 . CopyTree(the_qcd_cut);
47     TTree * t_qcd4 = chain_qcd4 . CopyTree(the_qcd_cut);
48     TTree * t_qcd5 = chain_qcd5 . CopyTree(the_qcd_cut);
49     TTree * t_qcd6 = chain_qcd6 . CopyTree(the_qcd_cut);
50     //
51     TTree * _sig = t_sig->CopyTree("","",49677,311);
52     TTree * _wjets = t_wjets->CopyTree("","");
53     TTree * _zjets = t_zjets->CopyTree("","");
54     _wjets -> CopyAddresses(_zjets);
55     _wjets -> CopyEntries(_zjets);
56     TTree * _qcd1 = t_qcd1->CopyTree("","",3,0);
57     TTree * _qcd2 = t_qcd2->CopyTree("","",1525,0);
58     TTree * _qcd3 = t_qcd3->CopyTree("","",3380,0);
59     TTree * _qcd4 = t_qcd4->CopyTree("","",137,0);
60     TTree * _qcd5 = t_qcd5->CopyTree("","",17502,0);
61     TTree * _qcd6 = t_qcd6->CopyTree("","",28472,0);
62     _qcd1 -> CopyAddresses(_qcd2);
63     _qcd1 -> CopyEntries(_qcd2);
64     _qcd1 -> CopyAddresses(_qcd3);
65     _qcd1 -> CopyEntries(_qcd3);
66     _qcd1 -> CopyAddresses(_qcd4);
67     _qcd1 -> CopyEntries(_qcd4);
68     _qcd1 -> CopyAddresses(_qcd5);
69     _qcd1 -> CopyEntries(_qcd5);
70     _qcd1 -> CopyAddresses(_qcd6);
71     _qcd1 -> CopyEntries(_qcd6);
72    
73    
74     // define new TTree names
75     _sig.SetName("ttbar");
76     _wjets.SetName("wzjets");
77     _qcd1.SetName("qcd");
78     //_sig->Print();
79     //_wjets->Print();
80     //_qcd->Print();
81    
82     // output file
83     TFile * out_file = new TFile("/uscms_data/d1/lpcljm/MVA/Summer08/training/electron_jets_training-wzfastsim-summer08-29apr2009.root", "RECREATE");
84     out_file->cd();
85     _sig->Write();
86     _wjets->Write();
87     _qcd1->Write();
88    
89    
90     out_file->Write();
91     delete out_file;
92     }
93