CMS 3D CMS Logo

GenParticle.h
Go to the documentation of this file.
1 #ifndef HepMCCandidate_GenParticle_h
2 #define HepMCCandidate_GenParticle_h
3 
13 #include <vector>
14 
15 namespace HepMC {
16  class GenParticle;
17 }
18 
19 namespace reco {
20 
21  class GenParticle : public CompositeRefCandidateT<GenParticleRefVector> {
22  public:
29  GenParticle(Charge q, const LorentzVector & p4, const Point & vtx,
30  int pdgId, int status, bool integerCharge);
32  GenParticle(Charge q, const PolarLorentzVector & p4, const Point & vtx,
33  int pdgId, int status, bool integerCharge);
35  ~GenParticle() override;
37  GenParticle * clone() const override;
38  void setCollisionId(int s) {collisionId_ = s;}
39  int collisionId() const {return collisionId_;}
40 
41  const GenStatusFlags &statusFlags() const { return statusFlags_; }
42  GenStatusFlags &statusFlags() { return statusFlags_; }
43 
45  //basic set of gen status flags accessible directly here
46  //the rest accessible through statusFlags()
47  //(see GenStatusFlags.h for their meaning)
48 
50  //these are robust, generator-independent functions for categorizing
51  //mainly final state particles, but also intermediate hadrons/taus
52 
53  //is particle prompt (not from hadron, muon, or tau decay) and final state
54  bool isPromptFinalState() const { return status()==1 && statusFlags_.isPrompt(); }
55 
56  //is particle prompt (not from hadron, muon, or tau decay) and decayed
57  //such as a prompt tau
58  bool isPromptDecayed() const { return statusFlags_.isDecayedLeptonHadron() && statusFlags_.isPrompt(); }
59 
60  //this particle is a direct decay product of a prompt tau and is final state
61  //(eg an electron or muon from a leptonic decay of a prompt tau)
62  bool isDirectPromptTauDecayProductFinalState() const { return status()==1 && statusFlags_.isDirectPromptTauDecayProduct(); }
63 
65  //these are generator history-dependent functions for tagging particles
66  //associated with the hard process
67  //Currently implemented for Pythia 6 and Pythia 8 status codes and history
68  //and may not have 100% consistent meaning across all types of processes
69  //Users are strongly encouraged to stick to the more robust flags above,
70  //as well as the expanded set available in GenStatusFlags.h
71 
72  //this particle is part of the hard process
73  bool isHardProcess() const { return statusFlags_.isHardProcess(); }
74 
75  //this particle is the final state direct descendant of a hard process particle
76  bool fromHardProcessFinalState() const { return status()==1 && statusFlags_.fromHardProcess(); }
77 
78  //this particle is the decayed direct descendant of a hard process particle
79  //such as a tau from the hard process
80  bool fromHardProcessDecayed() const { return statusFlags_.isDecayedLeptonHadron() && statusFlags_.fromHardProcess(); }
81 
82  //this particle is a direct decay product of a hardprocess tau and is final state
83  //(eg an electron or muon from a leptonic decay of a tau from the hard process)
84  bool isDirectHardProcessTauDecayProductFinalState() const { return status()==1 && statusFlags_.isDirectHardProcessTauDecayProduct(); }
85 
86  //this particle is the direct descendant of a hard process particle of the same pdg id.
87  //For outgoing particles the kinematics are those before QCD or QED FSR
88  //This corresponds roughly to status code 3 in pythia 6
89  //This is the most complex and error prone of all the flags and you are strongly encouraged
90  //to consider using the others to fill your needs.
91  bool fromHardProcessBeforeFSR() const { return statusFlags_.fromHardProcessBeforeFSR(); }
92 
93  //provided for convenience. Use this one if you were using status 3 before and didn't know or care what it exactly meant
94  bool isMostlyLikePythia6Status3() { return fromHardProcessBeforeFSR(); }
95 
96  //this particle is the last copy of the particle in the chain with the same pdg id
97  //(and therefore is more likely, but not guaranteed, to carry the final physical momentum)
98  bool isLastCopy() const { return statusFlags_.isLastCopy(); }
99 
100  //this particle is the last copy of the particle in the chain with the same pdg id
101  //before QED or QCD FSR
102  //(and therefore is more likely, but not guaranteed, to carry the momentum after ISR)
103  bool isLastCopyBeforeFSR() const { return statusFlags_.isLastCopyBeforeFSR(); }
104 
105  private:
107  bool overlap(const Candidate &) const override;
110  };
111 
112 }
113 
114 #endif
int Charge
electric charge type
Definition: Candidate.h:35
bool isPromptFinalState() const
Definition: GenParticle.h:54
bool isLastCopyBeforeFSR() const
Definition: GenParticle.h:103
void setCollisionId(int s)
Definition: GenParticle.h:38
bool isDirectHardProcessTauDecayProductFinalState() const
Definition: GenParticle.h:84
bool isLastCopy() const
Definition: GenParticle.h:98
bool isHardProcess() const
Definition: GenParticle.h:73
bool fromHardProcessBeforeFSR() const
Definition: GenParticle.h:91
int collisionId() const
Definition: GenParticle.h:39
GenStatusFlags statusFlags_
Definition: GenParticle.h:109
GenParticle()
default constructor
Definition: GenParticle.h:24
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
bool isMostlyLikePythia6Status3()
Definition: GenParticle.h:94
GenStatusFlags & statusFlags()
Definition: GenParticle.h:42
double p4[4]
Definition: TauolaWrapper.h:92
bool isPromptDecayed() const
Definition: GenParticle.h:58
GenParticle(const LeafCandidate &c)
default constructor
Definition: GenParticle.h:26
const GenStatusFlags & statusFlags() const
Definition: GenParticle.h:41
bool fromHardProcessFinalState() const
Definition: GenParticle.h:76
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
fixed size matrix
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:55
bool isDirectPromptTauDecayProductFinalState() const
Definition: GenParticle.h:62
bool fromHardProcessDecayed() const
Definition: GenParticle.h:80
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:39