1 /*************************************************************************
2 * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 // -----------------------------------------------
17 // particle level cuts for azimuthal isotropic
18 // expansion in highly central collisions analysis
19 // author: Cristian Andrei
20 // acristian@niham.nipne.ro
21 // ------------------------------------------------
26 #include "AliAnalysisCentralCutESD.h"
27 #include "AliESDtrack.h"
34 //____________________________________________________________________
35 ClassImp(AliAnalysisCentralCutESD)
37 //____________________________________________________________________
38 AliAnalysisCentralCutESD::AliAnalysisCentralCutESD(const Char_t* name, const Char_t* title)
39 :AliAnalysisCuts(name,title)
53 // Initialize the priors
54 fPartPriors[0] = 0.01;
55 fPartPriors[1] = 0.01;
56 fPartPriors[2] = 0.85;
58 fPartPriors[4] = 0.05;
61 TFile *f = TFile::Open("$ALICE_ROOT/PWG2/data/PriorProbabilities.root ");
63 printf("Can't open PWG2 prior probabilities file!\n Exiting ...\n");
66 fElectronFunction = (TF1 *)f->Get("fitElectrons");
67 fMuonFunction = (TF1 *)f->Get("fitMuons");
68 fPionFunction = (TF1 *)f->Get("fitPions");
69 fKaonFunction = (TF1 *)f->Get("fitKaons");
70 fProtonFunction = (TF1 *)f->Get("fitProtons");
75 AliAnalysisCentralCutESD::~AliAnalysisCentralCutESD() {
77 // Delete the created priors
80 if(fElectronFunction) delete fElectronFunction;
81 if(fMuonFunction) delete fMuonFunction;
82 if(fPionFunction) delete fPionFunction;
83 if(fKaonFunction) delete fKaonFunction;
84 if(fProtonFunction) delete fProtonFunction;
89 Bool_t AliAnalysisCentralCutESD::IsSelected(TObject *obj){
90 // Checks if a particle passes the cuts
92 AliESDtrack *track = dynamic_cast<AliESDtrack *>(obj);
95 printf("AliAnalysisCentralCutESD:IsSelected ->Can't get track!\n");
100 if(!IsCharged(track)) return kFALSE;
104 if(!IsA(track, fPartType)) return kFALSE;
111 Double_t AliAnalysisCentralCutESD::GetPriors(Int_t i, Double_t p) {
112 //Return the a priori probs
116 if(i == 0) priors = fElectronFunction->Eval(p);
117 if(i == 1) priors = fMuonFunction->Eval(p);
118 if(i == 2) priors = fPionFunction->Eval(p);
119 if(i == 3) priors = fKaonFunction->Eval(p);
120 if(i == 4) priors = fProtonFunction->Eval(p);
123 priors = fPartPriors[i];
131 Bool_t AliAnalysisCentralCutESD::IsA(AliESDtrack *track, PDG_t reqPartType){
132 // Determines the type of the particle
142 Double_t probability[5] = {0.0,0.0,0.0,0.0,0.0};
143 Double_t w[5] = {0.0,0.0,0.0,0.0,0.0};
145 Long64_t partType = 0;
147 Double_t p = track->P();
149 track->GetESDpid(probability);
154 for(Int_t i = 0; i < AliPID::kSPECIES; i++){
155 s += probability[i]*GetPriors(i,p);
159 for(Int_t i = 0; i < AliPID::kSPECIES; i++){
160 w[i] = probability[i]*GetPriors(i,p)/s;
165 if(fPIDtype.Contains("Bayesian")) {
166 partType = TMath::LocMax(AliPID::kSPECIES,w);
167 if(partType<0.) return kFALSE;
170 else if(fPIDtype.Contains("Custom")){
171 for(Int_t i=0;i<AliPID::kSPECIES;i++) {
179 printf("Unknown PID method!\n");
186 else { // then here partType >=0 so ok for ParticleCode !
187 if((AliPID::ParticleCode(partType)) != reqPartType) return kFALSE;
189 if(track->Charge() != charge) return kFALSE;
195 Bool_t AliAnalysisCentralCutESD::IsCharged(AliESDtrack* const track) const{
197 if(track->Charge() == 0) return kFALSE;