]>
Commit | Line | Data |
---|---|---|
1ee39b3a | 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 | /* $Id: AliTRDpidRefMakerLQ.cxx 34163 2009-08-07 11:28:51Z cblume $ */ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // | |
20 | // | |
21 | // TRD calibration class for building reference data for PID | |
22 | // - 2D reference histograms (responsible A.Bercuci) | |
23 | // - 3D reference histograms (not yet implemented) (responsible A.Bercuci) | |
1ee39b3a | 24 | // |
25 | // Origin | |
26 | // Alex Bercuci (A.Bercuci@gsi.de) | |
27 | // | |
28 | /////////////////////////////////////////////////////////////////////////////// | |
29 | ||
b91fdd71 | 30 | #include <TSystem.h> |
1ee39b3a | 31 | #include <TROOT.h> |
b91fdd71 | 32 | #include <TFile.h> |
1ee39b3a | 33 | #include <TTree.h> |
34 | #include <TMath.h> | |
35 | #include <TEventList.h> | |
36 | #include <TH2D.h> | |
37 | #include <TH2I.h> | |
1ee39b3a | 38 | #include <TCanvas.h> |
1ee39b3a | 39 | |
40 | #include "AliLog.h" | |
da27d983 | 41 | #include "../STAT/TKDPDF.h" |
4826d5b1 | 42 | #include "../STAT/TKDInterpolator.h" |
1ee39b3a | 43 | #include "AliTRDpidRefMakerLQ.h" |
da27d983 | 44 | #include "Cal/AliTRDCalPID.h" |
45 | #include "Cal/AliTRDCalPIDLQ.h" | |
1ee39b3a | 46 | #include "AliTRDseedV1.h" |
47 | #include "AliTRDcalibDB.h" | |
48 | #include "AliTRDgeometry.h" | |
4826d5b1 | 49 | #include "info/AliTRDpidInfo.h" |
1ee39b3a | 50 | |
51 | ClassImp(AliTRDpidRefMakerLQ) | |
52 | ||
53 | //__________________________________________________________________ | |
4826d5b1 | 54 | AliTRDpidRefMakerLQ::AliTRDpidRefMakerLQ() |
705f8b0a | 55 | : AliTRDpidRefMaker() |
4826d5b1 | 56 | , fPDF(NULL) |
1ee39b3a | 57 | { |
58 | // | |
59 | // AliTRDpidRefMakerLQ default constructor | |
60 | // | |
705f8b0a | 61 | SetNameTitle("refMakerLQ", "PID(LQ) Reference Maker"); |
62 | } | |
63 | ||
64 | //__________________________________________________________________ | |
65 | AliTRDpidRefMakerLQ::AliTRDpidRefMakerLQ(const char *name) | |
66 | : AliTRDpidRefMaker(name, "PID(LQ) Reference Maker") | |
67 | , fPDF(NULL) | |
68 | { | |
69 | // | |
70 | // AliTRDpidRefMakerLQ default constructor | |
71 | // | |
72 | DefineOutput(3, TObjArray::Class()); | |
1ee39b3a | 73 | } |
74 | ||
75 | //__________________________________________________________________ | |
76 | AliTRDpidRefMakerLQ::~AliTRDpidRefMakerLQ() | |
77 | { | |
78 | // | |
79 | // AliTRDCalPIDQRef destructor | |
80 | // | |
4826d5b1 | 81 | if(fPDF){ |
705f8b0a | 82 | //fPDF->Write("PDF_LQ", TObject::kSingleKey); |
4826d5b1 | 83 | fPDF->Delete(); |
84 | delete fPDF; | |
85 | } | |
1ee39b3a | 86 | } |
87 | ||
b91fdd71 | 88 | // //________________________________________________________________________ |
f8f46e4d | 89 | void AliTRDpidRefMakerLQ::UserCreateOutputObjects() |
1ee39b3a | 90 | { |
91 | // Create histograms | |
92 | // Called once | |
93 | ||
705f8b0a | 94 | AliTRDpidRefMaker::UserCreateOutputObjects(); |
b91fdd71 | 95 | fContainer = Histos(); |
4826d5b1 | 96 | |
97 | OpenFile(2, "RECREATE"); | |
092fbd8a | 98 | fPDF = new TObjArray(AliTRDCalPIDLQ::GetNrefs()); |
99 | fPDF->SetOwner();fPDF->SetName("PDF_LQ"); | |
b91fdd71 | 100 | } |
101 | ||
102 | ||
103 | //__________________________________________________________________ | |
104 | TObjArray* AliTRDpidRefMakerLQ::Histos() | |
105 | { | |
106 | // Create histograms | |
107 | ||
705f8b0a | 108 | if(!fContainer){ |
109 | AliError("Monitor histograms missing."); | |
110 | return NULL; | |
111 | } | |
112 | Int_t n(fContainer->GetEntriesFast()); | |
1ee39b3a | 113 | |
114 | // save dE/dx references | |
092fbd8a | 115 | TH1 *h(NULL); |
1ee39b3a | 116 | for(Int_t ip=AliTRDCalPID::kNMom; ip--;){ |
092fbd8a | 117 | TObjArray *arr = new TObjArray(2*AliPID::kSPECIES); |
b91fdd71 | 118 | arr->SetName(Form("Pbin%02d", ip)); arr->SetOwner(); |
1ee39b3a | 119 | for(Int_t is=AliPID::kSPECIES; is--;) { |
092fbd8a | 120 | h = new TH1D(Form("h1%s%d", AliPID::ParticleShortName(is), ip), Form("1D %s @ Pbin[%d]", AliPID::ParticleName(is), ip), 50, 7., 12.); |
121 | h->GetXaxis()->SetTitle("log(dE/dx) [au]"); | |
122 | h->GetYaxis()->SetTitle("#"); | |
123 | h->SetLineColor(AliTRDCalPIDLQ::GetPartColor(is)); | |
124 | arr->AddAt(h, is); | |
125 | } | |
126 | for(Int_t is=AliPID::kSPECIES; is--;) { | |
127 | h = new TH2D(Form("h2%s%d", AliPID::ParticleShortName(is), ip), Form("2D %s @ Pbin[%d]", AliPID::ParticleName(is), ip), 50, 7., 12., 50, 6.5, 11.); | |
128 | h->GetXaxis()->SetTitle("log(dE/dx_{am}) [au]"); | |
129 | h->GetYaxis()->SetTitle("log(dE/dx_{dr}) [au]"); | |
130 | h->GetZaxis()->SetTitle("#"); | |
131 | arr->AddAt(h, AliPID::kSPECIES+is); | |
1ee39b3a | 132 | } |
705f8b0a | 133 | fContainer->AddAt(arr, n+ip); |
1ee39b3a | 134 | } |
705f8b0a | 135 | fNRefFigures+=AliTRDCalPID::kNMom; |
b91fdd71 | 136 | return fContainer; |
1ee39b3a | 137 | } |
138 | ||
1ee39b3a | 139 | |
140 | //__________________________________________________________________ | |
4826d5b1 | 141 | TObject* AliTRDpidRefMakerLQ::GetOCDBEntry(Option_t */*opt*/) |
1ee39b3a | 142 | { |
143 | // Steer loading of OCDB LQ PID | |
144 | ||
4826d5b1 | 145 | if(gSystem->AccessPathName(Form("TRD.Calib%s.root", GetName()), kReadPermission)){ |
146 | AliError(Form("File TRD.Calib%s.root not readable", GetName())); | |
147 | return NULL; | |
148 | } | |
1ee39b3a | 149 | AliTRDCalPIDLQ *cal = new AliTRDCalPIDLQ("pidLQ", "LQ TRD PID object"); |
4826d5b1 | 150 | cal->LoadReferences(Form("TRD.Calib%s.root", GetName())); |
1ee39b3a | 151 | return cal; |
152 | } | |
153 | ||
154 | //__________________________________________________________________ | |
155 | Bool_t AliTRDpidRefMakerLQ::GetRefFigure(Int_t ifig) | |
156 | { | |
157 | // Steering reference picture | |
158 | ||
b91fdd71 | 159 | if(ifig<0 || ifig>=fNRefFigures){ |
1ee39b3a | 160 | AliError("Ref fig requested outside definition."); |
161 | return kFALSE; | |
162 | } | |
163 | if(!gPad){ | |
164 | AliWarning("Please provide a canvas to draw results."); | |
165 | return kFALSE; | |
166 | } | |
167 | ||
092fbd8a | 168 | TObjArray *arr(NULL);TList *l(NULL);TH1 *h(NULL); |
169 | if(!(arr = (TObjArray*)fContainer->At(ifig))){ | |
170 | AliError(Form("PDF container @ pBin[%d] missing.", ifig)); | |
171 | return kFALSE; | |
172 | } | |
173 | gPad->Divide(5, 2, 1.e-5, 1.e-5);l=gPad->GetListOfPrimitives(); | |
174 | for(Int_t is=0; is<AliPID::kSPECIES; is++){ | |
175 | ((TVirtualPad*)l->At(is))->cd(); | |
176 | if(!(h=(TH1*)arr->At(is))){ | |
177 | AliError(Form("1D for %s @ pBin[%d] missing.", AliPID::ParticleShortName(is), ifig)); | |
b91fdd71 | 178 | return kFALSE; |
179 | } | |
092fbd8a | 180 | h->GetYaxis()->SetRangeUser(0., 1.2); |
181 | h->Draw("l"); | |
182 | ||
183 | ((TVirtualPad*)l->At(AliPID::kSPECIES+is))->cd(); | |
184 | if(!(h=(TH1*)arr->At(AliPID::kSPECIES+is))){ | |
185 | AliError(Form("2D for %s @ pBin[%d] missing.", AliPID::ParticleShortName(is), ifig)); | |
b91fdd71 | 186 | return kFALSE; |
187 | } | |
092fbd8a | 188 | h->Draw("cont4z"); |
b91fdd71 | 189 | } |
092fbd8a | 190 | |
b91fdd71 | 191 | return kTRUE; |
192 | } | |
193 | ||
194 | ||
195 | //________________________________________________________________________ | |
fe1d1beb | 196 | Bool_t AliTRDpidRefMakerLQ::Load(const Char_t *file, const Char_t *dir) |
b91fdd71 | 197 | { |
fe1d1beb | 198 | if(gSystem->AccessPathName(file, kReadPermission)){ |
199 | AliError(Form("File %s not readable", file)); | |
b91fdd71 | 200 | return kFALSE; |
201 | } | |
fe1d1beb | 202 | if(!TFile::Open(file)) { |
203 | AliError(Form("File %s corrupted", file)); | |
b91fdd71 | 204 | return kFALSE; |
205 | } | |
fe1d1beb | 206 | if(!gFile->cd(dir)){ |
207 | AliWarning(Form("Couldn't cd to %s in %s.", dir, file)); | |
208 | return kFALSE; | |
209 | } | |
210 | if (!(fData = dynamic_cast<TTree*>(gDirectory->Get("PIDrefMaker")))) { | |
211 | AliError("PIDref Tree not available"); | |
b91fdd71 | 212 | return kFALSE; |
1ee39b3a | 213 | } |
b91fdd71 | 214 | LinkPIDdata(); |
1ee39b3a | 215 | |
b91fdd71 | 216 | TObjArray *o(NULL); |
092fbd8a | 217 | /* if(!(o = (TObjArray*)gFile->Get(Form("Moni%s", GetName())))){ |
b91fdd71 | 218 | AliWarning(Form("Monitor container Moni%s not available.", name)); |
219 | return kFALSE; | |
220 | } | |
221 | fContainer = (TObjArray*)o->Clone("monitor"); | |
4826d5b1 | 222 | fNRefFigures=AliTRDCalPID::kNMom; |
092fbd8a | 223 | */ |
224 | // temporary until new calibration data are being produced | |
225 | Histos(); | |
4826d5b1 | 226 | |
227 | ||
228 | if(!TFile::Open(Form("TRD.Calib%s.root", GetName()), "UPDATE")){ | |
229 | AliError(Form("File TRD.Calib%s.root corrupted", GetName())); | |
230 | return kFALSE; | |
231 | } | |
092fbd8a | 232 | if(!(o = (TObjArray*)gFile->Get(Form("PDF_LQ")))) { |
233 | AliInfo("PDF container not available. Create."); | |
234 | fPDF = new TObjArray(AliTRDCalPIDLQ::GetNrefs()); | |
235 | fPDF->SetOwner();fPDF->SetName("PDF_LQ"); | |
236 | } else fPDF = (TObjArray*)o->Clone("PDF_LQ"); | |
4826d5b1 | 237 | |
1ee39b3a | 238 | return kTRUE; |
239 | } | |
240 | ||
4826d5b1 | 241 | |
b91fdd71 | 242 | //________________________________________________________________________ |
f8f46e4d | 243 | void AliTRDpidRefMakerLQ::UserExec(Option_t */*opt*/) |
b91fdd71 | 244 | { |
4826d5b1 | 245 | // Load PID data into local data storage |
246 | ||
87c9fc00 | 247 | if(!(fTracks = dynamic_cast<TObjArray*>(GetInputData(1)))) return; |
248 | if(!(fV0s = dynamic_cast<TObjArray*>(GetInputData(2)))) return; | |
249 | if(!(fInfo = dynamic_cast<TObjArray*>(GetInputData(3)))) return; | |
250 | ||
4826d5b1 | 251 | AliTRDpidInfo *pid(NULL); |
252 | const AliTRDpidInfo::AliTRDpidData *data(NULL); | |
253 | Char_t s(-1); | |
254 | for(Int_t itrk=fInfo->GetEntriesFast(); itrk--;){ | |
255 | if(!(pid=(AliTRDpidInfo*)fInfo->At(itrk))) continue; | |
256 | if((s=pid->GetPID())<0) continue; | |
257 | for(Int_t itrklt=pid->GetNtracklets();itrklt--;){ | |
258 | data=pid->GetData(itrklt); | |
259 | Int_t ip(data->Momentum()); | |
260 | ||
261 | ||
262 | Double_t dedx[] = {0., 0.}; | |
263 | if(!AliTRDCalPIDLQ::CookdEdx(data->fdEdx, dedx)) continue; | |
092fbd8a | 264 | ((TH2*)((TObjArray*)fContainer->At(ip))->At(s+Int_t(AliPID::kSPECIES)))->Fill(dedx[0], dedx[1]); |
265 | AliTRDCalPIDLQ::CookdEdx(data->fdEdx, dedx, kFALSE); | |
266 | ((TH1*)((TObjArray*)fContainer->At(ip))->At(s))->Fill(dedx[0]); | |
4826d5b1 | 267 | } |
268 | } | |
269 | ||
705f8b0a | 270 | PostData(1, fContainer); |
271 | PostData(3, fPDF); | |
b91fdd71 | 272 | } |
273 | ||
274 | ||
1ee39b3a | 275 | //________________________________________________________________________ |
276 | Bool_t AliTRDpidRefMakerLQ::PostProcess() | |
277 | { | |
278 | // Analyse merged dedx = f(p) distributions. | |
279 | // - select momentum - species bins | |
280 | // - rotate to principal components | |
281 | // - locally interpolate with TKDPDF | |
282 | // - save interpolation to monitoring histograms | |
283 | // - write pdf to file for loading to OCDB | |
284 | // | |
285 | ||
674c7d26 | 286 | TCanvas *fMonitor(NULL); |
b91fdd71 | 287 | // allocate working storage |
674c7d26 | 288 | const Int_t kWS(AliPID::kSPECIES*AliTRDCalPID::kNMom); |
092fbd8a | 289 | Float_t *data[2*kWS], *data1D[kWS]; |
290 | for(Int_t i(0); i<kWS; i++){ | |
291 | data1D[i] = new Float_t[kMaxStat]; | |
292 | data[i] = new Float_t[kMaxStat]; | |
293 | data[kWS+i] = new Float_t[kMaxStat]; | |
294 | } | |
674c7d26 | 295 | Int_t ndata[kWS]; memset(ndata, 0, kWS*sizeof(Int_t)); |
296 | ||
297 | AliDebug(1, Form("Loading data[%d]", fData->GetEntries())); | |
298 | for(Int_t itrk=0; itrk < fData->GetEntries(); itrk++){ | |
299 | if(!(fData->GetEntry(itrk))) continue; | |
300 | Int_t sbin(fPIDbin); | |
301 | for(Int_t ily=fPIDdataArray->fNtracklets; ily--;){ | |
302 | Int_t pbin(fPIDdataArray->fData[ily].fPLbin & 0xf); | |
303 | ||
092fbd8a | 304 | Double_t dedx[] = {0., 0.}, |
305 | dedx1D[] = {0., 0.}; | |
674c7d26 | 306 | if(!AliTRDCalPIDLQ::CookdEdx(fPIDdataArray->fData[ily].fdEdx, dedx)) continue; |
092fbd8a | 307 | AliTRDCalPIDLQ::CookdEdx(fPIDdataArray->fData[ily].fdEdx, dedx1D, kFALSE); |
674c7d26 | 308 | Int_t idx=AliTRDCalPIDLQ::GetModelID(pbin,sbin); |
309 | if(ndata[idx]==kMaxStat) continue; | |
310 | ||
311 | // store data | |
092fbd8a | 312 | data1D[idx][ndata[idx]] = dedx1D[0]; |
313 | data[idx][ndata[idx]] = dedx[0]; | |
674c7d26 | 314 | data[idx+kWS][ndata[idx]] = dedx[1]; |
315 | ndata[idx]++; | |
316 | } | |
317 | } | |
092fbd8a | 318 | |
319 | TKDPDF *pdf(NULL); | |
320 | Int_t in(0); Float_t par[6], *pp(NULL); | |
4826d5b1 | 321 | for(Int_t ip=0;ip<AliTRDCalPID::kNMom;ip++){ |
1ee39b3a | 322 | for(Int_t is=AliPID::kSPECIES; is--;) { |
1ee39b3a | 323 | // estimate bucket statistics |
674c7d26 | 324 | Int_t idx(AliTRDCalPIDLQ::GetModelID(ip,is)), |
325 | nb(kMinBuckets), // number of buckets | |
44c98bbd | 326 | ns((Int_t)(((Float_t)(ndata[idx]))/nb)); //statistics/bucket |
1ee39b3a | 327 | |
674c7d26 | 328 | AliDebug(2, Form("pBin[%d] sBin[%d] n[%d] ns[%d] nb[%d]", ip, is, ndata[idx], ns, nb)); |
1ee39b3a | 329 | if(ns<Int_t(kMinStat)){ |
674c7d26 | 330 | AliWarning(Form("Not enough entries [%d] for %s[%d].", ndata[idx], AliPID::ParticleShortName(is), ip)); |
1ee39b3a | 331 | continue; |
332 | } | |
333 | ||
092fbd8a | 334 | // build helper 1D PDF |
335 | pdf = new TKDPDF(ndata[idx], 1, ns, &data1D[idx]); | |
336 | pdf->SetCOG(kFALSE); | |
337 | pdf->SetWeights(); | |
338 | //pdf->SetStore(); | |
339 | pdf->SetAlpha(15.); | |
340 | //pdf.GetStatus(); | |
341 | fPDF->AddAt(pdf, idx); | |
342 | in=pdf->GetNTNodes(); pp=&par[0]; | |
343 | while(in--){ | |
344 | const TKDNodeInfo *nn = pdf->GetNodeInfo(in); | |
345 | nn->GetCOG(pp); | |
346 | Double_t p(par[0]),r,e; | |
347 | pdf->Eval(&p,r,e,1); | |
348 | } | |
349 | ||
350 | // build helper 2D PDF | |
674c7d26 | 351 | Float_t *ldata[2]={data[idx], data[kWS+idx]}; |
092fbd8a | 352 | pdf = new TKDPDF(ndata[idx], 2, ns, ldata); |
4826d5b1 | 353 | pdf->SetCOG(kFALSE); |
354 | pdf->SetWeights(); | |
674c7d26 | 355 | //pdf->SetStore(); |
4826d5b1 | 356 | pdf->SetAlpha(5.); |
357 | //pdf.GetStatus(); | |
092fbd8a | 358 | fPDF->AddAt(pdf, AliTRDCalPIDLQ::GetModelID(ip,is, 2)); |
359 | in=pdf->GetNTNodes(); pp=&par[0]; | |
4826d5b1 | 360 | while(in--){ |
361 | const TKDNodeInfo *nn = pdf->GetNodeInfo(in); | |
362 | nn->GetCOG(pp); | |
4826d5b1 | 363 | Double_t p[] = {par[0], par[1]}, r,e; |
364 | pdf->Eval(p,r,e,1); | |
1ee39b3a | 365 | } |
4826d5b1 | 366 | /* |
367 | Int_t nnodes = pdf.GetNTNodes(), | |
368 | nside = Int_t(0.05*nnodes), | |
369 | nzeros = 4*(nside+1); | |
370 | printf("nnodes[%d] nside[%d] nzeros[%d]\n", nnodes, nside, nzeros); | |
371 | ||
372 | ||
373 | // Build interpolator on the pdf skeleton | |
374 | TKDInterpolator interpolator(2, nnodes+nzeros); | |
375 | for(Int_t in=nnodes; in--;) | |
376 | interpolator.SetNode(in, *pdf.GetNodeInfo(in)); | |
377 | TKDNodeInfo *nodes = new TKDNodeInfo[nzeros], *node = &nodes[0]; | |
378 | Float_t ax0min, ax0max, ax1min, ax1max; | |
379 | pdf.GetRange(0, ax0min, ax0max); Float_t dx = (ax0max-ax0min)/nside; | |
380 | pdf.GetRange(1, ax1min, ax1max); Float_t dy = (ax1max-ax1min)/nside; | |
381 | printf("x=[%f %f] y[%f %f]\n", ax0min, ax0max, ax1min, ax1max); | |
382 | ||
383 | Int_t jn = nnodes; | |
384 | SetZeroes(&interpolator, node, nside, jn, ax0min, dx, ax1min, -dy, 'x'); | |
385 | SetZeroes(&interpolator, node, nside, jn, ax1min, dy, ax0max, dx, 'y'); | |
386 | SetZeroes(&interpolator, node, nside, jn, ax0max,-dx, ax1max, dy, 'x'); | |
387 | SetZeroes(&interpolator, node, nside, jn ,ax1max, -dy, ax0min, -dx, 'y'); | |
388 | delete [] nodes; | |
674c7d26 | 389 | Int_t in=nnodes; Float_t par[6], *pp=&par[0]; |
4826d5b1 | 390 | while(in--){ |
391 | const TKDNodeInfo *nn = interpolator.GetNodeInfo(in); | |
392 | nn->GetCOG(pp); | |
393 | //printf("evaluate for node[%d] @ [%f %f]\n",in, par[0], par[1]); | |
394 | Double_t p[] = {par[0], par[1]}, r,e; | |
395 | interpolator.Eval(p,r,e,1); | |
396 | } | |
397 | */ | |
092fbd8a | 398 | |
4826d5b1 | 399 | // visual on-line monitoring |
674c7d26 | 400 | if(HasOnlineMonitor()){ |
401 | if(!fMonitor) fMonitor = new TCanvas("cc", "PDF 2D LQ", 500, 500); | |
402 | pdf->DrawProjection(); | |
403 | fMonitor->Modified(); fMonitor->Update(); | |
404 | fMonitor->SaveAs(Form("pdf_%s%02d.gif", AliPID::ParticleShortName(is), ip)); | |
405 | } | |
1ee39b3a | 406 | |
4826d5b1 | 407 | //fContainer->ls(); |
1ee39b3a | 408 | // save a discretization of the PDF for result monitoring |
4826d5b1 | 409 | Double_t rxy[]={0.,0.}; |
092fbd8a | 410 | TH2 *h2s = (TH2D*)((TObjArray*)fContainer->At(ip))->At(AliPID::kSPECIES+is); |
1ee39b3a | 411 | TAxis *ax = h2s->GetXaxis(), *ay = h2s->GetYaxis(); |
412 | h2s->Clear(); | |
413 | for(int ix=1; ix<=ax->GetNbins(); ix++){ | |
414 | rxy[0] = ax->GetBinCenter(ix); | |
415 | for(int iy=1; iy<=ay->GetNbins(); iy++){ | |
416 | rxy[1] = ay->GetBinCenter(iy); | |
417 | ||
418 | Double_t rr,ee; | |
4826d5b1 | 419 | pdf->Eval(rxy, rr, ee, kFALSE); |
1ee39b3a | 420 | if(rr<0. || ee/rr>.15) continue; // 15% relative error |
421 | //printf("x[%2d] x[%2d] r[%f] e[%f]\n", ix, iy, rr, ee); | |
422 | h2s->SetBinContent(ix, iy, rr); | |
423 | } | |
424 | } | |
092fbd8a | 425 | |
426 | pdf=dynamic_cast<TKDPDF*>(fPDF->At(idx)); | |
427 | TH1 *h1 = (TH1D*)((TObjArray*)fContainer->At(ip))->At(is); | |
428 | ax = h1->GetXaxis(); | |
429 | h1->Clear(); | |
430 | for(int ix=1; ix<=ax->GetNbins(); ix++){ | |
431 | rxy[0] = ax->GetBinCenter(ix); | |
432 | ||
433 | Double_t rr,ee; | |
434 | pdf->Eval(rxy, rr, ee, kFALSE); | |
435 | if(rr<0. || ee/rr>.15) continue; // 15% relative error | |
436 | //printf("x[%2d] x[%2d] r[%f] e[%f]\n", ix, iy, rr, ee); | |
437 | h1->SetBinContent(ix, rr); | |
438 | } | |
1ee39b3a | 439 | } |
440 | } | |
092fbd8a | 441 | for(Int_t i(0); i<kWS; i++){ |
442 | delete [] data1D[i]; | |
443 | delete [] data[i]; | |
444 | delete [] data[i+kWS]; | |
445 | } | |
4826d5b1 | 446 | return kTRUE; |
1ee39b3a | 447 | } |
448 | ||
449 | ||
4826d5b1 | 450 | //__________________________________________________________________ |
451 | void AliTRDpidRefMakerLQ::SetZeroes(TKDInterpolator *interpolator, TKDNodeInfo *node, Int_t n, Int_t& idx, Float_t x, Float_t dx, Float_t y, Float_t dy, const Char_t opt) | |
452 | { | |
453 | // Set extra nodes to ensure boundary conditions | |
454 | ||
455 | printf("SetZeroes(%c)\n", opt); | |
456 | Float_t par[6], val[] = {0., 1.}; | |
457 | Int_t a[6]; | |
458 | if(opt=='x'){ | |
459 | a[0]=0; a[1]=1; a[2]=2; a[3]=3; a[4]=4; a[5]=5; | |
460 | } else if(opt=='y'){ | |
461 | a[0]=1; a[1]=0; a[2]=4; a[3]=5; a[4]=2; a[5]=3; | |
462 | } else return; | |
463 | Float_t tmp; | |
464 | par[a[1]] = y; | |
465 | par[a[4]] = y; par[a[5]] = y+dy; | |
466 | if(dy<0.){tmp=par[a[4]]; par[a[4]]=par[a[5]]; par[a[5]]=tmp;} | |
467 | for(Int_t in=n; in--; node++, idx++, x+=dx){ | |
468 | par[a[0]] = x+.5*dx; | |
469 | par[a[2]] = x; par[a[3]] = x+dx; | |
470 | if(dx<0.){tmp=par[a[2]]; par[a[2]]=par[a[3]]; par[a[3]]=tmp;} | |
471 | node->SetNode(2, par, val); | |
472 | printf("\n\tnode[%d]\n", idx); node->Print(); | |
473 | interpolator->SetNode(idx, *node); | |
474 | } | |
475 | par[a[0]] = x; | |
476 | par[a[2]] = x; par[a[3]] = x+dx; | |
477 | if(dx<0.){tmp=par[a[2]]; par[a[2]]=par[a[3]]; par[a[3]]=tmp;} | |
478 | node->SetNode(2, par, val); | |
479 | printf("\n\tnode[%d]\n", idx); node->Print(); | |
480 | interpolator->SetNode(idx, *node);node++;idx++; | |
481 | } | |
482 |