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