From 674c7d26a378e4c94e98b0351095fb7c46b2e56c Mon Sep 17 00:00:00 2001 From: abercuci Date: Wed, 16 Dec 2009 12:23:26 +0000 Subject: [PATCH] speed up and last fixes before going into production --- PWG1/TRD/AliTRDpidRefMakerLQ.cxx | 76 +++++++++++++++++--------------- PWG1/TRD/AliTRDpidRefMakerLQ.h | 5 ++- 2 files changed, 44 insertions(+), 37 deletions(-) diff --git a/PWG1/TRD/AliTRDpidRefMakerLQ.cxx b/PWG1/TRD/AliTRDpidRefMakerLQ.cxx index de3eaf232f7..85f554937c6 100644 --- a/PWG1/TRD/AliTRDpidRefMakerLQ.cxx +++ b/PWG1/TRD/AliTRDpidRefMakerLQ.cxx @@ -254,55 +254,57 @@ Bool_t AliTRDpidRefMakerLQ::PostProcess() // - write pdf to file for loading to OCDB // - TCanvas *cc = new TCanvas("cc", "", 500, 500); + TCanvas *fMonitor(NULL); // allocate working storage - Float_t *data[] = { - new Float_t[kMaxStat], - new Float_t[kMaxStat]}; + const Int_t kWS(AliPID::kSPECIES*AliTRDCalPID::kNMom); + Float_t *data[2*kWS]; + for(Int_t i(0); i<2*kWS; i++) data[i]=new Float_t[kMaxStat]; + Int_t ndata[kWS]; memset(ndata, 0, kWS*sizeof(Int_t)); + + AliDebug(1, Form("Loading data[%d]", fData->GetEntries())); + for(Int_t itrk=0; itrk < fData->GetEntries(); itrk++){ + if(!(fData->GetEntry(itrk))) continue; + Int_t sbin(fPIDbin); + for(Int_t ily=fPIDdataArray->fNtracklets; ily--;){ + Int_t pbin(fPIDdataArray->fData[ily].fPLbin & 0xf); + + Double_t dedx[] = {0., 0.}; + if(!AliTRDCalPIDLQ::CookdEdx(fPIDdataArray->fData[ily].fdEdx, dedx)) continue; + Int_t idx=AliTRDCalPIDLQ::GetModelID(pbin,sbin); + if(ndata[idx]==kMaxStat) continue; + + // store data + data[idx][ndata[idx]] = dedx[0]; + data[idx+kWS][ndata[idx]] = dedx[1]; + ndata[idx]++; + } + } for(Int_t ip=0;ipGetEntries()) && (nGetEntry(itrk))) continue; - if(fPIDbin!=is) continue; - for(Int_t ily=fPIDdataArray->fNtracklets; ily--;){ - if((fPIDdataArray->fData[ily].fPLbin & 0xf)!= ip) continue; - - Double_t dedx[] = {0., 0.}; - if(!AliTRDCalPIDLQ::CookdEdx(fPIDdataArray->fData[ily].fdEdx, dedx)) continue; - // store data - data[0][n] = dedx[0]; - data[1][n] = dedx[1]; - n++; if(n==kMaxStat) break; - } - } - // estimate bucket statistics - Int_t nb(kMinBuckets), // number of buckets - ns(Int_t(Float_t(n)/nb)); //statistics/bucket + Int_t idx(AliTRDCalPIDLQ::GetModelID(ip,is)), + nb(kMinBuckets), // number of buckets + ns(Int_t(Float_t(ndata[idx])/nb)); //statistics/bucket -// if(Float_t(n)/nb < 220.) ns = 200; // 7% stat error -// else if(Float_t(n)/nb < 420.) ns = 400; // 5% stat error - - AliDebug(2, Form("pBin[%d] sBin[%d] n[%d] ns[%d] nb[%d]", ip, is, n, ns, nb)); + AliDebug(2, Form("pBin[%d] sBin[%d] n[%d] ns[%d] nb[%d]", ip, is, ndata[idx], ns, nb)); if(nsSetCOG(kFALSE); pdf->SetWeights(); - pdf->SetStore(); + //pdf->SetStore(); pdf->SetAlpha(5.); //pdf.GetStatus(); - fPDF->AddAt(pdf, AliTRDCalPIDLQ::GetModelID(ip,is)); + fPDF->AddAt(pdf, idx); Int_t in=pdf->GetNTNodes(); Float_t par[6], *pp=&par[0]; while(in--){ const TKDNodeInfo *nn = pdf->GetNodeInfo(in); nn->GetCOG(pp); - //printf("evaluate for node[%d] @ [%f %f]\n",in, par[0], par[1]); Double_t p[] = {par[0], par[1]}, r,e; pdf->Eval(p,r,e,1); } @@ -329,7 +331,7 @@ Bool_t AliTRDpidRefMakerLQ::PostProcess() SetZeroes(&interpolator, node, nside, jn, ax0max,-dx, ax1max, dy, 'x'); SetZeroes(&interpolator, node, nside, jn ,ax1max, -dy, ax0min, -dx, 'y'); delete [] nodes; - Int_t in=interpolator.GetNTNodes(); Float_t par[6], *pp=&par[0]; + Int_t in=nnodes; Float_t par[6], *pp=&par[0]; while(in--){ const TKDNodeInfo *nn = interpolator.GetNodeInfo(in); nn->GetCOG(pp); @@ -339,9 +341,12 @@ Bool_t AliTRDpidRefMakerLQ::PostProcess() } */ // visual on-line monitoring - pdf->DrawProjection();cc->Modified(); cc->Update(); cc->SaveAs(Form("pdf_%s%02d.gif", AliPID::ParticleShortName(is), ip)); - cc->SaveAs(Form("%s_%s%02d.gif", GetName(), AliPID::ParticleShortName(is), ip)); - + if(HasOnlineMonitor()){ + if(!fMonitor) fMonitor = new TCanvas("cc", "PDF 2D LQ", 500, 500); + pdf->DrawProjection(); + fMonitor->Modified(); fMonitor->Update(); + fMonitor->SaveAs(Form("pdf_%s%02d.gif", AliPID::ParticleShortName(is), ip)); + } //fContainer->ls(); // save a discretization of the PDF for result monitoring @@ -363,6 +368,7 @@ Bool_t AliTRDpidRefMakerLQ::PostProcess() } } } + for(Int_t i(0); i<2*kWS; i++) delete [] data[i]; return kTRUE; } diff --git a/PWG1/TRD/AliTRDpidRefMakerLQ.h b/PWG1/TRD/AliTRDpidRefMakerLQ.h index b222a33957e..cafa54aba47 100644 --- a/PWG1/TRD/AliTRDpidRefMakerLQ.h +++ b/PWG1/TRD/AliTRDpidRefMakerLQ.h @@ -29,9 +29,9 @@ class TObjArray; class AliTRDpidRefMakerLQ : public AliTRDpidRefMaker { public: enum ETRDpidRefMakerLQsteer{ - kMaxStat = 180000 // maximum statistics/PID bin + kMaxStat = 40000 // maximum statistics/PID bin ,kMinStat = 50 // minimum statistics/bucket 14% - ,kMinBuckets = 450 // minimum number of buckets [lambda(6)*alpha(1.5)*regions(50)] + ,kMinBuckets = 100 // minimum number of buckets [lambda(6)*alpha(1.5)*regions(50)] }; AliTRDpidRefMakerLQ(); ~AliTRDpidRefMakerLQ(); @@ -40,6 +40,7 @@ public: void Exec(Option_t *opt); TObject* GetOCDBEntry(Option_t *opt); Bool_t GetRefFigure(Int_t ifig); + Bool_t HasOnlineMonitor() const {return kTRUE;} TObjArray* Histos(); Bool_t Load(const Char_t *filename = "TRD.CalibPIDrefMaker.root"); Bool_t PostProcess(); -- 2.43.0