Problem calling functions from MCParticle.cc

Dear all,

I have been trying to analyze a sample file in EDM4HEP format using the script read_EDM4HEP.py from /FCCAnalyses/examples/basics/ (FCCAnalyses/examples/basics at basicexamples · HEP-FCC/FCCAnalyses · GitHub). I wanted to look into the PIDs of some particles produced from my sample and therefore looked into the MCParticle.cc code from /FCCAnalyses/analyzers/dataframe to find suitable functions to add in read_EDM4HEP.py. This has however been producing some problems. I was therefore wondering how I can use functions from MCParticle.cc to use in read_EDM4HEP.py to find the PIDs of certain particles. Many thanks in advance.

Sincerely,

Rohini

Dear @Rohini ,

could you maybe explain a bit more in details the issues you have encountered?

Best,
Clement

Dear Clement,

Maybe I can explain the problem I am facing with an example for clarification.

If I want to insert a function in read_EDM4HEP.py that finds the PID of a specific particle from my sample, I look into the MCParticle.cc code and can for example choose to use MCParticle::sel_pdgID::sel_pdgID(int arg_pdg, bool arg_chargeconjugate). When I use this function with appropriate inputs of the int pdg and bool chargeconjugate, for example: .Define(“PID”, “MCParticle::sel_pdgID(9900012, false)”), I get errors like: “no matching constructor for initialization of ‘MCParticle::sel_pdgID’” and also complaints that the number of arguments isn’t correct. This is where I face the problem. Do you possibly know what might be causing this error? Many thanks in advance.

Sincerely,
Rohini

Hi Rohini,

MCParticle::sel_pdgID will return a subset of MC-particles which have a given pdgID. Besides the pdgID of interest, and the bool that determines whether or not you also want the charge-conjugated particles, you need to specify the input collection of MC-particles.
In the EDM4HEP files that are produced with the default configuration, the name of the collection of MC-particles is “Particle”.
So you should try something like:

.Define(“PID”, “MCParticle::sel_pdgID(9900012, false) ( Particle )")

There are a few examples mentioned here:

that you could take a look at, in order to get familiar with the syntax of typical methods.

Cheers,
E.

Dear Emmanuel,

Thank you so much for the help; this solved the problem!

Sincerely,
Rohini