Getting MCParticle indices to use them to get parent indices

Hi,

I wanted to get the parent indices for my MC particles and was trying to use the “get_parentid” function from “MCParticle.h”; but I’m not able to understand how to get the three required arguments for the function.

.Define("MC_parent_indx", "MCParticle::get_parentid(________, Particle, Particle0)")

The second argument will simply be “Particle”, and for the third argument I can define an alias “Particle0”, but how can I get the index vector for the MC particles that goes as the first argument. I could find how to get the MC index for the reco particles but couldn’t find how to get the index vector for the MC particles which would be the first argument. Can someone help me with this?

Thanks.

Sincerely,
Kunal

Hello @kgautam ,

the arguments can be seen here:

now replying to your other question:

but what would I do if I wanted to get the MC indices for all of my MC particles? There is no function similar to "getRP2MC_index" (for ex. like "getMC_index") in the "MCParticle.h". That was my main question.

The index of any collection are simply running using the size of that collection. Or is there something else I do not understand?

Best,
Clement

Hi @clement.helsens ,

I think I’m not able to phrase my question correctly.
In the link that you referred me to, the first argument for the function “get_parentid” is obtained by using the function “get_RP2MC_index”. What that does, if I’m not understanding it wrong, is to get a vector with MC indices corresponding to the reconstructed particles in the collection. What I was wondering was that is there a way to get such a vector of MC indices without involving reconstructed particles at all? Is the following the correct way (since both the particle and its parent would be in the same collection)?

.Define("MC_parent_indx", "MCParticle::get_parentid(Particle0, Particle, Particle0)")

Thank you.

Sincerely,
Kunal