How to simulate a Trajectory




As explained in the SimulationSvc page, RecPack provides the functionality to create a simulated trajectory. The user should add measurement surfaces to the Setup. These are surface with special properties (see this) RP::meas_type and RP::resolution, which tells the system which kind of measurements should be generated. The user provides a simulation seed state, which is propagated an infinite length. In its path to the infinite all intersected measurement surfaces will generate a Measuremet with the appropriate properties in each surface. The vector of measurements generated that way will be returned. Once the measurement surfaces have been added to the Setup and the simulation seed has been cretated this is the necessary code to simulate the trajectory.

// Create a trajectory, where the true states (intersection with measurement surfaces) will be saved
Trajectory sim_traj;

// Create a vector of Measurements that will be filled by the simulation service
std::vector< Measurement* > meas_vector;

// simulate a set of measurements (meas_vector) provided a simulation seed state (sim_state)
// sim_traj contains the simulated measurements and also the simulated true states
// (intersection with measurement surfaces), that are needed to compute the pulls

man().simulation_svc().simulate(sim_state,sim_traj,meas_vector);

// create a trajectory and add the simulated measurements to the trajectory
Trajectory traj;
traj.add_constituents(meas_vector);



The simple example provided with the RecPack git distribution shows how to create a simulated trajectory that is later fitted.