rivet is hosted by Hepforge, IPPP Durham
ParticleUtils.hh
Go to the documentation of this file.
00001 #ifndef RIVET_PARTICLEUTILS_HH
00002 #define RIVET_PARTICLEUTILS_HH
00003 
00004 #include "Rivet/Particle.hh"
00005 #include "Rivet/Tools/ParticleIdUtils.hh"
00006 
00007 // Macros to map Rivet::Particle functions to PID:: functions of the same name
00008 /// @todo Can leave return type out of the macro and put that on each line where it's used?
00009 #define PARTICLE_TO_PID_BOOLFN(fname) inline bool fname (const Particle& p) { return PID:: fname (p.pid()); }
00010 #define PARTICLE_TO_PID_INTFN(fname) inline int fname (const Particle& p) { return PID:: fname (p.pid()); }
00011 #define PARTICLE_TO_PID_DBLFN(fname) inline double fname (const Particle& p) { return PID:: fname (p.pid()); }
00012 
00013 namespace Rivet {
00014 
00015 
00016   /// @name Particle classifier functions
00017   //@{
00018 
00019   /// Is this particle species charged?
00020   PARTICLE_TO_PID_BOOLFN(isCharged)
00021 
00022   /// Is this particle species neutral?
00023   PARTICLE_TO_PID_BOOLFN(isNeutral)
00024 
00025 
00026   /// Is this a neutrino?
00027   PARTICLE_TO_PID_BOOLFN(isNeutrino)
00028 
00029   /// Determine if the PID is that of a charged lepton
00030   PARTICLE_TO_PID_BOOLFN(isChLepton)
00031 
00032   /// Determine if the PID is that of a photon
00033   PARTICLE_TO_PID_BOOLFN(isPhoton)
00034 
00035   /// Determine if the PID is that of an electron or positron
00036   PARTICLE_TO_PID_BOOLFN(isElectron)
00037 
00038   /// Determine if the PID is that of an muon or antimuon
00039   PARTICLE_TO_PID_BOOLFN(isMuon)
00040 
00041   /// Determine if the PID is that of an tau or antitau
00042   PARTICLE_TO_PID_BOOLFN(isTau)
00043 
00044   /// Determine if the PID is that of a hadron
00045   PARTICLE_TO_PID_BOOLFN(isHadron)
00046 
00047   /// Determine if the PID is that of a meson
00048   PARTICLE_TO_PID_BOOLFN(isMeson)
00049 
00050   /// Determine if the PID is that of a baryon
00051   PARTICLE_TO_PID_BOOLFN(isBaryon)
00052 
00053   /// Determine if the PID is that of a quark
00054   PARTICLE_TO_PID_BOOLFN(isQuark)
00055 
00056   /// Determine if the PID is that of a parton (quark or gluon)
00057   PARTICLE_TO_PID_BOOLFN(isParton)
00058 
00059 
00060 
00061   /// Determine if the PID is that of a W+
00062   PARTICLE_TO_PID_BOOLFN(isWplus)
00063 
00064   /// Determine if the PID is that of a W-
00065   PARTICLE_TO_PID_BOOLFN(isWminus)
00066 
00067   /// Determine if the PID is that of a W+-
00068   PARTICLE_TO_PID_BOOLFN(isW)
00069 
00070   /// Determine if the PID is that of a Z0
00071   PARTICLE_TO_PID_BOOLFN(isZ)
00072 
00073   /// Determine if the PID is that of an SM/lightest SUSY Higgs
00074   PARTICLE_TO_PID_BOOLFN(isHiggs)
00075 
00076   /// Determine if the PID is that of a t/tbar
00077   PARTICLE_TO_PID_BOOLFN(isTop)
00078 
00079 
00080   /// Determine if the particle is a heavy flavour hadron or parton
00081   PARTICLE_TO_PID_BOOLFN(isHeavyFlavour)
00082 
00083   /// Determine if the PID is that of a heavy parton (c,b,t)
00084   PARTICLE_TO_PID_BOOLFN(isHeavyParton)
00085 
00086   /// Determine if the PID is that of a light parton (u,d,s)
00087   PARTICLE_TO_PID_BOOLFN(isLightParton)
00088 
00089 
00090   /// Determine if the PID is that of a heavy flavour (b or c) meson
00091   PARTICLE_TO_PID_BOOLFN(isHeavyMeson)
00092 
00093   /// Determine if the PID is that of a heavy flavour (b or c) baryon
00094   PARTICLE_TO_PID_BOOLFN(isHeavyBaryon)
00095 
00096   /// Determine if the PID is that of a heavy flavour (b or c) hadron
00097   PARTICLE_TO_PID_BOOLFN(isHeavyHadron)
00098 
00099 
00100   /// Determine if the PID is that of a light flavour (not b or c) meson
00101   PARTICLE_TO_PID_BOOLFN(isLightMeson)
00102 
00103   /// Determine if the PID is that of a light flavour (not b or c) baryon
00104   PARTICLE_TO_PID_BOOLFN(isLightBaryon)
00105 
00106   /// Determine if the PID is that of a light flavour (not b or c) hadron
00107   PARTICLE_TO_PID_BOOLFN(isLightHadron)
00108 
00109 
00110   /// Determine if the PID is that of a b-meson.
00111   PARTICLE_TO_PID_BOOLFN(isBottomMeson)
00112 
00113   /// Determine if the PID is that of a b-baryon.
00114   PARTICLE_TO_PID_BOOLFN(isBottomBaryon)
00115 
00116   /// Determine if the PID is that of a b-hadron.
00117   PARTICLE_TO_PID_BOOLFN(isBottomHadron)
00118 
00119 
00120   /// @brief Determine if the PID is that of a c-meson.
00121   ///
00122   /// Specifically, the _heaviest_ quark is a c: a B_c is a b-meson and NOT a c-meson.
00123   /// Charmonia (closed charm) are counted as c-mesons here.
00124   PARTICLE_TO_PID_BOOLFN(isCharmMeson)
00125 
00126   /// @brief Determine if the PID is that of a c-baryon.
00127   ///
00128   /// Specifically, the _heaviest_ quark is a c: a baryon containing a b & c
00129   /// is a b-baryon and NOT a c-baryon. To test for the simpler case, just use
00130   /// a combination of hasCharm() and isBaryon().
00131   PARTICLE_TO_PID_BOOLFN(isCharmBaryon)
00132 
00133   /// Determine if the PID is that of a c-hadron.
00134   PARTICLE_TO_PID_BOOLFN(isCharmHadron)
00135 
00136 
00137   /// Determine if the PID is that of a strange meson
00138   PARTICLE_TO_PID_BOOLFN(isStrangeMeson)
00139 
00140   /// Determine if the PID is that of a strange baryon
00141   PARTICLE_TO_PID_BOOLFN(isStrangeBaryon)
00142 
00143   /// Determine if the PID is that of a strange hadron
00144   PARTICLE_TO_PID_BOOLFN(isStrangeHadron)
00145 
00146 
00147 
00148   /// Is this a pomeron, odderon, or generic reggeon?
00149   PARTICLE_TO_PID_BOOLFN(isReggeon)
00150 
00151   /// Determine if the PID is that of a diquark (used in hadronization models)
00152   PARTICLE_TO_PID_BOOLFN(isDiquark)
00153 
00154   /// Determine if the PID is that of a pentaquark (hypothetical hadron)
00155   PARTICLE_TO_PID_BOOLFN(isPentaquark)
00156 
00157   /// Is this a fundamental SUSY particle?
00158   PARTICLE_TO_PID_BOOLFN(isSUSY)
00159 
00160   /// Is this an R-hadron?
00161   PARTICLE_TO_PID_BOOLFN(isRhadron)
00162 
00163   /// Is this a technicolor particle?
00164   PARTICLE_TO_PID_BOOLFN(isTechnicolor)
00165 
00166   /// Is this an excited (composite) quark or lepton?
00167   PARTICLE_TO_PID_BOOLFN(isExcited)
00168 
00169   /// Is this a Kaluza-Klein excitation?
00170   PARTICLE_TO_PID_BOOLFN(isKK)
00171 
00172   /// Is this a graviton?
00173   PARTICLE_TO_PID_BOOLFN(isGraviton)
00174 
00175   /// Is this a BSM particle (including graviton)?
00176   PARTICLE_TO_PID_BOOLFN(isBSM)
00177 
00178 
00179 
00180   /// Determine if the PID is in the generator-specific range
00181   PARTICLE_TO_PID_BOOLFN(isGenSpecific)
00182 
00183   /// Determine if the PID is that of an EW scale resonance
00184   PARTICLE_TO_PID_BOOLFN(isResonance)
00185 
00186   /// Check the PID for usability in transport codes like Geant4
00187   PARTICLE_TO_PID_BOOLFN(isTransportable)
00188 
00189 
00190 
00191   /// Does this particle contain an up quark?
00192   PARTICLE_TO_PID_BOOLFN(hasUp)
00193 
00194   /// Does this particle contain a down quark?
00195   PARTICLE_TO_PID_BOOLFN(hasDown)
00196 
00197   /// Does this particle contain a strange quark?
00198   PARTICLE_TO_PID_BOOLFN(hasStrange)
00199 
00200   /// Does this particle contain a charm quark?
00201   PARTICLE_TO_PID_BOOLFN(hasCharm)
00202 
00203   /// Does this particle contain a bottom quark?
00204   PARTICLE_TO_PID_BOOLFN(hasBottom)
00205 
00206   /// Does this particle contain a top quark?
00207   PARTICLE_TO_PID_BOOLFN(hasTop)
00208 
00209 
00210 
00211   /// jSpin returns 2J+1, where J is the total spin
00212   PARTICLE_TO_PID_INTFN(jSpin)
00213 
00214   /// sSpin returns 2S+1, where S is the spin
00215   PARTICLE_TO_PID_INTFN(sSpin)
00216 
00217   /// lSpin returns 2L+1, where L is the orbital angular momentum
00218   PARTICLE_TO_PID_INTFN(lSpin)
00219 
00220 
00221   /// Return 3 times the charge (3 x quark charge is an int)
00222   PARTICLE_TO_PID_INTFN(threeCharge)
00223 
00224   /// Return the charge
00225   PARTICLE_TO_PID_DBLFN(charge)
00226 
00227   //@}
00228 
00229 
00230   // PID matching functor to be passed to any() e.g. any(p.children(), HasPID(PID::MUON, true))
00231   struct HasPID {
00232     HasPID(PdgId pid, bool abs=false) : targetpid(pid), useabspid(abs) { }
00233     bool operator()(const Particle& p) const { return (useabspid ? p.abspid() : p.pid()) == targetpid; }
00234     PdgId targetpid;
00235     bool useabspid;
00236   };
00237 
00238 
00239 }
00240 
00241 #endif