diff --git a/PhysicsAnalysis/MCTruthClassifier/Root/MCTruthClassifierGen.cxx b/PhysicsAnalysis/MCTruthClassifier/Root/MCTruthClassifierGen.cxx index cca4cc504c3e30a3383e4abdbd67aad28a87034a..e7dc6c0d169009d90ddc4ed9d8e7c14b5e08d0a2 100644 --- a/PhysicsAnalysis/MCTruthClassifier/Root/MCTruthClassifierGen.cxx +++ b/PhysicsAnalysis/MCTruthClassifier/Root/MCTruthClassifierGen.cxx @@ -168,7 +168,7 @@ MCTruthClassifier::particleTruthClassifier(const xAOD::TruthParticle* thePart, M return std::make_pair(Neutrino, partOrig); } - if (thePart&& info.Mother() && HepMC::is_same_generator_particle(thePart,info.Mother())) + if (thePart && info.Mother() && HepMC::is_same_generator_particle(thePart,info.Mother())) return std::make_pair(NonPrimary, partOrig); if (isPartHadr) return std::make_pair(Hadron, partOrig); @@ -256,7 +256,7 @@ ParticleOrigin MCTruthClassifier::defOrigOfElectron(const xAOD::TruthParticleCon bool samePart = false; for (const auto& theDaug: partOriVert->particles_out()) { if (!theDaug) continue; - if (motherPDG == theDaug->pdgId() && info.Mother() && HepMC::is_same_generator_particle(theDaug, info.Mother())) samePart = true; + if (motherPDG == theDaug->pdgId() && HepMC::is_same_generator_particle(theDaug, mother)) samePart = true; } // to resolve Sherpa loop @@ -339,7 +339,7 @@ ParticleOrigin MCTruthClassifier::defOrigOfElectron(const xAOD::TruthParticleCon else if (MC::isTau(DaugType)) NumOfTau++; else if (abs(DaugType) == MC::NU_TAU) NumOfTauNeut++; else if (MC::isLeptoQuark(DaugType)) NumOfLQ++; - if (abs(DaugType) == abs(motherPDG) && theDaug && info.Mother() && HepMC::is_same_generator_particle(theDaug, info.Mother() )) samePart = true; + if (abs(DaugType) == abs(motherPDG) && theDaug && HepMC::is_same_generator_particle(theDaug, mother )) samePart = true; if (numOfParents == 1 && (MC::isPhoton(motherPDG) || MC::isElectron(motherPDG) || MC::isMuon(motherPDG) || abs(motherPDG) == MC::PIPLUS) && (MC::isNucleus(DaugType) || DaugType == 0 || DaugType == MC::PROTON || DaugType == MC::NEUTRON || @@ -998,12 +998,12 @@ ParticleOrigin MCTruthClassifier::defOrigOfPhoton(const xAOD::TruthParticleConta bool foundISR = false; bool foundFSR = false; - if (numOfParents == 1 && numOfDaug == 2 && Daug && info.Mother() && HepMC::is_same_generator_particle(Daug, info.Mother())) return BremPhot; + if (numOfParents == 1 && numOfDaug == 2 && Daug && HepMC::is_same_generator_particle(Daug, mother)) return BremPhot; if (numOfParents == 1 && numOfDaug == 2 && MC::isElectron(motherPDG) && NumOfPht == 2) return ElMagProc; // decay of W,Z and Higgs to lepton with FSR generated by Pythia if (numOfParents == 1 && numOfDaug == 2 && (MC::isElectron(motherPDG) || MC::isMuon(motherPDG) || MC::isTau(motherPDG)) && - !(Daug && info.Mother() && HepMC::is_same_generator_particle(Daug, info.Mother())) && mothOriVert != nullptr && + !(Daug && HepMC::is_same_generator_particle(Daug, mother)) && mothOriVert != nullptr && mothOriVert->nIncomingParticles() == 1) { int itr = 0; int PartPDG = 0; @@ -1041,7 +1041,7 @@ ParticleOrigin MCTruthClassifier::defOrigOfPhoton(const xAOD::TruthParticleConta if (MC::isMuon(motherPDG) && NumOfMu == 0) return Mu; if (MC::isTau(motherPDG) && NumOfTau == 0) return TauLep; - if (numOfParents == 1 && mother && mother->status() == 3) return (foundISR)? ISRPhot:UndrPhot; + if (numOfParents == 1 && mother->status() == 3) return (foundISR)? ISRPhot:UndrPhot; //-- to find initial and final state raiation and underline photons //-- SUSY @@ -1072,7 +1072,7 @@ ParticleOrigin MCTruthClassifier::defOrigOfPhoton(const xAOD::TruthParticleConta //-- Exotics - CompHep if (MC::isElectron(motherPDG) && numOfParents == 1 && numOfDaug == 2 && (NumOfEl == 1 || NumOfPos == 1) && NumOfPht == 1 && - !( Daug && info.Mother() && HepMC::is_same_generator_particle(Daug, info.Mother())) && !HepMC::is_simulation_particle(Daug) && !HepMC::is_simulation_particle(info.Mother())) + !( Daug && HepMC::is_same_generator_particle(Daug, mother)) && !HepMC::is_simulation_particle(Daug) && !HepMC::is_simulation_particle(mother)) return FSRPhot; // FSR from Photos @@ -1264,7 +1264,7 @@ MCTruthClassifier::defOrigOfNeutrino(const xAOD::TruthParticleContainer& xTruthP } } //if mother is still nullptr, we have a problem - if (!mother) return NonDefined; + if (!mother) return NonDefined; // FIXME it should not be possible for mother to be nullptr at this point??? motherPDG = mother->pdgId(); partOriVert = mother->decayVtx(); @@ -1299,7 +1299,7 @@ MCTruthClassifier::defOrigOfNeutrino(const xAOD::TruthParticleContainer& xTruthP else if (MC::isMuon(DaugType)) NumOfMu++; else if (MC::isTau(DaugType)) NumOfTau++; else if (MC::isLeptoQuark(DaugType)) NumOfLQ++; - if (std::abs(DaugType) == std::abs(motherPDG) && theDaug && info.Mother() && HepMC::is_same_generator_particle(theDaug,info.Mother())) samePart = true; + if (std::abs(DaugType) == std::abs(motherPDG) && theDaug && HepMC::is_same_generator_particle(theDaug,mother)) samePart = true; } // Quark weak decay