]>
Commit | Line | Data |
---|---|---|
e8a6457a | 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 | **************************************************************************/ | |
15 | /* | |
16 | * ITS PID class | |
17 | * checks ITS PID based on ITS dE/dx truncated mean | |
18 | * | |
19 | * Authors: Matus Kalisky <matus.kalisky@cern.ch> | |
20 | * Markus Fasel <M.Fasel@gsi.de> | |
21 | * | |
22 | */ | |
23 | #include <TH2F.h> | |
24 | #include <TList.h> | |
25 | #include <TMath.h> | |
26 | ||
27 | #include "AliESDtrack.h" | |
28 | #include "AliLog.h" | |
29 | #include "AliPID.h" | |
30 | #include "AliVParticle.h" | |
31 | ||
32 | #include "AliHFEpidITS.h" | |
33 | ||
34 | //___________________________________________________________________ | |
35 | AliHFEpidITS::AliHFEpidITS(const Char_t *name): | |
36 | AliHFEpidBase(name) | |
37 | , fQAlist(0x0) | |
38 | { | |
39 | // | |
40 | // Default constructor | |
41 | // | |
42 | } | |
43 | ||
44 | //___________________________________________________________________ | |
45 | AliHFEpidITS::AliHFEpidITS(const AliHFEpidITS &ref): | |
46 | AliHFEpidBase("") | |
47 | , fQAlist(0x0) | |
48 | { | |
49 | // | |
50 | // Copy constructor | |
51 | // | |
52 | ref.Copy(*this); | |
53 | } | |
54 | ||
55 | //___________________________________________________________________ | |
56 | AliHFEpidITS &AliHFEpidITS::operator=(const AliHFEpidITS &ref){ | |
57 | // | |
58 | // Assignment operator | |
59 | // | |
60 | if(this != &ref) ref.Copy(*this); | |
61 | return *this; | |
62 | } | |
63 | ||
64 | //___________________________________________________________________ | |
65 | AliHFEpidITS::~AliHFEpidITS(){ | |
66 | // | |
67 | // Destructor | |
68 | // | |
69 | if(fQAlist){ | |
70 | fQAlist->Clear(); | |
71 | delete fQAlist; | |
72 | } | |
73 | } | |
74 | ||
75 | //___________________________________________________________________ | |
76 | void AliHFEpidITS::Copy(TObject &o) const { | |
77 | // | |
78 | // Copy function | |
79 | // Provides a deep copy | |
80 | // | |
81 | AliHFEpidITS &target = dynamic_cast<AliHFEpidITS &>(o); | |
82 | ||
83 | target.fQAlist = dynamic_cast<TList *>(fQAlist->Clone()); | |
84 | AliHFEpidBase::Copy(target); | |
85 | } | |
86 | ||
87 | //___________________________________________________________________ | |
88 | Bool_t AliHFEpidITS::InitializePID(){ | |
89 | // | |
90 | // ITS PID initialization | |
91 | // | |
92 | return kTRUE; | |
93 | } | |
94 | ||
95 | ||
96 | //___________________________________________________________________ | |
97 | Int_t AliHFEpidITS::IsSelected(AliVParticle * /*track*/){ | |
98 | // | |
99 | // Does PID decision for ITS | |
100 | // | |
101 | return 11; // @TODO: Implement ITS PID decision | |
102 | } | |
103 | ||
104 | //___________________________________________________________________ | |
105 | void AliHFEpidITS::AddQAhistograms(TList *l){ | |
106 | // | |
107 | // Adding QA histograms for ITS PID | |
108 | // | |
109 | // QA histograms are: | |
110 | // - all Particles ITS signal vs. p (both methods) | |
111 | // - single particle ITS signal vs. p (both methods) | |
112 | // | |
113 | if(!fQAlist) fQAlist = new TList; | |
114 | fQAlist->SetName("fITSqaHistograms"); | |
115 | ||
116 | // prepare axis | |
117 | const Int_t kMomentumBins = 41; | |
118 | const Double_t kPtMin = 0.1; | |
119 | const Double_t kPtMax = 10.; | |
120 | const Int_t kSigBins = 300; | |
121 | Double_t momentumBins[kMomentumBins]; | |
122 | for(Int_t ibin = 0; ibin < kMomentumBins; ibin++) | |
123 | momentumBins[ibin] = static_cast<Double_t>(TMath::Power(10,TMath::Log10(kPtMin) + (TMath::Log10(kPtMax)-TMath::Log10(kPtMin))/(kMomentumBins-1)*static_cast<Double_t>(ibin))); | |
124 | ||
125 | TH2 *histo = NULL; | |
126 | fQAlist->AddAt((histo = new TH2F("fITSsigV1all", "ITS signal vs. p (all species, Method1):p / GeV/c:ITS signal / a.u.", kMomentumBins - 1, momentumBins, kSigBins, 0., kSigBins)), kITSsigV1); | |
127 | fQAlist->AddAt((histo = new TH2F("fITSsigV2all", "ITS signal vs. p (all species, Method2):p / GeV/c:ITS signal / a.u.", kMomentumBins - 1, momentumBins, kSigBins, 0., kSigBins)), kITSsigV2); | |
128 | for(Int_t ispec = 0; ispec < AliPID::kSPECIES; ispec++){ | |
129 | fQAlist->AddAt((histo = new TH2F(Form("fITSsigV1%s", AliPID::ParticleName(ispec)), Form("ITS signal vs. p (%s, Method1):p / GeV/c:ITS signal / a.u.", AliPID::ParticleName(ispec)), kMomentumBins - 1, momentumBins, kSigBins, 0., kSigBins)), 2 * ispec + kHistosSigAll); | |
130 | fQAlist->AddAt((histo = new TH2F(Form("fITSsigV2%s", AliPID::ParticleName(ispec)), Form("ITS signal vs. p (%s, Method2):p / GeV/c:ITS signal / a.u.", AliPID::ParticleName(ispec)), kMomentumBins - 1, momentumBins, kSigBins, 0., kSigBins)), 2 * ispec + 1 + kHistosSigAll); | |
131 | } | |
132 | l->Add(fQAlist); | |
133 | } | |
134 | ||
135 | //___________________________________________________________________ | |
136 | Double_t AliHFEpidITS::GetITSSignalV1(AliESDtrack *track){ | |
137 | // | |
138 | // Calculate the ITS signal according to the mean charge of the clusters | |
139 | // | |
140 | Double_t signal = 0.; | |
141 | #ifdef TRUNK | |
142 | Double_t dedx[4]; | |
143 | track->GetITSdEdxSamples(dedx); | |
144 | signal = TMath::Mean(4, dedx); | |
145 | #else | |
146 | signal = track->GetITSsignal(); | |
147 | #endif | |
148 | Double_t p = track->GetTPCInnerParam() ? track->GetTPCInnerParam()->P() : track->P(); | |
149 | AliDebug(1, Form("Momentum: %f, ITS Signal: %f", p, signal)); | |
150 | if(IsQAon()) FillHistogramsSignalV1(p, signal, GetMCpid(track)); | |
151 | return signal; | |
152 | } | |
153 | ||
154 | //___________________________________________________________________ | |
155 | Double_t AliHFEpidITS::GetITSSignalV2(AliESDtrack *track){ | |
156 | // | |
157 | // Calculates the ITS signal. Truncated mean is used. | |
158 | // | |
159 | Double_t dedx[4], tmp[4]; | |
160 | Int_t indices[4]; | |
161 | track->GetITSdEdxSamples(tmp); | |
162 | TMath::Sort(4, tmp, indices); | |
163 | for(Int_t ien = 0; ien < 4; ien++) dedx[ien] = tmp[indices[ien]]; | |
164 | Double_t signal = TMath::Mean(3, dedx); | |
165 | Double_t p = track->GetTPCInnerParam() ? track->GetTPCInnerParam()->P() : track->P(); | |
166 | AliDebug(1, Form("Momentum: %f, ITS Signal: %f", p, signal)); | |
167 | if(IsQAon()) FillHistogramsSignalV2(p, signal, GetMCpid(track)); | |
168 | return signal; | |
169 | } | |
170 | ||
171 | //___________________________________________________________________ | |
172 | void AliHFEpidITS::FillHistogramsSignalV1(Double_t p, Double_t signal, Int_t species){ | |
173 | (dynamic_cast<TH2 *>(fQAlist->At(kITSsigV1)))->Fill(p, signal); | |
174 | if(species >= 0 && species < AliPID::kSPECIES) | |
175 | (dynamic_cast<TH2 *>(fQAlist->At(kHistosSigAll + 2 * species)))->Fill(p, signal); | |
176 | } | |
177 | ||
178 | //___________________________________________________________________ | |
179 | void AliHFEpidITS::FillHistogramsSignalV2(Double_t p, Double_t signal, Int_t species){ | |
180 | (dynamic_cast<TH2 *>(fQAlist->At(kITSsigV2)))->Fill(p, signal); | |
181 | if(species >= 0 && species < AliPID::kSPECIES) | |
182 | (dynamic_cast<TH2 *>(fQAlist->At(kHistosSigAll + 2 * species + 1)))->Fill(p, signal); | |
183 | } | |
184 | ||
185 | //___________________________________________________________________ | |
186 | Int_t AliHFEpidITS::GetMCpid(AliESDtrack *track){ | |
187 | // | |
188 | // Return species of the track according to MC information | |
189 | // | |
190 | Int_t pdg = TMath::Abs(AliHFEpidBase::GetPdgCode(track)); | |
191 | Int_t pid = -1; | |
192 | switch(pdg){ | |
193 | case 11: pid = AliPID::kElectron; break; | |
194 | case 13: pid = AliPID::kMuon; break; | |
195 | case 211: pid = AliPID::kPion; break; | |
196 | case 321: pid = AliPID::kKaon; break; | |
197 | case 2212: pid = AliPID::kProton; break; | |
198 | default: pid = -1; break; | |
199 | }; | |
200 | return pid; | |
201 | } | |
202 |