Changes in examples/Example4.C [fbb617b:35b9204] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/Example4.C
rfbb617b r35b9204 1 1 /* 2 2 3 This macro shows how to compute jet energy scale. 3 This macro shows how to compute jet energy scale. 4 4 root -l examples/Example4.C'("delphes_output.root", "plots.root")' 5 5 6 The output ROOTfile contains the pT(MC)/pT(Reco) distributions for various pT(Reco) and |eta| bins.7 The peak value of such distribution is interpreted as the jet energy correction to be applied for that given pT(Reco), |eta| bin. 6 The output rootfile contains the pT(MC)/pT(Reco) distributions for various pT(Reco) and |eta| bins. 7 The peak value of such distribution is interpreted as the jet energy correction to be applied for that given pT(Reco), |eta| bin. 8 8 9 9 This can be done by modifying the "ScaleFormula" input parameter to the JetEnergyScale module in the delphes_card_XXX.tcl … … 15 15 16 16 set ScaleFormula { sqrt(3.0 - 0.1*(abs(eta)))^2 / pt + 1.0 ) } 17 18 17 18 19 19 or a binned function: 20 21 22 set ScaleFormula {(abs(eta) > 0.0 && abs(eta) <= 2.5) * (pt > 20.0 && pt <= 50.0) * (1.10) +23 (abs(eta) > 0.0 && abs(eta) <= 2.5) * (pt > 50.0 && pt <= 100.0) * (1.05) + 24 (abs(eta) > 0.0 && abs(eta) <= 2.5) * (pt > 100.0) * (1.00) + 25 (abs(eta) > 2.5 && abs(eta) <= 5.0) * (pt > 20.0 && pt <= 50.0) * (1.10) + 26 (abs(eta) > 2.5 && abs(eta) <= 5.0) * (pt > 50.0 && pt <= 100.0) * (1.05) + 20 21 22 set ScaleFormula { (abs(eta) > 0.0 && abs(eta) <= 2.5) * (pt > 20.0 && pt <= 50.0) * (1.10) + \ 23 (abs(eta) > 0.0 && abs(eta) <= 2.5) * (pt > 50.0 && pt <= 100.0) * (1.05) + \ 24 (abs(eta) > 0.0 && abs(eta) <= 2.5) * (pt > 100.0) * (1.00) + \ 25 (abs(eta) > 2.5 && abs(eta) <= 5.0) * (pt > 20.0 && pt <= 50.0) * (1.10) + \ 26 (abs(eta) > 2.5 && abs(eta) <= 5.0) * (pt > 50.0 && pt <= 100.0) * (1.05) + \ 27 27 (abs(eta) > 2.5 && abs(eta) <= 5.0) * (pt > 100.0) * (1.00)} 28 28 … … 31 31 32 32 33 33 34 34 */ 35 35 … … 39 39 { 40 40 TH1 *fJetPT; 41 41 42 42 TH1 *fJetRes_Pt_20_50_Eta_0_25; 43 43 TH1 *fJetRes_Pt_20_50_Eta_25_5; … … 72 72 "jet_pt", "p_{T}^{jet}", 73 73 "p_{T}^{jet} GeV/c", "number of jets", 74 100, 0.0, 1000.0); 75 74 100, 0.0, 1000.0); 75 76 76 plots->fJetRes_Pt_20_50_Eta_0_25 = result->AddHist1D( 77 77 "jet_delta_pt_20_50_cen", "p_{T}^{truth,parton}/p_{T}^{jet} , 20 < p_{T} < 50 , 0 < | #eta | < 2.5 ", … … 144 144 145 145 plots->fJetRes_Pt_500_inf_Eta_25_5->SetStats(); 146 146 147 147 148 148 } … … 166 166 TLorentzVector JetMom, GenJetMom, BestGenJetMom; 167 167 168 Float_t Dr; 168 Float_t Dr; 169 169 Float_t pt, eta; 170 170 Long64_t entry; … … 178 178 treeReader->ReadEntry(entry); 179 179 // cout<<"-- New event -- "<<endl; 180 180 181 181 if(entry%500 == 0) cout << "Event number: "<< entry <<endl; 182 182 183 183 // Loop over all reconstructed jets in event 184 184 for(i = 0; i < branchJet->GetEntriesFast(); ++i) 185 185 { 186 186 187 187 jet = (Jet*) branchJet->At(i); 188 188 JetMom = jet-> P4(); 189 189 190 190 plots->fJetPT->Fill(JetMom.Pt()); 191 191 192 192 Dr = 999; 193 193 194 194 // Loop over all hard partons in event 195 195 for(j = 0; j < branchParticle->GetEntriesFast(); ++j) 196 196 { 197 197 198 198 part = (GenParticle*) branchParticle->At(j); 199 199 200 200 GenJetMom = part -> P4(); 201 201 202 202 //this is simply to avoid warnings from initial state particle having infite rapidity ... 203 203 if(GenJetMom.Px() == 0 && GenJetMom.Py() == 0) continue; 204 204 205 205 //take the closest parton candidate 206 206 if( GenJetMom.DeltaR(JetMom) < Dr ) … … 208 208 Dr = GenJetMom.DeltaR(JetMom); 209 209 BestGenJetMom = GenJetMom; 210 } 211 210 } 211 212 212 } 213 213 214 if(Dr < 0.3) 214 if(Dr < 0.3) 215 215 { 216 216 pt = JetMom.Pt(); 217 217 eta = TMath::Abs(JetMom.Eta()); 218 219 218 219 220 220 if( pt > 20.0 && pt < 50.0 && eta > 0.0 && eta < 2.5 ) plots -> fJetRes_Pt_20_50_Eta_0_25->Fill(BestGenJetMom.Pt()/JetMom.Pt()); 221 221 if( pt > 20.0 && pt < 50.0 && eta > 2.5 && eta < 5.0 ) plots -> fJetRes_Pt_20_50_Eta_25_5->Fill(BestGenJetMom.Pt()/JetMom.Pt()); 222 222 223 223 if( pt > 50.0 && pt < 100.0 && eta > 0.0 && eta < 2.5 ) plots -> fJetRes_Pt_50_100_Eta_0_25->Fill(BestGenJetMom.Pt()/JetMom.Pt()); 224 224 if( pt > 50.0 && pt < 100.0 && eta > 2.5 && eta < 5.0 ) plots -> fJetRes_Pt_50_100_Eta_25_5->Fill(BestGenJetMom.Pt()/JetMom.Pt()); 225 225 226 226 if( pt > 100.0 && pt < 200.0 && eta > 0.0 && eta < 2.5 ) plots -> fJetRes_Pt_100_200_Eta_0_25->Fill(BestGenJetMom.Pt()/JetMom.Pt()); 227 227 if( pt > 100.0 && pt < 200.0 && eta > 2.5 && eta < 5.0 ) plots -> fJetRes_Pt_100_200_Eta_25_5->Fill(BestGenJetMom.Pt()/JetMom.Pt()); 228 228 229 229 if( pt > 200.0 && pt < 500.0 && eta > 0.0 && eta < 2.5 ) plots -> fJetRes_Pt_200_500_Eta_0_25->Fill(BestGenJetMom.Pt()/JetMom.Pt()); 230 230 if( pt > 200.0 && pt < 500.0 && eta > 2.5 && eta < 5.0 ) plots -> fJetRes_Pt_200_500_Eta_25_5->Fill(BestGenJetMom.Pt()/JetMom.Pt()); 231 231 232 232 if( pt > 500.0 && eta > 0.0 && eta < 2.5 ) plots -> fJetRes_Pt_500_inf_Eta_0_25->Fill(BestGenJetMom.Pt()/JetMom.Pt()); 233 233 if( pt > 500.0 && eta > 2.5 && eta < 5.0 ) plots -> fJetRes_Pt_500_inf_Eta_25_5->Fill(BestGenJetMom.Pt()/JetMom.Pt()); 234 235 234 235 236 236 } 237 238 239 } 237 238 239 } 240 240 } 241 241 }
Note:
See TracChangeset
for help on using the changeset viewer.