ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/Development/Plotting/Modules/FSRStudy.C
(Generate patch)

Comparing UserCode/cbrown/Development/Plotting/Modules/FSRStudy.C (file contents):
Revision 1.5 by buchmann, Sun Nov 4 19:14:43 2012 UTC vs.
Revision 1.6 by buchmann, Tue Nov 6 17:00:04 2012 UTC

# Line 4 | Line 4
4   samplecollection PhotonSamples("PhotonSamples");
5  
6   namespace GenPhotons {
7 <  void CompareZmassToFinalStateLeptons();
8 <  void GenLevelStudies();
9 <  
10 <  void NumberOfPhotonsPerEvent();
11 <  void CharacterizingFSRPhotons();
12 <  void MakeCharacterizationPlot(string variable, int nbins, float min, float max, string label, string saveas);
13 <  void dR2DPlots();
14 <  void CompareGenJZBDistributions();
15 <  void EfficiencyPurity();
16 <    
17 <  TCut FSRcut;
18 <  TCut NoFSRcut;
19 <  TCut BaseCut;
7 >    void CompareZmassToFinalStateLeptons();
8 >    void GenLevelStudies();
9 >    
10 >    void NumberOfPhotonsPerEvent();
11 >    void CharacterizingFSRPhotons();
12 >    void MakeCharacterizationPlot(string variable, int nbins, float min, float max, string label, string saveas);
13 >    void dR2DPlots();
14 >    void CompareGenJZBDistributions();
15 >    void EfficiencyPurity();
16 >    
17 >    TCut FSRcut;
18 >    TCut NoFSRcut;
19 >    TCut BaseCut;
20   }
21  
22   namespace RecoPhotons {
23 <  void RecoLevelStudies();
24 <  
25 <  void NumberOfPhotonsPerEvent();
26 <  void CharacterizingFSRPhotons();
27 <  void MakeCharacterizationPlot(string variable, int nbins, float min, float max, string label, string saveas);
28 <  void dR2DPlots();
29 <  void CompareRecoJZBDistributions();
30 <  void EfficiencyPurity();
31 <  void FSRPhotonVsUnmatchedVsMatchedPhoton();
32 <  void FSRPhotonVsUnmatchedVsMatchedPhoton2D();
33 <    
34 <  TCut FSRcut;
35 <  TCut NoFSRcut;
36 <  TCut BaseCut;
23 >    void RecoLevelStudies();
24 >    
25 >    void NumberOfPhotonsPerEvent();
26 >    void CharacterizingFSRPhotons();
27 >    void MakeCharacterizationPlot(string variable, int nbins, float min, float max, string label, string saveas);
28 >    void dR2DPlots();
29 >    void CompareRecoJZBDistributions();
30 >    void EfficiencyPurity();
31 >    void FSRPhotonVsUnmatchedVsMatchedPhoton();
32 >    void FSRPhotonVsUnmatchedVsMatchedPhoton2D();
33 >    void JZBvsmllClosure();
34 >    
35 >    TCut FSRcut;
36 >    TCut NoFSRcut;
37 >    TCut BaseCut;
38 > }
39 >
40 > void RecoPhotons::JZBvsmllClosure() {
41 >    TCanvas *can = new TCanvas("can","can",1000,1000);
42 >    can->Divide(2,2);
43 >    can->cd(1);
44 >    
45 >    write_warning(__FUNCTION__,"JZB distribution at gen level seems to be screwed up");
46 >    
47 >    //we only want Z->ee and Z->mm for this (not Z->tautau)
48 >    
49 >    TCut em("!EventZToTaus");
50 >    
51 >    //no FSR recovery
52 >    TH1F *negmll_noFSR = PhotonSamples.Draw("negmll_noFSR", "genFSRmll", 36, 20, 200, "m_{ll}^{gen}", "events",BaseCut && TCut("genFSRjzb<0.1") && em,   mc,PlottingSetup::luminosity);
53 >    TH1F *posmll_noFSR = PhotonSamples.Draw("posmll_noFSR", "genFSRmll", 36, 20, 200, "m_{ll}^{gen}", "events",BaseCut && TCut("genFSRjzb>0.1") && em,   mc,PlottingSetup::luminosity);
54 >    
55 >    
56 >    //with FSR recovery
57 >    TH1F *negmll_FSR = PhotonSamples.Draw("negmll_FSR", "genFSRmllg", 36, 20, 200, "m_{ll}^{gen}", "events",BaseCut && TCut("genFSRjzbG<0.1") && em,   mc,PlottingSetup::luminosity);
58 >    TH1F *posmll_FSR = PhotonSamples.Draw("posmll_FSR", "genFSRmllg", 36, 20, 200, "m_{ll}^{gen}", "events",BaseCut && TCut("genFSRjzbG>0.1") && em,   mc,PlottingSetup::luminosity);
59 >    
60 >    cout << "Integrals: " << endl;
61 >    cout << "     no FSR:   JZB<0 : " << negmll_noFSR->Integral() << endl;
62 >    cout << "     no FSR:   JZB>0 : " << posmll_noFSR->Integral() << endl;
63 >    cout << "     with FSR: JZB<0 : " << negmll_FSR->Integral() << endl;
64 >    cout << "     with FSR: JZB>0 : " << posmll_FSR->Integral() << endl;
65 >    
66 >    negmll_FSR->Scale(1.0/negmll_FSR->Integral());
67 >    posmll_FSR->Scale(1.0/posmll_FSR->Integral());
68 >    
69 >    negmll_noFSR->Scale(1.0/negmll_noFSR->Integral());
70 >    posmll_noFSR->Scale(1.0/posmll_noFSR->Integral());
71 >    
72 >    
73 >    can->cd(1)->SetLogy(1);
74 >    can->cd(2)->SetLogy(1);
75 > //    can->cd(3)->SetLogy(1);
76 > //    can->cd(4)->SetLogy(1);
77 >    
78 >    negmll_noFSR->SetLineColor(kRed);
79 >    posmll_noFSR->SetLineColor(kBlack);
80 >    
81 >    negmll_FSR->SetLineColor(kRed);
82 >    posmll_FSR->SetLineColor(kBlack);
83 >    
84 >    TLegend *leg = make_legend();
85 >    leg->AddEntry(negmll_noFSR,"prediction","L");
86 >    leg->AddEntry(posmll_noFSR,"observation","P");
87 >    leg->SetHeader("#splitline{DY MC, gen level}{Only Z#rightarrow ee,mm}");
88 >    
89 >    can->cd(1);
90 >    negmll_noFSR->Draw("histo");
91 >    posmll_noFSR->Draw("e1,same");
92 >    TText *noFSR = write_title("No FSR recovery");
93 >    noFSR->Draw();
94 >    leg->Draw();
95 >    
96 >    can->cd(2);
97 >    negmll_FSR->Draw("histo");
98 >    posmll_FSR->Draw("e1,same");
99 >    TText *FSR = write_title("With FSR recovery");
100 >    FSR->Draw();
101 >    leg->Draw();
102 >    
103 >    can->cd(3);
104 >    TH1F *ratioNoFSR = (TH1F*)posmll_noFSR->Clone("ratioNoFSR");
105 >    ratioNoFSR->Divide(negmll_noFSR);
106 >    ratioNoFSR->GetYaxis()->SetRangeUser(0,2);
107 >    ratioNoFSR->GetYaxis()->SetTitle("obs/pred");
108 >    ratioNoFSR->Draw("e1");
109 >    TLine *oneline = new TLine(ratioNoFSR->GetBinLowEdge(1),1.0,ratioNoFSR->GetBinLowEdge(ratioNoFSR->GetNbinsX())+ratioNoFSR->GetBinWidth(ratioNoFSR->GetNbinsX()),1.0);
110 >    oneline->SetLineColor(kBlue);
111 >    oneline->Draw();
112 >    noFSR->Draw();
113 >    
114 >    can->cd(4);
115 >    TH1F *ratioFSR = (TH1F*)posmll_FSR->Clone("ratioFSR");
116 >    ratioFSR->Divide(negmll_FSR);
117 >    ratioFSR->GetYaxis()->SetTitle("obs/pred");
118 >    ratioFSR->GetYaxis()->SetRangeUser(0,2);
119 >    ratioFSR->Draw("e1");
120 >    oneline->Draw();
121 >    FSR->Draw();
122 >    
123 >    
124 >    CompleteSave(can,"PhotonStudies/Recophotons/ComparePredObsZmass");
125 >    
126 >    
127 >    cout << __FUNCTION__ << " : Still need to delete objects" << endl;
128 >    delete can;
129   }
130  
131   void RecoPhotons::FSRPhotonVsUnmatchedVsMatchedPhoton() {
132      
133      TCanvas *can = new TCanvas("can","can");
134 +    
135      can->SetLogy(1);
136      TH1F *MatchedFSR  = PhotonSamples.Draw("MatchedFSR" ,"min(recoPhotonsDR1,recoPhotonsDR2)",20,0,2,"min(#Delta R (#gamma,l_{1}), #Delta R (#gamma,l_{2}))" ,  "events", "recoPhotonGenIndex>=0 && genPhotonsIsFSR[recoPhotonGenIndex]",mc,PlottingSetup::luminosity);
137      TH1F *MatchednoFSR  = PhotonSamples.Draw("MatchednoFSR" ,"min(recoPhotonsDR1,recoPhotonsDR2)",20,0,2,"min(#Delta R (#gamma,l_{1}), #Delta R (#gamma,l_{2}))" ,  "events", "recoPhotonGenIndex>=0 && !genPhotonsIsFSR[recoPhotonGenIndex]",mc,PlottingSetup::luminosity);
138      TH1F *UnMatched  = PhotonSamples.Draw("UnMatched" ,"min(recoPhotonsDR1,recoPhotonsDR2)",20,0,2,"min(#Delta R (#gamma,l_{1}), #Delta R (#gamma,l_{2}))" ,  "events", "recoPhotonGenIndex<0",mc,PlottingSetup::luminosity);
139 <    
139 >        
140      MatchedFSR->SetLineColor(TColor::GetColor("#01DF01"));//green
141      MatchednoFSR->SetLineColor(TColor::GetColor("#FF4000"));//red
142      UnMatched->SetLineColor(TColor::GetColor("#194fff"));//blue
# Line 63 | Line 156 | void RecoPhotons::FSRPhotonVsUnmatchedVs
156      
157      CompleteSave(can,"PhotonStudies/Recophotons/DeltaR_Comparison_Matched_Unmatched_FSR");
158      
159 +    delete can;
160 +    
161      
162   }
163  
164   void RecoPhotons::FSRPhotonVsUnmatchedVsMatchedPhoton2D() {
165      
166 <    TCanvas *can = new TCanvas("can","can",500,1500);
167 <    can->Divide(1,3);
168 <    
169 <    
170 <    vector<float> binX, binY;
76 <    for(int i=0;i<=31;i++) {
77 <        binX.push_back(i*0.1);
78 <        binY.push_back(i*0.1);
79 <    }
80 <    
81 <    TH2F *MatchedFSR   = PhotonSamples.Draw("MatchedFSR",  "recoPhotonsDR1:recoPhotonsDR2", binX,binY, "#Delta R (#gamma^{FSR},l_{1})","#Delta R (#gamma^{FSR},l_{2})",BaseCut&&TCut("recoPhotonGenIndex>=0 && genPhotonsIsFSR[recoPhotonGenIndex]"),mc,PlottingSetup::luminosity, PhotonSamples.FindSample("o"),false);
82 <    TH2F *MatchednoFSR   = PhotonSamples.Draw("MatchednoFSR",  "recoPhotonsDR1:recoPhotonsDR2", binX,binY, "#Delta R (#gamma^{FSR},l_{1})","#Delta R (#gamma^{FSR},l_{2})",BaseCut&&TCut("recoPhotonGenIndex>=0 && !genPhotonsIsFSR[recoPhotonGenIndex]"),mc,PlottingSetup::luminosity, PhotonSamples.FindSample("o"),false);
83 <    TH2F *UnMatched   = PhotonSamples.Draw("UnMatched",  "recoPhotonsDR1:recoPhotonsDR2", binX,binY, "#Delta R (#gamma^{FSR},l_{1})","#Delta R (#gamma^{FSR},l_{2})",BaseCut&&TCut("recoPhotonGenIndex<0"),mc,PlottingSetup::luminosity, PhotonSamples.FindSample("o"),false);
84 <    
85 <    
166 >    TCanvas *can = new TCanvas("can","can");
167 >    can->SetLogy(1);
168 >    TH1F *MatchedFSR  = PhotonSamples.Draw("MatchedFSR" ,"min(recoPhotonsDR1,recoPhotonsDR2)",100,0,2,"min(#Delta R (#gamma,l_{1}), #Delta R (#gamma,l_{2}))" ,  "events", "recoPhotonGenIndex>=0 && genPhotonsIsFSR[recoPhotonGenIndex]&&recoPhotonsDR1>0&&recoPhotonsDR2>0",mc,PlottingSetup::luminosity);
169 >    TH1F *MatchednoFSR  = PhotonSamples.Draw("MatchednoFSR" ,"min(recoPhotonsDR1,recoPhotonsDR2)",100,0,2,"min(#Delta R (#gamma,l_{1}), #Delta R (#gamma,l_{2}))" ,  "events", "recoPhotonGenIndex>=0 && !genPhotonsIsFSR[recoPhotonGenIndex]&&recoPhotonsDR1>0&&recoPhotonsDR2>0",mc,PlottingSetup::luminosity);
170 >    TH1F *UnMatched  = PhotonSamples.Draw("UnMatched" ,"min(recoPhotonsDR1,recoPhotonsDR2)",100,0,2,"min(#Delta R (#gamma,l_{1}), #Delta R (#gamma,l_{2}))" ,  "events", "recoPhotonGenIndex<0&&recoPhotonsDR1>0&&recoPhotonsDR2>0",mc,PlottingSetup::luminosity);
171      
172      MatchedFSR->SetLineColor(TColor::GetColor("#01DF01"));//green
173      MatchednoFSR->SetLineColor(TColor::GetColor("#FF4000"));//red
# Line 101 | Line 186 | void RecoPhotons::FSRPhotonVsUnmatchedVs
186      leg->Draw("same,histo");
187      DrawMCPrelim();
188      
189 <    CompleteSave(can,"PhotonStudies/Recophotons/DeltaR_Comparison_Matched_Unmatched_FSR__2D");
189 >    CompleteSave(can,"PhotonStudies/Recophotons/DeltaR_Comparison_Matched_Unmatched_FSR");
190 >    
191 >    
192 >    delete can;
193 >    
194 >    TCanvas *can2 = new TCanvas("can2","can2",1000,1000);
195 >    can2->Divide(2,2);
196 >    can2->cd(1);
197 >    
198 >    
199 >    vector<float> binX, binY;
200 >    int nBins=40;
201 >    for(int i=0;i<nBins;i++) {
202 >        binX.push_back(i*(3.0/nBins));
203 >        binY.push_back(i*(3.0/nBins));
204 >    }
205 >    
206 >    cout << __LINE__ << endl;
207 >    TH2F *tMatchedFSR   = PhotonSamples.Draw("tMatchedFSR",  "recoPhotonsDR1:recoPhotonsDR2", binX,binY, "#Delta R (#gamma^{FSR},l_{1})","#Delta R (#gamma^{FSR},l_{2})",BaseCut&&TCut("recoPhotonGenIndex>=0 && genPhotonsIsFSR[recoPhotonGenIndex]&&recoPhotonsDR1>0&&recoPhotonsDR2>0"),mc,PlottingSetup::luminosity, PhotonSamples.FindSample("o"),false);
208 >    cout << __LINE__ << endl;
209 >    TH2F *tMatchednoFSR   = PhotonSamples.Draw("tMatchednoFSR",  "recoPhotonsDR1:recoPhotonsDR2", binX,binY, "#Delta R (#gamma^{FSR},l_{1})","#Delta R (#gamma^{FSR},l_{2})",BaseCut&&TCut("recoPhotonGenIndex>=0 && !genPhotonsIsFSR[recoPhotonGenIndex]&&recoPhotonsDR1>0&&recoPhotonsDR2>0"),mc,PlottingSetup::luminosity, PhotonSamples.FindSample("o"),false);
210 >    cout << __LINE__ << endl;
211 >    TH2F *tUnMatched   = PhotonSamples.Draw("tUnMatched",  "recoPhotonsDR1:recoPhotonsDR2", binX,binY, "#Delta R (#gamma^{FSR},l_{1})","#Delta R (#gamma^{FSR},l_{2})",BaseCut&&TCut("recoPhotonGenIndex<0&&recoPhotonsDR1>0&&recoPhotonsDR2>0"),mc,PlottingSetup::luminosity, PhotonSamples.FindSample("o"),false);
212 >    cout << __LINE__ << endl;
213      
214      
215 +    
216 +    
217 +    can2->cd(1);
218 +    can2->cd(1)->SetRightMargin(0.14);
219 +    tMatchedFSR->Draw("COLZ");
220 +    TText *ma = write_title("Matched FSR photons");
221 +    ma->Draw();
222 +    can2->cd(2);
223 +    can2->cd(2)->SetRightMargin(0.14);
224 +    cout << __LINE__ << endl;
225 +    tMatchednoFSR->Draw("COLZ");
226 +    TText *man = write_title("Matched non-FSR phtons");
227 +    man->Draw();
228 +    can2->cd(3);
229 +    can2->cd(3)->SetRightMargin(0.14);
230 +    cout << __LINE__ << endl;
231 +    TText *unm = write_title("Unmatched photons");
232 +    tUnMatched->Draw("COLZ");
233 +    unm->Draw();
234 +    can2->cd(4);
235 +    can2->cd(4)->SetLogy(1);
236 +    MatchedFSR->DrawNormalized("histo");
237 +    MatchednoFSR->DrawNormalized("same,histo");
238 +    UnMatched->DrawNormalized("same,histo");
239 +    leg->SetHeader("DY MC:");
240 +    leg->Draw("same,histo");
241 +    DrawMCPrelim();
242 +    
243 +    cout << __LINE__ << endl;
244 +    CompleteSave(can2,"PhotonStudies/Recophotons/DeltaR_Comparison_Matched_Unmatched_FSR__2D");
245 +    
246 +    delete can2;
247   }
248  
249   void RecoPhotons::NumberOfPhotonsPerEvent() {
# Line 205 | Line 345 | void CompareZmassToFinalStateLeptons() {
345   }
346  
347   void RecoPhotons::RecoLevelStudies() {
348 <  TCut essential_bkp = essentialcut;
349 <  essentialcut=TCut("");
348 >    TCut essential_bkp = essentialcut;
349 >    essentialcut=TCut("");
350      
351 < //  CompareZmassToFinalStateLeptons();
351 >    JZBvsmllClosure();
352 > /*    CompareZmassToFinalStateLeptons();
353      FSRPhotonVsUnmatchedVsMatchedPhoton();
354      FSRPhotonVsUnmatchedVsMatchedPhoton2D();
355 <  NumberOfPhotonsPerEvent();
356 <  CharacterizingFSRPhotons();
357 <  CompareRecoJZBDistributions();
355 >    NumberOfPhotonsPerEvent();
356 >    CharacterizingFSRPhotons();
357 >    CompareRecoJZBDistributions();
358      
359 <  dR2DPlots();
359 >    dR2DPlots();
360      
361 <  EfficiencyPurity();
361 >    EfficiencyPurity();*/
362      
363 <  essentialcut=essential_bkp;
363 >    essentialcut=essential_bkp;
364   }
365  
366  
367   void GenPhotons::CompareZmassToFinalStateLeptons() {
368 <  
369 <  TCanvas *can = new TCanvas("can","can");
370 <  can->SetLogy(1);
371 <  
372 <  TH1F *FullZ = PhotonSamples.Draw("FullZ","genFSRmllg",36,20,200,"m_{Z}^{gen} [GeV]",  "events", "genFSRmllg>20&&genFSRmllg<200",mc,PlottingSetup::luminosity);
373 <  TH1F *GenLL = PhotonSamples.Draw("GenLL","genFSRmll", 36,20,200,"m_{ll}^{gen} [GeV]", "events","genFSRmllg>20&&genFSRmllg<200",mc,PlottingSetup::luminosity);
374 <  
375 <  FullZ->SetLineColor(TColor::GetColor("#01DF01"));
376 <  GenLL->SetLineColor(TColor::GetColor("#FF4000"));
377 <  
378 <  TLegend *leg = new TLegend(0.7,0.7,0.89,0.89);
379 <  leg->SetFillColor(kWhite);
380 <  leg->AddEntry(FullZ,"gen Z mass","l");
381 <  leg->AddEntry(GenLL,"gen m_{ll}","l");
382 <  
383 <  FullZ->Draw("histo");
384 <  GenLL->Draw("same,histo");
385 <  leg->SetHeader("DY MC:");
386 <  leg->Draw("same,histo");
387 <  DrawMCPrelim();
388 <  
389 <  CompleteSave(can,"PhotonStudies/GenPhotons/CompareZmassToFinalStateLeptons");
390 <  delete can;
391 < }  
368 >    
369 >    TCanvas *can = new TCanvas("can","can");
370 >    can->SetLogy(1);
371 >    
372 >    TH1F *FullZ = PhotonSamples.Draw("FullZ","genFSRmllg",36,20,200,"m_{Z}^{gen} [GeV]",  "events", "genFSRmllg>20&&genFSRmllg<200",mc,PlottingSetup::luminosity);
373 >    TH1F *GenLL = PhotonSamples.Draw("GenLL","genFSRmll", 36,20,200,"m_{ll}^{gen} [GeV]", "events","genFSRmllg>20&&genFSRmllg<200",mc,PlottingSetup::luminosity);
374 >    
375 >    FullZ->SetLineColor(TColor::GetColor("#01DF01"));
376 >    GenLL->SetLineColor(TColor::GetColor("#FF4000"));
377 >    
378 >    TLegend *leg = new TLegend(0.7,0.7,0.89,0.89);
379 >    leg->SetFillColor(kWhite);
380 >    leg->AddEntry(FullZ,"gen Z mass","l");
381 >    leg->AddEntry(GenLL,"gen m_{ll}","l");
382 >    
383 >    FullZ->Draw("histo");
384 >    GenLL->Draw("same,histo");
385 >    leg->SetHeader("DY MC:");
386 >    leg->Draw("same,histo");
387 >    DrawMCPrelim();
388 >    
389 >    CompleteSave(can,"PhotonStudies/GenPhotons/CompareZmassToFinalStateLeptons");
390 >    delete can;
391 > }
392  
393  
394   void GenPhotons::NumberOfPhotonsPerEvent() {
# Line 303 | Line 444 | void GenPhotons::NumberOfPhotonsPerEvent
444   }
445  
446   void GenPhotons::MakeCharacterizationPlot(string variable, int nbins, float min, float max, string label, string saveas) {
447 <  TCanvas *can = new TCanvas("can","can");
448 <  can->SetLogy(1);
449 <  
450 <  TH1F *dR_FSR  = PhotonSamples.Draw("dR_FSR", variable, nbins, min, max, label, "events",BaseCut && FSRcut,  mc,PlottingSetup::luminosity);
451 <  TH1F *dR_nFSR = PhotonSamples.Draw("dR_nFSR", variable, nbins, min, max, label, "events",BaseCut && NoFSRcut, mc,PlottingSetup::luminosity);
452 <  
453 <  dR_FSR->SetLineColor(TColor::GetColor("#01DF01"));
454 <  dR_nFSR->SetLineColor(TColor::GetColor("#FF4000"));
455 <  
456 <  TLegend *leg = new TLegend(0.7,0.7,0.89,0.89);
457 <  leg->SetFillColor(kWhite);
458 <  leg->AddEntry(dR_FSR,"FSR #gamma's","l");
459 <  leg->AddEntry(dR_nFSR,"non-FSR #gamma's","l");
460 <  
461 <  if(dR_nFSR->GetMinimum()<dR_FSR->GetMinimum()) dR_FSR->SetMinimum(dR_nFSR->GetMinimum());
462 <  if(dR_nFSR->GetMaximum()>dR_FSR->GetMaximum()) dR_FSR->SetMaximum(dR_nFSR->GetMaximum());
463 <  
464 <  
465 <  dR_FSR->Draw("histo");
466 <  dR_nFSR->Draw("same,histo");
467 <  leg->SetHeader("DY MC:");
468 <  leg->Draw("same,histo");
469 <  DrawMCPrelim();
470 <  
471 <  CompleteSave(can,"PhotonStudies/GenPhotons/CharacterizingFSRPhotons/"+saveas);
472 <  delete dR_FSR;
473 <  delete dR_nFSR;
474 <  delete can;
447 >    TCanvas *can = new TCanvas("can","can");
448 >    can->SetLogy(1);
449 >    
450 >    TH1F *dR_FSR  = PhotonSamples.Draw("dR_FSR", variable, nbins, min, max, label, "events",BaseCut && FSRcut,  mc,PlottingSetup::luminosity);
451 >    TH1F *dR_nFSR = PhotonSamples.Draw("dR_nFSR", variable, nbins, min, max, label, "events",BaseCut && NoFSRcut, mc,PlottingSetup::luminosity);
452 >    
453 >    dR_FSR->SetLineColor(TColor::GetColor("#01DF01"));
454 >    dR_nFSR->SetLineColor(TColor::GetColor("#FF4000"));
455 >    
456 >    TLegend *leg = new TLegend(0.7,0.7,0.89,0.89);
457 >    leg->SetFillColor(kWhite);
458 >    leg->AddEntry(dR_FSR,"FSR #gamma's","l");
459 >    leg->AddEntry(dR_nFSR,"non-FSR #gamma's","l");
460 >    
461 >    if(dR_nFSR->GetMinimum()<dR_FSR->GetMinimum()) dR_FSR->SetMinimum(dR_nFSR->GetMinimum());
462 >    if(dR_nFSR->GetMaximum()>dR_FSR->GetMaximum()) dR_FSR->SetMaximum(dR_nFSR->GetMaximum());
463 >    
464 >    
465 >    dR_FSR->Draw("histo");
466 >    dR_nFSR->Draw("same,histo");
467 >    leg->SetHeader("DY MC:");
468 >    leg->Draw("same,histo");
469 >    DrawMCPrelim();
470 >    
471 >    CompleteSave(can,"PhotonStudies/GenPhotons/CharacterizingFSRPhotons/"+saveas);
472 >    delete dR_FSR;
473 >    delete dR_nFSR;
474 >    delete can;
475   }
476  
477  
478   void GenPhotons::CharacterizingFSRPhotons() {
479 <  MakeCharacterizationPlot("min(genPhotonsdR1,genPhotonsdR2)",100,0,5,"min(#Delta R (#gamma,l_{1}), #Delta R (#gamma,l_{2}))", "MinDR");
480 <  MakeCharacterizationPlot("genPhotonsPt",100,0,100,"p_{T}^{#gamma}", "PhotonPt");
481 <  MakeCharacterizationPlot("genPhotonsEta",100,-5,5,"#eta^{#gamma}", "PhotonEta");
482 <  MakeCharacterizationPlot("genPhotonsPhi",40,-4,4,"#phi^{#gamma}", "PhotonPhi");
479 >    MakeCharacterizationPlot("min(genPhotonsdR1,genPhotonsdR2)",100,0,5,"min(#Delta R (#gamma,l_{1}), #Delta R (#gamma,l_{2}))", "MinDR");
480 >    MakeCharacterizationPlot("genPhotonsPt",100,0,100,"p_{T}^{#gamma}", "PhotonPt");
481 >    MakeCharacterizationPlot("genPhotonsEta",100,-5,5,"#eta^{#gamma}", "PhotonEta");
482 >    MakeCharacterizationPlot("genPhotonsPhi",40,-4,4,"#phi^{#gamma}", "PhotonPhi");
483   }
484  
485   void GenPhotons::CompareGenJZBDistributions() {
# Line 406 | Line 547 | void GenPhotons::EfficiencyPurity() {
547      vector<float> bindR, binPt;
548      for(int i=0;i<=100;i++) bindR.push_back(i*0.05);
549      binPt.push_back(0);binPt.push_back(10);binPt.push_back(50);binPt.push_back(100);binPt.push_back(1000);binPt.push_back(1010);
550 < //    binPt.push_back(0);binPt.push_back(1000);binPt.push_back(1001);
550 >    //    binPt.push_back(0);binPt.push_back(1000);binPt.push_back(1001);
551      
552      
553      TGraph *purity[binPt.size()];
# Line 415 | Line 556 | void GenPhotons::EfficiencyPurity() {
556      TH1F *FSR[binPt.size()];
557      TH1F *Any[binPt.size()];
558      for(int i=1;i<binPt.size();i++) {
559 <       //do this for each pt range
560 <       float ptlow=binPt[i-1];
561 <       float pthi =binPt[i];
562 <       stringstream ptcut;
563 <       ptcut << "genPhotonsPt>" << ptlow << " && genPhotonsPt<" << pthi << " && min(genPhotonsdR1,genPhotonsdR2)<5";
564 <      
565 <       FSR[i-1]  = PhotonSamples.Draw("FSR", "min(genPhotonsdR1,genPhotonsdR2)", bindR,"min DR","events",TCut(ptcut.str().c_str()) && BaseCut && FSRcut ,mc,PlottingSetup::luminosity);
566 <       Any[i-1]  = PhotonSamples.Draw("Any", "min(genPhotonsdR1,genPhotonsdR2)", bindR,"min DR","events",TCut(ptcut.str().c_str()) && BaseCut  ,mc,PlottingSetup::luminosity);
567 <      
568 <       float NPhotons=0;
569 <       float NFSRPhotons=0;
570 <       float totalNFSRphotons=0;
571 <      
572 <       for(int k=1;k<FSR[i-1]->GetNbinsX();k++) totalNFSRphotons+=FSR[i-1]->GetBinContent(k);
573 <       purity[i-1]=new TGraph(FSR[i-1]->GetNbinsX());
574 <       efficiency[i-1]=new TGraph(FSR[i-1]->GetNbinsX());
575 <       purity_n_efficiency[i-1]=new TGraph(FSR[i-1]->GetNbinsX());
576 <       for(int j=1;j<=FSR[i-1]->GetNbinsX();j++) {
577 <         NPhotons+=(int)Any[i-1]->GetBinContent(j);
578 <         NFSRPhotons+=FSR[i-1]->GetBinContent(j);
579 < //            cout << "       ::::::::" << j << " : " << NPhotons << " : " << NFSRPhotons << " : " << totalNFSRphotons << endl;
559 >        //do this for each pt range
560 >        float ptlow=binPt[i-1];
561 >        float pthi =binPt[i];
562 >        stringstream ptcut;
563 >        ptcut << "genPhotonsPt>" << ptlow << " && genPhotonsPt<" << pthi << " && min(genPhotonsdR1,genPhotonsdR2)<5";
564 >        
565 >        FSR[i-1]  = PhotonSamples.Draw("FSR", "min(genPhotonsdR1,genPhotonsdR2)", bindR,"min DR","events",TCut(ptcut.str().c_str()) && BaseCut && FSRcut ,mc,PlottingSetup::luminosity);
566 >        Any[i-1]  = PhotonSamples.Draw("Any", "min(genPhotonsdR1,genPhotonsdR2)", bindR,"min DR","events",TCut(ptcut.str().c_str()) && BaseCut  ,mc,PlottingSetup::luminosity);
567 >        
568 >        float NPhotons=0;
569 >        float NFSRPhotons=0;
570 >        float totalNFSRphotons=0;
571 >        
572 >        for(int k=1;k<FSR[i-1]->GetNbinsX();k++) totalNFSRphotons+=FSR[i-1]->GetBinContent(k);
573 >        purity[i-1]=new TGraph(FSR[i-1]->GetNbinsX());
574 >        efficiency[i-1]=new TGraph(FSR[i-1]->GetNbinsX());
575 >        purity_n_efficiency[i-1]=new TGraph(FSR[i-1]->GetNbinsX());
576 >        for(int j=1;j<=FSR[i-1]->GetNbinsX();j++) {
577 >            NPhotons+=(int)Any[i-1]->GetBinContent(j);
578 >            NFSRPhotons+=FSR[i-1]->GetBinContent(j);
579 >            //            cout << "       ::::::::" << j << " : " << NPhotons << " : " << NFSRPhotons << " : " << totalNFSRphotons << endl;
580              if(NPhotons>0) purity[i-1]->SetPoint(j-1,FSR[i-1]->GetXaxis()->GetBinCenter(j)+FSR[i-1]->GetBinWidth(j),(float)NFSRPhotons/NPhotons);
581              else purity[i-1]->SetPoint(j-1,FSR[i-1]->GetXaxis()->GetBinCenter(j)+FSR[i-1]->GetBinWidth(j),-1);
582              if(totalNFSRphotons>0) efficiency[i-1]->SetPoint(j,FSR[i-1]->GetXaxis()->GetBinCenter(j)+FSR[i-1]->GetBinWidth(j),(float)NFSRPhotons/totalNFSRphotons);
583              else efficiency[i-1]->SetPoint(j-1,FSR[i-1]->GetXaxis()->GetBinCenter(j)+FSR[i-1]->GetBinWidth(j),-1);
584 <            if(totalNFSRphotons>0&&NPhotons>0) purity_n_efficiency[i-1]->SetPoint(j-1,(float)NFSRPhotons/totalNFSRphotons,(float)NFSRPhotons/NPhotons);
584 >            if(totalNFSRphotons>0&&NPhotons>0) purity_n_efficiency[i-1]->SetPoint(j-1,(float)NFSRPhotons/totalNFSRphotons,(float)NFSRPhotons/NPhotons);
585          }
586 <        purity[i-1]->GetXaxis()->SetTitle("min(#Delta R(#gamma,l_{1}), #Delta R(#gamma,_{2}))");
587 <        purity[i-1]->GetXaxis()->CenterTitle();
588 <        purity[i-1]->GetYaxis()->SetTitle("purity");
589 <        purity[i-1]->GetYaxis()->CenterTitle();
590 <        
591 <        efficiency[i-1]->GetXaxis()->SetTitle("min(#Delta R(#gamma,l_{1}), #Delta R(#gamma,_{2}))");
592 <        efficiency[i-1]->GetXaxis()->CenterTitle();
593 <        efficiency[i-1]->GetYaxis()->SetTitle("efficiency");
594 <        efficiency[i-1]->GetYaxis()->CenterTitle();
595 <        
596 <        purity_n_efficiency[i-1]->GetXaxis()->SetTitle("efficiency");
597 <        purity_n_efficiency[i-1]->GetXaxis()->CenterTitle();
598 <        purity_n_efficiency[i-1]->GetYaxis()->SetTitle("purity");
599 <        purity_n_efficiency[i-1]->GetYaxis()->CenterTitle();
586 >        purity[i-1]->GetXaxis()->SetTitle("min(#Delta R(#gamma,l_{1}), #Delta R(#gamma,_{2}))");
587 >        purity[i-1]->GetXaxis()->CenterTitle();
588 >        purity[i-1]->GetYaxis()->SetTitle("purity");
589 >        purity[i-1]->GetYaxis()->CenterTitle();
590 >        
591 >        efficiency[i-1]->GetXaxis()->SetTitle("min(#Delta R(#gamma,l_{1}), #Delta R(#gamma,_{2}))");
592 >        efficiency[i-1]->GetXaxis()->CenterTitle();
593 >        efficiency[i-1]->GetYaxis()->SetTitle("efficiency");
594 >        efficiency[i-1]->GetYaxis()->CenterTitle();
595 >        
596 >        purity_n_efficiency[i-1]->GetXaxis()->SetTitle("efficiency");
597 >        purity_n_efficiency[i-1]->GetXaxis()->CenterTitle();
598 >        purity_n_efficiency[i-1]->GetYaxis()->SetTitle("purity");
599 >        purity_n_efficiency[i-1]->GetYaxis()->CenterTitle();
600      }
601      
602      TLegend *leg = make_legend();
# Line 469 | Line 610 | void GenPhotons::EfficiencyPurity() {
610          efficiency[i]->SetLineColor(i+1);
611          leg->AddEntry(purity[i],description.str().c_str(),"l");
612      }
613 <
613 >    
614      for(int i=0;i<binPt.size()-2;i++) {
615          if(i==0) purity[i]->Draw("AC");
616          else purity[i]->Draw("C");
# Line 501 | Line 642 | void GenPhotons::GenLevelStudies() {
642      TCut essential_bkp = essentialcut;
643      essentialcut=TCut("");
644      
645 <  CompareZmassToFinalStateLeptons();
646 <  NumberOfPhotonsPerEvent();
647 <  CharacterizingFSRPhotons();
648 <  CompareGenJZBDistributions();
649 <
650 <  dR2DPlots();
651 <    
652 <  EfficiencyPurity();
653 <  
654 <  essentialcut=essential_bkp;
645 >    CompareZmassToFinalStateLeptons();
646 >    NumberOfPhotonsPerEvent();
647 >    CharacterizingFSRPhotons();
648 >    CompareGenJZBDistributions();
649 >    
650 >    dR2DPlots();
651 >    
652 >    EfficiencyPurity();
653 >    
654 >    essentialcut=essential_bkp;
655   }
656  
657   void InitializePhotonSamples() {
658 <  float ZJetsCrossSection         = 3532.8;
659 <  float LowZJetsCrossSection      = 11050*0.069*1.15; // LO xs * filter eff * k-factor (same as ZJets)
660 <
661 <  PhotonSamples.AddSample("/shome/buchmann/ntuples/MC8tev/PhotonStudies/Skim3genJets_DYJetsToLL_M-50_TuneZ2Star_8TeV-madgraph-tarball-Summer12_DR53X-PU_S10_START53_V7A-v1.root","Z+Jets",-30346766,ZJetsCrossSection,false,false,1,kYellow);
662 <  PhotonSamples.AddSample("/shome/buchmann/ntuples/MC8tev/PhotonStudies/Skim3genJets_DYJetsToLL_M-10To50filter_8TeV-madgraph-Summer12_DR53X-PU_S10_START53_V7A-v1.root","Z+Jets",-6955271,LowZJetsCrossSection,false,false,1,kYellow);
663 <  
664 <  write_info(__FUNCTION__,"Photon samples have been initialized!");
665 <  PhotonSamples.ListSamples();
666 <  
667 <  GenPhotons::FSRcut   = TCut("genPhotonsIsFSR");
668 <  GenPhotons::NoFSRcut = TCut("!genPhotonsIsFSR");
669 <  GenPhotons::BaseCut = TCut("genNjets>=3 && genPhotonsPt > 5 && NgenLeps>0");
658 >    float ZJetsCrossSection         = 3532.8;
659 >    float LowZJetsCrossSection      = 11050*0.069*1.15; // LO xs * filter eff * k-factor (same as ZJets)
660 >    
661 >    PhotonSamples.AddSample("/shome/buchmann/ntuples/MC8tev/PhotonStudies/Skim3genJets_DYJetsToLL_M-50_TuneZ2Star_8TeV-madgraph-tarball-Summer12_DR53X-PU_S10_START53_V7A-v1.root","Z+Jets",-30346766,ZJetsCrossSection,false,false,1,kYellow);
662 >    PhotonSamples.AddSample("/shome/buchmann/ntuples/MC8tev/PhotonStudies/Skim3genJets_DYJetsToLL_M-10To50filter_8TeV-madgraph-Summer12_DR53X-PU_S10_START53_V7A-v1.root","Z+Jets",-6955271,LowZJetsCrossSection,false,false,1,kYellow);
663 >    
664 >    write_info(__FUNCTION__,"Photon samples have been initialized!");
665 >    PhotonSamples.ListSamples();
666 >    
667 >    GenPhotons::FSRcut   = TCut("genPhotonsIsFSR");
668 >    GenPhotons::NoFSRcut = TCut("!genPhotonsIsFSR");
669 >    GenPhotons::BaseCut = TCut("genNjets>=3 && genPhotonsPt > 5 && NgenLeps>0");
670   }
671  
672   void FSRstudy() {
673 <  InitializePhotonSamples();
674 <  
675 < //  GenPhotons::GenLevelStudies();
676 <  RecoPhotons::RecoLevelStudies();
673 >    InitializePhotonSamples();
674 >    
675 >    //  GenPhotons::GenLevelStudies();
676 >    RecoPhotons::RecoLevelStudies();
677   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines