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