29bf19f2 |
1 | #ifndef ALIPIDRESPONSE_H |
2 | #define ALIPIDRESPONSE_H |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
4 | * See cxx source for full Copyright notice */ |
5 | |
6 | //---------------------------------------------------------------// |
7 | // Base class for handling the pid response // |
8 | // functions of all detectors // |
9 | // and give access to the nsigmas // |
10 | // // |
11 | // Origin: Jens Wiechula, Uni Tuebingen, jens.wiechula@cern.ch // |
12 | //---------------------------------------------------------------// |
13 | |
14 | #include "AliITSPIDResponse.h" |
15 | #include "AliTPCPIDResponse.h" |
16 | #include "AliTRDPIDResponse.h" |
17 | #include "AliTOFPIDResponse.h" |
18 | |
19 | #include "AliVParticle.h" |
20 | #include "AliVTrack.h" |
21 | |
22 | #include "TNamed.h" |
23 | |
24 | class AliVEvent; |
25 | |
26 | class AliPIDResponse : public TNamed { |
27 | public: |
28 | AliPIDResponse(Bool_t isMC=kFALSE) : fITSResponse(isMC), fTPCResponse(), fTRDResponse(), fTOFResponse() {;} |
29 | virtual ~AliPIDResponse() {;} |
30 | |
31 | enum EStartTimeType_t {kFILL_T0,kTOF_T0, kT0_T0, kBest_T0}; |
32 | |
33 | AliITSPIDResponse &GetITSResponse() {return fITSResponse;} |
34 | AliTPCPIDResponse &GetTPCResponse() {return fTPCResponse;} |
35 | AliTOFPIDResponse &GetTOFResponse() {return fTOFResponse;} |
36 | AliTRDPIDResponse &GetTRDResponse() {return fTRDResponse;} |
37 | |
38 | virtual Float_t NumberOfSigmasITS(const AliVParticle *track, AliPID::EParticleType type) const; |
39 | virtual Float_t NumberOfSigmasTPC(const AliVParticle *track, AliPID::EParticleType type) const; |
40 | virtual Float_t NumberOfSigmasTOF(const AliVParticle *track, AliPID::EParticleType type) const = 0; |
41 | |
42 | void SetTOFResponse(AliVEvent */*event*/,EStartTimeType_t /*option*/) {;} |
43 | |
44 | protected: |
45 | AliITSPIDResponse fITSResponse; //PID response function of the ITS |
46 | AliTPCPIDResponse fTPCResponse; //PID response function of the TPC |
47 | AliTRDPIDResponse fTRDResponse; //PID response function of the TRD |
48 | AliTOFPIDResponse fTOFResponse; //PID response function of the TOF |
49 | |
50 | ClassDef(AliPIDResponse,1); //PID response handling |
51 | }; |
52 | |
53 | inline Float_t AliPIDResponse::NumberOfSigmasTPC(const AliVParticle *vtrack, AliPID::EParticleType type) const { |
54 | AliVTrack *track=(AliVTrack*)vtrack; |
55 | Double_t mom = track->GetTPCmomentum(); |
56 | Double_t sig = track->GetTPCsignal(); |
57 | UInt_t sigN = track->GetTPCsignalN(); |
58 | |
59 | Double_t nSigma = -999.; |
60 | if (sigN>0) nSigma=fTPCResponse.GetNumberOfSigmas(mom,sig,sigN,type); |
61 | |
62 | return nSigma; |
63 | } |
64 | |
65 | inline Float_t AliPIDResponse::NumberOfSigmasITS(const AliVParticle *vtrack, AliPID::EParticleType type) const { |
66 | AliVTrack *track=(AliVTrack*)vtrack; |
67 | Float_t dEdx=track->GetITSsignal(); |
68 | if (dEdx<=0) return -999.; |
69 | |
70 | UChar_t clumap=track->GetITSClusterMap(); |
71 | Int_t nPointsForPid=0; |
72 | for(Int_t i=2; i<6; i++){ |
73 | if(clumap&(1<<i)) ++nPointsForPid; |
74 | } |
75 | Float_t mom=track->P(); |
76 | Bool_t isSA=kTRUE; |
77 | if(track->GetTPCNcls()>0) isSA=kFALSE; |
78 | return fITSResponse.GetNumberOfSigmas(mom,dEdx,type,nPointsForPid,isSA); |
79 | } |
80 | |
81 | #endif |