Changes for #95543: request to commit to trunk: TOF code supporting PID for light...
[u/mrichter/AliRoot.git] / STEER / AOD / AliAODpidUtil.h
CommitLineData
1423bac9 1#ifndef ALIAODPIDUTIL_H
2#define ALIAODPIDUTIL_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id: AliAODpidUtil.h 38493 2010-01-26 16:33:03Z hristov $ */
7
8//-------------------------------------------------------
9// Combined PID class
10// for the AOD class
11// Origin: Rosa Romita, GSI, r.romita@gsi.de
9006fe9c 12// Modified: Jens Wiechula, Uni Tuebingen, jens.wiechula@cern.ch
b79db598 13// Modified: Pietro Antonioli, INFN BO, pietro.antonioli@bo.infn.it
1423bac9 14//-------------------------------------------------------
15#include <Rtypes.h>
16#include <TMatrixD.h>
b79db598 17#include "AliAODEvent.h" // Needed for inline functions
1423bac9 18#include "AliAODTrack.h" // Needed for inline functions
19#include "AliAODPid.h" // Needed for inline functions
b79db598 20#include "AliTOFHeader.h" //Needed for inline functions
1423bac9 21//#include "HMPID/AliHMPID.h"
22
9006fe9c 23#include "AliPIDResponse.h"
24
1423bac9 25class AliAODEvent;
9006fe9c 26class AliVParticle;
1423bac9 27
9006fe9c 28class AliAODpidUtil : public AliPIDResponse {
1423bac9 29public:
9006fe9c 30 //TODO: isMC???
ea235c90 31 AliAODpidUtil(Bool_t isMC = kFALSE): AliPIDResponse(isMC) {;}
1423bac9 32 virtual ~AliAODpidUtil() {;}
33
03945936 34 Int_t MakePID(const AliAODTrack *track,Double_t *p) const;
5e6a3170 35 void MakeTPCPID(const AliAODTrack *track,Double_t *p) const;
36 void MakeITSPID(const AliAODTrack *track,Double_t *p) const;
37 void MakeTOFPID(const AliAODTrack *track,Double_t *p) const;
1423bac9 38 // void MakeHMPIDPID(AliESDtrack *track);
5e6a3170 39 void MakeTRDPID(const AliAODTrack *track,Double_t *p) const;
1423bac9 40
9006fe9c 41 virtual Float_t NumberOfSigmasTOF(const AliVParticle *vtrack, AliPID::EParticleType type) const;
42
1423bac9 43private:
01f931c1 44
ea235c90 45 ClassDef(AliAODpidUtil,3) // PID calculation class
1423bac9 46};
47
9006fe9c 48inline Float_t AliAODpidUtil::NumberOfSigmasTOF(const AliVParticle *vtrack, AliPID::EParticleType type) const {
49 AliAODTrack *track=(AliAODTrack*)vtrack;
67376d1d 50 Double_t sigTOF;
9006fe9c 51 AliAODPid *pidObj = track->GetDetPid();
52 if (!pidObj) return -999.;
b79db598 53 Double_t tofTime=pidObj->GetTOFsignal();
67376d1d 54 Double_t expTime=fTOFResponse.GetExpectedSignal((AliVTrack*)vtrack,type);
b79db598 55 AliAODEvent *event=(AliAODEvent*)track->GetAODEvent();
67376d1d 56 AliTOFHeader* tofH=(AliTOFHeader*)event->GetTOFHeader();
57 if (tofH) { // new AOD
58 sigTOF=fTOFResponse.GetExpectedSigma(track->P(),expTime,AliPID::ParticleMassZ(type)); //fTOFResponse is set in InitialiseEvent
59 tofTime -= fTOFResponse.GetStartTime(vtrack->P());
60 } else { // old AOD
61 if (type <= AliPID::kProton) {
62 Double_t sigmaTOFPid[AliPID::kSPECIES];
63 pidObj->GetTOFpidResolution(sigmaTOFPid);
64 sigTOF=sigmaTOFPid[type];
65 } else return -998.; // light nuclei cannot be supported on old AOD because we don't have timeZero resolution
b79db598 66 }
67376d1d 67 if (sigTOF>0) return (tofTime - expTime)/sigTOF;
68 else return -997.;
9006fe9c 69}
70
1423bac9 71#endif
72
73