| 12 |
extern "C" { |
extern "C" { |
| 13 |
void dotrack_(int*, double*, double*, double*, double*, int*); |
void dotrack_(int*, double*, double*, double*, double*, int*); |
| 14 |
void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*); |
void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*); |
| 15 |
|
void dotrack3_(int*, double*, double*, double*, double*,double*, double*, double*,double*,int*); |
| 16 |
void mini2_(int*,int*,int*); |
void mini2_(int*,int*,int*); |
| 17 |
void guess_(); |
void guess_(); |
| 18 |
void gufld_(float*, float*); |
void gufld_(float*, float*); |
| 178 |
// |
// |
| 179 |
//-------------------------------------- |
//-------------------------------------- |
| 180 |
/** |
/** |
|
* Evaluates the trajectory in the apparatus associated to the track. |
|
|
* It integrates the equations of motion in the magnetic field. The magnetic field should be previously loaded ( by calling TrkLevel2::LoadField() ), otherwise an error message is returned. |
|
|
* @param t pointer to an object of the class Trajectory, |
|
|
* which z coordinates should be previously initialized by calling the proper constructor ( Trajectory::Trajectory(int n, float* zin) ). |
|
|
* @return error flag. |
|
| 181 |
* |
* |
| 182 |
* >>> OBSOLETE !!! use TrkTrack::DoTrack2(Trajectory* t) instead |
* >>> OBSOLETE !!! use TrkTrack::DoTrack(Trajectory* t) instead |
| 183 |
* |
* |
| 184 |
*/ |
*/ |
| 185 |
int TrkTrack::DoTrack(Trajectory* t){ |
int TrkTrack::DoTrack2(Trajectory* t){ |
|
|
|
|
cout << " int TrkTrack::DoTrack(Trajectory* t) --->> OBSOLETE !!! "<<endl; |
|
|
cout << " use int TrkTrack::DoTrack2(Trajectory* t)"<<endl; |
|
|
|
|
|
double *dxout = new double[t->npoint]; |
|
|
double *dyout = new double[t->npoint]; |
|
|
double *dzin = new double[t->npoint]; |
|
|
double dal[5]; |
|
|
|
|
|
int ifail = 0; |
|
|
|
|
|
for (int i=0; i<5; i++) dal[i] = (double)al[i]; |
|
|
for (int i=0; i<t->npoint; i++) dzin[i] = (double)t->z[i]; |
|
| 186 |
|
|
| 187 |
TrkParams::Load(1); |
cout << endl; |
| 188 |
if( !TrkParams::IsLoaded(1) ){ |
cout << " int TrkTrack::DoTrack2(Trajectory* t) --->> NB NB !! this method is going to be eliminated !!! "<<endl; |
| 189 |
cout << "int TrkTrack::DoTrack(Trajectory* t) --- ERROR --- m.field not loaded"<<endl; |
cout << " >>>> replace it with TrkTrack::DoTrack(Trajectory* t) <<<<"<<endl; |
| 190 |
return 0; |
cout << " (Sorry Wolfgang!! Don't be totally confused!! By Elena)"<<endl; |
| 191 |
} |
cout << endl; |
|
dotrack_(&(t->npoint),dzin,dxout,dyout,dal,&ifail); |
|
|
|
|
|
for (int i=0; i<t->npoint; i++){ |
|
|
t->x[i] = (float)*(dxout+i); |
|
|
t->y[i] = (float)*(dyout+i); |
|
|
} |
|
| 192 |
|
|
| 193 |
delete [] dxout; |
return DoTrack(t); |
|
delete [] dyout; |
|
|
delete [] dzin; |
|
| 194 |
|
|
|
return ifail; |
|
| 195 |
}; |
}; |
| 196 |
//-------------------------------------- |
//-------------------------------------- |
| 197 |
// |
// |
| 198 |
// |
// |
| 199 |
//-------------------------------------- |
//-------------------------------------- |
| 200 |
/** |
/** |
| 201 |
* Evaluates the trajectory in the apparatus associated to the track. |
* Evaluates the trajectory in the apparatus associated to the track state-vector. |
| 202 |
* It integrates the equations of motion in the magnetic field. The magnetic field should be previously loaded ( by calling TrkLevel2::LoadField() ), otherwise an error message is returned. |
* It integrates the equations of motion in the magnetic field. |
| 203 |
* @param t pointer to an object of the class Trajectory, |
* @param t pointer to an object of the class Trajectory, |
| 204 |
* which z coordinates should be previously initialized by calling the proper constructor ( Trajectory::Trajectory(int n, float* zin) ). |
* which z coordinates should be previously assigned. |
| 205 |
* @return error flag. |
* @return error flag. |
| 206 |
*/ |
*/ |
| 207 |
int TrkTrack::DoTrack2(Trajectory* t){ |
int TrkTrack::DoTrack(Trajectory* t){ |
| 208 |
|
|
| 209 |
double *dxout = new double[t->npoint]; |
double *dxout = new double[t->npoint]; |
| 210 |
double *dyout = new double[t->npoint]; |
double *dyout = new double[t->npoint]; |
| 221 |
|
|
| 222 |
TrkParams::Load(1); |
TrkParams::Load(1); |
| 223 |
if( !TrkParams::IsLoaded(1) ){ |
if( !TrkParams::IsLoaded(1) ){ |
| 224 |
cout << "int TrkTrack::DoTrack2(Trajectory* t) --- ERROR --- m.field not loaded"<<endl; |
cout << "int TrkTrack::DoTrack(Trajectory* t) --- ERROR --- m.field not loaded"<<endl; |
| 225 |
return 0; |
return 0; |
| 226 |
} |
} |
| 227 |
dotrack2_(&(t->npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail); |
dotrack2_(&(t->npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail); |
| 374 |
return (last_plane-first_plane+1); |
return (last_plane-first_plane+1); |
| 375 |
} |
} |
| 376 |
/** |
/** |
| 377 |
|
* Returns the track "lever-arm" on the x+y view, defined as the distance (in planes) between |
| 378 |
|
* the upper and lower x,y (couple) measurements (the maximum value of lever-arm is 6). |
| 379 |
|
*/ |
| 380 |
|
Int_t TrkTrack::GetLeverArmXY(){ |
| 381 |
|
int first_plane = -1; |
| 382 |
|
int last_plane = -1; |
| 383 |
|
for(Int_t ip=0; ip<6; ip++){ |
| 384 |
|
if( XGood(ip)*YGood(ip) && first_plane == -1 )first_plane = ip; |
| 385 |
|
if( XGood(ip)*YGood(ip) && first_plane != -1 )last_plane = ip; |
| 386 |
|
} |
| 387 |
|
if( first_plane == -1 || last_plane == -1){ |
| 388 |
|
cout<< "Int_t TrkTrack::GetLeverArmXY() -- XGood(ip)*YGood(ip) always false ??? "<<endl; |
| 389 |
|
return 0; |
| 390 |
|
} |
| 391 |
|
return (last_plane-first_plane+1); |
| 392 |
|
} |
| 393 |
|
/** |
| 394 |
* Returns the reduced chi-square of track x-projection |
* Returns the reduced chi-square of track x-projection |
| 395 |
*/ |
*/ |
| 396 |
Float_t TrkTrack::GetChi2X(){ |
Float_t TrkTrack::GetChi2X(){ |
| 601 |
4.52043, |
4.52043, |
| 602 |
4.29926}; |
4.29926}; |
| 603 |
int index; |
int index; |
| 604 |
float fact; |
float fact=0.; |
| 605 |
for(int i=0; i<6; i++) { |
for(int i=0; i<6; i++) { |
| 606 |
index = int((fabs(axv[i])+1.)/2.); |
index = int((fabs(axv[i])+1.)/2.); |
| 607 |
if(index>10) index=10; |
if(index>10) index=10; |
| 648 |
|
|
| 649 |
TrkParams::Set(path,1); |
TrkParams::Set(path,1); |
| 650 |
TrkParams::Load(1); |
TrkParams::Load(1); |
| 651 |
|
if( !TrkParams::IsLoaded(1) ){ |
| 652 |
|
cout << "void TrkTrack::LoadField(TString path) --- ERROR --- m.field not loaded"<<endl; |
| 653 |
|
} |
| 654 |
|
|
| 655 |
}; |
}; |
| 656 |
|
|
| 792 |
|
|
| 793 |
// cout << "void TrkTrack::GetClusterositions() "<<endl; |
// cout << "void TrkTrack::GetClusterositions() "<<endl; |
| 794 |
|
|
| 795 |
TrkParams::Load( ); |
TrkParams::Load(1); |
| 796 |
if( !TrkParams::IsLoaded() )return false; |
if( !TrkParams::IsLoaded(1) ){ |
| 797 |
|
cout << "Bool_t TrkTrack::EvaluateClusterPositions() ---ERROR--- m.field not loaded "<<endl; |
| 798 |
|
return false; |
| 799 |
|
} |
| 800 |
|
TrkParams::Load(4); |
| 801 |
|
if( !TrkParams::IsLoaded(4) ){ |
| 802 |
|
cout << "Bool_t TrkTrack::EvaluateClusterPositions() ---ERROR--- p.f.a. par. not loaded "<<endl; |
| 803 |
|
return false; |
| 804 |
|
} |
| 805 |
|
TrkParams::Load(5); |
| 806 |
|
if( !TrkParams::IsLoaded(5) ){ |
| 807 |
|
cout << "Bool_t TrkTrack::EvaluateClusterPositions() ---ERROR--- alignment par. not loaded "<<endl; |
| 808 |
|
return false; |
| 809 |
|
} |
| 810 |
|
|
| 811 |
for(int ip=0; ip<6; ip++){ |
for(int ip=0; ip<6; ip++){ |
| 812 |
// cout << ip<<" ** "<<xm[ip]<<" / "<<ym[ip]<<endl;; |
// cout << ip<<" ** "<<xm[ip]<<" / "<<ym[ip]<<endl;; |
| 813 |
int icx = GetClusterX_ID(ip)+1; |
int icx = GetClusterX_ID(ip)+1; |
| 859 |
*/ |
*/ |
| 860 |
void TrkTrack::Fit(double pfixed, int& fail, int iprint, int froml1){ |
void TrkTrack::Fit(double pfixed, int& fail, int iprint, int froml1){ |
| 861 |
|
|
| 862 |
float al_ini[] = {0.,0.,0.,0.,0.}; |
TrkParams::Load(1); |
| 863 |
|
if( !TrkParams::IsLoaded(1) ){ |
| 864 |
|
cout << "void TrkTrack::Fit(double,int&,int,int) ---ERROR--- m.field not loaded "<<endl; |
| 865 |
|
return; |
| 866 |
|
} |
| 867 |
|
TrkParams::Load(5); |
| 868 |
|
if( !TrkParams::IsLoaded(5) ){ |
| 869 |
|
cout << "void TrkTrack::Fit(double,int&,int,int) ---ERROR--- align.param. not loaded "<<endl; |
| 870 |
|
return; |
| 871 |
|
} |
| 872 |
|
|
| 873 |
TrkParams::Load( ); |
float al_ini[] = {0.,0.,0.,0.,0.}; |
|
if( !TrkParams::IsLoaded() )return; |
|
| 874 |
|
|
| 875 |
extern cMini2track track_; |
extern cMini2track track_; |
| 876 |
fail = 0; |
fail = 0; |
| 906 |
|
|
| 907 |
// ------------------------------------------ |
// ------------------------------------------ |
| 908 |
// call mini routine |
// call mini routine |
| 909 |
// TrkParams::Load(1); |
// ------------------------------------------ |
|
// if( !TrkParams::IsLoaded(1) ){ |
|
|
// cout << "void TrkTrack::Fit(double pfixed, int& fail, int iprint) --- ERROR --- m.field not loaded"<<endl; |
|
|
// return; |
|
|
// } |
|
| 910 |
int istep=0; |
int istep=0; |
| 911 |
int ifail=0; |
int ifail=0; |
| 912 |
mini2_(&istep,&ifail, &iprint); |
mini2_(&istep,&ifail, &iprint); |
| 1019 |
* by the intersection among magnet cavity, silicon-plane sensitive area and |
* by the intersection among magnet cavity, silicon-plane sensitive area and |
| 1020 |
* ToF sensitive area (nominal values from the official document used to |
* ToF sensitive area (nominal values from the official document used to |
| 1021 |
* calculate the geometrical factor) |
* calculate the geometrical factor) |
| 1022 |
|
* @param toll Tolerance around the nominal volume (toll>0 define an inner fiducial volume) |
| 1023 |
*/ |
*/ |
| 1024 |
Bool_t TrkTrack::IsInsideAcceptance(){ |
// Bool_t TrkTrack::IsInsideAcceptance(){ |
| 1025 |
|
|
| 1026 |
|
// int ngf = TrkParams::nGF; |
| 1027 |
|
// for(int i=0; i<ngf; i++){ |
| 1028 |
|
// if( |
| 1029 |
|
// xGF[i] <= TrkParams::xGF_min[i] || |
| 1030 |
|
// xGF[i] >= TrkParams::xGF_max[i] || |
| 1031 |
|
// yGF[i] <= TrkParams::yGF_min[i] || |
| 1032 |
|
// yGF[i] >= TrkParams::yGF_max[i] || |
| 1033 |
|
// false)return false; |
| 1034 |
|
// } |
| 1035 |
|
// return true; |
| 1036 |
|
|
| 1037 |
|
// } |
| 1038 |
|
Bool_t TrkTrack::IsInsideAcceptance(float toll){ |
| 1039 |
|
|
| 1040 |
|
|
| 1041 |
int ngf = TrkParams::nGF; |
int ngf = TrkParams::nGF; |
| 1042 |
for(int i=0; i<ngf; i++){ |
for(int i=0; i<ngf; i++){ |
| 1043 |
|
// |
| 1044 |
|
// cout << endl << TrkParams::GF_element[i]; |
| 1045 |
|
if( |
| 1046 |
|
TrkParams::GF_element[i].CompareTo("S11") && |
| 1047 |
|
TrkParams::GF_element[i].CompareTo("S12") && |
| 1048 |
|
TrkParams::GF_element[i].CompareTo("S21") && |
| 1049 |
|
TrkParams::GF_element[i].CompareTo("S22") && |
| 1050 |
|
TrkParams::GF_element[i].CompareTo("T1") && |
| 1051 |
|
TrkParams::GF_element[i].CompareTo("CUF") && |
| 1052 |
|
TrkParams::GF_element[i].CompareTo("T2") && |
| 1053 |
|
TrkParams::GF_element[i].CompareTo("T3") && |
| 1054 |
|
TrkParams::GF_element[i].CompareTo("T4") && |
| 1055 |
|
TrkParams::GF_element[i].CompareTo("T5") && |
| 1056 |
|
TrkParams::GF_element[i].CompareTo("CLF") && |
| 1057 |
|
TrkParams::GF_element[i].CompareTo("T6") && |
| 1058 |
|
TrkParams::GF_element[i].CompareTo("S31") && |
| 1059 |
|
TrkParams::GF_element[i].CompareTo("S32") && |
| 1060 |
|
true)continue; |
| 1061 |
|
// apply condition only within the cavity |
| 1062 |
|
// cout << " -- "<<xGF[i]<<" "<<yGF[i]; |
| 1063 |
if( |
if( |
| 1064 |
xGF[i] <= TrkParams::xGF_min[i] || |
xGF[i] <= TrkParams::xGF_min[i] + toll || |
| 1065 |
xGF[i] >= TrkParams::xGF_max[i] || |
xGF[i] >= TrkParams::xGF_max[i] - toll || |
| 1066 |
yGF[i] <= TrkParams::yGF_min[i] || |
yGF[i] <= TrkParams::yGF_min[i] + toll || |
| 1067 |
yGF[i] >= TrkParams::yGF_max[i] || |
yGF[i] >= TrkParams::yGF_max[i] - toll || |
| 1068 |
false)return false; |
false){ |
| 1069 |
|
|
| 1070 |
|
return false; |
| 1071 |
|
} |
| 1072 |
} |
} |
| 1073 |
return true; |
return true; |
| 1074 |
|
} |
| 1075 |
|
|
| 1076 |
|
/** |
| 1077 |
|
* Returns true if the track is inside one of the surfaces which define the |
| 1078 |
|
* geometrical acceptance. |
| 1079 |
|
* @param surf tag of the surface (possible values are: S11 S12 S21 S22 T1 |
| 1080 |
|
* CUF T2 T3 T4 T5 CLF T6 S31 S32). |
| 1081 |
|
* @param toll Tolerance around the nominal surface (toll>0 define an inner |
| 1082 |
|
* fiducial surface) |
| 1083 |
|
*/ |
| 1084 |
|
Bool_t TrkTrack::IsInsideGFSurface(const char* surf, float toll){ |
| 1085 |
|
|
| 1086 |
|
|
| 1087 |
|
int ngf = TrkParams::nGF; |
| 1088 |
|
bool SURFOK = false; |
| 1089 |
|
for(int i=0; i<ngf; i++){ |
| 1090 |
|
if( !TrkParams::GF_element[i].CompareTo(surf) ){ |
| 1091 |
|
SURFOK=true; |
| 1092 |
|
if( |
| 1093 |
|
xGF[i] > TrkParams::xGF_min[i] + toll && |
| 1094 |
|
xGF[i] < TrkParams::xGF_max[i] - toll && |
| 1095 |
|
yGF[i] > TrkParams::yGF_min[i] + toll && |
| 1096 |
|
yGF[i] < TrkParams::yGF_max[i] - toll && |
| 1097 |
|
true)return true; |
| 1098 |
|
} |
| 1099 |
|
} |
| 1100 |
|
if( !SURFOK )cout << " Bool_t TrkTrack::IsInsideGFSurface(char* surf, float toll) --> suface "<<surf<<" not defined "<<endl; |
| 1101 |
|
return false; |
| 1102 |
|
|
| 1103 |
} |
} |
| 1104 |
|
|
| 1105 |
/** |
/** |
| 1106 |
* Method to retrieve ID (0,1,...) of x-cluster (if any) associated to this track. |
* Method to retrieve ID (0,1,...) of x-cluster (if any) associated to this track. |
| 1107 |
* If no cluster is associated, ID=-1. |
* If no cluster is associated, ID=-1. |
| 1274 |
vto = iv+1; |
vto = iv+1; |
| 1275 |
} |
} |
| 1276 |
for(int i=pfrom; i<pto; i++) |
for(int i=pfrom; i<pto; i++) |
| 1277 |
for(int j=0; j<vto; j++) |
for(int j=vfrom; j<vto; j++){ |
| 1278 |
if(GetDEDX(i,j)>max)max=GetDEDX(i,j); |
if(j==0 && XGood(i) && GetDEDX(i,j)>max)max=GetDEDX(i,j); |
| 1279 |
|
if(j==1 && YGood(i) && GetDEDX(i,j)>max)max=GetDEDX(i,j); |
| 1280 |
|
} |
| 1281 |
return max; |
return max; |
| 1282 |
|
|
| 1283 |
}; |
}; |
| 1300 |
vto = iv+1; |
vto = iv+1; |
| 1301 |
} |
} |
| 1302 |
for(int i=pfrom; i<pto; i++) |
for(int i=pfrom; i<pto; i++) |
| 1303 |
for(int j=0; j<vto; j++) |
for(int j=vfrom; j<vto; j++){ |
| 1304 |
if(GetDEDX(i,j)<min)min=GetDEDX(i,j); |
if(j==0 && XGood(i) && GetDEDX(i,j)<min)min=GetDEDX(i,j); |
| 1305 |
|
if(j==1 && YGood(i) && GetDEDX(i,j)<min)min=GetDEDX(i,j); |
| 1306 |
|
} |
| 1307 |
return min; |
return min; |
| 1308 |
|
|
| 1309 |
}; |
}; |
| 1310 |
|
|
| 1311 |
/** |
/** |
| 1312 |
* \brief Give the maximum spatial residual release |
* \brief Give the maximum spatial residual |
| 1313 |
*/ |
*/ |
| 1314 |
Float_t TrkTrack::GetResidual_max(int ip, int iv){ |
Float_t TrkTrack::GetResidual_max(int ip, int iv){ |
| 1315 |
Float_t max=0; |
Float_t max=0; |
| 1326 |
vto = iv+1; |
vto = iv+1; |
| 1327 |
} |
} |
| 1328 |
for(int i=pfrom; i<pto; i++){ |
for(int i=pfrom; i<pto; i++){ |
| 1329 |
for(int j=0; j<vto; j++){ |
for(int j=vfrom; j<vto; j++){ |
| 1330 |
if(j==0 && XGood(i) && fabs(xm[i]-xv[i])>fabs(max))max=xv[i]-xm[i]; |
if(j==0 && XGood(i) && fabs(xm[i]-xv[i])>fabs(max))max=xm[i]-xv[i]; |
| 1331 |
if(j==1 && YGood(i) && fabs(ym[i]-yv[i])>fabs(max))max=yv[i]-ym[i]; |
if(j==1 && YGood(i) && fabs(ym[i]-yv[i])>fabs(max))max=ym[i]-yv[i]; |
| 1332 |
} |
} |
| 1333 |
} |
} |
| 1334 |
return max; |
return max; |
| 1335 |
|
|
| 1336 |
}; |
}; |
| 1337 |
|
/** |
| 1338 |
|
* \brief Give the anerage spatial residual |
| 1339 |
|
*/ |
| 1340 |
|
Float_t TrkTrack::GetResidual_av(int ip, int iv){ |
| 1341 |
|
// |
| 1342 |
|
//Sum$((xm>-50)*(xm-xv)/resx)/sqrt(TrkTrack.GetNX()*TrkTrack.GetChi2X())<0.3 |
| 1343 |
|
|
| 1344 |
|
Float_t av = 0.; |
| 1345 |
|
int nav = 0; |
| 1346 |
|
// |
| 1347 |
|
int pfrom = 0; |
| 1348 |
|
int pto = 6; |
| 1349 |
|
int vfrom = 0; |
| 1350 |
|
int vto = 2; |
| 1351 |
|
if(ip>=0&&ip<6){ |
| 1352 |
|
pfrom = ip; |
| 1353 |
|
pto = ip+1; |
| 1354 |
|
} |
| 1355 |
|
if(iv>=0&&iv<2){ |
| 1356 |
|
vfrom = iv; |
| 1357 |
|
vto = iv+1; |
| 1358 |
|
} |
| 1359 |
|
for(int i=pfrom; i<pto; i++){ |
| 1360 |
|
for(int j=vfrom; j<vto; j++){ |
| 1361 |
|
nav++; |
| 1362 |
|
if(j==0 && XGood(i)) av += (xm[i]-xv[i])/resx[i]; |
| 1363 |
|
if(j==1 && YGood(i)) av += (ym[i]-yv[i])/resy[i]; |
| 1364 |
|
} |
| 1365 |
|
} |
| 1366 |
|
if(nav==0)return -100.; |
| 1367 |
|
return av/nav; |
| 1368 |
|
|
| 1369 |
|
}; |
| 1370 |
|
|
| 1371 |
|
|
| 1372 |
/** |
/** |
| 1749 |
int ngf = TrkParams::nGF; |
int ngf = TrkParams::nGF; |
| 1750 |
float *zgf = TrkParams::zGF; |
float *zgf = TrkParams::zGF; |
| 1751 |
Trajectory tgf = Trajectory(ngf,zgf); |
Trajectory tgf = Trajectory(ngf,zgf); |
| 1752 |
tgf.DoTrack2(t_track->al);//<<<< integrate the trajectory |
tgf.DoTrack(t_track->al);//<<<< integrate the trajectory |
| 1753 |
for(int ip=0; ip<ngf; ip++){ |
for(int ip=0; ip<ngf; ip++){ |
| 1754 |
t_track->xGF[ip] = tgf.x[ip]; |
t_track->xGF[ip] = tgf.x[ip]; |
| 1755 |
t_track->yGF[ip] = tgf.y[ip]; |
t_track->yGF[ip] = tgf.y[ip]; |
| 1907 |
|
|
| 1908 |
if(!Track)return 0; |
if(!Track)return 0; |
| 1909 |
|
|
| 1910 |
TRefArray *sorted = new TRefArray(); |
// TRefArray *sorted = new TRefArray(); |
| 1911 |
|
TRefArray *sorted = NULL; |
| 1912 |
|
|
| 1913 |
TClonesArray &t = *Track; |
TClonesArray &t = *Track; |
| 1914 |
// TClonesArray &ts = *PhysicalTrack; |
// TClonesArray &ts = *PhysicalTrack; |
| 1946 |
|
|
| 1947 |
// cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl; |
// cout << "i** "<< ((TrkTrack *)t[indi])->image << " " << nfiti <<" "<<chi2i<<endl; |
| 1948 |
}; |
}; |
| 1949 |
|
if(!sorted)sorted = new TRefArray( TProcessID::GetProcessWithUID(t[indi])); |
| 1950 |
sorted->Add( (TrkTrack*)t[indi] ); |
sorted->Add( (TrkTrack*)t[indi] ); |
| 1951 |
|
|
| 1952 |
m[indi] = 0; |
m[indi] = 0; |
| 2117 |
|
|
| 2118 |
TrkParams::Set(path,1); |
TrkParams::Set(path,1); |
| 2119 |
TrkParams::Load(1); |
TrkParams::Load(1); |
| 2120 |
|
if( !TrkParams::IsLoaded(1) ){ |
| 2121 |
|
cout << "void TrkLevel2::LoadField(TString path) --- ERROR --- m.field not loaded"<<endl; |
| 2122 |
|
} |
| 2123 |
|
|
| 2124 |
// |
// |
| 2125 |
}; |
}; |
| 2307 |
|
|
| 2308 |
/** |
/** |
| 2309 |
* Evaluates the trajectory in the apparatus associated to the track. |
* Evaluates the trajectory in the apparatus associated to the track. |
| 2310 |
* It integrates the equations of motion in the magnetic field. The magnetic field should be previously loaded ( by calling TrkLevel2::LoadField() ), otherwise an error message is returned. |
* It integrates the equations of motion in the magnetic field. |
| 2311 |
* @param t pointer to an object of the class Trajectory, |
* @param al Track state-vector (X0,Y0,sin(theta),phi,deflection). |
| 2312 |
* which z coordinates should be previously initialized by calling the proper constructor ( Trajectory::Trajectory(int n, float* zin) ). |
* @param zini z-coordinate of the reference plane (Z0). |
| 2313 |
* @return error flag. |
* @return error flag. |
| 2314 |
|
* |
| 2315 |
|
* This method is needed when you want to integrate the particle trajectory |
| 2316 |
|
* starting from a track state-vector relative to an arbitrary reference plane. |
| 2317 |
|
* The default reference plane, used by the tracker routines, is at zini=23.5. |
| 2318 |
|
* If you give as input the track state-vector from a TrkTrack object, |
| 2319 |
|
* you can use Trajectory::DoTrack(float* al) instead. |
| 2320 |
*/ |
*/ |
| 2321 |
int Trajectory::DoTrack2(float* al){ |
int Trajectory::DoTrack(float* al, float zini){ |
| 2322 |
|
|
| 2323 |
// double *dxout = new double[npoint]; |
// double *dxout = new double[npoint]; |
| 2324 |
// double *dyout = new double[npoint]; |
// double *dyout = new double[npoint]; |
| 2327 |
// double *dtlout = new double[npoint]; |
// double *dtlout = new double[npoint]; |
| 2328 |
// double *dzin = new double[npoint]; |
// double *dzin = new double[npoint]; |
| 2329 |
|
|
| 2330 |
double *dxout; |
double *dxout; |
| 2331 |
double *dyout; |
double *dyout; |
| 2332 |
double *dthxout; |
double *dthxout; |
| 2333 |
double *dthyout; |
double *dthyout; |
| 2334 |
double *dtlout; |
double *dtlout; |
| 2335 |
double *dzin; |
double *dzin; |
| 2336 |
|
|
| 2337 |
dxout = (double*) malloc(npoint*sizeof(double)); |
dxout = (double*) malloc(npoint*sizeof(double)); |
| 2338 |
dyout = (double*) malloc(npoint*sizeof(double)); |
dyout = (double*) malloc(npoint*sizeof(double)); |
| 2339 |
dthxout = (double*) malloc(npoint*sizeof(double)); |
dthxout = (double*) malloc(npoint*sizeof(double)); |
| 2340 |
dthyout = (double*) malloc(npoint*sizeof(double)); |
dthyout = (double*) malloc(npoint*sizeof(double)); |
| 2341 |
dtlout = (double*) malloc(npoint*sizeof(double)); |
dtlout = (double*) malloc(npoint*sizeof(double)); |
| 2342 |
dzin = (double*) malloc(npoint*sizeof(double)); |
dzin = (double*) malloc(npoint*sizeof(double)); |
| 2343 |
|
|
| 2344 |
|
double dal[5]; |
| 2345 |
|
|
| 2346 |
double dal[5]; |
double dzini = (double)zini; |
| 2347 |
|
|
| 2348 |
int ifail = 0; |
int ifail = 0; |
| 2349 |
|
|
| 2350 |
for (int i=0; i<5; i++) dal[i] = (double)al[i]; |
for (int i=0; i<5; i++) dal[i] = (double)al[i]; |
| 2351 |
for (int i=0; i<npoint; i++) dzin[i] = (double)z[i]; |
for (int i=0; i<npoint; i++) dzin[i] = (double)z[i]; |
| 2352 |
|
|
| 2353 |
TrkParams::Load(1); |
TrkParams::Load(1); |
| 2354 |
if( !TrkParams::IsLoaded(1) ){ |
if( !TrkParams::IsLoaded(1) ){ |
| 2355 |
cout << "int Trajectory::DoTrack2(float* al) --- ERROR --- m.field not loaded"<<endl; |
cout << "int Trajectory::DoTrack(float* al) --- ERROR --- m.field not loaded"<<endl; |
| 2356 |
return 0; |
return 0; |
| 2357 |
} |
} |
| 2358 |
dotrack2_(&(npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail); |
// dotrack2_(&(npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail); |
| 2359 |
|
dotrack3_(&(npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&dzini,&ifail); |
| 2360 |
|
|
| 2361 |
for (int i=0; i<npoint; i++){ |
for (int i=0; i<npoint; i++){ |
| 2362 |
x[i] = (float)*(dxout+i); |
x[i] = (float)*(dxout+i); |
| 2384 |
return ifail; |
return ifail; |
| 2385 |
}; |
}; |
| 2386 |
|
|
| 2387 |
|
/** |
| 2388 |
|
* |
| 2389 |
|
* >>> OBSOLETE !!! use Trajectory::DoTrack(float* al, float zini) instead |
| 2390 |
|
* |
| 2391 |
|
*/ |
| 2392 |
|
int Trajectory::DoTrack2(float* al, float zini){ |
| 2393 |
|
|
| 2394 |
|
cout << endl; |
| 2395 |
|
cout << " int Trajectory::DoTrack2(float* al, float zini) --->> NB NB !! this method is going to be eliminated !!! "<<endl; |
| 2396 |
|
cout << " >>>> replace it with TrkTrack::DoTrack(Trajectory* t) <<<<"<<endl; |
| 2397 |
|
cout << " (Sorry Wolfgang!! Don't be totally confused!! By Elena)"<<endl; |
| 2398 |
|
cout << endl; |
| 2399 |
|
|
| 2400 |
|
return DoTrack(al,zini); |
| 2401 |
|
|
| 2402 |
|
}; |
| 2403 |
|
|
| 2404 |
|
|
| 2405 |
|
|
| 2406 |
ClassImp(TrkLevel2); |
ClassImp(TrkLevel2); |
| 2407 |
ClassImp(TrkSinglet); |
ClassImp(TrkSinglet); |
| 2408 |
ClassImp(TrkTrack); |
ClassImp(TrkTrack); |