]>
Commit | Line | Data |
---|---|---|
3b7aa4ba | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | //Obtain single particle efficiencies from output AliAnalysisTaskDiHadron (when ran over MC events and MC histograms filled) | |
16 | //Author: Jason Glyndwr Ulery, ulery@uni-frankfurt.de | |
17 | ||
18 | ||
19 | ||
20 | #ifndef __CINT__ | |
21 | #include <TF1.h> | |
22 | #include <TF2.h> | |
23 | #include "TSystem.h" | |
24 | #include <iostream> | |
25 | #include <TH1.h> | |
26 | #include <TH2.h> | |
27 | #include <TH3.h> | |
28 | #include <TRandom.h> | |
29 | #include <fstream> | |
30 | #include "TList.h" | |
31 | #include "TArrayF.h" | |
32 | #endif | |
33 | ||
34 | void SingleEff(int Cent){ | |
35 | gROOT->Reset(); | |
36 | gROOT->LoadMacro("Util9.C"); | |
37 | Style(1); | |
38 | ||
39 | ||
40 | // char *EffFolder="2010-08-13/7Pythia_LHC10b5"; | |
41 | char *EffFolder="2010-08-13/LHC10c6_900Pythia"; | |
42 | ||
43 | char effName[100]; | |
44 | sprintf(effName,"%s/julery_DiHadron.root",EffFolder); | |
45 | TFile *effFile=new TFile(effName); | |
46 | TList *effList=effFile->Get("julery_DiHadron"); | |
47 | ||
48 | char name[100]; | |
49 | sprintf(name,"fHistPtEff_C%d",Cent); | |
50 | TH1F *fHistPt=(TH1F*)effList->FindObject(name); | |
51 | sprintf(name,"fHistPtEff_C%d_MC",Cent); | |
52 | TH1F *fHistPtMC=(TH1F*)effList->FindObject(name); | |
53 | ||
54 | TH1F *fHistEff=(TH1F*)fHistPt->Clone(); | |
55 | fHistEff->SetName("fHistEff"); | |
56 | fHistEff->GetYaxis()->SetTitle("Efficiency+Contamination"); | |
57 | fHistEff->SetTitle(""); | |
58 | fHistEff->Divide(fHistPtMC); | |
59 | ||
60 | c1=new TCanvas("c1","",800,600); | |
61 | fHistEff->Draw(); | |
62 | fHistEff->SetMaximum(1); | |
63 | fHistEff->SetMinimum(0); | |
64 | fHistEff->GetXaxis()->SetRange(0,100); | |
65 | //c1->SetLogx(1); | |
66 | //TF1 *fit1=new TF1("fit1","[0]+[1]*x+[2]*x**2+[3]*x**3+[4]*x**4+[5]*x**5",0,100); | |
67 | //fit1->SetParameters(0.8,0.001,0.001,0.001,0.001,0.001) | |
68 | fit2=new TF1("fit2","[0]",3,100); | |
69 | fit2->SetParameter(0,0.8); | |
70 | TF1 *fit3=new TF1("fit3","[0]/[1]*exp(-0.5*pow(x/[1],2))+[2]+[3]*x",0,3); | |
71 | fit3->SetParameters(0.1,0.1,1,0.1,0.1,0.1); | |
72 | fit3->SetParLimits(0,-2,0); | |
73 | fit3->SetLineColor(4); | |
74 | fHistEff->Fit(fit3,"r"); | |
75 | fit2->SetLineColor(2); | |
76 | fHistEff->Fit(fit2,"r"); | |
77 | fit3->Draw("same"); | |
78 | sprintf(name,"%s/SingleEff1_%d.gif",EffFolder,Cent); | |
79 | c1->SaveAs(name); | |
80 | c2=new TCanvas("c2","",800,600); | |
81 | fHistEff->GetXaxis()->SetRange(0,30); | |
82 | fHistEff->Draw(); | |
83 | fit2->Draw("same"); | |
84 | fit3->Draw("same"); | |
85 | sprintf(name,"%s/SingleEff2_%d.gif",EffFolder,Cent); | |
86 | c2->SaveAs(name); | |
87 | ||
88 | cout << fit3->GetParameter(0) << ", " << fit3->GetParameter(1) << ", " << fit3->GetParameter(2) << ", " << fit3->GetParameter(3) << endl; | |
89 | cout << fit2->GetParameter(0) << endl; | |
90 | ||
91 | } |