I have a Monte Carlo simulation with all truth particles and their PDG-ID.
I would like to know the charge of the particle for the PDG-ID.
In do this there is a handy packages called particle that allows to get the particle charge for a given PDG-ID,
e.g. for pion
pid = PDGID(211)
print ('charge= ',three_charge(211))
Now I would like to use the three_charge function using my array in the tree something like
The resulting charge would then be a RVec
The questions can be posed more general:
If I would like to have a function in a python package having as input an integer and output an integer,
how can I run it on an RVec such that a vector is returned ?
I have made an example that you can execute like
Before running you need to install the particle package via
python3 -m pip install particle --user
This package should be predefined somewhere on lxplus, but I do not know here. Anybody knows ?
Here it my example code
testPDGID.py (775 Bytes)
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided