Changeset 219 in svn for trunk/src/BFieldProp.cc
- Timestamp:
- Feb 2, 2009, 12:33:21 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/BFieldProp.cc
r199 r219 9 9 * */ 10 10 11 #include " interface/BFieldProp.h"11 #include "BFieldProp.h" 12 12 #include<cmath> 13 #include "TMath.h"14 13 using namespace std; 15 14 … … 17 16 //------------------------------------------------------------------------------ 18 17 19 TrackPropagation::TrackPropagation(const string DetDatacard): 20 MAXITERATION(10000), q(-9999.), phi_0(-9999.), gammam(-9999.), omega(-9999.), r(-9999.), 21 x_c(-9999.), y_c(-9999.), R_c(-9999.), Phi_c(-9999.), 22 rr(-9999.), t(-9999.), t_z(-9999.), t_T(-9999.), 23 x_t(-9999.), y_t(-9999.), z_t(-9999.), 24 R_t(-9999.), Phi_t(-9999.), Theta_t(-9999.), Eta_t(-9999.), 25 Px_t(-9999), Py_t(-9999), Pz_t(-9999), PT_t(-9999), p_t(-9999), E_t(-9999) { 26 27 // if(DetDatacard="") { DET = new RESOLution(); } 28 // else DET = new RESOLution(DetDatacard); 29 DET = new RESOLution(); 30 DET->ReadDataCard(DetDatacard); 31 32 // magnetic field parameters 18 TrackPropagation::TrackPropagation(){ 19 DET = new RESOLution(); 20 init(); 21 } 22 23 TrackPropagation::TrackPropagation(const string& DetDatacard){ 24 DET = new RESOLution(); 25 DET->ReadDataCard(DetDatacard); 26 init(); 27 } 28 29 TrackPropagation::TrackPropagation(const RESOLution* DetDatacard){ 30 DET= new RESOLution(*DetDatacard); 31 init(); 32 } 33 34 TrackPropagation::TrackPropagation(const TrackPropagation & tp){ 35 MAXITERATION = tp.MAXITERATION; 36 DET = new RESOLution(*(tp.DET)); 37 R_max = tp.R_max; z_max = tp.z_max; 38 B_x = tp.B_x; B_y = tp.B_y; B_z = tp.B_z; 39 q = tp.q; phi_0 = tp.phi_0; 40 gammam= tp.gammam; omega = tp.omega; 41 r = tp.r; rr = tp.rr; 42 x_c = tp.x_c; y_c = tp.y_c; 43 R_c = tp.R_c; Phi_c = tp.Phi_c; 44 t = tp.t; t_z = tp.t_z; t_T = tp.t_T; 45 x_t = tp.x_t; y_t = tp.y_t; z_t = tp.z_t; 46 R_t = tp.R_t; Phi_t = tp.Phi_t; 47 Theta_t=tp.Theta_t; Eta_t = tp.Eta_t; 48 Px_t = tp.Px_t; Py_t = tp.Py_t; Pz_t = tp.Pz_t; 49 PT_t = tp.PT_t; p_t = tp.p_t; E_t = tp.E_t; 50 loop_overflow_counter = tp.loop_overflow_counter; 51 } 52 53 TrackPropagation& TrackPropagation::operator=(const TrackPropagation & tp) { 54 if(this==&tp) return *this; 55 MAXITERATION = tp.MAXITERATION; 56 DET = new RESOLution(*(tp.DET)); 57 R_max = tp.R_max; z_max = tp.z_max; 58 B_x = tp.B_x; B_y = tp.B_y; B_z = tp.B_z; 59 q = tp.q; phi_0 = tp.phi_0; 60 gammam= tp.gammam; omega = tp.omega; 61 r = tp.r; rr = tp.rr; 62 x_c = tp.x_c; y_c = tp.y_c; 63 R_c = tp.R_c; Phi_c = tp.Phi_c; 64 t = tp.t; t_z = tp.t_z; t_T = tp.t_T; 65 x_t = tp.x_t; y_t = tp.y_t; z_t = tp.z_t; 66 R_t = tp.R_t; Phi_t = tp.Phi_t; 67 Theta_t=tp.Theta_t; Eta_t = tp.Eta_t; 68 Px_t = tp.Px_t; Py_t = tp.Py_t; Pz_t = tp.Pz_t; 69 PT_t = tp.PT_t; p_t = tp.p_t; E_t = tp.E_t; 70 loop_overflow_counter = tp.loop_overflow_counter; 71 return *this; 72 } 73 74 75 76 void TrackPropagation::init() { 77 MAXITERATION = 10000; 78 q= UNDEFINED; phi_0= UNDEFINED; gammam= UNDEFINED; omega=UNDEFINED; r=UNDEFINED; 79 x_c=UNDEFINED; y_c=UNDEFINED; R_c=UNDEFINED; Phi_c=UNDEFINED; 80 rr=UNDEFINED; t=UNDEFINED; t_z=UNDEFINED; t_T=UNDEFINED; 81 x_t=UNDEFINED; y_t=UNDEFINED; z_t=UNDEFINED; 82 R_t=UNDEFINED; Phi_t=UNDEFINED; Theta_t=UNDEFINED; Eta_t=UNDEFINED; 83 Px_t=UNDEFINED; Py_t=UNDEFINED; Pz_t=UNDEFINED; PT_t=UNDEFINED; p_t=UNDEFINED; E_t=UNDEFINED; 84 85 // DET has been initialised in the constructors 86 // magnetic field parameters 33 87 R_max = DET->TRACK_radius; 34 88 z_max = DET->TRACK_length/2.; … … 39 93 loop_overflow_counter=0; 40 94 } 95 96 41 97 42 98 void TrackPropagation::Propagation(const TRootGenParticle *Part,TLorentzVector &momentum) { … … 81 137 rr = sqrt( pow(R_c,2.) + pow(r,2.) ); // temp variable 82 138 t_T=0; 83 t_z = gammam / Part->Pz * (-Part->Z + z_max* TMath::Sign((Float_t)1.,(Float_t)Part->Pz) ) ; 139 int sign_pz= (Part->Pz >0) ? 1 : -1; 140 t_z = gammam / Part->Pz * (-Part->Z + z_max*sign_pz ) ; 84 141 if ( fabs(R_c - r) > R_max || R_c + r < R_max ) t = t_z; 85 142 else { … … 103 160 R_t = sqrt( pow(x_t,2.) + pow(y_t,2.) ); 104 161 Phi_t = atan2( y_t, x_t); 105 /*if(R_t>0) {162 if(R_t>0) { 106 163 Theta_t = acos( z_t / sqrt(z_t*z_t+ R_t*R_t)); 107 164 Eta_t = - log(tan(Theta_t/2.)); … … 109 166 Theta_t=0; Eta_t = 9999; 110 167 } 111 */ 168 112 169 Px_t = - Part->PT * sin(omega*t + phi_0); 113 170 Py_t = Part->PT * cos(omega*t + phi_0); … … 116 173 p_t = sqrt(PT_t*PT_t + Pz_t*Pz_t); 117 174 E_t=sqrt(Part->M*Part->M +p_t); 118 if(p_t != fabs(Pz_t) ) Eta_t = log( (p_t+Pz_t)/(p_t-Pz_t) )/2.;119 if(p_t>0) Theta_t = acos(Pz_t/p_t);175 //if(p_t != fabs(Pz_t) ) Eta_t = log( (p_t+Pz_t)/(p_t-Pz_t) )/2.; 176 //if(p_t>0) Theta_t = acos(Pz_t/p_t); 120 177 momentum.SetPxPyPzE(Px_t,Py_t,Pz_t,E_t); 121 178
Note:
See TracChangeset
for help on using the changeset viewer.