//$Id$ // Author: Anders Vestbo //*-- Copyright © ASV #include "AliL3StandardIncludes.h" #include "AliL3HoughTest.h" #include "AliL3ModelTrack.h" #include "AliL3Transform.h" #include "AliL3Histogram.h" #include "TRandom.h" #include "TMath.h" #include "TH2.h" #include "TH3.h" #if GCCVERSION == 3 using namespace std; #endif //_____________________________________________________________ // AliL3HoughTest ClassImp(AliL3HoughTest) AliL3HoughTest::AliL3HoughTest() { fData=0; } AliL3HoughTest::~AliL3HoughTest() { if(fData) delete [] fData; } 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) delete fData; fData = new SimData[AliL3Transform::GetNRows(patch)]; memset(fData,0,AliL3Transform::GetNRows(patch)*sizeof(SimData)); AliL3ModelTrack *track = new AliL3ModelTrack(); 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; for(Int_t i=AliL3Transform::GetFirstRow(patch); i<=AliL3Transform::GetLastRow(patch); i++) { Float_t xyz[3]; if(!track->GetCrossingPoint(i,xyz)) continue; Int_t rowindex = i - AliL3Transform::GetFirstRow(patch); Int_t sector,row; AliL3Transform::Slice2Sector(0,i,sector,row); AliL3Transform::Local2Raw(xyz,sector,row); if(xyz[1] < 0 || xyz[1] >= AliL3Transform::GetNPads(i) || xyz[2] < 0 || xyz[2] >= AliL3Transform::GetNTimeBins()) continue; hitcounter++; track->SetPadHit(i,xyz[1]); track->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)); 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 "<= 10) { cerr<<"AliL3HoughTest::GenerateTrackData : Wrong timeindex "< 1023) charge=1023; //cout<<"row "<GetFirstYbin(); k<=hist->GetLastYbin(); k++) { phi0 = hist->GetBinCenterY(k); kappa = 2*sin(phi-phi0)/R; hist->Fill(kappa,phi0,charge); } } } } } void AliL3HoughTest::Transform2CircleC(AliL3Histogram *hist) { if(!fData) { cerr<<"AliL3HoughTest::TransformC : No data"<Fill(kappa,phi_0,charge1+charge2); } } } } } } } void AliL3HoughTest::Transform2Line(AliL3Histogram *hist,Int_t *rowrange) { if(!fData) { cerr<<"AliL3HoughTest::Transform2Line : No data"<GetFirstXbin(); xbinGetLastXbin(); xbin++) { theta = hist->GetBinCenterX(xbin); rho = hit[0]*cos(theta) + hit[1]*sin(theta); hist->Fill(theta,rho,charge); } } } } } void AliL3HoughTest::Transform2LineC(AliL3Histogram *hist,Int_t *rowrange) { if(!fData) { cerr<<"AliL3HoughTest::Transform2Line : No data"<Fill(theta,rho,charge1+charge2); } } } } } } } void AliL3HoughTest::FillImage(TH2 *hist,Int_t row) { if(!fData) { cerr<<"AliL3HoughTest::FillImage : No data to fill"<=0) if(i != row) continue; //cout<<"row "<=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); } } } } } } }