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.3 by buchmann, Mon Oct 15 22:12:14 2012 UTC vs.
Revision 1.4 by buchmann, Fri Nov 2 19:03:18 2012 UTC

# Line 22 | Line 22 | namespace GenPhotons {
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 >    
32 >  TCut FSRcut;
33 >  TCut NoFSRcut;
34 >  TCut BaseCut;
35 > }
36 >
37 > void RecoPhotons::NumberOfPhotonsPerEvent() {
38 >    cout << __FUNCTION__ << " not implemented." << endl;
39 > }
40 >
41 > void RecoPhotons::CharacterizingFSRPhotons() {
42 >    cout << __FUNCTION__ << " not implemented." << endl;
43 > }
44 >
45 > void RecoPhotons::dR2DPlots() {
46 >    cout << __FUNCTION__ << " not implemented." << endl;
47 > }
48 >
49 > void RecoPhotons::MakeCharacterizationPlot(string variable, int nbins, float min, float max, string label, string saveas) {
50 >    cout << __FUNCTION__ << " not implemented." << endl;
51 > }
52 >
53 > void RecoPhotons::CompareRecoJZBDistributions() {
54 >    cout << __FUNCTION__ << " not implemented." << endl;
55 > }
56 >
57 > void RecoPhotons::EfficiencyPurity() {
58 >    cout << __FUNCTION__ << " not implemented." << endl;
59 > }
60 >
61 > void CompareZmassToFinalStateLeptons() {
62 >    cout << __FUNCTION__ << " not implemented." << endl;
63   }
64  
65   void RecoPhotons::RecoLevelStudies() {
66    cout << "RecoLevelStudies have not been implemented yet" << endl;
67 +  TCut essential_bkp = essentialcut;
68 +  essentialcut=TCut("");
69 +    
70 +  CompareZmassToFinalStateLeptons();
71 +  NumberOfPhotonsPerEvent();
72 +  CharacterizingFSRPhotons();
73 +  CompareRecoJZBDistributions();
74 +    
75 +  dR2DPlots();
76 +    
77 +  EfficiencyPurity();
78 +    
79 +  essentialcut=essential_bkp;
80   }
81  
82  
# Line 53 | Line 102 | void GenPhotons::CompareZmassToFinalStat
102    leg->Draw("same,histo");
103    DrawMCPrelim();
104    
105 <  CompleteSave(can,"PhotonStudies/CompareZmassToFinalStateLeptons");
105 >  CompleteSave(can,"PhotonStudies/GenPhotons/CompareZmassToFinalStateLeptons");
106    delete can;
107   }  
108  
# Line 79 | Line 128 | void GenPhotons::NumberOfPhotonsPerEvent
128      leg->Draw("same,histo");
129      DrawMCPrelim();
130      
131 <    CompleteSave(can,"PhotonStudies/NPhotons");
131 >    CompleteSave(can,"PhotonStudies/GenPhotons/NPhotons");
132      
133      
134      TH1F *PhotonPt[10];
# Line 91 | Line 140 | void GenPhotons::NumberOfPhotonsPerEvent
140      
141      TLegend *leg2 = make_legend();
142      for(int i=0;i<10;i++) {
94        cout << PhotonPt[i]->Integral() << endl;
143          if(PhotonPt[i]->Integral()>50) {
144              PhotonPt[i]->SetLineColor(DrawCounter+1);
145              leg2->AddEntry(PhotonPt[i],(any2string(i)+" FSR Photons").c_str(),"l");
# Line 106 | Line 154 | void GenPhotons::NumberOfPhotonsPerEvent
154      leg2->SetHeader("DY MC (N_{jets} #geq 0):");
155      DrawMCPrelim();
156      
157 <    CompleteSave(can,"PhotonStudies/PhotonPtvsNPhotons");
157 >    CompleteSave(can,"PhotonStudies/GenPhotons/PhotonPtvsNPhotons");
158      
159      delete can;
160   }
# Line 136 | Line 184 | void GenPhotons::MakeCharacterizationPlo
184    leg->Draw("same,histo");
185    DrawMCPrelim();
186    
187 <  CompleteSave(can,"PhotonStudies/CharacterizingFSRPhotons/"+saveas);
187 >  CompleteSave(can,"PhotonStudies/GenPhotons/CharacterizingFSRPhotons/"+saveas);
188    delete dR_FSR;
189    delete dR_nFSR;
190    delete can;
# Line 146 | Line 194 | void GenPhotons::MakeCharacterizationPlo
194   void GenPhotons::CharacterizingFSRPhotons() {
195    MakeCharacterizationPlot("min(genPhotonsdR1,genPhotonsdR2)",100,0,5,"min(#Delta R (#gamma,l_{1}), #Delta R (#gamma,l_{2}))", "MinDR");
196    MakeCharacterizationPlot("genPhotonsPt",100,0,100,"p_{T}^{#gamma}", "PhotonPt");
197 <  MakeCharacterizationPlot("genPhotonsEta",100,-5,5,"{#eta}^{#gamma}", "PhotonEta");
198 <  MakeCharacterizationPlot("genPhotonsPhi",100,0,4,"{#phi}^{#gamma}", "PhotonPhi");
151 <  MakeCharacterizationPlot("genPhotonsM",100,0,2,"m^{#gamma}", "PhotonM");
197 >  MakeCharacterizationPlot("genPhotonsEta",100,-5,5,"#eta^{#gamma}", "PhotonEta");
198 >  MakeCharacterizationPlot("genPhotonsPhi",40,-4,4,"#phi^{#gamma}", "PhotonPhi");
199   }
200  
201   void GenPhotons::CompareGenJZBDistributions() {
# Line 176 | Line 223 | void GenPhotons::CompareGenJZBDistributi
223      leg->Draw("same,histo");
224      DrawMCPrelim();
225      
226 <    CompleteSave(can,"PhotonStudies/GenJZBDistributions");
226 >    CompleteSave(can,"PhotonStudies/GenPhotons/GenJZBDistributions");
227      delete dR_FSR;
228      delete dR_nFSR;
229      delete can;
# Line 204 | Line 251 | void GenPhotons::dR2DPlots() {
251      dR_nFSR->Draw("COLZ");
252      DrawMCPrelim();
253      
254 <    CompleteSave(can,"PhotonStudies/dR_in_2D");
254 >    CompleteSave(can,"PhotonStudies/GenPhotons/dR_in_2D");
255      delete dR_FSR;
256      delete dR_nFSR;
257      delete can;
# Line 213 | Line 260 | void GenPhotons::dR2DPlots() {
260  
261   void GenPhotons::EfficiencyPurity() {
262      TCanvas *can = new TCanvas("can","can");
216    cout << "Computing efficiency and purity !" << endl;
263      vector<float> bindR, binPt;
264      for(int i=0;i<=100;i++) bindR.push_back(i*0.05);
265      binPt.push_back(0);binPt.push_back(10);binPt.push_back(50);binPt.push_back(100);binPt.push_back(1000);binPt.push_back(1010);
# Line 240 | Line 286 | void GenPhotons::EfficiencyPurity() {
286         float totalNFSRphotons=0;
287        
288         for(int k=1;k<FSR[i-1]->GetNbinsX();k++) totalNFSRphotons+=FSR[i-1]->GetBinContent(k);
243       cout << i << " : " << totalNFSRphotons << " FSR photons in pt range " << ptlow << " , " << pthi << endl;
289         purity[i-1]=new TGraph(FSR[i-1]->GetNbinsX());
290         efficiency[i-1]=new TGraph(FSR[i-1]->GetNbinsX());
291         purity_n_efficiency[i-1]=new TGraph(FSR[i-1]->GetNbinsX());
# Line 254 | Line 299 | void GenPhotons::EfficiencyPurity() {
299              else efficiency[i-1]->SetPoint(j-1,FSR[i-1]->GetXaxis()->GetBinCenter(j)+FSR[i-1]->GetBinWidth(j),-1);
300              if(totalNFSRphotons>0&&NPhotons>0) purity_n_efficiency[i-1]->SetPoint(j-1,(float)NFSRPhotons/totalNFSRphotons,(float)NFSRPhotons/NPhotons);
301          }
302 <        cout << "Done for pt range" << endl;
302 >        purity[i-1]->GetXaxis()->SetTitle("min(#Delta R(#gamma,l_{1}), #Delta R(#gamma,_{2}))");
303 >        purity[i-1]->GetXaxis()->CenterTitle();
304 >        purity[i-1]->GetYaxis()->SetTitle("purity");
305 >        purity[i-1]->GetYaxis()->CenterTitle();
306 >        
307 >        efficiency[i-1]->GetXaxis()->SetTitle("min(#Delta R(#gamma,l_{1}), #Delta R(#gamma,_{2}))");
308 >        efficiency[i-1]->GetXaxis()->CenterTitle();
309 >        efficiency[i-1]->GetYaxis()->SetTitle("efficiency");
310 >        efficiency[i-1]->GetYaxis()->CenterTitle();
311 >        
312 >        purity_n_efficiency[i-1]->GetXaxis()->SetTitle("efficiency");
313 >        purity_n_efficiency[i-1]->GetXaxis()->CenterTitle();
314 >        purity_n_efficiency[i-1]->GetYaxis()->SetTitle("purity");
315 >        purity_n_efficiency[i-1]->GetYaxis()->CenterTitle();
316      }
317 <    cout << "Done with graphs" << endl;
318 < //    cout << "Artificially aborting ... " << endl;return;
319 <    for(int i=0;i<binPt.size()-1;i++) {
320 <      cout << "About to draw purity for i=" << i << endl;
321 <      cout << "( this corresponds to the Pt range from " << binPt[i] << " to " << binPt[i+1] << ")" << endl;
317 >    
318 >    TLegend *leg = make_legend();
319 >    
320 >    
321 >    for(int i=0;i<binPt.size()-2;i++) {
322 >        stringstream description;
323 >        description << binPt[i] << " < p_{T}^{#gamma} < " << binPt[i+1];
324 >        purity[i]->SetLineColor(i+1);
325 >        purity_n_efficiency[i]->SetLineColor(i+1);
326 >        efficiency[i]->SetLineColor(i+1);
327 >        leg->AddEntry(purity[i],description.str().c_str(),"l");
328 >    }
329 >
330 >    for(int i=0;i<binPt.size()-2;i++) {
331          if(i==0) purity[i]->Draw("AC");
332          else purity[i]->Draw("C");
333      }
334 <    CompleteSave(can,"PhotonStudies/Purity");
334 >    leg->Draw();
335 >    CompleteSave(can,"PhotonStudies/GenPhotons/Purity");
336      
337 <    for(int i=0;i<binPt.size()-1;i++) {
270 <      cout << "About to draw efficiency for i=" << i << endl;
337 >    for(int i=0;i<binPt.size()-2;i++) {
338          if(i==0) efficiency[i]->Draw("AC");
339          else efficiency[i]->Draw("C");
340      }
341 <    CompleteSave(can,"PhotonStudies/Efficiency");
341 >    leg->Draw();
342 >    CompleteSave(can,"PhotonStudies/GenPhotons/Efficiency");
343      
344      for(int i=0;i<binPt.size()-1;i++) {
345          if(i==0) purity_n_efficiency[i]->Draw("AC");
346          else purity_n_efficiency[i]->Draw("C");
347      }
348 <    CompleteSave(can,"PhotonStudies/Purity_n_efficiency");
348 >    leg->SetX2(0.8);
349 >    leg->SetX1(0.65);
350 >    leg->SetY1(0.1);
351 >    leg->SetY2(0.6);
352 >    leg->Draw();
353 >    CompleteSave(can,"PhotonStudies/GenPhotons/Purity_n_efficiency");
354   }
355  
356  
# Line 285 | Line 358 | void GenPhotons::GenLevelStudies() {
358      TCut essential_bkp = essentialcut;
359      essentialcut=TCut("");
360      
361 < //  CompareZmassToFinalStateLeptons();
362 < //  NumberOfPhotonsPerEvent();
363 < //  CharacterizingFSRPhotons();
364 < //  CompareGenJZBDistributions();
365 < //  dR2DPlots();
361 >  CompareZmassToFinalStateLeptons();
362 >  NumberOfPhotonsPerEvent();
363 >  CharacterizingFSRPhotons();
364 >  CompareGenJZBDistributions();
365 >
366 >  dR2DPlots();
367      
368    EfficiencyPurity();
369    
# Line 314 | Line 388 | void InitializePhotonSamples() {
388   void FSRstudy() {
389    InitializePhotonSamples();
390    
391 <  GenPhotons::GenLevelStudies();
391 > //  GenPhotons::GenLevelStudies();
392    RecoPhotons::RecoLevelStudies();
393   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines