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 "FtfMcTrack.h"
14  #include <stdlib.h>
15 
16 void FtfMcTrack::set ( int _id, float _r0, float _z0, float _phi0,
17  float _pt, float _tanl, float _psi,
18  int _q, int _nHits ) {
19  id = _id ;
20  r0 = _r0 ;
21  z0 = _z0 ;
22  phi0 = _phi0 ;
23  pt = _pt ;
24  tanl = _tanl ;
25  psi = _psi ;
26  q = _q ;
27  nHits = _nHits ;
28 }
29 
30 //*****************************************************************
31 // set Primary
32 //*****************************************************************
33 void FtfMcTrack::setPrimary ( short qIn, float ptIn, float eta, float psiIn ) {
34  q = qIn ;
35  float theta = 2 * atan(exp(-eta )) ;
36  tanl = 1./ tan(theta);
37  pt = ptIn ;
38  psi = psiIn ;
39  r0 = 0. ;
40  phi0 = 0. ;
41  z0 = 0. ;
42 }
43 //*****************************************************************
44 // set Random primary
45 //*****************************************************************
46 void FtfMcTrack::setRandomPrimary ( float ptMin, float ptMax,
47  float etaMin, float etaMax, float psiMin, float psiMax,
48  float zVert ) {
49  pt = ptMin + (ptMax - ptMin ) * (float)rand() / (float)RAND_MAX ;
50  double eta = etaMin + (etaMax - etaMin ) * (float)rand() / (float)RAND_MAX ;
51  double theta = 2 * atan(exp(-eta )) ;
52  tanl = 1./ tan(theta);
53  psi = psiMin + (psiMax - psiMin ) * (float)rand() / (float)RAND_MAX ;
54  q = 1 ;
55  r0 = 0. ;
56  phi0 = 0. ;
57  z0 = zVert ;
58  if ( (float)rand()/(float)RAND_MAX > 0.5 ) q = -1 ;
59 }