1 |
kukartse |
1.1 |
{
|
2 |
|
|
gROOT -> Reset();
|
3 |
|
|
gROOT -> Clear();
|
4 |
|
|
|
5 |
|
|
TFile *file1 = new TFile("muon_jets_fake_data_1fb-summer08-13jun2009.root");
|
6 |
|
|
TFile *file2 = new TFile("TMVApp-data-1fb-14jun2009.root");
|
7 |
|
|
|
8 |
|
|
TTree *tree1 = (TTree*)file1 -> Get("data");
|
9 |
|
|
TTree *tree2 = (TTree*)file2 -> Get("classifier");
|
10 |
|
|
|
11 |
|
|
tree1->SetBranchStatus("*",1);
|
12 |
|
|
tree2->SetBranchStatus("*",0);
|
13 |
|
|
tree2->SetBranchStatus("MVA_BDT",1);
|
14 |
|
|
|
15 |
|
|
Int_t nEntries = tree1 -> GetEntries();
|
16 |
|
|
if (tree2 -> GetEntries() < nEntries) nEntries = tree2 -> GetEntries();
|
17 |
|
|
cout << "The smallest tree has " << nEntries << " entries" << endl;
|
18 |
|
|
|
19 |
|
|
//
|
20 |
|
|
//_____ output file ___________________________________________________
|
21 |
|
|
//
|
22 |
|
|
TFile *newfile = new TFile("ljets-data-1fb-classifier-14jun2009.root","recreate");
|
23 |
|
|
|
24 |
|
|
//TTree *interface = new TTree("interface", "dummy Title"); // empty tree to attach friends to
|
25 |
|
|
//for (Int_t i=0;i<nEntries;i++) interface -> Fill();
|
26 |
|
|
|
27 |
|
|
TTree *newtree1 = tree1 -> CloneTree();
|
28 |
|
|
TTree *newtree2 = tree2 -> CloneTree();
|
29 |
|
|
|
30 |
|
|
newtree1 -> SetName("data");
|
31 |
|
|
newtree2 -> SetName("classifier");
|
32 |
|
|
|
33 |
|
|
//===> add friends to THE SMALLEST TREE !!!
|
34 |
|
|
//interface -> AddFriend( newtree1 );
|
35 |
|
|
//interface -> AddFriend( newtree2 );
|
36 |
|
|
newtree1 -> AddFriend( newtree2 );
|
37 |
|
|
|
38 |
|
|
newfile->Write();
|
39 |
|
|
|
40 |
|
|
}
|