// @(#) $Id$ // Author: Anders Vestbo //*-- Copyright © ALICE HLT Group #include "AliL3StandardIncludes.h" #include "AliL3Logging.h" #include "AliL3HoughClusterTransformer.h" #include "AliL3MemHandler.h" #include "AliL3SpacePointData.h" #include "AliL3Transform.h" #include "AliL3DigitData.h" #include "AliL3Histogram.h" #include "AliL3ClustFinderNew.h" #if __GNUC__ >= 3 using namespace std; #endif //_____________________________________________________________ // AliL3HoughClusterTransformer // // Hough transformation class. // // This class performs the Hough transform on _clusters_, and not raw data. // Therefore, it first finds the clusters using the HLT cluster finder, and // then uses these as input for the transform. ClassImp(AliL3HoughClusterTransformer) AliL3HoughClusterTransformer::AliL3HoughClusterTransformer() { //Default constructor fParamSpace = 0; fNClusters = 0; fClusters = 0; fMemHandler = 0; #ifdef do_mc fTrackID = 0; #endif } AliL3HoughClusterTransformer::AliL3HoughClusterTransformer(Int_t slice,Int_t patch,Int_t netasegments) : AliL3HoughBaseTransformer(slice,patch,netasegments) { //Normal constructor fParamSpace = 0; fNClusters=0; fClusters=0; fMemHandler=0; #ifdef do_mc fTrackID=0; #endif } AliL3HoughClusterTransformer::~AliL3HoughClusterTransformer() { //dtor DeleteHistograms(); if(fMemHandler) delete fMemHandler; #ifdef do_mc if(fTrackID) { for(Int_t i=0; iReset(); if(fMemHandler) delete fMemHandler; fNClusters=0; fClusters=0; #ifdef do_mc AliL3Histogram *hist = fParamSpace[0]; Int_t ncells = (hist->GetNbinsX()+2)*(hist->GetNbinsY()+2); for(Int_t i=0; i= GetNEtaSegments() || etaindex < 0) return 0; if(!fParamSpace[etaindex]) return 0; return fParamSpace[etaindex]; } Double_t AliL3HoughClusterTransformer::GetEta(Int_t etaindex,Int_t slice) const { //Returns eta associated with given eta slice Double_t etaslice = (GetEtaMax()-GetEtaMin())/GetNEtaSegments(); Double_t eta=(Double_t)((etaindex+0.5)*etaslice); if(slice>17) eta*=-1; return eta; } void AliL3HoughClusterTransformer::FindClusters() { //Find the clusters if(!GetDataPointer()) { cerr<<"AliL3HoughClusterTransformer::FindClusters : Zero data pointer"<Allocate(kPointsize); AliL3ClustFinderNew *cf = new AliL3ClustFinderNew(); cf->InitSlice(0,GetPatch(),AliL3Transform::GetFirstRow(GetPatch()),AliL3Transform::GetLastRow(GetPatch()),kMaxpoints); cf->SetDeconv(kFALSE); cf->SetOutputArray(fClusters); cf->Read(1,GetDataPointer()); cf->ProcessDigits(); fNClusters = cf->GetNumberOfClusters(); delete cf; } void AliL3HoughClusterTransformer::TransformCircle() { //Transform the input data with a circle HT. //The function loops over all the data, and transforms each cluster with the equations: // //kappa = 2/r*sin(phi - phi0) // //where r = sqrt(x*x +y*y), and phi = arctan(y/x) // //Each cluster then transforms into a curve in the (kappa,phi0)-space. In order to find //which histogram in which the pixel should be transformed, the eta-value is calcluated //and the proper histogram index is found by GetEtaIndex(eta). FindClusters(); if(!fClusters) { LOG(AliL3Log::kError,"AliL3HoughClusterTransformer::TransformCircle","Data") <<"No input data "<= GetNEtaSegments()) continue; AliL3Histogram *hist = fParamSpace[etaindex]; //Do the transformation: Double_t r = sqrt(xyz[0]*xyz[0] + xyz[1]*xyz[1]); Double_t phi = AliL3Transform::GetPhi(xyz); //Fill the histogram along the phirange for(Int_t b=hist->GetFirstYbin(); b<=hist->GetLastYbin(); b++) { Double_t phi0 = hist->GetBinCenterY(b); Double_t kappa = 2*sin(phi - phi0)/r; hist->Fill(kappa,phi0,1); #ifdef do_mc Int_t bin = hist->FindBin(kappa,phi0); for(Int_t t=0; t<3; t++) { Int_t label = fClusters[i].fTrackID[t]; if(label < 0) break; UInt_t c; for(c=0; c= GetNEtaSegments()) continue; for(Int_t j=i+1; jFill(kappa,psi,1); #ifdef do_mc Int_t bin = hist->FindBin(kappa,psi); for(Int_t l=0; l<3; l++) { for(Int_t m=0; m<3; m++) { if(fClusters[i].fTrackID[l] == fClusters[j].fTrackID[m]) { Int_t label = fClusters[i].fTrackID[l]; if(label < 0) continue; UInt_t c; for(c=0; c GetNEtaSegments()) { cerr<<"AliL3HoughClusterTransformer::GetTrackID : Wrong etaindex "<FindBin(kappa,psi); Int_t label=-1; Int_t max=0; for(UInt_t i=0; i max) { max = nhits; label = fTrackID[etaindex][bin].fLabel[i]; } } return label; #else Int_t AliL3HoughClusterTransformer::GetTrackID(Int_t /*etaindex*/,Double_t /*kappa*/,Double_t /*psi*/) const { // Does nothing if do_mc undefinde cout<<"AliL3HoughClusterTransformer::GetTrackID : Compile with do_mc flag!"<