]>
Commit | Line | Data |
---|---|---|
3a72645a | 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 | // Class AliHFEtrdPIDqaV1 | |
17 | // Monitoring TRD PID in the HFE PID montioring framework. The following | |
18 | // quantities are monitored: | |
19 | // TRD electron likelihood | |
20 | // TRD dE/dx (Absolute values) | |
21 | // TPC dE/dx (Number of sigmas, control histogram) | |
22 | // (Always as function of momentum, particle species and centrality | |
23 | // before and after cut) | |
24 | // More information about the PID monitoring framework can be found in | |
25 | // AliHFEpidQAmanager.cxx and AliHFEdetPIDqa.cxx | |
26 | // | |
27 | // Author: | |
28 | // Markus Fasel <M.Fasel@gsi.de> | |
29 | // | |
30 | ||
31 | #include <TAxis.h> | |
32 | #include <TH2.h> | |
33 | #include <THnSparse.h> | |
34 | #include <TString.h> | |
35 | ||
6555e2ad | 36 | #include "AliLog.h" |
3a72645a | 37 | #include "AliPID.h" |
38 | ||
39 | #include "AliHFEcollection.h" | |
40 | #include "AliHFEpidBase.h" | |
6555e2ad | 41 | #include "AliHFEpidQAmanager.h" |
42 | #include "AliHFEpidTPC.h" | |
43 | #include "AliHFEpidTRD.h" | |
3a72645a | 44 | #include "AliHFEtrdPIDqaV1.h" |
45 | ||
46 | ClassImp(AliHFEtrdPIDqaV1) | |
47 | ||
48 | //____________________________________________________________ | |
49 | AliHFEtrdPIDqaV1::AliHFEtrdPIDqaV1(): | |
50 | AliHFEdetPIDqa(), | |
51 | fHistos(NULL) | |
52 | { | |
53 | // | |
54 | // Dummy constructor | |
55 | // | |
56 | } | |
57 | ||
58 | //____________________________________________________________ | |
59 | AliHFEtrdPIDqaV1::AliHFEtrdPIDqaV1(const Char_t *name): | |
60 | AliHFEdetPIDqa(name, "QA for TRD"), | |
61 | fHistos(NULL) | |
62 | { | |
63 | // | |
64 | // Default constructor | |
65 | // | |
66 | } | |
67 | ||
68 | //____________________________________________________________ | |
69 | AliHFEtrdPIDqaV1::AliHFEtrdPIDqaV1(const AliHFEtrdPIDqaV1 &o): | |
70 | AliHFEdetPIDqa(o), | |
71 | fHistos(NULL) | |
72 | { | |
73 | // | |
74 | // Copy constructor | |
75 | // | |
76 | } | |
77 | ||
78 | //____________________________________________________________ | |
79 | AliHFEtrdPIDqaV1 &AliHFEtrdPIDqaV1::operator=(const AliHFEtrdPIDqaV1 &o){ | |
80 | // | |
81 | // Make assignment | |
82 | // | |
83 | AliHFEdetPIDqa::operator=(o); | |
84 | fHistos = o.fHistos; | |
85 | ||
86 | return *this; | |
87 | } | |
88 | ||
89 | //_________________________________________________________ | |
90 | Long64_t AliHFEtrdPIDqaV1::Merge(TCollection *coll){ | |
91 | // | |
92 | // Merge with other objects | |
93 | // | |
94 | if(!coll) return 0; | |
95 | if(coll->IsEmpty()) return 1; | |
96 | ||
97 | TIter it(coll); | |
98 | AliHFEtrdPIDqaV1 *refQA = NULL; | |
99 | TObject *o = NULL; | |
100 | Long64_t count = 0; | |
101 | TList listHistos; | |
102 | while((o = it())){ | |
103 | refQA = dynamic_cast<AliHFEtrdPIDqaV1 *>(o); | |
104 | if(!refQA) continue; | |
105 | ||
106 | listHistos.Add(refQA->fHistos); | |
107 | count++; | |
108 | } | |
109 | fHistos->Merge(&listHistos); | |
110 | return count + 1; | |
111 | } | |
112 | ||
113 | //____________________________________________________________ | |
114 | void AliHFEtrdPIDqaV1::Initialize(){ | |
115 | // | |
116 | // Initialize QA histos for TRD PID | |
117 | // | |
118 | ||
119 | AliDebug(1, "Initializing PID QA for TRD"); | |
120 | // Make common binning | |
121 | const Int_t kPIDbins = AliPID::kSPECIES + 1; | |
122 | const Int_t kPbins = 100; | |
123 | const Int_t kSteps = 2; | |
124 | const Double_t kMinPID = -1; | |
125 | const Double_t kMinP = 0.; | |
126 | const Double_t kMaxPID = (Double_t)AliPID::kSPECIES; | |
127 | const Double_t kMaxP = 20.; | |
128 | ||
129 | fHistos = new AliHFEcollection("trdqahistos", "Collection of TRD QA histograms"); | |
130 | ||
131 | // Create Control Histogram monitoring the TPC sigma between the selection steps | |
132 | const Int_t kTPCSigmaBins = 140; | |
133 | Int_t nBinsTPCSigma[4] = {kPIDbins, kPbins, kTPCSigmaBins, kSteps}; | |
134 | Double_t minTPCSigma[4] = {kMinPID, kMinP, -12., 0}; | |
135 | Double_t maxTPCSigma[4] = {kMaxPID, kMaxP, 12., 2.}; | |
136 | fHistos->CreateTHnSparse("hTPCsigma", "TPC sigma; species p [GeV/c]; TPC dEdx - <dE/dx>|_{el} [#sigma]; selection step", 4, nBinsTPCSigma, minTPCSigma, maxTPCSigma); | |
bf892a6a | 137 | fHistos->Sumw2("hTPCsigma"); |
3a72645a | 138 | // Create Monitoring histogram for the Likelihood distribution |
139 | const Int_t kTRDLikelihoodBins = 100; | |
140 | Int_t nBinsTRDlike[4] = {kPIDbins, kPbins, kTRDLikelihoodBins, kSteps}; | |
141 | Double_t minTRDlike[4] = {kMinPID, kMinP, 0., 0.}; | |
142 | Double_t maxTRDlike[4] = {kMaxPID, kMaxP, 1., 2.}; | |
143 | fHistos->CreateTHnSparse("hTRDlikelihood", "TRD Likelihood Distribution; species; p [GeV/c]; TRD electron Likelihood; selection step", 4, nBinsTRDlike, minTRDlike, maxTRDlike); | |
bf892a6a | 144 | fHistos->Sumw2("hTRDlikelihood"); |
3a72645a | 145 | // Create Monitoring histogram for the TRD total charge |
146 | const Int_t kTRDchargeBins = 1000; | |
147 | Int_t nBinsTRDcharge[4] = {kPIDbins, kPbins, kTRDchargeBins, kSteps}; | |
148 | Double_t minTRDcharge[4] = {kMinPID, kMinP, 0., 0.}; | |
149 | Double_t maxTRDcharge[4] = {kMaxPID, kMaxP, 100000., 2.}; | |
150 | fHistos->CreateTHnSparse("hTRDcharge", "Total TRD charge; species; p [GeV/c]; TRD charge [a.u.]; selection step", 4, nBinsTRDcharge, minTRDcharge, maxTRDcharge); | |
bf892a6a | 151 | fHistos->Sumw2("hTRDcharge"); |
3a72645a | 152 | } |
153 | ||
154 | //____________________________________________________________ | |
6555e2ad | 155 | void AliHFEtrdPIDqaV1::ProcessTrack(const AliHFEpidObject *track, AliHFEdetPIDqa::EStep_t step){ |
3a72645a | 156 | // |
157 | // Process the track, fill the containers | |
158 | // | |
159 | AliDebug(1, Form("QA started for TRD PID for step %d", (Int_t)step)); | |
160 | Int_t species = track->GetAbInitioPID(); | |
6555e2ad | 161 | AliHFEpidObject::AnalysisType_t anatype = track->IsESDanalysis() ? AliHFEpidObject::kESDanalysis : AliHFEpidObject::kAODanalysis; |
3a72645a | 162 | |
6555e2ad | 163 | AliHFEpidTRD *trdpid = dynamic_cast<AliHFEpidTRD *>(fQAmanager->GetDetectorPID(AliHFEpid::kTRDpid)); |
164 | AliHFEpidTPC *tpcpid = dynamic_cast<AliHFEpidTPC *>(fQAmanager->GetDetectorPID(AliHFEpid::kTPCpid)); | |
165 | ||
3a72645a | 166 | Double_t container[4]; |
167 | container[0] = species; | |
bf892a6a | 168 | container[1] = trdpid ? trdpid->GetP(track->GetRecTrack(), anatype) : 0.; |
169 | container[2] = tpcpid ? tpcpid->NumberOfSigmas(track->GetRecTrack(), AliPID::kElectron, anatype) : 0.; | |
3a72645a | 170 | container[3] = step; |
171 | fHistos->Fill("hTPCsigma", container); | |
172 | ||
6555e2ad | 173 | container[2] = trdpid->GetElectronLikelihood(track->GetRecTrack(), anatype); |
3a72645a | 174 | fHistos->Fill("hTRDlikelihood", container); |
175 | ||
6555e2ad | 176 | for(UInt_t ily = 0; ily < 6; ily++){ |
177 | container[2] = trdpid->GetChargeLayer(track->GetRecTrack(), ily, anatype); | |
3a72645a | 178 | fHistos->Fill("hTRDcharge", container); |
179 | } | |
6555e2ad | 180 | if(species >= AliPID::kSPECIES) species = -1; |
3a72645a | 181 | } |
182 | ||
183 | //_________________________________________________________ | |
184 | TH2 *AliHFEtrdPIDqaV1::MakeTPCspectrumNsigma(AliHFEdetPIDqa::EStep_t step, Int_t species){ | |
185 | // | |
186 | // Get the TPC control histogram for the TRD selection step (either before or after PID) | |
187 | // | |
188 | printf("histos :%p\n", fHistos); | |
189 | THnSparseF *histo = dynamic_cast<THnSparseF *>(fHistos->Get("hTPCsigma")); | |
190 | if(!histo){ | |
191 | AliError("QA histogram monitoring TPC nSigma not available"); | |
192 | return NULL; | |
193 | } | |
194 | if(species > -1 && species < AliPID::kSPECIES){ | |
195 | // cut on species (if available) | |
196 | histo->GetAxis(0)->SetRange(species + 2, species + 2); // undef + underflow | |
197 | } | |
6555e2ad | 198 | histo->GetAxis(3)->SetRange(step + 1, step + 1); |
3a72645a | 199 | |
200 | TH2 *hSpec = histo->Projection(2, 1); | |
201 | // construct title and name | |
6555e2ad | 202 | TString stepname = step == AliHFEdetPIDqa::kBeforePID ? "before" : "after"; |
3a72645a | 203 | TString speciesname = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "all Particles"; |
204 | TString specID = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "unid"; | |
205 | TString histname = Form("hSigmaTPC%s%s", specID.Data(), stepname.Data()); | |
206 | TString histtitle = Form("TPC Sigma for %s %s PID", speciesname.Data(), stepname.Data()); | |
207 | hSpec->SetName(histname.Data()); | |
208 | hSpec->SetTitle(histtitle.Data()); | |
209 | ||
210 | // Unset range on the original histogram | |
211 | histo->GetAxis(0)->SetRange(0, histo->GetAxis(0)->GetNbins()); | |
212 | histo->GetAxis(2)->SetRange(0, histo->GetAxis(2)->GetNbins()); | |
213 | return hSpec; | |
214 | } | |
215 | ||
216 | //_________________________________________________________ | |
217 | TH2 *AliHFEtrdPIDqaV1::MakeTRDlikelihoodDistribution(AliHFEdetPIDqa::EStep_t step, Int_t species){ | |
218 | // | |
219 | // Make Histogram for TRD Likelihood distribution | |
220 | // | |
221 | THnSparseF *histo = dynamic_cast<THnSparseF *>(fHistos->Get("hTRDlikelihood")); | |
222 | if(!histo){ | |
223 | AliError("QA histogram monitoring TRD Electron Likelihood not available"); | |
224 | return NULL; | |
225 | } | |
226 | if(species > -1 && species < AliPID::kSPECIES){ | |
227 | // cut on species (if available) | |
228 | histo->GetAxis(0)->SetRange(species + 2, species + 2); // undef + underflow | |
229 | } | |
6555e2ad | 230 | histo->GetAxis(3)->SetRangeUser(step + 1, step + 1); |
3a72645a | 231 | |
232 | TH2 *hSpec = histo->Projection(2, 1); | |
233 | // construct title and name | |
6555e2ad | 234 | TString stepname = step == AliHFEdetPIDqa::kBeforePID ? "before" : "after"; |
3a72645a | 235 | TString speciesname = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "all Particles"; |
236 | TString specID = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "unid"; | |
237 | TString histname = Form("hLikeElTRD%s%s", specID.Data(), stepname.Data()); | |
238 | TString histtitle = Form("TRD electron Likelihood for %s %s PID", speciesname.Data(), stepname.Data()); | |
239 | hSpec->SetName(histname.Data()); | |
240 | hSpec->SetTitle(histtitle.Data()); | |
241 | ||
242 | // Unset range on the original histogram | |
243 | histo->GetAxis(0)->SetRange(0, histo->GetAxis(0)->GetNbins()); | |
244 | histo->GetAxis(2)->SetRange(0, histo->GetAxis(2)->GetNbins()); | |
245 | return hSpec; | |
246 | } | |
247 | ||
248 | //_________________________________________________________ | |
249 | TH2 *AliHFEtrdPIDqaV1::MakeTRDchargeDistribution(AliHFEdetPIDqa::EStep_t step, Int_t species){ | |
250 | // | |
251 | // Make Histogram for TRD Likelihood distribution | |
252 | // | |
253 | THnSparseF *histo = dynamic_cast<THnSparseF *>(fHistos->Get("hTRDcharge")); | |
254 | if(!histo){ | |
255 | AliError("QA histogram monitoring TRD total charge not available"); | |
256 | return NULL; | |
257 | } | |
258 | if(species > -1 && species < AliPID::kSPECIES){ | |
259 | // cut on species (if available) | |
260 | histo->GetAxis(0)->SetRange(species + 2, species + 2); // undef + underflow | |
261 | } | |
6555e2ad | 262 | histo->GetAxis(3)->SetRange(step + 1, step + 1); |
3a72645a | 263 | |
264 | TH2 *hSpec = histo->Projection(2, 1); | |
265 | // construct title and name | |
6555e2ad | 266 | TString stepname = step == AliHFEdetPIDqa::kBeforePID ? "before" : "after"; |
3a72645a | 267 | TString speciesname = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "all Particles"; |
268 | TString specID = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "unid"; | |
269 | TString histname = Form("hChargeTRD%s%s", specID.Data(), stepname.Data()); | |
270 | TString histtitle = Form("TRD total charge for %s %s PID", speciesname.Data(), stepname.Data()); | |
271 | hSpec->SetName(histname.Data()); | |
272 | hSpec->SetTitle(histtitle.Data()); | |
273 | ||
274 | // Unset range on the original histogram | |
275 | histo->GetAxis(0)->SetRange(0, histo->GetAxis(0)->GetNbins()); | |
276 | histo->GetAxis(2)->SetRange(0, histo->GetAxis(2)->GetNbins()); | |
277 | return hSpec; | |
278 | } | |
279 |