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.7 by buchmann, Tue Nov 20 16:51:55 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 >    //we only want Z->ee and Z->mm for this (not Z->tautau)
46 >    
47 >    TCut em("!EventZToTaus");
48 >    
49 >    //no FSR recovery
50 >    TH1F *negmll_noFSR = PhotonSamples.Draw("negmll_noFSR", "genFSRmll", 36, 20, 200, "m_{ll}^{gen}", "events",BaseCut && TCut("genFSRjzb<-0.1") && em,   mc,PlottingSetup::luminosity);
51 >    TH1F *posmll_noFSR = PhotonSamples.Draw("posmll_noFSR", "genFSRmll", 36, 20, 200, "m_{ll}^{gen}", "events",BaseCut && TCut("genFSRjzb>0.1") && em,   mc,PlottingSetup::luminosity);
52 >    
53 >    
54 >    //with FSR recovery
55 >    TH1F *negmll_FSR = PhotonSamples.Draw("negmll_FSR", "genFSRmllg", 36, 20, 200, "m_{ll}^{gen}", "events",BaseCut && TCut("genFSRjzbG<-0.1") && em,   mc,PlottingSetup::luminosity);
56 >    TH1F *posmll_FSR = PhotonSamples.Draw("posmll_FSR", "genFSRmllg", 36, 20, 200, "m_{ll}^{gen}", "events",BaseCut && TCut("genFSRjzbG>0.1") && em,   mc,PlottingSetup::luminosity);
57 >    
58 >    cout << "Integrals: " << endl;
59 >    cout << "     no FSR:   JZB<0 : " << negmll_noFSR->Integral() << endl;
60 >    cout << "     no FSR:   JZB>0 : " << posmll_noFSR->Integral() << endl;
61 >    cout << "     with FSR: JZB<0 : " << negmll_FSR->Integral() << endl;
62 >    cout << "     with FSR: JZB>0 : " << posmll_FSR->Integral() << endl;
63 >    
64 >    can->cd(1)->SetLogy(1);
65 >    can->cd(2)->SetLogy(1);
66 > //    can->cd(3)->SetLogy(1);
67 > //    can->cd(4)->SetLogy(1);
68 >    
69 >    negmll_noFSR->SetLineColor(kRed);
70 >    posmll_noFSR->SetLineColor(kBlack);
71 >    
72 >    negmll_FSR->SetLineColor(kRed);
73 >    posmll_FSR->SetLineColor(kBlack);
74 >    
75 >    TLegend *leg = make_legend();
76 >    leg->AddEntry(negmll_noFSR,"prediction","L");
77 >    leg->AddEntry(posmll_noFSR,"observation","P");
78 >    leg->SetHeader("#splitline{DY MC, gen level}{Only Z#rightarrow ee,mm}");
79 >    
80 >    can->cd(1);
81 >    negmll_noFSR->Draw("histo");
82 >    posmll_noFSR->Draw("e1,same");
83 >    TText *noFSR = write_title("No FSR recovery");
84 >    noFSR->Draw();
85 >    leg->Draw();
86 >    
87 >    can->cd(2);
88 >    negmll_FSR->Draw("histo");
89 >    posmll_FSR->Draw("e1,same");
90 >    TText *FSR = write_title("With FSR recovery");
91 >    FSR->Draw();
92 >    leg->Draw();
93 >    
94 >    can->cd(3);
95 >    TH1F *ratioNoFSR = (TH1F*)posmll_noFSR->Clone("ratioNoFSR");
96 >    ratioNoFSR->Divide(negmll_noFSR);
97 >    ratioNoFSR->GetYaxis()->SetRangeUser(0,2);
98 >    ratioNoFSR->GetYaxis()->SetTitle("obs/pred");
99 >    ratioNoFSR->Draw("e1");
100 >    TLine *oneline = new TLine(ratioNoFSR->GetBinLowEdge(1),1.0,ratioNoFSR->GetBinLowEdge(ratioNoFSR->GetNbinsX())+ratioNoFSR->GetBinWidth(ratioNoFSR->GetNbinsX()),1.0);
101 >    oneline->SetLineColor(kBlue);
102 >    oneline->Draw();
103 >    noFSR->Draw();
104 >    
105 >    can->cd(4);
106 >    TH1F *ratioFSR = (TH1F*)posmll_FSR->Clone("ratioFSR");
107 >    ratioFSR->Divide(negmll_FSR);
108 >    ratioFSR->GetYaxis()->SetTitle("obs/pred");
109 >    ratioFSR->GetYaxis()->SetRangeUser(0,2);
110 >    ratioFSR->Draw("e1");
111 >    oneline->Draw();
112 >    FSR->Draw();
113 >    
114 >    
115 >    CompleteSave(can,"PhotonStudies/Recophotons/ComparePredObsZmass_GEN");
116 >    
117 >    
118 >    cout << __FUNCTION__ << " : Still need to delete objects" << endl;
119 >    delete FSR;
120 >    delete ratioNoFSR;
121 >    delete ratioFSR;
122 >    delete negmll_noFSR;
123 >    delete negmll_FSR;
124 >    delete posmll_noFSR;
125 >    delete posmll_FSR;
126 >    delete can;
127   }
128  
129   void RecoPhotons::FSRPhotonVsUnmatchedVsMatchedPhoton() {
130      
131      TCanvas *can = new TCanvas("can","can");
132 +    
133      can->SetLogy(1);
134      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);
135      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);
136      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);
137 <    
137 >        
138      MatchedFSR->SetLineColor(TColor::GetColor("#01DF01"));//green
139      MatchednoFSR->SetLineColor(TColor::GetColor("#FF4000"));//red
140      UnMatched->SetLineColor(TColor::GetColor("#194fff"));//blue
# Line 61 | Line 152 | void RecoPhotons::FSRPhotonVsUnmatchedVs
152      leg->Draw("same,histo");
153      DrawMCPrelim();
154      
155 +    CompleteSave(can,"PhotonStudies/Recophotons/DeltaR_Comparison_Matched_Unmatched_FSR__Normalized");
156 +    
157 +    MatchedFSR->Draw("histo");
158 +    MatchednoFSR->Draw("same,histo");
159 +    UnMatched->Draw("same,histo");
160 +    leg->SetHeader("DY MC:");
161 +    leg->Draw("same,histo");
162 +    DrawMCPrelim();
163      CompleteSave(can,"PhotonStudies/Recophotons/DeltaR_Comparison_Matched_Unmatched_FSR");
164 +    delete can;
165      
166      
167   }
168  
169   void RecoPhotons::FSRPhotonVsUnmatchedVsMatchedPhoton2D() {
170      
171 <    TCanvas *can = new TCanvas("can","can",500,1500);
172 <    can->Divide(1,3);
173 <    
174 <    
175 <    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 <    
171 >    TCanvas *can = new TCanvas("can","can");
172 >    can->SetLogy(1);
173 >    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);
174 >    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);
175 >    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);
176      
177      MatchedFSR->SetLineColor(TColor::GetColor("#01DF01"));//green
178      MatchednoFSR->SetLineColor(TColor::GetColor("#FF4000"));//red
# Line 101 | Line 191 | void RecoPhotons::FSRPhotonVsUnmatchedVs
191      leg->Draw("same,histo");
192      DrawMCPrelim();
193      
194 <    CompleteSave(can,"PhotonStudies/Recophotons/DeltaR_Comparison_Matched_Unmatched_FSR__2D");
194 >    CompleteSave(can,"PhotonStudies/Recophotons/DeltaR_Comparison_Matched_Unmatched_FSR");
195 >    
196      
197 +    delete can;
198 +    
199 +    TCanvas *can2 = new TCanvas("can2","can2",1000,1000);
200 +    can2->Divide(2,2);
201 +    can2->cd(1);
202 +    
203 +    
204 +    vector<float> binX, binY;
205 +    int nBins=40;
206 +    for(int i=0;i<nBins;i++) {
207 +        binX.push_back(i*(3.0/nBins));
208 +        binY.push_back(i*(3.0/nBins));
209 +    }
210 +    
211 +    cout << __LINE__ << endl;
212 +    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);
213 +    cout << __LINE__ << endl;
214 +    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);
215 +    cout << __LINE__ << endl;
216 +    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);
217 +    cout << __LINE__ << endl;
218      
219 +    
220 +    
221 +    
222 +    can2->cd(1);
223 +    can2->cd(1)->SetRightMargin(0.14);
224 +    tMatchedFSR->Draw("COLZ");
225 +    TText *ma = write_title("Matched FSR photons");
226 +    ma->Draw();
227 +    can2->cd(2);
228 +    can2->cd(2)->SetRightMargin(0.14);
229 +    cout << __LINE__ << endl;
230 +    tMatchednoFSR->Draw("COLZ");
231 +    TText *man = write_title("Matched non-FSR phtons");
232 +    man->Draw();
233 +    can2->cd(3);
234 +    can2->cd(3)->SetRightMargin(0.14);
235 +    cout << __LINE__ << endl;
236 +    TText *unm = write_title("Unmatched photons");
237 +    tUnMatched->Draw("COLZ");
238 +    unm->Draw();
239 +    can2->cd(4);
240 +    can2->cd(4)->SetLogy(1);
241 +    MatchedFSR->DrawNormalized("histo");
242 +    MatchednoFSR->DrawNormalized("same,histo");
243 +    UnMatched->DrawNormalized("same,histo");
244 +    leg->SetHeader("DY MC:");
245 +    leg->Draw("same,histo");
246 +    DrawMCPrelim();
247 +    
248 +    cout << __LINE__ << endl;
249 +    CompleteSave(can2,"PhotonStudies/Recophotons/DeltaR_Comparison_Matched_Unmatched_FSR__2D");
250 +    
251 +    delete can2;
252   }
253  
254   void RecoPhotons::NumberOfPhotonsPerEvent() {
# Line 159 | Line 304 | void CompareZmassToFinalStateLeptons() {
304      CompleteSave(can,"PhotonStudies/Recophotons/CompareZmassToFinalStateLeptons");
305      
306      
307 <    TH1F *RecoLL2 = PhotonSamples.Draw("RecoLL2","mll-genFSRmllg",       50,-100,100,"m_{ll}-m_{Z}^{gen} [GeV]", "events","mll>20&&genFSRmllg>20", mc,PlottingSetup::luminosity);
308 <    TH1F *FSRRll2 = PhotonSamples.Draw("FSRRll2","mllg-genFSRmllg",      50,-100,100,"m_{ll}-m_{Z}^{gen} [GeV]", "events","mllg>20&&genFSRmllg>20",mc,PlottingSetup::luminosity);
307 >    TH1F *RecoLL2 = PhotonSamples.Draw("RecoLL2","mll-genFSRmllg",       40,-100,100,"m_{ll}-m_{Z}^{gen} [GeV]", "events","mll>20&&genFSRmllg>20", mc,PlottingSetup::luminosity);
308 >    TH1F *FSRRll2 = PhotonSamples.Draw("FSRRll2","mllg-genFSRmllg",      40,-100,100,"m_{ll}-m_{Z}^{gen} [GeV]", "events","mllg>20&&genFSRmllg>20",mc,PlottingSetup::luminosity);
309      
310      RecoLL2->SetLineColor(TColor::GetColor("#FF4000"));//red
311      FSRRll2->SetLineColor(TColor::GetColor("#194fff"));//blue
# Line 169 | Line 314 | void CompareZmassToFinalStateLeptons() {
314      phony->SetLineColor(kWhite);
315      
316      stringstream summary;
317 <    summary << "Before: Mean @ " << std::setprecision(3) << RecoLL2->GetMean() << ", RMS: " << std::setprecision(3) << RecoLL2->GetRMS();
318 <    stringstream summary2;
174 <    summary2 << "After:  Mean @ " << std::setprecision(3) << FSRRll2->GetMean() << ", RMS: " << std::setprecision(3) << FSRRll2->GetRMS() << "";
317 >    summary << "#splitline{#splitline{Before: Mean : " << std::setprecision(3) << RecoLL2->GetMean() << "}{              RMS : " << std::setprecision(3) << RecoLL2->GetRMS() << "}";
318 >    summary << "}{#splitline{After:  Mean : " << std::setprecision(3) << FSRRll2->GetMean() << "}{              RMS : " << std::setprecision(3) << FSRRll2->GetRMS() << "}}";
319      
320      TLegend *leg2 = new TLegend(0.6,0.7,0.89,0.89);
321      leg2->SetFillColor(kWhite);
322 <    leg2->AddEntry(FullZ,"gen Z mass","l");
323 <    leg2->AddEntry(RecoLL,"m_{ll}-m{Z}^{gen}: no FSRR","l");
324 <    leg2->AddEntry(FSRRll,"m_{ll}-m{Z}^{gen}: FSRR","l");
181 <    leg2->AddEntry(phony, summary.str().c_str(),"l");
182 <    leg2->AddEntry(phony, summary2.str().c_str(),"l");
322 >    //leg2->AddEntry(FullZ,"gen Z mass","l");
323 >    leg2->AddEntry(RecoLL,"m_{ll}-m_{Z}^{gen}: no FSR recov","l");
324 >    leg2->AddEntry(FSRRll,"m_{ll}-m_{Z}^{gen}: with FSR recov","l");
325      
326      RecoLL2->DrawNormalized("histo");
327      FSRRll2->DrawNormalized("same,histo");
# Line 187 | Line 329 | void CompareZmassToFinalStateLeptons() {
329      leg2->Draw("same,histo");
330      DrawMCPrelim();
331      
332 +    TText *text = write_title(summary.str().c_str());
333 +    text->SetX(0.4);
334 +    text->SetY(0.8);
335 +    text->SetTextAlign(31);
336 +    text->SetTextSize(0.025);
337 +    text->Draw();
338 +    
339      cout << "Mean (before recovery) : " << RecoLL2->GetMean() << " , RMS: " << RecoLL2->GetRMS() << endl;
340      cout << "Mean (after recovery) : " <<  FSRRll2->GetMean() << " , RMS: " << FSRRll2->GetRMS() << endl;
341      
# Line 205 | Line 354 | void CompareZmassToFinalStateLeptons() {
354   }
355  
356   void RecoPhotons::RecoLevelStudies() {
357 <  TCut essential_bkp = essentialcut;
358 <  essentialcut=TCut("");
357 >    TCut essential_bkp = essentialcut;
358 >    essentialcut=TCut("");
359      
360 < //  CompareZmassToFinalStateLeptons();
361 <    FSRPhotonVsUnmatchedVsMatchedPhoton();
360 >    JZBvsmllClosure();
361 >    CompareZmassToFinalStateLeptons();
362 >    FSRPhotonVsUnmatchedVsMatchedPhoton();/*
363      FSRPhotonVsUnmatchedVsMatchedPhoton2D();
364 <  NumberOfPhotonsPerEvent();
365 <  CharacterizingFSRPhotons();
366 <  CompareRecoJZBDistributions();
364 >    NumberOfPhotonsPerEvent();
365 >    CharacterizingFSRPhotons();
366 >    CompareRecoJZBDistributions();
367      
368 <  dR2DPlots();
368 >    dR2DPlots();
369      
370 <  EfficiencyPurity();
370 >    EfficiencyPurity();*/
371      
372 <  essentialcut=essential_bkp;
372 >    essentialcut=essential_bkp;
373   }
374  
375  
376   void GenPhotons::CompareZmassToFinalStateLeptons() {
377 <  
378 <  TCanvas *can = new TCanvas("can","can");
379 <  can->SetLogy(1);
380 <  
381 <  TH1F *FullZ = PhotonSamples.Draw("FullZ","genFSRmllg",36,20,200,"m_{Z}^{gen} [GeV]",  "events", "genFSRmllg>20&&genFSRmllg<200",mc,PlottingSetup::luminosity);
382 <  TH1F *GenLL = PhotonSamples.Draw("GenLL","genFSRmll", 36,20,200,"m_{ll}^{gen} [GeV]", "events","genFSRmllg>20&&genFSRmllg<200",mc,PlottingSetup::luminosity);
383 <  
384 <  FullZ->SetLineColor(TColor::GetColor("#01DF01"));
385 <  GenLL->SetLineColor(TColor::GetColor("#FF4000"));
386 <  
387 <  TLegend *leg = new TLegend(0.7,0.7,0.89,0.89);
388 <  leg->SetFillColor(kWhite);
389 <  leg->AddEntry(FullZ,"gen Z mass","l");
390 <  leg->AddEntry(GenLL,"gen m_{ll}","l");
391 <  
392 <  FullZ->Draw("histo");
393 <  GenLL->Draw("same,histo");
394 <  leg->SetHeader("DY MC:");
395 <  leg->Draw("same,histo");
396 <  DrawMCPrelim();
397 <  
398 <  CompleteSave(can,"PhotonStudies/GenPhotons/CompareZmassToFinalStateLeptons");
399 <  delete can;
400 < }  
377 >    
378 >    TCanvas *can = new TCanvas("can","can");
379 >    can->SetLogy(1);
380 >    
381 >    TH1F *FullZ = PhotonSamples.Draw("FullZ","genFSRmllg",36,20,200,"m_{Z}^{gen} [GeV]",  "events", "genFSRmllg>20&&genFSRmllg<200",mc,PlottingSetup::luminosity);
382 >    TH1F *GenLL = PhotonSamples.Draw("GenLL","genFSRmll", 36,20,200,"m_{ll}^{gen} [GeV]", "events","genFSRmllg>20&&genFSRmllg<200",mc,PlottingSetup::luminosity);
383 >    
384 >    FullZ->SetLineColor(TColor::GetColor("#01DF01"));
385 >    GenLL->SetLineColor(TColor::GetColor("#FF4000"));
386 >    
387 >    TLegend *leg = new TLegend(0.7,0.7,0.89,0.89);
388 >    leg->SetFillColor(kWhite);
389 >    leg->AddEntry(FullZ,"gen Z mass","l");
390 >    leg->AddEntry(GenLL,"gen m_{ll}","l");
391 >    
392 >    FullZ->Draw("histo");
393 >    GenLL->Draw("same,histo");
394 >    leg->SetHeader("DY MC:");
395 >    leg->Draw("same,histo");
396 >    DrawMCPrelim();
397 >    
398 >    CompleteSave(can,"PhotonStudies/GenPhotons/CompareZmassToFinalStateLeptons");
399 >    delete can;
400 > }
401  
402  
403   void GenPhotons::NumberOfPhotonsPerEvent() {
# Line 303 | Line 453 | void GenPhotons::NumberOfPhotonsPerEvent
453   }
454  
455   void GenPhotons::MakeCharacterizationPlot(string variable, int nbins, float min, float max, string label, string saveas) {
456 <  TCanvas *can = new TCanvas("can","can");
457 <  can->SetLogy(1);
458 <  
459 <  TH1F *dR_FSR  = PhotonSamples.Draw("dR_FSR", variable, nbins, min, max, label, "events",BaseCut && FSRcut,  mc,PlottingSetup::luminosity);
460 <  TH1F *dR_nFSR = PhotonSamples.Draw("dR_nFSR", variable, nbins, min, max, label, "events",BaseCut && NoFSRcut, mc,PlottingSetup::luminosity);
461 <  
462 <  dR_FSR->SetLineColor(TColor::GetColor("#01DF01"));
463 <  dR_nFSR->SetLineColor(TColor::GetColor("#FF4000"));
464 <  
465 <  TLegend *leg = new TLegend(0.7,0.7,0.89,0.89);
466 <  leg->SetFillColor(kWhite);
467 <  leg->AddEntry(dR_FSR,"FSR #gamma's","l");
468 <  leg->AddEntry(dR_nFSR,"non-FSR #gamma's","l");
469 <  
470 <  if(dR_nFSR->GetMinimum()<dR_FSR->GetMinimum()) dR_FSR->SetMinimum(dR_nFSR->GetMinimum());
471 <  if(dR_nFSR->GetMaximum()>dR_FSR->GetMaximum()) dR_FSR->SetMaximum(dR_nFSR->GetMaximum());
472 <  
473 <  
474 <  dR_FSR->Draw("histo");
475 <  dR_nFSR->Draw("same,histo");
476 <  leg->SetHeader("DY MC:");
477 <  leg->Draw("same,histo");
478 <  DrawMCPrelim();
479 <  
480 <  CompleteSave(can,"PhotonStudies/GenPhotons/CharacterizingFSRPhotons/"+saveas);
481 <  delete dR_FSR;
482 <  delete dR_nFSR;
483 <  delete can;
456 >    TCanvas *can = new TCanvas("can","can");
457 >    can->SetLogy(1);
458 >    
459 >    TH1F *dR_FSR  = PhotonSamples.Draw("dR_FSR", variable, nbins, min, max, label, "events",BaseCut && FSRcut,  mc,PlottingSetup::luminosity);
460 >    TH1F *dR_nFSR = PhotonSamples.Draw("dR_nFSR", variable, nbins, min, max, label, "events",BaseCut && NoFSRcut, mc,PlottingSetup::luminosity);
461 >    
462 >    dR_FSR->SetLineColor(TColor::GetColor("#01DF01"));
463 >    dR_nFSR->SetLineColor(TColor::GetColor("#FF4000"));
464 >    
465 >    TLegend *leg = new TLegend(0.7,0.7,0.89,0.89);
466 >    leg->SetFillColor(kWhite);
467 >    leg->AddEntry(dR_FSR,"FSR #gamma's","l");
468 >    leg->AddEntry(dR_nFSR,"non-FSR #gamma's","l");
469 >    
470 >    if(dR_nFSR->GetMinimum()<dR_FSR->GetMinimum()) dR_FSR->SetMinimum(dR_nFSR->GetMinimum());
471 >    if(dR_nFSR->GetMaximum()>dR_FSR->GetMaximum()) dR_FSR->SetMaximum(dR_nFSR->GetMaximum());
472 >    
473 >    
474 >    dR_FSR->Draw("histo");
475 >    dR_nFSR->Draw("same,histo");
476 >    leg->SetHeader("DY MC:");
477 >    leg->Draw("same,histo");
478 >    DrawMCPrelim();
479 >    
480 >    CompleteSave(can,"PhotonStudies/GenPhotons/CharacterizingFSRPhotons/"+saveas);
481 >    delete dR_FSR;
482 >    delete dR_nFSR;
483 >    delete can;
484   }
485  
486  
487   void GenPhotons::CharacterizingFSRPhotons() {
488 <  MakeCharacterizationPlot("min(genPhotonsdR1,genPhotonsdR2)",100,0,5,"min(#Delta R (#gamma,l_{1}), #Delta R (#gamma,l_{2}))", "MinDR");
489 <  MakeCharacterizationPlot("genPhotonsPt",100,0,100,"p_{T}^{#gamma}", "PhotonPt");
490 <  MakeCharacterizationPlot("genPhotonsEta",100,-5,5,"#eta^{#gamma}", "PhotonEta");
491 <  MakeCharacterizationPlot("genPhotonsPhi",40,-4,4,"#phi^{#gamma}", "PhotonPhi");
488 >    MakeCharacterizationPlot("min(genPhotonsdR1,genPhotonsdR2)",100,0,5,"min(#Delta R (#gamma,l_{1}), #Delta R (#gamma,l_{2}))", "MinDR");
489 >    MakeCharacterizationPlot("genPhotonsPt",100,0,100,"p_{T}^{#gamma}", "PhotonPt");
490 >    MakeCharacterizationPlot("genPhotonsEta",100,-5,5,"#eta^{#gamma}", "PhotonEta");
491 >    MakeCharacterizationPlot("genPhotonsPhi",40,-4,4,"#phi^{#gamma}", "PhotonPhi");
492   }
493  
494   void GenPhotons::CompareGenJZBDistributions() {
# Line 406 | Line 556 | void GenPhotons::EfficiencyPurity() {
556      vector<float> bindR, binPt;
557      for(int i=0;i<=100;i++) bindR.push_back(i*0.05);
558      binPt.push_back(0);binPt.push_back(10);binPt.push_back(50);binPt.push_back(100);binPt.push_back(1000);binPt.push_back(1010);
559 < //    binPt.push_back(0);binPt.push_back(1000);binPt.push_back(1001);
559 >    //    binPt.push_back(0);binPt.push_back(1000);binPt.push_back(1001);
560      
561      
562      TGraph *purity[binPt.size()];
# Line 415 | Line 565 | void GenPhotons::EfficiencyPurity() {
565      TH1F *FSR[binPt.size()];
566      TH1F *Any[binPt.size()];
567      for(int i=1;i<binPt.size();i++) {
568 <       //do this for each pt range
569 <       float ptlow=binPt[i-1];
570 <       float pthi =binPt[i];
571 <       stringstream ptcut;
572 <       ptcut << "genPhotonsPt>" << ptlow << " && genPhotonsPt<" << pthi << " && min(genPhotonsdR1,genPhotonsdR2)<5";
573 <      
574 <       FSR[i-1]  = PhotonSamples.Draw("FSR", "min(genPhotonsdR1,genPhotonsdR2)", bindR,"min DR","events",TCut(ptcut.str().c_str()) && BaseCut && FSRcut ,mc,PlottingSetup::luminosity);
575 <       Any[i-1]  = PhotonSamples.Draw("Any", "min(genPhotonsdR1,genPhotonsdR2)", bindR,"min DR","events",TCut(ptcut.str().c_str()) && BaseCut  ,mc,PlottingSetup::luminosity);
576 <      
577 <       float NPhotons=0;
578 <       float NFSRPhotons=0;
579 <       float totalNFSRphotons=0;
580 <      
581 <       for(int k=1;k<FSR[i-1]->GetNbinsX();k++) totalNFSRphotons+=FSR[i-1]->GetBinContent(k);
582 <       purity[i-1]=new TGraph(FSR[i-1]->GetNbinsX());
583 <       efficiency[i-1]=new TGraph(FSR[i-1]->GetNbinsX());
584 <       purity_n_efficiency[i-1]=new TGraph(FSR[i-1]->GetNbinsX());
585 <       for(int j=1;j<=FSR[i-1]->GetNbinsX();j++) {
586 <         NPhotons+=(int)Any[i-1]->GetBinContent(j);
587 <         NFSRPhotons+=FSR[i-1]->GetBinContent(j);
588 < //            cout << "       ::::::::" << j << " : " << NPhotons << " : " << NFSRPhotons << " : " << totalNFSRphotons << endl;
568 >        //do this for each pt range
569 >        float ptlow=binPt[i-1];
570 >        float pthi =binPt[i];
571 >        stringstream ptcut;
572 >        ptcut << "genPhotonsPt>" << ptlow << " && genPhotonsPt<" << pthi << " && min(genPhotonsdR1,genPhotonsdR2)<5";
573 >        
574 >        FSR[i-1]  = PhotonSamples.Draw("FSR", "min(genPhotonsdR1,genPhotonsdR2)", bindR,"min DR","events",TCut(ptcut.str().c_str()) && BaseCut && FSRcut ,mc,PlottingSetup::luminosity);
575 >        Any[i-1]  = PhotonSamples.Draw("Any", "min(genPhotonsdR1,genPhotonsdR2)", bindR,"min DR","events",TCut(ptcut.str().c_str()) && BaseCut  ,mc,PlottingSetup::luminosity);
576 >        
577 >        float NPhotons=0;
578 >        float NFSRPhotons=0;
579 >        float totalNFSRphotons=0;
580 >        
581 >        for(int k=1;k<FSR[i-1]->GetNbinsX();k++) totalNFSRphotons+=FSR[i-1]->GetBinContent(k);
582 >        purity[i-1]=new TGraph(FSR[i-1]->GetNbinsX());
583 >        efficiency[i-1]=new TGraph(FSR[i-1]->GetNbinsX());
584 >        purity_n_efficiency[i-1]=new TGraph(FSR[i-1]->GetNbinsX());
585 >        for(int j=1;j<=FSR[i-1]->GetNbinsX();j++) {
586 >            NPhotons+=(int)Any[i-1]->GetBinContent(j);
587 >            NFSRPhotons+=FSR[i-1]->GetBinContent(j);
588 >            //            cout << "       ::::::::" << j << " : " << NPhotons << " : " << NFSRPhotons << " : " << totalNFSRphotons << endl;
589              if(NPhotons>0) purity[i-1]->SetPoint(j-1,FSR[i-1]->GetXaxis()->GetBinCenter(j)+FSR[i-1]->GetBinWidth(j),(float)NFSRPhotons/NPhotons);
590              else purity[i-1]->SetPoint(j-1,FSR[i-1]->GetXaxis()->GetBinCenter(j)+FSR[i-1]->GetBinWidth(j),-1);
591              if(totalNFSRphotons>0) efficiency[i-1]->SetPoint(j,FSR[i-1]->GetXaxis()->GetBinCenter(j)+FSR[i-1]->GetBinWidth(j),(float)NFSRPhotons/totalNFSRphotons);
592              else efficiency[i-1]->SetPoint(j-1,FSR[i-1]->GetXaxis()->GetBinCenter(j)+FSR[i-1]->GetBinWidth(j),-1);
593 <            if(totalNFSRphotons>0&&NPhotons>0) purity_n_efficiency[i-1]->SetPoint(j-1,(float)NFSRPhotons/totalNFSRphotons,(float)NFSRPhotons/NPhotons);
593 >            if(totalNFSRphotons>0&&NPhotons>0) purity_n_efficiency[i-1]->SetPoint(j-1,(float)NFSRPhotons/totalNFSRphotons,(float)NFSRPhotons/NPhotons);
594          }
595 <        purity[i-1]->GetXaxis()->SetTitle("min(#Delta R(#gamma,l_{1}), #Delta R(#gamma,_{2}))");
596 <        purity[i-1]->GetXaxis()->CenterTitle();
597 <        purity[i-1]->GetYaxis()->SetTitle("purity");
598 <        purity[i-1]->GetYaxis()->CenterTitle();
599 <        
600 <        efficiency[i-1]->GetXaxis()->SetTitle("min(#Delta R(#gamma,l_{1}), #Delta R(#gamma,_{2}))");
601 <        efficiency[i-1]->GetXaxis()->CenterTitle();
602 <        efficiency[i-1]->GetYaxis()->SetTitle("efficiency");
603 <        efficiency[i-1]->GetYaxis()->CenterTitle();
604 <        
605 <        purity_n_efficiency[i-1]->GetXaxis()->SetTitle("efficiency");
606 <        purity_n_efficiency[i-1]->GetXaxis()->CenterTitle();
607 <        purity_n_efficiency[i-1]->GetYaxis()->SetTitle("purity");
608 <        purity_n_efficiency[i-1]->GetYaxis()->CenterTitle();
595 >        purity[i-1]->GetXaxis()->SetTitle("min(#Delta R(#gamma,l_{1}), #Delta R(#gamma,_{2}))");
596 >        purity[i-1]->GetXaxis()->CenterTitle();
597 >        purity[i-1]->GetYaxis()->SetTitle("purity");
598 >        purity[i-1]->GetYaxis()->CenterTitle();
599 >        
600 >        efficiency[i-1]->GetXaxis()->SetTitle("min(#Delta R(#gamma,l_{1}), #Delta R(#gamma,_{2}))");
601 >        efficiency[i-1]->GetXaxis()->CenterTitle();
602 >        efficiency[i-1]->GetYaxis()->SetTitle("efficiency");
603 >        efficiency[i-1]->GetYaxis()->CenterTitle();
604 >        
605 >        purity_n_efficiency[i-1]->GetXaxis()->SetTitle("efficiency");
606 >        purity_n_efficiency[i-1]->GetXaxis()->CenterTitle();
607 >        purity_n_efficiency[i-1]->GetYaxis()->SetTitle("purity");
608 >        purity_n_efficiency[i-1]->GetYaxis()->CenterTitle();
609      }
610      
611      TLegend *leg = make_legend();
# Line 469 | Line 619 | void GenPhotons::EfficiencyPurity() {
619          efficiency[i]->SetLineColor(i+1);
620          leg->AddEntry(purity[i],description.str().c_str(),"l");
621      }
622 <
622 >    
623      for(int i=0;i<binPt.size()-2;i++) {
624          if(i==0) purity[i]->Draw("AC");
625          else purity[i]->Draw("C");
# Line 501 | Line 651 | void GenPhotons::GenLevelStudies() {
651      TCut essential_bkp = essentialcut;
652      essentialcut=TCut("");
653      
654 <  CompareZmassToFinalStateLeptons();
655 <  NumberOfPhotonsPerEvent();
656 <  CharacterizingFSRPhotons();
657 <  CompareGenJZBDistributions();
658 <
659 <  dR2DPlots();
660 <    
661 <  EfficiencyPurity();
662 <  
663 <  essentialcut=essential_bkp;
654 >    CompareZmassToFinalStateLeptons();
655 >    NumberOfPhotonsPerEvent();
656 >    CharacterizingFSRPhotons();
657 >    CompareGenJZBDistributions();
658 >    
659 >    dR2DPlots();
660 >    
661 >    EfficiencyPurity();
662 >    
663 >    essentialcut=essential_bkp;
664   }
665  
666   void InitializePhotonSamples() {
667 <  float ZJetsCrossSection         = 3532.8;
668 <  float LowZJetsCrossSection      = 11050*0.069*1.15; // LO xs * filter eff * k-factor (same as ZJets)
669 <
670 <  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);
671 <  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);
672 <  
673 <  write_info(__FUNCTION__,"Photon samples have been initialized!");
674 <  PhotonSamples.ListSamples();
675 <  
676 <  GenPhotons::FSRcut   = TCut("genPhotonsIsFSR");
677 <  GenPhotons::NoFSRcut = TCut("!genPhotonsIsFSR");
678 <  GenPhotons::BaseCut = TCut("genNjets>=3 && genPhotonsPt > 5 && NgenLeps>0");
667 >    float ZJetsCrossSection         = 3532.8;
668 >    float LowZJetsCrossSection      = 11050*0.069*1.15; // LO xs * filter eff * k-factor (same as ZJets)
669 >    
670 >    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);
671 >    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);
672 >    
673 >    write_info(__FUNCTION__,"Photon samples have been initialized!");
674 >    PhotonSamples.ListSamples();
675 >    
676 >    GenPhotons::FSRcut   = TCut("genPhotonsIsFSR");
677 >    GenPhotons::NoFSRcut = TCut("!genPhotonsIsFSR");
678 >    GenPhotons::BaseCut = TCut("genNjets>=3 && genPhotonsPt > 5 && NgenLeps>0");
679   }
680  
681   void FSRstudy() {
682 <  InitializePhotonSamples();
683 <  
684 < //  GenPhotons::GenLevelStudies();
685 <  RecoPhotons::RecoLevelStudies();
682 >    InitializePhotonSamples();
683 >    
684 >    //  GenPhotons::GenLevelStudies();
685 >    RecoPhotons::RecoLevelStudies();
686 >    write_info(__FUNCTION__,"Please change JZBAnalysis photon dR cuts to 0.1 and 0.3 instead of 0.1 and 0.5 - there's too much crap coming in between .3 and .5");
687   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines