]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDmcTrack.cxx
added new files to build system
[u/mrichter/AliRoot.git] / TRD / AliTRDmcTrack.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 /* $Id$ */
17
18 ////////////////////////////////////////////////////////////////////////////
19 //                                                                        //
20 //  TRD MC track                                                          //
21 //  Used for efficiency estimates and matching of reconstructed tracks    //
22 //  to MC particles                                                       //                    
23 //                                                                        //
24 ////////////////////////////////////////////////////////////////////////////
25
26 #include "AliTRDmcTrack.h"
27 #include "AliTRDgeometry.h"
28
29 ClassImp(AliTRDmcTrack)
30
31 //_____________________________________________________________________________
32 AliTRDmcTrack::AliTRDmcTrack() 
33   :TObject()
34   ,fLab(-1)
35   ,fSeedLab(-1)
36   ,fPrimary(kFALSE)
37   ,fMass(0)
38   ,fCharge(0)
39   ,fPDG(0)
40   ,fN(0) 
41
42   //
43   // Default constructor 
44   //
45
46   for (Int_t ltb = 0; ltb < kMAX_TB; ltb++) {
47     for (Int_t plane = 0; plane < 6; plane++) {
48       fIndex[ltb][plane][0] = -1;
49       fIndex[ltb][plane][1] = -1;
50     }
51   }
52
53   for (Int_t i = 0; i < 6; i++) {
54     for (Int_t j = 0; j < 3; j++) { 
55       Pin[i][j]    = 0.0; 
56       Pout[i][j]   = 0.0;
57       XYZin[i][j]  = 0.0; 
58       XYZout[i][j] = 0.0;
59     }
60   }
61
62 }
63
64 //_____________________________________________________________________________
65 AliTRDmcTrack::AliTRDmcTrack(Int_t label, Int_t seedLabel, Bool_t primary
66                            , Float_t mass, Int_t charge, Int_t pdg) 
67   :TObject()
68   ,fLab(label)
69   ,fSeedLab(seedLabel)
70   ,fPrimary(primary)
71   ,fMass(mass)
72   ,fCharge(charge)
73   ,fPDG(pdg)
74   ,fN(0) 
75
76   //
77   // Main constructor 
78   //
79   
80   for (Int_t ltb = 0; ltb < kMAX_TB; ltb++) {
81     for (Int_t plane = 0; plane < 6; plane++) {
82       fIndex[ltb][plane][0] = -1;
83       fIndex[ltb][plane][1] = -1;
84     }
85   }
86   
87   for (Int_t i = 0; i < 6; i++) {
88     for (Int_t j = 0; j < 3; j++) { 
89       Pin[i][j]    = 0.0; 
90       Pout[i][j]   = 0.0;
91       XYZin[i][j]  = 0.0; 
92       XYZout[i][j] = 0.0;
93     }
94   }
95
96 }
97
98 //_____________________________________________________________________________
99 void AliTRDmcTrack::GetPxPyPzXYZ(Double_t& px, Double_t& py, Double_t& pz
100                                , Double_t&  x, Double_t&  y, Double_t&  z 
101                                , Int_t opt) const 
102 {
103   //
104   // Returns track momentum components and coordinates at the entrance 
105   // (opt >= 0), or exit (opt < 0) of TRD. 
106   //
107
108   Int_t i = 0;
109
110   if (opt >= 0) {
111
112     for (i = 0; i < AliTRDgeometry::Nplan(); i++) {
113       if ((Pin[i][0]*Pin[i][0]
114          + Pin[i][1]*Pin[i][1]
115          + Pin[i][2]*Pin[i][2]) > 0.0005) {
116         break;
117       }
118     }
119
120     px = Pin[i][0];   
121     py = Pin[i][1];
122     pz = Pin[i][2];
123     x  = XYZin[i][0];   
124     y  = XYZin[i][1];
125     z  = XYZin[i][2];
126
127   }
128   else {
129
130     for (i = AliTRDgeometry::Nplan() - 1; i >= 0; i--) {
131       if ((Pout[i][0]*Pout[i][0]
132          + Pout[i][1]*Pout[i][1]
133          + Pout[i][2]*Pout[i][2]) > 0.0005) {
134         break;
135       }
136     }
137
138     px = Pout[i][0];
139     py = Pout[i][1];
140     pz = Pout[i][2];
141     x  = XYZout[i][0];
142     y  = XYZout[i][1];
143     z  = XYZout[i][2];
144
145   }
146
147   return;
148 }
149
150 //_____________________________________________________________________________
151 void AliTRDmcTrack::GetPlanePxPyPz(Double_t& px, Double_t& py, Double_t& pz
152                                  , Int_t plane, Int_t opt) const 
153 {
154   //
155   // Returns momentum components at the entrance (opt >= 0), or
156   // exit (opt < 0) of TRD plane <plane>. 
157   //
158
159   if (opt >= 0) {
160     px = Pin[plane][0];
161     py = Pin[plane][1];
162     pz = Pin[plane][2];
163   }
164   else {
165     px = Pout[plane][0];
166     py = Pout[plane][1];
167     pz = Pout[plane][2];
168   }
169
170   return;
171
172 }