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(),
38 // Default constructor
43 AliTPCLaserTrack::AliTPCLaserTrack(AliTPCLaserTrack <r) :
44 AliExternalTrackParam(ltr),
52 // Default constructor
57 AliTPCLaserTrack::AliTPCLaserTrack(const Int_t id, const Int_t side, const Int_t rod,
58 const Int_t bundle, const Int_t beam,
59 Double_t x, Double_t alpha,
60 const Double_t param[5],
61 const Double_t covar[15]) :
62 AliExternalTrackParam(x,alpha,param,covar),
70 // create laser track from arguments
75 void AliTPCLaserTrack::LoadTracks()
78 // Load all design positions from file into the static array fgArrLaserTracks
81 if ( fgArrLaserTracks ) return;
83 TString dataFileName("$ALICE_ROOT/TPC/Calib/LaserTracks.root"); //Path to the Data File
85 TFile *f=TFile::Open(gSystem->ExpandPathName(dataFileName.Data()));
86 if ( !f || !f->IsOpen() ){
87 // AliWarning(Form("Could not open laser data file: '%s'",dataFileName.Data()));
88 // AliWarning("Could not open laser data file");
91 TObjArray *arrLaserTracks = (TObjArray*)f->Get("arrLaserTracks");
92 if ( !arrLaserTracks ) {
93 // AliWarning(Form("Could not get laser position data from file: '%s'",fgkDataFileName));
97 fgArrLaserTracks = new TObjArray(fgkNLaserTracks);
98 for (Int_t itrack=0; itrack<fgkNLaserTracks; itrack++){
99 AliTPCLaserTrack *ltr = (AliTPCLaserTrack*)arrLaserTracks->At(itrack);
101 // AliWarning(Form("No informatino found for Track %d!",itrack));
104 fgArrLaserTracks->AddAt(new AliTPCLaserTrack(*ltr),itrack);
110 Int_t AliTPCLaserTrack::IdentifyTrack(AliExternalTrackParam *track)
113 // Find the laser track which is corresponding closest to 'track'
117 const Float_t kMaxdphi=0.1;
118 const Float_t kMaxdphiP=0.06;
119 const Float_t kMaxdz=50;
121 if ( !fgArrLaserTracks ) LoadTracks();
122 TObjArray *arrTracks = GetTracks();
129 track->GetXYZ(lxyz0);
130 track->GetPxPyPz(pxyz0);
133 for (Int_t itrack=0; itrack<fgkNLaserTracks; itrack++){
134 AliExternalTrackParam *ltr = (AliExternalTrackParam*)arrTracks->UncheckedAt(itrack);
135 Double_t * kokot = (Double_t*)ltr->GetParameter();
136 kokot[4]=-0.0000000001;
139 if ( (lxyz1[2]>0) && lxyz0[2]<0) continue;
140 if ( (lxyz1[2]<0) && lxyz0[2]>0) continue;
141 if (TMath::Abs(lxyz1[2]-lxyz0[2])>kMaxdz) continue;
143 Double_t phi0 = TMath::ATan2(lxyz0[1],lxyz0[0]);
144 Double_t phi1 = TMath::ATan2(lxyz1[1],lxyz1[0]);
145 if (TMath::Abs(phi0-phi1)>kMaxdphi) continue;
147 ltr->GetPxPyPz(pxyz1);
148 Double_t pphi0 = TMath::ATan2(pxyz0[1],pxyz0[0]);
149 Double_t pphi1 = TMath::ATan2(pxyz1[1],pxyz1[0]);
150 Bool_t phimatch = kFALSE;
151 if (TMath::Abs(ltr->GetParameter()[2]-track->GetParameter()[2])>kMaxdphiP)
153 // if (TMath::Abs(pphi0-pphi1)<kMaxdphiP) phimatch=kTRUE;
154 // if (TMath::Abs(pphi0-pphi1-TMath::Pi())<kMaxdphiP) phimatch=kTRUE;
155 // if (TMath::Abs(pphi0-pphi1+TMath::Pi())<kMaxdphiP) phimatch=kTRUE;
156 // if (!phimatch) continue;