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