]>
Commit | Line | Data |
---|---|---|
bde49c8a | 1 | /************************************************************************* |
2 | * Copyright(c) 1998-2008, 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 | ||
8a993eac | 16 | // *************************************************** |
17 | // * particle level cuts for azimuthal isotropic * | |
bde49c8a | 18 | // * expansion in highly central collisions analysis * |
8a993eac | 19 | // * author: Cristian Andrei * |
20 | // * acristian@niham.nipne.ro * | |
21 | // *************************************************** | |
bde49c8a | 22 | |
bde49c8a | 23 | #include <TFile.h> |
8a993eac | 24 | #include <TF1.h> |
bde49c8a | 25 | |
bde49c8a | 26 | #include "AliESDtrack.h" |
27 | ||
8a993eac | 28 | #include "AliAnalysisCentralCutESD.h" |
bde49c8a | 29 | |
30 | //____________________________________________________________________ | |
31 | ClassImp(AliAnalysisCentralCutESD) | |
32 | ||
33 | //____________________________________________________________________ | |
34 | AliAnalysisCentralCutESD::AliAnalysisCentralCutESD(const Char_t* name, const Char_t* title) | |
35 | :AliAnalysisCuts(name,title) | |
36 | ,fReqPID(kFALSE) | |
37 | ,fReqCharge(kFALSE) | |
38 | ,fPartType(kPiPlus) | |
39 | ,fPIDtype("Custom") | |
40 | ,fPriorsFunc(kFALSE) | |
41 | ,fPartPriors() | |
42 | ,fElectronFunction(0) | |
43 | ,fMuonFunction(0) | |
44 | ,fPionFunction(0) | |
45 | ,fKaonFunction(0) | |
46 | ,fProtonFunction(0) | |
47 | { | |
48 | // Constructor | |
49 | // Initialize the priors | |
50 | fPartPriors[0] = 0.01; | |
51 | fPartPriors[1] = 0.01; | |
52 | fPartPriors[2] = 0.85; | |
53 | fPartPriors[3] = 0.1; | |
54 | fPartPriors[4] = 0.05; | |
55 | ||
56 | if(fPriorsFunc){ | |
57 | TFile *f = TFile::Open("$ALICE_ROOT/PWG2/data/PriorProbabilities.root "); | |
58 | if(!f){ | |
59 | printf("Can't open PWG2 prior probabilities file!\n Exiting ...\n"); | |
8a993eac | 60 | return; |
bde49c8a | 61 | } |
62 | fElectronFunction = (TF1 *)f->Get("fitElectrons"); | |
63 | fMuonFunction = (TF1 *)f->Get("fitMuons"); | |
64 | fPionFunction = (TF1 *)f->Get("fitPions"); | |
65 | fKaonFunction = (TF1 *)f->Get("fitKaons"); | |
66 | fProtonFunction = (TF1 *)f->Get("fitProtons"); | |
67 | } | |
68 | ||
69 | } | |
70 | ||
71 | AliAnalysisCentralCutESD::~AliAnalysisCentralCutESD() { | |
72 | // Destructor | |
73 | // Delete the created priors | |
74 | ||
75 | if(fPartPriors) delete [] fPartPriors; | |
76 | ||
77 | if(fElectronFunction) delete fElectronFunction; | |
78 | if(fMuonFunction) delete fMuonFunction; | |
79 | if(fPionFunction) delete fPionFunction; | |
80 | if(fKaonFunction) delete fKaonFunction; | |
81 | if(fProtonFunction) delete fProtonFunction; | |
82 | } | |
83 | ||
84 | ||
85 | Bool_t AliAnalysisCentralCutESD::IsSelected(TObject *obj){ | |
86 | // Checks if a particle passes the cuts | |
87 | ||
88 | AliESDtrack *track = dynamic_cast<AliESDtrack *>(obj); | |
89 | ||
90 | if(!track){ | |
91 | printf("AliAnalysisCentralCutESD:IsSelected ->Can't get track!\n"); | |
8a993eac | 92 | return kFALSE; |
bde49c8a | 93 | } |
94 | ||
95 | if(fReqCharge){ | |
96 | if(!IsCharged(track)) return kFALSE; | |
97 | } | |
98 | ||
99 | if(fReqPID){ | |
8a993eac | 100 | if(!IsA(track, fPartType)) return kFALSE; |
bde49c8a | 101 | } |
102 | ||
103 | return kTRUE; | |
104 | } | |
105 | ||
106 | ||
107 | Double_t AliAnalysisCentralCutESD::GetPriors(Int_t i, Double_t p) { | |
108 | //Return the a priori probs | |
109 | ||
110 | Double_t priors=0; | |
111 | if(fPriorsFunc) { | |
112 | if(i == 0) priors = fElectronFunction->Eval(p); | |
113 | if(i == 1) priors = fMuonFunction->Eval(p); | |
114 | if(i == 2) priors = fPionFunction->Eval(p); | |
115 | if(i == 3) priors = fKaonFunction->Eval(p); | |
116 | if(i == 4) priors = fProtonFunction->Eval(p); | |
117 | } | |
118 | else { | |
119 | priors = fPartPriors[i]; | |
120 | } | |
121 | ||
122 | return priors; | |
123 | } | |
124 | ||
125 | ||
126 | ||
127 | Bool_t AliAnalysisCentralCutESD::IsA(AliESDtrack *track, PDG_t fPartType){ | |
128 | // Determines the type of the particle | |
129 | ||
130 | Double_t probability[5]; | |
131 | Double_t w[5]; | |
132 | ||
133 | Long64_t partType = 0; | |
134 | ||
135 | Double_t p = track->P(); | |
136 | ||
137 | track->GetESDpid(probability); | |
138 | ||
139 | Double_t s = 0.0; | |
140 | ||
141 | ||
142 | for(Int_t i = 0; i < AliPID::kSPECIES; i++){ | |
143 | s += probability[i]*GetPriors(i,p); | |
144 | } | |
145 | ||
146 | if(!s < 0.000001) { | |
147 | for(Int_t i = 0; i < AliPID::kSPECIES; i++){ | |
148 | w[i] = probability[i]*GetPriors(i,p)/s; | |
149 | } | |
150 | } | |
151 | ||
152 | ||
153 | if(fPIDtype.Contains("Bayesian")) { | |
154 | partType = TMath::LocMax(AliPID::kSPECIES,w); | |
155 | } | |
156 | ||
157 | else if(fPIDtype.Contains("Custom")){ | |
158 | for(Int_t i=0;i<AliPID::kSPECIES;i++) { | |
159 | if(w[i]>0.9){ | |
160 | partType = i; | |
161 | } | |
162 | } | |
163 | } | |
164 | ||
165 | else{ | |
166 | printf("Unknown PID method!\n"); | |
8a993eac | 167 | return kFALSE; |
bde49c8a | 168 | } |
169 | ||
170 | if((AliPID::ParticleCode(partType)) != fPartType){ | |
171 | return kFALSE; | |
172 | } | |
173 | ||
174 | ||
175 | return kTRUE; | |
176 | ||
177 | } | |
178 | ||
179 | Bool_t AliAnalysisCentralCutESD::IsCharged(AliESDtrack* const track) const{ | |
180 | ||
181 | if(track->Charge() == 0) return kFALSE; | |
182 | ||
183 | return kTRUE; | |
184 | ||
185 | } |