From c3853fabc77daa65e29ebcb1b212d5fe3b7f2afe Mon Sep 17 00:00:00 2001 From: vestbo Date: Tue, 17 Dec 2002 13:56:22 +0000 Subject: [PATCH] Generate data now in 3 dimensions. This means that the clusters are really 2d for every padrow. Timedirection is gauss smeared according to the drift distance. --- HLT/hough/AliL3HoughTest.cxx | 338 ++++++++++++++++++++++++++--------- HLT/hough/AliL3HoughTest.h | 10 +- 2 files changed, 262 insertions(+), 86 deletions(-) diff --git a/HLT/hough/AliL3HoughTest.cxx b/HLT/hough/AliL3HoughTest.cxx index 4caa4b98f1e..4cc15156deb 100644 --- a/HLT/hough/AliL3HoughTest.cxx +++ b/HLT/hough/AliL3HoughTest.cxx @@ -11,6 +11,7 @@ #include "TRandom.h" #include "TMath.h" #include "TH2.h" +#include "TH3.h" #if GCCVERSION == 3 using namespace std; @@ -34,7 +35,7 @@ AliL3HoughTest::~AliL3HoughTest() delete [] fData; } -Bool_t AliL3HoughTest::GenerateTrackData(Double_t pt,Double_t psi,Int_t sign,Int_t patch,Int_t minhits) +Bool_t AliL3HoughTest::GenerateTrackData(Double_t pt,Double_t psi,Double_t tgl,Int_t sign,Int_t patch,Int_t minhits) { fCurrentPatch=patch; if(fData) @@ -46,12 +47,13 @@ Bool_t AliL3HoughTest::GenerateTrackData(Double_t pt,Double_t psi,Int_t sign,Int track->Init(0,patch); track->SetPt(pt); track->SetPsi(psi); + track->SetTgl(tgl); track->SetCharge(sign); track->SetFirstPoint(0,0,0); track->CalculateHelix(); - Int_t temp[200]; + Int_t temp2[AliL3Transform::GetNTimeBins()]; Int_t entries=100; Int_t clustercharge=100; Int_t hitcounter=0; @@ -67,41 +69,69 @@ Bool_t AliL3HoughTest::GenerateTrackData(Double_t pt,Double_t psi,Int_t sign,Int AliL3Transform::Slice2Sector(0,i,sector,row); AliL3Transform::Local2Raw(xyz,sector,row); - if(xyz[1] < 0 || xyz[1] >= AliL3Transform::GetNPads(i)) + if(xyz[1] < 0 || xyz[1] >= AliL3Transform::GetNPads(i) || xyz[2] < 0 || xyz[2] >= AliL3Transform::GetNTimeBins()) continue; hitcounter++; track->SetPadHit(i,xyz[1]); - //cout<SetTimeHit(i,xyz[2]); + memset(temp,0,200*sizeof(Int_t)); + memset(temp2,0,AliL3Transform::GetNTimeBins()*sizeof(Int_t)); Double_t xysigma = sqrt(track->GetParSigmaY2(i)); + Double_t zsigma = sqrt(track->GetParSigmaZ2(i)); + //cout<Gaus(xyz[1],xysigma)); - if(pad < 0 || pad >= AliL3Transform::GetNPads(i)) + Int_t time = TMath::Nint(gRandom->Gaus(xyz[2],zsigma)); + if(pad < 0 || pad >= AliL3Transform::GetNPads(i) || time < 0 || time >= AliL3Transform::GetNTimeBins()) continue; temp[pad]++; + temp2[time]++; if(pad < minpad) minpad=pad; + if(time < mintime) + mintime=time; } + Int_t npads=0; for(j=0; j<200; j++) { if(temp[j]==0) continue; + Int_t index = j - minpad; + if(index < 0 || index >= 10) { cerr<<"AliL3HoughTest::GenerateTrackData : Wrong index "< 1023) - charge=1023; - fData[rowindex].pads[index]=charge; - fData[rowindex].npads++; + npads++; + Int_t seq_charge = clustercharge*temp[j]/entries; + Int_t ntimes=0; + for(Int_t k=0; k= 10) + { + cerr<<"AliL3HoughTest::GenerateTrackData : Wrong timeindex "< 1023) + charge=1023; + //cout<<"row "<GetFirstYbin(); k<=hist->GetLastYbin(); k++) + for(Int_t k=0; k<10; k++) { - phi0 = hist->GetBinCenterY(k); - kappa = 2*sin(phi-phi0)/R; - hist->Fill(kappa,phi0,charge); + time = k + fData[rowindex].mintime; + charge = fData[rowindex].pads[j][k]; + if(charge == 0) continue; + AliL3Transform::Raw2Local(xyz,sector,row,pad,time); + + R = sqrt(xyz[0]*xyz[0] + xyz[1]*xyz[1]); + + phi = AliL3Transform::GetPhi(xyz); + + for(Int_t k=hist->GetFirstYbin(); k<=hist->GetLastYbin(); k++) + { + phi0 = hist->GetBinCenterY(k); + kappa = 2*sin(phi-phi0)/R; + hist->Fill(kappa,phi0,charge); + } } } } @@ -150,7 +184,7 @@ void AliL3HoughTest::Transform2CircleC(AliL3Histogram *hist) cerr<<"AliL3HoughTest::TransformC : No data"<Fill(kappa,phi_0,charge1+charge2); - kappa = 2*sin(phi1-phi_0) / r1; - hist->Fill(kappa,phi_0,charge1+charge2); + + } + } } } } @@ -193,7 +239,7 @@ void AliL3HoughTest::Transform2Line(AliL3Histogram *hist,Int_t *rowrange) return; } - Int_t pad,charge,sector,row; + Int_t pad,time,charge,sector,row; Float_t hit[3],theta,rho; for(Int_t i=rowrange[0]; i<=rowrange[1]; i++) { @@ -201,17 +247,22 @@ void AliL3HoughTest::Transform2Line(AliL3Histogram *hist,Int_t *rowrange) for(Int_t d=0; dGetFirstXbin(); xbinGetLastXbin(); xbin++) + for(Int_t j=0; j<10; j++) { - theta = hist->GetBinCenterX(xbin); - rho = hit[0]*cos(theta) + hit[1]*sin(theta); - hist->Fill(theta,rho,charge); + time = j + fData[rowindex].mintime; + charge = fData[rowindex].pads[d][j]; + if(charge==0) continue; + AliL3Transform::Slice2Sector(0,i,sector,row); + AliL3Transform::Raw2Local(hit,sector,row,pad,time); + + hit[0] = hit[0] - AliL3Transform::Row2X(rowrange[0]); + + for(Int_t xbin=hist->GetFirstXbin(); xbinGetLastXbin(); xbin++) + { + theta = hist->GetBinCenterX(xbin); + rho = hit[0]*cos(theta) + hit[1]*sin(theta); + hist->Fill(theta,rho,charge); + } } } } @@ -225,7 +276,7 @@ void AliL3HoughTest::Transform2LineC(AliL3Histogram *hist,Int_t *rowrange) return; } - Int_t pad1,pad2,charge1,charge2,sector,row; + Int_t pad1,pad2,time1,time2,charge1,charge2,sector,row; Float_t theta,rho,hit[3],hit2[3]; for(Int_t i=rowrange[0]; i<=rowrange[1]; i++) { @@ -233,53 +284,174 @@ void AliL3HoughTest::Transform2LineC(AliL3Histogram *hist,Int_t *rowrange) for(Int_t d1=0; d1Fill(theta,rho,charge1+charge2); + Int_t rowindex2 = j - AliL3Transform::GetFirstRow(fCurrentPatch); + for(Int_t d2=0; d2Fill(theta,rho,charge1+charge2); + } + } } } } } } - -void AliL3HoughTest::FillImage(TH2 *hist) +void AliL3HoughTest::FillImage(TH2 *hist,Int_t row) { if(!fData) { cerr<<"AliL3HoughTest::FillImage : No data to fill"<=0) + if(i != row) continue; + + //cout<<"row "<Fill(xyz[0],xyz[1],charge); + for(Int_t k=0; k<10; k++) + { + Int_t time = k + fData[rowindex].mintime; + Int_t charge = fData[rowindex].pads[j][k]; + if(charge==0) continue; + //cout<=0) + hist->Fill(pad,time,charge); + else + hist->Fill(xyz[0],xyz[1],charge); + } } + if(row>=0) + break; } } + +void AliL3HoughTest::Transform2Line3D(TH3 *hist,Int_t *rowrange) +{ + if(!fData) + { + cerr<<"AliL3HoughTest::Transform2Line : No data"<GetXaxis()->GetFirst(); xbin<=hist->GetXaxis()->GetLast(); xbin++) + { + theta = hist->GetXaxis()->GetBinCenter(xbin); + rho = hit[0]*cos(theta) + hit[1]*sin(theta); + Float_t x = hit[0] + AliL3Transform::Row2X(rowrange[0]); + R = sqrt(x*x + hit[1]*hit[1]); + delta = atan(hit[2]/R); + hist->Fill(theta,rho,delta,charge); + } + } + } + } +} + +void AliL3HoughTest::Transform2LineC3D(TH3 *hist,Int_t *rowrange) +{ + if(!fData) + { + cerr<<"AliL3HoughTest::Transform2Line : No data"<Fill(theta,rho,delta,charge1+charge2); + } + } + } + } + } + } +} diff --git a/HLT/hough/AliL3HoughTest.h b/HLT/hough/AliL3HoughTest.h index 49db453cea7..d8febb12968 100644 --- a/HLT/hough/AliL3HoughTest.h +++ b/HLT/hough/AliL3HoughTest.h @@ -4,13 +4,15 @@ #include "AliL3RootTypes.h" struct SimData { + Int_t pads[10][10];//maximum 10 pads width Int_t npads; - Int_t pads[10];//maximum 10 pads width Int_t minpad; + Int_t mintime; }; class AliL3Histogram; class TH2; +class TH3; class AliL3HoughTest { @@ -23,12 +25,14 @@ class AliL3HoughTest { AliL3HoughTest(); virtual ~AliL3HoughTest(); - Bool_t GenerateTrackData(Double_t pt,Double_t psi,Int_t sign,Int_t patch,Int_t minhits); - void FillImage(TH2 *hist); + Bool_t GenerateTrackData(Double_t pt,Double_t psi,Double_t tgl,Int_t sign,Int_t patch,Int_t minhits); + void FillImage(TH2 *hist,Int_t row=-1); void Transform2Circle(AliL3Histogram *hist); void Transform2CircleC(AliL3Histogram *hist); void Transform2Line(AliL3Histogram *hist,Int_t *rowrange); void Transform2LineC(AliL3Histogram *hist,Int_t *rowrange); + void Transform2Line3D(TH3 *hist,Int_t *rowrange); + void Transform2LineC3D(TH3 *hist,Int_t *rowrange); ClassDef(AliL3HoughTest,1) //Hough transform base class }; -- 2.43.0