]>
Commit | Line | Data |
---|---|---|
809a4336 | 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 | **************************************************************************/ | |
50685501 | 15 | // |
16 | // Class for TOF PID | |
17 | // Implements the abstract base class AliHFEpidBase | |
18 | // IsInitialized() does the PID decision | |
19 | // | |
20 | // Authors: | |
21 | // Markus Fasel <M.Fasel@gsi.de> | |
22 | // Matus Kalisky <matus.kalisky@cern.ch> (contact) | |
23 | // | |
809a4336 | 24 | |
809a4336 | 25 | #include <TMath.h> |
26 | ||
722347d8 | 27 | #include "AliAODTrack.h" |
809a4336 | 28 | #include "AliESDtrack.h" |
809a4336 | 29 | #include "AliPID.h" |
8c1c76e9 | 30 | #include "AliPIDResponse.h" |
809a4336 | 31 | |
3a72645a | 32 | #include "AliHFEdetPIDqa.h" |
809a4336 | 33 | #include "AliHFEpidTOF.h" |
3a72645a | 34 | #include "AliHFEpidQAmanager.h" |
809a4336 | 35 | |
36 | ||
37 | ClassImp(AliHFEpidTOF) | |
3a72645a | 38 | |
39 | //___________________________________________________________________ | |
40 | AliHFEpidTOF::AliHFEpidTOF(): | |
41 | AliHFEpidBase() | |
3a72645a | 42 | , fNsigmaTOF(3) |
4437a0d2 | 43 | , fUseOnlyIfAvailable(kFALSE) |
44 | , fRejectMismatch(kFALSE) | |
3a72645a | 45 | { |
46 | // | |
47 | // Constructor | |
48 | // | |
11ff28c5 | 49 | |
5cd679b7 | 50 | memset(fSigmaBordersTOFLower, 0, sizeof(Float_t) * 12); |
51 | memset(fSigmaBordersTOFUpper, 0, sizeof(Float_t) * 12); | |
3a72645a | 52 | } |
53 | ||
809a4336 | 54 | //___________________________________________________________________ |
55 | AliHFEpidTOF::AliHFEpidTOF(const Char_t *name): | |
56 | AliHFEpidBase(name) | |
9bcfd1ab | 57 | , fNsigmaTOF(3) |
4437a0d2 | 58 | , fUseOnlyIfAvailable(kFALSE) |
59 | , fRejectMismatch(kFALSE) | |
809a4336 | 60 | { |
61 | // | |
62 | // Constructor | |
63 | // | |
5cd679b7 | 64 | memset(fSigmaBordersTOFLower, 0, sizeof(Float_t) * 12); |
65 | memset(fSigmaBordersTOFUpper, 0, sizeof(Float_t) * 12); | |
3024f297 | 66 | |
809a4336 | 67 | } |
3a72645a | 68 | |
809a4336 | 69 | //___________________________________________________________________ |
70 | AliHFEpidTOF::AliHFEpidTOF(const AliHFEpidTOF &c): | |
71 | AliHFEpidBase("") | |
9bcfd1ab | 72 | , fNsigmaTOF(3) |
4437a0d2 | 73 | , fUseOnlyIfAvailable(kFALSE) |
74 | , fRejectMismatch(kFALSE) | |
809a4336 | 75 | { |
76 | // | |
77 | // Copy operator | |
78 | // | |
79 | ||
80 | c.Copy(*this); | |
81 | } | |
82 | //___________________________________________________________________ | |
83 | AliHFEpidTOF &AliHFEpidTOF::operator=(const AliHFEpidTOF &ref){ | |
84 | // | |
85 | // Assignment operator | |
86 | // | |
87 | ||
88 | if(this != &ref){ | |
89 | ref.Copy(*this); | |
90 | } | |
91 | ||
92 | return *this; | |
93 | } | |
94 | //___________________________________________________________________ | |
95 | AliHFEpidTOF::~AliHFEpidTOF(){ | |
96 | // | |
97 | // Destructor | |
98 | // | |
809a4336 | 99 | } |
100 | //___________________________________________________________________ | |
101 | void AliHFEpidTOF::Copy(TObject &ref) const { | |
102 | // | |
103 | // Performs the copying of the object | |
104 | // | |
105 | AliHFEpidTOF &target = dynamic_cast<AliHFEpidTOF &>(ref); | |
106 | ||
e3fc062d | 107 | target.fNsigmaTOF = fNsigmaTOF; |
4437a0d2 | 108 | target.fUseOnlyIfAvailable = fUseOnlyIfAvailable; |
109 | target.fRejectMismatch = fRejectMismatch; | |
5cd679b7 | 110 | memcpy(target.fSigmaBordersTOFLower, fSigmaBordersTOFLower, sizeof(Float_t) * 12); |
111 | memcpy(target.fSigmaBordersTOFUpper, fSigmaBordersTOFUpper, sizeof(Float_t) * 12); | |
809a4336 | 112 | |
113 | AliHFEpidBase::Copy(ref); | |
114 | } | |
115 | //___________________________________________________________________ | |
8c1c76e9 | 116 | Bool_t AliHFEpidTOF::InitializePID(Int_t /*run*/){ |
809a4336 | 117 | // |
118 | // InitializePID: TOF experts have to implement code here | |
119 | // | |
120 | return kTRUE; | |
121 | } | |
122 | ||
123 | //___________________________________________________________________ | |
6555e2ad | 124 | Int_t AliHFEpidTOF::IsSelected(const AliHFEpidObject *track, AliHFEpidQAmanager *pidqa) const |
809a4336 | 125 | { |
faee3b18 | 126 | // |
127 | // TOF PID based on n-Sigma cut | |
128 | // Selects Protons and Kaons via n-sigma cut up to 3 GeV/c | |
129 | // In addition histos for n-sigma before (all species) and after (only closest species) are filled | |
130 | // | |
8c1c76e9 | 131 | if(!fkPIDResponse) return 0; |
3a72645a | 132 | AliDebug(2, "PID object available"); |
e3fc062d | 133 | |
bf892a6a | 134 | const AliVTrack *vtrack = dynamic_cast<const AliVTrack *>(track->GetRecTrack()); |
4437a0d2 | 135 | if(!vtrack) return 0; |
136 | Bool_t hasTOFpid = vtrack->GetStatus() & AliESDtrack::kTOFpid; | |
137 | if(fUseOnlyIfAvailable && !hasTOFpid){ | |
138 | AliDebug(2, "No TOF PID, but PID required only if available"); | |
139 | return 11; | |
140 | } else if(!hasTOFpid){ | |
141 | AliDebug(2, "No TOF PID, and TOF PID is required always"); | |
142 | return 0; | |
143 | } | |
3a72645a | 144 | AliDebug(2, "Track Has TOF PID"); |
145 | ||
4437a0d2 | 146 | if(fRejectMismatch){ |
147 | if(IsMismatch(vtrack)) return 0; | |
148 | } | |
149 | ||
3a72645a | 150 | if(pidqa) pidqa->ProcessTrack(track, AliHFEpid::kTOFpid, AliHFEdetPIDqa::kBeforePID); |
faee3b18 | 151 | |
152 | // Fill before selection | |
8c1c76e9 | 153 | Double_t sigEle = fkPIDResponse->NumberOfSigmasTOF(track->GetRecTrack(), AliPID::kElectron); |
3a72645a | 154 | AliDebug(2, Form("Number of sigmas in TOF: %f", sigEle)); |
faee3b18 | 155 | Int_t pdg = 0; |
11ff28c5 | 156 | if(TestBit(kSigmaBand)){ |
5cd679b7 | 157 | Int_t centrality = track->IsPbPb() ? track->GetCentrality() + 1 : 0; |
158 | AliDebug(2, Form("Centrality: %d\n", centrality)); | |
159 | if(centrality > 11) return kFALSE; | |
160 | if(sigEle > fSigmaBordersTOFLower[centrality] && sigEle < fSigmaBordersTOFUpper[centrality]) pdg = 11; | |
11ff28c5 | 161 | } else { |
162 | // Fixed nsigma cut | |
163 | if(TMath::Abs(sigEle) < fNsigmaTOF) pdg = 11; | |
faee3b18 | 164 | } |
11ff28c5 | 165 | |
166 | if(pdg == 11 && pidqa) pidqa->ProcessTrack(track, AliHFEpid::kTOFpid, AliHFEdetPIDqa::kAfterPID); | |
faee3b18 | 167 | |
168 | return pdg; | |
169 | } | |
5cd679b7 | 170 | //___________________________________________________________________ |
959ea9d8 | 171 | void AliHFEpidTOF::SetTOFnSigmaBand(Float_t lower, Float_t upper) |
172 | { | |
173 | // | |
174 | // Lower and higher cut independant of the centrality | |
175 | // | |
176 | ||
177 | for(Int_t k=0; k < 12; k++) { | |
178 | fSigmaBordersTOFLower[k] = lower; | |
179 | fSigmaBordersTOFUpper[k] = upper; | |
180 | } | |
181 | ||
182 | SetBit(kSigmaBand, kTRUE); | |
183 | ||
184 | } | |
185 | //___________________________________________________________________ | |
5cd679b7 | 186 | void AliHFEpidTOF::SetTOFnSigmaBandCentrality(Float_t lower, Float_t upper, Int_t centralityBin) |
187 | { | |
188 | // | |
189 | // Lower and higher cut as function of centrality | |
190 | // | |
191 | ||
192 | if(centralityBin < 11) { | |
193 | fSigmaBordersTOFLower[centralityBin+1] = lower; | |
194 | fSigmaBordersTOFUpper[centralityBin+1] = upper; | |
195 | } | |
196 | ||
197 | SetBit(kSigmaBand, kTRUE); | |
198 | ||
199 | } | |
722347d8 | 200 | |
4437a0d2 | 201 | //___________________________________________________________________ |
202 | Bool_t AliHFEpidTOF::IsMismatch(const AliVTrack * const track) const { | |
203 | // | |
204 | // Check for mismatch | |
205 | // | |
206 | if(!fkPIDResponse) return kFALSE; | |
207 | Double_t probs[AliPID::kSPECIESC]; | |
208 | AliPIDResponse::EDetPidStatus status = fkPIDResponse->ComputeTOFProbability(track, AliPID::kSPECIESC, probs); | |
209 | return status == AliPIDResponse::kDetMismatch; | |
210 | } |