Table of Contents

How to implement a MC associator

Idea

Sometimes it may be necessary to associate a Particle to a MCParticle (truthmatching) in a self written C++-code.

Implementation

To associate a MCParticle to a Particle in DaVinci, implement the following (works for DaVinci v25r4).

Header:

#include "Kernel/IParticle2MCAssociator.h"
...
IParticle2MCAssociator* m_p2mcAssoc;

cpp-file:

std::string p2mcAssocType("DaVinciSmartAssociator");
m_p2mcAssoc = tool<IParticle2MCAssociator>(p2mcAssocType,this);
... 
const LHCb::MCParticle* mcp;
mcp = m_p2mcAssoc->relatedMCP(*iParticle);

where *iParticle is a pointer to a Particle.