| 21 |
// |
// |
| 22 |
// |
// |
| 23 |
//-------------------------------------- |
//-------------------------------------- |
| 24 |
|
/** |
| 25 |
|
* Evaluates the trajectory in the apparatus associated to the track. |
| 26 |
|
* 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. |
| 27 |
|
* @param t pointer to an object of the class Trajectory, |
| 28 |
|
* which z coordinates should be previously initialized by calling the proper constructor ( Trajectory::Trajectory(int n, float* zin) ). |
| 29 |
|
* @return error flag. |
| 30 |
|
*/ |
| 31 |
|
int Trajectory::DoTrack2(float* al){ |
| 32 |
|
|
| 33 |
|
double *dxout = new double[t->npoint]; |
| 34 |
|
double *dyout = new double[t->npoint]; |
| 35 |
|
double *dthxout = new double[t->npoint]; |
| 36 |
|
double *dthyout = new double[t->npoint]; |
| 37 |
|
double *dtlout = new double[t->npoint]; |
| 38 |
|
double *dzin = new double[t->npoint]; |
| 39 |
|
double dal[5]; |
| 40 |
|
|
| 41 |
|
int ifail = 0; |
| 42 |
|
|
| 43 |
|
for (int i=0; i<5; i++) dal[i] = (double)al[i]; |
| 44 |
|
for (int i=0; i<t->npoint; i++) dzin[i] = (double)z[i]; |
| 45 |
|
|
| 46 |
|
dotrack2_(&(t->npoint),dzin,dxout,dyout,dthxout,dthyout,dtlout,dal,&ifail); |
| 47 |
|
|
| 48 |
|
for (int i=0; i<t->npoint; i++){ |
| 49 |
|
x[i] = (float)*dxout++; |
| 50 |
|
y[i] = (float)*dyout++; |
| 51 |
|
thx[i] = (float)*dthxout++; |
| 52 |
|
thy[i] = (float)*dthyout++; |
| 53 |
|
tl[i] = (float)*dtlout++; |
| 54 |
|
} |
| 55 |
|
|
| 56 |
|
return ifail; |
| 57 |
|
}; |
| 58 |
|
//--------------------------------------------- |
| 59 |
|
//--------------------------------------------- |
| 60 |
TrkTrack::TrkTrack(){ |
TrkTrack::TrkTrack(){ |
| 61 |
seqno = -1; |
seqno = -1; |
| 62 |
image = -1; |
image = -1; |