How to create a State




The code below creates a State in the RP::slopes_curv_z state representation. The state representation is the definition of the state vector parameters. This particular representation (specially useful for fitting when the propagating sense cannot be determined from the fit) has a main state vector with 6 parameters (x,y,z,dx/dz,dy/dz,q/p): position (3 parameters), slope (2 parameters) and charge over momentum (1 parameter). The propagating sense of the state in this representation is stored in a separate HyperVector called RP::sense.

// Create and fill the state vector
EVector v(6,0);
v[0]= 0; // x position of the state
v[1]= 0; // y position
v[2]= 0; // z position
v[3]= 0; // x slope (dx/dz)
v[4]= 0; // y slope (dy/dz)
v[5]= 1; // q/p (charge over momentum)

// Create and fill the state matrix
EMatrix C(6,6,0);
C[0][0] = C[1][1] = 1; // square of the position error
C[2][2] = 0 ; // no error in z since this is the running coordinate
C[3][3] = C[4][4] = 0.1; // square of the slope error
C[5][5] = 0.1; // square of 1/p error

// Create and fill the State it self
State state;
// The State representation
state.set_name(RP::rep, RP::slopes_curv_z);
// The main HyperVector
state.set_hv(HyperVector(v,C));
// The secondary sense HyperVector with sense=1 and no error
state.set_hv(RP::sense, HyperVector(1));


Now this state can be propagated, used for matching, as a seed for a Kalman filter fit, etc.

Another representation, which contains all information in the state vector is RP::pos_dir_curv. This representation has a main state vector with 7 parameters (x,y,z,ux,uy,uz, q/p): position (3 parameters), direction (3 parameters) and charge over momentum (1 parameter). Notice that the propagating sense is in this case embeded in the direction vector.