1 |
buchmann |
1.1 |
TTree* SkimTreeAndAachifyIt(int isample) {
|
2 |
|
|
TTree* newTree = new TTree("newTree","FullTree");
|
3 |
|
|
float AachenWeight,AachenchargeProduct,Aachenpt1,Aachenpt2;
|
4 |
|
|
|
5 |
|
|
newTree->Branch("weight",&AachenWeight,"weight/F");
|
6 |
|
|
// initFloatBranch( "weight" );
|
7 |
|
|
newTree->Branch("chargeProduct",&AachenchargeProduct,"chargeProduct/F");
|
8 |
|
|
// initFloatBranch( "chargeProduct" );
|
9 |
|
|
newTree->Branch("pt1",&Aachenpt1,"pt1/F");
|
10 |
|
|
// initFloatBranch( "pt1" );
|
11 |
|
|
newTree->Branch("pt2",&Aachenpt2,"pt2/F");
|
12 |
|
|
// initFloatBranch( "pt2" );
|
13 |
|
|
float ETHid1,ETHid2,ETHweight,ETHpt1,ETHpt2;
|
14 |
|
|
allsamples.collection[isample].events->SetBranchAddress("id1",Ðid1);
|
15 |
|
|
allsamples.collection[isample].events->SetBranchAddress("id2",Ðid2);
|
16 |
|
|
allsamples.collection[isample].events->SetBranchAddress("weight",Ðweight);
|
17 |
|
|
allsamples.collection[isample].events->SetBranchAddress("pt1",Ðpt1);
|
18 |
|
|
allsamples.collection[isample].events->SetBranchAddress("pt2",Ðpt2);
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
float Aacheneta1,Aacheneta2,Aachenid1,Aachenid2,Aachenjzb,Aachenht,Aachenmet;
|
22 |
|
|
newTree->Branch("eta1",&Aacheneta1,"eta1/F");
|
23 |
|
|
// initFloatBranch( "eta1" );
|
24 |
|
|
newTree->Branch("eta2",&Aacheneta2,"eta2/F");
|
25 |
|
|
// initFloatBranch( "eta2" );
|
26 |
|
|
newTree->Branch("id1",&Aachenid1,"id1/F");
|
27 |
|
|
// initFloatBranch( "id1" ); // isolation
|
28 |
|
|
newTree->Branch("id2",&Aachenid2,"id2/F");
|
29 |
|
|
// initFloatBranch( "id2" ); // isolation
|
30 |
|
|
newTree->Branch("jzb",&Aachenjzb,"jzb/F");
|
31 |
|
|
// initFloatBranch( "jzb" );
|
32 |
|
|
newTree->Branch("ht",&Aachenht,"ht/F");
|
33 |
|
|
// initFloatBranch( "ht" );
|
34 |
|
|
newTree->Branch("met",&Aachenmet,"met/F");
|
35 |
|
|
// initFloatBranch( "met" );
|
36 |
|
|
|
37 |
|
|
float ETHeta1,ETHeta2,ETHiso1,ETHiso2,ETHht;
|
38 |
|
|
float ETHjzb[30];
|
39 |
|
|
float ETHmet[30];
|
40 |
|
|
allsamples.collection[isample].events->SetBranchAddress("eta1",Ðeta1);
|
41 |
|
|
allsamples.collection[isample].events->SetBranchAddress("eta2",Ðeta2);
|
42 |
|
|
allsamples.collection[isample].events->SetBranchAddress("iso1",Ðiso1);
|
43 |
|
|
allsamples.collection[isample].events->SetBranchAddress("iso2",Ðiso2);
|
44 |
|
|
allsamples.collection[isample].events->SetBranchAddress("pfHT",Ðht);
|
45 |
|
|
allsamples.collection[isample].events->SetBranchAddress("met",Ðmet);
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
float AachenpZeta,AachenpZetaVis,AachennJets,AachennBJets,AachennVertices,Aachenjet1pt,Aachenjet2pt,Aachenjet3pt,Aachenjet4pt;
|
50 |
|
|
newTree->Branch("pZeta",&AachenpZeta,"pZeta/F");
|
51 |
|
|
// initFloatBranch( "pZeta" );
|
52 |
|
|
newTree->Branch("pZetaVis",&AachenpZetaVis,"pZetaVis/F");
|
53 |
|
|
// initFloatBranch( "pZetaVis" );
|
54 |
|
|
newTree->Branch("nJets",&AachennJets,"nJets/F");
|
55 |
|
|
// initIntBranch( "nJets" );
|
56 |
|
|
newTree->Branch("nBJets",&AachennBJets,"nBJets/F");
|
57 |
|
|
// initIntBranch( "nBJets" );
|
58 |
|
|
newTree->Branch("nVertices",&AachennVertices,"nVertices/F");
|
59 |
|
|
// initIntBranch( "nVertices" );
|
60 |
|
|
newTree->Branch("jet1pt",&Aachenjet1pt,"jet1pt/F");
|
61 |
|
|
// initFloatBranch( "jet1pt" );
|
62 |
|
|
newTree->Branch("jet2pt",&Aachenjet2pt,"jet2pt/F");
|
63 |
|
|
// initFloatBranch( "jet2pt" );
|
64 |
|
|
newTree->Branch("jet3pt",&Aachenjet3pt,"jet3pt/F");
|
65 |
|
|
// initFloatBranch( "jet3pt" );
|
66 |
|
|
newTree->Branch("jet4pt",&Aachenjet4pt,"jet4pt/F");
|
67 |
|
|
// initFloatBranch( "jet4pt" );
|
68 |
|
|
|
69 |
|
|
float ETHeta,ETHnjets,ETHnBJets,ETHnVertices;
|
70 |
|
|
float ETHjetPt[30];
|
71 |
|
|
allsamples.collection[isample].events->SetBranchAddress("eta",Ðeta);
|
72 |
|
|
allsamples.collection[isample].events->SetBranchAddress("pfJetGoodNum",Ðnjets);
|
73 |
|
|
allsamples.collection[isample].events->SetBranchAddress("pfJetGoodNumBtag",ÐnBJets);
|
74 |
|
|
allsamples.collection[isample].events->SetBranchAddress("numVtx",ÐnVertices);
|
75 |
|
|
allsamples.collection[isample].events->SetBranchAddress("pfJetGoodPt",ÐjetPt);
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
float Aachenbjet1pt;
|
80 |
|
|
int AachenrunNr,AachenlumiSec,AachenpdgId1,AachenpdgId2,AacheneventNr;
|
81 |
|
|
newTree->Branch("bjet1pt",&Aachenbjet1pt,"bjet1pt/F");
|
82 |
|
|
// initFloatBranch( "bjet1pt" );
|
83 |
|
|
newTree->Branch("runNr",&AachenrunNr,"runNr/I");
|
84 |
|
|
// initIntBranch( "runNr" );
|
85 |
|
|
newTree->Branch("lumiSec",&AachenlumiSec,"lumiSec/I");
|
86 |
|
|
// initIntBranch( "lumiSec" );
|
87 |
|
|
newTree->Branch("eventNr",&AacheneventNr,"eventNr/I");
|
88 |
|
|
// initIntBranch( "eventNr" );
|
89 |
|
|
newTree->Branch("pdgId1",&AachenpdgId1,"pdgId1/I");
|
90 |
|
|
// initIntBranch( "pdgId1" );
|
91 |
|
|
newTree->Branch("pdgId2",&AachenpdgId2,"pdgId2/I");
|
92 |
|
|
// initIntBranch( "pdgId2" );
|
93 |
|
|
|
94 |
|
|
float ETHBJetPt;
|
95 |
|
|
int ETHrunNum,ETHlumi,ETHevent,ETHgenId1,ETHgenId2;
|
96 |
|
|
allsamples.collection[isample].events->SetBranchAddress("runNum",ÐrunNum);
|
97 |
|
|
allsamples.collection[isample].events->SetBranchAddress("lumi",Ðlumi);
|
98 |
|
|
allsamples.collection[isample].events->SetBranchAddress("eventNum",Ðevent);
|
99 |
|
|
allsamples.collection[isample].events->SetBranchAddress("genId1",ÐgenId1);
|
100 |
|
|
allsamples.collection[isample].events->SetBranchAddress("genId2",ÐgenId2);
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
float ETHmll;
|
104 |
|
|
allsamples.collection[isample].events->SetBranchAddress("mll",Ðmll);
|
105 |
|
|
|
106 |
|
|
/*
|
107 |
|
|
e ist pt1, mu ist pt2
|
108 |
|
|
pt1 ist subleading lepton, pt2 leading
|
109 |
|
|
fuege mll zu
|
110 |
|
|
correctedJZB
|
111 |
|
|
*/
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
// int id1,id2;
|
117 |
|
|
|
118 |
|
|
TTreeFormula *select = new TTreeFormula("select", "pfJetGoodNum>4", allsamples.collection[isample].events);
|
119 |
|
|
for (Int_t entry = 0 ; entry < allsamples.collection[isample].events->GetEntries() ; entry++) {
|
120 |
|
|
allsamples.collection[isample].events->LoadTree(entry);
|
121 |
|
|
if (select->EvalInstance()) {
|
122 |
|
|
allsamples.collection[isample].events->GetEntry(entry);
|
123 |
|
|
cout << ETHrunNum << endl;
|
124 |
|
|
newTree->Fill();
|
125 |
|
|
}
|
126 |
|
|
}
|
127 |
|
|
|
128 |
|
|
if(EdgeFitter::MarcoDebug) cout << " Reduced tree contains " << newTree->GetEntries() << " entries " << endl;
|
129 |
|
|
return newTree;
|
130 |
|
|
}
|
131 |
|
|
|
132 |
|
|
void CastETHtoAachenNtuple() {
|
133 |
|
|
TTree *completetree;
|
134 |
|
|
write_warning(__FUNCTION__,"Need to make this function ready for scans as well (use signal from scan samples)");
|
135 |
|
|
TList *treelist = new TList;
|
136 |
|
|
int is_data=1;
|
137 |
|
|
for(int isample=0;isample<(int)allsamples.collection.size();isample++) {
|
138 |
|
|
if(!allsamples.collection[isample].is_active) continue;
|
139 |
|
|
if(is_data==1&&allsamples.collection[isample].is_data==false) continue;//kick all samples that aren't data if we're looking for data.
|
140 |
|
|
if(is_data==1&&allsamples.collection[isample].is_data==false) continue;//kick all samples that aren't data if we're looking for data.
|
141 |
|
|
if(is_data!=1&&allsamples.collection[isample].is_data==true) continue;//kick all data samples when looking for MC
|
142 |
|
|
if(is_data!=2&&allsamples.collection[isample].is_signal==true) continue;//remove signal sample if we don't want it.
|
143 |
|
|
if(EdgeFitter::MarcoDebug) cout << "Considering : " << allsamples.collection[isample].samplename << endl;
|
144 |
|
|
treelist->Add(SkimTreeAndAachifyIt(isample));
|
145 |
|
|
}
|
146 |
|
|
completetree = TTree::MergeTrees(treelist);
|
147 |
|
|
if(EdgeFitter::MarcoDebug) cout << "Complete tree now contains " << completetree->GetEntries() << " entries " << endl;
|
148 |
|
|
|
149 |
|
|
TFile *f = new TFile("AachenTree.root","RECREATE");
|
150 |
|
|
completetree->Write();
|
151 |
|
|
f->Close();
|
152 |
|
|
|
153 |
|
|
}
|