1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 #include <TObjArray.h>
23 #include "AliTPCLaserTrack.h"
25 ClassImp(AliTPCLaserTrack)
27 TObjArray *AliTPCLaserTrack::fgArrLaserTracks=0x0;
29 AliTPCLaserTrack::AliTPCLaserTrack() :
30 AliExternalTrackParam(),
39 // Default constructor
44 AliTPCLaserTrack::AliTPCLaserTrack(const AliTPCLaserTrack <r) :
45 AliExternalTrackParam(ltr),
51 fRayLength(ltr.fRayLength)
54 // Default constructor
59 AliTPCLaserTrack::AliTPCLaserTrack(const Int_t id, const Int_t side, const Int_t rod,
60 const Int_t bundle, const Int_t beam,
61 Double_t x, Double_t alpha,
62 const Double_t param[5],
63 const Double_t covar[15], const Float_t rayLength) :
64 AliExternalTrackParam(x,alpha,param,covar),
73 // create laser track from arguments
77 //_____________________________________________________________________
78 AliTPCLaserTrack& AliTPCLaserTrack::operator = (const AliTPCLaserTrack &source)
81 // assignment operator
83 if (&source == this) return *this;
84 new (this) AliTPCLaserTrack(source);
89 void AliTPCLaserTrack::LoadTracks()
92 // Load all design positions from file into the static array fgArrLaserTracks
95 if ( fgArrLaserTracks ) return;
97 TString dataFileName("$ALICE_ROOT/TPC/Calib/LaserTracks.root"); //Path to the Data File
99 TFile *f=TFile::Open(gSystem->ExpandPathName(dataFileName.Data()));
100 if ( !f || !f->IsOpen() ){
101 // AliWarning(Form("Could not open laser data file: '%s'",dataFileName.Data()));
102 // AliWarning("Could not open laser data file");
105 TObjArray *arrLaserTracks = (TObjArray*)f->Get("arrLaserTracks");
106 if ( !arrLaserTracks ) {
107 // AliWarning(Form("Could not get laser position data from file: '%s'",fgkDataFileName));
111 fgArrLaserTracks = new TObjArray(fgkNLaserTracks);
112 for (Int_t itrack=0; itrack<fgkNLaserTracks; itrack++){
113 AliTPCLaserTrack *ltr = (AliTPCLaserTrack*)arrLaserTracks->At(itrack);
115 // AliWarning(Form("No informatino found for Track %d!",itrack));
118 fgArrLaserTracks->AddAt(new AliTPCLaserTrack(*ltr),itrack);
124 Int_t AliTPCLaserTrack::IdentifyTrack(AliExternalTrackParam *track, Int_t side)
127 // Find the laser track which is corresponding closest to 'track'
131 const Float_t kMaxdphi=0.2;
132 const Float_t kMaxdphiP=0.05;
133 const Float_t kMaxdz=40;
135 if ( !fgArrLaserTracks ) LoadTracks();
136 TObjArray *arrTracks = GetTracks();
141 track->GetXYZ(lxyz0);
142 track->GetDirection(pxyz0);
144 Float_t mindist=10; // maxima minimal distance
146 AliExternalTrackParam* ltr0= (AliExternalTrackParam*)arrTracks->UncheckedAt(0);
147 for (Int_t itrack=0; itrack<fgkNLaserTracks; itrack++){
148 AliTPCLaserTrack *ltr = (AliTPCLaserTrack*)arrTracks->UncheckedAt(itrack);
149 if (side>=0) if (ltr->GetSide()!=side) continue;
150 Double_t * kokot = (Double_t*)ltr->GetParameter();
151 kokot[4]=-0.0000000001;
154 if (TMath::Abs(lxyz1[2]-lxyz0[2])>kMaxdz) continue;
156 Double_t phi0 = TMath::ATan2(lxyz0[1],lxyz0[0]);
157 Double_t phi1 = TMath::ATan2(lxyz1[1],lxyz1[0]);
158 if (TMath::Abs(phi0-phi1)>kMaxdphi) continue;
160 ltr->GetDirection(pxyz1);
161 Float_t direction= pxyz0[0]*pxyz1[0] + pxyz0[1]*pxyz1[1] + pxyz0[2]*pxyz1[2];
162 Float_t distdir = (1-TMath::Abs(direction))*90.; //distance at entrance
163 if (1-TMath::Abs(direction)>kMaxdphiP)
167 dist+=TMath::Abs(lxyz1[0]-lxyz0[0]);
168 dist+=TMath::Abs(lxyz1[1]-lxyz0[1]);
169 // dist+=TMath::Abs(lxyz1[2]-lxyz0[2]); //z is not used for distance calculation
178 if (dist>mindist) continue;