00001 // -*- C++ -*- 00002 // 00003 // StandardMatchers.h is a part of ThePEG - Toolkit for HEP Event Generation 00004 // Copyright (C) 1999-2007 Leif Lonnblad 00005 // 00006 // ThePEG is licenced under version 2 of the GPL, see COPYING for details. 00007 // Please respect the MCnet academic guidelines, see GUIDELINES for details. 00008 // 00009 #ifndef ThePEG_StandardMatchers_H 00010 #define ThePEG_StandardMatchers_H 00011 // This is the declaration of the AnyMatcher, 00012 00013 00014 #include "Matcher.h" 00015 #include "ThePEG/PDT/EnumParticles.h" 00016 00017 namespace ThePEG { 00018 00037 struct AnyMatcher: public MatcherType { 00039 typedef AnyMatcher CC; 00042 static bool Check(const ParticleData & pd) { 00043 return bool(pd.id()); 00044 } 00046 static string className() { return "Any"; } 00047 }; 00049 typedef Matcher<AnyMatcher> MatchAny; 00050 00051 00055 struct ChargedMatcher: public MatcherType { 00057 typedef ChargedMatcher CC; 00060 static bool Check(const ParticleData & pd) { 00061 return PDT::charged(pd.iCharge()); 00062 } 00064 static string className() { return "Charged"; } 00065 }; 00067 typedef Matcher<ChargedMatcher> MatchCharged; 00068 00069 struct NegativeMatcher; 00070 00074 struct PositiveMatcher: public MatcherType { 00076 typedef NegativeMatcher CC; 00079 static bool Check(const ParticleData & pd) { 00080 return PDT::positive(pd.iCharge()); 00081 } 00083 static string className() { return "Positive"; } 00084 }; 00086 typedef Matcher<PositiveMatcher> MatchPositive; 00087 00088 00092 struct NeutralMatcher: public MatcherType { 00094 typedef NeutralMatcher CC; 00097 static bool Check(const ParticleData & pd) { 00098 return pd.iCharge() == PDT::Charge0; 00099 } 00101 static string className() { return "Neutral"; } 00102 }; 00104 typedef Matcher<NeutralMatcher> MatchNeutral; 00105 00109 struct NegativeMatcher: public MatcherType { 00111 typedef PositiveMatcher CC; 00114 static bool Check(const ParticleData & pd) { 00115 return PDT::negative(pd.iCharge()); 00116 } 00118 static string className() { return "Negative"; } 00119 }; 00121 typedef Matcher<NegativeMatcher> MatchNegative; 00122 00126 struct BaryonMatcher: public MatcherType { 00128 typedef BaryonMatcher CC; 00131 static bool Check(const ParticleData & pd) { return Check(pd.id()); } 00134 static bool Check(long id) { 00135 return (id/10)%10 && (id/100)%10 && (id/1000)%10; 00136 } 00138 static string className() { return "Baryon"; } 00139 }; 00141 typedef Matcher<BaryonMatcher> MatchBaryon; 00142 00143 00147 struct MesonMatcher: public MatcherType { 00149 typedef MesonMatcher CC; 00152 static bool Check(const ParticleData & pd) { return Check(pd.id()); } 00155 static bool Check(long id) { 00156 return (id/10)%10 && (id/100)%10 && (id/1000)%10 == 0; 00157 } 00159 static string className() { return "Meson"; } 00160 }; 00162 typedef Matcher<MesonMatcher> MatchMeson; 00163 00164 00168 struct DiquarkMatcher: public MatcherType { 00170 typedef DiquarkMatcher CC; 00173 static bool Check(const ParticleData & pd) { return Check(pd.id()); } 00176 static bool Check(long id) { 00177 return id/10 && (id/10)%10 == 0 && (id/100)%10 && (id/1000)%10; 00178 } 00180 static string className() { return "Diquark"; } 00181 }; 00183 typedef Matcher<DiquarkMatcher> MatchDiquark; 00184 00188 struct QuarkMatcher: public MatcherType { 00190 typedef QuarkMatcher CC; 00193 static bool Check(const ParticleData & pd) { return Check(pd.id()); } 00196 static bool Check(long id) { 00197 return id && abs(id) < 10; 00198 } 00200 static string className() { return "Quark"; } 00201 }; 00203 typedef Matcher<QuarkMatcher> MatchQuark; 00204 00208 struct LeptonMatcher: public MatcherType { 00210 typedef LeptonMatcher CC; 00213 static bool Check(const ParticleData & pd) { return Check(pd.id()); } 00216 static bool Check(long id) { 00217 return abs(id) > 10 && abs(id) <= 20; 00218 } 00220 static string className() { return "Lepton"; } 00221 }; 00223 typedef Matcher<LeptonMatcher> MatchLepton; 00224 00225 struct LightAntiQuarkMatcher; 00226 00230 struct LightQuarkMatcher: public MatcherType { 00232 typedef LightAntiQuarkMatcher CC; 00235 static bool Check(const ParticleData & pd) { return Check(pd.id()); } 00238 static bool Check(long id) { 00239 return id > 0 && id < 4 ; 00240 } 00242 static string className() { return "LightQuark"; } 00243 }; 00245 typedef Matcher<LightQuarkMatcher> MatchLightQuark; 00246 00247 00253 struct LightAntiQuarkMatcher: public MatcherType { 00255 typedef LightQuarkMatcher CC; 00258 static bool Check(const ParticleData & pd) { return Check(pd.id()); } 00261 static bool Check(long id) { 00262 return id < 0 && id > -4 ; 00263 } 00265 static string className() { return "LightAntiQuark"; } 00266 }; 00268 typedef Matcher<LightAntiQuarkMatcher> MatchLightAntiQuark; 00269 00274 struct StandardQCDPartonMatcher: public MatcherType { 00276 typedef StandardQCDPartonMatcher CC; 00279 static bool Check(const ParticleData & pd) { return Check(pd.id()); } 00282 static bool Check(long id) { 00283 return id && ( abs(id) <= 5 || id == ParticleID::g ); 00284 } 00286 static string className() { return "StandardQCDParton"; } 00287 }; 00288 00290 typedef Matcher<StandardQCDPartonMatcher> MatchStandardQCDParton; 00291 00295 struct PseudoScalarMesonMatcher: public MatcherType { 00297 typedef PseudoScalarMesonMatcher CC; 00300 static bool Check(const ParticleData & pd) { return Check(pd.id()); } 00303 static bool Check(long id) { 00304 return ( (abs(id)/1000)%1 == 0 && abs(id) > 100 && abs(id)%10 == 1 ) || 00305 ( id == ParticleID::K_L0 || id == ParticleID::K_S0 ); 00306 } 00308 static string className() { return "PseudoScalarMeson"; } 00309 }; 00310 00312 typedef Matcher<PseudoScalarMesonMatcher> MatchPseudoScalarMeson; 00313 00314 00318 struct VectorMesonMatcher: public MatcherType { 00320 typedef VectorMesonMatcher CC; 00323 static bool Check(const ParticleData & pd) { return Check(pd.id()); } 00326 static bool Check(long id) { 00327 return (abs(id)/1000)%1 == 0 && abs(id) > 100 && abs(id)%10 == 3; 00328 } 00330 static string className() { return "VectorMeson"; } 00331 }; 00332 00334 typedef Matcher<VectorMesonMatcher> MatchVectorMeson; 00335 00336 } 00337 00338 #endif /* ThePEG_StandardMatchers_H */