]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDltuTracklet.cxx
hopefully the last refinements for correct type conversion in calibration
[u/mrichter/AliRoot.git] / TRD / AliTRDltuTracklet.cxx
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 //                                                                           //
18 //                                                                           //
19 //  TRD chamber local track (LTU, tracklet)                                  //
20 //                                                                           //
21 //  Author:                                                                  //
22 //    Bogdan Vulpescu                                                        //
23 //                                                                           //
24 ///////////////////////////////////////////////////////////////////////////////
25
26 #include <TMath.h>
27
28 #include "AliTRDltuTracklet.h"
29
30 ClassImp(AliTRDltuTracklet)
31
32 //_____________________________________________________________________________
33 AliTRDltuTracklet::AliTRDltuTracklet()
34   :TObject()
35   ,fX(0)
36   ,fY(0)
37   ,fSlope(0)
38   ,fRowz(0)
39   ,fDetector(0)
40   ,fRow(0)
41   ,fNclusters(0)
42   ,fLabel(0)
43   ,fQ(0)
44 {
45   //
46   // AliTRDltuTracklet default constructor
47   //
48
49 }
50
51 //_____________________________________________________________________________
52 AliTRDltuTracklet::AliTRDltuTracklet(Int_t det, Int_t row, Float_t rowz
53                                    , Float_t slope, Float_t offset, Float_t time
54                                    , Int_t ncl, Int_t label, Float_t q) 
55   :TObject()
56   ,fX(time)
57   ,fY(offset)
58   ,fSlope(slope)
59   ,fRowz(rowz)
60   ,fDetector(det)
61   ,fRow(row)
62   ,fNclusters(ncl)
63   ,fLabel(label)
64   ,fQ(q)
65 {
66   //
67   // AliTRDltuTracklet constructor
68   //
69
70 }
71
72 //_____________________________________________________________________________
73 AliTRDltuTracklet::~AliTRDltuTracklet()
74 {
75   //
76   // Destructor
77   //
78
79 }
80
81 //_____________________________________________________________________________
82 Float_t AliTRDltuTracklet::GetPt(Float_t field) const
83 {
84   //
85   // Transverse momentum calculation
86   // Curvature R = (fX*fX + fY*fY) / (2 * sin(alpha))
87   // alpha = angle deviation from "infinite momentum"
88   //
89   // Consistent with AliTRDmcmTracklet::GetPt(...)
90   //
91
92   Float_t infSlope = TMath::ATan(fY/fX) / TMath::Pi()*180.0;    
93   Float_t alpha    = fSlope - infSlope;
94   Float_t r        = TMath::Sqrt(fX*fX + fY*fY)
95                    / (2.0 * TMath::Sin(alpha/180.0*TMath::Pi()));
96   
97   Float_t pt       = 0.3 * field * 0.01 * r;
98  
99   return pt;
100  
101 }
102
103 //_____________________________________________________________________________
104 Int_t AliTRDltuTracklet::Compare(const TObject *o) const
105 {
106   //
107   // compare two LTU tracklets according to the intercept point Y1
108   //
109
110   AliTRDltuTracklet *ltutrk = (AliTRDltuTracklet *) o;
111
112   if (fRow      != ltutrk->fRow) {
113     return +1;
114   }
115   if (fDetector != ltutrk->fDetector) {
116     return +1;
117   }
118
119   if (fY <  ltutrk->fY) {
120     return -1;
121   }
122   if (fY == ltutrk->fY) {
123     return  0;
124   }
125
126   return 1;
127
128 }
129
130 //_____________________________________________________________________________
131 Float_t AliTRDltuTracklet::GetYproj(Float_t xpl) const
132 {
133   //
134   // y-projection (bending plane) onto the median plane
135   //
136
137   Float_t yproj = fY + TMath::Tan(fSlope/180.0*TMath::Pi()) * (xpl - fX);
138
139   return yproj;
140
141 }
142
143 //_____________________________________________________________________________
144 Float_t AliTRDltuTracklet::GetZproj(Float_t xpl) const
145 {
146   //
147   // z-projection (using pad row center) onto the median plane
148   //
149
150   Float_t zproj = fRowz * xpl / fX;
151
152   return zproj;
153
154 }
155