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.1 by buchmann, Thu Oct 11 09:11:50 2012 UTC vs.
Revision 1.5 by buchmann, Sun Nov 4 19:14:43 2012 UTC

# Line 7 | Line 7 | namespace GenPhotons {
7    void CompareZmassToFinalStateLeptons();
8    void GenLevelStudies();
9    
10 <  
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 <  
26 <  
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;
37 > }
38 >
39 > void RecoPhotons::FSRPhotonVsUnmatchedVsMatchedPhoton() {
40 >    
41 >    TCanvas *can = new TCanvas("can","can");
42 >    can->SetLogy(1);
43 >    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);
44 >    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);
45 >    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);
46 >    
47 >    MatchedFSR->SetLineColor(TColor::GetColor("#01DF01"));//green
48 >    MatchednoFSR->SetLineColor(TColor::GetColor("#FF4000"));//red
49 >    UnMatched->SetLineColor(TColor::GetColor("#194fff"));//blue
50 >    
51 >    TLegend *leg = new TLegend(0.7,0.7,0.89,0.89);
52 >    leg->SetFillColor(kWhite);
53 >    leg->AddEntry(MatchedFSR,"Matched: FSR","l");
54 >    leg->AddEntry(MatchednoFSR,"Matched: no FSR","l");
55 >    leg->AddEntry(UnMatched,"Unmatched #gamma","l");
56 >    
57 >    MatchedFSR->DrawNormalized("histo");
58 >    MatchednoFSR->DrawNormalized("same,histo");
59 >    UnMatched->DrawNormalized("same,histo");
60 >    leg->SetHeader("DY MC:");
61 >    leg->Draw("same,histo");
62 >    DrawMCPrelim();
63 >    
64 >    CompleteSave(can,"PhotonStudies/Recophotons/DeltaR_Comparison_Matched_Unmatched_FSR");
65 >    
66 >    
67 > }
68 >
69 > void RecoPhotons::FSRPhotonVsUnmatchedVsMatchedPhoton2D() {
70 >    
71 >    TCanvas *can = new TCanvas("can","can",500,1500);
72 >    can->Divide(1,3);
73 >    
74 >    
75 >    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 >    
86 >    
87 >    MatchedFSR->SetLineColor(TColor::GetColor("#01DF01"));//green
88 >    MatchednoFSR->SetLineColor(TColor::GetColor("#FF4000"));//red
89 >    UnMatched->SetLineColor(TColor::GetColor("#194fff"));//blue
90 >    
91 >    TLegend *leg = new TLegend(0.7,0.7,0.89,0.89);
92 >    leg->SetFillColor(kWhite);
93 >    leg->AddEntry(MatchedFSR,"Matched: FSR","l");
94 >    leg->AddEntry(MatchednoFSR,"Matched: no FSR","l");
95 >    leg->AddEntry(UnMatched,"Unmatched #gamma","l");
96 >    
97 >    MatchedFSR->DrawNormalized("histo");
98 >    MatchednoFSR->DrawNormalized("same,histo");
99 >    UnMatched->DrawNormalized("same,histo");
100 >    leg->SetHeader("DY MC:");
101 >    leg->Draw("same,histo");
102 >    DrawMCPrelim();
103 >    
104 >    CompleteSave(can,"PhotonStudies/Recophotons/DeltaR_Comparison_Matched_Unmatched_FSR__2D");
105 >    
106 >    
107 > }
108 >
109 > void RecoPhotons::NumberOfPhotonsPerEvent() {
110 >    cout << __FUNCTION__ << " not implemented." << endl;
111 > }
112 >
113 > void RecoPhotons::CharacterizingFSRPhotons() {
114 >    cout << __FUNCTION__ << " not implemented." << endl;
115 > }
116 >
117 > void RecoPhotons::dR2DPlots() {
118 >    cout << __FUNCTION__ << " not implemented." << endl;
119 > }
120 >
121 > void RecoPhotons::MakeCharacterizationPlot(string variable, int nbins, float min, float max, string label, string saveas) {
122 >    cout << __FUNCTION__ << " not implemented." << endl;
123 > }
124 >
125 > void RecoPhotons::CompareRecoJZBDistributions() {
126 >    cout << __FUNCTION__ << " not implemented." << endl;
127 > }
128 >
129 > void RecoPhotons::EfficiencyPurity() {
130 >    cout << __FUNCTION__ << " not implemented." << endl;
131 > }
132 >
133 > void CompareZmassToFinalStateLeptons() {
134 >    
135 >    TCanvas *can = new TCanvas("can","can");
136 >    can->SetLogy(1);
137 >    
138 >    TH1F *FullZ  = PhotonSamples.Draw("FullZ" ,"genFSRmllg",36,20,200,"m_{ll} [GeV]" ,  "events", "genFSRmllg>20&&genFSRmllg<200",mc,PlottingSetup::luminosity);
139 >    TH1F *RecoLL = PhotonSamples.Draw("RecoLL","mll",       36,20,200,"m_{ll} [GeV]"      , "events","mll>20&&mll<200",mc,PlottingSetup::luminosity);
140 >    TH1F *FSRRll = PhotonSamples.Draw("FSRRll","mllg",      36,20,200,"m_{ll#gamma} [GeV]", "events","mllg>20&&mllg<200",mc,PlottingSetup::luminosity);
141 >    
142 >    FullZ->SetLineColor(TColor::GetColor("#01DF01"));//green
143 >    RecoLL->SetLineColor(TColor::GetColor("#FF4000"));//red
144 >    FSRRll->SetLineColor(TColor::GetColor("#194fff"));//blue
145 >    
146 >    TLegend *leg = new TLegend(0.7,0.7,0.89,0.89);
147 >    leg->SetFillColor(kWhite);
148 >    leg->AddEntry(FullZ,"gen Z mass","l");
149 >    leg->AddEntry(RecoLL,"reco m_{ll}","l");
150 >    leg->AddEntry(FSRRll,"reco m_{ll} w/ FSR recovery","l");
151 >    
152 >    FullZ->DrawNormalized("histo");
153 >    RecoLL->DrawNormalized("same,histo");
154 >    FSRRll->DrawNormalized("same,histo");
155 >    leg->SetHeader("DY MC:");
156 >    leg->Draw("same,histo");
157 >    DrawMCPrelim();
158 >    
159 >    CompleteSave(can,"PhotonStudies/Recophotons/CompareZmassToFinalStateLeptons");
160 >    
161 >    
162 >    TH1F *RecoLL2 = PhotonSamples.Draw("RecoLL2","mll-genFSRmllg",       50,-100,100,"m_{ll}-m_{Z}^{gen} [GeV]", "events","mll>20&&genFSRmllg>20", mc,PlottingSetup::luminosity);
163 >    TH1F *FSRRll2 = PhotonSamples.Draw("FSRRll2","mllg-genFSRmllg",      50,-100,100,"m_{ll}-m_{Z}^{gen} [GeV]", "events","mllg>20&&genFSRmllg>20",mc,PlottingSetup::luminosity);
164 >    
165 >    RecoLL2->SetLineColor(TColor::GetColor("#FF4000"));//red
166 >    FSRRll2->SetLineColor(TColor::GetColor("#194fff"));//blue
167 >    
168 >    TH1F *phony = new TH1F("phony","",1,0,1);
169 >    phony->SetLineColor(kWhite);
170 >    
171 >    stringstream summary;
172 >    summary << "Before: Mean @ " << std::setprecision(3) << RecoLL2->GetMean() << ", RMS: " << std::setprecision(3) << RecoLL2->GetRMS();
173 >    stringstream summary2;
174 >    summary2 << "After:  Mean @ " << std::setprecision(3) << FSRRll2->GetMean() << ", RMS: " << std::setprecision(3) << FSRRll2->GetRMS() << "";
175 >    
176 >    TLegend *leg2 = new TLegend(0.6,0.7,0.89,0.89);
177 >    leg2->SetFillColor(kWhite);
178 >    leg2->AddEntry(FullZ,"gen Z mass","l");
179 >    leg2->AddEntry(RecoLL,"m_{ll}-m{Z}^{gen}: no FSRR","l");
180 >    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");
183 >    
184 >    RecoLL2->DrawNormalized("histo");
185 >    FSRRll2->DrawNormalized("same,histo");
186 >    leg2->SetHeader("DY MC:");
187 >    leg2->Draw("same,histo");
188 >    DrawMCPrelim();
189 >    
190 >    cout << "Mean (before recovery) : " << RecoLL2->GetMean() << " , RMS: " << RecoLL2->GetRMS() << endl;
191 >    cout << "Mean (after recovery) : " <<  FSRRll2->GetMean() << " , RMS: " << FSRRll2->GetRMS() << endl;
192 >    
193 >    
194 >    CompleteSave(can,"PhotonStudies/Recophotons/CompareZmassToFinalStateLeptons_MassDiff");
195 >    
196 >    
197 >    
198 >    delete RecoLL;
199 >    delete RecoLL2;
200 >    delete FullZ;
201 >    delete FSRRll;
202 >    delete FSRRll2;
203 >    delete phony;
204 >    delete can;
205   }
206  
207   void RecoPhotons::RecoLevelStudies() {
208 <  cout << "RecoLevelStudies have not been implemented yet" << endl;
208 >  TCut essential_bkp = essentialcut;
209 >  essentialcut=TCut("");
210 >    
211 > //  CompareZmassToFinalStateLeptons();
212 >    FSRPhotonVsUnmatchedVsMatchedPhoton();
213 >    FSRPhotonVsUnmatchedVsMatchedPhoton2D();
214 >  NumberOfPhotonsPerEvent();
215 >  CharacterizingFSRPhotons();
216 >  CompareRecoJZBDistributions();
217 >    
218 >  dR2DPlots();
219 >    
220 >  EfficiencyPurity();
221 >    
222 >  essentialcut=essential_bkp;
223   }
224  
225  
# Line 27 | Line 228 | void GenPhotons::CompareZmassToFinalStat
228    TCanvas *can = new TCanvas("can","can");
229    can->SetLogy(1);
230    
231 <  TH1F *FullZ = PhotonSamples.Draw("FullZ","genFSRmllg",36,20,200,"m_{Z}^{gen} (GeV)",  "events","genFSRmllg>20&&genFSRmllg<200",mc,PlottingSetup::luminosity);
232 <  TH1F *GenLL = PhotonSamples.Draw("GenLL","genFSRmll", 36,20,200,"m_{ll}^{gen} (GeV)", "events","genFSRmllg>20&&genFSRmllg<200",mc,PlottingSetup::luminosity);
231 >  TH1F *FullZ = PhotonSamples.Draw("FullZ","genFSRmllg",36,20,200,"m_{Z}^{gen} [GeV]",  "events", "genFSRmllg>20&&genFSRmllg<200",mc,PlottingSetup::luminosity);
232 >  TH1F *GenLL = PhotonSamples.Draw("GenLL","genFSRmll", 36,20,200,"m_{ll}^{gen} [GeV]", "events","genFSRmllg>20&&genFSRmllg<200",mc,PlottingSetup::luminosity);
233    
234    FullZ->SetLineColor(TColor::GetColor("#01DF01"));
235    GenLL->SetLineColor(TColor::GetColor("#FF4000"));
236    
237    TLegend *leg = new TLegend(0.7,0.7,0.89,0.89);
238 +  leg->SetFillColor(kWhite);
239    leg->AddEntry(FullZ,"gen Z mass","l");
240 <  leg->AddEntry(GenLL,"Mass from final state gen leptons","l");
240 >  leg->AddEntry(GenLL,"gen m_{ll}","l");
241    
242 <  FullZ->Draw();
243 <  GenLL->Draw("same");
244 <  leg->Draw("same");
245 <  
246 <  CompleteSave(can,"PhotonStudies/CompareZmassToFinalStateLeptons");
242 >  FullZ->Draw("histo");
243 >  GenLL->Draw("same,histo");
244 >  leg->SetHeader("DY MC:");
245 >  leg->Draw("same,histo");
246 >  DrawMCPrelim();
247    
248 +  CompleteSave(can,"PhotonStudies/GenPhotons/CompareZmassToFinalStateLeptons");
249 +  delete can;
250   }  
251  
252 +
253 + void GenPhotons::NumberOfPhotonsPerEvent() {
254 +    TCanvas *can = new TCanvas("can","can");
255 +    can->SetLogy(1);
256 +    
257 +    TH1F *FSR = PhotonSamples.Draw("FSR","genFSRNparticles"  ,11,-0.5,10.5,"N(#gamma)", "events", BaseCut,mc,PlottingSetup::luminosity);
258 +    TH1F *all = PhotonSamples.Draw("all","genPhotonsNPhotons",11,-0.5,10.5,"N(#gamma)", "events", BaseCut,mc,PlottingSetup::luminosity);
259 +    
260 +    FSR->SetLineColor(TColor::GetColor("#01DF01"));
261 +    all->SetLineColor(TColor::GetColor("#FF4000"));
262 +    
263 +    TLegend *leg = new TLegend(0.7,0.7,0.89,0.89);
264 +    leg->SetFillColor(kWhite);
265 +    leg->AddEntry(FSR,"FSR photons","l");
266 +    leg->AddEntry(all,"all photons","l");
267 +    
268 +    FSR->Draw("histo");
269 +    all->Draw("same,histo");
270 +    leg->SetHeader("DY MC:");
271 +    leg->Draw("same,histo");
272 +    DrawMCPrelim();
273 +    
274 +    CompleteSave(can,"PhotonStudies/GenPhotons/NPhotons");
275 +    
276 +    
277 +    TH1F *PhotonPt[10];
278 +    for(int i=0;i<10;i++) {
279 +        PhotonPt[i] = PhotonSamples.Draw("FSR","genPhotonsPt",25,0,100,"N(#gamma)",  "events", FSRcut && TCut(("genFSRNparticles=="+any2string(i)).c_str()),mc,PlottingSetup::luminosity);
280 +    }
281 +    
282 +    int DrawCounter=0;
283 +    
284 +    TLegend *leg2 = make_legend();
285 +    for(int i=0;i<10;i++) {
286 +        if(PhotonPt[i]->Integral()>50) {
287 +            PhotonPt[i]->SetLineColor(DrawCounter+1);
288 +            leg2->AddEntry(PhotonPt[i],(any2string(i)+" FSR Photons").c_str(),"l");
289 +            if(DrawCounter) PhotonPt[i]->DrawNormalized("same,hist");
290 +            else PhotonPt[i]->DrawNormalized("hist");
291 +            DrawCounter++;
292 +        }
293 +    }
294 +    
295 +    leg2->Draw();
296 +    
297 +    leg2->SetHeader("DY MC (N_{jets} #geq 0):");
298 +    DrawMCPrelim();
299 +    
300 +    CompleteSave(can,"PhotonStudies/GenPhotons/PhotonPtvsNPhotons");
301 +    
302 +    delete can;
303 + }
304 +
305 + void GenPhotons::MakeCharacterizationPlot(string variable, int nbins, float min, float max, string label, string saveas) {
306 +  TCanvas *can = new TCanvas("can","can");
307 +  can->SetLogy(1);
308 +  
309 +  TH1F *dR_FSR  = PhotonSamples.Draw("dR_FSR", variable, nbins, min, max, label, "events",BaseCut && FSRcut,  mc,PlottingSetup::luminosity);
310 +  TH1F *dR_nFSR = PhotonSamples.Draw("dR_nFSR", variable, nbins, min, max, label, "events",BaseCut && NoFSRcut, mc,PlottingSetup::luminosity);
311 +  
312 +  dR_FSR->SetLineColor(TColor::GetColor("#01DF01"));
313 +  dR_nFSR->SetLineColor(TColor::GetColor("#FF4000"));
314 +  
315 +  TLegend *leg = new TLegend(0.7,0.7,0.89,0.89);
316 +  leg->SetFillColor(kWhite);
317 +  leg->AddEntry(dR_FSR,"FSR #gamma's","l");
318 +  leg->AddEntry(dR_nFSR,"non-FSR #gamma's","l");
319 +  
320 +  if(dR_nFSR->GetMinimum()<dR_FSR->GetMinimum()) dR_FSR->SetMinimum(dR_nFSR->GetMinimum());
321 +  if(dR_nFSR->GetMaximum()>dR_FSR->GetMaximum()) dR_FSR->SetMaximum(dR_nFSR->GetMaximum());
322 +  
323 +  
324 +  dR_FSR->Draw("histo");
325 +  dR_nFSR->Draw("same,histo");
326 +  leg->SetHeader("DY MC:");
327 +  leg->Draw("same,histo");
328 +  DrawMCPrelim();
329 +  
330 +  CompleteSave(can,"PhotonStudies/GenPhotons/CharacterizingFSRPhotons/"+saveas);
331 +  delete dR_FSR;
332 +  delete dR_nFSR;
333 +  delete can;
334 + }
335 +
336 +
337 + void GenPhotons::CharacterizingFSRPhotons() {
338 +  MakeCharacterizationPlot("min(genPhotonsdR1,genPhotonsdR2)",100,0,5,"min(#Delta R (#gamma,l_{1}), #Delta R (#gamma,l_{2}))", "MinDR");
339 +  MakeCharacterizationPlot("genPhotonsPt",100,0,100,"p_{T}^{#gamma}", "PhotonPt");
340 +  MakeCharacterizationPlot("genPhotonsEta",100,-5,5,"#eta^{#gamma}", "PhotonEta");
341 +  MakeCharacterizationPlot("genPhotonsPhi",40,-4,4,"#phi^{#gamma}", "PhotonPhi");
342 + }
343 +
344 + void GenPhotons::CompareGenJZBDistributions() {
345 +    TCanvas *can = new TCanvas("can","can");
346 +    can->SetLogy(1);
347 +    
348 +    TH1F *dR_FSR  = PhotonSamples.Draw("dR_FSR", "genFSRjzbG", 30, -30, 30, "JZB^{gen}", "events",BaseCut && TCut("abs(genFSRjzbG)>0.1"),   mc,PlottingSetup::luminosity);
349 +    TH1F *dR_nFSR = PhotonSamples.Draw("dR_nFSR", "genFSRjzb", 30, -30, 30, "JZB^{gen}", "events",BaseCut && TCut("abs(genFSRjzb)>0.1") , mc,PlottingSetup::luminosity);
350 +    
351 +    dR_FSR->SetLineColor(TColor::GetColor("#01DF01"));
352 +    dR_nFSR->SetLineColor(TColor::GetColor("#FF4000"));
353 +    
354 +    TLegend *leg = new TLegend(0.7,0.7,0.89,0.89);
355 +    leg->SetFillColor(kWhite);
356 +    leg->AddEntry(dR_FSR,"With FSR recovery","l");
357 +    leg->AddEntry(dR_nFSR,"Without FSR recovery","l");
358 +    
359 +    if(dR_nFSR->GetMinimum()<dR_FSR->GetMinimum()) dR_FSR->SetMinimum(dR_nFSR->GetMinimum());
360 +    if(dR_nFSR->GetMaximum()>dR_FSR->GetMaximum()) dR_FSR->SetMaximum(dR_nFSR->GetMaximum());
361 +    
362 +    
363 +    dR_FSR->Draw("histo");
364 +    dR_nFSR->Draw("same,histo");
365 +    leg->SetHeader("DY MC:");
366 +    leg->Draw("same,histo");
367 +    DrawMCPrelim();
368 +    
369 +    CompleteSave(can,"PhotonStudies/GenPhotons/GenJZBDistributions");
370 +    delete dR_FSR;
371 +    delete dR_nFSR;
372 +    delete can;
373 + }
374 +
375 + void GenPhotons::dR2DPlots() {
376 +    TCanvas *can = new TCanvas("can","can",1000,500);
377 +    can->Divide(2,1);
378 +    can->cd(1);
379 +    
380 +    vector<float> binX, binY;
381 +    for(int i=0;i<=31;i++) {
382 +        binX.push_back(i*0.1);
383 +        binY.push_back(i*0.1);
384 +    }
385 +    
386 +    TH2F *dR_FSR   = PhotonSamples.Draw("dR_FSR",  "genPhotonsdR1:genPhotonsdR2", binX,binY, "#Delta R (#gamma^{FSR},l_{1})","#Delta R (#gamma^{FSR},l_{2})",BaseCut && FSRcut   ,mc,PlottingSetup::luminosity, PhotonSamples.FindSample("o"),false);
387 +    TH2F *dR_nFSR  = PhotonSamples.Draw("dR_nFSR", "genPhotonsdR1:genPhotonsdR2", binX,binY, "#Delta R (#gamma^{non-FSR},l_{1})","#Delta R (#gamma^{non-FSR},l_{2})",BaseCut && NoFSRcut ,mc,PlottingSetup::luminosity, PhotonSamples.FindSample("o"),false);
388 +    
389 +    can->cd(1);
390 +    dR_FSR->Draw("COLZ");
391 +    DrawMCPrelim();
392 +    
393 +    can->cd(2);
394 +    dR_nFSR->Draw("COLZ");
395 +    DrawMCPrelim();
396 +    
397 +    CompleteSave(can,"PhotonStudies/GenPhotons/dR_in_2D");
398 +    delete dR_FSR;
399 +    delete dR_nFSR;
400 +    delete can;
401 + }
402 +
403 +
404 + void GenPhotons::EfficiencyPurity() {
405 +    TCanvas *can = new TCanvas("can","can");
406 +    vector<float> bindR, binPt;
407 +    for(int i=0;i<=100;i++) bindR.push_back(i*0.05);
408 +    binPt.push_back(0);binPt.push_back(10);binPt.push_back(50);binPt.push_back(100);binPt.push_back(1000);binPt.push_back(1010);
409 + //    binPt.push_back(0);binPt.push_back(1000);binPt.push_back(1001);
410 +    
411 +    
412 +    TGraph *purity[binPt.size()];
413 +    TGraph *efficiency[binPt.size()];
414 +    TGraph *purity_n_efficiency[binPt.size()];
415 +    TH1F *FSR[binPt.size()];
416 +    TH1F *Any[binPt.size()];
417 +    for(int i=1;i<binPt.size();i++) {
418 +       //do this for each pt range
419 +       float ptlow=binPt[i-1];
420 +       float pthi =binPt[i];
421 +       stringstream ptcut;
422 +       ptcut << "genPhotonsPt>" << ptlow << " && genPhotonsPt<" << pthi << " && min(genPhotonsdR1,genPhotonsdR2)<5";
423 +      
424 +       FSR[i-1]  = PhotonSamples.Draw("FSR", "min(genPhotonsdR1,genPhotonsdR2)", bindR,"min DR","events",TCut(ptcut.str().c_str()) && BaseCut && FSRcut ,mc,PlottingSetup::luminosity);
425 +       Any[i-1]  = PhotonSamples.Draw("Any", "min(genPhotonsdR1,genPhotonsdR2)", bindR,"min DR","events",TCut(ptcut.str().c_str()) && BaseCut  ,mc,PlottingSetup::luminosity);
426 +      
427 +       float NPhotons=0;
428 +       float NFSRPhotons=0;
429 +       float totalNFSRphotons=0;
430 +      
431 +       for(int k=1;k<FSR[i-1]->GetNbinsX();k++) totalNFSRphotons+=FSR[i-1]->GetBinContent(k);
432 +       purity[i-1]=new TGraph(FSR[i-1]->GetNbinsX());
433 +       efficiency[i-1]=new TGraph(FSR[i-1]->GetNbinsX());
434 +       purity_n_efficiency[i-1]=new TGraph(FSR[i-1]->GetNbinsX());
435 +       for(int j=1;j<=FSR[i-1]->GetNbinsX();j++) {
436 +         NPhotons+=(int)Any[i-1]->GetBinContent(j);
437 +         NFSRPhotons+=FSR[i-1]->GetBinContent(j);
438 + //            cout << "       ::::::::" << j << " : " << NPhotons << " : " << NFSRPhotons << " : " << totalNFSRphotons << endl;
439 +            if(NPhotons>0) purity[i-1]->SetPoint(j-1,FSR[i-1]->GetXaxis()->GetBinCenter(j)+FSR[i-1]->GetBinWidth(j),(float)NFSRPhotons/NPhotons);
440 +            else purity[i-1]->SetPoint(j-1,FSR[i-1]->GetXaxis()->GetBinCenter(j)+FSR[i-1]->GetBinWidth(j),-1);
441 +            if(totalNFSRphotons>0) efficiency[i-1]->SetPoint(j,FSR[i-1]->GetXaxis()->GetBinCenter(j)+FSR[i-1]->GetBinWidth(j),(float)NFSRPhotons/totalNFSRphotons);
442 +            else efficiency[i-1]->SetPoint(j-1,FSR[i-1]->GetXaxis()->GetBinCenter(j)+FSR[i-1]->GetBinWidth(j),-1);
443 +            if(totalNFSRphotons>0&&NPhotons>0) purity_n_efficiency[i-1]->SetPoint(j-1,(float)NFSRPhotons/totalNFSRphotons,(float)NFSRPhotons/NPhotons);
444 +        }
445 +        purity[i-1]->GetXaxis()->SetTitle("min(#Delta R(#gamma,l_{1}), #Delta R(#gamma,_{2}))");
446 +        purity[i-1]->GetXaxis()->CenterTitle();
447 +        purity[i-1]->GetYaxis()->SetTitle("purity");
448 +        purity[i-1]->GetYaxis()->CenterTitle();
449 +        
450 +        efficiency[i-1]->GetXaxis()->SetTitle("min(#Delta R(#gamma,l_{1}), #Delta R(#gamma,_{2}))");
451 +        efficiency[i-1]->GetXaxis()->CenterTitle();
452 +        efficiency[i-1]->GetYaxis()->SetTitle("efficiency");
453 +        efficiency[i-1]->GetYaxis()->CenterTitle();
454 +        
455 +        purity_n_efficiency[i-1]->GetXaxis()->SetTitle("efficiency");
456 +        purity_n_efficiency[i-1]->GetXaxis()->CenterTitle();
457 +        purity_n_efficiency[i-1]->GetYaxis()->SetTitle("purity");
458 +        purity_n_efficiency[i-1]->GetYaxis()->CenterTitle();
459 +    }
460 +    
461 +    TLegend *leg = make_legend();
462 +    
463 +    
464 +    for(int i=0;i<binPt.size()-2;i++) {
465 +        stringstream description;
466 +        description << binPt[i] << " < p_{T}^{#gamma} < " << binPt[i+1];
467 +        purity[i]->SetLineColor(i+1);
468 +        purity_n_efficiency[i]->SetLineColor(i+1);
469 +        efficiency[i]->SetLineColor(i+1);
470 +        leg->AddEntry(purity[i],description.str().c_str(),"l");
471 +    }
472 +
473 +    for(int i=0;i<binPt.size()-2;i++) {
474 +        if(i==0) purity[i]->Draw("AC");
475 +        else purity[i]->Draw("C");
476 +    }
477 +    leg->Draw();
478 +    CompleteSave(can,"PhotonStudies/GenPhotons/Purity");
479 +    
480 +    for(int i=0;i<binPt.size()-2;i++) {
481 +        if(i==0) efficiency[i]->Draw("AC");
482 +        else efficiency[i]->Draw("C");
483 +    }
484 +    leg->Draw();
485 +    CompleteSave(can,"PhotonStudies/GenPhotons/Efficiency");
486 +    
487 +    for(int i=0;i<binPt.size()-1;i++) {
488 +        if(i==0) purity_n_efficiency[i]->Draw("AC");
489 +        else purity_n_efficiency[i]->Draw("C");
490 +    }
491 +    leg->SetX2(0.8);
492 +    leg->SetX1(0.65);
493 +    leg->SetY1(0.1);
494 +    leg->SetY2(0.6);
495 +    leg->Draw();
496 +    CompleteSave(can,"PhotonStudies/GenPhotons/Purity_n_efficiency");
497 + }
498 +
499 +
500   void GenPhotons::GenLevelStudies() {
501 +    TCut essential_bkp = essentialcut;
502 +    essentialcut=TCut("");
503 +    
504    CompareZmassToFinalStateLeptons();
505 +  NumberOfPhotonsPerEvent();
506 +  CharacterizingFSRPhotons();
507 +  CompareGenJZBDistributions();
508 +
509 +  dR2DPlots();
510 +    
511 +  EfficiencyPurity();
512    
513 <  
513 >  essentialcut=essential_bkp;
514   }
515  
516   void InitializePhotonSamples() {
517    float ZJetsCrossSection         = 3532.8;
518    float LowZJetsCrossSection      = 11050*0.069*1.15; // LO xs * filter eff * k-factor (same as ZJets)
519  
520 <  PhotonSamples.AddSample("/shome/buchmann/ntuples/MC8tev/PhotonStudies/DYJetsToLL_M-50_TuneZ2Star_8TeV-madgraph-tarball-Summer12_DR53X-PU_S10_START53_V7A-v1.root","Z+Jets",-30346766,ZJetsCrossSection,false,false,1,kYellow);
521 <  PhotonSamples.AddSample("//shome/buchmann/ntuples/MC8tev/PhotonStudies/DYJetsToLL_M-10To50filter_8TeV-madgraph-Summer12_DR53X-PU_S10_START53_V7A-v1.root","Z+Jets",-6955271,LowZJetsCrossSection,false,false,1,kYellow);
520 >  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);
521 >  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);
522    
523    write_info(__FUNCTION__,"Photon samples have been initialized!");
524    PhotonSamples.ListSamples();
525    
526 +  GenPhotons::FSRcut   = TCut("genPhotonsIsFSR");
527 +  GenPhotons::NoFSRcut = TCut("!genPhotonsIsFSR");
528 +  GenPhotons::BaseCut = TCut("genNjets>=3 && genPhotonsPt > 5 && NgenLeps>0");
529   }
530  
531   void FSRstudy() {
532    InitializePhotonSamples();
533    
534 <  GenPhotons::GenLevelStudies();
534 > //  GenPhotons::GenLevelStudies();
535    RecoPhotons::RecoLevelStudies();
536   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines