]>
Commit | Line | Data |
---|---|---|
23b18f4e | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | ||
17 | #include <TObjArray.h> | |
18 | #include <TFile.h> | |
19 | #include <TString.h> | |
20 | #include <TSystem.h> | |
21 | ||
22 | #include "AliLog.h" | |
23 | #include "AliTPCLaserTrack.h" | |
24 | ||
25 | ClassImp(AliTPCLaserTrack) | |
26 | ||
27 | TObjArray *AliTPCLaserTrack::fgArrLaserTracks=0x0; | |
28 | ||
29 | AliTPCLaserTrack::AliTPCLaserTrack() : | |
30 | AliExternalTrackParam(), | |
31 | fId(-1), | |
32 | fSide(-1), | |
33 | fRod(-1), | |
34 | fBundle(-1), | |
35 | fBeam(-1) | |
36 | { | |
37 | // | |
38 | // Default constructor | |
39 | // | |
40 | ||
41 | } | |
42 | ||
43 | AliTPCLaserTrack::AliTPCLaserTrack(AliTPCLaserTrack <r) : | |
44 | AliExternalTrackParam(ltr), | |
45 | fId(ltr.fId), | |
46 | fSide(ltr.fSide), | |
47 | fRod(ltr.fRod), | |
48 | fBundle(ltr.fBundle), | |
49 | fBeam(ltr.fBeam) | |
50 | { | |
51 | // | |
52 | // Default constructor | |
53 | // | |
54 | ||
55 | } | |
56 | ||
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), | |
63 | fId(id), | |
64 | fSide(side), | |
65 | fRod(rod), | |
66 | fBundle(bundle), | |
67 | fBeam(beam) | |
68 | { | |
69 | // | |
70 | // create laser track from arguments | |
71 | // | |
72 | ||
73 | } | |
74 | ||
75 | void AliTPCLaserTrack::LoadTracks() | |
76 | { | |
77 | // | |
78 | // Load all design positions from file into the static array fgArrLaserTracks | |
79 | // | |
80 | ||
81 | if ( fgArrLaserTracks ) return; | |
82 | ||
83 | TString dataFileName("$ALICE_ROOT/TPC/Calib/LaserTracks.root"); //Path to the Data File | |
84 | ||
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"); | |
89 | return; | |
90 | } | |
91 | TObjArray *arrLaserTracks = (TObjArray*)f->Get("arrLaserTracks"); | |
92 | if ( !arrLaserTracks ) { | |
93 | // AliWarning(Form("Could not get laser position data from file: '%s'",fgkDataFileName)); | |
94 | return; | |
95 | } | |
96 | ||
97 | fgArrLaserTracks = new TObjArray(fgkNLaserTracks); | |
98 | for (Int_t itrack=0; itrack<fgkNLaserTracks; itrack++){ | |
99 | AliTPCLaserTrack *ltr = (AliTPCLaserTrack*)arrLaserTracks->At(itrack); | |
100 | if ( !ltr ){ | |
101 | // AliWarning(Form("No informatino found for Track %d!",itrack)); | |
102 | continue; | |
103 | } | |
104 | fgArrLaserTracks->AddAt(new AliTPCLaserTrack(*ltr),itrack); | |
105 | } | |
106 | delete f; | |
107 | } | |
108 | ||
f1fcccb7 | 109 | |
23b18f4e | 110 | Int_t AliTPCLaserTrack::IdentifyTrack(AliExternalTrackParam *track) |
111 | { | |
f1fcccb7 | 112 | // |
113 | // Find the laser track which is corresponding closest to 'track' | |
114 | // return its id | |
115 | // | |
116 | // | |
b51d4393 | 117 | const Float_t kMaxdphi=0.2; |
265e5fdb | 118 | const Float_t kMaxdphiP=0.05; |
119 | const Float_t kMaxdz=40; | |
f1fcccb7 | 120 | |
121 | if ( !fgArrLaserTracks ) LoadTracks(); | |
122 | TObjArray *arrTracks = GetTracks(); | |
f1fcccb7 | 123 | Double_t lxyz0[3]; |
124 | Double_t lxyz1[3]; | |
125 | Double_t pxyz0[3]; | |
126 | Double_t pxyz1[3]; | |
127 | track->GetXYZ(lxyz0); | |
128 | track->GetPxPyPz(pxyz0); | |
265e5fdb | 129 | // |
130 | Float_t mindist=40; // maxima minimal distance | |
f1fcccb7 | 131 | Int_t id = -1; |
265e5fdb | 132 | AliExternalTrackParam* ltr0= (AliExternalTrackParam*)arrTracks->UncheckedAt(0); |
f1fcccb7 | 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; | |
23b18f4e | 137 | // |
f1fcccb7 | 138 | ltr->GetXYZ(lxyz1); |
b51d4393 | 139 | if (TMath::Abs(lxyz1[2]-lxyz0[2])>kMaxdz) continue; |
f1fcccb7 | 140 | // phi position |
141 | Double_t phi0 = TMath::ATan2(lxyz0[1],lxyz0[0]); | |
142 | Double_t phi1 = TMath::ATan2(lxyz1[1],lxyz1[0]); | |
b51d4393 | 143 | if (TMath::Abs(phi0-phi1)>kMaxdphi) continue; |
f1fcccb7 | 144 | // phi direction |
145 | ltr->GetPxPyPz(pxyz1); | |
265e5fdb | 146 | Float_t distdir = (ltr->GetParameter()[2]-track->GetParameter()[2])*90; //distance at entrance |
f1fcccb7 | 147 | if (TMath::Abs(ltr->GetParameter()[2]-track->GetParameter()[2])>kMaxdphiP) |
148 | continue; | |
23b18f4e | 149 | // |
265e5fdb | 150 | Float_t dist=0; |
151 | dist+=TMath::Abs(lxyz1[0]-lxyz0[0]); | |
152 | dist+=TMath::Abs(lxyz1[1]-lxyz0[1]); | |
153 | dist+=TMath::Abs(lxyz1[2]-lxyz0[2]); | |
154 | dist+=distdir; | |
155 | // | |
156 | if (id<0) { | |
157 | id =itrack; | |
158 | mindist=dist; | |
159 | ltr0=ltr; | |
160 | continue; | |
161 | } | |
162 | if (dist>mindist) continue; | |
163 | id = itrack; | |
164 | mindist=dist; | |
165 | ltr0=ltr; | |
f1fcccb7 | 166 | } |
167 | return id; | |
23b18f4e | 168 | } |
169 |