+++ /dev/null
-// @(#) $Id$
-// Original: AliHLTConfMapFit.cxx,v 1.14 2005/06/14 10:55:21 cvetan
-
-/**************************************************************************
- * 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 AliHLTTPCConfMapFit.cxx
- @author Anders Vestbo, maintained by Matthias Richter
- @date
- @brief Fit class for conformal mapping tracking.
-*/
-
-// see header file for class documentation //
-// or //
-// refer to README to build package //
-// or //
-// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt //
-
-#include "AliHLTTPCRootTypes.h"
-#include "AliHLTTPCLogging.h"
-#include "AliHLTTPCVertex.h"
-#include "AliHLTTPCConfMapTrack.h"
-#include "AliHLTTPCConfMapPoint.h"
-#include "AliHLTTPCTransform.h"
-#include "AliHLTTPCConfMapFit.h"
-
-#if __GNUC__ >= 3
-using namespace std;
-#endif
-
-ClassImp(AliHLTTPCConfMapFit);
-
-AliHLTTPCConfMapFit::AliHLTTPCConfMapFit()
- :
- fTrack(NULL),
- fVertex(NULL)
-{
- //constructor
-}
-
-AliHLTTPCConfMapFit::AliHLTTPCConfMapFit(AliHLTTPCConfMapTrack *track,AliHLTTPCVertex *vertex)
- :
- fTrack(track),
- fVertex(vertex)
-
-{
- //constructor
-}
-
-AliHLTTPCConfMapFit::~AliHLTTPCConfMapFit()
-{
- // destructor
-}
-
-Int_t AliHLTTPCConfMapFit::FitHelix()
-{
- //fit the helix
- if(FitCircle())
- {
- LOG(AliHLTTPCLog::kError,"AliHLTTPCConfMapFit::FitHelix","TrackFit")<<AliHLTTPCLog::kDec<<
- "Problems during circle fit"<<ENDLOG;
- return 1;
- }
- if(FitLine())
- {
- LOG(AliHLTTPCLog::kError,"AliHLTTPCConfMapFit::FitHelix","TrackFit")<<AliHLTTPCLog::kDec<<
- "Problems during line fit"<<ENDLOG;
- return 1;
- }
- return 0;
-}
-
-Int_t AliHLTTPCConfMapFit::FitStraightLine() {
- //fit the straight line
- if(FitLineXY()) {
- LOG(AliHLTTPCLog::kError,"AliHLTTPCConfMapFit::FitStraightLine","TrackFit")<<AliHLTTPCLog::kDec<<
- "Problems during stright line fit in XY plane"<<ENDLOG;
- return 1;
- }
- if(FitLineSZ()){
- LOG(AliHLTTPCLog::kError,"AliHLTTPCConfMapFit::FitStraightLine","TrackFit")<<AliHLTTPCLog::kDec<<
- "Problems during stright line fit in SZ plane"<<ENDLOG;
- return 1;
- }
- return 0;
-}
-
-Int_t AliHLTTPCConfMapFit::FitCircle()
-{
- //-----------------------------------------------------------------
- //Fits circle parameters using algorithm
- //described by ChErnov and Oskov in Computer Physics
- //Communications.
- //
- //Written in FORTRAN by Jawluen Tang, Physics department , UT-Austin
- //Moved to C by Pablo Yepes
- //Moved to AliROOT by ASV.
- //------------------------------------------------------------------
-
- Double_t wsum = 0.0 ;
- Double_t xav = 0.0 ;
- Double_t yav = 0.0 ;
-
- Int_t numOfHits = fTrack->GetNumberOfPoints();
- //
- // Loop over hits calculating average
- Int_t co=0;
-
- for(fTrack->StartLoop(); fTrack->LoopDone(); fTrack->GetNextHit())
- {
- co++;
- AliHLTTPCConfMapPoint *cHit = (AliHLTTPCConfMapPoint*)fTrack->GetCurrentHit();
- cHit->SetXYWeight( 1./ (Double_t)(cHit->GetXerr()*cHit->GetXerr() + cHit->GetYerr()*cHit->GetYerr()) );
- wsum += cHit->GetXYWeight() ;
- xav += cHit->GetXYWeight() * cHit->GetX() ;
- yav += cHit->GetXYWeight() * cHit->GetY() ;
- }
- if(co!=numOfHits)
- LOG(AliHLTTPCLog::kError,"AliHLTTPCConfMapFit::FitCircle","TrackFit")<<AliHLTTPCLog::kDec<<
- "Mismatch of hits. Counter: "<<co<<" nHits: "<<numOfHits<<ENDLOG;
- if (fTrack->ComesFromMainVertex() == true)
- {
- wsum += fVertex->GetXYWeight() ;
- xav += fVertex->GetX() ;
- yav += fVertex->GetY() ;
- }
-
- xav = xav / wsum ;
- yav = yav / wsum ;
-//
-// CALCULATE <X**2>, <XY>, AND <Y**2> WITH <X> = 0, & <Y> = 0
-//
- Double_t xxav = 0.0 ;
- Double_t xyav = 0.0 ;
- Double_t yyav = 0.0 ;
- Double_t xi, yi ;
-
- for(fTrack->StartLoop(); fTrack->LoopDone(); fTrack->GetNextHit())
- {
- //AliHLTTPCConfMapPoint *cHit = (AliHLTTPCConfMapPoint *)hits->At(hit_counter);
- AliHLTTPCConfMapPoint *cHit = (AliHLTTPCConfMapPoint*)fTrack->GetCurrentHit();
- xi = cHit->GetX() - xav ;
- yi = cHit->GetY() - yav ;
- xxav += xi * xi * cHit->GetXYWeight() ;
- xyav += xi * yi * cHit->GetXYWeight() ;
- yyav += yi * yi * cHit->GetXYWeight() ;
- }
-
- if (fTrack->ComesFromMainVertex() == true)
- {
- xi = fVertex->GetX() - xav ;
- yi = fVertex->GetY() - yav ;
- xxav += xi * xi * fVertex->GetXYWeight() ;
- xyav += xi * yi * fVertex->GetXYWeight() ;
- yyav += yi * yi * fVertex->GetXYWeight() ;
- }
- xxav = xxav / wsum ;
- xyav = xyav / wsum ;
- yyav = yyav / wsum ;
-//
-//--> ROTATE COORDINATES SO THAT <XY> = 0
-//
-//--> SIGN(C**2 - S**2) = SIGN(XXAV - YYAV) >
-//--> & > ==> NEW : (XXAV-YYAV) > 0
-//--> SIGN(S) = SIGN(XYAV) >
-
- Double_t a = fabs( xxav - yyav ) ;
- Double_t b = 4.0 * xyav * xyav ;
-
- Double_t asqpb = a * a + b ;
- Double_t rasqpb = sqrt ( asqpb) ;
-
- Double_t splus = 1.0 + a / rasqpb ;
- Double_t sminus = b / (asqpb * splus) ;
-
- splus = sqrt (0.5 * splus ) ;
- sminus = sqrt (0.5 * sminus) ;
-//
-//-> FIRST REQUIRE : SIGN(C**2 - S**2) = SIGN(XXAV - YYAV)
-//
- Double_t sinrot, cosrot ;
- if ( xxav <= yyav ) {
- cosrot = sminus ;
- sinrot = splus ;
- }
- else {
- cosrot = splus ;
- sinrot = sminus ;
- }
-//
-//-> REQUIRE : SIGN(S) = SIGN(XYAV) * SIGN(C) (ASSUMING SIGN(C) > 0)
-//
- if ( xyav < 0.0 ) sinrot = - sinrot ;
-//
-//--> WE NOW HAVE THE SMALLEST ANGLE THAT GUARANTEES <X**2> > <Y**2>
-//--> TO GET THE SIGN OF THE CHARGE RIGHT, THE NEW X-AXIS MUST POINT
-//--> OUTWARD FROM THE ORGIN. WE ARE FREE TO CHANGE SIGNS OF BOTH
-//--> COSROT AND SINROT SIMULTANEOUSLY TO ACCOMPLISH THIS.
-//
-//--> CHOOSE SIGN OF C WISELY TO BE ABLE TO GET THE SIGN OF THE CHARGE
-//
- if ( cosrot*xav+sinrot*yav < 0.0 ) {
- cosrot = -cosrot ;
- sinrot = -sinrot ;
- }
-//
-//-> NOW GET <R**2> AND RSCALE= SQRT(<R**2>)
-//
- Double_t rrav = xxav + yyav ;
- Double_t rscale = sqrt(rrav) ;
-
- xxav = 0.0 ;
- yyav = 0.0 ;
- xyav = 0.0 ;
- Double_t xrrav = 0.0 ;
- Double_t yrrav = 0.0 ;
- Double_t rrrrav = 0.0 ;
-
- Double_t xixi, yiyi, riri, wiriri, xold, yold ;
-
- //for (hit_counter=0; hit_counter<numOfHits; hit_counter++)
- for(fTrack->StartLoop(); fTrack->LoopDone(); fTrack->GetNextHit())
- {
- //AliHLTTPCConfMapPoint *cHit = (AliHLTTPCConfMapPoint*)hits->At(hit_counter);
- AliHLTTPCConfMapPoint* cHit = (AliHLTTPCConfMapPoint*)fTrack->GetCurrentHit();
-
- xold = cHit->GetX() - xav ;
- yold = cHit->GetY() - yav ;
- //
- //--> ROTATE SO THAT <XY> = 0 & DIVIDE BY RSCALE SO THAT <R**2> = 1
- //
- xi = ( cosrot * xold + sinrot * yold ) / rscale ;
- yi = ( -sinrot * xold + cosrot * yold ) / rscale ;
-
- xixi = xi * xi ;
- yiyi = yi * yi ;
- riri = xixi + yiyi ;
- wiriri = cHit->GetXYWeight() * riri ;
-
- xyav += cHit->GetXYWeight() * xi * yi ;
- xxav += cHit->GetXYWeight() * xixi ;
- yyav += cHit->GetXYWeight() * yiyi ;
-
- xrrav += wiriri * xi ;
- yrrav += wiriri * yi ;
- rrrrav += wiriri * riri ;
- }
- //
-// Include vertex if required
-//
- if (fTrack->ComesFromMainVertex() == true)
- {
- xold = fVertex->GetX() - xav ;
- yold = fVertex->GetY() - yav ;
- //
- //--> ROTATE SO THAT <XY> = 0 & DIVIDE BY RSCALE SO THAT <R**2> = 1
- //
- xi = ( cosrot * xold + sinrot * yold ) / rscale ;
- yi = ( -sinrot * xold + cosrot * yold ) / rscale ;
-
- xixi = xi * xi ;
- yiyi = yi * yi ;
- riri = xixi + yiyi ;
- wiriri = fVertex->GetXYWeight() * riri ;
-
- xyav += fVertex->GetXYWeight() * xi * yi ;
- xxav += fVertex->GetXYWeight() * xixi ;
- yyav += fVertex->GetXYWeight() * yiyi ;
-
- xrrav += wiriri * xi ;
- yrrav += wiriri * yi ;
- rrrrav += wiriri * riri ;
- }
- //
- //
- //
- //--> DIVIDE BY WSUM TO MAKE AVERAGES
- //
- xxav = xxav / wsum ;
- yyav = yyav / wsum ;
- xrrav = xrrav / wsum ;
- yrrav = yrrav / wsum ;
- rrrrav = rrrrav / wsum ;
- xyav = xyav / wsum ;
-
- const Int_t ntry = 5 ;
-//
-//--> USE THESE TO GET THE COEFFICIENTS OF THE 4-TH ORDER POLYNIMIAL
-//--> DON'T PANIC - THE THIRD ORDER TERM IS ZERO !
-//
- Double_t xrrxrr = xrrav * xrrav ;
- Double_t yrryrr = yrrav * yrrav ;
- Double_t rrrrm1 = rrrrav - 1.0 ;
- Double_t xxyy = xxav * yyav ;
-
- Double_t c0 = rrrrm1*xxyy - xrrxrr*yyav - yrryrr*xxav ;
- Double_t c1 = - rrrrm1 + xrrxrr + yrryrr - 4.0*xxyy ;
- Double_t c2 = 4.0 + rrrrm1 - 4.0*xxyy ;
- Double_t c4 = - 4.0 ;
-//
-//--> COEFFICIENTS OF THE DERIVATIVE - USED IN NEWTON-RAPHSON ITERATIONS
-//
- Double_t c2d = 2.0 * c2 ;
- Double_t c4d = 4.0 * c4 ;
-//
-//--> 0'TH VALUE OF LAMDA - LINEAR INTERPOLATION BETWEEN P(0) & P(YYAV)
-//
-// LAMDA = YYAV * C0 / (C0 + YRRSQ * (XXAV-YYAV))
- Double_t lamda = 0.0 ;
- Double_t dlamda = 0.0 ;
-//
- Double_t chiscl = wsum * rscale * rscale ;
- Double_t dlamax = 0.001 / chiscl ;
-
- Double_t p, pd ;
- for ( int itry = 1 ; itry <= ntry ; itry++ ) {
- p = c0 + lamda * (c1 + lamda * (c2 + lamda * lamda * c4 )) ;
- pd = (c1 + lamda * (c2d + lamda * lamda * c4d)) ;
- dlamda = -p / pd ;
- lamda = lamda + dlamda ;
- if (fabs(dlamda)< dlamax) break ;
- }
-
- Double_t chi2 = (Double_t)(chiscl * lamda) ;
-
- fTrack->SetChiSq1(chi2);
- // Double_t dchisq = chiscl * dlamda ;
-//
-//--> NOW CALCULATE THE MATRIX ELEMENTS FOR ALPHA, BETA & KAPPA
-//
- Double_t h11 = xxav - lamda ;
- Double_t h14 = xrrav ;
- Double_t h22 = yyav - lamda ;
- Double_t h24 = yrrav ;
- Double_t h34 = 1.0 + 2.0*lamda ;
- if ( h11 == 0.0 || h22 == 0.0 ){
- LOG(AliHLTTPCLog::kError,"AliHLTTPCConfMapFit::FitCircle","TrackFit")<<AliHLTTPCLog::kDec<<
- "Problems fitting circle"<<ENDLOG;
- return 1 ;
- }
- Double_t rootsq = (h14*h14)/(h11*h11) + 4.0*h34 ;
-
- Double_t ratio, kappa, beta ;
- if ( fabs(h22) > fabs(h24) ) {
- ratio = h24 / h22 ;
- rootsq = ratio * ratio + rootsq ;
- kappa = 1.0 / sqrt(rootsq) ;
- beta = - ratio * kappa ;
- }
- else {
- ratio = h22 / h24 ;
- rootsq = 1.0 + ratio * ratio * rootsq ;
- beta = 1.0 / sqrt(rootsq) ;
- if ( h24 > 0 ) beta = - beta ;
- kappa = -ratio * beta ;
- }
- Double_t alpha = - (h14/h11) * kappa ;
-//
-//--> transform these into the lab coordinate system
-//--> first get kappa and back to real dimensions
-//
- Double_t kappa1 = kappa / rscale ;
- Double_t dbro = 0.5 / kappa1 ;
-//
-//--> next rotate alpha and beta and scale
-//
- Double_t alphar = (cosrot * alpha - sinrot * beta)* dbro ;
- Double_t betar = (sinrot * alpha + cosrot * beta)* dbro ;
-//
-//--> then translate by (xav,yav)
-//
- Double_t acent = (double)(xav - alphar) ;
- Double_t bcent = (double)(yav - betar ) ;
- Double_t radius = (double)dbro ;
-//
-// Get charge
-//
- Int_t q = ( ( yrrav < 0 ) ? 1 : -1 ) ;
-
- fTrack->SetCharge(q);
-
-
- //Set the first point on the track to the space point coordinates of the innermost track
- //This will be updated to lie on the fit later on (AliHLTTPCTrack::UpdateToFirstPoint).
- Double_t x0,y0,psi,pt ;
- AliHLTTPCConfMapPoint *lHit = (AliHLTTPCConfMapPoint*)fTrack->GetLastHit();
- x0 = lHit->GetX();
- y0 = lHit->GetY();
- fTrack->SetFirstPoint(x0,y0,0); //Z-value is set in FitLine
-
- psi = (Double_t)atan2(bcent-y0,acent-x0) ;
- psi = psi + q * AliHLTTPCTransform::PiHalf();
- if ( psi < 0 ) psi = psi + AliHLTTPCTransform::TwoPi();
- pt = (Double_t)(AliHLTTPCTransform::GetBFieldValue() * radius ) ;
-
- //Update the track parameters with the parameters from this fit:
- fTrack->SetPsi(psi);
- fTrack->SetPt(pt);
- fTrack->SetRadius(radius);
- fTrack->SetCenterX(acent);
- fTrack->SetCenterY(bcent);
-
- fTrack->SetY0err(0.03);
- //set error for pT and Y. psi, Z and Tgl are set.
-
- //
-// Get errors from fast fit
-//
- //if ( getPara()->getErrors ) getErrorsCircleFit ( acent, bcent, radius ) ;
-//
- return 0 ;
-
-}
-
-//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-// Fit Line in s-z plane
-//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Int_t AliHLTTPCConfMapFit::FitLine ( )
-{
- //
- //Initialization
- //
- Double_t sum = 0.F ;
- Double_t ss = 0.F ;
- Double_t sz = 0.F ;
- Double_t sss = 0.F ;
- Double_t ssz = 0.F ;
- //
- //find sum , sums ,sumz, sumss
- //
- Double_t dx, dy ;
- Double_t radius = (Double_t)(fTrack->GetPt() / AliHLTTPCTransform::GetBFieldValue() ) ;
-
- //TObjArray *hits = fTrack->GetHits();
- //Int_t numOfHits = fTrack->GetNumberOfPoints();
-
- if (0)// fTrack->ComesFromMainVertex() == true )
- {
- dx = ((AliHLTTPCConfMapPoint*)fTrack->GetFirstHit())->GetX() - fVertex->GetX();
- dy = ((AliHLTTPCConfMapPoint*)fTrack->GetFirstHit())->GetY() - fVertex->GetY() ;
- }
- else
- {
- dx = ((AliHLTTPCConfMapPoint *)fTrack->GetFirstHit())->GetX() - ((AliHLTTPCConfMapPoint *)fTrack->GetLastHit())->GetX() ;
- dy = ((AliHLTTPCConfMapPoint *)fTrack->GetFirstHit())->GetY() - ((AliHLTTPCConfMapPoint *)fTrack->GetLastHit())->GetY() ;
- //dx = ((AliHLTTPCConfMapPoint *)hits->First())->GetX() - ((AliHLTTPCConfMapPoint *)hits->Last())->GetX() ;
- //dy = ((AliHLTTPCConfMapPoint *)hits->First())->GetY() - ((AliHLTTPCConfMapPoint *)hits->Last())->GetY() ;
- }
-
- Double_t localPsi = 0.5F * sqrt ( dx*dx + dy*dy ) / radius ;
- Double_t totalS ;
-
- if ( fabs(localPsi) < 1. )
- {
- totalS = 2.0 * radius * asin ( localPsi ) ;
- }
- else
- {
- totalS = 2.0 * radius * AliHLTTPCTransform::Pi() ;
- }
-
- AliHLTTPCConfMapPoint *previousHit = NULL;
-
- // FtfBaseHit *previousHit = 0 ;
-
- //for ( startLoop() ; done() ; nextHit() ) {
- Double_t dpsi,s;
-
- // for(hit_counter=0; hit_counter<numOfHits; hit_counter++)
- for(fTrack->StartLoop(); fTrack->LoopDone(); fTrack->GetNextHit())
- {
- // AliHLTTPCConfMapPoint *cHit = (AliHLTTPCConfMapPoint*)hits->At(hit_counter);
- AliHLTTPCConfMapPoint *cHit = (AliHLTTPCConfMapPoint*)fTrack->GetCurrentHit();
- // if ( GetCurrentHit() != GetFirstHit() )
- if(previousHit)// hits->First())
- {
- // this means cHit != fTrack->GetFirstHit()
- dx = cHit->GetX() - previousHit->GetX() ;
- dy = cHit->GetY() - previousHit->GetY() ;
- dpsi = 0.5 * (Double_t)sqrt ( dx*dx + dy*dy ) / radius ;
- fTrack->SetPsierr(dpsi);
- s = previousHit->GetS() - 2.0 * radius * (Double_t)asin ( dpsi ) ;
- cHit->SetS(s);
- }
- else
- cHit->SetS(totalS);
- // cHit->s = totalS ;
-
- sum += cHit->GetZWeight() ;
- ss += cHit->GetZWeight() * cHit->GetS() ;
- sz += cHit->GetZWeight() * cHit->GetZ() ;
- sss += cHit->GetZWeight() * cHit->GetS() * cHit->GetS() ;
- ssz += cHit->GetZWeight() * cHit->GetS() * cHit->GetZ() ;
- previousHit = cHit ;
- }
-
- Double_t chi2,det = sum * sss - ss * ss;
- if ( fabs(det) < 1e-20)
- {
- chi2 = 99999.F ;
- fTrack->SetChiSq2(chi2);
- return 0 ;
- }
-
- //Compute the best fitted parameters A,B
- Double_t tanl,z0,dtanl,dz0;
-
- tanl = (Double_t)((sum * ssz - ss * sz ) / det );
- z0 = (Double_t)((sz * sss - ssz * ss ) / det );
-
- fTrack->SetTgl(tanl);
- fTrack->SetZ0(z0);
-
- // calculate chi-square
-
- chi2 = 0.;
- Double_t r1 ;
-
- //for(hit_counter=0; hit_counter<numOfHits; hit_counter++)
- for(fTrack->StartLoop(); fTrack->LoopDone(); fTrack->GetNextHit())
- {
- //AliHLTTPCConfMapPoint *cHit = (AliHLTTPCConfMapPoint*)hits->At(hit_counter);
- AliHLTTPCConfMapPoint *cHit = (AliHLTTPCConfMapPoint*)fTrack->GetCurrentHit();
- r1 = cHit->GetZ() - tanl * cHit->GetS() - z0 ;
- chi2 += (Double_t) ( (Double_t)cHit->GetZWeight() * (r1 * r1) );
- }
- fTrack->SetChiSq2(chi2);
- //
- // calculate estimated variance
- // varsq=chi/(double(n)-2.)
- // calculate covariance matrix
- // siga=sqrt(varsq*sxx/det)
- // sigb=sqrt(varsq*sum/det)
- //
- dtanl = (Double_t) ( sum / det );
- dz0 = (Double_t) ( sss / det );
-
- fTrack->SetTglerr(dtanl);
- fTrack->SetZ0err(dz0);
-
- //The calculation of pT comes from "Perticle Physics Booklet":
- //24.11 Measurement of particle momenta in a uniform magnetic field.
- //(dk)^2=(dk_res)^2 + (dk_ms)^2
- //for now k_ms is 0. Need to find length of track in 3D.
-
- Double_t lengthXY = fTrack->GetLengthXY();
- //Double_t lengthTot = fTrack->GetLengthTot();
- //Double_t beta = fTrack->GetP()/TMath::Sqrt((fTrack->GetP()*fTrack->GetP())+(0.13957*0.13957));
- //Double_t lambda = TMath::ATan(fTrack->GetTgl());
- Double_t lengthXY2 = lengthXY*lengthXY;
- Int_t nCluster4 = fTrack->GetNHits()+4;
-
- Double_t Kres = 0.03/lengthXY2;
- Kres = Kres * TMath::Sqrt(720/nCluster4);
-
- //Double_t Kres = (0.03/(lengthXY*lengthXY))*TMath::Sqrt(720/(fTrack->GetNHits()+4));
-
- //Double_t d = lengthTot*fTrack->GetP()*beta*TMath::Cos(lambda)*TMath::Cos(lambda);
- //Double_t Kms = (0.016/d)*TMath::Sqrt(lengthTot/24.0);
- Double_t Kms = 0.0;
-
- Double_t KTot = TMath::Sqrt((Kres * Kres) + (Kms * Kms));
-
- Double_t Pterr = (1/(0.3*AliHLTTPCTransform::GetBField()))*KTot;
-
- fTrack->SetPterr(Pterr);
-
- return 0 ;
-}
-
-
-//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-// Straight Line Fit in x-y plane
-//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Int_t AliHLTTPCConfMapFit::FitLineXY ( ){
- // -----------------------------------------------------------------------------
- // Implementation after Numerical Recipes in C, 2nd Edtion, chapter 15.2, p. 661
- // with y = b*x + a
- // and Data Analysis for Physical Science Students, Luis Lyons, chapter 2.4 p.51
- // with y = a' + bx' , x' = x - <x>
- // -----------------------------------------------------------------------------
-
- Double_t s = 0.;
- Double_t sx = 0.;
-
- Double_t sPrime = 0.;
- Double_t sxPrime = 0.;
- Double_t sxxPrime = 0.;
- Double_t syPrime = 0.;
- Double_t sxyPrime = 0.;
-
- Double_t chi2 = 0.;
-
- Int_t numOfHits = fTrack->GetNumberOfPoints();
-
- Int_t co=0;
-
- // - Loop over hits calculating average : xav
- for(fTrack->StartLoop(); fTrack->LoopDone(); fTrack->GetNextHit()) {
- co++;
- AliHLTTPCConfMapPoint *currentHit = (AliHLTTPCConfMapPoint*)fTrack->GetCurrentHit();
- // ** maybe not necessary, already done in ConfMapPoint
- currentHit->SetXYWeight( 1./ (Double_t)(currentHit->GetXerr()*currentHit->GetXerr() + currentHit->GetYerr()*currentHit->GetYerr()) );
- // **
- s += currentHit->GetXYWeight();
- sx += currentHit->GetXYWeight() * currentHit->GetX();
- }
-
- if(co!=numOfHits)
- LOG(AliHLTTPCLog::kError,"AliHLTTPCConfMapFit::FitLineXY","TrackFit") << "Mismatch of hits. Counter: "<<co<<" nHits: "<<numOfHits<<ENDLOG;
-
- Double_t xav = (Double_t)sx / s;
-
- // Calculate weighted means
- for(fTrack->StartLoop(); fTrack->LoopDone(); fTrack->GetNextHit()) {
- AliHLTTPCConfMapPoint *currentHit = (AliHLTTPCConfMapPoint*)fTrack->GetCurrentHit();
-
- Double_t xPrime = currentHit->GetX() - xav;
- sPrime += currentHit->GetXYWeight();
- sxPrime += currentHit->GetXYWeight() * xPrime;
- sxxPrime += currentHit->GetXYWeight() * xPrime * xPrime;
- syPrime += currentHit->GetXYWeight() * currentHit->GetY();
- sxyPrime += currentHit->GetXYWeight() * xPrime * currentHit->GetY();
- }
-
- Double_t det = sPrime*sxxPrime + sxPrime*sxPrime;
-
- if (fabs(det) < 1e-20) {
- LOG(AliHLTTPCLog::kDebug,"AliHLTTPCConfMapFit::FitLineXY","TrackFit") << "Determinant == 0" << ENDLOG;
- chi2 = 99999.F ;
- fTrack->SetChiSq1(chi2);
- return -1 ;
- }
-
- Double_t b = (Double_t)(sPrime*sxyPrime - sxPrime*syPrime) / det; // line parameter b
- Double_t aPrime = (Double_t)(sxxPrime*syPrime - sxPrime*sxyPrime) / det; // line parameter a
-
- Double_t sigma2b = (Double_t)1. / sxxPrime;
- //-- Double_t sigma2aprime = (Double_t)1. /sPrime;
-
- // Get gradient angle psi of line in xy plane
- Double_t psi = (Double_t) atan(b) ;
-
- // Calculate chi2
- for(fTrack->StartLoop(); fTrack->LoopDone(); fTrack->GetNextHit()) {
- AliHLTTPCConfMapPoint *currentHit = (AliHLTTPCConfMapPoint*)fTrack->GetCurrentHit();
- Double_t tempchi = currentHit->GetY() - aPrime - b*(currentHit->GetX() - xav);
- chi2 += tempchi*tempchi*currentHit->GetXYWeight() ;
- }
-
- Double_t a = aPrime - b*xav;
-
-
- // Set TrackParameter
- fTrack->SetChiSq1(chi2);
- fTrack->SetPsi(psi);
- fTrack->SetPsierr(sigma2b);
- fTrack->SetCenterX(0.); // Set to point on the track (for UpdateToFirstPoint)
- fTrack->SetCenterY(a); // Set to point on the track (for UpdateToFirstPoint)
-
- //Set the first point on the track to the space point coordinates of the innermost track
- //This will be updated to lie on the fit later on (AliHLTTPCTrack::UpdateToFirstPoint).
- AliHLTTPCConfMapPoint *lastHit = (AliHLTTPCConfMapPoint*)fTrack->GetLastHit();
- Double_t x0 = lastHit->GetX();
- Double_t y0 = lastHit->GetY();
- fTrack->SetFirstPoint(x0,y0,0); //Z-value is set in FitLineSZ
-
-
- //Set Defaults
- fTrack->SetRadius(-1.);
- fTrack->SetCharge(1);
- fTrack->SetPt(-1.);
-
-
- return 0;
-}
-
-
-//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-// Straight Line Fit in s-z plane
-//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-Int_t AliHLTTPCConfMapFit::FitLineSZ ( ){
- // -----------------------------------------------------------------------------
- // Implementation after Numerical Recipes in C, 2nd Edtion, chapter 15.2, p. 661
- // with z = b*s + a
- // and Data Analysis for Physical Science Students, Luis Lyons, chapter 2.4 p.51
- // with z = a' + bs' , s' = s - <s>
- // -----------------------------------------------------------------------------
-
- Double_t S = 0.;
- Double_t Ss = 0.;
-
- Double_t sPrime = 0.;
- Double_t ssPrime = 0.;
- Double_t sssPrime = 0.;
- Double_t szPrime = 0.;
- Double_t sszPrime = 0.;
-
- Double_t chi2 = 0.;
-
- // Matthias 16.10.2007
- // what's that!!! local variables 's' and 'S'
- // change Double_t s = 0.; -> slength
- Double_t slength = 0.;
-
- // Matthias 23.02.2011
- // this looks like a bug: previousHit is initialized, not changed
- // in the loop, but dereferenced for all but the first hit
- // changing the condition and adding an assignment at the end
- // of the loop
- AliHLTTPCConfMapPoint *previousHit = NULL;
-
- // - Loop over hits calculating length in xy-plane: s
- // - Loop over hits calculating average : sav
- for(fTrack->StartLoop(); fTrack->LoopDone(); fTrack->GetNextHit()) {
- AliHLTTPCConfMapPoint *currentHit = (AliHLTTPCConfMapPoint*)fTrack->GetCurrentHit();
- if(previousHit) {
- // this means currentHit != fTrack->GetFirstHit()
- Double_t dx = currentHit->GetX() - previousHit->GetX() ;
- Double_t dy = currentHit->GetY() - previousHit->GetY() ;
- slength = previousHit->GetS() - (Double_t)sqrt ( dx*dx + dy*dy );
- }
- else{
- Double_t dx = ((AliHLTTPCConfMapPoint *)fTrack->GetFirstHit())->GetX() - ((AliHLTTPCConfMapPoint *)fTrack->GetLastHit())->GetX();
- Double_t dy = ((AliHLTTPCConfMapPoint *)fTrack->GetFirstHit())->GetY() - ((AliHLTTPCConfMapPoint *)fTrack->GetLastHit())->GetY();
- slength = (Double_t)sqrt ( dx*dx + dy*dy );
- }
-
- currentHit->SetS(slength);
-
- S += currentHit->GetZWeight();
- Ss += currentHit->GetZWeight() * currentHit->GetS();
-
- // Matthias 23.02.2011
- // adding missing assignment, otherwise previousHit stays NULL
- previousHit=currentHit;
- }
-
- Double_t sav = (Double_t)Ss / S;
-
- // Calculate weighted means
- for(fTrack->StartLoop(); fTrack->LoopDone(); fTrack->GetNextHit()) {
- AliHLTTPCConfMapPoint *currentHit = (AliHLTTPCConfMapPoint*)fTrack->GetCurrentHit();
-
- // Matthias 20.05.2008
- // here was a shadowed variable, sPrime is formerly defined
- // renamed it to lsPrime ('local')
- Double_t lsPrime = currentHit->GetS() - sav;
- lsPrime += currentHit->GetZWeight();
- ssPrime += currentHit->GetZWeight() * lsPrime;
- sssPrime += currentHit->GetZWeight() * lsPrime * lsPrime;
- szPrime += currentHit->GetZWeight() * currentHit->GetZ();
- sszPrime += currentHit->GetZWeight() * lsPrime * currentHit->GetZ();
- }
-
- Double_t det = sPrime*sssPrime + ssPrime*ssPrime;
-
- if (fabs(det) < 1e-20) {
- LOG(AliHLTTPCLog::kDebug,"AliHLTTPCConfMapFit::FitLineSZ","TrackFit") << "Determinant == 0" << ENDLOG;
- chi2 = 99999.F ;
- fTrack->SetChiSq2(chi2);
- return -1 ;
- }
-
- Double_t b = (Double_t)(sPrime*sszPrime - ssPrime*szPrime) / det; // line parameter b
- Double_t aPrime = (Double_t)(sssPrime*szPrime - ssPrime*sszPrime) / det; // line parameter a
-
- Double_t a = aPrime - b*sav;
-
- Double_t sigma2b = (Double_t) 1. / sssPrime;
- Double_t sigma2aprime = (Double_t) 1. /sPrime;
-
- Double_t sigma2a = sigma2aprime + sav*sav * sigma2b*sigma2b;
-
- // Calculate chi2
- for(fTrack->StartLoop(); fTrack->LoopDone(); fTrack->GetNextHit()) {
- AliHLTTPCConfMapPoint *currentHit = (AliHLTTPCConfMapPoint*)fTrack->GetCurrentHit();
- Double_t tempchi = currentHit->GetZ() - aPrime - b*(currentHit->GetS() - sav);
- chi2 += tempchi*tempchi*currentHit->GetZWeight() ;
- }
-
- // Set TrackParameter
- fTrack->SetChiSq2(chi2);
- fTrack->SetTgl(b);
- fTrack->SetZ0(a);
- fTrack->SetTglerr(sigma2b);
-// fTrack->SetZ0err(sigma2aprime); // maybe subject to check
- fTrack->SetZ0err(sigma2a); // maybe subject to check
- return 0;
-}
-
+++ /dev/null
-// @(#) $Id$
-// Original: AliHLTConfMapFit.h,v 1.5 2004/07/05 09:03:11 loizides
-
-#ifndef ALIHLTTPCCONFMAPFIT_H
-#define ALIHLTTPCCONFMAPFIT_H
-
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* See cxx source for full Copyright notice *
-
-/** @file AliHLTTPCConfMapFit.h
- @author Anders Vestbo, maintained by Matthias Richter
- @date
- @brief Fit class for conformal mapping tracking.
-*/
-
-class AliHLTTPCConfMapTrack;
-class AliHLTTPCVertex;
-
-/**
- * @class AliHLTTPCConfMapFit
- *
- * Fit class for conformal mapping tracking
- *
- * @ingroup alihlt_tpc
- */
-class AliHLTTPCConfMapFit {
-
- public:
- /** default constructor */
- AliHLTTPCConfMapFit();
- /** constructor */
- AliHLTTPCConfMapFit (AliHLTTPCConfMapTrack *track,AliHLTTPCVertex *vertex);
- /** destructor */
- virtual ~AliHLTTPCConfMapFit();
-
- // helix fit
- Int_t FitHelix();
- Int_t FitCircle();
- Int_t FitLine();
-
- // straight line fit
- Int_t FitStraightLine();
- Int_t FitLineXY();
- Int_t FitLineSZ();
-
- private:
- /** copy constructor prohibited */
- AliHLTTPCConfMapFit(const AliHLTTPCConfMapFit&);
- /** assignment operator prohibited */
- AliHLTTPCConfMapFit& operator=(const AliHLTTPCConfMapFit&);
-
- AliHLTTPCConfMapTrack *fTrack; //!
- AliHLTTPCVertex *fVertex; //!
-
- ClassDef(AliHLTTPCConfMapFit,0) //Conformal mapping fit class
-};
-
-#endif // ALIHLTTPCCONFMAPFIT_H
+++ /dev/null
-// @(#) $Id$
-// Original: AliHLTConfMapPoint.cxx,v 1.10 2005/06/23 17:46:55 hristov
-
-/**************************************************************************
- * 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 AliHLTTPCConfMapPoint.cxx
- @author Anders Vestbo, maintained by Matthias Richter
- @date
- @brief Hit class for conformal mapper
-*/
-
-#include <cassert>
-#include "AliHLTTPCLogging.h"
-#include "AliHLTTPCConfMapPoint.h"
-#include "AliHLTTPCSpacePointData.h"
-#include "AliHLTTPCVertex.h"
-#include "AliHLTTPCConfMapTrack.h"
-
-/**
-<pre>
-//_____________________________________________________________
-// AliHLTTPCConfMapPoint
-//
-// Hit class for conformal mapper
-</pre>
-*/
-
-/** ROOT macro for the implementation of ROOT specific class methods */
-ClassImp(AliHLTTPCConfMapPoint);
-
-Bool_t AliHLTTPCConfMapPoint::fgDontMap=kFALSE;
-
-AliHLTTPCConfMapPoint::AliHLTTPCConfMapPoint()
- :
- fHitNumber(-1),
- fTrackNumber(0),
- fNextHitNumber(0),
- fUsed(kFALSE),
- fPadrow(0),
- fSector(0),
- fx(0),
- fy(0),
- fz(0),
- fxerr(0),
- fyerr(0),
- fzerr(0),
- fWxy(0),
- fWz(0),
- fs(0),
- fXt(0),
- fYt(0),
- fZt(0),
- fXterr(0),
- fYterr(0),
- fZterr(0),
- fXprime(0),
- fYprime(0),
- fXprimeerr(0),
- fYprimeerr(0),
- fXv(0),
- fYv(0),
- fZv(0),
- fXverr(0),
- fYverr(0),
- fZverr(0),
- fPhi(0),
- fEta(0),
- fNextVolumeHit(NULL),
- fNextRowHit(NULL),
- fNextTrackHit(NULL),
- fPhiIndex(0),
- fEtaIndex(0),
- fXYChi2(0),
- fSZChi2(0)
-{
- //Constructor
- fMCTrackID[0]=-1;
- fMCTrackID[1]=-1;
- fMCTrackID[2]=-1;
-}
-
-AliHLTTPCConfMapPoint::AliHLTTPCConfMapPoint(const AliHLTTPCConfMapPoint& src)
- :
- fHitNumber(src.fHitNumber),
- fTrackNumber(src.fTrackNumber),
- fNextHitNumber(src.fNextHitNumber),
- fUsed(src.fUsed),
- fPadrow(src.fPadrow),
- fSector(src.fSector),
- fx(src.fx),
- fy(src.fy),
- fz(src.fz),
- fxerr(src.fxerr),
- fyerr(src.fyerr),
- fzerr(src.fzerr),
- fWxy(src.fWxy),
- fWz(src.fWz),
- fs(src.fs),
- fXt(src.fXt),
- fYt(src.fYt),
- fZt(src.fZt),
- fXterr(src.fXterr),
- fYterr(src.fYterr),
- fZterr(src.fZterr),
- fXprime(src.fXprime),
- fYprime(src.fYprime),
- fXprimeerr(src.fXprimeerr),
- fYprimeerr(src.fYprimeerr),
- fXv(src.fXv),
- fYv(src.fYv),
- fZv(src.fZv),
- fXverr(src.fXverr),
- fYverr(src.fYverr),
- fZverr(src.fZverr),
- fPhi(src.fPhi),
- fEta(src.fEta),
- fNextVolumeHit(src.fNextVolumeHit),
- fNextRowHit(src.fNextRowHit),
- fNextTrackHit(src.fNextTrackHit),
- fPhiIndex(src.fPhiIndex),
- fEtaIndex(src.fEtaIndex),
- fXYChi2(src.fXYChi2),
- fSZChi2(src.fSZChi2)
-{
- //Copy Constructor
- fMCTrackID[0]=src.fMCTrackID[0];
- fMCTrackID[1]=src.fMCTrackID[1];
- fMCTrackID[2]=src.fMCTrackID[2];
-}
-
-AliHLTTPCConfMapPoint& AliHLTTPCConfMapPoint::operator=(const AliHLTTPCConfMapPoint& src)
-{
- if( &src ==this ) return *this;
-
- fHitNumber=src.fHitNumber;
- fTrackNumber=src.fTrackNumber;
- fNextHitNumber=src.fNextHitNumber;
- fUsed=src.fUsed;
- fPadrow=src.fPadrow;
- fSector=src.fSector;
- fx=src.fx;
- fy=src.fy;
- fz=src.fz;
- fxerr=src.fxerr;
- fyerr=src.fyerr;
- fzerr=src.fzerr;
- fWxy=src.fWxy;
- fWz=src.fWz;
- fs=src.fs;
- fXt=src.fXt;
- fYt=src.fYt;
- fZt=src.fZt;
- fXterr=src.fXterr;
- fYterr=src.fYterr;
- fZterr=src.fZterr;
- fXprime=src.fXprime;
- fYprime=src.fYprime;
- fXprimeerr=src.fXprimeerr;
- fYprimeerr=src.fYprimeerr;
- fXv=src.fXv;
- fYv=src.fYv;
- fZv=src.fZv;
- fXverr=src.fXverr;
- fYverr=src.fYverr;
- fZverr=src.fZverr;
- fPhi=src.fPhi;
- fEta=src.fEta;
- fNextVolumeHit=src.fNextVolumeHit;
- fNextRowHit=src.fNextRowHit;
- fNextTrackHit=src.fNextTrackHit;
- fPhiIndex=src.fPhiIndex;
- fEtaIndex=src.fEtaIndex;
- fXYChi2=src.fXYChi2;
- fSZChi2=src.fSZChi2;
- fMCTrackID[0]=src.fMCTrackID[0];
- fMCTrackID[1]=src.fMCTrackID[1];
- fMCTrackID[2]=src.fMCTrackID[2];
-
- return *this;
-}
-
-AliHLTTPCConfMapPoint::~AliHLTTPCConfMapPoint()
-{
- // Destructor.
-}
-
-Bool_t AliHLTTPCConfMapPoint::Read(const AliHLTTPCSpacePointData& hit)
-{
- //read the hits
- SetHitNumber(hit.fID);
- SetPadRow(hit.fPadRow);
- SetSector(hit.GetSlice());
- SetX(hit.fX);
- SetY(hit.fY);
- SetZ(hit.fZ);
- SetXerr(sqrt(hit.fSigmaY2));
- SetYerr(sqrt(hit.fSigmaY2));
- SetZerr(sqrt(hit.fSigmaZ2));
- return kTRUE;
-}
-
-void AliHLTTPCConfMapPoint::Reset()
-{
- //Reset this point.
- SetUsage(kFALSE);
- SetS(0);
- fNextRowHit = NULL;
- fNextVolumeHit=NULL;
- fNextTrackHit=NULL;
-}
-
-void AliHLTTPCConfMapPoint::Setup(AliHLTTPCVertex *vertex)
-{
- //Setup. Sets the vertex, conformal coordinates,
- //and phi and eta of each hit.
-
- SetIntPoint(vertex->GetX(), vertex->GetY(), vertex->GetZ(),
- vertex->GetXErr(), vertex->GetYErr(), vertex->GetZErr());
- SetShiftedCoord();
- SetConfCoord();
- // The angles are set properly if they are set after
- // the interaction point and the shifted coordinates
- SetAngles();
- //SetDist(0., 0.);
- return;
-}
-
-void AliHLTTPCConfMapPoint::SetIntPoint(Double_t inx, Double_t iny, Double_t inz,
- Double_t inxerr, Double_t inyerr, Double_t inzerr)
-{
- // Defines a new interaction point. This point is needed to calculate
- // the conformal coordinates.
-
- SetXt(inx);
- SetYt(iny);
- SetZt(inz);
- SetXterr(inxerr);
- SetYterr(inyerr);
- SetZterr(inzerr);
-
- return;
-}
-
-void AliHLTTPCConfMapPoint::SetAllCoord(const AliHLTTPCConfMapPoint *precedinghit)
-{
- // Sets the interaction point, the shifted coordinates, and the conformal mapping coordinates.
- // These values are calculated from the interaction point of the given cluster which should be a
- // already found cluster on the same track.
-
- if (this == precedinghit) {
- SetIntPoint(precedinghit->GetX(), precedinghit->GetY(), precedinghit->GetZ(),
- precedinghit->GetXerr(), precedinghit->GetYerr(), precedinghit->GetZerr());
- }
-
- else {
- SetIntPoint(precedinghit->GetXt(), precedinghit->GetYt(), precedinghit->GetZt(),
- precedinghit->GetXterr(), precedinghit->GetYterr(), precedinghit->GetZterr());
- }
-
- SetShiftedCoord();
- SetConfCoord();
-
- return;
-}
-
-void AliHLTTPCConfMapPoint::SetShiftedCoord()
-{
- // Sets the coordinates with resepct to the given vertex point
-
- SetXv(GetX() - fXt);
- SetYv(GetY() - fYt);
- SetZv(GetZ() - fZt);
- /*
- SetXverr(TMath::Sqrt(GetXerr()*GetXerr() + fXterr*fXterr));
- SetYverr(TMath::Sqrt(GetYerr()*GetYerr() + fYterr*fYterr));
- SetZverr(TMath::Sqrt(GetZerr()*GetZerr() + fZterr*fZterr));
- */
- return;
-}
-
-void AliHLTTPCConfMapPoint::SetConfCoord()
-{
- // Calculates the conformal coordinates of one cluster.
- // If the option "vertex_constraint" applies the interaction point is
- // assumed to be at (0, 0, 0). Otherwise the function will use the
- // interaction point specified by fXt and fYt.
-
- if(fgDontMap){
- fXprime = fx;
- fYprime = fy;
- fWxy = 0;
- fs = 0; //track trajectory
- fWz = 0;
- return;
- }
-
- Double_t r2;
- Double_t xyErrorScale = 1;
- Double_t szErrorScale = 1;
-
- if ((r2 = fXv*fXv + fYv*fYv))
- {
- fXprime = fXv / r2;
- fYprime = -fYv / r2;
-
- //set weights:
- fWxy = r2*r2 / ((xyErrorScale*xyErrorScale)*((fxerr*fxerr)+(fyerr*fyerr)));
- fs = 0; //track trajectory
- fWz = (Double_t)(1./(szErrorScale*fzerr*fzerr));
- } else {
- fXprime = 0.;
- fYprime = 0.;
- fXprimeerr = 0.;
- fYprimeerr = 0.;
- fWxy = 0;
- fWz = 0;
- fs = 0;
- }
-
- return;
-}
-
-void AliHLTTPCConfMapPoint::SetAngles()
-{
- // Calculates the angle phi and the pseudorapidity eta for each cluster.
- /*
- Double_t r = TMath::Sqrt(x*x + y*y);
-
- fPhi = TMath::ATan2(y,x);
- if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
- fEta = 3.*z/(TMath::Abs(z)+2.*r);
- return;
- */
- // Double_t r3dim = TMath::Sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
- Double_t r3dim = sqrt(fXv*fXv + fYv*fYv + fZv*fZv);
- //Double_t r2dim = TMath::Sqrt(fXv*fXv + fYv*fYv);
-
- /*if (r2dim == 0.) {
- // If r2dim == 0 the pseudorapidity eta cannot be calculated (division by zero)!
- // This can only happen if the point is lying on the z-axis and this should never be possible.
- cerr << "The pseudorapidity eta cannot be calculated (division by zero)! Set to 1.e-10." << endl;
- r2dim = 1.e-10;
- }
-
- if (fXv == 0.) {
- fPhi = (fYv > 0.) ? TMath::Pi() / 2. : - TMath::Pi() / 2.;
- }
-
- else {
- fPhi = (fXv > 0.) ? TMath::ASin(fYv/r2dim) : TMath::Pi() - TMath::ASin(fYv/r2dim);
- }
-
- if (fPhi < 0.) {
- fPhi += 2. * TMath::Pi();
- }
- */
- //fPhi = TMath::ATan2(y,x);
- fPhi = atan2(fy,fx);
- //if(fPhi<0) fPhi = fPhi + 2*TMath::Pi();
-
- //fEta = 0.5 * TMath::Log((r3dim + fZv)/(r3dim - fZv));
- fEta = 0.5 * log((r3dim + fZv)/(r3dim - fZv));
- return;
-}
-
-/*
-AliHLTTPCConfMapTrack *AliHLTTPCConfMapPoint::GetTrack(TClonesArray *tracks) const
-{
- // Returns the pointer to the track to which this hit belongs.
-
- return (AliHLTTPCConfMapTrack*)tracks->At(this->GetTrackNumber());
-}
-*/
+++ /dev/null
-// $Id$
-// Original: AliHLTConfMapPoint.h,v 1.8 2005/06/23 17:46:55 hristov
-
-#ifndef ALIHLTTPCCONFMAPPOINT_H
-#define ALIHLTTPCCONFMAPPOINT_H
-
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* See cxx source for full Copyright notice *
-
-/// @file AliHLTTPCConfMapPoint.h
-/// @author Anders Vestbo, maintained by Matthias Richter
-/// @date
-/// @brief Hit class for conformal mapper
-///
-
-#include "AliHLTTPCRootTypes.h"
-
-struct AliHLTTPCSpacePointData;
-class AliHLTTPCConfMapTrack;
-class AliHLTTPCVertex;
-
-/**
- * @class AliHLTTPCConfMapPoint
- * Hit class for conformal mapper
- *
- * @ingroup alihlt_tpc
- */
-class AliHLTTPCConfMapPoint {
-
- public:
- /** constructor */
- AliHLTTPCConfMapPoint();
- /** copy constructor */
- AliHLTTPCConfMapPoint(const AliHLTTPCConfMapPoint&);
- /** assignment operator */
- AliHLTTPCConfMapPoint& operator=(const AliHLTTPCConfMapPoint&);
- /** destructor */
- virtual ~AliHLTTPCConfMapPoint();
-
- /**
- * Reset this point.
- * The usage flag will be cleared as well as variables are reset.
- */
- void Reset();
-
- /**
- * Read one hit.
- * Set members from AliHLTTPCSpacePointData.
- */
- Bool_t Read(const AliHLTTPCSpacePointData& hit);
-
- // getter
- Double_t GetX() const {return fx;}
- Double_t GetY() const {return fy;}
- Double_t GetZ() const {return fz;}
- Double_t GetXerr() const {return fxerr;}
- Double_t GetYerr() const {return fyerr;}
- Double_t GetZerr() const {return fzerr;}
- Int_t GetPadRow() const {return fPadrow;}
- Int_t GetSector() const {return fSector;}
-
- Double_t GetXYWeight() const {return fWxy;}
- Double_t GetZWeight() const {return fWz;}
- Float_t GetS() const {return fs;}
-
- Bool_t GetUsage() const {return fUsed;}
- Double_t GetPhi() const {return fPhi;}
- Double_t GetEta() const {return fEta;}
-
- Double_t GetXprime() const {return fXprime;}
- Double_t GetYprime() const {return fYprime;}
- Double_t GetXprimeerr() const {return fXprimeerr;}
- Double_t GetYprimeerr() const {return fYprimeerr;}
-
- Double_t GetXt() const {return fXt;}
- Double_t GetYt() const {return fYt;}
- Double_t GetZt() const {return fZt;}
- Double_t GetXterr() const {return fXterr;}
- Double_t GetYterr() const {return fYterr;}
- Double_t GetZterr() const {return fZterr;}
-
- Double_t GetXv() const {return fXv;}
- Double_t GetYv() const {return fYv;}
- Double_t GetZv() const {return fZv;}
- Double_t GetXverr() const {return fXverr;}
- Double_t GetYverr() const {return fYverr;}
- Double_t GetZverr() const {return fZverr;}
-
- Int_t GetHitNumber() const {return fHitNumber;}
- Int_t GetNextHitNumber() const {return fNextHitNumber;}
- Int_t GetTrackNumber() const {return fTrackNumber;}
- //Int_t const *GetMCTrackID() const {return fMCTrackID;}
-
- AliHLTTPCConfMapPoint* GetNextVolumeHit(){return fNextVolumeHit;}
- AliHLTTPCConfMapPoint* GetNextRowHit(){return fNextRowHit;}
- AliHLTTPCConfMapPoint* GetNextTrackHit(){return fNextTrackHit;}
- Short_t GetPhiIndex() const {return fPhiIndex;}
- Short_t GetEtaIndex() const {return fEtaIndex;}
- Double_t GetXYChi2() const {return fXYChi2;}
- Double_t GetSZChi2() const {return fSZChi2;}
-
- // setter
- void SetNextVolumeHit(AliHLTTPCConfMapPoint* p){fNextVolumeHit=p;}
- void SetNextRowHit(AliHLTTPCConfMapPoint* p){fNextRowHit=p;}
- void SetNextTrackHit(AliHLTTPCConfMapPoint* p){fNextTrackHit=p;}
-
- void SetPhiIndex(Short_t p){fPhiIndex=p;}
- void SetEtaIndex(Short_t p){fEtaIndex=p;}
- void SetXYChi2(Double_t d) {fXYChi2=d;}
- void SetSZChi2(Double_t d) {fSZChi2=d;}
-
- static void SetDontMap(Bool_t b){fgDontMap=b;}
-
- void SetX(Double_t f){fx=f;}
- void SetY(Double_t f){fy=f;}
- void SetZ(Double_t f){fz=f;}
- void SetXerr(Double_t f){fxerr=f;}
- void SetYerr(Double_t f){fyerr=f;}
- void SetZerr(Double_t f){fzerr=f;}
- void SetPadRow(Int_t f){fPadrow=f;}
- void SetSector(Int_t f){fSector=f;}
- void SetMCTrackID(Int_t f,Int_t g,Int_t h){fMCTrackID[0] = f; fMCTrackID[1]=g; fMCTrackID[2]=h;}
-
- void SetXYWeight(Float_t f){fWxy = f;}
- void SetZWeight(Float_t f){fWz = f;}
- void SetS(Float_t f){fs = f;}
- void SetUsage(Bool_t f){fUsed=f;}
- void SetPhi(Double_t f ){fPhi = f;}
- void SetEta(Double_t f){fEta = f;}
- void SetXprime(Double_t f){fXprime = f;}
- void SetYprime(Double_t f){fYprime = f;}
- void SetXprimeerr(Double_t f){fXprimeerr = f;}
- void SetYprimeerr(Double_t f){fYprimeerr = f;}
- void SetXt(Double_t f){fXt = f;}
- void SetYt(Double_t f){fYt = f;}
- void SetZt(Double_t f){fZt = f;}
- void SetXterr(Double_t f){fXterr = f;}
- void SetYterr(Double_t f){fYterr = f;}
- void SetZterr(Double_t f){fZterr = f;}
- void SetXv(Double_t f){fXv = f;}
- void SetYv(Double_t f){fYv = f;}
- void SetZv(Double_t f){fZv = f;}
- void SetXverr(Double_t f){fXverr = f;}
- void SetYverr(Double_t f){fYverr = f;}
- void SetZverr(Double_t f){fZverr = f;}
- void SetHitNumber(Int_t f){fHitNumber=f;}
- void SetTrackNumber(Int_t f){fTrackNumber=f;}
- void SetNextHitNumber(Int_t f){fNextHitNumber=f;}
-
- void Setup(AliHLTTPCVertex *vertex);// does the usual setup in the right order
- void SetAngles(); // calculate spherical angles and set values
- void SetIntPoint(Double_t inx = 0., Double_t iny = 0.,
- Double_t inz = 0., Double_t inxerr = 0.,
- Double_t inyerr = 0., Double_t inzerr = 0.);
- //-> set interaction point
- void SetShiftedCoord();// set shifted coordinates
- void SetAllCoord(const AliHLTTPCConfMapPoint *hit);// set conformal mapping coordinates in respect to given hit
- void SetConfCoord();// conformal mapping
-
- private:
-
- Int_t fHitNumber; //hit number
- Int_t fTrackNumber; //track number
- Int_t fNextHitNumber; //next hit number
- Bool_t fUsed; //flag is used
- Int_t fPadrow; //padrow
- Int_t fSector; //sector
-
- //global coordinates and their errors
- Double_t fx; //glob x
- Double_t fy; //glob y
- Double_t fz; //glob z
- Double_t fxerr; //glob xerr
- Double_t fyerr; //glob yerr
- Double_t fzerr; //glob zerr
-
- Double_t fWxy; // x-y weight on x-y
- Double_t fWz; // z weight on z
- Float_t fs; //track trajectory
-
- // Interaction point
- Double_t fXt; // x-value of the interaction point
- Double_t fYt; // y-value of the interaction point
- Double_t fZt; // z-value of the interaction point
-
- Double_t fXterr; // error of mXt
- Double_t fYterr; // error of mYt
- Double_t fZterr; // error of mZt
-
- // conformal mapping coordinates
- Double_t fXprime; // transformed x
- Double_t fYprime; // transformed y
-
- Double_t fXprimeerr; // error of mXprime
- Double_t fYprimeerr; // error of mYprime
-
- // coordinates with respect to the vertex
-
- // cartesian coordinates
- Double_t fXv; // x with respect to vertex
- Double_t fYv; // y with respect to vertex
- Double_t fZv; // z with respect to vertex
-
- Double_t fXverr; // error of mXv
- Double_t fYverr; // error of mYv
- Double_t fZverr; // error of mZv
-
- // spherical coordinates
- Double_t fPhi; // angle phi
- Double_t fEta; // pseudorapidity
-
- AliHLTTPCConfMapPoint *fNextVolumeHit; //!
- AliHLTTPCConfMapPoint *fNextRowHit; //!
- AliHLTTPCConfMapPoint *fNextTrackHit; //! Linked chain of points in a track
- Short_t fPhiIndex; //phi index
- Short_t fEtaIndex; //eta index
- Double_t fXYChi2; //xy chi
- Double_t fSZChi2; //z chi
- Int_t fMCTrackID[3]; //MClabel of tracks, may overlap
-
- static Bool_t fgDontMap; //flag to switch off mapping
-
- ClassDef(AliHLTTPCConfMapPoint, 1) //Conformal mapping hit class.
-};
-
-#endif // ALIHLTTPCCONFMAPPOINT_H
+++ /dev/null
-// @(#) $Id$
-// Original: AliHLTConfMapTrack.cxx,v 1.16 2005/06/14 10:55:21 cvetan
-
-//**************************************************************************
-//* 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 AliHLTTPCConfMapTrack.cxx
- @author Anders Vestbo, maintained by Matthias Richter
- @date
- @brief Track class for conformal mapper
-*/
-
-#include "AliHLTTPCRootTypes.h"
-#include "AliHLTTPCLogging.h"
-#include "AliHLTTPCVertex.h"
-#include "AliHLTTPCConfMapPoint.h"
-#include "AliHLTTPCConfMapFit.h"
-#include "AliHLTTPCConfMapTrack.h"
-#include "AliHLTTPCTransform.h"
-
-#if __GNUC__ >= 3
-using namespace std;
-#endif
-
-ClassImp(AliHLTTPCConfMapTrack)
-
-
-AliHLTTPCConfMapTrack::AliHLTTPCConfMapTrack()
- :
- fCurrentHit(0),
- fLastHit(0),
- fFirstHit(0),
- fs11Xy(0),
- fs12Xy(0),
- fs22Xy(0),
- fg1Xy(0),
- fg2Xy(0),
- fs11Sz(0),
- fs12Sz(0),
- fs22Sz(0),
- fg1Sz(0),
- fg2Sz(0),
- fddXy(0),
- fa1Xy(0),
- fa2Xy(0),
- fddSz(0),
- fa1Sz(0),
- fa2Sz(0)
-{
- //Constructor
- fChiSq[0] = 0.;
- fChiSq[1] = 0.;
-}
-
-AliHLTTPCConfMapTrack::~AliHLTTPCConfMapTrack()
-{
- //deconstructor
-}
-
-void AliHLTTPCConfMapTrack::DeleteCandidate()
-{
- //Deletes this track by resetting all its parameters. Does not delete
- //the object itself.
-
- AliHLTTPCConfMapPoint *curHit = (AliHLTTPCConfMapPoint*)fFirstHit;
- AliHLTTPCConfMapPoint *nextHit;
-
- while(curHit != 0)
- {
- nextHit = (AliHLTTPCConfMapPoint*)curHit->GetNextTrackHit();
- curHit->SetNextTrackHit(0);
- curHit = nextHit;
- }
-
- UInt_t *hit_numbers = GetHitNumbers();
- for(Int_t i=0; i<GetNHits(); i++)
- {
- //fHitNumbers[i] = 0;
- hit_numbers[i]=0;
- }
-
- SetRadius(0.);
- SetCenterX(0.);
- SetCenterY(0.);
-
- ComesFromMainVertex(false);
-
- SetNHits(0);
- SetCharge(0);
- fChiSq[0] = 0.;
- fChiSq[1] = 0.;
-}
-
-
-void AliHLTTPCConfMapTrack::SetProperties(Bool_t usage)
-{
- //Set the hits to this track to 'usage'
- for(StartLoop(); LoopDone(); GetNextHit())
- {
- AliHLTTPCConfMapPoint *p = (AliHLTTPCConfMapPoint*)fCurrentHit;
- p->SetUsage(usage);
- }
- return;
-}
-
-void AliHLTTPCConfMapTrack::Reset()
-{
- //Resets the fit parameters of this track.
-
- //xy-plane
- fs11Xy = 0;
- fs12Xy = 0;
- fs22Xy = 0;
- fg1Xy = 0;
- fg2Xy = 0;
- fChiSq[0] = 0.;
-
- //sz-plane
- fs11Sz = 0;
- fs12Sz = 0;
- fs22Sz = 0;
- fg1Sz = 0;
- fg2Sz = 0;
- fChiSq[1] = 0;
- SetLength(0);
- SetNHits(0);
-}
-
-void AliHLTTPCConfMapTrack::UpdateParam(AliHLTTPCConfMapPoint *thisHit)
-{
- //Function to update fit parameters of track
- //Also, it updates the hit pointers.
-
-
- //Increment the number of hits assigned to this track:
-
- //fNHits++;
- Int_t nhits = GetNHits();
- nhits++;
- SetNHits(nhits); //SetNHits(nhits++);
-
- //Set the hit pointers:
- //if(fNHits == 1)
- if(GetNHits()==1)
- fFirstHit = thisHit;
- else
- ((AliHLTTPCConfMapPoint*)fLastHit)->SetNextTrackHit(thisHit);
- fLastHit = thisHit;
-
-
- fs11Xy = fs11Xy + thisHit->GetXYWeight() ;
- fs12Xy = fs12Xy + thisHit->GetXYWeight() * thisHit->GetXprime() ;
- fs22Xy = fs22Xy + thisHit->GetXYWeight() * pow((thisHit->GetXprime()),2) ;
- fg1Xy = fg1Xy + thisHit->GetXYWeight() * thisHit->GetYprime() ;
- fg2Xy = fg2Xy + thisHit->GetXYWeight() * thisHit->GetXprime() * thisHit->GetYprime() ;
-
- fddXy = fs11Xy * fs22Xy - pow((fs12Xy),2) ;
- if ( fddXy != 0 )
- {
- fa1Xy = ( fg1Xy * fs22Xy - fg2Xy * fs12Xy ) / fddXy ;
- fa2Xy = ( fg2Xy * fs11Xy - fg1Xy * fs12Xy ) / fddXy ;
- }
-
- // Now in the sz plane
- fs11Sz = fs11Sz + thisHit->GetZWeight() ;
- fs12Sz = fs12Sz + thisHit->GetZWeight() * thisHit->GetS() ;
- fs22Sz = fs22Sz + thisHit->GetZWeight() * thisHit->GetS() * thisHit->GetS() ;
- fg1Sz = fg1Sz + thisHit->GetZWeight() * thisHit->GetZ() ;
- fg2Sz = fg2Sz + thisHit->GetZWeight() * thisHit->GetS() * thisHit->GetZ() ;
-
-
- fddSz = fs11Sz * fs22Sz - fs12Sz * fs12Sz ;
- if ( fddSz != 0 ) {
- fa1Sz = ( fg1Sz * fs22Sz - fg2Sz * fs12Sz ) / fddSz ;
- fa2Sz = ( fg2Sz * fs11Sz - fg1Sz * fs12Sz ) / fddSz ;
- }
-}
-
-
-void AliHLTTPCConfMapTrack::Fill(AliHLTTPCVertex *vertex,Double_t max_Dca)
-{
- //Fill track variables with or without fit.
-
- // for straight line fit
- if (AliHLTTPCTransform::GetBFieldValue() == 0.0 ){
-
- SetRadius(0.);
- SetPt(0.);
-
- //go for fit of straight line in real space
- AliHLTTPCConfMapFit *fit = new AliHLTTPCConfMapFit(this,vertex);
- /* Matthias 13.12.2006
- * the global variable AliHLTTPCS::fgDoVertexFit has never been used so far
- * and has always been kTRUE.
- * In order to remove the AliHLTTPC class (which is the old steering class for
- * HLT (TPC) tracking) from the compilation, this function can not be activated
- * again. We have to think about a more elegant way to specify the parameters
- * anyway.
- ComesFromMainVertex(AliHLTTPC::DoVertexFit());
- */
- ComesFromMainVertex(kTRUE);
- fit->FitStraightLine();
-
- AliHLTTPCConfMapPoint *fHit = (AliHLTTPCConfMapPoint*)fFirstHit;
- SetLastPoint(fHit->GetX(),fHit->GetY(),fHit->GetZ());
-
- UpdateToFirstPoint();
-
- delete fit;
-
- }
- // for helix fit
- else {
- //fRadius = sqrt(fa2Xy*fa2Xy+1)/(2*fabs(fa1Xy));
- Double_t radius = sqrt(fa2Xy*fa2Xy+1)/(2*fabs(fa1Xy));
- SetRadius(radius);
-
- //fPt = (Double_t)(AliHLTTPCTransform::GetBFieldValue() * fRadius);
- Double_t pt = (Double_t)(AliHLTTPCTransform::GetBFieldValue() * GetRadius());
- SetPt(pt);
- //Set Error here?????
-
- if(GetPt() > max_Dca) //go for fit of helix in real space
- {
- AliHLTTPCConfMapFit *fit = new AliHLTTPCConfMapFit(this,vertex);
- /* Matthias 13.12.2006
- * the global variable AliHLTTPCS::fgDoVertexFit has never been used so far
- * and has always been kTRUE.
- * In order to remove the AliHLTTPC class (which is the old steering class for
- * HLT (TPC) tracking) from the compilation, this function can not be activated
- * again. We have to think about a more elegant way to specify the parameters
- * anyway.
- ComesFromMainVertex(AliHLTTPC::DoVertexFit());
- */
- ComesFromMainVertex(kTRUE);
- fit->FitHelix();
-
- //AliHLTTPCConfMapPoint *lHit = (AliHLTTPCConfMapPoint*)fLastHit;
- AliHLTTPCConfMapPoint *fHit = (AliHLTTPCConfMapPoint*)fFirstHit;
- SetLastPoint(fHit->GetX(),fHit->GetY(),fHit->GetZ());
-
- UpdateToFirstPoint();
-
- delete fit;
- }
- else if(GetPt() == 0)
- {
- LOG(AliHLTTPCLog::kError,"AliHLTTPCConfMapTrack::Fill","Tracks")<<AliHLTTPCLog::kDec<<
- "Found track with Pt=0!!!"<<ENDLOG;
- }
- else
- {
- LOG(AliHLTTPCLog::kError,"AliHLTTPCConfMapTrack::Fill","Tracks")<<AliHLTTPCLog::kDec<<
- "Track with pt<max_Dca :"<<GetPt()<<ENDLOG;
- }
- }
-}
-
-Int_t AliHLTTPCConfMapTrack::GetMCLabel()
-{
- //For evaluation study.
- //Returns the MCtrackID of the belonging clusters.
- //If MCLabel < 0, means that track is fake.
-
- return 0;
- /*
- Int_t num_of_clusters = GetNumberOfPoints();
- S *s=new S[num_of_clusters];
- Int_t i;
- for (i=0; i<num_of_clusters; i++) s[i].lab=s[i].max=0;
-
- Int_t lab=123456789;
- for (i=0; i<num_of_clusters; i++) {
- AliHLTTPCConfMapPoint *c=(AliHLTTPCConfMapPoint*)fPoints->UncheckedAt(i);
- lab=fabs(c->fMCTrackID[0]);
- Int_t j;
- for (j=0; j<num_of_clusters; j++)
- if (s[j].lab==lab || s[j].max==0) break;
- s[j].lab=lab;
- s[j].max++;
- }
-
- Int_t max=0;
- for (i=0; i<num_of_clusters; i++)
- if (s[i].max>max) {max=s[i].max; lab=s[i].lab;}
-
- delete[] s;
-
- for (i=0; i<num_of_clusters; i++) {
- AliHLTTPCConfMapPoint *c=(AliHLTTPCConfMapPoint*)fPoints->UncheckedAt(i);
- if (fabs(c->fMCTrackID[1]) == lab ||
- fabs(c->fMCTrackID[2]) == lab ) max++;
- }
-
- //check if more than 10% of the clusters are incorrectly assigned (fake track):
-
- if (1.-Float_t(max)/num_of_clusters > 0.10)
- {
- return -lab;
- }
- Int_t tail=Int_t(0.08*174);
- if (num_of_clusters < tail) return lab;
-
- max=0;
- for (i=1; i<=tail; i++) {
- AliHLTTPCConfMapPoint *c = (AliHLTTPCConfMapPoint*)fPoints->UncheckedAt(num_of_clusters-i);
- if (lab == fabs(c->fMCTrackID[0]) ||
- lab == fabs(c->fMCTrackID[1]) ||
- lab == fabs(c->fMCTrackID[2])) max++;
- }
- if (max < Int_t(0.5*tail))
- {
- //printf("Wrong innermost clusters\n");
- return -lab;
- }
- return lab;
- */
-}
-
+++ /dev/null
-// @(#) $Id$
-// Original: AliHLTConfMapTrack.h,v 1.4 2004/06/16 11:25:06 loizides
-
-#ifndef ALIHLTTPCCONFMAPTRACK_H
-#define ALIHLTTPCCONFMAPTRACK_H
-
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* See cxx source for full Copyright notice *
-
-/** @file AliHLTTPCConfMapTrack.h
- @author Anders Vestbo, maintained by Matthias Richter
- @date
- @brief Track class for conformal mapper
-*/
-
-#include "AliHLTTPCTrack.h"
-#include "AliHLTTPCConfMapPoint.h"
-
-class AliHLTTPCVertex;
-
-/**
- * @class AliHLTTPCConfMapTrack
- * Track class for conformal mapper
- *
- * @ingroup alihlt_tpc
- */
-class AliHLTTPCConfMapTrack :public AliHLTTPCTrack {
-
- public:
-
- AliHLTTPCConfMapTrack();
- /** destructor */
- virtual ~AliHLTTPCConfMapTrack();
- void Fill(AliHLTTPCVertex *vertex,Double_t max_Dca);
- void Reset();
- void UpdateParam(AliHLTTPCConfMapPoint *hit);
- void DeleteCandidate();
-
- void StartLoop() {fCurrentHit = fFirstHit;}
- void GetNextHit() {fCurrentHit = ((AliHLTTPCConfMapPoint*)fCurrentHit)->GetNextTrackHit();}
- Int_t LoopDone() const {return fCurrentHit != 0;}
-
- // setter
- void SetChiSq1(Double_t f) {fChiSq[0]=f;}
- void SetChiSq2(Double_t f) {fChiSq[1]=f;}
- void SetProperties(Bool_t fUsage);
-
- // getter
- Double_t const *GetChiSq() const { return fChiSq;}
- Double_t GetChiSq1() const { return fChiSq[0]; }
- Double_t GetChiSq2() const { return fChiSq[1]; }
-
- /*
- Double_t GetS11Xy() const {return fs11Xy;}
- Double_t GetS12Xy() const {return fs12Xy;}
- Double_t GetS22Xy() const {return fs22Xy;}
- Double_t GetG1Xy() const {return fg1Xy;}
- Double_t GetG2Xy() const {return fg2Xy;}
- Double_t GetS11Sz() const {return fs11Sz;}
- Double_t GetS12Sz() const {return fs12Sz;}
- Double_t GetS22z() const {return fs22Sz;}
- Double_t GetG1Sz() const {return fg1Sz;}
- Double_t GetG2Sz() const { return fg2Sz;}
- */
-
- Double_t GetDDXy() const {return fddXy;}
- Double_t GetA1Xy() const {return fa1Xy;}
- Double_t GetA2Xy() const {return fa2Xy;}
- Double_t GetDDSz() const {return fddSz;}
- Double_t GetA1Sz() const {return fa1Sz;}
- Double_t GetA2Sz() const {return fa2Sz;}
-
- AliHLTTPCConfMapPoint* GetFirstHit() const {return fFirstHit;}
- AliHLTTPCConfMapPoint* GetLastHit() const {return fLastHit;}
- AliHLTTPCConfMapPoint* GetCurrentHit() const {return fCurrentHit;}
- Int_t GetMCLabel();
-
- protected:
-
- AliHLTTPCConfMapPoint *fCurrentHit; //!
- AliHLTTPCConfMapPoint *fLastHit; //!
- AliHLTTPCConfMapPoint *fFirstHit; //!
-
-
- Double_t fChiSq[2]; //chi squared
-
- //fit parameters. Bad naming convention, i know...
- Double_t fs11Xy; //helper
- Double_t fs12Xy; //helper
- Double_t fs22Xy; //helper
- Double_t fg1Xy; //helper
- Double_t fg2Xy; //helper
- Double_t fs11Sz; //helper
- Double_t fs12Sz; //helper
- Double_t fs22Sz; //helper
- Double_t fg1Sz; //helper
- Double_t fg2Sz; //helper
-
- Double_t fddXy, fa1Xy, fa2Xy ; /*fit par in xy */
- Double_t fddSz, fa1Sz, fa2Sz ; /*fit par in sz */
-
- private:
- /** copy constructor prohibited */
- AliHLTTPCConfMapTrack(const AliHLTTPCConfMapTrack&);
- /** assignment operator prohibited */
- AliHLTTPCConfMapTrack& operator=(const AliHLTTPCConfMapTrack&);
-
- ClassDef(AliHLTTPCConfMapTrack,1) //Conformal mapping track class
-};
-
-#endif // ALIHLTTPCCONFMAPTRACK_H
-
+++ /dev/null
-// @(#) $Id$
-// Original: AliHLTConfMapper.cxx,v 1.26 2005/06/14 10:55:21 cvetan Exp $
-
-//**************************************************************************
-//* 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 AliHLTTPCConfMapper.cxx
- @author Anders Vestbo, Matthias Richter
- @date Conformal mapping base class.
- @brief
-*/
-
-#include <cassert>
-#include <sys/time.h>
-
-#include "AliHLTTPCRootTypes.h"
-#include "AliHLTTPCSpacePointData.h"
-#include "AliHLTTPCLogging.h"
-#include "AliHLTTPCVertex.h"
-#include "AliHLTTPCConfMapTrack.h"
-#include "AliHLTTPCConfMapPoint.h"
-#include "AliHLTTPCTrackArray.h"
-#include "AliHLTTPCTransform.h"
-#include "AliHLTTPCConfMapper.h"
-
-#if __GNUC__ >= 3
-using namespace std;
-#endif
-
-ClassImp(AliHLTTPCConfMapper)
-
-AliHLTTPCConfMapper::AliHLTTPCConfMapper()
- :
- fBench(kTRUE),
- fNTracks(0),
- fVertex(NULL),
- fVertexFinder(kFALSE),
- fHit(),
- fTrack(NULL),
- fMaxDca(0.0), // no clue whether this is reasonable, but at least better than without initialization
- fVolume(NULL),
- fRow(NULL),
- fNumRowSegment(0),
- fNumPhiSegment(0),
- fNumEtaSegment(0),
- fNumRowSegmentPlusOne(0),
- fNumPhiSegmentPlusOne(0),
- fNumEtaSegmentPlusOne(0),
- fNumPhiEtaSegmentPlusOne(0),
- fBounds(0),
- fPhiHitsOutOfRange(0),
- fEtaHitsOutOfRange(0),
- fPhiMin(0),
- fPhiMax(0),
- fEtaMin(0),
- fEtaMax(0),
- fRowMin(0),
- fRowMax(0),
- fVertexConstraint(kTRUE),
- fGoodDist(0.0),
- fMaxPhi(0.0),
- fMaxEta(0.0),
- fMainVertexTracks(0),
- fClustersUnused(0),
- fClusterCutZ(-1)
-{
- //Default constructor
- memset(fParamSet, 0, sizeof(fParamSet));
- memset(fTrackletLength, 0, sizeof(fTrackletLength));
- memset(fRowScopeTracklet, 0, sizeof(fRowScopeTracklet));
- memset(fRowScopeTrack, 0, sizeof(fRowScopeTrack));
- memset(fMinPoints, 0, sizeof(fMinPoints));
-
- memset(fMaxAngleTracklet, 0, sizeof(fMaxAngleTracklet));
- memset(fMaxDist, 0, sizeof(fMaxDist));
- memset(fHitChi2Cut, 0, sizeof(fHitChi2Cut));
- memset(fGoodHitChi2, 0, sizeof(fGoodHitChi2));
- memset(fTrackChi2Cut, 0, sizeof(fTrackChi2Cut));
-}
-
-AliHLTTPCConfMapper::~AliHLTTPCConfMapper()
-{
- // Destructor.
- if(fRow) {
- delete [] fRow;
- }
- if(fTrack) {
- delete fTrack;
- }
-}
-
-void AliHLTTPCConfMapper::InitVolumes()
-{
- //Data organization.
- //Allocate volumes, set conformal coordinates and pointers.
-
- //Should be done after setting the track parameters
-
- fNumRowSegmentPlusOne = AliHLTTPCTransform::GetNRows();//NumRows[0]; //Maximum 32.
- fNumPhiSegmentPlusOne = fNumPhiSegment+1;
- fNumEtaSegmentPlusOne = fNumEtaSegment+1;
- fNumPhiEtaSegmentPlusOne = fNumPhiSegmentPlusOne*fNumEtaSegmentPlusOne;
- fBounds = fNumRowSegmentPlusOne * fNumPhiSegmentPlusOne * fNumEtaSegmentPlusOne;
-
- Reset();
-
- fTrack = new AliHLTTPCTrackArray("AliHLTTPCConfMapTrack",10);
-}
-
-void AliHLTTPCConfMapper::Reset()
-{
- if(fVolume) delete [] fVolume;
- fVolume=NULL;
- if(fRow) delete [] fRow;
- fRow=NULL;
-
- fClustersUnused=0;
- fHit.clear();
-}
-
-void AliHLTTPCConfMapper::InitSector(Int_t sector,Int_t *rowrange,Float_t *etarange)
-{ //sector means slice here
- //Initialize tracker for tracking in a given sector.
- //Resets track and hit arrays.
- //Here it is also possible to specify a subsector, by defining
- //rowrange[0]=innermost row;
- //rowrange[1]=outermostrow;
- //Finally you can specify etaslices to save time (assuming a good seed from TRD...)
-
- //Define tracking area:
- if(rowrange)
- {
- fRowMin = rowrange[0];
- fRowMax = rowrange[1];
- }
- else //complete sector
- {
- fRowMin = 0;
- fRowMax = AliHLTTPCTransform::GetNRows() - 1;
- }
- if(etarange)
- {
- fEtaMin = etarange[0];
- fEtaMax = sector < 18 ? etarange[1] : -etarange[1];
- }
- else
- {
- fEtaMin = 0;
- fEtaMax = sector < 18 ? 0.9 : -0.9;
- }
-
- //Set the angles to sector 2:
- fPhiMin = -10*AliHLTTPCTransform::ToRad();//fParam->GetAngle(sector) - 10/todeg;
- fPhiMax = 10*AliHLTTPCTransform::ToRad();//fParam->GetAngle(sector) + 10/todeg;
-
- fNTracks=0;
- fMainVertexTracks = 0;
- fClustersUnused = 0;
- fEtaHitsOutOfRange=0;
- fPhiHitsOutOfRange=0;
-
- fNumRowSegment = fRowMax - fRowMin; //number of rows to be considered by tracker
- LOG(AliHLTTPCLog::kInformational,"AliHLTTPCConfMapper::InitSector","B-field")
- <<"Tracker initializing with a magnetic field of "<<AliHLTTPCTransform::GetBField()<<ENDLOG;
-
- fTrack->Reset();
-}
-
-Bool_t AliHLTTPCConfMapper::ReadHits(UInt_t count, AliHLTTPCSpacePointData* hits )
-{
- //read hits with ReadHitsChecked
- return ReadHitsChecked(count,hits,0);
-}
-
-Bool_t AliHLTTPCConfMapper::ReadHitsChecked(UInt_t count, AliHLTTPCSpacePointData* hits, unsigned int sizeInByte )
-{
- //read hits
- if(fClusterCutZ == -1){
- if (fHit.size()<fClustersUnused+count) fHit.resize(fClustersUnused+count);
- assert(fHit.size()>=fClustersUnused+count);
- for (Int_t i=0;(UInt_t)i<count;i++)
- {
- AliHLTTPCSpacePointData *hit = &hits[i];
- if (sizeInByte>0 && ((AliHLTUInt8_t*)hit)+sizeof(AliHLTTPCSpacePointData)>((AliHLTUInt8_t*)hits)+sizeInByte) {
- LOG(AliHLTTPCLog::kWarning,"AliHLTTPCConfMapper::ReadHits","")<<"Wrong size of data (" << sizeInByte << " byte), skipping array of AliHLTTPCSpacePointData" <<ENDLOG;;
- break;
- }
- fHit[i+fClustersUnused].Reset();
- fHit[i+fClustersUnused].Read(hits[i]);
- }
- fClustersUnused += count;
- }
- else{
- //Skipping clusters with high Z.
- UInt_t skipped=0;
-
- if (fHit.size()<fClustersUnused+count) fHit.resize(fClustersUnused+count);
- assert(fHit.size()>=fClustersUnused+count);
- for (Int_t i=0;(UInt_t)i<count;i++)
- {
- AliHLTTPCSpacePointData *hit = &hits[i];
- if (sizeInByte>0 && ((AliHLTUInt8_t*)hit)+sizeof(AliHLTTPCSpacePointData)>((AliHLTUInt8_t*)hits)+sizeInByte) {
- LOG(AliHLTTPCLog::kWarning,"AliHLTTPCConfMapper::ReadHits","")<<"Wrong size of data (" << sizeInByte << " byte), skipping array of AliHLTTPCSpacePointData" <<ENDLOG;;
- break;
- }
- if(hits[i].fZ > fClusterCutZ || hits[i].fZ < -1*fClusterCutZ){
- ++skipped;
- continue;
- }
- fHit[i+fClustersUnused-skipped].Reset();
- fHit[i+fClustersUnused-skipped].Read(hits[i]);
- }
- fClustersUnused += count - skipped;
- fHit.resize(fClustersUnused);
- }
-
- LOG(AliHLTTPCLog::kDebug,"AliHLTTPCConfMapper::ReadHits","#hits")
- <<AliHLTTPCLog::kDec<<"#hits: "<<count<<" total: "<<fClustersUnused<<ENDLOG;
-
- return true;
-}
-
-void AliHLTTPCConfMapper::SetPointers()
-{
- //Check if there are not enough clusters to make a track in this sector
- //Can happen in pp events.
-
- if(fClustersUnused < fMinPoints[fVertexConstraint])
- return;
-
- //Allocate detector volumes
- if (fVolume==NULL) {
- LOG(AliHLTTPCLog::kDebug,"AliHLTTPCConfMapper::InitVolumes","Memory")<<AliHLTTPCLog::kDec<<
- "Allocating "<<fBounds*sizeof(AliHLTTPCConfMapContainer)<<" Bytes to fVolume"<<ENDLOG;
- fVolume = new AliHLTTPCConfMapContainer[fBounds];
- }
-
- if (fRow==NULL) {
- LOG(AliHLTTPCLog::kDebug,"AliHLTTPCConfMapper::InitVolumes","Memory")<<AliHLTTPCLog::kDec<<
- "Allocating "<<fNumRowSegmentPlusOne*sizeof(AliHLTTPCConfMapContainer)<<" Bytes to fRow"<<ENDLOG;
- fRow = new AliHLTTPCConfMapContainer[fNumRowSegmentPlusOne];
- }
-
- memset(fVolume,0,fBounds*sizeof(AliHLTTPCConfMapContainer));
- memset(fRow,0,fNumRowSegmentPlusOne*sizeof(AliHLTTPCConfMapContainer));
-
- Float_t phiSlice = (fPhiMax-fPhiMin)/fNumPhiSegment;
- Float_t etaSlice = (fEtaMax-fEtaMin)/fNumEtaSegment;
-
- Int_t volumeIndex;
- Int_t localcounter=0;
- assert((int)fHit.size()>=fClustersUnused);
- for(Int_t j=0; j<fClustersUnused; j++)
- {
- AliHLTTPCConfMapPoint *thisHit = &(fHit[j]);
-
- thisHit->Setup(fVertex);
-
- Int_t localrow = thisHit->GetPadRow();
-
- if(localrow < fRowMin || localrow > fRowMax)
- continue;
-
- //Get indexes:
- thisHit->SetPhiIndex((Int_t)((thisHit->GetPhi()-fPhiMin)/phiSlice +1));
-
- if(thisHit->GetPhiIndex()<1 || thisHit->GetPhiIndex()>fNumPhiSegment)
- {
- //cout << "Phiindex: " << thisHit->phiIndex << " " << thisHit->GetPhi() << endl;
- fPhiHitsOutOfRange++;
- continue;
- }
-
- thisHit->SetEtaIndex((Int_t)((thisHit->GetEta()-fEtaMin)/etaSlice + 1));
- if(thisHit->GetEtaIndex()<1 || thisHit->GetEtaIndex()>fNumEtaSegment)
- {
- //cout << "Etaindex: " << thisHit->etaIndex << " " << thisHit->GetEta() << endl;
- fEtaHitsOutOfRange++;
- continue;
- }
- localcounter++;
-
- volumeIndex = (localrow-fRowMin)*fNumPhiEtaSegmentPlusOne +
- thisHit->GetPhiIndex()*fNumEtaSegmentPlusOne+thisHit->GetEtaIndex();
-
- if(fVolume[volumeIndex].first == NULL)
- fVolume[volumeIndex].first = (void *)thisHit;
- else
- ((AliHLTTPCConfMapPoint *)fVolume[volumeIndex].last)->SetNextVolumeHit(thisHit);
- fVolume[volumeIndex].last = (void *)thisHit;
-
-
- //set row pointers
- if(fRow[(localrow-fRowMin)].first == NULL)
- fRow[(localrow-fRowMin)].first = (void *)thisHit;
- else
- ((AliHLTTPCConfMapPoint *)(fRow[(localrow-fRowMin)].last))->SetNextRowHit(thisHit);
- fRow[(localrow-fRowMin)].last = (void *)thisHit;
- }
-
- //If a cluster has an Eta outside the Eta or Phi range set in the Tracker, it will go in to
- //the if here. This has been seen for high Eta clusters most likely from signal from the gating grid.
- //These clusters are read in, but not used in the Tracking.
-#ifdef PACKAGE_STRING
- if(fClustersUnused>0 && localcounter==0)
- LOG(AliHLTTPCLog::kDebug,"AliHLTTPCConfMapper::SetPointers","Parameters")
- <<AliHLTTPCLog::kDec<<"No points passed to track finder, hits out of range: "
- <<fEtaHitsOutOfRange+fPhiHitsOutOfRange<<ENDLOG;
-
- Int_t hits_accepted=fClustersUnused-(fEtaHitsOutOfRange+fPhiHitsOutOfRange);
- LOG(AliHLTTPCLog::kDebug,"AliHLTTPCConfMapper::SetPointers","Setup")
- <<"Setup finished, hits out of range: "<<fEtaHitsOutOfRange+fPhiHitsOutOfRange
- <<" hits accepted "<<hits_accepted<<ENDLOG;
-#endif //PACKAGE_STRING
-}
-
-void AliHLTTPCConfMapper::MainVertexTrackingA()
-{
- //Tracking with vertex constraint.
-
- if(!fParamSet[(Int_t)kTRUE])
- {
- LOG(AliHLTTPCLog::kError,"AliHLTTPCConfMapper::MainVertexTracking","Parameters")<<AliHLTTPCLog::kDec<<
- "Tracking parameters not set!"<<ENDLOG;
- return;
- }
-
- Double_t initCpuTime,cpuTime;
- initCpuTime = CpuTime();
-
- SetPointers();
- SetVertexConstraint(true);
- cpuTime = CpuTime() - initCpuTime;
- if(fBench)
- LOG(AliHLTTPCLog::kBenchmark,"AliHLTTPCConfMapper::MainVertexTrackingA","Timing")
- <<AliHLTTPCLog::kDec<<"Setup finished in "<<cpuTime*1000<<" ms"<<ENDLOG;
-
-}
-
-void AliHLTTPCConfMapper::MainVertexTrackingB()
-{
- //Tracking with vertex constraint.
-
- if(!fParamSet[(Int_t)kTRUE])
- {
- LOG(AliHLTTPCLog::kError,"AliHLTTPCConfMapper::MainVertexTracking","Parameters")<<AliHLTTPCLog::kDec<<
- "Tracking parameters not set!"<<ENDLOG;
- return;
- }
- Double_t initCpuTime,cpuTime;
- initCpuTime = CpuTime();
-
- ClusterLoop();
-
- cpuTime = CpuTime() - initCpuTime;
- if(fBench)
- LOG(AliHLTTPCLog::kBenchmark,"AliHLTTPCConfMapper::MainVertexTrackingB","Timing")
- <<AliHLTTPCLog::kDec<<"Main Tracking finished in "<<cpuTime*1000<<" ms"<<ENDLOG;
-}
-
-void AliHLTTPCConfMapper::MainVertexTracking()
-{
- //Tracking with vertex constraint.
-
- if(!fParamSet[(Int_t)kTRUE])
- {
- LOG(AliHLTTPCLog::kError,"AliHLTTPCConfMapper::MainVertexTracking","Parameters")<<AliHLTTPCLog::kDec<<
- "Tracking parameters not set!"<<ENDLOG;
- return;
- }
-
- Double_t initCpuTime,cpuTime;
- initCpuTime = CpuTime();
-
- SetPointers();
-
- SetVertexConstraint(true);
-
- ClusterLoop();
-
- cpuTime = CpuTime() - initCpuTime;
- if(fBench)
- LOG(AliHLTTPCLog::kBenchmark,"AliHLTTPCConfMapper::MainVertexTracking","Timing")<<AliHLTTPCLog::kDec<<
- "Tracking finished in "<<cpuTime*1000<<" ms"<<ENDLOG;
-
- return;
-}
-
-void AliHLTTPCConfMapper::NonVertexTracking()
-{
- //Tracking with no vertex constraint. This should be called after doing MainVertexTracking,
- //in order to do tracking on the remaining clusters.
- //The conformal mapping is now done with respect to the first cluster
- //assosciated with this track.
-
- if(!fParamSet[(Int_t)kFALSE])
- {
- LOG(AliHLTTPCLog::kError,"AliHLTTPCConfMapper::NonVertexTracking","Parameters")<<AliHLTTPCLog::kDec<<
- "Tracking parameters not set!"<<ENDLOG;
- return;
- }
-
- SetVertexConstraint(false);
-
- SetPointers(); //To be able to do only nonvertextracking (more testing)
-
- ClusterLoop();
- LOG(AliHLTTPCLog::kInformational,"AliHLTTPCConfMapper::NonVertexTracking","ntracks")<<AliHLTTPCLog::kDec<<
- "Number of nonvertex tracks found: "<<(fNTracks-fMainVertexTracks)<<ENDLOG;
- return;
-}
-
-void AliHLTTPCConfMapper::MainVertexSettings(Int_t trackletlength, Int_t tracklength,
- Int_t rowscopetracklet, Int_t rowscopetrack,
- Double_t maxphi,Double_t maxeta)
-{
- //Settings for main vertex tracking. The cuts are:
- //TrackletLength: #hits on segment, before trying to build a track
- //TrackLength: Minimum hits on a track
- //RowScopeTracklet: Row search range for segments
- //RowScopeTrack: Row search range for tracks
-
- SetTrackletLength(trackletlength,(Bool_t)true);
- SetRowScopeTracklet(rowscopetracklet, (Bool_t) true);
- SetRowScopeTrack(rowscopetrack, (Bool_t) true);
- SetMinPoints(tracklength,(Bool_t)true);
- fMaxPhi=maxphi;
- fMaxEta=maxeta;
- SetParamDone(kTRUE);
-}
-
-void AliHLTTPCConfMapper::NonVertexSettings(Int_t trackletlength, Int_t tracklength,
- Int_t rowscopetracklet, Int_t rowscopetrack)
-{
- //set parameters for non-vertex tracking
- SetTrackletLength(trackletlength,(Bool_t)false);
- SetRowScopeTracklet(rowscopetracklet, (Bool_t)false);
- SetRowScopeTrack(rowscopetrack, (Bool_t)false);
- SetMinPoints(tracklength,(Bool_t)false);
- SetParamDone(kFALSE);
-}
-
-void AliHLTTPCConfMapper::SetTrackCuts(Double_t hitChi2Cut, Double_t goodHitChi2, Double_t trackChi2Cut,Int_t maxdist,Bool_t vertexconstraint)
-{
- //Settings for tracks. The cuts are:
- //HitChi2Cut: Maximum hit chi2
- //goodHitChi2: Chi2 to stop look for next hit
- //trackChi2Cut: Maximum track chi2
- //maxdist: Maximum distance between two clusters when forming segments
-
- SetHitChi2Cut(hitChi2Cut,vertexconstraint);
- SetGoodHitChi2(goodHitChi2,vertexconstraint);
- SetTrackChi2Cut(trackChi2Cut,vertexconstraint);
- SetMaxDist(maxdist,vertexconstraint);
-}
-
-void AliHLTTPCConfMapper::SetTrackletCuts(Double_t maxangle,Double_t goodDist, Bool_t vc)
-{
- //Sets cuts of tracklets. Right now this is only:
- //maxangle: Maximum angle when forming segments (if trackletlength > 2)
-
- fGoodDist=goodDist;
- SetMaxAngleTracklet(maxangle, vc);
-}
-
-void AliHLTTPCConfMapper::ClusterLoop()
-{
- //Loop over hits, starting at outermost padrow, and trying to build segments.
-
- //Check if there are not enough clusters to make a track in this sector
- //Can happen in pp events.
- if(fClustersUnused < fMinPoints[fVertexConstraint])
- return;
-
- Int_t rowsegm,lastrow = fRowMin + fMinPoints[fVertexConstraint];
- AliHLTTPCConfMapPoint *hit;
-
- //Loop over rows, and try to create tracks from the hits.
- //Starts at the outermost row, and loops as long as a track can be build, due to length.
-
- for(rowsegm = fRowMax; rowsegm >= lastrow; rowsegm--)
- {
- if(fRow[(rowsegm-fRowMin)].first && ((AliHLTTPCConfMapPoint*)fRow[(rowsegm-fRowMin)].first)->GetPadRow() < fRowMin + 1)
- break;
-
- for(hit = (AliHLTTPCConfMapPoint*)fRow[(rowsegm-fRowMin)].first; hit!=0; hit=hit->GetNextRowHit())
- {
- if(hit->GetUsage() == true)
- continue;
- else
- CreateTrack(hit);
- }
- }
-
- return;
-}
-
-
-void AliHLTTPCConfMapper::CreateTrack(AliHLTTPCConfMapPoint *hit)
-{
- //Tries to create a track from the initial hit given by ClusterLoop()
-
- AliHLTTPCConfMapPoint *closesthit = NULL;
- AliHLTTPCConfMapTrack *track = NULL;
-
- Int_t point;
- Int_t tracks = fNTracks;
- fNTracks++;
-
- track = (AliHLTTPCConfMapTrack*)fTrack->NextTrack();
-
- //reset hit parameters:
- track->Reset();
-
- UInt_t *trackhitnumber = track->GetHitNumbers();
-
- //set conformal coordinates if we are looking for non vertex tracks
- if(!fVertexConstraint)
- {
- hit->SetAllCoord(hit);
- }
-
- //fill fit parameters of initial track:
- track->UpdateParam(hit); //here the number of hits is incremented.
- trackhitnumber[track->GetNumberOfPoints()-1] = hit->GetHitNumber();
-
- Double_t dx,dy;
- //create tracklets:
-
- for(point=1; point<fTrackletLength[fVertexConstraint]; point++)
- {
- if((closesthit = GetNextNeighbor(hit)))
- {//closest hit exist
-
- // Calculate track length in sz plane
- dx = ((AliHLTTPCConfMapPoint*)closesthit)->GetX() - ((AliHLTTPCConfMapPoint*)hit)->GetX();
- dy = ((AliHLTTPCConfMapPoint*)closesthit)->GetY() - ((AliHLTTPCConfMapPoint*)hit)->GetY();
- //track->fLength += (Double_t)sqrt ( dx * dx + dy * dy ) ;
- Double_t length = track->GetLength()+(Double_t)sqrt ( dx * dx + dy * dy );
- track->SetLength(length);
-
- //closesthit->SetS(track->fLength);
- closesthit->SetS(track->GetLength());
-
- //update fit parameters
- track->UpdateParam(closesthit);
- trackhitnumber[track->GetNumberOfPoints()-1] = closesthit->GetHitNumber();
-
- hit = closesthit;
- }
- else
- {
- //closest hit does not exist:
- track->DeleteCandidate();
- fTrack->RemoveLast();
- fNTracks--;
- point = fTrackletLength[fVertexConstraint];
- }
- }
-
- //tracklet is long enough to be extended to a track
- if(track->GetNumberOfPoints() == fTrackletLength[fVertexConstraint])
- {
-
- track->SetProperties(true);
-
- if(TrackletAngle(track) > fMaxAngleTracklet[fVertexConstraint])
- {//proof if the first points seem to be a beginning of a track
- track->SetProperties(false);
- track->DeleteCandidate();
- fTrack->RemoveLast();
- fNTracks--;
- }
-
- else//good tracklet ->proceed, follow the trackfit
- {
- tracks++;
-
- //define variables to keep the total chi:
- Double_t xyChi2 = track->GetChiSq1();
- Double_t szChi2 = track->GetChiSq2();
-
- for(point = fTrackletLength[fVertexConstraint]; point <= fNumRowSegment; point++)
- {
- track->SetChiSq1(fHitChi2Cut[fVertexConstraint]);
- closesthit = GetNextNeighbor((AliHLTTPCConfMapPoint*)track->GetLastHit(),track);
-
- if(closesthit)
- {
- //keep total chi:
- Double_t lxyChi2 = track->GetChiSq1()-track->GetChiSq2();
- xyChi2 += lxyChi2;
- closesthit->SetXYChi2(lxyChi2);
-
- //update track length:
- track->SetLength(closesthit->GetS());
- szChi2 += track->GetChiSq2();
- closesthit->SetSZChi2(track->GetChiSq2());
-
- track->UpdateParam(closesthit);
- trackhitnumber[track->GetNumberOfPoints()-1] = closesthit->GetHitNumber();
-
- //add closest hit to track
- closesthit->SetUsage(true);
- closesthit->SetTrackNumber(tracks-1);
-
- }//closesthit
-
- else
- {
- //closest hit does not exist
- point = fNumRowSegment; //continue with next hit in segment
- }//else
-
- }//create tracks
-
- //store track chi2:
- track->SetChiSq1(xyChi2);
- track->SetChiSq2(szChi2);
- Double_t normalizedchi2 = (track->GetChiSq1()+track->GetChiSq2())/track->GetNumberOfPoints();
-
- //remove tracks with not enough points already now
- if(track->GetNumberOfPoints() < fMinPoints[fVertexConstraint] || normalizedchi2 > fTrackChi2Cut[fVertexConstraint])
- {
- track->SetProperties(false);
- fNTracks--;
- track->DeleteCandidate();
- fTrack->RemoveLast();
- tracks--;
- }
-
- else
- {
- fClustersUnused -= track->GetNumberOfPoints();
- track->ComesFromMainVertex(fVertexConstraint);
- //mark track as main vertex track or not
- track->SetSector(2); //only needed for testing purposes.
- track->SetRowRange(fRowMin,fRowMax);
-
- if(fVertexConstraint)
- fMainVertexTracks++;
- }
-
- }//good tracklet
-
- }
-
- return;
-}
-
-AliHLTTPCConfMapPoint *AliHLTTPCConfMapper::GetNextNeighbor(AliHLTTPCConfMapPoint *starthit,
- AliHLTTPCConfMapTrack *track)
-{
- //When forming segments: Finds closest hit to input hit
- //When forming tracks: Find closest hit to track fit.
-
- Double_t dist,closestdist = fMaxDist[fVertexConstraint];
-
- AliHLTTPCConfMapPoint *hit = NULL;
- AliHLTTPCConfMapPoint *closesthit = NULL;
-
- Int_t subrowsegm;
- Int_t subphisegm;
- Int_t subetasegm;
- Int_t volumeIndex;
- Int_t testhit;
-
- Int_t maxrow = starthit->GetPadRow()-1;
- Int_t minrow;
-
- if(track) //finding hit close to trackfit
- {
- minrow = starthit->GetPadRow()-fRowScopeTrack[fVertexConstraint];
- }
- else
- {
- minrow = starthit->GetPadRow()-fRowScopeTracklet[fVertexConstraint];
- }
-
- //make a smart loop
- Int_t loopeta[25] = {0,0,0,-1,-1,-1,1,1,1, 0,0,-1,-1,1,1,-2,-2,-2,-2,-2,2,2,2,2,2};
- Int_t loopphi[25] = {0,-1,1,0,-1,1,0,-1,1, -2,2,-2,2,-2,2,-2,-1,0,1,2,-2,-1,0,1,2};
-
- if(minrow < fRowMin)
- minrow = fRowMin;
- if(maxrow < fRowMin)
- return 0; //reached the last padrow under consideration
-
- else
- {
- //loop over sub rows
- for(subrowsegm=maxrow; subrowsegm>=minrow; subrowsegm--)
- {
- //loop over subsegments, in the order defined above.
- for(Int_t i=0; i<9; i++)
- {
- subphisegm = starthit->GetPhiIndex() + loopphi[i];
-
- if(subphisegm < 0 || subphisegm >= fNumPhiSegment)
- continue;
- /*
- if(subphisegm<0)
- subphisegm += fNumPhiSegment;
-
- else if(subphisegm >=fNumPhiSegment)
- subphisegm -= fNumPhiSegment;
- */
- //loop over sub eta segments
-
- subetasegm = starthit->GetEtaIndex() + loopeta[i];
-
- if(subetasegm < 0 || subetasegm >=fNumEtaSegment)
- continue;//segment exceeds bounds->skip it
-
- //loop over hits in this sub segment:
- volumeIndex=(subrowsegm-fRowMin)*fNumPhiEtaSegmentPlusOne +
- subphisegm*fNumEtaSegmentPlusOne + subetasegm;
-
- if(volumeIndex<0)
- {//debugging
- LOG(AliHLTTPCLog::kError,"AliHLTTPCConfMapper::GetNextNeighbor","Memory")<<AliHLTTPCLog::kDec<<
- "VolumeIndex error "<<volumeIndex<<ENDLOG;
- }
-
- assert(fVolume!=NULL);
- for(hit = (AliHLTTPCConfMapPoint*)fVolume[volumeIndex].first;
- hit!=0; hit = hit->GetNextVolumeHit())
- {
-
- if(!hit->GetUsage())
- {//hit was not used before
-
- //set conformal mapping if looking for nonvertex tracks:
- if(!fVertexConstraint)
- {
- hit->SetAllCoord(starthit);
- }
-
- if(track)//track search - look for nearest neighbor to extrapolated track
- {
- if (fVertexConstraint) {
- if(!VerifyRange(starthit,hit))
- continue;
- }
- testhit = EvaluateHit(starthit,hit,track);
-
- if(testhit == 0)//chi2 not good enough, keep looking
- continue;
- else if(testhit==2)//chi2 good enough, return it
- return hit;
- else
- closesthit = hit;//chi2 acceptable, but keep looking
-
- }//track search
-
- else //tracklet search, look for nearest neighbor
- {
-
- if((dist=CalcDistance(starthit,hit)) < closestdist)
- {
- if (fVertexConstraint) {
- if(!VerifyRange(starthit,hit))
- continue;
- }
- closestdist = dist;
- closesthit = hit;
-
- //if this hit is good enough, return it:
- if(closestdist < fGoodDist)
- return closesthit;
- }
- else
- continue;//sub hit was farther away than a hit before
-
- }//tracklet search
-
- }//hit not used before
-
- else continue; //sub hit was used before
-
- }//loop over hits in sub segment
-
- }//loop over sub segments
-
- }//loop over subrows
-
- }//else
-
- //closest hit found:
- if(closesthit)// && closestdist < mMaxDist)
- return closesthit;
- else
- return 0;
-}
-
-Int_t AliHLTTPCConfMapper::EvaluateHit(AliHLTTPCConfMapPoint *starthit,AliHLTTPCConfMapPoint *hit,AliHLTTPCConfMapTrack *track)
-{
- //Check if space point gives a fit with acceptable chi2.
-
- Double_t temp,dxy,lchi2,dx,dy,slocal,dsz,lszChi2;
- temp = (track->GetA2Xy()*hit->GetXprime()-hit->GetYprime()+track->GetA1Xy());
- dxy = temp*temp/(track->GetA2Xy()*track->GetA2Xy() + 1.);
-
- //Calculate chi2
- lchi2 = (dxy*hit->GetXYWeight());
-
- if(lchi2 > track->GetChiSq1())//chi2 was worse than before.
- return 0;
-
- //calculate s and the distance hit-line
- dx = starthit->GetX()-hit->GetX();
- dy = starthit->GetY()-hit->GetY();
- //slocal = track->fLength+sqrt(dx*dx+dy*dy);
- slocal = track->GetLength()+sqrt(dx*dx+dy*dy);
-
- temp = (track->GetA2Sz()*slocal-hit->GetZ()+track->GetA1Sz());
- dsz = temp*temp/(track->GetA2Sz()*track->GetA2Sz()+1);
-
- //calculate chi2
- lszChi2 = dsz*hit->GetZWeight();
- lchi2 += lszChi2;
-
-
- //check whether chi2 is better than previous one:
- if(lchi2 < track->GetChiSq1())
- {
- track->SetChiSq1(lchi2);
- track->SetChiSq2(lszChi2);
-
- hit->SetS(slocal);
-
- //if chi2 good enough, stop here:
- if(lchi2 < fGoodHitChi2[fVertexConstraint])
- return 2;
-
- return 1;
- }
-
- return 0;
-
-}
-
-Double_t AliHLTTPCConfMapper::CalcDistance(const AliHLTTPCConfMapPoint *hit1,const AliHLTTPCConfMapPoint *hit2) const
-{
- //Return distance between two clusters, defined by Pablo
-
- Double_t phidiff = fabs( hit1->GetPhi() - hit2->GetPhi() );
- if (phidiff > AliHLTTPCTransform::Pi()) phidiff = AliHLTTPCTransform::TwoPi() - phidiff;
-
- return AliHLTTPCTransform::ToDeg()*fabs((Float_t)((hit1->GetPadRow() - hit2->GetPadRow()) *
- (phidiff + fabs( hit1->GetEta() - hit2->GetEta()))));
-}
-
-Bool_t AliHLTTPCConfMapper::VerifyRange(const AliHLTTPCConfMapPoint *hit1,const AliHLTTPCConfMapPoint *hit2) const
-{
- //Check if the hit are within reasonable range in phi and eta
- Double_t dphi,deta;//maxphi=0.1,maxeta=0.1;
- dphi = fabs(hit1->GetPhi() - hit2->GetPhi());
- if(dphi > AliHLTTPCTransform::Pi()) dphi = fabs(AliHLTTPCTransform::TwoPi() - dphi);
- if(dphi > fMaxPhi) return false;
-
- deta = fabs(hit1->GetEta() - hit2->GetEta());
- if(deta > fMaxEta) return false;
-
- return true;
-
-}
-
-Double_t AliHLTTPCConfMapper::TrackletAngle(AliHLTTPCConfMapTrack *track,Int_t n) const
-{
- // Returns the angle 'between' the last three points (started at point number n) on this track.
-
- if(n > track->GetNumberOfPoints())
- n = track->GetNumberOfPoints();
-
- if(n<3)
- return 0;
-
- Double_t x1[2]={0,0};
- Double_t x2[2]={0,0};
- Double_t x3[2]={0,0};
- Double_t angle1,angle2;
- Int_t counter=0;
- for(track->StartLoop(); track->LoopDone(); track->GetNextHit())
- {
- AliHLTTPCConfMapPoint *p = (AliHLTTPCConfMapPoint*)track->GetCurrentHit();
- if( (n-1) == counter)
- {
- x1[0] = p->GetX();
- x1[1] = p->GetY();
- }
- else if( (n-2) == counter)
- {
- x2[0] = p->GetX();
- x2[1] = p->GetY();
- }
- else if( (n-3) == counter)
- {
- x3[0] = p->GetX();
- x3[1] = p->GetY();
- }
- counter++;
- }
-
- angle1 = atan2(x2[1]-x3[1],x2[0]-x3[0]);
- angle2 = atan2(x1[1]-x2[1],x1[0]-x2[0]);
-
- return fabs(angle1-angle2);
-
- /*
- Double_t x1[2];
- Double_t x2[2];
- Double_t angle1,angle2;
- TObjArray *hits = track->GetHits();
-
- if (n > track->GetNumberOfPoints()) {
- n = track->GetNumberOfPoints();
- }
-
- if (n<3)
- return 0;
-
-
- x1[0] = ((AliHLTTPCConfMapPoint *)hits->At(n-2))->GetX() - ((AliHLTTPCConfMapPoint *)hits->At(n-3))->GetX();
- x1[1] = ((AliHLTTPCConfMapPoint *)hits->At(n-2))->GetY() - ((AliHLTTPCConfMapPoint *)hits->At(n-3))->GetY();
-
- x2[0] = ((AliHLTTPCConfMapPoint *)hits->At(n-1))->GetX() - ((AliHLTTPCConfMapPoint *)hits->At(n-2))->GetX();
- x2[1] = ((AliHLTTPCConfMapPoint *)hits->At(n-1))->GetY() - ((AliHLTTPCConfMapPoint *)hits->At(n-2))->GetY();
-
- angle1 = atan2(x1[1],x1[0]);
- angle2 = atan2(x2[1],x1[0]);
- return fabs(angle1-angle2);
- */
-}
-
-Int_t AliHLTTPCConfMapper::FillTracks()
-{
- //Fill track parameters. Which basically means do a fit of helix in real space,
- //which should be done in order to get nice tracks.
-
- Int_t numoftracks = fNTracks;
- if(fNTracks == 0)
- {
- LOG(AliHLTTPCLog::kDebug,"AliHLTTPCConfMapper::FillTracks","fNTracks")<<AliHLTTPCLog::kDec<<
- "No tracks found!!"<<ENDLOG;
- return 0;
- }
-
- LOG(AliHLTTPCLog::kInformational,"AliHLTTPCConfMapper::FillTracks","fNTracks")<<AliHLTTPCLog::kDec<<
- "Number of found tracks: "<<fNTracks<<ENDLOG;
-
- // fTrack->Sort();
- for(Int_t i=0; i<numoftracks; i++)
- {
- AliHLTTPCConfMapTrack *track = (AliHLTTPCConfMapTrack*)fTrack->GetTrack(i);
- track->Fill(fVertex,fMaxDca);
- }
- return 1;
-}
-
-Double_t AliHLTTPCConfMapper::CpuTime()
-{
- //Return the Cputime in seconds.
- struct timeval tv;
- gettimeofday( &tv, NULL );
- return tv.tv_sec+(((Double_t)tv.tv_usec)/1000000.);
-}
+++ /dev/null
-// $Id$
-// Original: AliHLTConfMapper.h,v 1.11 2004/07/05 09:03:11 loizides
-
-#ifndef ALIHLTTPCCONFMAPPER_H
-#define ALIHLTTPCCONFMAPPER_H
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* See cxx source for full Copyright notice *
-
-/// @file AliHLTTPCConfMapper.h
-/// @author Anders Vestbo, Matthias Richter
-/// @date Conformal mapping base class.
-/// @brief
-///
-
-#include <vector>
-#include "AliHLTTPCConfMapPoint.h"
-
-class AliHLTTPCConfMapTrack;
-class AliHLTTPCVertex;
-class AliHLTTPCTrackArray;
-struct AliHLTTPCSpacePointData;
-
-
-/**
- * @class AliHLTTPCConfMapper
- * Conformal mapping base class.
- *
- * @ingroup alihlt_tpc
- */
-class AliHLTTPCConfMapper {
-
- public:
-
- AliHLTTPCConfMapper();
- // AliHLTTPCConfMapper(AliTPCParam *param,AliHLTTPCVertex *vertex,Bool_t bench=(Bool_t)false);
- /** destructor */
- virtual ~AliHLTTPCConfMapper();
-
- /**
- * Init and calculate bounds for the internal arrays.
- */
- void InitVolumes();
-
- /**
- * Reset internal arrays and free memory.
- */
- void Reset();
-
- void InitSector(Int_t sector,Int_t *rowrange=0,Float_t *etarange=0);
- void SetVertex(AliHLTTPCVertex *vertex){fVertex = vertex;}
- void MainVertexTrackingA();
- void MainVertexTrackingB();
- void MainVertexTracking();
- void NonVertexTracking();
- void MainVertexSettings(Int_t trackletlength, Int_t tracklength,
- Int_t rowscopetracklet, Int_t rowscopetrack,Double_t maxphi=0.1,Double_t maxeta=0.1);
- void NonVertexSettings(Int_t trackletlength, Int_t tracklength,
- Int_t rowscopetracklet, Int_t rowscopetrack);
-
- /**
- * Read an array of space point data.
- * @param count array size
- * @param hits array
- * @return kTRUE if success.
- */
- Bool_t ReadHits(UInt_t count, AliHLTTPCSpacePointData* hits );
- Bool_t ReadHitsChecked(UInt_t count, AliHLTTPCSpacePointData* hits,unsigned int sizeInByte );
- void ClusterLoop();
- void CreateTrack(AliHLTTPCConfMapPoint *hit);
- AliHLTTPCConfMapPoint *GetNextNeighbor(AliHLTTPCConfMapPoint *start_hit,AliHLTTPCConfMapTrack *track=NULL);
- Int_t EvaluateHit(AliHLTTPCConfMapPoint *start_hit,AliHLTTPCConfMapPoint *hit,AliHLTTPCConfMapTrack *track);
-
- Double_t CalcDistance(const AliHLTTPCConfMapPoint *hit1,const AliHLTTPCConfMapPoint *hit2) const;
- Double_t TrackletAngle(AliHLTTPCConfMapTrack *track,Int_t n=3) const;
- Bool_t VerifyRange(const AliHLTTPCConfMapPoint *hit1,const AliHLTTPCConfMapPoint *hit2) const;
- Int_t FillTracks();
-
- //getters
- Int_t GetNumberOfTracks() const {return fNTracks;}
- AliHLTTPCTrackArray *GetTracks() const {return fTrack;}
- Double_t GetMaxDca() const {return fMaxDca;}
- AliHLTTPCVertex* GetVertex() const {return fVertex;}
- Double_t CpuTime();
-
- //setters
- void SetTrackCuts(Double_t hitChi2Cut, Double_t goodHitChi2, Double_t trackChi2Cut, Int_t maxdist,Bool_t vertexconstraint);
- void SetTrackletCuts(Double_t maxangle,Double_t goodDist,Bool_t vc); //Set cut of tracklet for the given vertex_constraint
- void SetNSegments(Int_t f,Int_t g) {fNumPhiSegment=f,fNumEtaSegment=g;} //Set number of subvolumes (#segments in (phi,eta)
- void SetMaxDca(Double_t f) {fMaxDca = f;}
-
- //setter:
- void SetMinPoints(Int_t f,Bool_t vconstraint) {fMinPoints[(Int_t)vconstraint] = f; }
- void SetVertexConstraint(Bool_t f) {fVertexConstraint =f;}
-
- void SetHitChi2Cut(Double_t f,Bool_t vert) {fHitChi2Cut[(Int_t)vert]=f;}
- void SetGoodHitChi2(Double_t f,Bool_t vert) {fGoodHitChi2[(Int_t)vert]=f;}
- void SetTrackChi2Cut(Double_t f,Bool_t vert) {fTrackChi2Cut[(Int_t)vert]=f;}
- void SetMaxDist(Int_t f,Bool_t vert) {fMaxDist[(Int_t)vert]=f;}
- void SetTrackletLength(Int_t f,Bool_t vert) {fTrackletLength[(Int_t)vert]=f;}
- void SetRowScopeTrack(Int_t f, Bool_t vc){fRowScopeTrack[(Int_t)vc] = f;}
- void SetRowScopeTracklet(Int_t f, Bool_t vc){fRowScopeTracklet[(Int_t)vc] = f;}
- void SetMaxAngleTracklet(Double_t f, Bool_t vc){fMaxAngleTracklet[(Int_t)vc] = f;}
-
- void SetPointers();
- void SetParamDone(Bool_t vconstraint) {fParamSet[(Int_t)vconstraint] = kTRUE;}
-
- void SetClusterCutZ(Int_t c){fClusterCutZ=c;}
-
- private:
- /** copy constructor prohibited */
- AliHLTTPCConfMapper(const AliHLTTPCConfMapper&);
- /** assignment operator prohibited */
- AliHLTTPCConfMapper& operator=(const AliHLTTPCConfMapper&);
-
- struct AliHLTTPCConfMapContainer
- {
- void *first; // first track
- void *last; // last track
- };
-
- Bool_t fBench; //run-time measurements
- Int_t fNTracks; //number of tracks build.
-
- AliHLTTPCVertex *fVertex; //!
- Bool_t fParamSet[2]; //!
- Bool_t fVertexFinder; //Include vertexfinding or not
- //(latter case vertex=(0,0,0))
-
- /** the list of hits */
- vector<AliHLTTPCConfMapPoint> fHit; //!
- AliHLTTPCTrackArray *fTrack; //!
- Double_t fMaxDca; //cut value for momentum fit
-
- AliHLTTPCConfMapContainer *fVolume; //! Segment volume
- AliHLTTPCConfMapContainer *fRow; //! Row volume
-
- //Number of cells (segments)
- Int_t fNumRowSegment; // Total number of padrows
- Int_t fNumPhiSegment; // number of phi segments
- Int_t fNumEtaSegment; // number of eta segments
- Int_t fNumRowSegmentPlusOne; // row+1
- Int_t fNumPhiSegmentPlusOne; // phi+1
- Int_t fNumEtaSegmentPlusOne; // eta+1
- Int_t fNumPhiEtaSegmentPlusOne;// phieta+1
- Int_t fBounds; // bounds
- Int_t fPhiHitsOutOfRange; // phi hits out of range
- Int_t fEtaHitsOutOfRange; // eta hits out of range
-
- //tracking range:
- Float_t fPhiMin; //MinPhi angle to consider
- Float_t fPhiMax; //MaxPhi angle to consider
- Float_t fEtaMin; //MinEta to consider
- Float_t fEtaMax; //MaxEta to consider
- Int_t fRowMin; //Minimum row to consider
- Int_t fRowMax; //Maximum row to consider
-
- Bool_t fVertexConstraint; //vertex constraint (true or false)
- Int_t fTrackletLength[2]; //minimal length of tracks
- Int_t fRowScopeTracklet[2]; //number of row segments to look for the next point of a tracklet
- Int_t fRowScopeTrack[2]; //number of row segments to look for the next point of a track
- Int_t fMinPoints[2]; //minimum number of points on one track
-
- // Cuts
- Double_t fMaxAngleTracklet[2]; //limit of angle between to pieces of a tracklet
- Int_t fMaxDist[2]; //maximum distance between two hits
- Double_t fHitChi2Cut[2]; //Maximum hit chi2
- Double_t fGoodHitChi2[2]; //Chi2 to stop looking for next hit
- Double_t fTrackChi2Cut[2]; //Maximum track chi2
- Double_t fGoodDist; //In segment building, distance consider good enough
- Double_t fMaxPhi; //Maximum phi
- Double_t fMaxEta; //Maximum eta
-
- // Tracking informtion
- Int_t fMainVertexTracks; //number of tracks coming from the main vertex
- Int_t fClustersUnused; //number of unused clusters
-
- Int_t fClusterCutZ; //Cut for taking out clusters with large Z
-
- ClassDef(AliHLTTPCConfMapper,0) //Base class for conformal mapping tracking
-};
-
-#endif
+++ /dev/null
-// @(#) $Id$
-// Original: AliHLTDataCompressorHelper.cxx,v 1.5 2004/06/15 10:26:57 hristov Exp $
-
-//**************************************************************************
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* *
-//* Primary Authors: Anders Vestbo *
-//* 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. *
-//**************************************************************************
-
-#include "AliHLTStdIncludes.h"
-#include "AliHLTTPCRootTypes.h"
-#include "AliHLTTPCTransform.h"
-
-#include "AliHLTTPCDataCompressorHelper.h"
-
-#if __GNUC__ >= 3
-using namespace std;
-#endif
-
-//_____________________________________________________________
-//
-// AliHLTTPCDataCompression
-//
-// Interface class; binary <-> AliROOT handling of TPC data compression classes.
-//
-
-
-ClassImp(AliHLTTPCDataCompressorHelper)
-
-AliHLTTPCDataCompressorHelper::AliHLTTPCDataCompressorHelper()
-{
-}
-
-AliHLTTPCDataCompressorHelper::~AliHLTTPCDataCompressorHelper()
-{
-}
-
-Int_t AliHLTTPCDataCompressorHelper::fgNumTimeBits = 12;
-Int_t AliHLTTPCDataCompressorHelper::fgNumPadBits = 12;
-Int_t AliHLTTPCDataCompressorHelper::fgNumChargeBits = 14;
-Int_t AliHLTTPCDataCompressorHelper::fgNumShapeBits = 14;
-Float_t AliHLTTPCDataCompressorHelper::fgXYResidualStep1 = 0.03;
-Float_t AliHLTTPCDataCompressorHelper::fgXYResidualStep2 = 0.03;
-Float_t AliHLTTPCDataCompressorHelper::fgXYResidualStep3 = 0.03;
-Float_t AliHLTTPCDataCompressorHelper::fgZResidualStep1 = 0.05;
-Float_t AliHLTTPCDataCompressorHelper::fgZResidualStep2 = 0.05;
-Float_t AliHLTTPCDataCompressorHelper::fgZResidualStep3 = 0.05;
-Float_t AliHLTTPCDataCompressorHelper::fgXYWidthStep = 0.005;
-Float_t AliHLTTPCDataCompressorHelper::fgZWidthStep = 0.005;
-Int_t AliHLTTPCDataCompressorHelper::fgClusterCharge = 100;
-Int_t AliHLTTPCDataCompressorHelper::fgNumPadBitsRemaining = 18;
-Int_t AliHLTTPCDataCompressorHelper::fgNumTimeBitsRemaining = 19;
-Int_t AliHLTTPCDataCompressorHelper::fgNumShapeBitsRemaining = 11;
-
-void AliHLTTPCDataCompressorHelper::SetBitNumbers(Int_t pad,Int_t time,Int_t charge,Int_t shape)
-{
- // sets the numbers of bits
- fgNumPadBits = pad;
- fgNumTimeBits = time;
- fgNumChargeBits = charge;
- fgNumShapeBits = shape;
-}
-
-void AliHLTTPCDataCompressorHelper::SetTransverseResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width)
-{
- // sets the transverse resolution
- fgXYResidualStep1 = res1;
- fgXYResidualStep2 = res2;
- fgXYResidualStep3 = res3;
- fgXYWidthStep = width;
-}
-
-void AliHLTTPCDataCompressorHelper::SetLongitudinalResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width)
-{
- // sets the longitudinal resolution
- fgZResidualStep1 = res1;
- fgZResidualStep2 = res2;
- fgZResidualStep3 = res3;
- fgZWidthStep = width;
-}
-
-void AliHLTTPCDataCompressorHelper::SetRemainingBitNumbers(Int_t pad,Int_t time,Int_t shape)
-{
- // sets the numbers of remaining bits
- fgNumPadBitsRemaining = pad;
- fgNumTimeBitsRemaining = time;
- fgNumShapeBitsRemaining = shape;
-}
-
-Float_t AliHLTTPCDataCompressorHelper::GetXYResidualStep(Int_t row)
-{
- // gets the XY residual step
- if(row < AliHLTTPCTransform::GetNRowLow())
- return fgXYResidualStep1;
- else if(row < AliHLTTPCTransform::GetNRowLow() + AliHLTTPCTransform::GetNRowUp1())
- return fgXYResidualStep2;
- else if(row < AliHLTTPCTransform::GetNRowLow() + AliHLTTPCTransform::GetNRowUp1() + AliHLTTPCTransform::GetNRowUp2())
- return fgXYResidualStep3;
- else
- {
- cerr<<"AliHLTTPCDataCompressorHelper::GetXYResidualStep : Wrong row number "<<row<<endl;
- return -1;
- }
-}
-
-Float_t AliHLTTPCDataCompressorHelper::GetZResidualStep(Int_t row)
-{
- // gets the Z residual step
- if(row < AliHLTTPCTransform::GetNRowLow())
- return fgZResidualStep1;
- else if(row < AliHLTTPCTransform::GetNRowLow() + AliHLTTPCTransform::GetNRowUp1())
- return fgZResidualStep2;
- else if(row < AliHLTTPCTransform::GetNRowLow() + AliHLTTPCTransform::GetNRowUp1() + AliHLTTPCTransform::GetNRowUp2())
- return fgZResidualStep3;
- else
- {
- cerr<<"AliHLTTPCDataCompressorHelper::GetXYResidualStep : Wrong row number "<<row<<endl;
- return -1;
- }
-}
-
-Float_t AliHLTTPCDataCompressorHelper::GetPadPrecisionFactor()
-{
- // gets pad precision factor
- Int_t nbits = fgNumPadBitsRemaining;
- if(nbits >=21)
- return 10000;
- if(nbits >= 18)
- return 1000;
- if(nbits >= 14)
- return 100;
- if(nbits >= 11)
- return 10;
- if(nbits >= 8)
- return 1;
- else
- {
- cerr<<"AliHLTTPCDataCompressorHelper::GetRemainingPadFactor : Too few bits for the pad direction: "<<nbits<<endl;
- return 1;
- }
-}
-
-Float_t AliHLTTPCDataCompressorHelper::GetTimePrecisionFactor()
-{
- // gest time precision factor
- Int_t nbits = fgNumTimeBitsRemaining;
- if(nbits >=23)
- return 10000;
- if(nbits >= 19)
- return 1000;
- if(nbits >= 16)
- return 100;
- if(nbits >= 13)
- return 10;
- if(nbits >= 9)
- return 1;
- else
- {
- cerr<<"AliHLTTPCDataCompressorHelper::GetRemainingPadFactor : Too few bits for the pad direction: "<<nbits<<endl;
- return 1;
- }
-}
-
-
-Int_t AliHLTTPCDataCompressorHelper::Nint(Double_t x)
-{
- // Round to nearest integer. Rounds half integers
- // to the nearest even integer.
-
- Int_t i=0;
- if (x >= 0) {
- i = Int_t(x + 0.5);
- if (x + 0.5 == Double_t(i) && i & 1) i--;
- } else {
- i = Int_t(x - 0.5);
- if (x - 0.5 == Double_t(i) && i & 1) i++;
-
- }
- return i;
-}
+++ /dev/null
-// @(#) $Id$
-// Original: AliHLTDataCompressorHelper.h,v 1.4 2004/06/15 10:26:57 hristov Exp $
-
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* See cxx source for full Copyright notice *
-
-#ifndef AliHLTTPC_DataCompressorHelper
-#define AliHLTTPC_DataCompressorHelper
-
-/**
- * @class AliHLTTPCDataCompressorHelper
- *
- * @ingroup alihlt_tpc
- */
-class AliHLTTPCDataCompressorHelper {
-
- public:
- AliHLTTPCDataCompressorHelper();
- virtual ~AliHLTTPCDataCompressorHelper();
-
- static void SetBitNumbers(Int_t pad,Int_t time,Int_t charge,Int_t shape);
- static void SetTransverseResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width=0.005);
- static void SetLongitudinalResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width=0.005);
- static void SetRemainingBitNumbers(Int_t pad,Int_t time,Int_t shape);
- static Int_t GetNPadBits() {return fgNumPadBits;}
- static Int_t GetNTimeBits() {return fgNumTimeBits;}
- static Int_t GetNChargeBits() {return fgNumChargeBits;}
- static Int_t GetNShapeBits() {return fgNumShapeBits;}
- static Float_t GetXYWidthStep() {return fgXYWidthStep;}
- static Float_t GetZWidthStep() {return fgZWidthStep;}
- static Int_t GetClusterCharge() {return fgClusterCharge;}
- static Float_t GetXYResidualStep(Int_t row);
- static Float_t GetZResidualStep(Int_t row);
- static Int_t GetNPadBitsRemaining() {return fgNumPadBitsRemaining;}
- static Int_t GetNTimeBitsRemaining() {return fgNumTimeBitsRemaining;}
- static Int_t GetNShapeBitsRemaining() {return fgNumShapeBitsRemaining;}
- static Float_t GetPadPrecisionFactor();
- static Float_t GetTimePrecisionFactor();
-
- //taken from TMath
- static Int_t Nint(Double_t x);
- static Int_t Abs(Int_t d) { return (d > 0) ? d : -d; }
- static Double_t Abs(Double_t d) { return (d > 0) ? d : -d; }
-
- private:
- static Int_t fgNumPadBits; // Number of pad bits
- static Int_t fgNumTimeBits; // Number of time bits
- static Int_t fgNumChargeBits; // Number of charge bits
- static Int_t fgNumShapeBits; // Number of shape bits
- static Int_t fgNumPadBitsRemaining; // Number of remaining pad bits
- static Int_t fgNumTimeBitsRemaining; // Number of remaining time bits
- static Int_t fgNumShapeBitsRemaining; // Number of remaining shape bits
-
- static Float_t fgXYResidualStep1; // XY resbual at step 1
- static Float_t fgXYResidualStep2; // XY residual at step 2
- static Float_t fgXYResidualStep3; // XY resudual at step 3
- static Float_t fgZResidualStep1; // Z residual at step 1
- static Float_t fgZResidualStep2; // Z resudual at step 2
- static Float_t fgZResidualStep3; // Z resudual at step 3
- static Float_t fgXYWidthStep; // Width of XY step
- static Float_t fgZWidthStep; // Width of Z step
- static Int_t fgClusterCharge; // Cluster charge
-
-
- ClassDef(AliHLTTPCDataCompressorHelper,0)
-
-};
-
-#endif
+++ /dev/null
-// @(#) $Id$
-
-//**************************************************************************
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* *
-//* Primary Authors: 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 AliHLTTPCEsdWriterComponent.cxx
- @author Matthias Richter
- @date
- @brief Writer component to store tracks of the HLT TPC conformal
- mapping tracker in the AliESD format
-*/
-
-// see header file for class documentation
-// or
-// refer to README to build package
-// or
-// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
-
-#include <cassert>
-#include "AliHLTTPCEsdWriterComponent.h"
-#include "AliESDEvent.h"
-#include "AliESDtrack.h"
-#include "AliCDBEntry.h"
-#include "AliCDBManager.h"
-#include "TTree.h"
-#include "TList.h"
-#include "AliHLTTPCTrack.h"
-#include "AliHLTTPCTrackArray.h"
-#include "AliHLTTPCTrackletDataFormat.h"
-#include "AliHLTTPCDefinitions.h"
-#include "AliHLTTPCTransform.h"
-#include "AliHLTExternalTrackParam.h"
-#include "AliHLTGlobalBarrelTrack.h"
-#include "AliHLTTrackMCLabel.h"
-#include "TGeoGlobalMagField.h"
-
-#include <vector>
-
-/** ROOT macro for the implementation of ROOT specific class methods */
-ClassImp(AliHLTTPCEsdWriterComponent)
-
-AliHLTTPCEsdWriterComponent::AliHLTTPCEsdWriterComponent()
- :
- fSolenoidBz(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
-}
-
-AliHLTTPCEsdWriterComponent::~AliHLTTPCEsdWriterComponent()
-{
- // see header file for class documentation
-}
-
-AliHLTTPCEsdWriterComponent::AliWriter::AliWriter()
- :
- fTree(NULL),
- fESD(NULL),
- fBase(new AliHLTTPCEsdWriterComponent)
-{
- // see header file for class documentation
- // or
- // refer to README to build package
- // or
- // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
-}
-
-AliHLTTPCEsdWriterComponent::AliWriter::~AliWriter()
-{
- // see header file for class documentation
- if (fBase) delete fBase;
- fBase=NULL;
-}
-
-void AliHLTTPCEsdWriterComponent::AliWriter::GetInputDataTypes(AliHLTComponentDataTypeList& list)
-{
- // see header file for class documentation
- list.push_back(AliHLTTPCDefinitions::fgkTrackSegmentsDataType);
- list.push_back(AliHLTTPCDefinitions::fgkTracksDataType);
- list.push_back( kAliHLTDataTypeTrack|kAliHLTDataOriginTPC );
-}
-
-int AliHLTTPCEsdWriterComponent::AliWriter::InitWriter()
-{
- // see header file for class documentation
- int iResult=0;
- fESD = new AliESDEvent;
- if (fESD) {
- fESD->CreateStdContent();
- fTree = new TTree("esdTree", "Tree with HLT ESD objects");
- if (fTree) {
- fTree->SetDirectory(0);
- fESD->WriteToTree(fTree);
- }
- }
- if (fTree==NULL) {
- iResult=-ENOMEM;
- }
-
- if (iResult>=0) {
- iResult=fBase->Reconfigure(NULL, NULL);
- }
-
- return iResult;
-}
-
-int AliHLTTPCEsdWriterComponent::AliWriter::CloseWriter()
-{
- // see header file for class documentation
- int iResult=0;
- if (fTree) {
- // the esd structure is written to the user info and is
- // needed in te ReadFromTree method to read all objects correctly
- if (fESD) fTree->GetUserInfo()->Add(fESD);
- WriteObject(kAliHLTVoidEventID, fTree);
- fTree->GetUserInfo()->Clear();
- TTree* pTree=fTree;
- fTree=NULL;
- delete pTree;
- } else {
- HLTWarning("not initialized");
- }
-
- if (fESD) {
- delete fESD;
- }
- iResult=AliHLTRootFileWriterComponent::CloseWriter();
- return iResult;
-}
-
-int AliHLTTPCEsdWriterComponent::AliWriter::DumpEvent( const AliHLTComponentEventData& evtData,
- const AliHLTComponentBlockData* blocks,
- AliHLTComponentTriggerData& /*trigData*/ )
-{
- // see header file for class documentation
- int iResult=0;
- TTree* pTree=fTree;
- assert(fBase);
- if (pTree && fBase) {
- if (fESD) {
- AliESDEvent* pESD=fESD;
-
- pESD->Reset();
- pESD->SetMagneticField(GetBz());
- iResult=fBase->ProcessBlocks(pTree, pESD, blocks, (int)evtData.fBlockCnt);
-
- } else {
- iResult=-ENOMEM;
- }
- }
- return iResult;
-}
-
-int AliHLTTPCEsdWriterComponent::AliWriter::ScanArgument(int argc, const char** argv)
-{
- // see header file for class documentation
- int iResult=AliHLTRootFileWriterComponent::ScanArgument(argc, argv);
- return iResult;
-}
-
-int AliHLTTPCEsdWriterComponent::ProcessBlocks(TTree* pTree, AliESDEvent* pESD,
- const AliHLTComponentBlockData* blocks,
- int nBlocks, int* pMinSlice,
- int* pMaxSlice)
-{
- // see header file for class documentation
-
- int iResult=0;
- int iAddedDataBlocks=0;
-
- if (pESD && blocks) {
- const AliHLTComponentBlockData* iter = NULL;
- int bIsTrackSegs=0;
-
- // first read MC information (if present)
-
- std::map<int,int> mcLabels;
-
- for (int ndx=0; ndx<nBlocks && iResult>=0; ndx++) {
- iter = blocks+ndx;
- if(iter->fDataType == (kAliHLTDataTypeTrackMC|kAliHLTDataOriginTPC) ) {
- AliHLTTrackMCData* dataPtr = ( AliHLTTrackMCData* )( iter->fPtr );
- for( unsigned int il=0; il<dataPtr->fCount; il++ ){
- AliHLTTrackMCLabel &lab = dataPtr->fLabels[il];
- mcLabels[lab.fTrackID] = lab.fMCLabel;
- }
- }
- }
-
-
- // do the conversion of tracks
-
- for (int ndx=0; ndx<nBlocks && iResult>=0; ndx++) {
- iter = blocks+ndx;
-
- if( iter->fDataType == ( kAliHLTDataTypeTrack|kAliHLTDataOriginTPC ) ){
- AliHLTTracksData* dataPtr = ( AliHLTTracksData* ) iter->fPtr;
- int nTracks = dataPtr->fCount;
- AliHLTExternalTrackParam* currOutTrack = dataPtr->fTracklets;
-
- for( int itr=0; itr<nTracks; itr++ ){
- AliHLTGlobalBarrelTrack t(*currOutTrack);
- Float_t points[4] = {currOutTrack->fX, currOutTrack->fY, currOutTrack->fLastX, currOutTrack->fLastY };
-
- Int_t mcLabel = -1;
- if( mcLabels.find(currOutTrack->fTrackID)!=mcLabels.end() )
- mcLabel = mcLabels[currOutTrack->fTrackID];
-
- t.SetLabel( mcLabel );
-
- AliESDtrack iotrack;
- iotrack.UpdateTrackParams( &t,AliESDtrack::kTPCin);
- iotrack.SetTPCPoints(points);
- pESD->AddTrack(&iotrack);
- unsigned int dSize = sizeof( AliHLTExternalTrackParam ) + currOutTrack->fNPoints * sizeof( unsigned int );
- currOutTrack = ( AliHLTExternalTrackParam* )( (( Byte_t * )currOutTrack) + dSize );
- }
- iAddedDataBlocks++;
- }
-
-
- if ( (bIsTrackSegs=(iter->fDataType == AliHLTTPCDefinitions::fgkTrackSegmentsDataType))==1 ||
- iter->fDataType == AliHLTTPCDefinitions::fgkTracksDataType ) {
- Int_t minslice=AliHLTTPCDefinitions::GetMinSliceNr(iter->fSpecification);
- Int_t maxslice=AliHLTTPCDefinitions::GetMaxSliceNr(iter->fSpecification);
- if (bIsTrackSegs==0) {
- // slice parameter and data specification ignored, tracks already in global coordinates
- minslice=-1;
- maxslice=-1;
- if (pMinSlice) *pMinSlice=0;
- if (pMaxSlice) *pMaxSlice=AliHLTTPCTransform::GetNSlice()-1;
- } else {
- if (pMinSlice && (*pMinSlice==-1 || *pMinSlice>minslice)) *pMinSlice=minslice;
- if (pMaxSlice && (*pMaxSlice==-1 || *pMaxSlice<maxslice)) *pMaxSlice=maxslice;
- }
- //HLTDebug("dataspec %#x minslice %d", iter->fSpecification, minslice);
- if (minslice >=-1 && minslice<AliHLTTPCTransform::GetNSlice()) {
- if (minslice!=maxslice) {
- HLTWarning("data from multiple sectors in one block: "
- "possible mismatch in treatment of local coordinate system");
- }
- AliHLTTPCTrackArray tracks;
- AliHLTTPCTrackletData* inPtr = (AliHLTTPCTrackletData*) iter->fPtr;
- HLTDebug("reading block %d (slice %d): %d tracklets", ndx, minslice, inPtr->fTrackletCnt);
- if ((iResult=tracks.FillTracksChecked(inPtr->fTracklets, inPtr->fTrackletCnt, iter->fSize, minslice, 0/*don't rotate*/))>=0) {
- if ((iResult=Tracks2ESD(&tracks, pESD ))>=0) {
- iAddedDataBlocks++;
- }
- }
- } else {
- HLTError("invalid sector number");
- iResult=-EBADF;
- }
- }
- }
-
- if (iAddedDataBlocks>0 && pTree) {
- pTree->Fill();
- }
-
- } else {
- iResult=-EINVAL;
- }
- if (iResult>=0) iResult=iAddedDataBlocks;
- return iResult;
-}
-
-
-int AliHLTTPCEsdWriterComponent::Tracks2ESD(AliHLTTPCTrackArray* pTracks, AliESDEvent* pESD )
-{
- // see header file for class documentation
- int iResult=0;
-
- if (pTracks && pESD) {
-
- for (int i=0; i<pTracks->GetNTracks() && iResult>=0; i++) {
- AliHLTTPCTrack* pTrack=(*pTracks)[i];
- if (pTrack) {
-
- if( pTrack->Convert2AliKalmanTrack() ){
- HLTError("conversion to AliKalmanTrack failed for track %d of %d", i, pTracks->GetNTracks());
- continue;
- }
-
- Float_t points[4] = {pTrack->GetFirstPointX(), pTrack->GetFirstPointY(), pTrack->GetLastPointX(), pTrack->GetLastPointY() };
-
- if(pTrack->GetSector() == -1){ // Set first and last points for global tracks
- Double_t s = TMath::Sin( pTrack->GetAlpha() );
- Double_t c = TMath::Cos( pTrack->GetAlpha() );
- points[0] = pTrack->GetFirstPointX()*c + pTrack->GetFirstPointY()*s;
- points[1] = -pTrack->GetFirstPointX()*s + pTrack->GetFirstPointY()*c;
- points[2] = pTrack->GetLastPointX() *c + pTrack->GetLastPointY() *s;
- points[3] = -pTrack->GetLastPointX() *s + pTrack->GetLastPointY() *c;
- }
-
- AliESDtrack iotrack;
- iotrack.UpdateTrackParams(pTrack,AliESDtrack::kTPCin);
- iotrack.SetTPCPoints(points);
-
- pESD->AddTrack(&iotrack);
- } else {
- HLTError("internal mismatch in array");
- iResult=-EFAULT;
- }
- }
-
- } else {
- iResult=-EINVAL;
- }
- return iResult;
-}
-
-int AliHLTTPCEsdWriterComponent::Configure(const char* arguments)
-{
- // see header file for class documentation
- int iResult=0;
- if (!arguments) return iResult;
-
- // Check field
- if (!TGeoGlobalMagField::Instance()) {
- HLTError("magnetic field not initialized, please set up TGeoGlobalMagField and AliMagF");
- return -ENODEV;
- }
-
- TString allArgs=arguments;
- TString argument;
- int bMissingParam=0;
-
- TObjArray* pTokens=allArgs.Tokenize(" ");
- if (pTokens) {
- for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
- argument=((TObjString*)pTokens->At(i))->GetString();
- if (argument.IsNull()) continue;
-
- if (argument.CompareTo("-solenoidBz")==0) {
- if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
- HLTWarning("parameter -solenoidBz deprecated, magnetic field handled by global AliMagF object and TGeoGlobalMagField");
- continue;
- } else {
- HLTError("unknown argument %s", argument.Data());
- iResult=-EINVAL;
- break;
- }
- }
- delete pTokens;
- }
- if (bMissingParam) {
- HLTError("missing parameter for argument %s", argument.Data());
- iResult=-EINVAL;
- }
-
- return iResult;
-}
-
-int AliHLTTPCEsdWriterComponent::Reconfigure(const char* cdbEntry, const char* chainId)
-{
- // see header file for class documentation
- int iResult=0;
- const char* path=NULL;
- const char* defaultNotify="";
- if (cdbEntry) {
- path=cdbEntry;
- defaultNotify=" (default)";
- }
- if (path) {
- HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
- AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
- if (pEntry) {
- TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
- if (pString) {
- HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
- iResult=Configure(pString->GetString().Data());
- } else {
- HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
- }
- } else {
- HLTError("can not fetch object \"%s\" from CDB", path);
- }
- }
-
- return iResult;
-}
-
-AliHLTTPCEsdWriterComponent::AliConverter::AliConverter()
- :
- fESD(NULL),
- fBase(new AliHLTTPCEsdWriterComponent),
- fWriteTree(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
-}
-
-AliHLTTPCEsdWriterComponent::AliConverter::~AliConverter()
-{
- // see header file for class documentation
- if (fBase) delete fBase;
- fBase=NULL;
-
- if (fESD) delete fESD;
- fESD=NULL;
-}
-
-void AliHLTTPCEsdWriterComponent::AliConverter::GetInputDataTypes(AliHLTComponentDataTypeList& list)
-{
- // see header file for class documentation
- list.push_back(AliHLTTPCDefinitions::fgkTrackSegmentsDataType);
- list.push_back(AliHLTTPCDefinitions::fgkTracksDataType);
- list.push_back( kAliHLTDataTypeTrack|kAliHLTDataOriginTPC );
-}
-
-AliHLTComponentDataType AliHLTTPCEsdWriterComponent::AliConverter::GetOutputDataType()
-{
- // see header file for class documentation
- return kAliHLTDataTypeESDTree;
-}
-
-void AliHLTTPCEsdWriterComponent::AliConverter::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
-{
- // see header file for class documentation
- constBase=2000000;
- inputMultiplier=10.0;
-}
-
-int AliHLTTPCEsdWriterComponent::AliConverter::DoInit(int argc, const char** argv)
-{
- // see header file for class documentation
- int iResult=0;
- TString argument="";
- int bMissingParam=0;
- for (int i=0; i<argc && iResult>=0; i++) {
- argument=argv[i];
- if (argument.IsNull()) continue;
-
- // -notree
- if (argument.CompareTo("-notree")==0) {
- fWriteTree=0;
-
- // -tree
- } else if (argument.CompareTo("-tree")==0) {
- fWriteTree=1;
-
- // -solenoidBz
- } else if (argument.CompareTo("-solenoidBz")==0) {
- HLTWarning("parameter -solenoidBz deprecated, magnetic field handled by global AliMagF object and TGeoGlobalMagField");
- } else {
- HLTError("unknown argument %s", argument.Data());
- break;
- }
- }
- if (bMissingParam) {
- HLTError("missing parameter for argument %s", argument.Data());
- iResult=-EINVAL;
- }
-
- if (iResult>=0) {
- iResult=fBase->Reconfigure(NULL, NULL);
- }
-
- return iResult;
-}
-
-int AliHLTTPCEsdWriterComponent::AliConverter::DoDeinit()
-{
- // see header file for class documentation
- return 0;
-}
-
-int AliHLTTPCEsdWriterComponent::AliConverter::DoEvent(const AliHLTComponentEventData& evtData,
- const AliHLTComponentBlockData* blocks,
- AliHLTComponentTriggerData& /*trigData*/,
- AliHLTUInt8_t* /*outputPtr*/,
- AliHLTUInt32_t& size,
- AliHLTComponentBlockDataList& /*outputBlocks*/ )
-{
- // see header file for class documentation
- int iResult=0;
- // no direct writing to the output buffer
- size=0;
-
- assert(fBase);
- if (!fESD) {
- fESD = new AliESDEvent;
- if (fESD) {
- fESD->CreateStdContent();
- } else {
- iResult=-ENOMEM;
- }
- }
-
- AliESDEvent* pESD = fESD;
-
- if (pESD && fBase) {
-
- TTree* pTree = NULL;
- // TODO: Matthias 06.12.2007
- // Tried to write the ESD directly instead to a tree, but this did not work
- // out. Information in the ESD is different, needs investigation.
-
- if (fWriteTree)
- pTree = new TTree("esdTree", "Tree with HLT ESD objects");
-
- if (pTree) {
- pTree->SetDirectory(0);
- }
-
- pESD->Reset();
- pESD->SetMagneticField(GetBz());
- if ((iResult=fBase->ProcessBlocks(pTree, pESD, blocks, (int)evtData.fBlockCnt))>0) {
- // TODO: set the specification correctly
- if (pTree) {
- // the esd structure is written to the user info and is
- // needed in te ReadFromTree method to read all objects correctly
- pTree->GetUserInfo()->Add(pESD);
- pESD->WriteToTree(pTree);
- iResult=PushBack(pTree, kAliHLTDataTypeESDTree|kAliHLTDataOriginTPC, 0);
- } else {
- iResult=PushBack(pESD, kAliHLTDataTypeESDObject|kAliHLTDataOriginTPC, 0);
- }
- }
- if (pTree) {
- // clear user info list to prevent objects from being deleted
- pTree->GetUserInfo()->Clear();
- delete pTree;
- }
- }
- return iResult;
-}
-
+++ /dev/null
-// @(#) $Id$
-
-#ifndef ALIHLTTPCESDWRITERCOMPONENT_H
-#define ALIHLTTPCESDWRITERCOMPONENT_H
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* See cxx source for full Copyright notice *
-
-/** @file AliHLTTPCEsdWriterComponent.h
- @author Matthias Richter
- @date
- @brief Writer component to store tracks of the HLT TPC conformal
- mapping tracker in the AliESD format
-*/
-
-#include "AliHLTRootFileWriterComponent.h"
-#include "AliHLTProcessor.h"
-
-// forward declarations
-class TTree;
-class AliESDEvent;
-class AliHLTTPCTrackArray;
-
-/**
- * @class AliHLTTPCEsdWriterComponent
- * Translation of internal TPC track data to the ESD format.
- * This class translates incoming track segments structures from the TPC
- * conformal mapping tracker (datatype TRAKSEGS/TPC) or tracks in global
- * coordinates from the AliHLTTPCGlobalMergerComponent (TRACKS/TPC) into
- * the ESD format.
- *
- * The \em TPCEsdWriter writes it to a ROOT file, the \em TPCEsdConverter
- * to a TTree and sends the whole object to the output stream with data
- * type ::kAliHLTDataTypeESDTree and origin TPC.
- *
- * In case of TRAKSEGS, the component can only process data block containing
- * data of one slice, but it can read an unlimeted number of data blocks.
- *
- * componentid: \b TPCEsdWriter <br>
- * componentid: \b TPCEsdConverter <br>
- * componentlibrary: \b libAliHLTTPC.so <br>
- * Arguments TPCEsdWriter: <br>
- * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
- * \li -datafile <i> filename </i> <br>
- * file name base
- * \li -directory <i> directory </i> <br>
- * target directory
- *
- * Arguments TPCEsdConverter: <br>
- * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
- * \li -notree <br>
- * write ESD directly to output (::kAliHLTDataTypeESDObject)
- * this has been made the default behavior in Sep 2008.
- * \li -tree <br>
- * write ESD directly to TTree and to output (::kAliHLTDataTypeESDTree)
- * \li -solenoidBz <br>
- * magnetic field like -solenoidBz 5.0
- *
- * <pre>
- * Example usage (HLT configuration file):
- * \<Proc ID="EsdWriter" type="prc">
- * \<Cmd>AliRootWrapperSubscriber -eventmodulo 1
- * -componentid TPCEsdWriter
- * -componentlibrary libAliHLTTPC.so
- * -componentargs "-datafile AliESDs.root"
- * \</Cmd>
- *
- * \<Parent>TR0-SC\</Parent>
- * \<Node>master\</Node>
- * \<Shm blocksize="1k" blockcount="1" type="sysv"/>
- * \</Proc>
- * </pre>
- *
- * @see AliHLTFileWriter and AliHLTRootFileWriterComponent for more parameters
- *
- * @ingroup alihlt_tpc_components
- */
-class AliHLTTPCEsdWriterComponent : public AliHLTLogging
-{
- public:
- /** standard constructor */
- AliHLTTPCEsdWriterComponent();
- /** destructor */
- ~AliHLTTPCEsdWriterComponent();
-
- /**
- * class AliHLTTPCEsdWriterComponent::AliWriter
- * The writer component of the AliHLTTPCEsdWriterComponent.
- */
- class AliWriter : public AliHLTRootFileWriterComponent
- {
- public:
- /** standard constructor */
- AliWriter();
- /** destructor */
- virtual ~AliWriter();
-
- /**
- * The id of the component.
- * @return component id (string)
- */
- const char* GetComponentID() {return "TPCEsdWriter";};
-
- void GetInputDataTypes(AliHLTComponentDataTypeList& list);
-
- /**
- * Spawn function.
- * @return new class instance
- */
- AliHLTComponent* Spawn() {return new AliHLTTPCEsdWriterComponent::AliWriter;}
-
- protected:
- /**
- * Data processing method for the component.
- * The function can be overloaded by specific ROOT file writer
- * components.
- * @param evtData event data structure
- * @param blocks input data block descriptors
- * @param trigData trigger data structure
- */
- int DumpEvent( const AliHLTComponentEventData& evtData,
- const AliHLTComponentBlockData* blocks,
- AliHLTComponentTriggerData& trigData );
-
- using AliHLTRootFileWriterComponent::DumpEvent;
-
- /**
- * Scan one argument and adjacent parameters.
- * @param argc size of the argument array
- * @param argv agument array for component initialization
- * @return number of processed members of the argv <br>
- * -EINVAL unknown argument <br>
- * -EPROTO parameter for argument missing <br>
- */
- int ScanArgument(int argc, const char** argv);
- private:
- /** copy constructor prohibited */
- AliWriter(const AliWriter&);
- /** assignment operator prohibited */
- AliWriter& operator=(const AliWriter&);
-
- /**
- * Init the writer.
- * The DoInit function is not available for this child class. InitWriter is the
- * corresponding function for classes derived from AliHLTFileWriter.
- */
- int InitWriter();
-
- /**
- * Init the writer.
- * The DoDeinit function is not available for this child class. CloseWriter is the
- * corresponding function for classes derived from AliHLTFileWriter.
- */
- int CloseWriter();
-
- /** the ESD tree */
- TTree* fTree; //! transient value
-
- /** the ESD */
- AliESDEvent* fESD; //! transient value
-
- /** pointer to the basic ESD conversion methods */
- AliHLTTPCEsdWriterComponent* fBase; //! transient value
- };
-
- /**
- * class AliHLTTPCEsdWriterComponent::AliConverter
- * The converter component of the AliHLTTPCEsdWriterComponent.
- *
- */
- class AliConverter : public AliHLTProcessor
- {
- public:
- /** standard constructor */
- AliConverter();
- /** destructor */
- virtual ~AliConverter();
-
- // interface methods of base class
- const char* GetComponentID() {return "TPCEsdConverter";};
- void GetInputDataTypes(AliHLTComponentDataTypeList& list);
- AliHLTComponentDataType GetOutputDataType();
- void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
- AliHLTComponent* Spawn() {return new AliHLTTPCEsdWriterComponent::AliConverter;}
-
- protected:
- // interface methods of base class
- int DoInit(int argc, const char** argv);
- int DoDeinit();
- int DoEvent(const AliHLTComponentEventData& evtData,
- const AliHLTComponentBlockData* blocks,
- AliHLTComponentTriggerData& trigData,
- AliHLTUInt8_t* outputPtr,
- AliHLTUInt32_t& size,
- AliHLTComponentBlockDataList& outputBlocks );
-
- using AliHLTProcessor::DoEvent;
-
- private:
- /** copy constructor prohibited */
- AliConverter(const AliConverter&);
- /** assignment operator prohibited */
- AliConverter& operator=(const AliConverter&);
-
- /** the ESD */
- AliESDEvent* fESD; //! transient value
-
- /** pointer to the basic ESD conversion methods */
- AliHLTTPCEsdWriterComponent* fBase; //! transient value
-
- /** write object to TTree or directly */
- int fWriteTree; //!transient
- };
-
- protected:
- /**
- * Process the input data blocks.
- * @param pTree tree to be filled
- * @param pESD ESD to be filled
- * @param blocks data block descriptor array
- * @param nBlocks size of the array
- * @param pMinSlice [OUT] receives the minimum slice no
- * @param pMaxSlice [OUT] receives the maximum slice no
- * @return neg. error code if failed
- */
- int ProcessBlocks(TTree* pTree, AliESDEvent* pESD, const AliHLTComponentBlockData* blocks,
- int nBlocks, int* pMinSlice=NULL, int* pMaxSlice=NULL);
-
- /**
- * Covert tracks to AliTPCtracks (AliKalmanTracks) and add them to ESD.
- * @param pTracks array of tracks
- * @param pESD pointer to ESD
- * @return neg. error code if failed
- */
- int Tracks2ESD(AliHLTTPCTrackArray* pTracks, AliESDEvent* pESD );
-
- private:
- /** copy constructor prohibited */
- AliHLTTPCEsdWriterComponent(const AliHLTTPCEsdWriterComponent&);
- /** assignment operator prohibited */
- AliHLTTPCEsdWriterComponent& operator=(const AliHLTTPCEsdWriterComponent&);
-
- /**
- * (Re)Configure from the CDB
- * Loads the following objects:
- * - HLT/ConfigHLT/SolenoidBz
- */
- int Reconfigure(const char* cdbEntry, const char* chainId);
-
- /**
- * Configure the component.
- * Parse a string for the configuration arguments and set the component
- * properties.
- */
- int Configure(const char* arguments);
-
- /** solenoid b field */
- Double_t fSolenoidBz; //! transient
-
- ClassDef(AliHLTTPCEsdWriterComponent, 0)
-};
-#endif
+++ /dev/null
-// @(#) $Id$
-// Original: AliHLTModelTrack.cxx,v 1.18 2005/02/14 11:50:11 hristov
-// Author: Anders Vestbo <mailto:vestbo$fi.uib.no>
-//*-- Copyright © ALICE HLT Group
-//_____________________________________________________________
-// AliHLTTPCModelTrack
-//
-//
-
-
-#include "AliHLTTPCLogging.h"
-#include "AliHLTTPCTransform.h"
-#include "AliHLTTPCVertex.h"
-#include "AliHLTTPCDataCompressorHelper.h"
-
-#include "AliHLTTPCModelTrack.h"
-
-#if __GNUC__ >= 3
-using namespace std;
-#endif
-
-ClassImp(AliHLTTPCModelTrack)
-
-AliHLTTPCModelTrack::AliHLTTPCModelTrack()
- :
- fClusterCharge(0),
- fClusters(0),
- fTrackModel(0),
- fNClusters(0),
- fMaxOverlaps(0),
- fNoverlaps(0),
- fOverlap(0),
- fParSigmaY2(0),
- fParSigmaZ2(0),
- fCrossingAngle(0),
- fPatch(0),
- fArraysCreated(kFALSE),
- fPad(0),
- fTime(0)
-{
- // default constructor
-}
-
-AliHLTTPCModelTrack::~AliHLTTPCModelTrack()
-{
- // destructor
- DeleteArrays();
-}
-
-void AliHLTTPCModelTrack::DeleteArrays()
-{
- // deletes all arrays
- if(fClusters)
- delete [] fClusters;
- if(fPad)
- delete [] fPad;
- if(fTime)
- delete [] fTime;
- if(fCrossingAngle)
- delete [] fCrossingAngle;
- if(fParSigmaY2)
- delete [] fParSigmaY2;
- if(fParSigmaZ2)
- delete [] fParSigmaZ2;
- if(fTrackModel)
- delete fTrackModel;
- if(fNoverlaps)
- delete [] fNoverlaps;
- if(fOverlap)
- {
- for(Int_t i=0; i<AliHLTTPCTransform::GetNRows(fPatch); i++)
- delete [] fOverlap[i];
- delete [] fOverlap;
- }
- fArraysCreated=kFALSE;
-}
-
-void AliHLTTPCModelTrack::Init(Int_t /*slice*/,Int_t patch)
-{
- // Initialization
- if(fArraysCreated)
- {
- DeleteArrays();
- }
- fNClusters=AliHLTTPCTransform::GetNRows(patch);
- fPatch=patch;
- Int_t nrows = AliHLTTPCTransform::GetNRows(fPatch);
- fClusters = new AliHLTTPCClusterModel[nrows];
- fPad = new Float_t[nrows];
- fTime = new Float_t[nrows];
- fCrossingAngle = new Float_t[nrows];
- fParSigmaY2 = new Float_t[nrows];
- fParSigmaZ2 = new Float_t[nrows];
- fTrackModel = new AliHLTTPCTrackModel;
-
- fOverlap = new Int_t*[nrows];
- fNoverlaps = new Int_t[nrows];
- fMaxOverlaps = 5;
-
- memset(fNoverlaps,0,nrows*sizeof(Int_t));
- memset(fClusters,0,nrows*sizeof(AliHLTTPCClusterModel));
- memset(fPad,0,nrows*sizeof(Float_t));
- memset(fTime,0,nrows*sizeof(Float_t));
- memset(fCrossingAngle,0,nrows*sizeof(Float_t));
- memset(fParSigmaY2,0,nrows*sizeof(Float_t));
- memset(fParSigmaZ2,0,nrows*sizeof(Float_t));
- memset(fTrackModel,0,sizeof(AliHLTTPCTrackModel));
- for(Int_t i=0; i<nrows; i++)
- {
- fOverlap[i] = new Int_t[fMaxOverlaps];
- for(Int_t j=0; j<fMaxOverlaps; j++)
- fOverlap[i][j]=-1;
- fClusters[i].fSlice = -1;
- }
- fArraysCreated=kTRUE;
-}
-
-
-
-void AliHLTTPCModelTrack::CalculateClusterWidths(Int_t row,Bool_t parametrize)
-{
- //Cluster widths
-
- Float_t xyz[3];
- Int_t sr,lr;
- Int_t index = row - AliHLTTPCTransform::GetFirstRow(fPatch);
- if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
- {
- cerr<<"AliHLTTPCModelTrack::CalculcateClusterWidths : Wrond index "<<index<<" row "<<row<<endl;
- return;
- }
- Int_t patch = AliHLTTPCTransform::GetPatch(row);
- AliHLTTPCTransform::Slice2Sector(0,row,sr,lr);
- AliHLTTPCTransform::Raw2Local(xyz,sr,lr,GetPadHit(row),GetTimeHit(row));
- fParSigmaY2[index] = AliHLTTPCTransform::GetParSigmaY2(row,xyz[2],GetCrossingAngleLUT(row));
- fParSigmaZ2[index] = AliHLTTPCTransform::GetParSigmaZ2(row,xyz[2],GetTgl());
-
- if(parametrize)
- {
- fParSigmaY2[index] = (fParSigmaY2[index] + (1./12)*pow(AliHLTTPCTransform::GetPadPitchWidth(patch),2) );
- fParSigmaY2[index] *= 0.108;
- if(patch<2)
- fParSigmaY2[index] *= 2.07;
-
- fParSigmaZ2[index] = (fParSigmaZ2[index] + (1./12)*pow(AliHLTTPCTransform::GetZWidth(),2) );
- fParSigmaZ2[index] *= 0.169;
- if(patch<2)
- fParSigmaZ2[index] *= 1.77;
- }
-
- //convert to raw coordinates:
- fParSigmaY2[index] /= pow(AliHLTTPCTransform::GetPadPitchWidth(patch),2);
- fParSigmaZ2[index] /= pow(AliHLTTPCTransform::GetZWidth(),2);
-}
-
-void AliHLTTPCModelTrack::SetCluster(Int_t row,Float_t fpad,Float_t ftime,Float_t charge,
- Float_t sigmaY2,Float_t sigmaZ2,Int_t npads)
-{
- AliHLTTPCClusterModel *cl = GetClusterModel(row);
-
- //First bit: Cluster is present or not
- //Second bit: Cluster was set, meaning an fit attempt was done (if true)
-
- cl->fPresent |= 0x2; //set second bit to true, because a fit attempt has been made
-
- Int_t patch = AliHLTTPCTransform::GetPatch(row);
- if(!charge || npads == 1)
- {
- cl->fPresent &= ~0x1; //set first bit to false
- }
- else
- {
- cl->fPresent|=0x1;//set first bit to true
- cl->fDPad = (fpad - GetPadHit(row))/(AliHLTTPCDataCompressorHelper::GetXYResidualStep(row)/AliHLTTPCTransform::GetPadPitchWidth(patch));
- cl->fDTime = (ftime - GetTimeHit(row))/(AliHLTTPCDataCompressorHelper::GetZResidualStep(row)/AliHLTTPCTransform::GetZWidth());
- cl->fDCharge = charge;
- if(sigmaY2==0 && sigmaZ2==0)
- {
- cl->fDSigmaY=0;//if width is zero, shape is not supposed to be written
- cl->fDSigmaZ=0;
- }
- else
- {
- //cl->fDSigmaY2 = (sigmaY2 - GetParSigmaY2(row))/(pow(AliHLTTPCDataCompressorHelper::GetXYWidthStep(),2)/pow(AliHLTTPCTransform::GetPadPitchWidth(patch),2));
- //cl->fDSigmaZ2 = (sigmaZ2 - GetParSigmaZ2(row))/(pow(AliHLTTPCDataCompressorHelper::GetZWidthStep(),2)/pow(AliHLTTPCTransform::GetZWidth(),2));
- cl->fDSigmaY = (sqrt(sigmaY2) - sqrt(GetParSigmaY2(row)))/(AliHLTTPCDataCompressorHelper::GetXYWidthStep()/AliHLTTPCTransform::GetPadPitchWidth(patch));
- cl->fDSigmaZ = (sqrt(sigmaZ2) - sqrt(GetParSigmaZ2(row)))/(AliHLTTPCDataCompressorHelper::GetZWidthStep()/AliHLTTPCTransform::GetZWidth());
- }
- cl->fNPads = npads;
- }
-}
-
-
-void AliHLTTPCModelTrack::Set(AliHLTTPCTrack *tpt)
-{
- // Sets track and does initialization
- AliHLTTPCModelTrack *tr = (AliHLTTPCModelTrack*)tpt;
- SetRowRange(tr->GetFirstRow(),tr->GetLastRow());
- SetPhi0(tr->GetPhi0());
- SetKappa(tr->GetKappa());
- SetFirstPoint(tr->GetFirstPointX(),tr->GetFirstPointY(),tr->GetFirstPointZ());
- SetLastPoint(tr->GetLastPointX(),tr->GetLastPointY(),tr->GetLastPointZ());
- SetPt(tr->GetPt());
- SetPsi(tr->GetPsi());
- SetTgl(tr->GetTgl());
- SetCharge(tr->GetCharge());
-
- if(fClusters)
- {
- cerr<<"AliHLTTPCModelTrack::Set : Init has already been called for this object!"<<endl;
- return;
- }
-
- //Init(tr->fSlice,tr->fPatch);
- Init(0,tr->fPatch);
- memcpy(fClusters,tr->fClusters,AliHLTTPCTransform::GetNRows(fPatch)*sizeof(AliHLTTPCClusterModel));
- memcpy(fPad,tr->fPad,AliHLTTPCTransform::GetNRows(fPatch)*sizeof(Float_t));
- memcpy(fTime,tr->fTime,AliHLTTPCTransform::GetNRows(fPatch)*sizeof(Float_t));
- memcpy(fParSigmaY2,tr->fParSigmaY2,AliHLTTPCTransform::GetNRows(fPatch)*sizeof(Float_t));
- memcpy(fParSigmaZ2,tr->fParSigmaZ2,AliHLTTPCTransform::GetNRows(fPatch)*sizeof(Float_t));
- memcpy(fCrossingAngle,tr->fCrossingAngle,AliHLTTPCTransform::GetNRows(fPatch)*sizeof(Float_t));
- memcpy(fTrackModel,tr->fTrackModel,sizeof(AliHLTTPCTrackModel));
-
-}
-
-Int_t AliHLTTPCModelTrack::GetNPresentClusters()
-{
- //Return the number of assigned clusters to the track.
- //Differs from fNClusters, which should be equal to the
- //number of padrows in the present patch.
-
- Int_t count=0;
-
- for(Int_t i=AliHLTTPCTransform::GetFirstRow(fPatch); i<=AliHLTTPCTransform::GetLastRow(fPatch); i++)
- if(IsPresent(i))
- count++;
-
- return count;
-}
-
-void AliHLTTPCModelTrack::FillModel()
-{
- //Fill the track structure
-
- if(fNClusters != AliHLTTPCTransform::GetNRows(fPatch))
- {
- cout<<"AliHLTTPCModelTrack::FillModel : fNClusters != nrows; beware, this could be caused by a bug!!!"<<endl;
- fNClusters = AliHLTTPCTransform::GetNRows(fPatch);
- }
-
- if(!fTrackModel)
- {
- cerr<<"AliHLTTPCModelTrack::FillModel() : No trackmodel "<<endl;
- return;
- }
- Double_t impact[3];
- AliHLTTPCVertex vertex;
- CalculateHelix();
- GetClosestPoint(&vertex,impact[0],impact[1],impact[2]);
- fTrackModel->fKappa = GetKappa();
- fTrackModel->fPhi = atan2(impact[1],impact[0]);
- fTrackModel->fD = sqrt(impact[0]*impact[0] + impact[1]*impact[1]);
- fTrackModel->fZ0 = impact[2];
- fTrackModel->fTgl = GetTgl();
-
- //We have to check on which of the vertex the track fit is lying
- //This we need to encode the azimuthal angle coordinate of the center of curvature.
- if(GetRadius() < sqrt(GetCenterX()*GetCenterX()+GetCenterY()*GetCenterY()))
- fTrackModel->fD *=-1;
-
-}
-
-void AliHLTTPCModelTrack::FillTrack()
-{
- //Fill the track parameters from the structure.
-
- if(!fTrackModel)
- {
- cerr<<"AliHLTTPCModelTrack::FillTrack() : No data!!"<<endl;
- return;
- }
- SetKappa(fTrackModel->fKappa);
- Double_t impact[3],psi;
- Float_t trackPhi0 = fTrackModel->fPhi;
- if(fTrackModel->fD < 0)
- trackPhi0 += AliHLTTPCTransform::Pi();
- Int_t charge = -1*(Int_t)copysign(1.,GetKappa());
- impact[0] = fabs(fTrackModel->fD)*cos(fTrackModel->fPhi);
- impact[1] = fabs(fTrackModel->fD)*sin(fTrackModel->fPhi);
- impact[2] = fTrackModel->fZ0;
-
- psi = trackPhi0 - charge*0.5*AliHLTTPCTransform::Pi();
- if(psi < 0)
- psi += 2*AliHLTTPCTransform::Pi();
-
- SetCharge(charge);
- SetFirstPoint(impact[0],impact[1],impact[2]);
- SetPsi(psi);
- SetTgl(fTrackModel->fTgl);
- SetPt((AliHLTTPCTransform::GetBFact()*AliHLTTPCTransform::GetBField())/fabs(GetKappa()));
- fNClusters = AliHLTTPCTransform::GetNRows(fPatch);
- CalculateHelix();
-
- for(Int_t i=AliHLTTPCTransform::GetFirstRow(fPatch); i<=AliHLTTPCTransform::GetLastRow(fPatch); i++)
- {
- AliHLTTPCClusterModel *cl = GetClusterModel(i);
- if(!cl) continue;
-
- if(cl->fSlice == -1)
- {
- SetPadHit(i,-1);
- SetTimeHit(i,-1);
- continue;
- }
- if(cl->fSlice < 0 || cl->fSlice > 35)
- {
- cerr<<"AliHLTTPCModelTrack::FillTrack : Slice out of range "<<cl->fSlice<<" on row "<<i<<endl;
- exit(5);
- }
-
- Float_t angle = 0;
-
- AliHLTTPCTransform::Local2GlobalAngle(&angle,cl->fSlice);
- if(!CalculateReferencePoint(angle,AliHLTTPCTransform::Row2X(i)))
- {
- if(IsPresent(i))
- {
- cerr<<"AliHLTTPCModelTrack::FillTrack : Track does not cross slice "<<cl->fSlice<<" row "<<i<<" Points "
- <<GetPointX()<<" "<<GetPointY()<<" "<<GetPointZ()<<endl;
- Print();
- exit(5);
- }
- SetPadHit(i,-1);
- SetTimeHit(i,-1);
- continue;
- }
- Float_t hit[3] = {GetPointX(),GetPointY(),GetPointZ()};
- Int_t sector,row;
- AliHLTTPCTransform::Slice2Sector(cl->fSlice,i,sector,row);
- AliHLTTPCTransform::Global2Raw(hit,sector,row);
-
- SetPadHit(i,hit[1]);
- SetTimeHit(i,hit[2]);
-
- Float_t crossingangle = GetCrossingAngle(i,cl->fSlice);
-
- SetCrossingAngleLUT(i,crossingangle);
- CalculateClusterWidths(i,kTRUE);
-
- }
-}
-
-void AliHLTTPCModelTrack::SetPadHit(Int_t row,Float_t pad)
-{
- // sets pad hit
- Int_t index = row-AliHLTTPCTransform::GetFirstRow(fPatch);
- if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
- {
- cerr<<"AliHLTTPCModelTrack::SetPadHit() : Wrong index: "<<index<<endl;
- return;
- }
- fPad[index]=pad;
-}
-
-void AliHLTTPCModelTrack::SetTimeHit(Int_t row,Float_t time)
-{
- // sets time hit
- Int_t index = row-AliHLTTPCTransform::GetFirstRow(fPatch);
- if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
- {
- cerr<<"AliHLTTPCModelTrack::SetTimeHit() : Wrong index: "<<index<<endl;
- return;
- }
- fTime[index]=time;
-}
-
-void AliHLTTPCModelTrack::SetCrossingAngleLUT(Int_t row,Float_t angle)
-{
- // sets LUT for crossing angle
- Int_t index = row-AliHLTTPCTransform::GetFirstRow(fPatch);
- if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
- {
- cerr<<"AliHLTTPCModelTrack::SetCrossingAngle() : Wrong index: "<<index<<endl;
- return;
- }
- fCrossingAngle[index]=angle;
-}
-
-void AliHLTTPCModelTrack::SetOverlap(Int_t row,Int_t id)
-{
- // sets overlap
- Int_t index = row-AliHLTTPCTransform::GetFirstRow(fPatch);
- if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
- {
- cerr<<"AliHLTTPCModelTrack::SetOverlap() : Wrong index: "<<index<<endl;
- return;
- }
- if(fNoverlaps[index] >= fMaxOverlaps) return;
- fOverlap[index][fNoverlaps[index]++] = id;
-}
-
-Bool_t AliHLTTPCModelTrack::IsPresent(Int_t row)
-{
- AliHLTTPCClusterModel *cl = GetClusterModel(row);
- return (Bool_t)(cl->fPresent & 0x1);
-}
-
-Bool_t AliHLTTPCModelTrack::IsSet(Int_t row)
-{
- // checks if row was set
- AliHLTTPCClusterModel *cl = GetClusterModel(row);
- return (Bool_t)(cl->fPresent & 0x2);
-}
-
-Int_t AliHLTTPCModelTrack::GetNPads(Int_t row)
-{
- // gets number of pads
- AliHLTTPCClusterModel *cl = GetClusterModel(row);
- return cl->fNPads;
-}
-
-Bool_t AliHLTTPCModelTrack::GetPad(Int_t row,Float_t &pad)
-{
- // gets pad
- //(fpad - GetPadHit(row))/(AliHLTTPCDataCompressorHelper::GetXYResidualStep(row)/AliHLTTPCTransform::GetPadPitchWidth(patch));
- AliHLTTPCClusterModel *cl = GetClusterModel(row);
- Int_t patch = AliHLTTPCTransform::GetPatch(row);
- pad = cl->fDPad*(AliHLTTPCDataCompressorHelper::GetXYResidualStep(row)/AliHLTTPCTransform::GetPadPitchWidth(patch)) + GetPadHit(row);
- return IsPresent(row);
-}
-
-Bool_t AliHLTTPCModelTrack::GetTime(Int_t row,Float_t &time)
-{
- // gets time
- AliHLTTPCClusterModel *cl = GetClusterModel(row);
- time = cl->fDTime*(AliHLTTPCDataCompressorHelper::GetZResidualStep(row)/AliHLTTPCTransform::GetZWidth()) + GetTimeHit(row);
- return IsPresent(row);
-}
-
-Bool_t AliHLTTPCModelTrack::GetClusterCharge(Int_t row,Int_t &charge)
-{
- // gets cluster's charge
- AliHLTTPCClusterModel *cl = GetClusterModel(row);
- charge = (Int_t)cl->fDCharge;// + AliHLTTPCDataCompressorHelperHelper::GetClusterCharge();
- return IsPresent(row);
-}
-
-Bool_t AliHLTTPCModelTrack::GetSigmaY2(Int_t row,Float_t &sigma2)
-{
- // gets SigmaY2
- //cl->fDSigmaY = (sqrt(sigmaY2) - sqrt(GetParSigmaY2(row)))/(AliHLTTPCDataCompressorHelper::GetXYWidthStep()/AliHLTTPCTransform::GetPadPitchWidth(patch));
- AliHLTTPCClusterModel *cl = GetClusterModel(row);
- Int_t patch = AliHLTTPCTransform::GetPatch(row);
- Float_t sigma = cl->fDSigmaY*(AliHLTTPCDataCompressorHelper::GetXYWidthStep()/AliHLTTPCTransform::GetPadPitchWidth(patch)) + sqrt(GetParSigmaY2(row));
- sigma2 = sigma*sigma;
- return IsPresent(row);
-}
-
-Bool_t AliHLTTPCModelTrack::GetSigmaZ2(Int_t row,Float_t &sigma2)
-{
- // gets SigmaZ2
- //cl->fDSigmaZ = (sqrt(sigmaZ2) - sqrt(GetParSigmaZ2(row)))/(AliHLTTPCDataCompressorHelper::GetZWidthStep()/AliHLTTPCTransform::GetZWidth());
- AliHLTTPCClusterModel *cl = GetClusterModel(row);
- Float_t sigma = cl->fDSigmaZ*(AliHLTTPCDataCompressorHelper::GetZWidthStep()/AliHLTTPCTransform::GetZWidth()) + sqrt(GetParSigmaZ2(row));
- sigma2 = sigma*sigma;
- return IsPresent(row);
-}
-
-Bool_t AliHLTTPCModelTrack::GetPadResidual(Int_t row,Float_t &res)
-{
- // gets pad residual
- AliHLTTPCClusterModel *cl = GetClusterModel(row);
- Int_t patch = AliHLTTPCTransform::GetPatch(row);
- res = cl->fDPad*(AliHLTTPCDataCompressorHelper::GetXYResidualStep(row)/AliHLTTPCTransform::GetPadPitchWidth(patch));
- return IsPresent(row);
-}
-
-Bool_t AliHLTTPCModelTrack::GetTimeResidual(Int_t row,Float_t &res)
-{
- // gets time residual
- AliHLTTPCClusterModel *cl = GetClusterModel(row);
- res = cl->fDTime*(AliHLTTPCDataCompressorHelper::GetZResidualStep(row)/AliHLTTPCTransform::GetZWidth());
- return IsPresent(row);
-}
-
-Bool_t AliHLTTPCModelTrack::GetSigmaYResidual(Int_t row,Float_t &res)
-{
- // gets SigmaY residual (?)
- AliHLTTPCClusterModel *cl = GetClusterModel(row);
- Int_t patch = AliHLTTPCTransform::GetPatch(row);
- res = cl->fDSigmaY*(AliHLTTPCDataCompressorHelper::GetXYWidthStep()/AliHLTTPCTransform::GetPadPitchWidth(patch));
- return IsPresent(row);
-}
-
-Bool_t AliHLTTPCModelTrack::GetSigmaZResidual(Int_t row,Float_t &res)
-{
- // gets SigmaZ resigual (?)
- AliHLTTPCClusterModel *cl = GetClusterModel(row);
- res = cl->fDSigmaZ*(AliHLTTPCDataCompressorHelper::GetZWidthStep()/AliHLTTPCTransform::GetZWidth());
- return IsPresent(row);
-}
-
-Int_t AliHLTTPCModelTrack::GetSlice(Int_t row)
-{
- // Gets slice
- AliHLTTPCClusterModel *cl = GetClusterModel(row);
- return cl->fSlice;
-}
-
-Float_t AliHLTTPCModelTrack::GetPadHit(Int_t row)
-{
- // Gets pad hit
- Int_t index = row-AliHLTTPCTransform::GetFirstRow(fPatch);
- if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
- {
- cerr<<"AliHLTTPCModelTrack::GetPadHit() : Wrong index: "<<index<<" row "<<row<<endl;
- return 0;
- }
- return fPad[index];
-}
-
-Float_t AliHLTTPCModelTrack::GetTimeHit(Int_t row)
-{
- // Gets time hit
- Int_t index = row-AliHLTTPCTransform::GetFirstRow(fPatch);
- if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
- {
- cerr<<"AliHLTTPCModelTrack::GetTimeHit() : Wrong index: "<<index<<" row "<<row<<endl;
- return 0;
- }
- return fTime[index];
-}
-
-Float_t AliHLTTPCModelTrack::GetCrossingAngleLUT(Int_t row)
-{
- // gets LUT for crossing angle
- Int_t index = row-AliHLTTPCTransform::GetFirstRow(fPatch);
- if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
- {
- cerr<<"AliHLTTPCModelTrack::GetCrossingAngleLUT() : Wrong index: "<<index<<" row "<<row<<endl;
- return 0;
- }
- return fCrossingAngle[index];
-}
-
-Float_t AliHLTTPCModelTrack::GetParSigmaY2(Int_t row)
-{
- // gets par SigmaY2 (?)
- Int_t index = row-AliHLTTPCTransform::GetFirstRow(fPatch);
- if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
- {
- cerr<<"AliHLTTPCModelTrack::GetParSigmaY2() : Wrong index: "<<index<<" row "<<row<<endl;
- return 0;
- }
- return fParSigmaY2[index];
-}
-
-Float_t AliHLTTPCModelTrack::GetParSigmaZ2(Int_t row)
-{
- // gets par SigmaZ2 (?)
- Int_t index = row-AliHLTTPCTransform::GetFirstRow(fPatch);
- if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
- {
- cerr<<"AliHLTTPCModelTrack::GetParSigmaZ2() : Wrong index: "<<index<<" row "<<row<<endl;
- return 0;
- }
- return fParSigmaZ2[index];
-}
-
-Int_t AliHLTTPCModelTrack::GetNOverlaps(Int_t row)
-{
- // gets number of overlaps
- Int_t index = row - AliHLTTPCTransform::GetFirstRow(fPatch);
- if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
- {
- cerr<<"AliHLTTPCModelTrack::GetOverlap() : Wrong index: "<<index<<endl;
- return 0;
- }
- return fNoverlaps[index];
-}
-
-Int_t *AliHLTTPCModelTrack::GetOverlaps(Int_t row)
-{
- // gets overlaps
- Int_t index = row - AliHLTTPCTransform::GetFirstRow(fPatch);
- if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
- {
- cerr<<"AliHLTTPCModelTrack::GetOverlap() : Wrong index: "<<index<<endl;
- return 0;
- }
- return fOverlap[index];
-}
-
-AliHLTTPCClusterModel *AliHLTTPCModelTrack::GetClusterModel(Int_t row)
-{
- // gets cluster model
- if(!fClusters) return 0;
- Int_t index = row-AliHLTTPCTransform::GetFirstRow(fPatch);
- if(index < 0 || index > AliHLTTPCTransform::GetNRows(fPatch))
- {
- cerr<<"AliHLTTPCModelTrack::GetClusterModel() : Wrong index: "<<index<<endl;
- return 0;
- }
- return &fClusters[index];
-}
-
-void AliHLTTPCModelTrack::Print(Bool_t everything)
-{
- //Print info
-
- cout<<"First point "<<GetFirstPointX()<<" "<<GetFirstPointY()<<" "<<GetFirstPointZ()<<endl;
- cout<<"Last point "<<GetLastPointX()<<" "<<GetLastPointY()<<" "<<GetLastPointZ()<<endl;
- cout<<"Pt "<<GetPt()<<" kappa "<<GetKappa()<<" tgl "<<GetTgl()<<" psi "<<GetPsi()<<" charge "<<GetCharge()<<endl;
- cout<<"Center "<<GetCenterX()<<" "<<GetCenterY()<<endl<<endl;
- if(!everything)
- return;
- cout<<"NHits "<<GetNClusters()<<endl;
-
- cout<<"Clusters:"<<endl;
- Int_t origslice=-1,counter=0;
- Float_t fpad,ftime,sigmaY2,sigmaZ2;
- for(Int_t i=AliHLTTPCTransform::GetFirstRow(fPatch); i<=AliHLTTPCTransform::GetLastRow(fPatch); i++)
- {
- AliHLTTPCClusterModel *cl = GetClusterModel(i);
-
- if(!IsPresent(i))
- {
- cout<<i<<" Empty"<<" Slice "<<cl->fSlice<<" Padcrossing "<<GetPadHit(i)<<" Timecrossing "<<GetTimeHit(i)<<" ";
- //AliHLTTPCTransform::RawHLT2Global(xyz,cl->fSlice,i,GetPadHit(i),GetTimeHit(i));
- //cout<<i<<" slice "<<cl->fSlice<<" x "<<xyz[0]<<" y "<<xyz[1]<<" z "<<xyz[2];
- }
- else
- {
- GetPad(i,fpad);
- GetTime(i,ftime);
- GetSigmaY2(i,sigmaY2);
- GetSigmaZ2(i,sigmaZ2);
- if(counter==0)
- origslice=cl->fSlice;
- else if(cl->fSlice != origslice)
- cout<<"Change in slice "<<cl->fSlice<<" "<<origslice<<endl;
- cout<<i<<" Slice "<<cl->fSlice<<" Dpad "<<cl->fDPad<<" Dtime "<<cl->fDTime<<" Dcharge "<<cl->fDCharge;
- cout<<" sigmaY2 "<<sigmaY2<<" sigmaZ2 "<<sigmaZ2;
- cout<<" parsigmaY2 "<<GetParSigmaY2(i)<<" parsigmaZ2 "<<GetParSigmaZ2(i);
- cout<<" Pad "<<fpad<<" padhit "<<GetPadHit(i)<<" Time "<<ftime<<" timehit "<<GetTimeHit(i)<<" ";
- counter++;
- }
- cout<<endl;
- }
-}
-
-#ifdef do_mc
-void AliHLTTPCModelTrack::SetClusterLabel(Int_t row,Int_t *trackID)
-{
- // sets cluster label
- AliHLTTPCClusterModel *cl = GetClusterModel(row);
- cl->fTrackID[0] = trackID[0];
- cl->fTrackID[1] = trackID[1];
- cl->fTrackID[2] = trackID[2];
-#else
- void AliHLTTPCModelTrack::SetClusterLabel(Int_t /*row*/,Int_t */*trackID*/)
-{
- // Does nothing if do_mc undefined
- return;
-#endif
-}
-
-#ifdef do_mc
-void AliHLTTPCModelTrack::GetClusterLabel(Int_t row,Int_t *trackID)
-{
- // gets cluster label
- AliHLTTPCClusterModel *cl = GetClusterModel(row);
- trackID[0] = cl->fTrackID[0];
- trackID[1] = cl->fTrackID[1];
- trackID[2] = cl->fTrackID[2];
-#else
- void AliHLTTPCModelTrack::GetClusterLabel(Int_t /*row*/,Int_t */*trackID*/)
-{
- // Does nothing if do_mc undefined
- return;
-#endif
-}
-
+++ /dev/null
-// @(#) $Id$
-// Original: AliHLTModelTrack.h,v 1.13 2004/06/15 10:26:57 hristov
-
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* See cxx source for full Copyright notice *
-
-#ifndef AliHLTTPCModel_Track
-#define AliHLTTPCModel_Track
-
-#include "AliHLTTPCTrack.h"
-#include "AliHLTTPCModels.h"
-
-/**
- * @class AliHLTTPCModelTrack
- *
- * @ingroup alihlt_tpc
- */
-class AliHLTTPCModelTrack : public AliHLTTPCTrack {
-
- public:
- AliHLTTPCModelTrack();
- virtual ~AliHLTTPCModelTrack();
-
- void Init(Int_t slice,Int_t patch);
- void CalculateClusterWidths(Int_t row,Bool_t parametrize=kFALSE);
- void SetCluster(Int_t row,Float_t dpad,Float_t dtime,Float_t charge,Float_t sigmaY2,Float_t sigmaZ2,Int_t npads);
- void FillModel();
- void FillTrack();
- void Print(Bool_t everything=kTRUE);
- using AliHLTTPCTrack::Print;
- void Set(AliHLTTPCTrack *tpt);
-
- void SetPadHit(Int_t row,Float_t f);
- void SetTimeHit(Int_t row,Float_t f);
- void SetCrossingAngleLUT(Int_t row,Float_t angle);
- void SetOverlap(Int_t row,Int_t id);
- void SetClusterLabel(Int_t row,Int_t *trackID);
- void SetNClusters(Int_t i) {fNClusters = i;}
-
- Int_t GetNPresentClusters();
- Bool_t IsPresent(Int_t row);
- Bool_t IsSet(Int_t row);
-
- AliHLTTPCClusterModel *GetClusters() {return fClusters;}
- AliHLTTPCTrackModel *GetModel() {return fTrackModel;}
- AliHLTTPCClusterModel *GetClusterModel(Int_t row);
- Int_t *GetOverlaps(Int_t row);
- Int_t GetNOverlaps(Int_t row);
- Int_t GetNPads(Int_t row);
- Int_t GetSlice(Int_t row);
- Float_t GetPadHit(Int_t row);
- Float_t GetTimeHit(Int_t row);
- Float_t GetCrossingAngleLUT(Int_t row);
- Float_t GetParSigmaY2(Int_t row);
- Float_t GetParSigmaZ2(Int_t row);
- Bool_t GetPad(Int_t row,Float_t &pad);
- Bool_t GetTime(Int_t row,Float_t &time);
- Bool_t GetClusterCharge(Int_t row,Int_t &charge);
- Bool_t GetSigmaY2(Int_t row,Float_t &sigma2);
- Bool_t GetSigmaZ2(Int_t row,Float_t &sigma2);
- Bool_t GetPadResidual(Int_t row,Float_t &res);
- Bool_t GetTimeResidual(Int_t row,Float_t &res);
- Bool_t GetSigmaYResidual(Int_t row,Float_t &res);
- Bool_t GetSigmaZResidual(Int_t row,Float_t &res);
- Int_t GetNClusters() const {return fNClusters;}
- void GetClusterLabel(Int_t row,Int_t *trackID);
-
- private:
- /** copy constructor prohibited */
- AliHLTTPCModelTrack(const AliHLTTPCModelTrack&);
- /** assignment operator prohibited */
- AliHLTTPCModelTrack& operator=(const AliHLTTPCModelTrack&);
-
- Short_t fClusterCharge; //Average cluster charge
- AliHLTTPCClusterModel *fClusters; //! Clusters
- AliHLTTPCTrackModel *fTrackModel; //! Track model
- Short_t fNClusters; // Number of clusters
- Int_t fMaxOverlaps; // Max overlaps (?)
- Int_t *fNoverlaps; //! Number of overlaps
- Int_t **fOverlap; //! Table of overlaps(?)
- Float_t *fParSigmaY2; //! Parameter SigmaY2 (?)
- Float_t *fParSigmaZ2; //! Parameter SigmaZ2 (?)
- Float_t *fCrossingAngle; //! Crossing angle
- Int_t fPatch; // Current patch
- Bool_t fArraysCreated; // Flag if arrays were created
-
- //Crossing points with padrows
- Float_t *fPad; //! Current pad
- Float_t *fTime; //! Current time
-
- void DeleteArrays();
-
- ClassDef(AliHLTTPCModelTrack,1)
-
-};
-
-#endif
+++ /dev/null
-// @(#) $Id$
-// Original: AliHLTModels.h,v 1.11 2004/05/17 16:37:19 hristov
-
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* See cxx source for full Copyright notice *
-
-#ifndef AliHLTTPCModels_H
-#define AliHLTTPCModels_H
-
-/// \author Anders Vestbo or Constantin Loizides
-/// \date 7 Sep 2005
-/// \brief Data structures used for TPC clusters.
-///
-/// Basic structures used by the AliHLTTPCModelTrack class.
-
-#include "AliHLTTPCRootTypes.h"
-
-const Int_t kMaxNClusters = 32;
-
-struct AliHLTTPCClusterModel {
- Byte_t fPresent; // Boolean flag, is the cluster present or not?
- Float_t fDTime; // Digit time.
- Float_t fDPad; // Digit pad.
- Float_t fDCharge; // Digit charge.
- Float_t fDSigmaY; // Sigma in Y.
- Float_t fDSigmaZ; // Sigma in X.
- UInt_t fNPads; // Total number of pafs.
- Short_t fSlice; // TPC slice.
-#ifdef do_mc
- Int_t fTrackID[3]; // Track IDs from MC.
-#endif
-};
-typedef struct AliHLTTPCClusterModel AliHLTTPCClusterModel;
-
-struct AliHLTTPCRemainingCluster {
- Float_t fPad; // Pad value.
- Float_t fTime; // Time value.
- Float_t fSigmaY2; // Square of sigma in Y.
- Float_t fSigmaZ2; // Square of sigma in X.
- UShort_t fCharge; // Charge.
-};
-typedef struct AliHLTTPCRemainingCluster AliHLTTPCRemainingCluster;
-
-struct AliHLTTPCRemainingRow {
- Byte_t fPadRow; //1 byte
- UShort_t fNClusters; //2 bytes
-#if defined(__HP_aCC) || defined(__DECCXX) || defined(__SUNPRO_CC)
- AliHLTTPCRemainingCluster fClusters[1]; // Array of clusters.
-#else
- AliHLTTPCRemainingCluster fClusters[0]; // Array of clusters.
-#endif
-};
-typedef struct AliHLTTPCRemainingRow AliHLTTPCRemainingRow;
-
-struct AliHLTTPCTrackModel {//5 independent parameters is needed to encode the helix:
- Float_t fKappa; //Curvature
- Float_t fPhi; //Azimuthal angle of DCAO (distance of closest approach to origo)
- Float_t fD; //radius of DCA0
- Float_t fZ0; //z-coordinate of DCA0
- Float_t fTgl; //tan of dipangle
-};
-typedef struct AliHLTTPCTrackModel AliHLTTPCTrackModel;
-
-#endif
+++ /dev/null
-// @(#) $Id$
-// Original: AliHLTRootTypes.h,v 1.12 2004/06/15 14:02:38 loizides
-#ifndef ALIHLTTPCROOTTYPES_H
-#define ALIHLTTPCROOTTYPES_H
-
-
-//////////////////////////////////////////////////////////////////////////
-// //
-// Basic types used by HLT //
-// //
-//////////////////////////////////////////////////////////////////////////
-
-#ifndef no_root
-#include <TObject.h>
-#include <Rtypes.h>
-
-#else
-
-#if __GNUC__ == 3
-#include <cstdio>
-#include <cmath>
-#else
-#include <stdio.h>
-#include <math.h>
-#endif
-
-#ifndef ROOT_Rtypes
-//---- types -------------------------------------------------------------------
-
-typedef char Char_t; //Signed Character 1 byte
-typedef unsigned char UChar_t; //Unsigned Character 1 byte
-typedef short Short_t; //Signed Short integer 2 bytes
-typedef unsigned short UShort_t; //Unsigned Short integer 2 bytes
-#ifdef R__INT16
-typedef long Int_t; //Signed integer 4 bytes
-typedef unsigned long UInt_t; //Unsigned integer 4 bytes
-#else
-typedef int Int_t; //Signed integer 4 bytes
-typedef unsigned int UInt_t; //Unsigned integer 4 bytes
-#endif
-#ifdef R__B64
-typedef int Seek_t; //File pointer
-typedef long Long_t; //Signed long integer 4 bytes
-typedef unsigned long ULong_t; //Unsigned long integer 4 bytes
-#else
-typedef int Seek_t; //File pointer
-typedef long Long_t; //Signed long integer 8 bytes
-typedef unsigned long ULong_t; //Unsigned long integer 8 bytes
-#endif
-typedef float Float_t; //Float 4 bytes
-typedef double Double_t; //Float 8 bytes
-typedef char Text_t; //General string
-typedef bool Bool_t; //Boolean (0=false, 1=true) (bool)
-typedef unsigned char Byte_t; //Byte (8 bits)
-typedef short Version_t; //Class version identifier
-typedef const char Option_t; //Option string
-typedef int Ssiz_t; //String size
-typedef float Real_t; //TVector and TMatrix element type
-typedef long long Long64_t; //Portable signed long integer 8 bytes
-typedef unsigned long long ULong64_t; //Portable unsigned long integer 8 bytes
-
-typedef void (*VoidFuncPtr_t)(); //pointer to void function
-
-
-//---- constants ---------------------------------------------------------------
-#ifndef NULL
-#define NULL 0
-#endif
-
-const Bool_t kTRUE = 1;
-const Bool_t kFALSE = 0;
-
-const Int_t kMaxInt = 2147483647;
-const Int_t kMaxShort = 32767;
-const size_t kBitsPerByte = 8;
-const Ssiz_t kNPOS = ~(Ssiz_t)0;
-
-
-//---- ClassDef macros ---------------------------------------------------------
-
-#define ClassDef(name,id)
-#define ClassImp(name)
-#endif //end of Rtypes
-#endif //end of root selection
-
-//---- Timms AliHLTTPCEventDataType from AliHLTTPCEventDataType.h
-
-union AliHLTTPCEventDataTypeRoot{
- ULong_t fID;
- unsigned char fDescr[8];
-};
-
-typedef union AliHLTTPCEventDataTypeRoot AliHLTTPCEventDataTypeRoot;
-
-#define ROOT_UNKNOWN_DATAID (((ULong_t)'UNKN')<<32 | 'OWN ')
-#define ROOT_COMPOSITE_DATAID (((ULong_t)'COMP')<<32 | 'OSIT')
-#define ROOT_ADCCOUNTS_DATAID (((ULong_t)'ADCC')<<32 | 'OUNT')
-#define ROOT_ADCCOUNTS_UNPACKED_DATAID (((ULong_t)'ADCC')<<32 | 'NTUP')
-#define ROOT_CLUSTERS_DATAID (((ULong_t)'CLUS')<<32 | 'TERS')
-#define ROOT_SPACEPOINTS_DATAID (((ULong_t)'SPAC')<<32 | 'EPTS')
-#define ROOT_VERTEXDATA_DATAID (((ULong_t)'VRTX')<<32 | 'DATA')
-#define ROOT_TRACKSEGMENTS_DATAID (((ULong_t)'TRAC')<<32 | 'SEGS')
-#define ROOT_SLICETRACKS_DATAID (((ULong_t)'SLCT')<<32 | 'RCKS')
-#define ROOT_TRACKS_DATAID (((ULong_t)'TRAC')<<32 | 'KS ')
-#define ROOT_NODELIST_DATAID (((ULong_t)'NODE')<<32 | 'LIST')
-#define ROOT_EVENTTRIGGER_DATAID (((ULong_t)'EVTT')<<32 | 'RG ')
-
-#endif
+++ /dev/null
-// @(#) $Id$
-// Original: AliHLTTrack.cxx,v 1.32 2005/06/14 10:55:21 cvetan
-
-/**************************************************************************
- * This file is property of and copyright by the ALICE HLT Project *
- * ALICE Experiment at CERN, All rights reserved. *
- * *
- * Primary Authors: Anders Vestbo, Uli Frankenfeld, 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 AliHLTTPCTrack.cxx
- @author Anders Vestbo, Uli Frankenfeld, maintained by Matthias Richter
- @date
- @brief HLT TPC track implementation (conformal mapping) */
-
-
-#include "AliHLTTPCLogging.h"
-#include "AliHLTTPCTrack.h"
-#include "AliHLTTPCTransform.h"
-#include "AliHLTTPCVertex.h"
-#include "AliHLTTPCSpacePointData.h"
-
-#if __GNUC__ >= 3
-using namespace std;
-#endif
-
-ClassImp(AliHLTTPCTrack)
-
-
-AliHLTTPCTrack::AliHLTTPCTrack()
- :
- fNHits(0),
- fMCid(-1),
- fKappa(0),
- fRadius(0),
- fCenterX(0),
- fCenterY(0),
- fFromMainVertex(0),
- fSector(0),
- fQ(0),
-
- fTanl(0),
- fPsi(0),
- fPt(0),
- fLength(0),
-
- fPterr(0),
- fPsierr(0),
- fZ0err(0),
- fY0err(0),
- fTanlerr(0),
-
- fPhi0(0),
- fR0(0),
- fZ0(0),
-
- // fPoint({0,0,0}),
- fPointPsi(0),
-
- fIsPoint(0),
- fIsLocal(true),
- // fRowRange({0,0}),
-
- fPID(0),
- fId(-1)
-{
- //Constructor
- fRowRange[0]=0;
- fRowRange[1]=0;
- fPoint[0]=0;
- fPoint[1]=0;
- fPoint[2]=0;
-
- SetFirstPoint(0,0,0);
- SetLastPoint(0,0,0);
- memset(fHitNumbers,0,fgkHitArraySize*sizeof(UInt_t));
-}
-
-void AliHLTTPCTrack::Copy(AliHLTTPCTrack *tpt)
-{
- //setter
- SetRowRange(tpt->GetFirstRow(),tpt->GetLastRow());
- SetPhi0(tpt->GetPhi0());
- SetKappa(tpt->GetKappa());
- SetNHits(tpt->GetNHits());
- SetFirstPoint(tpt->GetFirstPointX(),tpt->GetFirstPointY(),tpt->GetFirstPointZ());
- SetLastPoint(tpt->GetLastPointX(),tpt->GetLastPointY(),tpt->GetLastPointZ());
- SetPt(tpt->GetPt());
- SetPsi(tpt->GetPsi());
- SetTgl(tpt->GetTgl());
- SetPterr(tpt->GetPterr());
- SetPsierr(tpt->GetPsierr());
- SetTglerr(tpt->GetTglerr());
- SetZ0err(tpt->GetZ0err());
- SetY0err(tpt->GetY0err());
- SetCharge(tpt->GetCharge());
- SetHits(tpt->GetNHits(),(UInt_t *)tpt->GetHitNumbers());
- SetMCid(tpt->GetMCid());
- SetPID(tpt->GetPID());
- SetSector(tpt->GetSector());
- SetId( tpt->GetId());
-}
-
-Int_t AliHLTTPCTrack::Compare(const AliHLTTPCTrack *track) const
-{
- // compare tracks
- if(track->GetNHits() < GetNHits()) return 1;
- if(track->GetNHits() > GetNHits()) return -1;
- return 0;
-}
-
-AliHLTTPCTrack::~AliHLTTPCTrack()
-{
- //Nothing to do
-}
-
-Double_t AliHLTTPCTrack::GetP() const
-{
- // Returns total momentum.
- return fabs(GetPt())*sqrt(1. + GetTgl()*GetTgl());
-}
-
-Double_t AliHLTTPCTrack::GetPseudoRapidity() const
-{ //get pseudo rap
- return 0.5 * log((GetP() + GetPz()) / (GetP() - GetPz()));
-}
-
-Double_t AliHLTTPCTrack::GetRapidity() const
-{
- //get rap
- const Double_t kmpi = 0.13957;
- return 0.5 * log((kmpi + GetPz()) / (kmpi - GetPz()));
-}
-
-void AliHLTTPCTrack::Rotate(Int_t slice,Bool_t tolocal)
-{
- //Rotate track to global parameters
- //If flag tolocal is set, the track is rotated
- //to local coordinates.
-
- Float_t psi[1] = {GetPsi()};
- if(!tolocal)
- AliHLTTPCTransform::Local2GlobalAngle(psi,slice);
- else
- AliHLTTPCTransform::Global2LocalAngle(psi,slice);
- SetPsi(psi[0]);
- Float_t first[3];
- first[0] = GetFirstPointX();
- first[1] = GetFirstPointY();
- first[2] = GetFirstPointZ();
- if(!tolocal)
- AliHLTTPCTransform::Local2Global(first,slice);
- else
- AliHLTTPCTransform::Global2LocHLT(first,slice);
- //AliHLTTPCTransform::Global2Local(first,slice,kTRUE);
-
- SetFirstPoint(first[0],first[1],first[2]);
- Float_t last[3];
- last[0] = GetLastPointX();
- last[1] = GetLastPointY();
- last[2] = GetLastPointZ();
- if(!tolocal)
- AliHLTTPCTransform::Local2Global(last,slice);
- else
- AliHLTTPCTransform::Global2LocHLT(last,slice);
- //AliHLTTPCTransform::Global2Local(last,slice,kTRUE);
- SetLastPoint(last[0],last[1],last[2]);
-
- Float_t center[3] = {GetCenterX(),GetCenterY(),0};
- if(!tolocal)
- AliHLTTPCTransform::Local2Global(center,slice);
- else
- AliHLTTPCTransform::Global2LocHLT(center,slice);
- //AliHLTTPCTransform::Global2Local(center,slice,kTRUE);
- SetCenterX(center[0]);
- SetCenterY(center[1]);
-
- SetPhi0(atan2(fFirstPoint[1],fFirstPoint[0]));
- SetR0(sqrt(fFirstPoint[0]*fFirstPoint[0]+fFirstPoint[1]*fFirstPoint[1]));
-
- if(!tolocal)
- fIsLocal=kFALSE;
- else
- fIsLocal=kTRUE;
-}
-
-void AliHLTTPCTrack::CalculateHelix()
-{
- // fit assigned clusters to helix
- // for straight line fit
- if (AliHLTTPCTransform::GetBFieldValue() == 0.0 ){
- fRadius = 999999; //just zero
-
- SetPhi0(atan2(fFirstPoint[1],fFirstPoint[0]));
- SetR0(sqrt(fFirstPoint[0]*fFirstPoint[0]+fFirstPoint[1]*fFirstPoint[1]));
- }
- // for helix fit
- else {
- //Calculate Radius, CenterX and CenterY from Psi, X0, Y0
- fRadius = fPt / (AliHLTTPCTransform::GetBFieldValue());
- if(fRadius) fKappa = -fQ*1./fRadius;
- else fRadius = 999999; //just zero
- Double_t trackPhi0 = fPsi + fQ * AliHLTTPCTransform::PiHalf();
-
- fCenterX = fFirstPoint[0] - fRadius * cos(trackPhi0);
- fCenterY = fFirstPoint[1] - fRadius * sin(trackPhi0);
-
- SetPhi0(atan2(fFirstPoint[1],fFirstPoint[0]));
- SetR0(sqrt(fFirstPoint[0]*fFirstPoint[0]+fFirstPoint[1]*fFirstPoint[1]));
- }
-}
-
-Double_t AliHLTTPCTrack::GetCrossingAngle(Int_t padrow,Int_t slice)
-{
- //Calculate the crossing angle between track and given padrow.
- //Take the dot product of the tangent vector of the track, and
- //vector perpendicular to the padrow.
- //In order to do this, we need the tangent vector to the track at the
- //point. This is done by rotating the radius vector by 90 degrees;
- //rotation matrix: ( 0 1 )
- // ( -1 0 )
-
- Float_t angle=0;//Angle perpendicular to the padrow in local coordinates
- if(slice>=0)//Global coordinates
- {
- AliHLTTPCTransform::Local2GlobalAngle(&angle,slice);
- if(!CalculateReferencePoint(angle,AliHLTTPCTransform::Row2X(padrow)))
- cerr<<"AliHLTTPCTrack::GetCrossingAngle : Track does not cross line in slice "<<slice<<" row "<<padrow<<endl;
- }
- else //should be in local coordinates
- {
- Float_t xyz[3];
- GetCrossingPoint(padrow,xyz);
- fPoint[0] = xyz[0];
- fPoint[1] = xyz[1];
- fPoint[2] = xyz[2];
- }
-
- Double_t tangent[2];
-
- tangent[0] = (fPoint[1] - GetCenterY())/GetRadius();
- tangent[1] = -1.*(fPoint[0] - GetCenterX())/GetRadius();
-
- Double_t perppadrow[2] = {cos(angle),sin(angle)};
- Double_t cosbeta = fabs(tangent[0]*perppadrow[0] + tangent[1]*perppadrow[1]);
- if(cosbeta > 1) cosbeta=1;
- return acos(cosbeta);
-}
-
-Bool_t AliHLTTPCTrack::GetCrossingPoint(Int_t padrow,Float_t *xyz)
-{
- //Assumes the track is given in local coordinates
- if(!IsLocal())
- {
- cerr<<"GetCrossingPoint: Track is given on global coordinates"<<endl;
- return false;
- }
-
- Double_t xHit = AliHLTTPCTransform::Row2X(padrow);
-
-//if (xHit < xyz[0]){
-// LOG(AliHLTTPCLog::kError,"AliHLTTPCTRACK::GetCrossingPoint","")<< "Track doesn't cross padrow "
-// << padrow <<"(x=" << xHit << "). Smallest x=" << xyz[0] << ENDLOG;
-// return false;
-//}
-
- // for straight line fit
- if (AliHLTTPCTransform::GetBFieldValue() == 0.0 ){
-
- Double_t yHit = GetFirstPointY() + (Double_t) tan( GetPsi() ) * (xHit - GetFirstPointX());
-
- Double_t s = (xHit - GetFirstPointX())*(xHit - GetFirstPointX()) + (yHit - GetFirstPointY())*(yHit - GetFirstPointY());
-
- Double_t zHit = GetFirstPointZ() + s * GetTgl();
-
- xyz[0] = xHit;
- xyz[1] = yHit;
- xyz[2] = zHit;
- }
- // for helix fit
- else {
- xyz[0] = xHit;
- Double_t aa = (xHit - GetCenterX())*(xHit - GetCenterX());
- Double_t r2 = GetRadius()*GetRadius();
- if(aa > r2)
- return false;
-
- Double_t aa2 = sqrt(r2 - aa);
- Double_t y1 = GetCenterY() + aa2;
- Double_t y2 = GetCenterY() - aa2;
- xyz[1] = y1;
- if(fabs(y2) < fabs(y1)) xyz[1] = y2;
-
- Double_t yHit = xyz[1];
- Double_t angle1 = atan2((yHit - GetCenterY()),(xHit - GetCenterX()));
- if(angle1 < 0) angle1 += 2.*AliHLTTPCTransform::Pi();
- Double_t angle2 = atan2((GetFirstPointY() - GetCenterY()),(GetFirstPointX() - GetCenterX()));
- if(angle2 < 0) angle2 += AliHLTTPCTransform::TwoPi();
-
- Double_t diffangle = angle1 - angle2;
- diffangle = fmod(diffangle,AliHLTTPCTransform::TwoPi());
- if((GetCharge()*diffangle) > 0) diffangle = diffangle - GetCharge()*AliHLTTPCTransform::TwoPi();
-
- Double_t stot = fabs(diffangle)*GetRadius();
-
- Double_t zHit = GetFirstPointZ() + stot*GetTgl();
-
- xyz[2] = zHit;
- }
-
- return true;
-}
-
-Bool_t AliHLTTPCTrack::CalculateReferencePoint(Double_t angle,Double_t radius)
-{
- // Global coordinate: crossing point with y = ax+ b;
- // a=tan(angle-AliHLTTPCTransform::PiHalf());
- //
- const Double_t krr=radius; //position of reference plane
- const Double_t kxr = cos(angle) * krr;
- const Double_t kyr = sin(angle) * krr;
-
- Double_t a = tan(angle-AliHLTTPCTransform::PiHalf());
- Double_t b = kyr - a * kxr;
-
- Double_t pp=(fCenterX+a*fCenterY-a*b)/(1+pow(a,2));
- Double_t qq=(pow(fCenterX,2)+pow(fCenterY,2)-2*fCenterY*b+pow(b,2)-pow(fRadius,2))/(1+pow(a,2));
-
- Double_t racine = pp*pp-qq;
- if(racine<0) return IsPoint(kFALSE); //no Point
-
- Double_t rootRacine = sqrt(racine);
- Double_t x0 = pp+rootRacine;
- Double_t x1 = pp-rootRacine;
- Double_t y0 = a*x0 + b;
- Double_t y1 = a*x1 + b;
-
- Double_t diff0 = sqrt(pow(x0-kxr,2)+pow(y0-kyr,2));
- Double_t diff1 = sqrt(pow(x1-kxr,2)+pow(y1-kyr,2));
-
- if(diff0<diff1){
- fPoint[0]=x0;
- fPoint[1]=y0;
- }
- else{
- fPoint[0]=x1;
- fPoint[1]=y1;
- }
-
- Double_t pointPhi0 = atan2(fPoint[1]-fCenterY,fPoint[0]-fCenterX);
- Double_t trackPhi0 = atan2(fFirstPoint[1]-fCenterY,fFirstPoint[0]-fCenterX);
- if(fabs(trackPhi0-pointPhi0)>AliHLTTPCTransform::Pi()){
- if(trackPhi0<pointPhi0) trackPhi0 += AliHLTTPCTransform::TwoPi();
- else pointPhi0 += AliHLTTPCTransform::TwoPi();
- }
- Double_t stot = -fQ * (pointPhi0-trackPhi0) * fRadius ;
- fPoint[2] = fFirstPoint[2] + stot * fTanl;
-
- fPointPsi = pointPhi0 - fQ * AliHLTTPCTransform::PiHalf();
- if(fPointPsi<0.) fPointPsi+= AliHLTTPCTransform::TwoPi();
- fPointPsi = fmod(fPointPsi, AliHLTTPCTransform::TwoPi());
-
- return IsPoint(kTRUE);
-}
-
-Bool_t AliHLTTPCTrack::CalculateEdgePoint(Double_t angle)
-{
- // Global coordinate: crossing point with y = ax; a=tan(angle);
- //
- Double_t rmin=AliHLTTPCTransform::Row2X(AliHLTTPCTransform::GetFirstRow(-1)); //min Radius of TPC
- Double_t rmax=AliHLTTPCTransform::Row2X(AliHLTTPCTransform::GetLastRow(-1)); //max Radius of TPC
-
- Double_t a = tan(angle);
- Double_t pp=(fCenterX+a*fCenterY)/(1+pow(a,2));
- Double_t qq=(pow(fCenterX,2)+pow(fCenterY,2)-pow(fRadius,2))/(1+pow(a,2));
- Double_t racine = pp*pp-qq;
- if(racine<0) return IsPoint(kFALSE); //no Point
- Double_t rootRacine = sqrt(racine);
- Double_t x0 = pp+rootRacine;
- Double_t x1 = pp-rootRacine;
- Double_t y0 = a*x0;
- Double_t y1 = a*x1;
-
- Double_t r0 = sqrt(pow(x0,2)+pow(y0,2));
- Double_t r1 = sqrt(pow(x1,2)+pow(y1,2));
- //find the right crossing point:
- //inside the TPC modules
- Bool_t ok0 = kFALSE;
- Bool_t ok1 = kFALSE;
-
- if(r0>rmin&&r0<rmax){
- Double_t da=atan2(y0,x0);
- if(da<0) da+=AliHLTTPCTransform::TwoPi();
- if(fabs(da-angle)<0.5)
- ok0 = kTRUE;
- }
- if(r1>rmin&&r1<rmax){
- Double_t da=atan2(y1,x1);
- if(da<0) da+=AliHLTTPCTransform::TwoPi();
- if(fabs(da-angle)<0.5)
- ok1 = kTRUE;
- }
- if(!(ok0||ok1)) return IsPoint(kFALSE); //no Point
-
- if(ok0&&ok1){
- Double_t diff0 = sqrt(pow(fFirstPoint[0]-x0,2)+pow(fFirstPoint[1]-y0,2));
- Double_t diff1 = sqrt(pow(fFirstPoint[0]-x1,2)+pow(fFirstPoint[1]-y1,2));
- if(diff0<diff1) ok1 = kFALSE; //use ok0
- else ok0 = kFALSE; //use ok1
- }
- if(ok0){fPoint[0]=x0; fPoint[1]=y0;}
- else {fPoint[0]=x1; fPoint[1]=y1;}
-
- Double_t pointPhi0 = atan2(fPoint[1]-fCenterY,fPoint[0]-fCenterX);
- Double_t trackPhi0 = atan2(fFirstPoint[1]-fCenterY,fFirstPoint[0]-fCenterX);
- if(fabs(trackPhi0-pointPhi0)>AliHLTTPCTransform::Pi()){
- if(trackPhi0<pointPhi0) trackPhi0 += AliHLTTPCTransform::TwoPi();
- else pointPhi0 += AliHLTTPCTransform::TwoPi();
- }
- Double_t stot = -fQ * (pointPhi0-trackPhi0) * fRadius ;
- fPoint[2] = fFirstPoint[2] + stot * fTanl;
-
- fPointPsi = pointPhi0 - fQ * AliHLTTPCTransform::PiHalf();
- if(fPointPsi<0.) fPointPsi+= AliHLTTPCTransform::TwoPi();
- fPointPsi = fmod(fPointPsi, AliHLTTPCTransform::TwoPi());
-
- return IsPoint(kTRUE);
-}
-
-Bool_t AliHLTTPCTrack::CalculatePoint(Double_t xplane)
-{
- // Local coordinate: crossing point with x plane
- //
- Double_t racine = pow(fRadius,2)-pow(xplane-fCenterX,2);
- if(racine<0) return IsPoint(kFALSE);
- Double_t rootRacine = sqrt(racine);
-
- Double_t y0 = fCenterY + rootRacine;
- Double_t y1 = fCenterY - rootRacine;
- //Double_t diff0 = sqrt(pow(fFirstPoint[0]-xplane)+pow(fFirstPoint[1]-y0));
- //Double_t diff1 = sqrt(pow(fFirstPoint[0]-xplane)+pow(fFirstPoint[1]-y1));
- Double_t diff0 = fabs(y0-fFirstPoint[1]);
- Double_t diff1 = fabs(y1-fFirstPoint[1]);
-
- fPoint[0]=xplane;
- if(diff0<diff1) fPoint[1]=y0;
- else fPoint[1]=y1;
-
- Double_t pointPhi0 = atan2(fPoint[1]-fCenterY,fPoint[0]-fCenterX);
- Double_t trackPhi0 = atan2(fFirstPoint[1]-fCenterY,fFirstPoint[0]-fCenterX);
- if(fabs(trackPhi0-pointPhi0)>AliHLTTPCTransform::Pi()){
- if(trackPhi0<pointPhi0) trackPhi0 += AliHLTTPCTransform::TwoPi();
- else pointPhi0 += AliHLTTPCTransform::TwoPi();
- }
- Double_t stot = -fQ * (pointPhi0-trackPhi0) * fRadius ;
- fPoint[2] = fFirstPoint[2] + stot * fTanl;
-
- fPointPsi = pointPhi0 - fQ * AliHLTTPCTransform::PiHalf();
- if(fPointPsi<0.) fPointPsi+= AliHLTTPCTransform::TwoPi();
- fPointPsi = fmod(fPointPsi, AliHLTTPCTransform::TwoPi());
-
- return IsPoint(kTRUE);
-}
-
-void AliHLTTPCTrack::UpdateToFirstPoint()
-{
- //Update track parameters to the innermost point on the track.
- //This means that the parameters of the track will be given in the point
- //of closest approach to the first innermost point, i.e. the point
- //lying on the track fit (and not the coordinates of the innermost point itself).
- //This function assumes that fFirstPoint is already set to the coordinates of the innermost
- //assigned cluster.
- //
- //During the helix-fit, the first point on the track is set to the coordinates
- //of the innermost assigned cluster. This may be ok, if you just want a fast
- //estimate of the "global" track parameters; such as the momentum etc.
- //However, if you later on want to do more precise local calculations, such
- //as impact parameter, residuals etc, you need to give the track parameters
- //according to the actual fit.
- // for straight line fit
- if (AliHLTTPCTransform::GetBFieldValue() == 0.0 ){
- Double_t xc = GetCenterX() - GetFirstPointX();
- Double_t yc = GetCenterY() - GetFirstPointY();
-
- Double_t xn = (Double_t) sin( GetPsi() );
- Double_t yn = -1. * (Double_t) cos( GetPsi() );
-
- Double_t d = xc*xn + yc*yn;
-
- Double_t distx = d * xn;
- Double_t disty = d * yn;
-
- Double_t point[2];
-
- point[0] = distx + GetFirstPointX();
- point[1] = disty + GetFirstPointY();
-
- //Update the track parameters
- SetR0(sqrt(point[0]*point[0]+point[1]*point[1]));
- SetPhi0(atan2(point[1],point[0]));
- SetFirstPoint(point[0],point[1],GetZ0());
- }
- // for helix fit
- else {
- Double_t xc = GetCenterX() - GetFirstPointX();
- Double_t yc = GetCenterY() - GetFirstPointY();
-
- Double_t distx1 = xc*(1 + GetRadius()/sqrt(xc*xc + yc*yc));
- Double_t disty1 = yc*(1 + GetRadius()/sqrt(xc*xc + yc*yc));
- Double_t distance1 = sqrt(distx1*distx1 + disty1*disty1);
-
- Double_t distx2 = xc*(1 - GetRadius()/sqrt(xc*xc + yc*yc));
- Double_t disty2 = yc*(1 - GetRadius()/sqrt(xc*xc + yc*yc));
- Double_t distance2 = sqrt(distx2*distx2 + disty2*disty2);
-
- //Choose the closest:
- Double_t point[2];
- if(distance1 < distance2)
- {
- point[0] = distx1 + GetFirstPointX();
- point[1] = disty1 + GetFirstPointY();
- }
- else
- {
- point[0] = distx2 + GetFirstPointX();
- point[1] = disty2 + GetFirstPointY();
- }
-
- Double_t pointpsi = atan2(point[1]-GetCenterY(),point[0]-GetCenterX());
- pointpsi -= GetCharge()*AliHLTTPCTransform::PiHalf();
- if(pointpsi < 0) pointpsi += AliHLTTPCTransform::TwoPi();
-
- //Update the track parameters
- SetR0(sqrt(point[0]*point[0]+point[1]*point[1]));
- SetPhi0(atan2(point[1],point[0]));
- SetFirstPoint(point[0],point[1],GetZ0());
- SetPsi(pointpsi);
- }
-}
-
-void AliHLTTPCTrack::GetClosestPoint(AliHLTTPCVertex *vertex,Double_t &closestX,Double_t &closestY,Double_t &closestZ)
-{
- //Calculate the point of closest approach to the vertex
- //This function calculates the minimum distance from the helix to the vertex, and choose
- //the corresponding point lying on the helix as the point of closest approach.
-
- Double_t xc = GetCenterX() - vertex->GetX();
- Double_t yc = GetCenterY() - vertex->GetY();
-
- Double_t distx1 = xc*(1 + GetRadius()/sqrt(xc*xc + yc*yc));
- Double_t disty1 = yc*(1 + GetRadius()/sqrt(xc*xc + yc*yc));
- Double_t distance1 = sqrt(distx1*distx1 + disty1*disty1);
-
- Double_t distx2 = xc*(1 - GetRadius()/sqrt(xc*xc + yc*yc));
- Double_t disty2 = yc*(1 - GetRadius()/sqrt(xc*xc + yc*yc));
- Double_t distance2 = sqrt(distx2*distx2 + disty2*disty2);
-
- //Choose the closest:
- if(distance1 < distance2)
- {
- closestX = distx1 + vertex->GetX();
- closestY = disty1 + vertex->GetY();
- }
- else
- {
- closestX = distx2 + vertex->GetX();
- closestY = disty2 + vertex->GetY();
- }
-
- //Get the z coordinate:
- Double_t angle1 = atan2((closestY-GetCenterY()),(closestX-GetCenterX()));
- if(angle1 < 0) angle1 = angle1 + AliHLTTPCTransform::TwoPi();
-
- Double_t angle2 = atan2((GetFirstPointY()-GetCenterY()),(GetFirstPointX()-GetCenterX()));
- if(angle2 < 0) angle2 = angle2 + AliHLTTPCTransform::TwoPi();
-
- Double_t diffAngle = angle1 - angle2;
- diffAngle = fmod(diffAngle,AliHLTTPCTransform::TwoPi());
-
- if((GetCharge()*diffAngle) < 0) diffAngle = diffAngle + GetCharge()*AliHLTTPCTransform::TwoPi();
- Double_t stot = fabs(diffAngle)*GetRadius();
- closestZ = GetFirstPointZ() - stot*GetTgl();
-}
-
-void AliHLTTPCTrack::Print(Option_t* /*option*/) const
-{
-//print out parameters of track
-
- LOG(AliHLTTPCLog::kInformational,"AliHLTTPCTrack::Print","Print values")
- <<"NH="<<fNHits<<" "<<fMCid<<" K="<<fKappa<<" R="<<fRadius<<" Cx="<<fCenterX<<" Cy="<<fCenterY<<" MVT="
- <<fFromMainVertex<<" Row0="<<fRowRange[0]<<" Row1="<<fRowRange[1]<<" Sector="<<fSector<<" Q="<<fQ<<" TgLam="
- <<fTanl<<" psi="<<fPsi<<" pt="<<fPt<<" L="<<fLength<<" "<<fPterr<<" "<<fPsierr<<" "<<fZ0err<<" "
- <<fTanlerr<<" phi0="<<fPhi0<<" R0="<<fR0<<" Z0="<<fZ0<<" X0="<<fFirstPoint[0]<<" Y0="<<fFirstPoint[1]<<" Z0="
- <<fFirstPoint[2]<<" XL="<<fLastPoint[0]<<" YL="<<fLastPoint[1]<<" ZL="<<fLastPoint[2]<<" "
- <<fPoint[0]<<" "<<fPoint[1]<<" "<<fPoint[2]<<" "<<fPointPsi<<" "<<fIsPoint<<" local="
- <<fIsLocal<<" "<<fPID<<ENDLOG;
-
-}
-
-int AliHLTTPCTrack::Convert2AliKalmanTrack()
-{
- // The method has been copied from AliHLTHoughKalmanTrack and adapted
- // to the TPC conformal mapping track parametrization
- int iResult=0;
-
- // sector A00 starts at 3 o'clock, sectors are counted counterclockwise
- // median of sector 00 is at 10 degrees, median of sector A04 at 90
- //
-
- Double_t charge=(double) GetCharge();
- Double_t param[5];
- param[1] = GetFirstPointZ();
- param[3] = GetTgl();
- param[4] = charge*(1.0/GetPt());
-
- Double_t alpha, phi, xl, yl;
-
- // rotate to local coordinates if necessary
-
- if(GetSector() == -1){ // track in global coordinates
-
- alpha = TMath::ATan2(GetFirstPointY(),GetFirstPointX());
- double sinAlpha = TMath::Sin(alpha);
- double cosAlpha = TMath::Cos(alpha);
-
- phi = GetPsi() - alpha;
- xl = GetFirstPointX()*cosAlpha + GetFirstPointY()*sinAlpha;
- yl = -GetFirstPointX()*sinAlpha + GetFirstPointY()*cosAlpha;
-
- } else{ // track in local coordinates
-
- alpha = (GetSector()+0.5)*(TMath::TwoPi()/18);
- phi = GetPsi();
- xl = GetFirstPointX();
- yl = GetFirstPointY();
-
- // normalize alpha to [-Pi,+Pi]
-
- alpha = alpha - TMath::TwoPi() * TMath::Floor( alpha /TMath::TwoPi()+.5);
- }
-
- // extra rotation to keep phi in the range (-Pi/2,+Pi/2)
- {
- const Double_t kMaxPhi = TMath::PiOver2() - 10./180.*TMath::Pi();
-
- // normalize phi to [-Pi,+Pi]
-
- phi = phi - TMath::TwoPi() * TMath::Floor( phi /TMath::TwoPi()+.5);
-
- if( phi >= kMaxPhi )
- {
- alpha += TMath::PiOver2();
- phi -= TMath::PiOver2();
- Double_t xtmp = xl;
- xl = yl;
- yl = -xtmp;
- }
- else if( phi <= -kMaxPhi )
- {
- alpha += -TMath::PiOver2();
- phi -= -TMath::PiOver2();
- Double_t xtmp = xl;
- xl = -yl;
- yl = xtmp;
- }
- }
-
- param[0] = yl;
- param[2] = TMath::Sin(phi);
-
- //covariance matrix
- Double_t cov[15]={
- GetY0err(), //Error in Y (Y and X are the same)
- 0., GetZ0err(), //Error in Z
- 0., 0., GetPsierr(), //Error for Psi
- 0., 0., 0., GetTglerr(), //Error for Tgl
- 0., 0., 0., 0., GetPterr() //Error for Pt
- };
-
- Int_t nCluster = GetNHits();
- fdEdx=0;
-
- // the Set function was not available in earlier versions, check done
- // during configure; for the AliRoot build, by default ON
-#ifdef EXTERNALTRACKPARAM_V1
-#warning track conversion to ESD format needs AliRoot version > v4-05-04
- //TODO (Feb 07): make this a real warning when logging system is adapted
- //HLTWarning("track conversion to ESD format needs AliRoot version > v4-05-04");
-#else
- Set(xl,alpha,param,cov);
- SetNumberOfClusters(nCluster);
- SetChi2(0.);
- SetFakeRatio(0.);
- SetMass(0.13957);
-#endif
-
- return iResult;
-}
-
-void AliHLTTPCTrack::SetHits(Int_t nhits,UInt_t *hits)
-{
- // set hit array
- if (!hits) return;
- if (nhits>fgkHitArraySize) {
- LOG(AliHLTTPCLog::kWarning,"AliHLTTPCTrack::SetHits","too many hits")
- << "too many hits (" << nhits << ") for hit array of size " << fgkHitArraySize << ENDLOG;
- SetNHits(fgkHitArraySize);
- } else {
- SetNHits(nhits);
- }
- memcpy(fHitNumbers,hits,fNHits*sizeof(UInt_t));
-}
-
-Double_t AliHLTTPCTrack::GetLengthXY() const
-{
- //calculates the length of the arc in XY-plane. This is the length of the track in XY-plane.
- //Using a^2 = b^2 + c^2 - 2bc * cosA for finding the angle between first and last point.
- //Length of arc is arc = r*A. Where A is the angle between first and last point.
-
- Double_t dx = GetLastPointX()-GetFirstPointX();
- Double_t dy = GetLastPointY()-GetFirstPointY();
- Double_t a = TMath::Sqrt((dx*dx)+(dy*dy));
- Double_t r = GetRadius();
- Double_t r2 = r*r;
-
- Double_t A = TMath::ACos((r2+r2-(a*a))/(2*r2));
-
- return r*A;
-}
-
-Double_t AliHLTTPCTrack::GetLengthTot() const
-{
- //Calculates the length of the track in 3D
-
-
-
-
-
- return 100.0;
-
-}
-
-int AliHLTTPCTrack::CheckConsistency()
-{
- // Check consistency of all members
- int iResult=0;
- if (CheckDoubleMember(&fPterr, 0., "fPterr")<0) iResult=-EDOM;
- if (CheckDoubleMember(&fPsierr, 0., "fPsierr")<0) iResult=-EDOM;
- if (CheckDoubleMember(&fZ0err, 0., "fZ0err")<0) iResult=-EDOM;
- if (CheckDoubleMember(&fY0err, 0., "fY0err")<0) iResult=-EDOM;
- if (CheckDoubleMember(&fTanlerr, 0., "fTanlerr")<0) iResult=-EDOM;
- return iResult;
-}
-
-int AliHLTTPCTrack::CheckDoubleMember(double* pMember, double def, const char* name) const
-{
- // Check consistency of a Double member
- if (!pMember) return -EINVAL;
- if (TMath::Abs(*pMember)>kVeryBig) {
- LOG(AliHLTTPCLog::kWarning,"AliHLTTPCTrack","member consistency")
- << "invalid Double number %f" << *pMember << " in member " << name << ENDLOG;
- *pMember=def;
- return -EDOM;
- }
- return 0;
-}
+++ /dev/null
-// XEmacs -*-C++-*-
-// $Id$
-// Original: AliHLTTrack.h,v 1.18 2005/03/31 04:48:58 cvetan
-
-#ifndef ALIHLTTPCTRACK_H
-#define ALIHLTTPCTRACK_H
-
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* See cxx source for full Copyright notice *
-
-/// @file AliHLTTPCTrack.h
-/// @author Anders Vestbo, Uli Frankenfeld, maintained by Matthias Richter
-/// @date
-/// @brief HLT TPC track base class (conformal mapping)
-///
-
-#include "AliTPCtrack.h"
-
-class AliHLTTPCVertex;
-struct AliHLTTPCSpacePointData;
-
-/**
- * @class AliHLTTPCTrack
- * This class implements the representation of a TPC track, used by the
- * HLT conformal mapping track finder. <br>
- * It was originally separated from the offline TPC track class, but in
- * order to adjust the output format to the offline ESD, AliHLTTPCTrack
- * now inherits from AliHLTtrack.
- *
- * @ingroup alihlt_tpc
- */
-class AliHLTTPCTrack : public AliTPCtrack {
-
- public:
-
- AliHLTTPCTrack();
- virtual ~AliHLTTPCTrack();
-
- /**
- * Copy track parameters.
- * @param track pointer to source track
- */
- virtual void Copy(AliHLTTPCTrack* track);
- using AliTPCtrack::Copy; //TODO: Check if "virtual void Copy(TObject*)" does what it is supposed to do.
-
- /**
- * Compare two tracks by the number of hits
- * @return 0 if equal number of hits,
- * 1 if this > track
- * -1 if this < track
- */
- virtual Int_t Compare(const AliHLTTPCTrack *track) const;
- using AliTPCtrack::Compare; //TODO: Check if "virtual Int_t Compare(TObject*)" does what it is supposed to do.
-
- /**
- * Fit the assigned spacepoints to a helix.
- * The function sets teh track parameters.
- */
- virtual void CalculateHelix();
-
- Bool_t CalculateReferencePoint(Double_t angle,Double_t radius=132);//Calculate Reference Point
- Bool_t CalculateEdgePoint(Double_t angle);//Calculate crossing point with line
- Bool_t CalculatePoint(Double_t xplane); //Calculate crossing point with X-plane
- Bool_t IsPoint() {return fIsPoint;}
- Double_t GetCrossingAngle(Int_t padrow,Int_t slice=-1);
- Bool_t GetCrossingPoint(Int_t padrow,Float_t *xyz);
- Double_t GetDistance(Double_t /*x0*/,Double_t /*x1*/){return 0;}
- void UpdateToFirstPoint();
- void GetClosestPoint(AliHLTTPCVertex *vertex,Double_t &closestX,Double_t &closestY,Double_t &closestZ);
- void Rotate(Int_t slice,Bool_t tolocal=kFALSE);
- Bool_t IsLocal() const {return fIsLocal;}
- virtual void Print(Option_t* option = "") const;
- using AliTPCtrack::Print;
-
- // getter
- Double_t GetFirstPointX() const {return fFirstPoint[0];}
- Double_t GetFirstPointY() const {return fFirstPoint[1];}
- Double_t GetFirstPointZ() const {return fFirstPoint[2];}
- Double_t GetLastPointX() const {return fLastPoint[0];}
- Double_t GetLastPointY() const {return fLastPoint[1];}
- Double_t GetLastPointZ() const {return fLastPoint[2];}
-
- Double_t GetPointPsi() const {return fPointPsi;}
- Double_t GetPointX() const {return fPoint[0];}
- Double_t GetPointY() const {return fPoint[1];}
- Double_t GetPointZ() const {return fPoint[2];}
-
- Double_t GetPt() const {return fPt;}
- Double_t GetTgl() const {return fTanl;}
- Double_t GetPsi() const {return fPsi;}
- Double_t GetPhi0() const {return fPhi0;}
- Double_t GetR0() const {return fR0;}
- Double_t GetZ0() const {return fFirstPoint[2];}
- Float_t GetPID() const {return fPID;}
-
- Double_t GetPterr() const {return fPterr;}
- Double_t GetPsierr() const {return fPsierr;}
- Double_t GetTglerr() const {return fTanlerr;}
- Double_t GetZ0err() const {return fZ0err;}
- Double_t GetY0err() const {return fY0err;}
-
- Double_t GetKappa() const {return fKappa;}
- Double_t GetRadius() const {return fRadius;}
- Double_t GetCenterX() const {return fCenterX;}
- Double_t GetCenterY() const {return fCenterY;}
-
- Int_t GetNHits() const {return fNHits;}
- Int_t GetNumberOfPoints() const {return fNHits;}
- Bool_t ComesFromMainVertex() const {return fFromMainVertex;}
-
- Double_t GetPx() const {return fPt*cos(fPsi);}
- Double_t GetPy() const {return fPt*sin(fPsi);}
- Double_t GetPz() const {return fPt*fTanl;}
-
- Double_t GetP() const;
- Double_t GetPseudoRapidity() const;
- Double_t GetRapidity() const;
-
- Int_t GetCharge() const {return fQ;}
- Int_t GetMCid() const {return fMCid;}
- Double_t GetLength() const {return fLength;}
- Double_t GetLengthXY() const ;
- Double_t GetLengthTot() const;
-
- Int_t GetFirstRow() const {return fRowRange[0];}
- Int_t GetLastRow() const {return fRowRange[1];}
- Int_t GetSector() const {return fSector;}
-
- UInt_t *GetHitNumbers() {return fHitNumbers;}
- Int_t GetId(){ return fId; }
-
- // setter
- void SetPID(Float_t pid) {fPID=pid;}
- void SetMCid(Int_t f) {fMCid = f;}
- void SetFirstPoint(Double_t f,Double_t g,Double_t h) {fFirstPoint[0]=f; fFirstPoint[1]=g; fFirstPoint[2]=h;}
- void SetLastPoint(Double_t f,Double_t g,Double_t h) {fLastPoint[0]=f; fLastPoint[1]=g; fLastPoint[2]=h;}
- void SetHits(Int_t nhits,UInt_t *hits);
- void SetPhi0(Double_t f) {fPhi0 = f;}
- void SetPsi(Double_t f) {fPsi = f;}
- void SetR0(Double_t f) {fR0 = f;}
- void SetTgl(Double_t f) {fTanl =f;}
- void SetZ0(Double_t f) {fFirstPoint[2] = f;}
- void SetPt(Double_t f) {fPt = f;}
- void SetLength(Double_t f) {fLength = f;}
- void SetPterr(Double_t f) {fPterr = f;}
- void SetPsierr(Double_t f) {fPsierr = f;}
- void SetZ0err(Double_t f) {fZ0err = f;}
- void SetY0err(Double_t f) {fY0err = f;}
- void SetTglerr(Double_t f) {fTanlerr = f;}
- void SetKappa(Double_t f) {fKappa = f;}
- void SetNHits(Int_t f) {fNHits = f;}
- void SetRowRange(Int_t f,Int_t g) {fRowRange[0]=f; fRowRange[1]=g;}
- void SetSector(Int_t f) {fSector = f;}
- void SetRadius(Double_t f) {fRadius = f;}
- void SetCenterX(Double_t f) {fCenterX = f;}
- void SetCenterY(Double_t f) {fCenterY = f;}
- void SetCharge(Int_t f) {fQ = f;}
- void SetId( Int_t f ) { fId = f; }
-
- void ComesFromMainVertex(Bool_t f) {fFromMainVertex = f;}
-
- /**
- * Convert all track parameters to the format of AliKalmanTrack
- * The AliKalmanTrack class implements the track parametrization for offline ITS, TPC
- * and TRD tracking. The function calculates and sets the parameters of the
- * parent class (Note: AliHLTTPCTrack inherits from AliTPCtrack and thus
- * AliKalmanTrack).
- */
- int Convert2AliKalmanTrack();
-
- /**
- * Check the structure members to be within reasonable limits.
- */
- int CheckConsistency();
-
- /**
- * Check consistency of a double member
- */
- int CheckDoubleMember(double* pMember, double def, const char* name) const;
-
- private:
-
- Int_t fNHits; //Number of hits
- Int_t fMCid; //Assigned id from MC data.
-
- Double_t fKappa; // Signed curvature (projected to a circle)
- Double_t fRadius; // Radius of the helix (projected to a circle)
- Double_t fCenterX; // x coordinate of the center of the helix (projected to a circle)
- Double_t fCenterY; // y coordinate of the center of the helix (projected to a circle)
- Bool_t fFromMainVertex; // true if tracks origin is the main vertex, otherwise false
-
- Int_t fRowRange[2]; //Subsector where this track was build
- Int_t fSector; //Sector # where this track was build
-
- //data from momentum fit
- Int_t fQ; //charge measured fit
-
- //track parameters:
- Double_t fTanl; //tan of dipangle
- Double_t fPsi; //azimuthal angle of the momentum
- Double_t fPt; //transverse momentum
- Double_t fLength; //length of track (s)
-
- Double_t fPterr; //error in pt
- Double_t fPsierr; //error in psi
- Double_t fZ0err; //error in first point
- Double_t fY0err; //error in first point
- Double_t fTanlerr; //error in tanl
-
- Double_t fPhi0; //azimuthal angle of the first point
- Double_t fR0; //radius of the first point
- Double_t fZ0; //z coordinate of the first point (fFirstPoint[2])
-
- Double_t fFirstPoint[3]; //first point
- Double_t fLastPoint[3]; //last point
- Double_t fPoint[3]; //point
- Double_t fPointPsi; //azimuthal angle of the momentum at Point
-
- Bool_t fIsPoint; //Helix crosses the X-plane
- Bool_t fIsLocal; //Track given in local coordinates.
-
- Float_t fPID; //pid
- static const int fgkHitArraySize=159; // size of hit array
- UInt_t fHitNumbers[fgkHitArraySize]; //Array of hit numbers for this track
- Int_t fId; // unique ID of the track
-
- Bool_t IsPoint(Bool_t ispoint) {fIsPoint = ispoint;return fIsPoint;}
-
- ClassDef(AliHLTTPCTrack,3) //Base track class
-};
-#endif
+++ /dev/null
-// @(#) $Id$
-// Original: AliHLTTrackArray.cxx,v 1.21 2005/06/14 10:55:21 cvetan
-
-/**************************************************************************
- * This file is property of and copyright by the ALICE HLT Project *
- * ALICE Experiment at CERN, All rights reserved. *
- * *
- * Primary Authors: Uli Frankenfeld, 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 AliHLTTPCTrackArray.cxx
- @author Uli Frankenfeld, maintained by Matthias Richter
- @date
- @brief Array of AliHLTTPCTracks */
-
-#include "AliLog.h"
-#include "TClass.h"
-#include "AliHLTTPCLogging.h"
-#include "AliHLTTPCTrackArray.h"
-// Matthias 17.10.2007 the hough code has been disabled for the moment
-//#define INCLUDE_TPC_HOUGH
-#ifdef INCLUDE_TPC_HOUGH
-#include "AliHLTTPCHoughTrack.h"
-#endif
-#include "AliHLTTPCModelTrack.h"
-#include "AliHLTTPCConfMapTrack.h"
-#include "AliHLTTPCTrackSegmentData.h"
-#include "AliHLTTPCTransform.h"
-#include "AliHLTTPCConfMapPoint.h"
-#include "AliHLTExternalTrackParam.h"
-
-#if __GNUC__ >= 3
-using namespace std;
-#endif
-
-ClassImp(AliHLTTPCTrackArray)
-
-AliHLTTPCTrackArray::AliHLTTPCTrackArray()
- :
- fTrackType('t'),
- fSize(0),
- fIsPresent(NULL),
- fNAbsent(0),
- fTrack(NULL),
- fNTracks(0)
-{
- //Default constructor
- SetSize();
-}
-
-
-AliHLTTPCTrackArray::AliHLTTPCTrackArray(Int_t ntrack)
- :
- fTrackType('t'),
- fSize(0),
- fIsPresent(NULL),
- fNAbsent(0),
- fTrack(NULL),
- fNTracks(0)
-{
- //Constructor.
- SetSize(ntrack);
-}
-
-AliHLTTPCTrackArray::AliHLTTPCTrackArray(const char* tracktype,Int_t ntrack)
- :
- fTrackType('t'),
- fSize(0),
- fIsPresent(NULL),
- fNAbsent(0),
- fTrack(NULL),
- fNTracks(0)
-{
- //Constructor.
- if(strcmp(tracktype,"AliHLTTPCTrack")==0) fTrackType='t';
- if(strcmp(tracktype,"AliHLTTPCConfMapTrack")==0) fTrackType='c';
-#ifdef INCLUDE_TPC_HOUGH
- if(strcmp(tracktype,"AliHLTTPCHoughTrack")==0) fTrackType='h';
-#endif
- if(strcmp(tracktype,"AliHLTTPCModelTrack")==0) fTrackType='m';
- SetSize(ntrack);
-}
-
-AliHLTTPCTrackArray::AliHLTTPCTrackArray(const char* tracktype)
- :
- fTrackType('t'),
- fSize(0),
- fIsPresent(NULL),
- fNAbsent(0),
- fTrack(NULL),
- fNTracks(0)
-{
- //Constructor.
- if(strcmp(tracktype,"AliHLTTPCTrack")==0) fTrackType='t';
- if(strcmp(tracktype,"AliHLTTPCConfMapTrack")==0) fTrackType='c';
-#ifdef INCLUDE_TPC_HOUGH
- if(strcmp(tracktype,"AliHLTTPCHoughTrack")==0) fTrackType='h';
-#endif
- if(strcmp(tracktype,"AliHLTTPCModelTrack")==0) fTrackType='m';
- SetSize();
-}
-
-AliHLTTPCTrackArray::~AliHLTTPCTrackArray()
-{
- //Destructor
- DeleteArray();
-}
-
-
-AliHLTTPCTrack *AliHLTTPCTrackArray::NextTrack()
-{
- //next track in array
- if(fNTracks<fSize) return fTrack[fNTracks++];
- SetSize(fSize+100);
- return fTrack[fNTracks++];
-}
-
-void AliHLTTPCTrackArray::DeleteArray()
-{
- //delete array
- for(Int_t i=0; i<fSize;i++)
- delete fTrack[i];
- delete[] fIsPresent;
- delete[] fTrack;
- fSize=0;
-}
-
-Bool_t AliHLTTPCTrackArray::SetSize(Int_t newsize)
-{
- //set size
- if(newsize<=fSize) return kFALSE; //shrink comes later!!
- if(!fSize){
- fSize = newsize;
- fTrack = new AliHLTTPCTrack*[fSize];
- fIsPresent = new Bool_t[fSize];
- switch(fTrackType){
- case 't':
- for(Int_t i=0;i<fSize;i++){
- fTrack[i] = new AliHLTTPCTrack();
- fIsPresent[i] = kTRUE;
- }
- break;
- case 'c':
- for(Int_t i=0;i<fSize;i++){
- fTrack[i] = new AliHLTTPCConfMapTrack();
- fIsPresent[i] = kTRUE;
- }
- break;
-#ifdef INCLUDE_TPC_HOUGH
- case 'h':
- for(Int_t i=0;i<fSize;i++){
- fTrack[i] = new AliHLTTPCHoughTrack();
- fIsPresent[i] = kTRUE;
- }
- break;
-#endif
- case 'm':
- for(Int_t i=0;i<fSize;i++){
- fTrack[i] = new AliHLTTPCModelTrack();
- fIsPresent[i] = kTRUE;
- }
- break;
- default:
- return kFALSE;
- }
- return kTRUE;
- }
- AliHLTTPCTrack **tmp = new AliHLTTPCTrack*[fSize];
- Bool_t *pre = new Bool_t[fSize];
- for(Int_t i=0; i<fSize;i++){
- tmp[i] = fTrack[i];
- pre[i] = fIsPresent[i];
- }
- delete[] fTrack;
- delete[] fIsPresent;
- fTrack = new AliHLTTPCTrack*[newsize];
- fIsPresent = new Bool_t[newsize];
- for(Int_t i=0; i<fSize;i++){
- fTrack[i] = tmp[i];
- fIsPresent[i] = pre[i];
- }
- delete[] tmp;
- delete[] pre;
- switch(fTrackType){
- case 't':
- for(Int_t i=fSize;i<newsize;i++){
- fTrack[i] = new AliHLTTPCTrack();
- fIsPresent[i] = kTRUE;
- }
- break;
- case 'c':
- for(Int_t i=fSize;i<newsize;i++){
- fTrack[i] = new AliHLTTPCConfMapTrack();
- fIsPresent[i] = kTRUE;
- }
- break;
-#ifdef INCLUDE_TPC_HOUGH
- case 'h':
- for(Int_t i=fSize;i<newsize;i++){
- fTrack[i] = new AliHLTTPCHoughTrack();
- fIsPresent[i] = kTRUE;
- }
- break;
-#endif
- case 'm':
- for(Int_t i=fSize;i<newsize;i++){
- fTrack[i] = new AliHLTTPCModelTrack();
- fIsPresent[i] = kTRUE;
- }
- break;
- default:
- return kFALSE;
- }
- fSize = newsize;
- return kTRUE;
-}
-
-void AliHLTTPCTrackArray::Reset()
-{
- //reset
- fNTracks=0;
- fNAbsent=0;
- for(Int_t i=0; i<fSize;i++)
- fIsPresent[i] = kTRUE;
-}
-
-void AliHLTTPCTrackArray::Remove(Int_t track)
-{
- //remove track
- if(fIsPresent[track]){
- fIsPresent[track]=kFALSE;
- fNAbsent++;
- }
-}
-
-int AliHLTTPCTrackArray::FillTracks(Int_t ntracks, AliHLTTPCTrackSegmentData* tr, Int_t slice, Int_t bTransform)
-{
- //Read tracks from shared memory (or memory)
- return FillTracksChecked(tr, ntracks, 0, slice, bTransform);
-}
-
-int AliHLTTPCTrackArray::FillTracksChecked(AliHLTExternalTrackParam* tr, Int_t ntracks, unsigned int sizeInByte, Int_t slice, Int_t bTransform)
-{
- int iResult=0;
- AliHLTExternalTrackParam *trs = tr;
-
- for(Int_t i=0; i<ntracks; i++){
- if (sizeInByte>0 &&
- (((AliHLTUInt8_t*)trs)+sizeof(AliHLTExternalTrackParam)>((AliHLTUInt8_t*)tr)+sizeInByte ||
- ((AliHLTUInt8_t*)trs)+sizeof(AliHLTExternalTrackParam)+trs->fNPoints*sizeof(UInt_t)>((AliHLTUInt8_t*)tr)+sizeInByte)) {
- iResult=-EDOM;
- break;
- }
- AliHLTTPCTrack *track = NextTrack();
- track->SetId( i );
- track->SetPt(trs->fq1Pt);
- track->SetPterr(trs->fC[14]);
- Float_t psi[1];
- psi[0]=trs->fSinPsi;
- if (slice>=0 && bTransform!=0) {
- AliHLTTPCTransform::Local2GlobalAngle(psi,slice);
- }
- //cout << "psi " << psi[0] << endl;
- track->SetPsi(psi[0]);
- track->SetTgl(trs->fTgl);
- track->SetPsierr(trs->fC[5]);
- track->SetTglerr(trs->fC[9]);
- track->SetY0err(trs->fC[0]);
- track->SetZ0err(trs->fC[2]);
- track->SetNHits(trs->fNPoints);
- //track->SetCharge(trs->fCharge);
- Float_t first[3];
- first[0]=trs->fX;first[1]=trs->fY;first[2]=trs->fZ;
- if (slice>=0 && bTransform!=0) {
- AliHLTTPCTransform::Local2Global(first,slice);
- }
- //cout << "first point: " << first[0] << " " << first[1] << " " << first[3] << endl;
- track->SetFirstPoint(first[0],first[1],first[2]);
- Float_t last[3];
- last[0]=trs->fLastX;last[1]=trs->fLastY;last[2]=trs->fLastZ;
- if (slice>=0 && bTransform!=0) {
- AliHLTTPCTransform::Local2Global(last,slice);
- }
- //cout << "last point: " << last[0] << " " << last[1] << " " << last[3] << endl;
- track->SetLastPoint(last[0],last[1],last[2]);
- track->SetHits( trs->fNPoints, trs->fPointIDs );
-
- //if (slice>=0 && bTransform!=0) {
- // Matthias Feb07: as everything is now in global coordinates, sector should
- // be set to 0. But as the display does a check on the sector, we have to set
- // it to the slice no. I suspect, that the transformation is done twice.
- //track->SetSector(0);
-
- track->SetSector(slice);
-
- //} else {
- // the parameters are in local coordinates, set the sector no
- //#ifndef INCLUDE_TPC_HOUGH
- //if (slice<0) track->SetSector(0);
- //else track->SetSector(slice);
- //#else
- // Matthias Feb 2007: this is some kind of legacy ...
- // the INCLUDE_TPC_HOUGH has never been switched on in the new TPCLib
- // and this line was below in the corresponding block. As the slice
- // parameter is very useful but not available if the define is off
- // we distinguish the two cases here. Should be cleaned up.
- // Matthias April 2007: update, try to integrate Cvetans Hough tracker
- // so we need the support for the AliHLTTPCHoughTrack. I dont have the
- // full control of this code (should we use slice or trs->fSector?)
- // But the FillTracks method is never called from the hough code, so we
- // take 'slice'
- if (GetTrackType()=='h') {
- AliErrorClassStream() << "FillTracks was never used with AliHLTTPCHoughTrack:"
- << " CHECK THIS CODE!!!" << endl;
- }
- //track->SetSector(trs->fSector);
- //#endif // INCLUDE_TPC_HOUGH
- //}
-
- // this is currently a quick hack for straight lines of the first version
- // of the CA tracker.
- // we have to think about a more general way of treating straight and curved
- // tracks
- if ( trs->fq1Pt == -9876.0 || trs->fq1Pt == -1.0) {
- track->SetPhi0(atan2(first[1],first[0]));
- track->SetKappa(1.0);
- track->SetRadius(999999.0);
- } else {
- // Matthias Feb07: just tried to take this away, but this causes the tracks
- // in the display not to be drawn. But we still have to tink about this.
- track->CalculateHelix();
- }
-
-#ifdef INCLUDE_TPC_HOUGH
-#ifdef ROWHOUGHPARAMS
- if(GetTrackType()=='h') {
- ((AliHLTTPCHoughTrack *)track)->SetWeight(trs->fWeight);
- ((AliHLTTPCHoughTrack *)track)->SetBinXY(trs->fBinX,trs->fBinY,trs->fBinXSize,trs->fBinYSize);
- }
- track->SetMCid(trs->fTrackID);
- track->SetRowRange(trs->fRowRange1,trs->fRowRange2);
- track->SetPID(trs->fPID);
-#endif
-#endif // INCLUDE_TPC_HOUGH
- track->CheckConsistency();
-
- UChar_t *tmpP = (UChar_t*)trs;
- tmpP += sizeof(AliHLTExternalTrackParam)+trs->fNPoints*sizeof(UInt_t);
- trs = (AliHLTExternalTrackParam*)tmpP;
- }
- return iResult;
-}
-
-int AliHLTTPCTrackArray::FillTracksChecked(AliHLTTPCTrackSegmentData* tr, Int_t ntracks, unsigned int sizeInByte, Int_t slice, Int_t bTransform)
-{
- //Read tracks from shared memory (or memory)
- int iResult=0;
- AliHLTTPCTrackSegmentData *trs = tr;
- for(Int_t i=0; i<ntracks; i++){
- if (sizeInByte>0 &&
- (((AliHLTUInt8_t*)trs)+sizeof(AliHLTTPCTrackSegmentData)>((AliHLTUInt8_t*)tr)+sizeInByte ||
- ((AliHLTUInt8_t*)trs)+sizeof(AliHLTTPCTrackSegmentData)+trs->fNPoints*sizeof(UInt_t)>((AliHLTUInt8_t*)tr)+sizeInByte)) {
- iResult=-EDOM;
- break;
- }
- AliHLTTPCTrack *track = NextTrack();
- track->SetId( i );
- track->SetPt(trs->fPt);
- track->SetPterr(trs->fPterr);
- Float_t psi[1];
- psi[0]=trs->fPsi;
- if (slice>=0 && bTransform!=0) {
- AliHLTTPCTransform::Local2GlobalAngle(psi,slice);
- }
- //cout << "psi " << psi[0] << endl;
- track->SetPsi(psi[0]);
- track->SetTgl(trs->fTgl);
- track->SetPsierr(trs->fPsierr);
- track->SetTglerr(trs->fTglerr);
- track->SetY0err(trs->fY0err);
- track->SetZ0err(trs->fZ0err);
- track->SetNHits(trs->fNPoints);
- track->SetCharge(trs->fCharge);
- Float_t first[3];
- first[0]=trs->fX;first[1]=trs->fY;first[2]=trs->fZ;
- if (slice>=0 && bTransform!=0) {
- AliHLTTPCTransform::Local2Global(first,slice);
- }
- //cout << "first point: " << first[0] << " " << first[1] << " " << first[3] << endl;
- track->SetFirstPoint(first[0],first[1],first[2]);
- Float_t last[3];
- last[0]=trs->fLastX;last[1]=trs->fLastY;last[2]=trs->fLastZ;
- if (slice>=0 && bTransform!=0) {
- AliHLTTPCTransform::Local2Global(last,slice);
- }
- //cout << "last point: " << last[0] << " " << last[1] << " " << last[3] << endl;
- track->SetLastPoint(last[0],last[1],last[2]);
- track->SetHits( trs->fNPoints, trs->fPointIDs );
-
- //if (slice>=0 && bTransform!=0) {
- // Matthias Feb07: as everything is now in global coordinates, sector should
- // be set to 0. But as the display does a check on the sector, we have to set
- // it to the slice no. I suspect, that the transformation is done twice.
- //track->SetSector(0);
- track->SetSector(slice);
- //} else {
- // the parameters are in local coordinates, set the sector no
- //#ifndef INCLUDE_TPC_HOUGH
- //if (slice<0) track->SetSector(0);
- //else track->SetSector(slice);
- //#else
- // Matthias Feb 2007: this is some kind of legacy ...
- // the INCLUDE_TPC_HOUGH has never been switched on in the new TPCLib
- // and this line was below in the corresponding block. As the slice
- // parameter is very useful but not available if the define is off
- // we distinguish the two cases here. Should be cleaned up.
- // Matthias April 2007: update, try to integrate Cvetans Hough tracker
- // so we need the support for the AliHLTTPCHoughTrack. I dont have the
- // full control of this code (should we use slice or trs->fSector?)
- // But the FillTracks method is never called from the hough code, so we
- // take 'slice'
- if (GetTrackType()=='h') {
- AliErrorClassStream() << "FillTracks was never used with AliHLTTPCHoughTrack:"
- << " CHECK THIS CODE!!!" << endl;
- }
- //track->SetSector(trs->fSector);
- //#endif // INCLUDE_TPC_HOUGH
- //}
-
- // this is currently a quick hack for straight lines of the first version
- // of the CA tracker.
- // we have to think about a more general way of treating straight and curved
- // tracks
- if ( trs->fPt == -9876.0 || trs->fPt == -1.0) {
- track->SetPhi0(atan2(first[1],first[0]));
- track->SetKappa(1.0);
- track->SetRadius(999999.0);
- } else {
- // Matthias Feb07: just tried to take this away, but this causes the tracks
- // in the display not to be drawn. But we still have to tink about this.
- track->CalculateHelix();
- }
-
-#ifdef INCLUDE_TPC_HOUGH
-#ifdef ROWHOUGHPARAMS
- if(GetTrackType()=='h') {
- ((AliHLTTPCHoughTrack *)track)->SetWeight(trs->fWeight);
- ((AliHLTTPCHoughTrack *)track)->SetBinXY(trs->fBinX,trs->fBinY,trs->fBinXSize,trs->fBinYSize);
- }
- track->SetMCid(trs->fTrackID);
- track->SetRowRange(trs->fRowRange1,trs->fRowRange2);
- track->SetPID(trs->fPID);
-#endif
-#endif // INCLUDE_TPC_HOUGH
- track->CheckConsistency();
-
- UChar_t *tmpP = (UChar_t*)trs;
- tmpP += sizeof(AliHLTTPCTrackSegmentData)+trs->fNPoints*sizeof(UInt_t);
- trs = (AliHLTTPCTrackSegmentData*)tmpP;
- }
-
- if (iResult==-EDOM) {
- // try to recover the version 1 struct
- Reset();
- if ((iResult=FillTracksVersion1((AliHLTTPCTrackSegmentDataV1*)tr, ntracks, sizeInByte, slice, bTransform))>=0) {
- LOG(AliHLTTPCLog::kWarning,"AliHLTTPCTrackArray::FillTracks","") << "version 1 track array recoverd (deprecated since r27415)" << ENDLOG;
- }
- }
- if (iResult==-EDOM) {
- Reset();
- LOG(AliHLTTPCLog::kError,"AliHLTTPCTrackArray::FillTracks","") << "corrupted input data array" << ENDLOG;
- }
-
- return iResult;
-}
-
-int AliHLTTPCTrackArray::FillTracksVersion1(AliHLTTPCTrackSegmentDataV1* tr, Int_t ntracks, unsigned int sizeInByte, Int_t slice, Int_t bTransform)
-{
- //Read tracks from shared memory (or memory)
- int iResult=0;
- AliHLTTPCTrackSegmentDataV1 *trs = tr;
- for(Int_t i=0; i<ntracks; i++){
- if (sizeInByte>0 &&
- (((AliHLTUInt8_t*)trs)+sizeof(AliHLTTPCTrackSegmentDataV1)>((AliHLTUInt8_t*)tr)+sizeInByte ||
- ((AliHLTUInt8_t*)trs)+sizeof(AliHLTTPCTrackSegmentDataV1)+trs->fNPoints*sizeof(UInt_t)>((AliHLTUInt8_t*)tr)+sizeInByte)) {
- iResult=-EDOM;
- break;
- }
- AliHLTTPCTrack *track = NextTrack();
- track->SetPt(trs->fPt);
- track->SetPterr(trs->fPterr);
- Float_t psi[1];
- psi[0]=trs->fPsi;
- if (slice>=0 && bTransform!=0) {
- AliHLTTPCTransform::Local2GlobalAngle(psi,slice);
- }
- track->SetPsi(psi[0]);
- track->SetTgl(trs->fTgl);
- track->SetPsierr(trs->fPsierr);
- track->SetTglerr(trs->fTglerr);
- track->SetNHits(trs->fNPoints);
- track->SetCharge(trs->fCharge);
- Float_t first[3];
- first[0]=trs->fX;first[1]=trs->fY;first[2]=trs->fZ;
- if (slice>=0 && bTransform!=0) {
- AliHLTTPCTransform::Local2Global(first,slice);
- }
- track->SetFirstPoint(first[0],first[1],first[2]);
- Float_t last[3];
- last[0]=trs->fLastX;last[1]=trs->fLastY;last[2]=trs->fLastZ;
- if (slice>=0 && bTransform!=0) {
- AliHLTTPCTransform::Local2Global(last,slice);
- }
- track->SetLastPoint(last[0],last[1],last[2]);
- track->SetHits( trs->fNPoints, trs->fPointIDs );
-
- track->SetSector(slice);
- if ( trs->fPt == -9876.0 || trs->fPt == -1.0) {
- track->SetPhi0(atan2(first[1],first[0]));
- track->SetKappa(1.0);
- track->SetRadius(999999.0);
- } else {
- track->CalculateHelix();
- }
-
- UChar_t *tmpP = (UChar_t*)trs;
- tmpP += sizeof(AliHLTTPCTrackSegmentDataV1)+trs->fNPoints*sizeof(UInt_t);
- trs = (AliHLTTPCTrackSegmentDataV1*)tmpP;
- }
- return iResult;
-}
-
-UInt_t AliHLTTPCTrackArray::GetOutSize()
-{
- //get size for IO
- UInt_t count = GetOutCount(); //use only present tracks
- UInt_t tHits = 0;
- for(Int_t i=0;i<fNTracks;i++){ //loop over all tracks
- AliHLTTPCTrack *track = GetCheckedTrack(i); //use only present tracks
- if(track) //use only present tracks
- tHits += track->GetNHits();
- }
-
- //calculate size of track
- return count*sizeof(AliHLTTPCTrackSegmentData)+sizeof(UInt_t)*tHits;
-}
-
-UInt_t AliHLTTPCTrackArray::WriteTracks(UInt_t & ntracks,AliHLTTPCTrackSegmentData* tr)
-{
- //write tracks
- ntracks = GetOutCount();
- return WriteTracks(tr);
-}
-
-UInt_t AliHLTTPCTrackArray::WriteTracks(AliHLTTPCTrackSegmentData* tr)
-{
- //if(GetTrackType()=='c') return WriteConfMapTracks(tr);
- AliHLTTPCTrackSegmentData *tP = tr;
- UInt_t *pP;
- UInt_t size = 0;
- for(Int_t i=0; i<fNTracks; i++){ //loop over all tracks
- AliHLTTPCTrack *track = GetCheckedTrack(i); //use only present tracks
- if(!track) continue; //use only present tracks
- tP->fX = track->GetFirstPointX();
- tP->fY = track->GetFirstPointY();
- tP->fZ = track->GetFirstPointZ();
- tP->fPt = track->GetPt();
- tP->fPterr = track->GetPterr();
- tP->fLastX = track->GetLastPointX();
- tP->fLastY = track->GetLastPointY();
- tP->fLastZ = track->GetLastPointZ();
- tP->fPsi = track->GetPsi();
- tP->fTgl = track->GetTgl();
- tP->fPsierr = track->GetPsierr();
- tP->fTglerr = track->GetTglerr();
- tP->fY0err = track->GetY0err();
- tP->fZ0err = track->GetZ0err();
- tP->fCharge = track->GetCharge();
- tP->fNPoints = track->GetNHits();
-#ifdef INCLUDE_TPC_HOUGH
-#ifdef ROWHOUGHPARAMS
- if(GetTrackType()=='h') {
- tP->fWeight = ((AliHLTTPCHoughTrack *)track)->GetWeight();
- tP->fBinX = ((AliHLTTPCHoughTrack *)track)->GetBinX();
- tP->fBinY = ((AliHLTTPCHoughTrack *)track)->GetBinY();
- tP->fBinXSize = ((AliHLTTPCHoughTrack *)track)->GetSizeX();
- tP->fBinYSize = ((AliHLTTPCHoughTrack *)track)->GetSizeY();
- }
- tP->fTrackID = track->GetMCid();
- tP->fRowRange1 = track->GetFirstRow();
- tP->fRowRange2 = track->GetLastRow();
- tP->fSector = track->GetSector();
- tP->fPID = track->GetPID();
-#endif
-#endif // INCLUDE_TPC_HOUGH
- pP = (UInt_t*)track->GetHitNumbers();
- for (UInt_t j=0;j<tP->fNPoints;j++){
- tP->fPointIDs[j] = pP[j];
- }
- Byte_t *tmpP = (Byte_t *)tP;
- tmpP += sizeof(AliHLTTPCTrackSegmentData)+tP->fNPoints*sizeof(UInt_t);
- size += sizeof(AliHLTTPCTrackSegmentData)+tP->fNPoints*sizeof(UInt_t);
- tP = (AliHLTTPCTrackSegmentData*)tmpP;
-
-// LOG(AliHLTTPCLog::kError,"AliHLTTPCTrackArray::WriteTracks","TRACKPARAMETER") <<ENDLOG;
-// track->Rotate(0,kFALSE);
-// track->Print();
-
- }
- return size;
-}
-
-UInt_t AliHLTTPCTrackArray::WriteConfMapTracks(AliHLTTPCTrackSegmentData* tr)
-{
- // use first and last point objects
- AliHLTTPCTrackSegmentData *tP = tr;
- UInt_t *pP;
- UInt_t size = 0;
- for(Int_t i=0; i<fNTracks; i++){ //loop over all tracks
- AliHLTTPCConfMapTrack *track =(AliHLTTPCConfMapTrack *) GetCheckedTrack(i); //use only present tracks
- if(!track) continue; //use only present tracks
- AliHLTTPCConfMapPoint *hit = (AliHLTTPCConfMapPoint*)track->GetLastHit();
- AliHLTTPCConfMapPoint *lastHit = (AliHLTTPCConfMapPoint*)track->GetFirstHit();
- tP->fX = hit->GetX();
- tP->fY = hit->GetY();
- tP->fZ = hit->GetZ();
- tP->fLastX = lastHit->GetX();
- tP->fLastY = lastHit->GetY();
- tP->fLastZ = lastHit->GetZ();
-
-// tP->fX = track->GetFirstPointX();
-// tP->fY = track->GetFirstPointY();
-// tP->fZ = track->GetFirstPointZ();
- tP->fPt = track->GetPt();
- tP->fPterr = track->GetPterr();
-// tP->fLastX = track->GetLastPointX();
-// tP->fLastY = track->GetLastPointY();
-// tP->fLastZ = track->GetLastPointZ();
- tP->fPsi = track->GetPsi();
- tP->fTgl = track->GetTgl();
- tP->fPsierr = track->GetPsierr();
- tP->fTglerr = track->GetTglerr();
- tP->fY0err = track->GetY0err();
- tP->fZ0err = track->GetZ0err();
- tP->fCharge = track->GetCharge();
-#ifdef INCLUDE_TPC_HOUGH
-#ifdef ROWHOUGHPARAMS
- tP->fTrackID = track->GetMCid();
- tP->fRowRange1 = track->GetFirstRow();
- tP->fRowRange2 = track->GetLastRow();
- tP->fSector = track->GetSector();
- tP->fPID = track->GetPID();
-#endif
-#endif // INCLUDE_TPC_HOUGH
- tP->fNPoints = track->GetNHits();
- pP = (UInt_t*)track->GetHitNumbers();
- for (UInt_t j=0;j<tP->fNPoints;j++){
- tP->fPointIDs[j] = pP[j];
- }
- Byte_t *tmpP = (Byte_t *)tP;
- tmpP += sizeof(AliHLTTPCTrackSegmentData)+tP->fNPoints*sizeof(UInt_t);
- size +=sizeof(AliHLTTPCTrackSegmentData)+tP->fNPoints*sizeof(UInt_t);
- tP = (AliHLTTPCTrackSegmentData*)tmpP;
- }
- return size;
-}
-
-void AliHLTTPCTrackArray::AddLast(AliHLTTPCTrack *track)
-{
- //add track to last position
- AliHLTTPCTrack *tpt = NextTrack();
- tpt->Copy(track);
-
-}
-
-void AliHLTTPCTrackArray::AddTracks(AliHLTTPCTrackArray *newtrack,Bool_t remove_old,Int_t slice)
-{
- //add tracks
- if(GetTrackType() != newtrack->GetTrackType() && GetTrackType()!='t')
- {
- LOG(AliHLTTPCLog::kError,"AliHLTTPCTrackArray::AddTracks","Track types")
- <<"Bad idea to add tracks of different types"<<ENDLOG;
- return;
- }
- if(fSize < fNTracks+newtrack->GetNPresent())
- SetSize(fSize+newtrack->GetSize());
- for(Int_t i =0;i<newtrack->GetNTracks();i++){
- AliHLTTPCTrack *tpt = newtrack->GetCheckedTrack(i);
- if(!tpt) continue;
- if(remove_old)
- newtrack->Remove(i);
- AliHLTTPCTrack *track = NextTrack();
- track->Copy(tpt);
- if(slice>=0)
- track->Rotate(slice); //Rotate track to global coordinates
- /*
- AliHLTTPCTrack *track;
-#ifdef INCLUDE_TPC_HOUGH
- if(GetTrackType()=='h')
- track = (AliHLTTPCHoughTrack*)NextTrack();
- else
-#endif
- track = NextTrack();
- track->Copy(tpt);
- */
- }
-}
-
-void AliHLTTPCTrackArray::Compress()
-{
- //compress array
- if(GetNPresent()==GetNTracks()) return;
- AliHLTTPCTrack **tmp = new AliHLTTPCTrack *[fNTracks];
- Int_t present=0;
- Int_t absent=GetNPresent();
- for(Int_t i=0;i<GetNTracks();i++){
- if(fIsPresent[i]) tmp[present++] = fTrack[i];
- else tmp[absent++] = fTrack[i];
- }
- for(Int_t i=0;i<GetNTracks();i++)
- fIsPresent[i]=kTRUE;
-
- //Copy pointers back
- for(Int_t i=0; i<GetNTracks();i++){
- fTrack[i]=tmp[i];
- }
-
- delete[] tmp;
-
- fNTracks = GetNPresent();
- fNAbsent = 0;
-}
-
-void AliHLTTPCTrackArray::QSort()
-{
- // compress and sort
- Compress();
- QSort(fTrack,0,fNTracks);
-}
-
-void AliHLTTPCTrackArray::QSort( AliHLTTPCTrack **a, Int_t first, Int_t last)
-{
- // Sort array of AliHLTTPCTrack pointers using a quicksort algorithm.
- // Uses TrackCompare() to compare objects.
- // Thanks to Root!
-
- static AliHLTTPCTrack *tmp;
- static int i; // "static" to save stack space
- int j;
-
- while (last - first > 1) {
- i = first;
- j = last;
- for (;;) {
- while (++i < last && TrackCompare(a[i], a[first]) < 0)
- ;
- while (--j > first && TrackCompare(a[j], a[first]) > 0)
- ;
- if (i >= j)
- break;
-
- tmp = a[i];
- a[i] = a[j];
- a[j] = tmp;
- }
- if (j == first) {
- ++first;
- continue;
- }
- tmp = a[first];
- a[first] = a[j];
- a[j] = tmp;
- if (j - first < last - (j + 1)) {
- QSort(a, first, j);
- first = j + 1; // QSort(j + 1, last);
- } else {
- QSort(a, j + 1, last);
- last = j; // QSort(first, j);
- }
- }
-}
-
-Int_t AliHLTTPCTrackArray::TrackCompare(AliHLTTPCTrack *a, AliHLTTPCTrack *b) const
-{
- // Compare the two tracks.
-
- return b->Compare(a);
-
- /*
-#ifdef INCLUDE_TPC_HOUGH
- if(fTrackType=='h')
- {
- AliHLTTPCHoughTrack *tra = (AliHLTTPCHoughTrack*)a;
- AliHLTTPCHoughTrack *trb = (AliHLTTPCHoughTrack*)b;
- if(tra->GetWeight() < trb->GetWeight()) return 1;
- if(tra->GetWeight() > trb->GetWeight()) return -1;
- }
- else
-#endif
- {
- if(a->GetNHits() < b->GetNHits()) return 1;
- if(a->GetNHits() > b->GetNHits()) return -1;
- }
-
- return 0;
- */
-}
-
-AliHLTTPCTrack* AliHLTTPCTrackArray::operator[](int index)
-{
- // access operator
- if (index<fNTracks) return fTrack[index];
- return NULL;
-}
+++ /dev/null
-// -*- Mode: C++ -*-
-// $Id$
-// Original: AliHLTTrackArray.h,v 1.7 2004/06/11 16:06:33 loizides
-#ifndef ALIHLTTPCTRACKARRAY_H
-#define ALIHLTTPCTRACKARRAY_H
-
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* See cxx source for full Copyright notice *
-
-/// @file AliHLTTPCTrackArray.h
-/// @author Uli Frankenfeld, maintained by Matthias Richter
-/// @date
-/// @brief Array of AliHLTTPCTracks
-///
-
-#include "AliHLTTPCRootTypes.h"
-
-class AliHLTTPCConfMapTrack;
-class AliHLTTPCTrack;
-struct AliHLTTPCTrackSegmentData;
-struct AliHLTTPCTrackSegmentDataV1;
-struct AliHLTExternalTrackParam;
-/**
- * @class AliHLTTPCTrackArray
- * Array of AliHLTTrack objects.
- * The class implements a dynamic array and handler methods.
- *
- * @ingroup alihlt_tpc
- */
-class AliHLTTPCTrackArray {
- public:
- /** default constructor */
- AliHLTTPCTrackArray();
- /**
- * constructor
- * @param ntrack initial size
- */
- AliHLTTPCTrackArray(Int_t ntrack);
- /**
- * constructor
- * @param tracktype string describing type, one of
- * - AliHLTTPCTrack -> 't'
- * - AliHLTTPCConfMapTrack -> 'c'
- * - AliHLTTPCHoughTrack -> 'h'
- * - AliHLTTPCModelTrack -> 'm'
- * @param ntrack initial size
- */
- AliHLTTPCTrackArray(const char* tracktype,Int_t ntrack);
- /**
- * constructor
- * @param tracktype string describing type, one of
- * - AliHLTTPCTrack -> 't'
- * - AliHLTTPCConfMapTrack -> 'c'
- * - AliHLTTPCHoughTrack -> 'h'
- * - AliHLTTPCModelTrack -> 'm'
- */
- AliHLTTPCTrackArray(const char* tracktype);
- /** destructor */
- virtual ~AliHLTTPCTrackArray();
-
- /**
- * Get type of track.
- * @return one of
- * - 't' -> AliHLTTPCTrack
- * - 'c' -> AliHLTTPCConfMapTrack
- * - 'h' -> AliHLTTPCHoughTrack
- * - 'm' -> AliHLTTPCModelTrack
- */
- Int_t GetTrackType(){return fTrackType;}
-
- /**
- * Get size of the array.
- * @return size of the array
- */
- Int_t GetSize() const {return fSize;}
-
- /**
- * Set size.
- * If the current size is smaller, the array is grown to the new size.
- * @return kTRUE if the array was grown, kFALSE otherwise
- */
- Bool_t SetSize(Int_t newsize=0);
-
- Int_t GetNPresent() const {return (fNTracks- fNAbsent);}
- Int_t GetNTracks() const {return fNTracks;}
-
- /**
- * Return pointer to next free track object.
- * The array is grown if necessary.
- */
- AliHLTTPCTrack *NextTrack();
- AliHLTTPCTrack *GetCheckedTrack(Int_t t) const {if(fIsPresent[t]) return fTrack[t]; return 0;}
- AliHLTTPCTrack *GetTrack(Int_t t) const {return fTrack[t];}
-
- void Remove(Int_t track);
- void RemoveLast() {fNTracks--;}
- void Compress();
- void Reset();
- void QSort();
- void QSort( AliHLTTPCTrack **a, Int_t first, Int_t last);
- Int_t TrackCompare(AliHLTTPCTrack *a, AliHLTTPCTrack *b) const;
-
- /**
- * Fill track array from track segment array.
- * Old method excluding buffer protection kept for backward compatibility.
- * Forwarded to FillTracksChecked().
- * @param ntracks size of the input array
- * @param tr array of AliHLTTrackSegmentData
- * @param slice slice no to transform the tracks to
- * @param bTransform transform to global coordinates if 1
- */
- int FillTracks(Int_t ntracks, AliHLTTPCTrackSegmentData* tr, Int_t slice=-1, Int_t bTransform=1);
-
- /**
- * Fill track array from track segment array.
- * Reads the track from an array of AliHLTTrackSegmentData. The coordinates
- * are transformed to global coordinates if the slice parameter is specified.
- * In that case to internal slice variable is set to zero.
- *
- * The sizeInByte parameter allows an additional buffer protection if
- * non-zero. The size of the AliHLTTPCTrackSegmentData is not fixed due to
- * variable array at the end of the structure. The pointer to the next
- * entry must be set according to the variable array.
- * @param ntracks size of the input array
- * @param tr array of AliHLTTrackSegmentData
- * @param sizeInByte additional size protection
- * @param slice slice no to transform the tracks to
- * @param bTransform transform to global coordinates if 1
- */
- int FillTracksChecked(AliHLTTPCTrackSegmentData* tr, Int_t ntracks, unsigned int sizeInByte, Int_t slice=-1, Int_t bTransform=1);
- int FillTracksChecked(AliHLTExternalTrackParam* tr, Int_t ntracks, unsigned int sizeInByte, Int_t slice=-1, Int_t bTransform=1);
-
- /**
- * Fill array from version1 structure.
- * The version 1 of ALiHLTTPCTrackSegmentData was valid until July 2008
- * revision 27415.
- *
- * Similar behavior like FillTracksChecked.
- */
- int FillTracksVersion1(AliHLTTPCTrackSegmentDataV1* tr, Int_t ntracks, unsigned int sizeInByte, Int_t slice=-1, Int_t bTransform=1);
-
- UInt_t WriteTracks(AliHLTTPCTrackSegmentData* tr); //Write tracks
- UInt_t WriteTracks(UInt_t & ntracks,AliHLTTPCTrackSegmentData* tr); //Write tracks
- UInt_t GetOutSize();
- UInt_t GetOutCount(){return (UInt_t) GetNPresent();}
- void AddTracks(AliHLTTPCTrackArray *newtrack,Bool_t remove_old=kTRUE,Int_t slice=-1);//add all Tracks to this
- void AddLast(AliHLTTPCTrack *track);
-
- AliHLTTPCTrack* operator[](int index);
-
- private:
- /** copy constructor prohibited */
- AliHLTTPCTrackArray(const AliHLTTPCTrackArray&);
- /** assignment operator prohibited */
- AliHLTTPCTrackArray& operator=(const AliHLTTPCTrackArray&);
-
- Char_t fTrackType; //track type
- Int_t fSize; //size of array
- Bool_t *fIsPresent;//!
- Int_t fNAbsent; //ntracks absent
-
- AliHLTTPCTrack **fTrack;//!
- Int_t fNTracks; //ntracks in
-
- UInt_t WriteConfMapTracks(AliHLTTPCTrackSegmentData* tr);
- void DeleteArray();
-
- ClassDef(AliHLTTPCTrackArray,2) //Track array class
-};
-
-#endif
+++ /dev/null
-// @(#) $Id$
-// Original: AliHLTVertex.cxx,v 1.5 2004/07/02 11:41:18 loizides Exp $
-
-// Author: Uli Frankenfeld <mailto:franken@fi.uib.no>
-//*-- Copyright © ALICE HLT Group
-
-#include "AliHLTTPCLogging.h"
-#include "AliHLTTPCVertexData.h"
-#include "AliHLTTPCVertex.h"
-
-/** \class AliHLTTPCVertex
-<pre>
-//_____________________________________________________________
-// AliHLTTPCVertex
-//
-// Stores the information of the vertex position
-//
-</pre>
-*/
-
-ClassImp(AliHLTTPCVertex)
-
-AliHLTTPCVertex::AliHLTTPCVertex()
- :
- fX(0.0),
- fY(0.0),
- fZ(0.0),
- fPhi(0.0),
- fR(0.0),
- fXErr(1.0),
- fYErr(1.0),
- fZErr(1.0),
- fMWxy(1.0)
-{
- //
- // default constructor for the AliHLTTPCVertex class.
- //
-
- SetZero();
-}
-
-AliHLTTPCVertex::AliHLTTPCVertex(const AliHLTTPCVertex&)
- :
- fX(0.0),
- fY(0.0),
- fZ(0.0),
- fPhi(0.0),
- fR(0.0),
- fXErr(1.0),
- fYErr(1.0),
- fZErr(1.0),
- fMWxy(1.0)
-{
- //
- // copy constructor not for use
- //
-}
-
-AliHLTTPCVertex& AliHLTTPCVertex::operator=(const AliHLTTPCVertex&)
-{
- //
- // assignment operator not for use
- //
- fX=0.0;
- fY=0.0;
- fZ=0.0;
- fPhi=0.0;
- fR=0.0;
- fXErr=1.0;
- fYErr=1.0;
- fZErr=1.0;
- fMWxy=1.0;
- return *this;
-}
-
-AliHLTTPCVertex::~AliHLTTPCVertex()
-{
- //
- // destructor
- //
-}
-
-void AliHLTTPCVertex::SetZero()
-{
- // set vertex to zero
- SetX(0);
- SetY(0);
- SetZ(0);
- SetXErr(1);
- SetYErr(1);
- SetZErr(1);
- fR=0;
- fPhi=0;
- fMWxy = 1.;
-}
-
-void AliHLTTPCVertex::Read(const AliHLTTPCVertexData *vertex)
-{
- // read vertex
- SetX(vertex->fX);
- SetY(vertex->fY);
- SetZ(vertex->fZ);
- SetXErr(vertex->fXErr);
- SetYErr(vertex->fYErr);
- SetZErr(vertex->fZErr);
- fR=0;
- fPhi=0;
- fMWxy = 1.;
-}
+++ /dev/null
-// @(#) $Id$
-// Original: AliHLTVertex.h,v 1.4 2004/07/02 11:41:18 loizides
-
-#ifndef ALIHLTTPCVERTEX_H
-#define ALIHLTTPCVERTEX_H
-
-class AliHLTTPCVertexData;
-
-class AliHLTTPCVertex {
-
- public:
- AliHLTTPCVertex();
-
- virtual ~AliHLTTPCVertex();
-
- void SetZero();
- void Read(const AliHLTTPCVertexData *vertex);
-
- Double_t GetX() const {return fX;}
- Double_t GetY() const {return fY;}
- Double_t GetZ() const {return fZ;}
- Double_t GetXErr() const {return fXErr;}
- Double_t GetYErr() const {return fYErr;}
- Double_t GetZErr() const {return fZErr;}
- Double_t GetPhi() const {return fPhi;}
- Double_t GetR() const {return fR;}
- Double_t GetXYWeight() const {return fMWxy;}
- void SetX(Double_t f) {fX=f;}
- void SetY(Double_t f) {fY=f;}
- void SetZ(Double_t f) {fZ=f;}
- void SetXErr(Double_t f) {fXErr=f;}
- void SetYErr(Double_t f) {fYErr=f;}
- void SetZErr(Double_t f) {fZErr=f;}
- void SetXYWeight(Double_t f) {fMWxy = f;}
-
- private:
- AliHLTTPCVertex(const AliHLTTPCVertex&);
- AliHLTTPCVertex& operator=(const AliHLTTPCVertex&);
-
- Double_t fX; //x
- Double_t fY; //y
- Double_t fZ; //z
- Double_t fPhi; //phi
- Double_t fR; //R
- Double_t fXErr; //error in x
- Double_t fYErr; //error in z
- Double_t fZErr; //error in y
- Double_t fMWxy; //weight
-
- ClassDef(AliHLTTPCVertex,1) // Vertex base class
-};
-#endif
+++ /dev/null
-// @(#) $Id$
-// Original: AliHLTVertexData.h,v 1.2 2003/07/27 21:02:09 loizides
-
-#ifndef VERTEXDATA_H
-#define VERTEXDATA_H
-
-#include "AliHLTTPCRootTypes.h"
-
-struct AliHLTTPCVertexData{
- Double_t fX;
- Double_t fY;
- Double_t fZ;
- Double_t fXErr;
- Double_t fYErr;
- Double_t fZErr;
-};
-typedef struct AliHLTTPCVertexData AliHLTTPCVertexData;
-
-#endif /* VERTEXDATA_H */
+++ /dev/null
-// $Id$
-
-//**************************************************************************
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* *
-//* Primary Authors: Jacek Otwinowski <J.Otwinowski@gsi.de> *
-//* *
-//* 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 AliHLTTPCOfflineCalibrationComponent.cxx
- @author Jacek Otwinowski <J.Otwinowski@gsi.de>
- @date
- @brief TPC calibration component
-*/
-
-#include "AliHLTTPCOfflineCalibrationComponent.h"
-#include "TString.h"
-#include "TObjArray.h"
-#include "TObjString.h"
-#include "AliTPCcalibAlign.h"
-#include "AliTPCcalibTracksGain.h"
-#include "AliTPCcalibTracks.h"
-#include "AliESDEvent.h"
-#include "AliESDfriend.h"
-#include "AliCDBManager.h"
-#include "AliTPCcalibDB.h"
-#include "AliTPCClusterParam.h"
-#include "AliTPCcalibTracksCuts.h"
-#include "AliTPCseed.h"
-#include "AliTPCcalibTracksCuts.h"
-#include "AliTPCClusterParam.h"
-#include "AliHLTTPCDefinitions.h"
-#include "AliHLTReadoutList.h"
-
-/** ROOT macro for the implementation of ROOT specific class methods */
-ClassImp(AliHLTTPCOfflineCalibrationComponent)
-
-AliHLTTPCOfflineCalibrationComponent::AliHLTTPCOfflineCalibrationComponent() : AliHLTCalibrationProcessor(),
-fEnableAnalysis(kTRUE),
-fClustParam(0),
-fTrackCuts(0),
-fTPCcalibAlign(0),
-fTPCcalibTracksGain(0),
-fTPCcalibTracks(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
-}
-
-AliHLTTPCOfflineCalibrationComponent::~AliHLTTPCOfflineCalibrationComponent()
-{
- // see header file for class documentation
-}
-
-const char* AliHLTTPCOfflineCalibrationComponent::GetComponentID()
-{
- // see header file for class documentation
- return "TPCOfflineCalibration";
-}
-
-void AliHLTTPCOfflineCalibrationComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
-{
- // get input data type
- list.clear();
- list.push_back(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC/*TObjArray of seeds*/);
-}
-
-AliHLTComponentDataType AliHLTTPCOfflineCalibrationComponent::GetOutputDataType()
-{
- // return ouput data type
- return kAliHLTMultipleDataType;
-}
-
-
-int AliHLTTPCOfflineCalibrationComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
-{
- // create output data type
- tgtList.clear();
- tgtList.push_back(AliHLTTPCDefinitions::OfflineCalibAlignDataType());
- tgtList.push_back(AliHLTTPCDefinitions::OfflineCalibTracksDataType());
- tgtList.push_back(AliHLTTPCDefinitions::OfflineCalibTracksGainDataType());
-
- return tgtList.size();
-}
-
-void AliHLTTPCOfflineCalibrationComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
-{
- // get output data size
- constBase = 30000000;
- inputMultiplier = 1;
-}
-
-AliHLTComponent* AliHLTTPCOfflineCalibrationComponent::Spawn()
-{
- // create instance of the component
- return new AliHLTTPCOfflineCalibrationComponent;
-}
-
-int AliHLTTPCOfflineCalibrationComponent::InitCalibration()
-{
- // init configuration
-
- HLTInfo("init calibration component");
- int iResult=0;
-
- //
- // initialisation
- //
-
- // Init parameters and cuts
- fClustParam = AliTPCcalibDB::Instance()->GetClusterParam();
- fTrackCuts = new AliTPCcalibTracksCuts(20, 0.4, 0.5, 0.13, 0.018);
-
- // Init calibration componenets
- fTPCcalibAlign = new AliTPCcalibAlign("TPCcalibAlign","TPCcalibAlign");
- fTPCcalibTracksGain = new AliTPCcalibTracksGain("TPCcalibTracksGain","TPCcalibTracksGain",fTrackCuts);
- fTPCcalibTracks = new AliTPCcalibTracks("TPCcalibTracks","TPCcalibTracks",fClustParam,fTrackCuts);
-
- if (!fTrackCuts || !fClustParam || !fTPCcalibAlign || !fTPCcalibTracksGain || !fTPCcalibTracks) {
- HLTError("failed creating internal objects");
- iResult=-ENOMEM;
- }
-
- return iResult;
-}
-
-Int_t AliHLTTPCOfflineCalibrationComponent::DeinitCalibration()
-{
- // deinit configuration
- if(fClustParam) delete fClustParam; fClustParam = 0;
- if(fTrackCuts) delete fTrackCuts; fTrackCuts = 0;
-
- if(fTPCcalibAlign) delete fTPCcalibAlign; fTPCcalibAlign = 0;
- if(fTPCcalibTracksGain) delete fTPCcalibTracksGain; fTPCcalibTracksGain = 0;
- if(fTPCcalibTracks) delete fTPCcalibTracks; fTPCcalibTracks = 0;
-
- return 0;
-}
-
-Int_t AliHLTTPCOfflineCalibrationComponent::ScanArgument(Int_t argc, const char** argv)
-{
- int iResult = 0;
-
- TString argument="";
- TString configuration="";
- int bMissingParam=0;
- for (int i=0; i<argc && iResult>=0; i++) {
- argument=argv[i];
- if (argument.IsNull()) continue;
-
- }
- if (bMissingParam) {
- HLTError("missing parameter for argument %s", argument.Data());
- iResult=-EINVAL;
- }
-
- if (iResult>=0 && !configuration.IsNull()) {
- iResult=Configure(configuration.Data());
- } else {
- iResult=Reconfigure(NULL, NULL);
- }
-
- return iResult;
-}
-
-int AliHLTTPCOfflineCalibrationComponent::ProcessCalibration(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
-{
- // calibration function
- HLTInfo("ProcessCalibration processing data");
-
- int iResult=0;
- TObjArray *pSeedsArray=0;
- int slice, patch;
-
- // calculate specification
- const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC);
- if(!pBlock) {
- HLTError("Cannot get first data block 0x%08x ",pBlock);
- iResult=-ENOMEM; return iResult;
- }
- int minSlice=AliHLTTPCDefinitions::GetMinSliceNr(pBlock->fSpecification);
- int maxSlice=AliHLTTPCDefinitions::GetMaxSliceNr(pBlock->fSpecification);
- int minPatch=AliHLTTPCDefinitions::GetMinPatchNr(pBlock->fSpecification);
- int maxPatch=AliHLTTPCDefinitions::GetMaxPatchNr(pBlock->fSpecification);
-
- if (fTPCcalibAlign && fTPCcalibTracksGain && fTPCcalibTracks)
- {
- // loop over input data blocks: TObjArray of TPCseed
- for (TObject *pObj = (TObject *)GetFirstInputObject(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC,"TObjArray",0);
- pObj !=0 && iResult>=0;
- pObj = (TObject *)GetNextInputObject(0)) {
-
- pSeedsArray = dynamic_cast<TObjArray*>(pObj);
- if (!pSeedsArray) continue;
-
- slice=AliHLTTPCDefinitions::GetMinSliceNr(GetSpecification(pObj));
- patch=AliHLTTPCDefinitions::GetMinPatchNr(GetSpecification(pObj));
-
- if(slice < minSlice) minSlice=slice;
- if(slice > maxSlice) maxSlice=slice;
- if(patch < minPatch) minPatch=patch;
- if(patch > maxPatch) maxPatch=patch;
-
- // get TPC seeds
- Int_t nseed = pSeedsArray->GetEntriesFast();
- HLTInfo("Number TPC seeds %d",nseed);
-
- for(Int_t i=0; i<nseed; ++i) {
- AliTPCseed *seed = (AliTPCseed*)pSeedsArray->UncheckedAt(i);
- if(!seed) continue;
- HLTInfo("Process calibration on seed 0x%08x", seed);
- fTPCcalibAlign->Process(seed);
- fTPCcalibTracksGain->Process(seed);
- fTPCcalibTracks->Process(seed);
- }
-
- // calculate specification from the specification of input data blocks
- AliHLTUInt32_t iSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(minSlice, maxSlice, minPatch, maxPatch);
-
- // send data
- PushBack((TObject*)fTPCcalibAlign,AliHLTTPCDefinitions::OfflineCalibAlignDataType(),iSpecification);
- PushBack((TObject*)fTPCcalibTracksGain,AliHLTTPCDefinitions::OfflineCalibTracksGainDataType(),iSpecification);
- PushBack((TObject*)fTPCcalibTracks,AliHLTTPCDefinitions::OfflineCalibTracksDataType(),iSpecification);
-
- // reset standard ESD content
- pSeedsArray->Delete();
-
- }// end loop over input objects
-
- } else {
- HLTError("component not initialized");
- iResult=-ENOMEM;
- }
-
- return iResult;
-}
-
-Int_t AliHLTTPCOfflineCalibrationComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/,
- AliHLTComponentTriggerData& /*trigData*/ ) {
-// see header file for class documentation
- if( fEnableAnalysis )
- {
- fTPCcalibAlign->Analyze();
- fTPCcalibTracksGain->Analyze();
- fTPCcalibTracks->Analyze();
- }
- static AliHLTReadoutList rdList(AliHLTReadoutList::kTPC);
- PushToFXS((TObject*)fTPCcalibAlign, "TPC", "TPCcalibAlign", &rdList) ;
- PushToFXS((TObject*)fTPCcalibTracksGain, "TPC", "TPCcalibTracksGain", &rdList) ;
- PushToFXS((TObject*)fTPCcalibTracks, "TPC", "TPCcalibTracks", &rdList) ;
-
-return 0;
-}
-
-int AliHLTTPCOfflineCalibrationComponent::Configure(const char* arguments)
-{
- // see header file for class documentation
- int iResult=0;
- if (!arguments) return iResult;
-
- TString allArgs=arguments;
- TString argument;
- int bMissingParam=0;
-
- TObjArray* pTokens=allArgs.Tokenize(" ");
- if (pTokens) {
- for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
- argument=((TObjString*)pTokens->At(i))->GetString();
- if (argument.IsNull()) continue;
-
- if (argument.CompareTo("-something")==0) {
- if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
-
- } else {
- HLTError("unknown argument %s", argument.Data());
- iResult=-EINVAL;
- break;
- }
- }
- delete pTokens;
- }
- if (bMissingParam) {
- HLTError("missing parameter for argument %s", argument.Data());
- iResult=-EINVAL;
- }
- return iResult;
-}
-
-int AliHLTTPCOfflineCalibrationComponent::Reconfigure(const char* /*cdbEntry*/, const char* /*chainId*/)
-{
- // see header file for class documentation
- int iResult=0;
- return iResult;
-}
+++ /dev/null
-//-*- Mode: C++ -*-
-// $Id$
-#ifndef ALIHLTTPCOFFLINECALIBRATIONCOMPONENT_H
-#define ALIHLTTPCOFFLINECALIBRATIONCOMPONENT_H
-
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* See cxx source for full Copyright notice *
-
-/** @file AliHLTTPCOfflineCalibrationComponent.h
- @author Jacek Otwinowski
- @date
- @brief TPC calibration component
-*/
-
-#include "AliHLTCalibrationProcessor.h"
-
-/**
- * @class AliHLTTPCOfflineCalibrationComponent
- * TPC calibration component
- *
- * The component interfaces of the TPC offline calibration components
- * to the online HLT. The component expects a TPCseed object.
- * The outputs are calibration components.
- *
- * <h2>General properties:</h2>
- *
- * Component ID: \b TPCOfflineCalibration <br>
- * Library: \b libAliHLTTPC.so <br>
- * Input Data Types: @ref kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC <br>
- * Output Data Types: @ref AliHLTTPCDefinitions::fgkOfflineCalibAlignDataType|kAliHLTDataOriginTPC <br>
- * Output Data Types: @ref AliHLTTPCDefinitions::fgkOfflineCalibTracksDataType|kAliHLTDataOriginTPC <br>
- * Output Data Types: @ref AliHLTTPCDefinitions::fgkOfflineCalibTracksGainDataType|kAliHLTDataOriginTPC <br>
- *
- * <h2>Mandatory arguments:</h2>
- * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
- *
- * <h2>Optional arguments:</h2>
- * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
- *
- * <h2>Configuration:</h2>
- * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
- *
- * <h2>Default CDB entries:</h2>
- * - loads magnetic field value from <tt>HLT/ConfigHLT/SolenoidBz</tt>.
- *
- * <h2>Performance:</h2>
- * To be determined.
- *
- * <h2>Memory consumption:</h2>
- * To be determined.
- *
- * <h2>Output size:</h2>
- * To be determined.
- *
- */
-
-class AliTPCClusterParam;
-class AliTPCcalibTracksCuts;
-
-class AliTPCcalibAlign;
-class AliTPCcalibTracksGain;
-class AliTPCcalibTracks;
-
-class AliHLTTPCOfflineCalibrationComponent : public AliHLTCalibrationProcessor {
-public:
- AliHLTTPCOfflineCalibrationComponent();
- virtual ~AliHLTTPCOfflineCalibrationComponent();
-
- // AliHLTComponent interface functions
- const char* GetComponentID();
- void GetInputDataTypes(vector<AliHLTComponentDataType>& list);
- AliHLTComponentDataType GetOutputDataType();
- int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList);
- void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
-
- // Spawn function, return new class instance
- AliHLTComponent* Spawn();
-
-protected:
- // AliHLTComponent interface functions
-
-
- /** Initialize the calibration component. */
- Int_t InitCalibration();
-
- /** Scan commandline arguments of the calibration component. */
- Int_t ScanArgument( Int_t argc, const char** argv );
-
- /** DeInitialize the calibration component. */
- Int_t DeinitCalibration();
-
- /** Process the data in the calibration component. */
- Int_t ProcessCalibration( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData );
-
- /** Ship the data to the FXS at end of run or eventmodulo. */
- Int_t ShipDataToFXS( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData );
-
- using AliHLTCalibrationProcessor::ProcessCalibration;
- using AliHLTCalibrationProcessor::ShipDataToFXS;
-
-private:
- /** copy constructor prohibited */
- AliHLTTPCOfflineCalibrationComponent(const AliHLTTPCOfflineCalibrationComponent&);
- /** assignment operator prohibited */
- AliHLTTPCOfflineCalibrationComponent& operator=(const AliHLTTPCOfflineCalibrationComponent&);
-
- Bool_t fEnableAnalysis; //! enable component analysis
-
- AliTPCClusterParam * fClustParam; //! TPC cluster parameters
- AliTPCcalibTracksCuts* fTrackCuts; //! TPC track cuts
-
- AliTPCcalibAlign *fTPCcalibAlign; //! TPC geometry params
- AliTPCcalibTracksGain *fTPCcalibTracksGain; //! TPC tracker
- AliTPCcalibTracks *fTPCcalibTracks; //! AliESDEvent needed by TPC tracker
-
- /**
- * Configure the component.
- * Parse a string for the configuration arguments and set the component
- * properties.
- */
- int Configure(const char* arguments);
- int Reconfigure(const char* /*cdbEntry*/, const char* /*chainId*/);
-
- ClassDef(AliHLTTPCOfflineCalibrationComponent, 0)
-};
-#endif
+++ /dev/null
-// $Id$
-
-//**************************************************************************
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* *
-//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
-//* *
-//* 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 AliHLTTPCOfflineClustererComponent.cxx
- @author Matthias Richter & Jacek Otwinowski
- @date
- @brief Wrapper component to the TPC offline cluster finder
-*/
-
-#include "AliHLTTPCOfflineClustererComponent.h"
-#include "AliHLTTPCDefinitions.h"
-#include "AliCDBManager.h"
-#include "AliGeomManager.h"
-#include "AliTPCRecoParam.h"
-#include "AliTPCParam.h"
-#include "AliTPCParamSR.h"
-#include "AliRawReaderMemory.h"
-#include "AliTPCclustererMI.h"
-#include "AliTPCClustersRow.h"
-#include "AliTracker.h"
-#include "AliDAQ.h"
-#include "TString.h"
-#include "TObjArray.h"
-#include "TClonesArray.h"
-#include "TObjString.h"
-#include "TTree.h"
-
-/** ROOT macro for the implementation of ROOT specific class methods */
-ClassImp(AliHLTTPCOfflineClustererComponent)
-
-AliHLTTPCOfflineClustererComponent::AliHLTTPCOfflineClustererComponent()
-: AliHLTProcessor(),
-fOutputPercentage(100),
-fGeometryFileName(""),
-fTPCRecoParam(0),
-fTPCGeomParam(0),
-fRawReader(0),
-fClusterer(0)
-{
- // Default constructor
- fGeometryFileName = getenv("ALICE_ROOT");
- fGeometryFileName += "/HLT/TPCLib/offline/geometry.root";
-}
-
-AliHLTTPCOfflineClustererComponent::~AliHLTTPCOfflineClustererComponent()
-{
- // Destructor
-}
-
-const char* AliHLTTPCOfflineClustererComponent::GetComponentID()
-{
- // Return component ID
- return "TPCOfflineClusterer";
-}
-
-void AliHLTTPCOfflineClustererComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
-{
- // Get the list of input data types
- list.push_back(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC);
-}
-
-AliHLTComponentDataType AliHLTTPCOfflineClustererComponent::GetOutputDataType()
-{
- // Return output data type
- // TObjArray/TClonesArray of clusters
- return kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC/*AliHLTTPCDefinitions::fgkOfflineClustersDataType*/;
-
-}
-
-void AliHLTTPCOfflineClustererComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
-{
- // Get output data size
- constBase = 20000;
- inputMultiplier = ((double)fOutputPercentage)/100.0;
-}
-
-AliHLTComponent* AliHLTTPCOfflineClustererComponent::Spawn()
-{
- // Return a new instance of the class
- return new AliHLTTPCOfflineClustererComponent;
-}
-
-int AliHLTTPCOfflineClustererComponent::DoInit( int argc, const char** argv )
-{
- // Perfom initialisation. Checks arguments (argc,argv)
- // and make initialisation. Returns 0 if success.
- //
-#ifdef HAVE_NOT_TPCOFFLINE_REC
- HLTError("AliRoot version > v4-13-Release required");
- return -ENOSYS;
-#endif //HAVE_NOT_TPCOFFLINE_REC
-
- int iResult=0;
- HLTInfo("parsing %d arguments", argc);
-
- TString argument="";
- TString configuration="";
- int bMissingParam=0;
-
- // loop over input parameters
- for (int i=0; i<argc && iResult>=0; i++) {
- argument=argv[i];
- if (argument.IsNull()) continue;
-
- if (argument.CompareTo("-geometry")==0) {
- if ((bMissingParam=(++i>=argc))) break;
-
- HLTInfo("got \'-geometry\' argument: %s", argv[i]);
- fGeometryFileName = argv[i];
- HLTInfo("Geometry file is: %s", fGeometryFileName.c_str());
-
- // the remaining arguments are treated as configuration
- } else {
- if (!configuration.IsNull()) configuration+=" ";
- configuration+=argument;
- }
- } // end loop
-
- if (bMissingParam) {
- HLTError("missing parameter for argument %s", argument.Data());
- iResult=-EINVAL;
- }
-
- if (iResult>=0 && !configuration.IsNull()) {
- iResult=Configure(configuration.Data());
- } else {
- iResult=Reconfigure(NULL, NULL);
- }
-
- //
- // initialisation
- //
-
- // Load geometry
- AliGeomManager::LoadGeometry(fGeometryFileName.c_str());
- if((AliGeomManager::GetGeometry()) == 0) {
- HLTError("Cannot load geometry from file %s",fGeometryFileName.c_str());
- iResult=-EINVAL;
- }
-
- // Raw Reader
- fRawReader = new AliRawReaderMemory;
-
- // TPC reconstruction parameters
- fTPCRecoParam = AliTPCRecoParam::GetHLTParam();
- if (fTPCRecoParam) {
- fTPCRecoParam->SetClusterSharing(kTRUE);
- }
-
- // TPC geometry parameters
- fTPCGeomParam = new AliTPCParamSR;
- if (fTPCGeomParam) {
- fTPCGeomParam->ReadGeoMatrices();
- }
-
- // Init clusterer
- fClusterer = new AliTPCclustererMI(fTPCGeomParam,fTPCRecoParam);
-#ifndef HAVE_NOT_TPCOFFLINE_REC
- if (fClusterer) fClusterer->StoreInClonesArray(kTRUE); // output clusters stored in one TClonesArray
-#endif
-
- if (!fRawReader || !fClusterer || !fTPCRecoParam || !fTPCGeomParam) {
- HLTError("failed creating internal objects");
- iResult=-ENOMEM;
- }
- return iResult;
-}
-
-int AliHLTTPCOfflineClustererComponent::DoDeinit()
-{
- // Deinitialisation of the component
- if (fTPCRecoParam) delete fTPCRecoParam; fTPCRecoParam=0;
- if (fTPCGeomParam) delete fTPCGeomParam; fTPCGeomParam=0;
- if (fRawReader) delete fRawReader; fRawReader=0;
- if (fClusterer) delete fClusterer; fClusterer=0;
-
- return 0;
-}
-
-int AliHLTTPCOfflineClustererComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
-{
- // see header file for class documentation
- HLTInfo("processing data");
-
- int iResult=0;
- int commonMinSlice=-1;
- int commonMaxSlice=-1;
- int commonMinPatch=-1;
- int commonMaxPatch=-1;
-
- for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC);
- pBlock!=NULL && iResult>=0;
- pBlock=GetNextInputBlock()) {
- int slice=AliHLTTPCDefinitions::GetMinSliceNr(pBlock->fSpecification);
- int patch=AliHLTTPCDefinitions::GetMinPatchNr(pBlock->fSpecification);
-
- if (slice!=AliHLTTPCDefinitions::GetMaxSliceNr(pBlock->fSpecification) ||
- patch!=AliHLTTPCDefinitions::GetMaxPatchNr(pBlock->fSpecification)) {
- HLTError("ambiguous readout partition (specification 0x%08x), skipping input block", pBlock->fSpecification);
- break;
- }
- if (slice<0 || slice>35 || patch<0 || patch>5) {
- HLTError("invalid readout partition %d/%d (specification 0x%08x, skipping input block", slice, patch, pBlock->fSpecification);
- break;
- }
-
- if (commonMinPatch<0) {
- commonMinSlice=slice;
- commonMaxSlice=slice;
- commonMinPatch=patch;
- commonMaxPatch=patch;
- } else {
- if (commonMinSlice<slice) commonMinSlice=slice;
- if (commonMaxSlice>slice) commonMinSlice=slice;
- if (commonMinPatch<patch) commonMinPatch=patch;
- if (commonMaxPatch>patch) commonMinPatch=patch;
- }
-
- if (fRawReader && fClusterer) {
- // setup raw reader and cluster finder
- int ddlId=AliDAQ::DdlIDOffset("TPC");
- if (patch<2) {
- ddlId+=2*slice+patch;
- } else {
- ddlId+=72;
- ddlId+=4*slice+patch-2;
- }
-
-#ifdef HAVE_NOT_ALIRAWREADERMEMORY_ADDBUFFER
- // AliRawReaderMemory does not support mulriple blocks,
- // process on block by block basis
- fRawReader->SetMemory( reinterpret_cast<UChar_t*>( pBlock->fPtr ), pBlock->fSize );
- fRawReader->SetEquipmentID(ddlId);
- iResult=RunClusterer(pBlock->fSpecification);
-#else //!HAVE_NOT_ALIRAWREADERMEMORY_ADDBUFFER
- // add all raw data blocks to one clusterer
- fRawReader->AddBuffer( reinterpret_cast<UChar_t*>( pBlock->fPtr ), pBlock->fSize, ddlId );
-#endif //HAVE_NOT_ALIRAWREADERMEMORY_ADDBUFFER
- }
- }
-
-#ifndef HAVE_NOT_ALIRAWREADERMEMORY_ADDBUFFER
- iResult=RunClusterer(AliHLTTPCDefinitions::EncodeDataSpecification(commonMinSlice,
- commonMaxSlice,
- commonMinPatch,
- commonMaxPatch));
- fRawReader->ClearBuffers();
-#endif //HAVE_NOT_ALIRAWREADERMEMORY_ADDBUFFER
-
- return iResult;
-}
-
-int AliHLTTPCOfflineClustererComponent::RunClusterer(AliHLTUInt32_t outspec)
-{
- // see header file for class documentation
- int iResult=0;
- {
- if (fRawReader && fClusterer) {
- // run the cluster finder
- fClusterer->Digits2Clusters(fRawReader);
-
- Int_t nbClusters = 0;
- TClonesArray* outClrow=NULL;
-#ifndef HAVE_NOT_TPCOFFLINE_REC
- outClrow=fClusterer->GetOutputClonesArray();
-
-#endif //HAVE_NOT_TPCOFFLINE_REC
-
- if (outClrow) {
- nbClusters = outClrow->GetEntriesFast() ;
-
- // insert TClonesArray of clusters into output stream
- PushBack(outClrow, kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC/*AliHLTTPCDefinitions::fgkOfflineClustersDataType*/, outspec);
-
- // clear array
- outClrow->Delete();
- }
- HLTInfo("processing done: Number of clusters %d (specification 0x%08x)", nbClusters, outspec);
-
- } else {
- HLTError("component not initialized");
- iResult=-EFAULT;
- }
- }
- return iResult;
-}
-
-int AliHLTTPCOfflineClustererComponent::Configure(const char* arguments)
-{
- // see header file for class documentation
- int iResult=0;
- if (!arguments) return iResult;
-
- TString allArgs=arguments;
- TString argument;
- int bMissingParam=0;
-
- TObjArray* pTokens=allArgs.Tokenize(" ");
- if (pTokens) {
- for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
- argument=((TObjString*)pTokens->At(i))->GetString();
- if (argument.IsNull()) continue;
-
- if (argument.CompareTo("-something")==0) {
- if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
-
- } else {
- HLTError("unknown argument %s", argument.Data());
- iResult=-EINVAL;
- break;
- }
- }
- delete pTokens;
- }
- if (bMissingParam) {
- HLTError("missing parameter for argument %s", argument.Data());
- iResult=-EINVAL;
- }
- return iResult;
-}
-
-int AliHLTTPCOfflineClustererComponent::Reconfigure(const char* /*cdbEntry*/, const char* /*chainId*/)
-{
- // see header file for class documentation
- int iResult=0;
- // CDB stuff needs to be implemented
- return iResult;
-}
+++ /dev/null
-//-*- Mode: C++ -*-
-// $Id$
-#ifndef ALIHLTTPCOFFLINECLUSTERFINDERCOMPONENT_H
-#define ALIHLTTPCOFFLINECLUSTERFINDERCOMPONENT_H
-
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* See cxx source for full Copyright notice */
-
-/** @file AliHLTTPCOfflineClustererComponent.h
- @author Matthias Richter
- @date
- @brief Wrapper component to the TPC offline cluster finder
-*/
-
-#include "AliHLTProcessor.h"
-class AliTPCRecoParam;
-class AliTPCParam;
-class AliTPCclustererMI;
-class AliRawReaderMemory;
-
-/**
- * @class AliHLTTPCOfflineClustererComponent
- * Wrapper component to the TPC offline cluster finder.
- *
- * The component interfaces the AliTPCclustererMI of the TPC offline code
- * to the online HLT. The component expects raw data as input and publishes
- * a full TreeR containing the cluster information.
- *
- * <h2>General properties:</h2>
- *
- * Component ID: \b TPCOfflineCF <br>
- * Library: \b libAliHLTTPC.so <br>
- * Input Data Types: @ref kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC <br>
- * Output Data Types: @ref kAliHLTDataTypeAliTreeR|kAliHLTDataOriginTPC <br>
- *
- * <h2>Mandatory arguments:</h2>
- * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
- *
- * <h2>Optional arguments:</h2>
- * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
- *
- * <h2>Configuration:</h2>
- * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
- *
- * <h2>Default CDB entries:</h2>
- * - so far the component does not load any configuration object
- *
- * <h2>Performance:</h2>
- * To be determined.
- *
- * <h2>Memory consumption:</h2>
- * To be determined.
- *
- * <h2>Output size:</h2>
- * To be determined.
- *
- * @ingroup alihlt_tpc_components
- */
-class AliHLTTPCOfflineClustererComponent : public AliHLTProcessor {
-public:
- AliHLTTPCOfflineClustererComponent();
- virtual ~AliHLTTPCOfflineClustererComponent();
-
- // AliHLTComponent interface functions
- const char* GetComponentID();
- void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
- AliHLTComponentDataType GetOutputDataType();
- void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
-
- // Spawn function, return new class instance
- AliHLTComponent* Spawn();
-
- protected:
- // AliHLTComponent interface functions
- int DoInit( int argc, const char** argv );
- int DoDeinit();
- int DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
- int Reconfigure(const char* cdbEntry, const char* chainId);
-
- using AliHLTProcessor::DoEvent;
-
-private:
- /** copy constructor prohibited */
- AliHLTTPCOfflineClustererComponent(const AliHLTTPCOfflineClustererComponent&);
- /** assignment operator prohibited */
- AliHLTTPCOfflineClustererComponent& operator=(const AliHLTTPCOfflineClustererComponent&);
-
- /**
- * Run the clusterer and PushBack the clusters with the given specification.
- * @param outspec data specification of the output block
- */
- int RunClusterer(AliHLTUInt32_t outspec);
-
- /**
- * Configure the component.
- * Parse a string for the configuration arguments and set the component
- * properties.
- */
- int Configure(const char* arguments);
-
- unsigned fOutputPercentage; //! Output volume in percentage of the input
- string fGeometryFileName; //! Geometry file with full path
-
- AliTPCRecoParam *fTPCRecoParam; //! TPC reco params
- AliTPCParam *fTPCGeomParam; //! TPC geometry params
-
- AliRawReaderMemory *fRawReader; //! Memory reader
- AliTPCclustererMI *fClusterer; //! TPC clusterer
-
- ClassDef(AliHLTTPCOfflineClustererComponent, 1)
-};
-#endif
+++ /dev/null
-// $Id$
-
-//**************************************************************************
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* *
-//* Primary Authors: Jacek Otwinowski <J.Otwinowski@gsi.de> *
-//* *
-//* 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 AliHLTTPCOfflineTrackerCalibComponent.cxx
- @author Jacek Otwinowski & Matthias Richter
- @date
- @brief Wrapper component to the TPC offline tracker (ONLY CALIBRATION)
-*/
-
-#include "AliHLTTPCOfflineTrackerCalibComponent.h"
-#include "TString.h"
-#include "TClonesArray.h"
-#include "TObjArray.h"
-#include "TObjString.h"
-#include "AliVParticle.h"
-#include "AliCDBManager.h"
-#include "AliCDBEntry.h"
-#include "AliGeomManager.h"
-#include "AliTPCReconstructor.h"
-#include "AliTPCParam.h"
-#include "AliTPCRecoParam.h"
-#include "AliTPCParamSR.h"
-#include "AliTPCtrackerMI.h"
-#include "AliTPCClustersRow.h"
-#include "AliTPCseed.h"
-#include "AliESDEvent.h"
-#include "AliHLTTPCDefinitions.h"
-
-/** ROOT macro for the implementation of ROOT specific class methods */
-ClassImp(AliHLTTPCOfflineTrackerCalibComponent)
-
-AliHLTTPCOfflineTrackerCalibComponent::AliHLTTPCOfflineTrackerCalibComponent() : AliHLTProcessor(),
-fGeometryFileName(""),
-fTPCGeomParam(0),
-fTracker(0),
-fESD(0)
-{
- // Default constructor
- fGeometryFileName = getenv("ALICE_ROOT");
- fGeometryFileName += "/HLT/TPCLib/offline/geometry.root";
-}
-
-AliHLTTPCOfflineTrackerCalibComponent::~AliHLTTPCOfflineTrackerCalibComponent()
-{
- // see header file for class documentation
-}
-
-const char* AliHLTTPCOfflineTrackerCalibComponent::GetComponentID()
-{
- // see header file for class documentation
- return "TPCOfflineTrackerCalib";
-}
-
-void AliHLTTPCOfflineTrackerCalibComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
-{
- // get input data type
- list.push_back(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC/*AliHLTTPCDefinitions::fgkOfflineClustersDataType*/);
-}
-
-AliHLTComponentDataType AliHLTTPCOfflineTrackerCalibComponent::GetOutputDataType()
-{
- // create output data type
- //return kAliHLTDataTypeESDObject|kAliHLTDataOriginTPC/*AliHLTTPCDefinitions::fgkOfflineTrackSegmentsDataType*/;
- return kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC;
-}
-
-void AliHLTTPCOfflineTrackerCalibComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
-{
- // get output data size
- constBase = 2000000;
- inputMultiplier = 1;
-}
-
-AliHLTComponent* AliHLTTPCOfflineTrackerCalibComponent::Spawn()
-{
- // create instance of the component
- return new AliHLTTPCOfflineTrackerCalibComponent;
-}
-
-int AliHLTTPCOfflineTrackerCalibComponent::DoInit( int argc, const char** argv )
-{
- // init configuration
- //
- int iResult=0;
-#ifdef HAVE_NOT_TPCOFFLINE_REC
- HLTFatal("AliRoot version > v4-13-Release required");
- return -ENOSYS;
-#endif
-
- TString argument="";
- TString configuration="";
- int bMissingParam=0;
-
- // loop over input parameters
- for (int i=0; i<argc && iResult>=0; i++) {
- argument=argv[i];
- if (argument.IsNull()) continue;
-
- if (argument.CompareTo("-geometry")==0) {
- if ((bMissingParam=(++i>=argc))) break;
-
- HLTInfo("got \'-geometry\' argument: %s", argv[i]);
- fGeometryFileName = argv[i];
- HLTInfo("Geometry file is: %s", fGeometryFileName.c_str());
-
- // the remaining arguments are treated as configuration
- } else {
- if (!configuration.IsNull()) configuration+=" ";
- configuration+=argument;
- }
- } // end loop
-
- if (bMissingParam) {
- HLTError("missing parameter for argument %s", argument.Data());
- iResult=-EINVAL;
- }
-
- if (iResult>=0 && !configuration.IsNull()) {
- iResult=Configure(configuration.Data());
- } else {
- iResult=Reconfigure(NULL, NULL);
- }
-
- //
- // initialisation
- //
-
- // Load geometry
- AliGeomManager::LoadGeometry(fGeometryFileName.c_str());
- if((AliGeomManager::GetGeometry()) == 0) {
- HLTError("Cannot load geometry from file %s",fGeometryFileName.c_str());
- iResult=-EINVAL;
- }
-
- // TPC reconstruction parameters
- AliTPCRecoParam * tpcRecoParam = AliTPCRecoParam::GetHLTParam();
- if(tpcRecoParam) {
- tpcRecoParam->SetClusterSharing(kTRUE);
-
- AliTPCReconstructor tpcReconstructor;
- tpcReconstructor.SetRecoParam(tpcRecoParam);
- }
-
- // TPC geometry parameters
- fTPCGeomParam = new AliTPCParamSR;
- if (fTPCGeomParam) {
- fTPCGeomParam->ReadGeoMatrices();
- }
-
- // Init tracker
- fTracker = new AliTPCtrackerMI(fTPCGeomParam);
-
- // AliESDEvent event needed by AliTPCtrackerMI
- // output of the component
- fESD = new AliESDEvent();
- if (fESD) {
- fESD->CreateStdContent();
- }
-
- if (!fTracker || !fESD || !fTPCGeomParam) {
- HLTError("failed creating internal objects");
- iResult=-ENOMEM;
- }
-
- if (iResult>=0) {
- // read the default CDB entries
- iResult=Reconfigure(NULL, NULL);
- }
-
- return iResult;
-}
-
-int AliHLTTPCOfflineTrackerCalibComponent::DoDeinit()
-{
- // deinit configuration
-
- if(fTPCGeomParam) delete fTPCGeomParam; fTPCGeomParam = 0;
- if(fTracker) delete fTracker; fTracker = 0;
- if(fESD) delete fESD; fESD = 0;
-
- return 0;
-}
-
-int AliHLTTPCOfflineTrackerCalibComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
-{
- // tracker function
- HLTInfo("DoEvent processing data");
-
- int iResult=0;
- TClonesArray *clusterArray=0;
- TObjArray *seedArray=0;
- int slice, patch;
-
- const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC);
- if(!pBlock) {
- HLTError("Cannot get first data block 0x%08x ",pBlock);
- iResult=-ENOMEM; return iResult;
- }
- int minSlice=AliHLTTPCDefinitions::GetMinSliceNr(pBlock->fSpecification);
- int maxSlice=AliHLTTPCDefinitions::GetMaxSliceNr(pBlock->fSpecification);
- int minPatch=AliHLTTPCDefinitions::GetMinPatchNr(pBlock->fSpecification);
- int maxPatch=AliHLTTPCDefinitions::GetMaxPatchNr(pBlock->fSpecification);
-
- if (fTracker && fESD) {
- // loop over input data blocks: TClonesArrays of clusters
- for (TObject *pObj = (TObject *)GetFirstInputObject(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC/*AliHLTTPCDefinitions::fgkOfflineClustersDataType*/,"TClonesArray",0);
- pObj !=0 && iResult>=0;
- pObj = (TObject *)GetNextInputObject(0)) {
- clusterArray = dynamic_cast<TClonesArray*>(pObj);
- if (!clusterArray) continue;
-
- HLTInfo("load %d clusters from block %s 0x%08x", clusterArray->GetEntries(), DataType2Text(GetDataType(pObj)).c_str(), GetSpecification(pObj));
- slice=AliHLTTPCDefinitions::GetMinSliceNr(GetSpecification(pObj));
- patch=AliHLTTPCDefinitions::GetMinPatchNr(GetSpecification(pObj));
-
- if(slice < minSlice) minSlice=slice;
- if(slice > maxSlice) maxSlice=slice;
- if(patch < minPatch) minPatch=patch;
- if(patch > maxPatch) maxPatch=patch;
-#ifndef HAVE_NOT_TPCOFFLINE_REC
- fTracker->LoadClusters(clusterArray);
-#endif //HAVE_NOT_TPCOFFLINE_REC
-
- clusterArray->Delete();
- }// end loop over input objects
-
-#ifndef HAVE_NOT_TPCOFFLINE_REC
- // Load outer sectors
- fTracker->LoadOuterSectors();
- // Load inner sectors
- fTracker->LoadInnerSectors();
-#endif
-
- // set magnetic field for the ESD, assumes correct initialization of
- // the field map
- fESD->SetMagneticField(AliTracker::GetBz());
-
- // run tracker
- fTracker->Clusters2Tracks(fESD);
-
- // get TPC seeds
- seedArray = fTracker->GetSeeds();
-
- Int_t nTracks = fESD->GetNumberOfTracks();
- HLTInfo("Number TPC tracks %d", nTracks);
-
- // calculate specification from the specification of input data blocks
- AliHLTUInt32_t iSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( minSlice, maxSlice, minPatch, maxPatch );
- HLTInfo("minSlice %d, maxSlice %d, minPatch %d, maxPatch %d", minSlice, maxSlice, minPatch, maxPatch);
-
- // send data
- if(seedArray) PushBack(seedArray, kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC, iSpecification);
-
- // delete seeds
- if(seedArray) seedArray->Delete();
-
- // unload clusters
- fTracker->UnloadClusters();
-
- // reset ESDs and ESDs friends
- fESD->Reset();
-
- } else {
- HLTError("component not initialized");
- iResult=-ENOMEM;
- }
-
- return iResult;
-}
-
-int AliHLTTPCOfflineTrackerCalibComponent::Configure(const char* arguments)
-{
- // see header file for class documentation
- int iResult=0;
- if (!arguments) return iResult;
-
- TString allArgs=arguments;
- TString argument;
- int bMissingParam=0;
-
- TObjArray* pTokens=allArgs.Tokenize(" ");
- if (pTokens) {
- for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
- argument=((TObjString*)pTokens->At(i))->GetString();
- if (argument.IsNull()) continue;
-
- if (argument.CompareTo("-solenoidBz")==0) {
- if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break;
- HLTWarning("argument -solenoidBz is deprecated, magnetic field set up globally (%f)", GetBz());
- continue;
- } else {
- HLTError("unknown argument %s", argument.Data());
- iResult=-EINVAL;
- break;
- }
- }
- delete pTokens;
- }
- if (bMissingParam) {
- HLTError("missing parameter for argument %s", argument.Data());
- iResult=-EINVAL;
- }
- return iResult;
-}
-
-int AliHLTTPCOfflineTrackerCalibComponent::Reconfigure(const char* cdbEntry, const char* chainId)
-{
- // see header file for class documentation
- int iResult=0;
- const char* path=kAliHLTCDBSolenoidBz;
-#ifdef __DEBUG
- const char* defaultNotify="";
-#endif
- if (cdbEntry) {
- path=cdbEntry;
-#ifdef __DEBUG
- defaultNotify=" (default)";
-#endif
- }
- if (path) {
- if (chainId) {} // just to get rid of warning, can not comment argument due to debug message
- HLTDebug("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
- AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
- if (pEntry) {
- TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
- if (pString) {
- HLTDebug("received configuration object string: \'%s\'", pString->GetString().Data());
- iResult=Configure(pString->GetString().Data());
- } else {
- HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
- }
- } else {
- HLTError("can not fetch object \"%s\" from CDB", path);
- }
- }
-
- return iResult;
-}
+++ /dev/null
-//-*- Mode: C++ -*-
-// $Id$
-#ifndef ALIHLTTPCOFFLINETRACKERCALIBCOMPONENT_H
-#define ALIHLTTPCOFFLINETRACKERCALIBCOMPONENT_H
-
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* See cxx source for full Copyright notice *
-
-/** @file AliHLTTPCOfflineTrackerCalibComponent.h
- @author Jacek Otwinowski & Matthias Richter
- @date
- @brief Wrapper component to the TPC offline tracker (ONLY CALIBRATION)
-*/
-
-#include "AliHLTProcessor.h"
-
-/**
- * @class AliHLTTPCOfflineTrackerCalibComponent
- * Wrapper component to a TPC offline tracker for calibration
- *
- * The component interfaces the AliTPCtrackerMI of the TPC offline code
- * to the online HLT (ONLY FOR CALIBRATION). The component expects a TClonesArray containing the
- * cluster information. The output are TPC seed in TObjArray.
- *
- * <h2>General properties:</h2>
- *
- * Component ID: \b TPCOfflineTrackerCalib <br>
- * Library: \b libAliHLTTPC.so <br>
- * Input Data Types: ::kAliHLTDataTypeTObjArray|::kAliHLTDataOriginTPC <br>
- * Output Data Types: ::kAliHLTDataTypeTObjArray|::kAliHLTDataOriginTPC <br>
- *
- * <h2>Mandatory arguments:</h2>
- * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
- *
- * <h2>Optional arguments:</h2>
- * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
- *
- * <h2>Configuration:</h2>
- * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
- *
- * <h2>Default CDB entries:</h2>
- * - loads magnetic field value from <tt>HLT/ConfigHLT/SolenoidBz</tt>.
- *
- * <h2>Performance:</h2>
- * To be determined.
- *
- * <h2>Memory consumption:</h2>
- * To be determined.
- *
- * <h2>Output size:</h2>
- * To be determined.
- *
- * @ingroup alihlt_tpc_components
- */
-
-class AliTPCParam;
-class AliTPCtrackerMI;
-class AliESDEvent;
-
-class AliHLTTPCOfflineTrackerCalibComponent : public AliHLTProcessor {
-public:
- AliHLTTPCOfflineTrackerCalibComponent();
- virtual ~AliHLTTPCOfflineTrackerCalibComponent();
-
- // AliHLTComponent interface functions
- const char* GetComponentID();
- void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
- AliHLTComponentDataType GetOutputDataType();
- void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
-
- // Spawn function, return new class instance
- AliHLTComponent* Spawn();
-
- protected:
- // AliHLTComponent interface functions
- int DoInit( int argc, const char** argv );
- int DoDeinit();
- int DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
- int Reconfigure(const char* cdbEntry, const char* chainId);
-
- using AliHLTProcessor::DoEvent;
-
-private:
- /** copy constructor prohibited */
- AliHLTTPCOfflineTrackerCalibComponent(const AliHLTTPCOfflineTrackerCalibComponent&);
- /** assignment operator prohibited */
- AliHLTTPCOfflineTrackerCalibComponent& operator=(const AliHLTTPCOfflineTrackerCalibComponent&);
-
- string fGeometryFileName; //! Geometry file with full path
- AliTPCParam *fTPCGeomParam; //! TPC geometry params
-
- AliTPCtrackerMI *fTracker; //! TPC tracker
- AliESDEvent *fESD; //! AliESDEvent needed by TPC tracker
-
- /**
- * Configure the component.
- * Parse a string for the configuration arguments and set the component
- * properties.
- */
- int Configure(const char* arguments);
-
- ClassDef(AliHLTTPCOfflineTrackerCalibComponent, 0)
-};
-#endif
+++ /dev/null
-// $Id$
-
-//**************************************************************************
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* *
-//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
-//* *
-//* 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 AliHLTTPCOfflineTrackerComponent.cxx
- @author Jacek Otwinowski & Matthias Richter
- @date
- @brief Wrapper component to the TPC offline tracker
-*/
-
-#include "AliHLTTPCOfflineTrackerComponent.h"
-#include "TString.h"
-#include "TClonesArray.h"
-#include "TObjArray.h"
-#include "TObjString.h"
-#include "AliVParticle.h"
-#include "AliCDBManager.h"
-#include "AliCDBEntry.h"
-#include "AliGeomManager.h"
-#include "AliTPCReconstructor.h"
-#include "AliTPCParam.h"
-#include "AliTPCRecoParam.h"
-#include "AliTPCParamSR.h"
-#include "AliTPCtrackerMI.h"
-#include "AliTPCClustersRow.h"
-#include "AliTPCseed.h"
-#include "AliESDEvent.h"
-#include "AliHLTTPCDefinitions.h"
-
-/** ROOT macro for the implementation of ROOT specific class methods */
-ClassImp(AliHLTTPCOfflineTrackerComponent)
-
-AliHLTTPCOfflineTrackerComponent::AliHLTTPCOfflineTrackerComponent() : AliHLTProcessor(),
-fGeometryFileName(""),
-fTPCGeomParam(0),
-fTracker(0),
-fESD(0)
-{
- // Default constructor
- fGeometryFileName = getenv("ALICE_ROOT");
- fGeometryFileName += "/HLT/TPCLib/offline/geometry.root";
-}
-
-AliHLTTPCOfflineTrackerComponent::~AliHLTTPCOfflineTrackerComponent()
-{
- // see header file for class documentation
-}
-
-const char* AliHLTTPCOfflineTrackerComponent::GetComponentID()
-{
- // see header file for class documentation
- return "TPCOfflineTracker";
-}
-
-void AliHLTTPCOfflineTrackerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
-{
- // get input data type
- list.push_back(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC/*AliHLTTPCDefinitions::fgkOfflineClustersDataType*/);
-}
-
-AliHLTComponentDataType AliHLTTPCOfflineTrackerComponent::GetOutputDataType()
-{
- // create output data type
- return kAliHLTDataTypeESDObject|kAliHLTDataOriginTPC/*AliHLTTPCDefinitions::fgkOfflineTrackSegmentsDataType*/;
-}
-
-void AliHLTTPCOfflineTrackerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
-{
- // get output data size
- constBase = 2000000;
- inputMultiplier = 1;
-}
-
-AliHLTComponent* AliHLTTPCOfflineTrackerComponent::Spawn()
-{
- // create instance of the component
- return new AliHLTTPCOfflineTrackerComponent;
-}
-
-int AliHLTTPCOfflineTrackerComponent::DoInit( int argc, const char** argv )
-{
- // init configuration
- //
- int iResult=0;
-#ifdef HAVE_NOT_TPCOFFLINE_REC
- HLTFatal("AliRoot version > v4-13-Release required");
- return -ENOSYS;
-#endif
-
- TString argument="";
- TString configuration="";
- int bMissingParam=0;
-
- // loop over input parameters
- for (int i=0; i<argc && iResult>=0; i++) {
- argument=argv[i];
- if (argument.IsNull()) continue;
-
- if (argument.CompareTo("-geometry")==0) {
- if ((bMissingParam=(++i>=argc))) break;
-
- HLTInfo("got \'-geometry\' argument: %s", argv[i]);
- fGeometryFileName = argv[i];
- HLTInfo("Geometry file is: %s", fGeometryFileName.c_str());
-
- // the remaining arguments are treated as configuration
- } else {
- if (!configuration.IsNull()) configuration+=" ";
- configuration+=argument;
- }
- } // end loop
-
- if (bMissingParam) {
- HLTError("missing parameter for argument %s", argument.Data());
- iResult=-EINVAL;
- }
-
- if (iResult>=0 && !configuration.IsNull()) {
- iResult=Configure(configuration.Data());
- } else {
- iResult=Reconfigure(NULL, NULL);
- }
-
- //
- // initialisation
- //
-
- // Load geometry
- AliGeomManager::LoadGeometry(fGeometryFileName.c_str());
- if((AliGeomManager::GetGeometry()) == 0) {
- HLTError("Cannot load geometry from file %s",fGeometryFileName.c_str());
- iResult=-EINVAL;
- }
-
- // TPC reconstruction parameters
- AliTPCRecoParam * tpcRecoParam = AliTPCRecoParam::GetHLTParam();
- if(tpcRecoParam) {
- tpcRecoParam->SetClusterSharing(kTRUE);
-
- AliTPCReconstructor tpcReconstructor;
- tpcReconstructor.SetRecoParam(tpcRecoParam);
- }
-
- // TPC geometry parameters
- fTPCGeomParam = new AliTPCParamSR;
- if (fTPCGeomParam) {
- fTPCGeomParam->ReadGeoMatrices();
- }
-
- // Init tracker
- fTracker = new AliTPCtrackerMI(fTPCGeomParam);
-
- // AliESDEvent event needed by AliTPCtrackerMI
- // output of the component
- fESD = new AliESDEvent();
- if (fESD) {
- fESD->CreateStdContent();
- }
-
- if (!fTracker || !fESD || !fTPCGeomParam) {
- HLTError("failed creating internal objects");
- iResult=-ENOMEM;
- }
-
- if (iResult>=0) {
- // read the default CDB entries
- iResult=Reconfigure(NULL, NULL);
- }
-
- return iResult;
-}
-
-int AliHLTTPCOfflineTrackerComponent::DoDeinit()
-{
- // deinit configuration
-
- if(fTPCGeomParam) delete fTPCGeomParam; fTPCGeomParam = 0;
- if(fTracker) delete fTracker; fTracker = 0;
- if(fESD) delete fESD; fESD = 0;
-
- return 0;
-}
-
-int AliHLTTPCOfflineTrackerComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
-{
- // tracker function
- HLTInfo("DoEvent processing data");
-
- int iResult=0;
- TClonesArray *clusterArray=0;
- int slice, patch;
-
- const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC);
- if(!pBlock) {
- HLTError("Cannot get first data block 0x%08x ",pBlock);
- iResult=-ENOMEM; return iResult;
- }
- int minSlice=AliHLTTPCDefinitions::GetMinSliceNr(pBlock->fSpecification);
- int maxSlice=AliHLTTPCDefinitions::GetMaxSliceNr(pBlock->fSpecification);
- int minPatch=AliHLTTPCDefinitions::GetMinPatchNr(pBlock->fSpecification);
- int maxPatch=AliHLTTPCDefinitions::GetMaxPatchNr(pBlock->fSpecification);
-
- if (fTracker && fESD) {
- // loop over input data blocks: TClonesArrays of clusters
- for (TObject *pObj = (TObject *)GetFirstInputObject(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC/*AliHLTTPCDefinitions::fgkOfflineClustersDataType*/,"TClonesArray",0);
- pObj !=0 && iResult>=0;
- pObj = (TObject *)GetNextInputObject(0)) {
- clusterArray = dynamic_cast<TClonesArray*>(pObj);
- if (!clusterArray) continue;
-
- HLTInfo("load %d clusters from block %s 0x%08x", clusterArray->GetEntries(), DataType2Text(GetDataType(pObj)).c_str(), GetSpecification(pObj));
- slice=AliHLTTPCDefinitions::GetMinSliceNr(GetSpecification(pObj));
- patch=AliHLTTPCDefinitions::GetMinPatchNr(GetSpecification(pObj));
-
- if(slice < minSlice) minSlice=slice;
- if(slice > maxSlice) maxSlice=slice;
- if(patch < minPatch) minPatch=patch;
- if(patch > maxPatch) maxPatch=patch;
-#ifndef HAVE_NOT_TPCOFFLINE_REC
- fTracker->LoadClusters(clusterArray);
-#endif //HAVE_NOT_TPCOFFLINE_REC
-
- clusterArray->Delete();
- }// end loop over input objects
-
-#ifndef HAVE_NOT_TPCOFFLINE_REC
- // Load outer sectors
- fTracker->LoadOuterSectors();
- // Load inner sectors
- fTracker->LoadInnerSectors();
-#endif
-
- // set magnetic field for the ESD, assumes correct initialization of
- // the field map
- fESD->SetMagneticField(AliTracker::GetBz());
-
- // run tracker
- fTracker->Clusters2Tracks(fESD);
-
- // unload clusters
- fTracker->UnloadClusters();
-
- Int_t nTracks = fESD->GetNumberOfTracks();
- HLTInfo("Number TPC tracks %d", nTracks);
-
- // calculate specification from the specification of input data blocks
- AliHLTUInt32_t iSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( minSlice, maxSlice, minPatch, maxPatch );
- HLTInfo("minSlice %d, maxSlice %d, minPatch %d, maxPatch %d", minSlice, maxSlice, minPatch, maxPatch);
-
- // send data
- PushBack(fESD, kAliHLTDataTypeESDObject|kAliHLTDataOriginTPC, iSpecification);
-
- // reset ESDs and ESDs friends
- fESD->Reset();
-
- } else {
- HLTError("component not initialized");
- iResult=-ENOMEM;
- }
-
- return iResult;
-}
-
-int AliHLTTPCOfflineTrackerComponent::Configure(const char* arguments)
-{
- // see header file for class documentation
- int iResult=0;
- if (!arguments) return iResult;
-
- TString allArgs=arguments;
- TString argument;
- int bMissingParam=0;
-
- TObjArray* pTokens=allArgs.Tokenize(" ");
- if (pTokens) {
- for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
- argument=((TObjString*)pTokens->At(i))->GetString();
- if (argument.IsNull()) continue;
-
- if (argument.CompareTo("-solenoidBz")==0) {
- if ( ( bMissingParam = ( ++i >= pTokens->GetEntries() ) ) ) break;
- HLTWarning("argument -solenoidBz is deprecated, magnetic field set up globally (%f)", GetBz());
- continue;
- } else {
- HLTError("unknown argument %s", argument.Data());
- iResult=-EINVAL;
- break;
- }
- }
- delete pTokens;
- }
- if (bMissingParam) {
- HLTError("missing parameter for argument %s", argument.Data());
- iResult=-EINVAL;
- }
- return iResult;
-}
-
-int AliHLTTPCOfflineTrackerComponent::Reconfigure(const char* cdbEntry, const char* chainId)
-{
- // see header file for class documentation
- int iResult=0;
- const char* path=kAliHLTCDBSolenoidBz;
-#ifdef __DEBUG
- const char* defaultNotify="";
-#endif
- if (cdbEntry) {
- path=cdbEntry;
-#ifdef __DEBUG
- defaultNotify=" (default)";
-#endif
- }
- if (path) {
- if (chainId) {} // just to get rid of warning, can not comment argument due to debug message
- HLTDebug("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
- AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
- if (pEntry) {
- TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
- if (pString) {
- HLTDebug("received configuration object string: \'%s\'", pString->GetString().Data());
- iResult=Configure(pString->GetString().Data());
- } else {
- HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
- }
- } else {
- HLTError("can not fetch object \"%s\" from CDB", path);
- }
- }
-
- return iResult;
-}
+++ /dev/null
-//-*- Mode: C++ -*-
-// $Id$
-#ifndef ALIHLTTPCOFFLINETRACKERCOMPONENT_H
-#define ALIHLTTPCOFFLINETRACKERCOMPONENT_H
-
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* See cxx source for full Copyright notice *
-
-/** @file AliHLTTPCOfflineTrackerComponent.h
- @author Matthias Richter
- @date
- @brief Wrapper component to the TPC offline cluster finder
-*/
-
-#include "AliHLTProcessor.h"
-
-/**
- * @class AliHLTTPCOfflineTrackerComponent
- * Wrapper component to the TPC offline tracker.
- *
- * The component interfaces the AliTPCtrackerMI of the TPC offline code
- * to the online HLT. The component expects a TClonesArray containing the
- * cluster information. The output is in ESD format.
- *
- * <h2>General properties:</h2>
- *
- * Component ID: \b TPCOfflineTracker <br>
- * Library: \b libAliHLTTPC.so <br>
- * Input Data Types: ::kAliHLTDataTypeTObjArray|::kAliHLTDataOriginTPC <br>
- * Output Data Types: ::kAliHLTDataTypeESDTree|::kAliHLTDataOriginTPC <br>
- *
- * <h2>Mandatory arguments:</h2>
- * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
- *
- * <h2>Optional arguments:</h2>
- * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
- *
- * <h2>Configuration:</h2>
- * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
- *
- * <h2>Default CDB entries:</h2>
- * - loads magnetic field value from <tt>HLT/ConfigHLT/SolenoidBz</tt>.
- *
- * <h2>Performance:</h2>
- * To be determined.
- *
- * <h2>Memory consumption:</h2>
- * To be determined.
- *
- * <h2>Output size:</h2>
- * To be determined.
- *
- * @ingroup alihlt_tpc_components
- */
-
-class AliTPCParam;
-class AliTPCtrackerMI;
-class AliESDEvent;
-
-class AliHLTTPCOfflineTrackerComponent : public AliHLTProcessor {
-public:
- AliHLTTPCOfflineTrackerComponent();
- virtual ~AliHLTTPCOfflineTrackerComponent();
-
- // AliHLTComponent interface functions
- const char* GetComponentID();
- void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
- AliHLTComponentDataType GetOutputDataType();
- void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
-
- // Spawn function, return new class instance
- AliHLTComponent* Spawn();
-
- protected:
- // AliHLTComponent interface functions
- int DoInit( int argc, const char** argv );
- int DoDeinit();
- int DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
- int Reconfigure(const char* cdbEntry, const char* chainId);
-
- using AliHLTProcessor::DoEvent;
-
-private:
- /** copy constructor prohibited */
- AliHLTTPCOfflineTrackerComponent(const AliHLTTPCOfflineTrackerComponent&);
- /** assignment operator prohibited */
- AliHLTTPCOfflineTrackerComponent& operator=(const AliHLTTPCOfflineTrackerComponent&);
-
- string fGeometryFileName; //! Geometry file with full path
- AliTPCParam *fTPCGeomParam; //! TPC geometry params
-
- AliTPCtrackerMI *fTracker; //! TPC tracker
- AliESDEvent *fESD; //! AliESDEvent needed by TPC tracker
-
- /**
- * Configure the component.
- * Parse a string for the configuration arguments and set the component
- * properties.
- */
- int Configure(const char* arguments);
-
- ClassDef(AliHLTTPCOfflineTrackerComponent, 1)
-};
-#endif