Update of tracking code for tilted pads
[u/mrichter/AliRoot.git] / TRD / AliTRDmcTrack.cxx
CommitLineData
16bf9884 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#include "AliTRDmcTrack.h"
17#include "AliTRDgeometry.h"
18
fd621f36 19
16bf9884 20ClassImp(AliTRDmcTrack)
21
22//_____________________________________________________________________________
23AliTRDmcTrack::AliTRDmcTrack()
24{
25
26 //
27 // Default constructor
28 //
29
30 fLab = -1;
31 fPrimary = kFALSE;
32 fMass = 0;
33 fCharge = 0;
34 fN = 0;
35
fd621f36 36 for(Int_t i=0; i<kMAX_CLUSTERS_PER_MC_TRACK; i++) fIndex[i]=-1;
16bf9884 37
38 for(Int_t i=0; i<6; i++) {
39 for(Int_t j=0; j<3; j++) {
fd621f36 40 Pin[i][j]=0.;
41 Pout[i][j] = 0.;
42 XYZin[i][j]=0.;
43 XYZout[i][j] = 0.;
16bf9884 44 }
45 }
46
47}
48
49//_____________________________________________________________________________
50AliTRDmcTrack::AliTRDmcTrack(Int_t label, Bool_t primary, Float_t mass
51 ,Int_t charge, Int_t pdg)
52{
53
54 //
55 // Main constructor
56 //
57
58 fLab = label;
59 fPrimary = primary;
60 fMass = mass;
61 fCharge = charge;
62 fPDG = pdg;
63 fN = 0;
64
fd621f36 65 for(Int_t i=0; i<kMAX_CLUSTERS_PER_MC_TRACK; i++) fIndex[i]=-1;
16bf9884 66
67 for(Int_t i=0; i<6; i++) {
68 for(Int_t j=0; j<3; j++) {
fd621f36 69 Pin[i][j]=0.;
70 Pout[i][j] = 0.;
71 XYZin[i][j]=0.;
72 XYZout[i][j] = 0.;
16bf9884 73 }
74 }
75
76}
77
78//_____________________________________________________________________________
fd621f36 79void AliTRDmcTrack::GetPxPyPzXYZ(Double_t& px, Double_t& py, Double_t& pz,
80 Double_t& x, Double_t& y, Double_t& z,
81 Int_t opt) const
16bf9884 82{
83 //
fd621f36 84 // Returns track momentum components and coordinates at the entrance
85 // (opt >= 0), or exit (opt < 0) of TRD.
16bf9884 86 //
87
88 Int_t i;
89
90 if(opt >= 0) {
91 for(i = 0; i < AliTRDgeometry::Nplan(); i++) {
fd621f36 92 if( Pin[i][0] * Pin[i][0]
93 + Pin[i][1] * Pin[i][1]
94 + Pin[i][2] * Pin[i][2] > 0.0005) break;
16bf9884 95 }
fd621f36 96 px = Pin[i][0]; py = Pin[i][1]; pz = Pin[i][2];
97 x = XYZin[i][0]; y = XYZin[i][1]; z = XYZin[i][2];
16bf9884 98 }
99 else {
100 for(i = AliTRDgeometry::Nplan() - 1; i >= 0; i--) {
fd621f36 101 if( Pout[i][0] * Pout[i][0]
102 + Pout[i][1] * Pout[i][1]
103 + Pout[i][2] * Pout[i][2] > 0.0005) break;
16bf9884 104 }
fd621f36 105 px = Pout[i][0]; py = Pout[i][1]; pz = Pout[i][2];
106 x = XYZout[i][0]; y = XYZout[i][1]; z = XYZout[i][2];
16bf9884 107 }
16bf9884 108 return;
16bf9884 109}
110
111//_____________________________________________________________________________
112void AliTRDmcTrack::GetPlanePxPyPz(Double_t& px, Double_t& py, Double_t& pz,
a3d851c2 113 Int_t plane, Int_t opt) const
16bf9884 114{
115 //
116 // Returns momentum components at the entrance (opt >= 0), or
117 // exit (opt < 0) of TRD plane <plane>.
118 //
119
120 if(opt >= 0) {
fd621f36 121 px = Pin[plane][0]; py = Pin[plane][1]; pz = Pin[plane][2];
16bf9884 122 }
123 else {
fd621f36 124 px = Pout[plane][0]; py = Pout[plane][1]; pz = Pout[plane][2];
16bf9884 125 }
16bf9884 126 return;
16bf9884 127}
fd621f36 128
129