25 if (mid < 0 or mid > pcontainer.size()) {
28 return &(pcontainer[mid]);
34 if (did < 0 or did > pcontainer.size()) {
37 return &(pcontainer[did]);
43 if (did < 0 or did > pcontainer.size()) {
46 return &(pcontainer[did]);
52 if (did < 0 or did > pcontainer.size()) {
55 return &(pcontainer[did]);
66 if (
ptr->isPrimary()) {
88 if ((hepmcStatusCode > 1) && (pdg != 130) && p.
isPrimary()) {
105 const auto ipm =
getMother(p, pcontainer);
106 if (ipm !=
nullptr) {
107 if (std::abs(ipm->GetPdgCode()) == 130) {
116 if (ipd && ipd->GetPdgCode() == 22) {
128 int mpdg = std::abs(pm->GetPdgCode());
130 if ((mpdg == 3212) && pm->isPrimary()) {
137 if ((mpdg == kPi0) && pm->isPrimary()) {
142 int mfl =
int(mpdg / std::pow(10,
int(std::log10(mpdg))));
151 if (pm->isPrimary()) {
157 while (!pm->isPrimary()) {
160 mpdg = std::abs(pm->GetPdgCode());
161 mfl =
int(mpdg / std::pow(10,
int(std::log10(mpdg))));
182 if (!mother || mother->isPrimary()) {
191 auto isFromPrimaryPairProduction = [&pcontainer](
const MCTrack& part) {
197 if (part.getProcess() != kPPair) {
200 auto mother =
getMother(part, pcontainer);
201 if (!mother || mother->isPrimary()) {
213 auto status = particle.GetStatusCode();
Utility functions for MC particles.
int getProcess() const
get the production process (id) of this track
o2::mcgenstatus::MCGenStatusEncoding getStatusCode() const
get generator status code
Int_t getFirstDaughterTrackId() const
Int_t getLastDaughterTrackId() const
Int_t GetPdgCode() const
Accessors.
Int_t getMotherTrackId() const
static void encodeParticleStatusAndTracking(TParticle &particle, bool wanttracking=true)
static o2::MCTrack const * getMother(o2::MCTrack const &p, std::vector< o2::MCTrack > const &pcontainer)
Given an MCTrack p; Return it's direct mother or nullptr. (we follow only first mother)
static bool isPhysicalPrimary(o2::MCTrack const &p, std::vector< o2::MCTrack > const &pcontainer)
static o2::MCTrack const & getFirstPrimary(o2::MCTrack const &p, std::vector< o2::MCTrack > const &pcontainer)
static o2::MCTrack const * getDaughter1(o2::MCTrack const &p, std::vector< o2::MCTrack > const &pcontainer)
Given an MCTrack p; Return it's second direct daughter or nullptr.
static bool isFromPrimaryDecayChain(o2::MCTrack const &p, std::vector< o2::MCTrack > const &pcontainer)
static o2::MCTrack const * getDaughter(o2::MCTrack const &p, std::vector< o2::MCTrack > const &pcontainer)
Given an MCTrack p; Return it's direct daughter or nullptr. (we follow only first daughter)
static o2::MCTrack const * getDaughter0(o2::MCTrack const &p, std::vector< o2::MCTrack > const &pcontainer)
Given an MCTrack p; Return it's first direct daughter or nullptr.
static bool isKeepPhysics(o2::MCTrack const &p, std::vector< o2::MCTrack > const &pcontainer)
int getHepMCStatusCode(MCGenStatusEncoding enc)
bool isEncoded(MCGenStatusEncoding statusCode)
bool isStable(int pdg)
Determine if a particle (identified by pdg) is stable.