StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
FtfMcTrack.cxx
1 //:>------------------------------------------------------------------
2 //: FILE: FtfMcTrack.cxx
3 //: HISTORY:
4 //: 1may2000 new version
5 //: 10may2000 ppy add set
6 //:
7 //:<------------------------------------------------------------------
8 //:>------------------------------------------------------------------
9 //: CLASS: FtfMcTrack
10 //: DESCRIPTION: Functions associated with this class
11 //: AUTHOR: ppy - Pablo Yepes, yepes@rice.edu
12 //:>------------------------------------------------------------------
13 #include "Stl3Util/ftf/FtfMcTrack.h"
14 
15 void FtfMcTrack::set ( int _id, float _r0, float _z0, float _phi0,
16  float _pt, float _tanl, float _psi,
17  int _q, int _nHits ) {
18  id = _id ;
19  r0 = _r0 ;
20  z0 = _z0 ;
21  phi0 = _phi0 ;
22  pt = _pt ;
23  tanl = _tanl ;
24  psi = _psi ;
25  q = _q ;
26  nHits = _nHits ;
27 }
28 
29 //*****************************************************************
30 // set Primary
31 //*****************************************************************
32 void FtfMcTrack::setPrimary ( short qIn, float ptIn, float eta, float psiIn ) {
33  q = qIn ;
34  float theta = 2 * atan(exp(-eta )) ;
35  tanl = 1./ tan(theta);
36  pt = ptIn ;
37  psi = psiIn ;
38  r0 = 0. ;
39  phi0 = 0. ;
40  z0 = 0. ;
41 }
42 //*****************************************************************
43 // set Random primary
44 //*****************************************************************
45 void FtfMcTrack::setRandomPrimary ( float ptMin, float ptMax,
46  float etaMin, float etaMax, float psiMin, float psiMax,
47  float zVert ) {
48  pt = ptMin + (ptMax - ptMin ) * (float)rand() / (float)RAND_MAX ;
49  double eta = etaMin + (etaMax - etaMin ) * (float)rand() / (float)RAND_MAX ;
50  double theta = 2 * atan(exp(-eta )) ;
51  tanl = 1./ tan(theta);
52  psi = psiMin + (psiMax - psiMin ) * (float)rand() / (float)RAND_MAX ;
53  q = 1 ;
54  r0 = 0. ;
55  phi0 = 0. ;
56  z0 = zVert ;
57  if ( (float)rand()/(float)RAND_MAX > 0.5 ) q = -1 ;
58 }