]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/hfe/AliHFEpidBayes.cxx
Updates
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliHFEpidBayes.cxx
CommitLineData
8c1c76e9 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//
16// Class for Bayesian PID
17// Implements the abstract base class AliHFEpidBase
18//
19// Class contains Bayesian specific cuts and QA histograms
20// several detectors added for combined PID
21//
22//
23// Authors:
24//
25// Yvonne Pachmayer <pachmay@physi.uni-heidelberg.de>
26//
27#include <TF1.h>
28#include <TMath.h>
29
30#include "AliAODPid.h"
31#include "AliAODTrack.h"
32#include "AliAODMCParticle.h"
33#include "AliESDtrack.h"
34#include "AliExternalTrackParam.h"
35#include "AliLog.h"
36#include "AliMCParticle.h"
37#include "AliPID.h"
38#include "AliPIDResponse.h"
39#include "AliPIDCombined.h"
40
41#include "AliHFEpidTPC.h"
42#include "AliHFEpidTOF.h"
43#include "AliHFEpidTRD.h"
44#include "AliHFEpidBayes.h"
45#include "AliHFEpidQAmanager.h"
46
47ClassImp(AliHFEpidBayes)
48
49//___________________________________________________________________
50AliHFEpidBayes::AliHFEpidBayes() :
51 // add a list here
52 AliHFEpidBase()
53 , fPIDCombined(NULL)
54 , fDetMask(10)
55 , fDetMaskDefault(10)
56 , fDetMaskDefaultandTRD(14)
57 , fpidthres(0.9)
58{
59 //
60 // default constructor
61 //
62
63
64}
65
66//___________________________________________________________________
67AliHFEpidBayes::AliHFEpidBayes(const char* name) :
68 // add a list here
69 AliHFEpidBase(name)
70 , fPIDCombined(NULL)
71 , fDetMask(10)
72 , fDetMaskDefault(10)
73 , fDetMaskDefaultandTRD(14)
74 , fpidthres(0.9)
75{
76 //
77 // default constructor
78 //
79 //
80
81}
82
83//____________________________________________________________
84AliHFEpidBayes::AliHFEpidBayes(const AliHFEpidBayes &ref):
85 AliHFEpidBase("")
86 , fPIDCombined(NULL)
87 , fDetMask(10)
88 , fDetMaskDefault(10)
89 , fDetMaskDefaultandTRD(14)
90 , fpidthres(0.9)
91{
92 //
93 // Copy constructor
94 //
95 ref.Copy(*this);
96}
97
98//____________________________________________________________
99AliHFEpidBayes &AliHFEpidBayes::operator=(const AliHFEpidBayes &ref){
100 //
101 // Make assignment
102 //
103 if(this != &ref){
104 ref.Copy(*this);
105 }
106 return *this;
107}
108
109//___________________________________________________________________
110AliHFEpidBayes::~AliHFEpidBayes(){
111 //
112 // Destructor
113 //
114}
115
116//___________________________________________________________________
117void AliHFEpidBayes::Copy(TObject &ref) const {
118 //
119 // Performs the copying of the object
120 //
121 AliHFEpidBayes &target = dynamic_cast<AliHFEpidBayes &>(ref);
122
123 target.fPIDCombined = fPIDCombined;
124 target.fDetMask = fDetMask;
125 target.fDetMaskDefault = fDetMaskDefault;
126 target.fDetMaskDefaultandTRD = fDetMaskDefaultandTRD;
127 target.fpidthres = fpidthres;
128
129 AliHFEpidBase::Copy(ref);
130
131}
132
133//___________________________________________________________________
134Bool_t AliHFEpidBayes::InitializePID(Int_t /*run*/){
135 //
136 // Initialize Bayes PID
137 //
138
139 fPIDCombined=new AliPIDCombined;
140 fDetMaskDefault=AliPIDResponse::kDetTPC+AliPIDResponse::kDetTOF;
141 fDetMaskDefaultandTRD=AliPIDResponse::kDetTPC+AliPIDResponse::kDetTOF+AliPIDResponse::kDetTRD;
142 return kTRUE;
143}
144
145//___________________________________________________________________
146Int_t AliHFEpidBayes::IsSelected(const AliHFEpidObject *track, AliHFEpidQAmanager *pidqa) const
147{
148 //
149 // identification of electrons via Bayes pid
150 //
151
152 if(pidqa) pidqa->ProcessTrack(track, AliHFEpid::kBAYESpid, AliHFEdetPIDqa::kBeforePID);
153 AliDebug(1, "Doing Bayes PID based");
154
155 if (!fkPIDResponse)
156 {
157 AliFatal("This Task needs the PID response attached to the inputHandler");
158 return 0;
159 }
160
161 Bool_t used=kFALSE;
162 Bool_t usedTOF=kFALSE;
163 Bool_t usedTPC=kFALSE;
164 Bool_t usedTRD=kFALSE;
165
166
167
168 if((fDetMask==fDetMaskDefault)||(fDetMask==fDetMaskDefaultandTRD))
169 {
170 Double_t probTPC[AliPID::kSPECIES]={0.};
aa1417ee 171 usedTPC = fkPIDResponse->ComputePIDProbability(AliPIDResponse::kDetTPC,(AliVTrack*)track->GetRecTrack(),AliPID::kSPECIES,probTPC) == AliPIDResponse::kDetPidOk;
8c1c76e9 172 Double_t probTOF[AliPID::kSPECIES]={0.};
aa1417ee 173 usedTOF = fkPIDResponse->ComputePIDProbability(AliPIDResponse::kDetTOF,(AliVTrack*)track->GetRecTrack(),AliPID::kSPECIES,probTOF) == AliPIDResponse::kDetPidOk;
8c1c76e9 174 if((usedTOF==1)&&(usedTPC==1)) used=1;
175 else used=0;
176
177 if(fDetMask==fDetMaskDefaultandTRD)
178 {
179 Double_t probTRD[AliPID::kSPECIES]={0.};
aa1417ee 180 usedTRD = fkPIDResponse->ComputePIDProbability(AliPIDResponse::kDetTRD,(AliVTrack*)track->GetRecTrack(),AliPID::kSPECIES,probTRD) == AliPIDResponse::kDetPidOk;
8c1c76e9 181 if((usedTOF==1)&&(usedTPC==1)&&(usedTRD==1)) used=1;
182 else used=0;
183 }
184 }
185
186
187
188
189 Double_t fprobComb[AliPID::kSPECIES]={0.};
190 CalcCombProb(track,fkPIDResponse, fprobComb);
191
192 Int_t pdg=0;
193 if(fprobComb[AliPID::kElectron]>fpidthres) pdg=11;
194
195 if((pidqa) && (pdg==11) && (used==1)) pidqa->ProcessTrack(track, AliHFEpid::kBAYESpid, AliHFEdetPIDqa::kAfterPID);
196
197 return pdg;
198
199
200}
201
202void AliHFEpidBayes::CalcCombProb(const AliHFEpidObject *track,const AliPIDResponse *fPIDResponse, Double_t* fprobTPCTOF) const
203{
204 //
205 // The name says it all
206 //
207
208 for(Int_t i=0;i<AliPID::kSPECIES;i++)
209 {
210 fprobTPCTOF[i]=0.;
211 }
212 fPIDCombined->SetEnablePriors(kFALSE);
213 fPIDCombined->SetDetectorMask(fDetMask);
214
215 fPIDCombined->ComputeProbabilities((AliVTrack*)track->GetRecTrack(), fPIDResponse, fprobTPCTOF);
216
217}
218