25 int pdg_id = std::abs(
p->pdgId() );
26 int mom_pdg_id = pdg_id;
30 while (pdg_id == mom_pdg_id) {
33 mom_pdg_id = abs(mother->
pdgId());
35 if (pdg_id != mom_pdg_id)
break;
39 if(oldVprod==mother->
prodVtx())
break;
59 bool isWZ = (nDecay==2);
60 return (mom_pdg_id == 23 || mom_pdg_id == 24 || isWZ);
65 bool isWZDecay(
const xAOD::TruthParticle* p, std::vector<const xAOD::TruthParticle*>& wzLeptons,
double photonCone2) {
66 int pdg_id = abs(
p->pdgId() );
68 if(!
p->hasProdVtx() )
return false;
74 if(
MC::isStable(p) && ( (pdg_id==11) || (pdg_id==13) ) ) {
75 wzLeptons.push_back(p);
79 if( pdg_id == 22 && photonCone2>0)
81 for(
const auto *lep: wzLeptons) {
83 if( deltaR2 < photonCone2 ) {
99 int pdg =
part->pdgId();
102 if(!
part->hasProdVtx())
return false;
104 if(!prod)
return false;
107 int parentId = (*elParent)->pdgId();
108 if(abs(parentId) == 15 && isWZDecay(*elParent)) {
112 if(parentId == pdg) {
116 if(isLeptonFromTau(*elParent)) {
142 declareInterface<JetTruthParticleSelectorTool>(
this);
173 return StatusCode::FAILURE;
188 return StatusCode::SUCCESS;
193 auto truth4Mom = truthPart->
p4();
195 if ( truth4Mom.E() <= 0 )
return false;
196 if ( truth4Mom.P() - truth4Mom.Pz() <= 0 )
return false;
198 double pt = truth4Mom.Pt();
201 double eta = truth4Mom.Eta();
230 !isLeptonFromTau(truthPart) );
237 int apId = abs(truthPart->
pdgId());
238 auto truth4Mom = truthPart->
p4();
239 double p = truth4Mom.P();
240 double phi = truth4Mom.Phi();
241 double pt = truth4Mom.Pt();
242 double eta = truth4Mom.Eta();
243 PDGList::iterator it =
m_pdgList.find(apId);
254 m_avM[apId]=truthPart->
m();
255 m_av2M[apId]=truthPart->
m() * truthPart->
m();
266 m_avM[apId]+=truthPart->
m();
267 m_av2M[apId]+=truthPart->
m() * truthPart->
m();
281 msg(MSG::INFO) <<
"Counts of PDGs of all stable particles :" <<
endmsg;
282 msg(MSG::INFO) <<
"========================================" <<
endmsg;
283 msg(MSG::INFO) <<
"| PDG | # particles |" <<
endmsg;
286 msg(MSG::INFO) <<
"|"
287 << std::setw(10) << it->first <<
" |"
288 << std::setw(10) << it->second <<
" |"
291 msg(MSG::INFO) <<
"| PDG | <p> | rms | <pt> | rms | <eta> | rms |" <<
endmsg;
295 double p=
m_avP[it->first]/n;
296 double p2=std::sqrt(
m_av2P[it->first]/n-
298 double pt=
m_avPt[it->first]/n;
299 double pt2=std::sqrt(
m_av2Pt[it->first]/n-
302 double eta2=std::sqrt(
m_av2Eta[it->first]/n-
304 msg(MSG::INFO) <<
"|"
305 << std::setw(15) << it->first <<
" |"
306 << std::setw(15) << p <<
" |"
307 << std::setw(15) << p2 <<
" |"
308 << std::setw(15) << pt <<
" |"
309 << std::setw(15) << pt2 <<
" |"
310 << std::setw(15) <<
eta <<
" |"
311 << std::setw(15) << eta2 <<
" |"
314 msg(MSG::INFO) <<
"| PDG | <phi> | rms | <m> | rms |" <<
endmsg;
319 double phi2=std::sqrt(
m_av2Phi[it->first]/n-
321 double m=
m_avM[it->first]/n;
324 m2=std::sqrt(
m_av2M[it->first]/n-
326 msg(MSG::INFO) <<
"|"
327 << std::setw(15) << it->first <<
" |"
328 << std::setw(15) <<
phi <<
" |"
329 << std::setw(15) << phi2 <<
" |"
330 << std::setw(15) << m <<
" |"
331 << std::setw(15) << m2 <<
" |"
335 return StatusCode::SUCCESS;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_MSG_VERBOSE(x)
ATLAS-specific HepMC functions.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
virtual StatusCode finalize() override
std::vector< const xAOD::TruthParticle * > m_wzLeptons
bool passKinematics(const xAOD::TruthParticle *truth) const
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
virtual ~JetTruthParticleSelectorTool()
JetTruthParticleSelectorTool(const std::string &s)
SelectionMode m_selectionMode
std::string m_selectionModeName
bool selector(const xAOD::TruthParticle *truth)
virtual double m() const override final
The mass of the particle.
int pdgId() const
PDG ID code.
bool hasProdVtx() const
Check for a production vertex on this particle.
const TruthVertex_v1 * prodVtx() const
The production vertex of this particle.
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
const TPLinks_t & outgoingParticleLinks() const
Get all the outgoing particles.
const TruthParticle_v1 * incomingParticle(size_t index) const
Get one of the incoming particles.
size_t nIncomingParticles() const
Get the number of incoming particles.
const TPLinks_t & incomingParticleLinks() const
Get all the incoming particles.
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
bool isZeroEnergyPhoton(const T &p)
Identify a photon with zero energy. Probably a workaround for a generator bug.
bool isSMLepton(const T &p)
APID: the fourth generation leptons are not standard model leptons.
bool isStableOrSimDecayed(const T &p)
Identify if particle is satble or decayed in simulation.
bool isSpecialNonInteracting(const T &p)
Identify a special non-interacting particles.
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
bool isGeantino(const T &p)
double deltaR2(double rapidity1, double phi1, double rapidity2, double phi2)
from bare rapidity,phi
TruthVertex_v1 TruthVertex
Typedef to implementation.
TruthParticle_v1 TruthParticle
Typedef to implementation.