From 7a1f143244ea579f09d2315c2f199acc97770388 Mon Sep 17 00:00:00 2001 From: vestbo Date: Tue, 10 Dec 2002 10:34:28 +0000 Subject: [PATCH] Checking in code which until now only existed as macros in my home directory. The class contains functions to generate data, which should resemble tpc rawdata without any geant stuff in of course. Is primarily used to investigate the properties of the models, spread of peaks etc. --- HLT/hough/AliL3HoughTest.cxx | 197 +++++++++++++++++++++++++++++++++++ HLT/hough/AliL3HoughTest.h | 41 ++++++++ 2 files changed, 238 insertions(+) create mode 100644 HLT/hough/AliL3HoughTest.cxx create mode 100644 HLT/hough/AliL3HoughTest.h diff --git a/HLT/hough/AliL3HoughTest.cxx b/HLT/hough/AliL3HoughTest.cxx new file mode 100644 index 00000000000..bbf811ccef7 --- /dev/null +++ b/HLT/hough/AliL3HoughTest.cxx @@ -0,0 +1,197 @@ +//$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" + +#if GCCVERSION == 3 +using namespace std; +#endif + +//_____________________________________________________________ +// AliL3HoughTest + + +ClassImp(AliL3HoughTest) + +AliL3HoughTest::AliL3HoughTest() +{ + fData=0; +} + + +AliL3HoughTest::~AliL3HoughTest() +{ + if(fData) + delete [] fData; +} + +void AliL3HoughTest::GenerateTrackData(Double_t pt,Double_t psi,Int_t patch) +{ + 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->SetCharge(1); + track->CalculateHelix(); + + + Int_t temp[200]; + Int_t entries=100; + Int_t clustercharge=100; + for(Int_t i=AliL3Transform::GetFirstRow(patch); i<=AliL3Transform::GetLastRow(patch); i++) + { + Float_t xyz[3]; + + if(!track->GetCrossingPoint(i,xyz)) + continue; + + Int_t sector,row; + AliL3Transform::Slice2Sector(0,i,sector,row); + AliL3Transform::Local2Raw(xyz,sector,row); + + if(xyz[1] < 0 || xyz[1] >= AliL3Transform::GetNPads(i)) + continue; + track->SetPadHit(row,xyz[1]); + + memset(temp,0,200*sizeof(Int_t)); + Double_t xysigma = sqrt(track->GetParSigmaY2(i)); + Int_t minpad=200,j; + for(j=0; jGaus(xyz[1],xysigma)); + if(pad < 0 || pad >= AliL3Transform::GetNPads(i)) + continue; + temp[pad]++; + if(pad < minpad) + minpad=pad; + } + 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[i].pads[index]=charge; + fData[i].npads++; + } + fData[i].minpad=minpad; + } + delete track; +} + +void AliL3HoughTest::Transform(AliL3Histogram *hist) +{ + if(!fData) + { + cerr<<"AliL3HoughTest::Transform : No data"<GetFirstYbin(); k<=hist->GetLastYbin(); k++) + { + phi0 = hist->GetBinCenterY(k); + kappa = 2*sin(phi-phi0)/R; + hist->Fill(kappa,phi0,charge); + } + } + } +} + +void AliL3HoughTest::TransformC(AliL3Histogram *hist) +{ + if(!fData) + { + cerr<<"AliL3HoughTest::TransformC : No data"<Fill(kappa,phi_0,charge1+charge2); + } + } + } + } +} + +void AliL3HoughTest::FillImage(TH2 *hist) +{ + if(!fData) + { + cerr<<"AliL3HoughTest::FillImage : No data to fill"<Fill(xyz[0],xyz[1],charge); + } + } +} diff --git a/HLT/hough/AliL3HoughTest.h b/HLT/hough/AliL3HoughTest.h new file mode 100644 index 00000000000..431f63f430d --- /dev/null +++ b/HLT/hough/AliL3HoughTest.h @@ -0,0 +1,41 @@ +#ifndef ALIL3_HOUGHTEST +#define ALIL3_HOUGHTEST + +#include "AliL3RootTypes.h" + +struct SimData { + Int_t npads; + Int_t pads[10];//maximum 10 pads width + Int_t minpad; +}; + +class AliL3Histogram; +class TH2; + +class AliL3HoughTest { + + private: + SimData *fData; + Int_t fCurrentPatch; + + public: + + AliL3HoughTest(); + virtual ~AliL3HoughTest(); + + void GenerateTrackData(Double_t pt,Double_t psi,Int_t patch); + void FillImage(TH2 *hist); + void Transform(AliL3Histogram *hist); + void TransformC(AliL3Histogram *hist); + + ClassDef(AliL3HoughTest,1) //Hough transform base class +}; + +#endif + + + + + + + -- 2.39.3