From 8759443599df9d4fb1db934ff6c342750084b41f Mon Sep 17 00:00:00 2001 From: fca Date: Fri, 22 Sep 2000 11:42:40 +0000 Subject: [PATCH] Adding Cluster and KalmanTrack classes from J.Belikov --- STEER/AliCluster.cxx | 43 +++++++++++ STEER/AliCluster.h | 43 +++++++++++ STEER/AliKalmanTrack.cxx | 153 +++++++++++++++++++++++++++++++++++++++ STEER/AliKalmanTrack.h | 60 +++++++++++++++ STEER/Makefile | 3 +- STEER/STEERLinkDef.h | 2 + 6 files changed, 303 insertions(+), 1 deletion(-) create mode 100644 STEER/AliCluster.cxx create mode 100644 STEER/AliCluster.h create mode 100644 STEER/AliKalmanTrack.cxx create mode 100644 STEER/AliKalmanTrack.h diff --git a/STEER/AliCluster.cxx b/STEER/AliCluster.cxx new file mode 100644 index 00000000000..13ac2d86a88 --- /dev/null +++ b/STEER/AliCluster.cxx @@ -0,0 +1,43 @@ +/************************************************************************** + * 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. * + **************************************************************************/ + +//------------------------------------------------------------------------- +// Implementation of the Cluster class +// +// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch +//------------------------------------------------------------------------- + +#include "AliCluster.h" + +ClassImp(AliCluster) + +//_____________________________________________________________________________ +AliCluster::AliCluster() { + //default constructor + fTracks[0]=fTracks[1]=fTracks[2]=-3141593; + fY=fZ=fSigmaY2=fSigmaZ2=0.; +} + +//_____________________________________________________________________________ +AliCluster::AliCluster(Int_t *lab, Float_t *hit) { + //Creates a simulated cluster + fTracks[0] = lab[0]; + fTracks[1] = lab[1]; + fTracks[2] = lab[2]; + fY = hit[0]; + fZ = hit[1]; + fSigmaY2 = hit[2]; + fSigmaZ2 = hit[3]; +} diff --git a/STEER/AliCluster.h b/STEER/AliCluster.h new file mode 100644 index 00000000000..c4fc46e3bb3 --- /dev/null +++ b/STEER/AliCluster.h @@ -0,0 +1,43 @@ +#ifndef ALICLUSTER_H +#define ALICLUSTER_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +//------------------------------------------------------------------------- +// Class AliCluster +// +// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch +//------------------------------------------------------------------------- + +#include + +//_____________________________________________________________________________ +class AliCluster : public TObject { +public: + AliCluster(); + AliCluster(Int_t *lab, Float_t *hit); + void SetLabel(Int_t lab, Int_t i) {fTracks[i]=lab;} + void SetY(Float_t y) {fY=y;} + void SetZ(Float_t z) {fZ=z;} + void SetSigmaY2(Float_t sy2) {fSigmaY2=sy2;} + void SetSigmaZ2(Float_t sz2) {fSigmaZ2=sz2;} + + Int_t GetLabel(Int_t i) const {return fTracks[i];} + Float_t GetY() const {return fY;} + Float_t GetZ() const {return fZ;} + Float_t GetSigmaY2() const {return fSigmaY2;} + Float_t GetSigmaZ2() const {return fSigmaZ2;} + +protected: + Int_t fTracks[3];//labels of overlapped tracks + Float_t fY ; //Y of cluster + Float_t fZ ; //Z of cluster + Float_t fSigmaY2; //Sigma Y square of cluster + Float_t fSigmaZ2; //Sigma Z square of cluster + + ClassDef(AliCluster,1) // Time Projection Chamber clusters +}; + +#endif + + diff --git a/STEER/AliKalmanTrack.cxx b/STEER/AliKalmanTrack.cxx new file mode 100644 index 00000000000..6bdc95e6d97 --- /dev/null +++ b/STEER/AliKalmanTrack.cxx @@ -0,0 +1,153 @@ +/************************************************************************** + * 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. * + **************************************************************************/ + +//------------------------------------------------------------------------- +// Implementation of the AliKalmanTrack class +// +// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch +//------------------------------------------------------------------------- + +#include "AliKalmanTrack.h" +#include "AliCluster.h" +#include +#include + +ClassImp(AliKalmanTrack) + +//_____________________________________________________________________________ +AliKalmanTrack::AliKalmanTrack(const AliKalmanTrack& t) { + //----------------------------------------------------------------- + // This is a copy constructor. + //----------------------------------------------------------------- + fLab=t.fLab; + + fP0=t.fP0; fP1=t.fP1; fP2=t.fP2; fP3=t.fP3; fP4=t.fP4; + + fC00=t.fC00; + fC10=t.fC10; fC11=t.fC11; + fC20=t.fC20; fC21=t.fC21; fC22=t.fC22; + fC30=t.fC30; fC31=t.fC31; fC32=t.fC32; fC33=t.fC33; + fC40=t.fC40; fC41=t.fC41; fC42=t.fC42; fC43=t.fC43; fC44=t.fC44; + + fChi2=t.fChi2; + fN=t.fN; +} + +//_____________________________________________________________________________ +Int_t AliKalmanTrack::Compare(TObject *o) { + //----------------------------------------------------------------- + // This function compares tracks according to the their curvature + //----------------------------------------------------------------- + AliKalmanTrack *t=(AliKalmanTrack*)o; + Double_t co=TMath::Abs(t->GetPt()); + Double_t c =TMath::Abs(GetPt()); + if (cco) return -1; + return 0; +} + +//_____________________________________________________________________________ +Double_t AliKalmanTrack::GetPredictedChi2(const AliCluster *c) const +{ + //----------------------------------------------------------------- + // This function calculates a predicted chi2 increment. + //----------------------------------------------------------------- + Double_t r00=c->GetSigmaY2(), r01=0., r11=c->GetSigmaZ2(); + r00+=fC00; r01+=fC10; r11+=fC11; + + Double_t det=r00*r11 - r01*r01; + if (TMath::Abs(det) < 1.e-10) { + if (fN>4) cerr<GetY() - fP0, dz=c->GetZ() - fP1; + + return (dy*r00*dy + 2*r01*dy*dz + dz*r11*dz)/det; +} + +//_____________________________________________________________________________ +void AliKalmanTrack::GetCovariance(Double_t cc[15]) const { + // return covariance maxtrix + cc[0 ]=fC00; + cc[1 ]=fC10; cc[2 ]=fC11; + cc[3 ]=fC20; cc[4 ]=fC21; cc[5 ]=fC22; + cc[6 ]=fC30; cc[7 ]=fC31; cc[8 ]=fC32; cc[9 ]=fC33; + cc[10]=fC40; cc[11]=fC41; cc[12]=fC42; cc[13]=fC43; cc[14]=fC44; +} + +//____________________________________________________________________________ +void AliKalmanTrack::Streamer(TBuffer &R__b) +{ + //----------------------------------------------------- + // This is AliKalmanTrack streamer. + //----------------------------------------------------- + if (R__b.IsReading()) { + Version_t R__v = R__b.ReadVersion(); if (R__v) { } + TObject::Streamer(R__b); + R__b >> fLab; + R__b >> fP0; + R__b >> fP1; + R__b >> fP2; + R__b >> fP3; + R__b >> fP4; + R__b >> fC00; + R__b >> fC10; + R__b >> fC11; + R__b >> fC20; + R__b >> fC21; + R__b >> fC22; + R__b >> fC30; + R__b >> fC31; + R__b >> fC32; + R__b >> fC33; + R__b >> fC40; + R__b >> fC41; + R__b >> fC42; + R__b >> fC43; + R__b >> fC44; + R__b >> fChi2; + R__b >> fN; + } else { + R__b.WriteVersion(AliKalmanTrack::IsA()); + TObject::Streamer(R__b); + R__b << fLab; + R__b << fP0; + R__b << fP1; + R__b << fP2; + R__b << fP3; + R__b << fP4; + R__b << fC00; + R__b << fC10; + R__b << fC11; + R__b << fC20; + R__b << fC21; + R__b << fC22; + R__b << fC30; + R__b << fC31; + R__b << fC32; + R__b << fC33; + R__b << fC40; + R__b << fC41; + R__b << fC42; + R__b << fC43; + R__b << fC44; + R__b << fChi2; + R__b << fN; + } +} + + diff --git a/STEER/AliKalmanTrack.h b/STEER/AliKalmanTrack.h new file mode 100644 index 00000000000..e001d4a8fe4 --- /dev/null +++ b/STEER/AliKalmanTrack.h @@ -0,0 +1,60 @@ +#ifndef ALIKALMANTRACK_H +#define ALIKALMANTRACK_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +//------------------------------------------------------------------------- +// Class AliKalmanTrack +// +// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch +//------------------------------------------------------------------------- + +#include + +class AliCluster; + +class AliKalmanTrack : public TObject { +public: + AliKalmanTrack() {fN=0; fChi2=0; fLab=-3141593;} + AliKalmanTrack(const AliKalmanTrack& t); + Int_t Compare(TObject *o); + void SetLabel(Int_t lab) {fLab=lab;} + + Double_t GetPredictedChi2(const AliCluster *cluster) const; + Bool_t IsSortable() const {return kTRUE;} + Int_t GetLabel() const {return fLab;} + void GetCovariance(Double_t cov[15]) const; + Double_t GetChi2() const {return fChi2;} + Int_t GetNumberOfClusters() const {return fN;} + + virtual Double_t GetPt() const=0; + virtual Double_t GetP() const=0; + virtual void GetPxPyPz(Double_t &px, Double_t &py, Double_t &pz) const=0; + virtual Int_t PropagateTo(Double_t xr,Double_t x0,Double_t rho,Double_t pm)=0; + virtual void Update(const AliCluster* c, Double_t chi2, UInt_t i)=0; + +protected: + Int_t fLab; // track label + + Double_t fP0; // + Double_t fP1; // + Double_t fP2; // track parameters + Double_t fP3; // + Double_t fP4; // + + Double_t fC00; // covariance + Double_t fC10, fC11; // matrix + Double_t fC20, fC21, fC22; // of the + Double_t fC30, fC31, fC32, fC33; // track + Double_t fC40, fC41, fC42, fC43, fC44; // parameters + + Double_t fChi2; // total chi2 value for this track + Short_t fN; // number of clusters + + ClassDef(AliKalmanTrack,1) // Reconstructed track +}; + +#endif + + diff --git a/STEER/Makefile b/STEER/Makefile index 5188e92d593..396a18b1bef 100644 --- a/STEER/Makefile +++ b/STEER/Makefile @@ -15,7 +15,8 @@ SRCS = AliDetector.cxx AliHeader.cxx AliMagF.cxx \ AliLego.cxx AliModule.cxx AliDigitNew.cxx \ AliGeometry.cxx AliRecPoint.cxx AliSegmentation.cxx \ AliHitMap.cxx AliMagFC.cxx AliMagFCM.cxx \ - AliMagFDM.cxx AliLegoGenerator.cxx + AliMagFDM.cxx AliLegoGenerator.cxx \ + AliKalmanTrack.cxx AliCluster.cxx # C++ Headers diff --git a/STEER/STEERLinkDef.h b/STEER/STEERLinkDef.h index af95cd1bbf4..7a697032ba6 100644 --- a/STEER/STEERLinkDef.h +++ b/STEER/STEERLinkDef.h @@ -35,6 +35,8 @@ #pragma link C++ class AliRecPoint; #pragma link C++ class AliSegmentation; #pragma link C++ class AliHitMap; +#pragma link C++ class AliCluster; +#pragma link C++ class AliKalmanTrack-; #endif -- 2.39.3