Skip to content

How to truth match simulated events ?

dglazier edited this page Jun 10, 2020 · 1 revision

In the simulated DSTs the "MC truth", or generated, 4-vectors are kept in the hipo file MC::Lund bank for each event. The HipoData class reads these into a std::vector for each event and you may use this to check your reconstructed particles versus the truth values. To do this you must use your won knowledge of your event generator (you may need to inspect your Lund text files directly) to assign which Lund particle corresponds to which FinalState particle. This is done in your FinalState::Define function, for example

 AddParticle("Electron",&_electron,kTRUE,3);
 AddParticle("Proton",&_proton,kTRUE,2);
 AddParticle("Pip",&_pip,kTRUE,0);
 AddParticle("Pim",&_pim,kTRUE,1);

The last number given to each function refers to the order in the LUND file so an event for the above particles may, in LUND format, look like

 1 1 1 211 0 0 -0.26757 0.0414689 1.32739 1.36189 0.13957 0 0 0
 2 -1 1 -211 0 0 0.584867 0.316992 1.56244 1.7039 0.13957 0 0 0
 3 1 1 2212 0 0 0.0908738 -0.184521 0.241232 0.99038 0.938272 0 0 0
 4 -1 1 11 0 0 -0.408171 -0.173939 7.46945 7.48262 0.000510999 0 0 0

For your final state particles you can use p.Truth()._p4 to access this information. There are also functions to give the "resolutions" or differences between truth and reconstructed variables, e.g p.ResP(), p.ResTheta()

The question arises when making different combitorial events as to which combitorial is the truth and by using the truth 4-vectors we can establish which matches the reconstructed event.

In the spirit of using Actions an EventTruthAction class has been added which automates this based on an algorithm which you may want to improve on for your own analysis.

To use this you can add this action to your final state similarly to the other actions,

 EventTruthAction etra("EventTruth");
 FS->RegisterPostKinAction(etra); //PostKin

The useful result of this is the addition of a branch called Truth in your output tree. This is ==1 in the case of the correct event reconstruction and 0 for false combinations.