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 **************************************************************************/
17 // Implements the abstract base class AliHFEpidBase
18 // IsInitialized() does the PID decision
21 // Markus Fasel <M.Fasel@gsi.de>
22 // Matus Kalisky <matus.kalisky@cern.ch> (contact)
27 #include "AliAODpidUtil.h"
28 #include "AliAODTrack.h"
29 #include "AliESDpid.h"
30 #include "AliESDtrack.h"
33 #include "AliHFEdetPIDqa.h"
34 #include "AliHFEpidTOF.h"
35 #include "AliHFEpidQAmanager.h"
38 ClassImp(AliHFEpidTOF)
40 //___________________________________________________________________
41 AliHFEpidTOF::AliHFEpidTOF():
51 //___________________________________________________________________
52 AliHFEpidTOF::AliHFEpidTOF(const Char_t *name):
62 //___________________________________________________________________
63 AliHFEpidTOF::AliHFEpidTOF(const AliHFEpidTOF &c):
74 //___________________________________________________________________
75 AliHFEpidTOF &AliHFEpidTOF::operator=(const AliHFEpidTOF &ref){
77 // Assignment operator
86 //___________________________________________________________________
87 AliHFEpidTOF::~AliHFEpidTOF(){
93 //___________________________________________________________________
94 void AliHFEpidTOF::Copy(TObject &ref) const {
96 // Performs the copying of the object
98 AliHFEpidTOF &target = dynamic_cast<AliHFEpidTOF &>(ref);
101 target.fNsigmaTOF = fNsigmaTOF;
103 AliHFEpidBase::Copy(ref);
105 //___________________________________________________________________
106 Bool_t AliHFEpidTOF::InitializePID(){
108 // InitializePID: TOF experts have to implement code here
113 //___________________________________________________________________
114 Int_t AliHFEpidTOF::IsSelected(const AliHFEpidObject *track, AliHFEpidQAmanager *pidqa) const
117 // TOF PID based on n-Sigma cut
118 // Selects Protons and Kaons via n-sigma cut up to 3 GeV/c
119 // In addition histos for n-sigma before (all species) and after (only closest species) are filled
121 if((!fESDpid && track->IsESDanalysis()) || (!fAODpid && track->IsAODanalysis())) return 0;
122 AliDebug(2, "PID object available");
124 AliHFEpidObject::AnalysisType_t anaType = track->IsESDanalysis() ? AliHFEpidObject::kESDanalysis : AliHFEpidObject::kAODanalysis;
125 if(!((dynamic_cast<const AliVTrack *>(track->GetRecTrack()))->GetStatus() & AliESDtrack::kTOFpid)) return 0;
126 AliDebug(2, "Track Has TOF PID");
128 if(pidqa) pidqa->ProcessTrack(track, AliHFEpid::kTOFpid, AliHFEdetPIDqa::kBeforePID);
130 // Fill before selection
131 Double_t sigEle = NumberOfSigmas(track->GetRecTrack(), AliPID::kElectron, anaType);
132 AliDebug(2, Form("Number of sigmas in TOF: %f", sigEle));
134 if(TMath::Abs(sigEle) < fNsigmaTOF){
136 if(pidqa) pidqa->ProcessTrack(track, AliHFEpid::kTOFpid, AliHFEdetPIDqa::kAfterPID);
142 /////////////////////////////////////////////////////////
144 // Wrappers for functions which are not virtual but
145 // only available for ESD and AOD case separately
147 /////////////////////////////////////////////////////////
149 //___________________________________________________________________
150 Double_t AliHFEpidTOF::NumberOfSigmas(const AliVParticle *track, AliPID::EParticleType species, AliHFEpidObject::AnalysisType_t anaType) const {
152 // Get the number of sigmas
154 Double_t nSigmas = 100;
155 if(anaType == AliHFEpidObject::kESDanalysis){
157 const AliESDtrack *esdtrack = dynamic_cast<const AliESDtrack *>(track);
158 if(esdtrack && fESDpid) nSigmas = fESDpid->NumberOfSigmasTOF(esdtrack, species, fESDpid->GetTOFResponse().GetTimeZero());
160 const AliAODTrack *aodtrack = dynamic_cast<const AliAODTrack *>(track);
161 if(aodtrack && fAODpid) nSigmas = fAODpid->NumberOfSigmasTOF(aodtrack, species);
166 //___________________________________________________________________
167 Double_t AliHFEpidTOF::GetTOFsignal(const AliVParticle *track, AliHFEpidObject::AnalysisType_t anatype) const{
169 // Get the TOF signal
171 Double_t tofSignal = 0.;
172 if(anatype == AliHFEpidObject::kESDanalysis){
174 const AliESDtrack *esdtrack = dynamic_cast<const AliESDtrack *>(track);
175 tofSignal = esdtrack->GetTOFsignal();
177 const AliAODTrack *aodtrack = dynamic_cast<const AliAODTrack *>(track);
178 tofSignal = aodtrack->GetDetPid() ? aodtrack->GetDetPid()->GetTOFsignal() : 0.;
183 //___________________________________________________________________
184 Double_t AliHFEpidTOF::GetTime0(AliHFEpidObject::AnalysisType_t anatype) const{
189 if(anatype == AliHFEpidObject::kESDanalysis){
190 time0 = fESDpid->GetTOFResponse().GetTimeZero();
192 time0 = fAODpid->GetTOFResponse().GetTimeZero();
197 //___________________________________________________________________
198 void AliHFEpidTOF::GetIntegratedTimes(const AliVParticle *track, Double_t *times, AliHFEpidObject::AnalysisType_t anatype) const{
200 // Return integrated times
202 if(anatype == AliHFEpidObject::kESDanalysis){
204 const AliESDtrack *esdtrack = dynamic_cast<const AliESDtrack *>(track);
205 esdtrack->GetIntegratedTimes(times);
207 const AliAODTrack *aodtrack = dynamic_cast<const AliAODTrack *>(track);
208 aodtrack->GetDetPid()->GetIntegratedTimes(times);