1 /**************************************************************************
2 * Copyright(c) 1998-1999, 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 **************************************************************************/
20 // Implements the abstract base class AliHFEpidBase
21 // IsInitialized() does the PID decision
24 // Markus Fasel <M.Fasel@gsi.de>
25 // Matus Kalisky <matus.kalisky@cern.ch> (contact)
30 #include "AliAODpidUtil.h"
31 #include "AliAODTrack.h"
32 #include "AliESDpid.h"
33 #include "AliESDtrack.h"
36 #include "AliHFEdetPIDqa.h"
37 #include "AliHFEpidTOF.h"
38 #include "AliHFEpidQAmanager.h"
41 ClassImp(AliHFEpidTOF)
43 //___________________________________________________________________
44 AliHFEpidTOF::AliHFEpidTOF():
54 //___________________________________________________________________
55 AliHFEpidTOF::AliHFEpidTOF(const Char_t *name):
65 //___________________________________________________________________
66 AliHFEpidTOF::AliHFEpidTOF(const AliHFEpidTOF &c):
77 //___________________________________________________________________
78 AliHFEpidTOF &AliHFEpidTOF::operator=(const AliHFEpidTOF &ref){
80 // Assignment operator
89 //___________________________________________________________________
90 AliHFEpidTOF::~AliHFEpidTOF(){
96 //___________________________________________________________________
97 void AliHFEpidTOF::Copy(TObject &ref) const {
99 // Performs the copying of the object
101 AliHFEpidTOF &target = dynamic_cast<AliHFEpidTOF &>(ref);
104 target.fNsigmaTOF = fNsigmaTOF;
106 AliHFEpidBase::Copy(ref);
108 //___________________________________________________________________
109 Bool_t AliHFEpidTOF::InitializePID(){
111 // InitializePID: TOF experts have to implement code here
116 //___________________________________________________________________
117 Int_t AliHFEpidTOF::IsSelected(const AliHFEpidObject *track, AliHFEpidQAmanager *pidqa) const
120 // TOF PID based on n-Sigma cut
121 // Selects Protons and Kaons via n-sigma cut up to 3 GeV/c
122 // In addition histos for n-sigma before (all species) and after (only closest species) are filled
124 if((!fESDpid && track->IsESDanalysis()) || (!fAODpid && track->IsAODanalysis())) return 0;
125 AliDebug(2, "PID object available");
127 AliHFEpidObject::AnalysisType_t anaType = track->IsESDanalysis() ? AliHFEpidObject::kESDanalysis : AliHFEpidObject::kAODanalysis;
128 const AliVTrack *vtrack = dynamic_cast<const AliVTrack *>(track->GetRecTrack());
129 if(!(vtrack && (vtrack->GetStatus() & AliESDtrack::kTOFpid))) return 0;
130 AliDebug(2, "Track Has TOF PID");
132 if(pidqa) pidqa->ProcessTrack(track, AliHFEpid::kTOFpid, AliHFEdetPIDqa::kBeforePID);
134 // Fill before selection
135 Double_t sigEle = NumberOfSigmas(track->GetRecTrack(), AliPID::kElectron, anaType);
136 AliDebug(2, Form("Number of sigmas in TOF: %f", sigEle));
138 if(TMath::Abs(sigEle) < fNsigmaTOF){
140 if(pidqa) pidqa->ProcessTrack(track, AliHFEpid::kTOFpid, AliHFEdetPIDqa::kAfterPID);
146 /////////////////////////////////////////////////////////
148 // Wrappers for functions which are not virtual but
149 // only available for ESD and AOD case separately
151 /////////////////////////////////////////////////////////
153 //___________________________________________________________________
154 Double_t AliHFEpidTOF::NumberOfSigmas(const AliVParticle *track, AliPID::EParticleType species, AliHFEpidObject::AnalysisType_t anaType) const {
156 // Get the number of sigmas
158 Double_t nSigmas = 100;
159 if(anaType == AliHFEpidObject::kESDanalysis){
161 const AliESDtrack *esdtrack = dynamic_cast<const AliESDtrack *>(track);
162 if(esdtrack && fESDpid) nSigmas = fESDpid->NumberOfSigmasTOF(esdtrack, species, 0.);
164 const AliAODTrack *aodtrack = dynamic_cast<const AliAODTrack *>(track);
165 if(aodtrack && fAODpid) nSigmas = fAODpid->NumberOfSigmasTOF(aodtrack, species);
170 //___________________________________________________________________
171 Double_t AliHFEpidTOF::GetTOFsignal(const AliVParticle *track, AliHFEpidObject::AnalysisType_t anatype) const{
173 // Get the TOF signal
175 Double_t tofSignal = 0.;
176 if(anatype == AliHFEpidObject::kESDanalysis){
178 const AliESDtrack *esdtrack = dynamic_cast<const AliESDtrack *>(track);
179 if(esdtrack) tofSignal = esdtrack->GetTOFsignal();
181 const AliAODTrack *aodtrack = dynamic_cast<const AliAODTrack *>(track);
182 if(aodtrack) tofSignal = aodtrack->GetDetPid() ? aodtrack->GetDetPid()->GetTOFsignal() : 0.;
187 //___________________________________________________________________
188 Double_t AliHFEpidTOF::GetTime0(AliHFEpidObject::AnalysisType_t anatype) const{
193 if(anatype == AliHFEpidObject::kESDanalysis){
194 time0 = fESDpid->GetTOFResponse().GetTimeZero();
196 time0 = fAODpid->GetTOFResponse().GetTimeZero();
201 //___________________________________________________________________
202 void AliHFEpidTOF::GetIntegratedTimes(const AliVParticle *track, Double_t *times, AliHFEpidObject::AnalysisType_t anatype) const{
204 // Return integrated times
206 if(anatype == AliHFEpidObject::kESDanalysis){
208 const AliESDtrack *esdtrack = dynamic_cast<const AliESDtrack *>(track);
209 if(esdtrack) esdtrack->GetIntegratedTimes(times);
211 const AliAODTrack *aodtrack = dynamic_cast<const AliAODTrack *>(track);
212 if(aodtrack) aodtrack->GetDetPid()->GetIntegratedTimes(times);