// @(#) $Id$
// Original: AliHLTFitter.cxx,v 1.14 2005/06/14 10:55:21 cvetan
-// Author: Anders Vestbo <mailto:vestbo@fi.uib.no>
-//*-- Copyright © ALICE HLT Group
-
-/** \class AliHLTTPCFitter
-<pre>
-//_____________________________________________________________
-// AliHLTTPCFitter
-//
-// Fit class HLT for helix
-</pre>
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project *
+ * ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Primary Authors: Anders Vestbo, maintained by *
+ * Matthias Richter <Matthias.Richter@ift.uib.no> *
+ * for The ALICE HLT Project. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/** @file AliHLTTPCFitter.cxx
+ @author Anders Vestbo, maintained by Matthias Richter
+ @date
+ @brief Fit class HLT for helix
*/
#include <math.h>
#include "AliHLTTPCVertex.h"
#include "AliHLTTPCTrack.h"
#include "AliHLTTPCSpacePointData.h"
-#include "AliHLTTPCMemHandler.h"
#include "AliHLTTPCTransform.h"
-#include "AliHLTTPC.h"
+//#include "AliHLTTPC.h"
#if __GNUC__ >= 3
using namespace std;
AliHLTTPCFitter::AliHLTTPCFitter()
+ :
+ fTrack(NULL),
+ fVertex(NULL),
+ fVertexConstraint(0)
{
//constructor
- fTrack=0;
- fVertex=0;
+ // see header file for class documentation
+ // or
+ // refer to README to build package
+ // or
+ // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
memset(fClusters,0,36*6*sizeof(AliHLTTPCSpacePointData*));
+ memset(fNcl,0,36*6*sizeof(UInt_t));
}
AliHLTTPCFitter::AliHLTTPCFitter(AliHLTTPCVertex *vertex,Bool_t vertexconstraint)
+ :
+ fTrack(NULL),
+ fVertex(vertex),
+ fVertexConstraint(vertexconstraint)
{
//constructor
fTrack=0;
- fVertex = vertex;
- fVertexConstraint=vertexconstraint;
memset(fClusters,0,36*6*sizeof(AliHLTTPCSpacePointData*));
}
}
}
-void AliHLTTPCFitter::LoadClusters(Char_t *path,Int_t event,Bool_t sp)
-{
- //load clusters
- Char_t fname[256];
- AliHLTTPCMemHandler *clusterfile[36][6];
- for(Int_t s=0; s<=35; s++)
- {
- for(Int_t p=0; p<6; p++)
- {
- Int_t patch;
- if(sp==kTRUE)
- patch=-1;
- else
- patch=p;
- if(fClusters[s][p])
- delete fClusters[s][p];
- fClusters[s][p] = 0;
- clusterfile[s][p] = new AliHLTTPCMemHandler();
- sprintf(fname,"%s/points_%d_%d_%d.raw",path,event,s,patch);
- if(!clusterfile[s][p]->SetBinaryInput(fname))
- {
- delete clusterfile[s][p];
- clusterfile[s][p] = 0;
- continue;
- }
- fClusters[s][p] = (AliHLTTPCSpacePointData*)clusterfile[s][p]->Allocate();
- clusterfile[s][p]->Binary2Memory(fNcl[s][p],fClusters[s][p]);
- clusterfile[s][p]->CloseBinaryInput();
- if(sp==kTRUE)
- break;
- }
- }
-}
-
void AliHLTTPCFitter::SortTrackClusters(AliHLTTPCTrack *track) const
{
//Sort the internal cluster list in each track with respect to row numbering.
{
id=ids[k];
if(id < 0) continue;
- slice = (id>>25) & 0x7f;
- patch = (id>>22) & 0x7;
- pos = id&0x3fffff;
+ slice = AliHLTTPCSpacePointData::GetSlice(id);
+ patch = AliHLTTPCSpacePointData::GetPatch(id);
+ pos = AliHLTTPCSpacePointData::GetNumber(id);
AliHLTTPCSpacePointData *points = fClusters[slice][patch];
padrow = points[pos].fPadRow;
if(padrow > maxrow)
//Moved to C by Pablo Yepes
//Moved to AliROOT by ASV.
//------------------------------------------------------------------
+
+ if (!fTrack) return -1;
Double_t wsum = 0.0 ;
Double_t xav = 0.0 ;
// Loop over hits calculating average
Double_t * fXYWeight = new Double_t[(fTrack->GetNHits())];
UInt_t *hitnum = fTrack->GetHitNumbers();
+ if (!fXYWeight || !hitnum) {
+ if (fXYWeight) delete [] fXYWeight;
+ return -1;
+ }
+ memset(fXYWeight, 0, fTrack->GetNHits()*sizeof(Double_t));
for(Int_t i=0; i<fTrack->GetNHits(); i++)
{
UInt_t id = hitnum[i];
- Int_t slice = (id>>25) & 0x7f;
- Int_t patch = (id>>22) & 0x7;
- UInt_t pos = id&0x3fffff;
+ Int_t slice = AliHLTTPCSpacePointData::GetSlice(id);
+ Int_t patch = AliHLTTPCSpacePointData::GetPatch(id);
+ UInt_t pos = AliHLTTPCSpacePointData::GetNumber(id);
AliHLTTPCSpacePointData *points = fClusters[slice][patch];
fXYWeight[i] = 1./ (Double_t)(points[pos].fSigmaY2 + points[pos].fSigmaY2);
wsum += fXYWeight[i];
for(Int_t i=0; i<fTrack->GetNHits(); i++)
{
UInt_t id = hitnum[i];
- Int_t slice = (id>>25) & 0x7f;
- Int_t patch = (id>>22) & 0x7;
- UInt_t pos = id&0x3fffff;
+ Int_t slice = AliHLTTPCSpacePointData::GetSlice(id);
+ Int_t patch = AliHLTTPCSpacePointData::GetPatch(id);
+ UInt_t pos = AliHLTTPCSpacePointData::GetNumber(id);
AliHLTTPCSpacePointData *points = fClusters[slice][patch];
xi = points[pos].fX -xav;
for(Int_t i=0; i<fTrack->GetNHits(); i++)
{
UInt_t id = hitnum[i];
- Int_t slice = (id>>25) & 0x7f;
- Int_t patch = (id>>22) & 0x7;
- UInt_t pos = id&0x3fffff;
+ Int_t slice = AliHLTTPCSpacePointData::GetSlice(id);
+ Int_t patch = AliHLTTPCSpacePointData::GetPatch(id);
+ UInt_t pos = AliHLTTPCSpacePointData::GetNumber(id);
AliHLTTPCSpacePointData *points = fClusters[slice][patch];
xold = points[pos].fX - xav ;
if ( h11 == 0.0 || h22 == 0.0 ){
LOG(AliHLTTPCLog::kError,"AliHLTTPCFitter::FitCircle","TrackFit")<<AliHLTTPCLog::kDec<<
"Problems fitting circle"<<ENDLOG;
+ delete [] fXYWeight;
return 1 ;
}
Double_t rootsq = (h14*h14)/(h11*h11) + 4.0*h34 ;
Double_t x0,y0,psi,pt ;
Int_t lastid=fTrack->GetNHits()-1;
UInt_t id = hitnum[lastid];
- Int_t slice = (id>>25) & 0x7f;
- Int_t patch = (id>>22) & 0x7;
- UInt_t pos = id&0x3fffff;
+ Int_t slice = AliHLTTPCSpacePointData::GetSlice(id);
+ Int_t patch = AliHLTTPCSpacePointData::GetPatch(id);
+ UInt_t pos = AliHLTTPCSpacePointData::GetNumber(id);
AliHLTTPCSpacePointData *points = fClusters[slice][patch];
x0 = points[pos].fX;
y0 = points[pos].fY;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Int_t AliHLTTPCFitter::FitLine ( )
{
+ // Fit Line in s-z plane
+ if (!fTrack) return -1;
+
//
//Initialization
//
Double_t * fS = new Double_t[(fTrack->GetNHits())];
Double_t *fZWeight = new Double_t[fTrack->GetNHits()];
UInt_t *hitnum = fTrack->GetHitNumbers();
+ if (!fS || !fZWeight || !hitnum) {
+ if (fS) delete [] fS;
+ if (fZWeight) delete [] fZWeight;
+ return -1;
+ }
+ memset(fS, 0, fTrack->GetNHits()*sizeof(Double_t));
+ memset(fZWeight, 0, fTrack->GetNHits()*sizeof(Double_t));
if (0)//fVertexConstraint==kTRUE)
{
UInt_t id = hitnum[0];
- Int_t slice = (id>>25) & 0x7f;
- Int_t patch = (id>>22) & 0x7;
- UInt_t pos = id&0x3fffff;
+ Int_t slice = AliHLTTPCSpacePointData::GetSlice(id);
+ Int_t patch = AliHLTTPCSpacePointData::GetPatch(id);
+ UInt_t pos = AliHLTTPCSpacePointData::GetNumber(id);
AliHLTTPCSpacePointData *points = fClusters[slice][patch];
dx = points[pos].fX - fVertex->GetX();
else
{
UInt_t id = hitnum[0];
- Int_t slice = (id>>25) & 0x7f;
- Int_t patch = (id>>22) & 0x7;
- UInt_t posf = id&0x3fffff;
+ Int_t slice = AliHLTTPCSpacePointData::GetSlice(id);
+ Int_t patch = AliHLTTPCSpacePointData::GetPatch(id);
+ UInt_t posf = AliHLTTPCSpacePointData::GetNumber(id);
AliHLTTPCSpacePointData *pointsf = fClusters[slice][patch];
id = hitnum[(fTrack->GetNHits()-1)];
- slice = (id>>25) & 0x7f;
- patch = (id>>22) & 0x7;
- UInt_t posl = id&0x3fffff;
+ slice = AliHLTTPCSpacePointData::GetSlice(id);
+ patch = AliHLTTPCSpacePointData::GetPatch(id);
+ UInt_t posl = AliHLTTPCSpacePointData::GetNumber(id);
AliHLTTPCSpacePointData *pointsl = fClusters[slice][patch];
dx = pointsf[posf].fX - pointsl[posl].fX;
dy = pointsf[posf].fY - pointsl[posl].fY;
for(Int_t i=0; i<fTrack->GetNHits(); i++)
{
UInt_t id = hitnum[i];
- Int_t slice = (id>>25) & 0x7f;
- Int_t patch = (id>>22) & 0x7;
- UInt_t pos = id&0x3fffff;
+ Int_t slice = AliHLTTPCSpacePointData::GetSlice(id);
+ Int_t patch = AliHLTTPCSpacePointData::GetPatch(id);
+ UInt_t pos = AliHLTTPCSpacePointData::GetNumber(id);
AliHLTTPCSpacePointData *points = fClusters[slice][patch];
fZWeight[i] = 1./(Double_t)(points[pos].fSigmaZ2);
if(i>0)
{
id = hitnum[i-1];
- slice = (id>>25) & 0x7f;
- patch = (id>>22) & 0x7;
- UInt_t lastpos = id&0x3fffff;
+ slice = AliHLTTPCSpacePointData::GetSlice(id);
+ patch = AliHLTTPCSpacePointData::GetPatch(id);
+ UInt_t lastpos = AliHLTTPCSpacePointData::GetNumber(id);
AliHLTTPCSpacePointData *lastpoints = fClusters[slice][patch];
dx = points[pos].fX -lastpoints[lastpos].fX;
dy = points[pos].fY -lastpoints[lastpos].fY;
dpsi = 0.5 * (Double_t)sqrt ( dx*dx + dy*dy ) / radius ;
- if(fabs(dpsi) > 1)
+ if(fabs(dpsi) > 1) {
+ delete [] fS;
+ delete [] fZWeight;
return 1;
+ }
fTrack->SetPsierr(dpsi);
s = fS[i-1] - 2.0 * radius * (Double_t)asin ( dpsi ) ;
fS[i]=s;
{
chi2 = 99999.F ;
//fTrack->SetChiSq2(chi2);
+ delete [] fS;
+ delete [] fZWeight;
return 0 ;
}
for(Int_t i=0; i<fTrack->GetNHits(); i++)
{
UInt_t id = hitnum[i];
- Int_t slice = (id>>25) & 0x7f;
- Int_t patch = (id>>22) & 0x7;
- UInt_t pos = id&0x3fffff;
+ Int_t slice = AliHLTTPCSpacePointData::GetSlice(id);
+ Int_t patch = AliHLTTPCSpacePointData::GetPatch(id);
+ UInt_t pos = AliHLTTPCSpacePointData::GetNumber(id);
AliHLTTPCSpacePointData *points = fClusters[slice][patch];
r1 = points[pos].fZ - tanl * fS[i] - z0 ;
chi2 += (Double_t) ( (Double_t)(fZWeight[i]) * (r1 * r1) );