From 23b18f4e7b05e90e11b0306a82e6a5fd35e32f08 Mon Sep 17 00:00:00 2001 From: marian Date: Thu, 26 Jun 2008 16:48:18 +0000 Subject: [PATCH] Adding new class - AliTPCLaserTrack (Jens) --- TPC/AliTPCLaserTrack.cxx | 178 +++++++++++++++++++++++++++++++++++++++ TPC/AliTPCLaserTrack.h | 71 ++++++++++++++++ 2 files changed, 249 insertions(+) create mode 100644 TPC/AliTPCLaserTrack.cxx create mode 100644 TPC/AliTPCLaserTrack.h diff --git a/TPC/AliTPCLaserTrack.cxx b/TPC/AliTPCLaserTrack.cxx new file mode 100644 index 00000000000..ef7737a7c58 --- /dev/null +++ b/TPC/AliTPCLaserTrack.cxx @@ -0,0 +1,178 @@ +/************************************************************************** + * 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. * + **************************************************************************/ + + +#include +#include +#include +#include + +#include "AliLog.h" +#include "AliTPCLaserTrack.h" + +ClassImp(AliTPCLaserTrack) + +TObjArray *AliTPCLaserTrack::fgArrLaserTracks=0x0; + +AliTPCLaserTrack::AliTPCLaserTrack() : + AliExternalTrackParam(), + fId(-1), + fSide(-1), + fRod(-1), + fBundle(-1), + fBeam(-1) +{ + // + // Default constructor + // + +} + +AliTPCLaserTrack::AliTPCLaserTrack(AliTPCLaserTrack <r) : + AliExternalTrackParam(ltr), + fId(ltr.fId), + fSide(ltr.fSide), + fRod(ltr.fRod), + fBundle(ltr.fBundle), + fBeam(ltr.fBeam) +{ + // + // Default constructor + // + +} + +AliTPCLaserTrack::AliTPCLaserTrack(const Int_t id, const Int_t side, const Int_t rod, + const Int_t bundle, const Int_t beam, + Double_t x, Double_t alpha, + const Double_t param[5], + const Double_t covar[15]) : + AliExternalTrackParam(x,alpha,param,covar), + fId(id), + fSide(side), + fRod(rod), + fBundle(bundle), + fBeam(beam) +{ + // + // create laser track from arguments + // + +} + +void AliTPCLaserTrack::LoadTracks() +{ + // + // Load all design positions from file into the static array fgArrLaserTracks + // + + if ( fgArrLaserTracks ) return; + + TString dataFileName("$ALICE_ROOT/TPC/Calib/LaserTracks.root"); //Path to the Data File + + TFile *f=TFile::Open(gSystem->ExpandPathName(dataFileName.Data())); + if ( !f || !f->IsOpen() ){ +// AliWarning(Form("Could not open laser data file: '%s'",dataFileName.Data())); +// AliWarning("Could not open laser data file"); + return; + } + TObjArray *arrLaserTracks = (TObjArray*)f->Get("arrLaserTracks"); + if ( !arrLaserTracks ) { +// AliWarning(Form("Could not get laser position data from file: '%s'",fgkDataFileName)); + return; + } + + fgArrLaserTracks = new TObjArray(fgkNLaserTracks); + for (Int_t itrack=0; itrackAt(itrack); + if ( !ltr ){ +// AliWarning(Form("No informatino found for Track %d!",itrack)); + continue; + } + fgArrLaserTracks->AddAt(new AliTPCLaserTrack(*ltr),itrack); + } + delete f; +} + +Int_t AliTPCLaserTrack::IdentifyTrack(AliExternalTrackParam *track) +{ + // + // Find the laser track which is corresponding closest to 'track' + // return its id + // + + LoadTracks(); + TObjArray *arrTracks = GetTracks(); + + Double_t phitr=0; + Double_t philtr=0; + Double_t xltr[3]; + Double_t xtr[3]; + Double_t vtr[3]; + + track->GetXYZ(xtr); + track->GetDirection(vtr); + phitr=track->Phi(); + + Int_t id = -1; + Double_t dcaMin=3; // 3 sigma is the minimum weighted dca accepted + for (Int_t itrack=0; itrackUncheckedAt(itrack); + philtr=ltr->Phi(); + Double_t phiadd=0; + Double_t dphi=TMath::Abs(phitr-philtr); + if (dphi>TMath::Pi()) phiadd=TMath::Pi(); + dphi-=phiadd; + if (dphi>2*TMath::DegToRad()) continue; //only 2 degree in phi + + //printf("itrack: %d; dphi: %f\n",itrack,dphi/TMath::DegToRad()); + + ltr->GetXYZ(xltr); + + Double_t l=0; + Double_t d2=0; + Double_t d=0; + for (Int_t i=0; i<2; i++) + l+=(xltr[i]-xtr[i])*vtr[i]; + for (Int_t i=0; i<2; i++) + d2+=(xltr[i]-xtr[i]-l*vtr[i])*(xltr[i]-xtr[i]-l*vtr[i]); + d=TMath::Sqrt(d2); + + //printf("itrack: %d; d-xy: %f\n",itrack,d); + + + //only 3mm in x-y + if ( d>.3 ) continue; + + + Double_t dz=TMath::Abs(xltr[2] - xtr[2]); + //printf("itrack: %d; d-z: %f\n",itrack,dz); + //30 cm in z + if ( dz > 30. ) continue; + + //if ( id!=-1 ) printf("Warnig: Track (%d) already identified before (%d)\n", itrack, id); + id=itrack; +// Double_t relDistX +// Double_t xtr=0; +// Double_t xltr=0; +// Double_t dca=track->GetDCA(ltr,0,xtr,xltr); +// if ( dca + +#include "AliExternalTrackParam.h" + +class TObjArray; + + + +class AliTPCLaserTrack : public AliExternalTrackParam { +public: + AliTPCLaserTrack(); + AliTPCLaserTrack(AliTPCLaserTrack <r); + AliTPCLaserTrack(const Int_t id, const Int_t side, const Int_t rod, + const Int_t bundle, const Int_t beam, + Double_t x, Double_t alpha, + const Double_t param[5], + const Double_t covar[15]); + + + static void LoadTracks(); + static TObjArray* GetTracks() {return fgArrLaserTracks;} + + static Int_t IdentifyTrack(AliExternalTrackParam *track); + + Int_t GetId() const {return fId; } + Int_t GetSide() const {return fSide; } + Int_t GetRod() const {return fRod; } + Int_t GetBundle() const {return fBundle; } + Int_t GetBeam() const {return fBeam; } + + static Int_t GetNLaserTracks() { return fgkNLaserTracks; } + static Int_t GetNLaserRodsPerSide() { return fgkNRodsPerSide; } + static Int_t GetNMirrorBundlesPerRod() { return fgkNBundlePerRod; } + static Int_t GetNLaserRaysPerMirrorBundle() { return fgkNBeamsPerBundle; } + + + void SetId (Int_t id) {fId = id; } + void SetSide (Int_t side) {fSide = side; } + void SetRod (Int_t rod) {fRod = rod; } + void SetBundle(Int_t bundle){fBundle = bundle;} + void SetBeam (Int_t beam) {fBeam = beam; } + + +private: + Int_t fId; //Laser beam id (0-335) + Int_t fSide; //TPC side; 0:Shaft Side (A) -- 1:Muon Side (C) + Int_t fRod; //Laser Rod (0-5) + Int_t fBundle; //Mirror bundle in the Rod (0-3) + Int_t fBeam; //Laser Beam in the bundle (0-6) + + + static TObjArray* fgArrLaserTracks; //! Array of all Laser Tracks, + // keeps instances of this class; + + static const Int_t fgkNLaserTracks = 336; //Number of laser tracks + static const Int_t fgkNRodsPerSide = 6; //Number of laser rods on each readout side + static const Int_t fgkNBundlePerRod = 4; //Number of mirror bundles per rod + static const Int_t fgkNBeamsPerBundle = 7; //Number of laser rays per bundle + +// static const char* fgkDataFileName = "$ALIC_ROOT/TPC/Calib/LaserTracks.root"; //Path to the Data File + + ClassDef(AliTPCLaserTrack,1) // Laser Track positions and track identification +}; + +#endif + -- 2.43.0