-#include "AliTrackPoints.h"
-//_________________________________
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * 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. *
+ **************************************************************************/
+
+/* $Id$ */
+
////////////////////////////////////////////////////////////
// //
// class AliTrackPoints //
// //
////////////////////////////////////////////////////////////
+#include "AliTrackPoints.h"
+#include "AliLog.h"
+
#include <TClonesArray.h>
#include <TFile.h>
#include <TMath.h>
#include "AliTrackReference.h"
#include "AliITStrackV2.h"
+#include "AliRun.h"
+#include "AliMagF.h"
+#include "AliTracker.h"
+#include "AliESD.h"
+#include "AliRunLoader.h"
+#include "AliTPCtrack.h"
+#include "TTree.h"
+#include "TBranch.h"
+#include "TH2D.h"
+
ClassImp(AliTrackPoints)
Int_t AliTrackPoints::fgDebug = 0;
{
//constructor
}
+
/***************************************************************/
AliTrackPoints::AliTrackPoints(AliTrackPoints::ETypes type, AliESDtrack* track, Float_t mf):
}
}
+
/***************************************************************/
AliTrackPoints::AliTrackPoints(Int_t n, AliESDtrack* track, Float_t mf, Float_t dr, Float_t r0):
((track->GetStatus() & AliESDtrack::kTPCin) == kFALSE) )
{
//could happend: its stand alone tracking
- if (GetDebug() > 3)
- Warning("AliTrackPoints","This ESD track does not contain TPC information");
+ AliDebug(3,"This ESD track does not contain TPC information");
fN = 0;
delete [] fX;
return;
}
- Double_t x;
+ Double_t alpha,x;
Double_t par[5];
- track->GetInnerExternalParameters(x,par); //get properties of the track
+ track->GetInnerExternalParameters(alpha,x,par);//get properties of the track
if (par[4] == 0)
{
Error("AliTrackPoints","This ESD track seem not to contain TPC information (curv is 0)");
return;
}
- Double_t alpha = track->GetInnerAlpha();
+ //Double_t alpha = track->GetInnerAlpha();
Double_t cc = 1000./0.299792458/mf;//conversion constant
Double_t c=par[4]/cc;
MakePoints(dr,r0,x,par,c,alpha);
}
+
/***************************************************************/
AliTrackPoints::AliTrackPoints(Int_t n, AliTPCtrack* track, Float_t dr, Float_t r0):
Double_t alpha = track->GetAlpha();
Double_t c=track->GetC();
MakePoints(dr,r0,x,par,c,alpha);
-}
+}
+
/***************************************************************/
AliTrackPoints::~AliTrackPoints()
delete [] fY;
delete [] fZ;
}
+
/***************************************************************/
void AliTrackPoints::MakePoints( Float_t dr, Float_t r0, Double_t x, Double_t* par, Double_t c, Double_t alpha)
Double_t r = TMath::Hypot(x,y);
- if (GetDebug() > 9)
- Info("AliTrackPoints","Radius0 %f, Real Radius %f",r0,r);
+ AliDebug(9,Form("Radius0 %f, Real Radius %f",r0,r));
- if (GetDebug() > 5)
- Info("AliTrackPoints","Phi Global at first padraw %f, Phi locat %f",phi0global,phi0local);
+ AliDebug(5,Form("Phi Global at first padraw %f, Phi locat %f",phi0global,phi0local));
Double_t eta = x*c - par[2] ;//par[2] = fX*C - eta; eta==fP2 ; C==fP4
Double_t ftmp = (c2*rc + cst1/rc)/cst2;
if (ftmp > 1.0)
{
- if (GetDebug() > 1)
- Warning("AliTrackPoints","ASin argument > 1 %f:",ftmp);
+ AliDebug(1,Form("ASin argument > 1 %f:",ftmp));
ftmp=1.0;
}
else if (ftmp < -1.0)
{
- if (GetDebug() > 1)
- Warning("AliTrackPoints","ASin argument < -1 %f:",ftmp);
+ AliDebug(1,Form("ASin argument < -1 %f:",ftmp));
ftmp=-1.0;
}
ftmp = (rc*rc-dcasq)/cst2;
if (ftmp < 0.0)
{
- if (GetDebug() > 1)
- Warning("AliTrackPoints","Sqrt argument < 0: %f",ftmp);
+ AliDebug(1,Form("Sqrt argument < 0: %f",ftmp));
ftmp=0.0;
}
ftmp = c2*TMath::Sqrt(ftmp);
if (ftmp > 1.0)
{
- if (GetDebug() > 1)
- Warning("AliTrackPoints","ASin argument > 1: %f",ftmp);
+ AliDebug(1,Form("ASin argument > 1: %f",ftmp));
ftmp=1.0;
}
else if (ftmp < -1.0)
{
- if (GetDebug() > 1)
- Warning("AliTrackPoints","ASin argument < -1: %f",ftmp);
+ AliDebug(2,Form("ASin argument < -1: %f",ftmp));
ftmp=-1.0;
}
Double_t factorZ = TMath::ASin(ftmp)*par[3]/c2;
fX[i] = rc*TMath::Cos(phi);
fY[i] = rc*TMath::Sin(phi);
- if ( GetDebug() > 2 )
- {
- Info("AliTrackPoints","X %f Y %f Z %f R asked %f R obtained %f",
- fX[i],fY[i],fZ[i],rc,TMath::Hypot(fX[i],fY[i]));
- }
+ AliDebug(3,Form("AliTrackPoints","X %f Y %f Z %f R asked %f R obtained %f",
+ fX[i],fY[i],fZ[i],rc,TMath::Hypot(fX[i],fY[i])));
}
}
+
/***************************************************************/
void AliTrackPoints::MakeITSPoints(AliESDtrack* track)
// z=R*Pz/Pt
AliITStrackV2 itstrack(*track,kTRUE);
Double_t x,y,z;
- static const Double_t r[6] = {4.0, 7.0, 14.9, 23.8, 39.1, 43.6};
+ static const Double_t kR[6] = {4.0, 7.0, 14.9, 23.8, 39.1, 43.6};
for (Int_t i = 0; i < 6; i++)
{
- itstrack.GetGlobalXYZat(r[i],x,y,z);
+ itstrack.GetGlobalXYZat(kR[i],x,y,z);
fX[i] = x;
fY[i] = y;
fZ[i] = z;
}
/***************************************************************/
+
void AliTrackPoints::MakeITSPointsInnerFromVertexOuterFromTPC(AliESDtrack* track, Float_t mf)
{
//makes trackpoints for ITS
//for 3 inner layers calculates out of the vector at vertex
//for 3 outer ---------------//------------------ at inner TPC
- static const Double_t r[6] = {4.0, 7.0, 14.9, 23.8, 39.1, 43.6};
+ static const Double_t kR[6] = {4.0, 7.0, 14.9, 23.8, 39.1, 43.6};
AliITStrackV2 itstrack(*track,kTRUE);
Double_t x,y,z;
for (Int_t i = 0; i < 3; i++)
{
- itstrack.GetGlobalXYZat(r[i],x,y,z);
+ itstrack.GetGlobalXYZat(kR[i],x,y,z);
fX[i] = x;
fY[i] = y;
fZ[i] = z;
- Info("MakeITSPoints","X %f Y %f Z %f R asked %f R obtained %f",
- fX[i],fY[i],fZ[i],r[i],TMath::Hypot(fX[i],fY[i]));
+ AliDebug(3,Form("X %f Y %f Z %f R asked %f R obtained %f",
+ fX[i],fY[i],fZ[i],kR[i],TMath::Hypot(fX[i],fY[i])));
}
for (Int_t i = 3; i < 6; i++)
{
Float_t ax,ay,az;
- AliTrackPoints tmptp(1,track,mf,0,r[i]);
+ AliTrackPoints tmptp(1,track,mf,0,kR[i]);
tmptp.PositionAt(0,ax,ay,az);
fX[i] = ax;
fY[i] = ay;
fZ[i] = az;
- Info("MakeITSPoints","X %f Y %f Z %f R asked %f R obtained %f",
- fX[i],fY[i],fZ[i],r[i],TMath::Hypot(fX[i],fY[i]));
+ AliDebug(3,Form("X %f Y %f Z %f R asked %f R obtained %f",
+ fX[i],fY[i],fZ[i],kR[i],TMath::Hypot(fX[i],fY[i])));
}
}
-
/***************************************************************/
void AliTrackPoints::PositionAt(Int_t n, Float_t &x,Float_t &y,Float_t &z)
{
//returns position at point n
- if ((n<0) || (n>fN))
+ if ((n<0) || (n>=fN))
{
Error("PositionAt","Point %d out of range",n);
return;
x = fX[n];
y = fY[n];
z = fZ[n];
- if ( GetDebug() > 1 )
- {
- Info("AliTrackPoints","n %d; X %f; Y %f; Z %f",n,x,y,z);
- }
+ AliDebug(2,Form("n %d; X %f; Y %f; Z %f",n,x,y,z));
+
}
+
/***************************************************************/
void AliTrackPoints::Move(Float_t x, Float_t y, Float_t z)
fZ[i]+=z;
}
}
+
/***************************************************************/
Double_t AliTrackPoints::AvarageDistance(const AliTrackPoints& tr)
// Info("AvarageDistance","Entered");
if ( (fN <= 0) || (tr.fN <=0) )
{
- if (GetDebug()) Warning("AvarageDistance","One of tracks is empty");
+ AliDebug(1,"One of tracks is empty");
return -1;
}
Double_t sum = 0;
for (Int_t i = 0; i<fN; i++)
{
- if (GetDebug()>9)
- {
+ AliDebug(10,Form("radii: %f %f",TMath::Hypot(fX[i],fY[i]),TMath::Hypot(tr.fX[i],tr.fY[i])));
// Float_t r1sq = fX[i]*fX[i]+fY[i]*fY[i];
// Float_t r2sq = tr.fX[i]*tr.fX[i]+tr.fY[i]*tr.fY[i];
- Float_t r1sq = TMath::Hypot(fX[i],fY[i]);
- Float_t r2sq = TMath::Hypot(tr.fX[i],tr.fY[i]);
- Info("AvarageDistance","radii: %f %f",r1sq,r2sq);
- }
Double_t dx = fX[i]-tr.fX[i];
Double_t dz = fZ[i]-tr.fZ[i];
sum+=TMath::Sqrt(dx*dx + dy*dy + dz*dz);
- if (GetDebug()>1)
- {
- Info("AvarageDistance","Diff: x ,y z: %f , %f, %f",dx,dy,dz);
- Info("AvarageDistance","xxyyzz %f %f %f %f %f %f",
- fX[i],tr.fX[i],fY[i],tr.fY[i],fZ[i],tr.fZ[i]);
- }
+ AliDebug(2,Form("Diff: x ,y z: %f , %f, %f",dx,dy,dz));
+ AliDebug(2,Form("xxyyzz %f %f %f %f %f %f",
+ fX[i],tr.fX[i],fY[i],tr.fY[i],fZ[i],tr.fZ[i]));
}
Double_t retval = sum/((Double_t)fN);
- if ( GetDebug() )
- {
- Info("AvarageDistance","Avarage distance is %f.",retval);
- }
+ AliDebug(1,Form("Avarage distance is %f.",retval));
+
return retval;
}
-/***************************************************************/
-/***************************************************************/
-/***************************************************************/
-/***************************************************************/
-/***************************************************************/
-/***************************************************************/
-#include "AliRun.h"
-#include "AliESD.h"
-#include "AliRunLoader.h"
-#include "AliTPCtrack.h"
-#include "TTree.h"
-#include "TBranch.h"
-#include "TH2D.h"
-#include "TCanvas.h"
-#include "AliMagF.h"
+/***************************************************************/
+void AliTrackPoints::Print(Option_t* /*option*/) const
+{
+ // Prints the coordinates of the track points
+ Info("Print","There is %d points",fN);
+ for(Int_t i = 0; i < fN; i++)
+ {
+ Info("Print","%d: %f %f %f",i,fX[i],fY[i],fZ[i]);
+ }
+}
+/***************************************************************/
void AliTrackPoints::Testesd(Int_t entr,const char* fname )
{
+ // This is a former macro converted to member function.
+ // It is used to test the functionality of the class using ESD tracks
delete gAlice;
gAlice = 0x0;
AliRunLoader* rl = AliRunLoader::Open();
}
- Int_t N = 170;
- AliTrackPoints* tp = new AliTrackPoints(N,t,mf,1.);
+ Int_t nTrackPoints = 170;
+ AliTrackPoints* tp = new AliTrackPoints(nTrackPoints,t,mf,1.);
Float_t xmin = -250;
Float_t xmax = 250;
Float_t x,y,z;
- for (Int_t i = 0;i<N;i++)
+ for (Int_t i = 0;i<nTrackPoints;i++)
{
Double_t r = 84.1+i;
tp->PositionAt(i,x,y,z);
delete rl;
}
-/***************************************************************/
-/***************************************************************/
/***************************************************************/
void AliTrackPoints::Testtpc(Int_t entr)
{
+ // This is a former macro converted to member function.
+ // It is used to test the functionality of the class using TPC tracks
delete gAlice;
gAlice = 0x0;
AliRunLoader* rl = AliRunLoader::Open();
AliLoader* l = rl->GetLoader("TPCLoader");
rl->LoadgAlice();
- AliKalmanTrack::SetConvConst(100/0.299792458/0.2/rl->GetAliRun()->Field()->Factor());
+ AliTracker::SetFieldMap(rl->GetAliRun()->Field(),kTRUE);
l->LoadTracks();
AliTPCtrack* t = new AliTPCtrack();
TBranch* b=l->TreeT()->GetBranch("tracks");
b->SetAddress(&t);
l->TreeT()->GetEntry(entr);
- Int_t N = 160;
- AliTrackPoints* tp = new AliTrackPoints(N,t,1.);
+ Int_t nTrackPoints = 160;
+ AliTrackPoints* tp = new AliTrackPoints(nTrackPoints,t,1.);
Float_t xmin = -250;
Float_t xmax = 250;
Float_t x,y,z;
- for (Int_t i = 0;i<N;i++)
+ for (Int_t i = 0;i<nTrackPoints;i++)
{
Double_t r = 84.1+i;
tp->PositionAt(i,x,y,z);
hxz->Fill(x,z);
printf("Rdemanded %f\n",r);
printf("tpx %f tpy %f tpz %f Rt =%f\n", x,y,z,TMath::Hypot(x,y));
-
+
//BUT they are local!!!!
t->PropagateTo(r);
// Double_t phi = t->Phi();
- Double_t rl = TMath::Hypot(t->GetX(),t->GetY());//real radius
+ Double_t rL = TMath::Hypot(t->GetX(),t->GetY());//real radius
Double_t alpha = t->GetAlpha();
Double_t salpha = TMath::Sin(alpha);
y = t->GetX()*salpha + t->GetY()*calpha;
z = t->GetZ();
- printf("tx %f ty %f tz %f Rt = %f R from XY %f\n",x,y,z,TMath::Hypot(x,y),rl);
+ printf("tx %f ty %f tz %f Rt = %f R from XY %f\n",x,y,z,TMath::Hypot(x,y),rL);
printf("tpz - tz %f\n",z-t->GetZ());
printf("\n");