Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:24:21

0001 // -*- C++ -*-
0002 //
0003 // StandardMatchers.h is a part of Herwig - A multi-purpose Monte Carlo event generator
0004 // Copyright (C) 2002-2019 The Herwig Collaboration
0005 //
0006 // Herwig is licenced under version 3 of the GPL, see COPYING for details.
0007 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
0008 //
0009 #ifndef Herwig_StandardMatchers_H
0010 #define Herwig_StandardMatchers_H
0011 // This is the declaration of the AnyMatcher,
0012 
0013 
0014 #include "ThePEG/PDT/Matcher.h"
0015 #include "ThePEG/Repository/CurrentGenerator.h"
0016 #include "ThePEG/PDF/BeamParticleData.h"
0017 #include "ThePEG/PDT/EnumParticles.h"
0018 
0019 namespace Herwig {
0020 using namespace ThePEG;
0021 
0022 /**
0023  *
0024  * This file declare a set of standard matcher classes in addition to those
0025  * defined in ThePEG. The classes can be used by themselves (with
0026  * their static functions) or together with the Matcher class to
0027  * define Interfaced objects of the MatcherBase type to be used in the
0028  * Repository. Suitable typedefs are declared for the latter.
0029  *
0030  * @see Matcher
0031  * @see MatcherBase
0032  */
0033 
0034 /**
0035  * A Matcher class which matches photons
0036  */
0037 struct PhotonMatcher: public MatcherType {
0038   /** Typedef the class matching the complex conjugate particles. */
0039   typedef PhotonMatcher CC;
0040   /** The main static function to check if a given particle type \a pd
0041       matches. */
0042   static bool Check(const ParticleData & pd) {
0043     return pd.id()==ParticleID::gamma;
0044   }
0045   /** A simplified but unique class name. */
0046   static string className() { return "Photon"; }
0047 };
0048 
0049 /**
0050  * Gives a MatcherBase class based on PhotonMatcher. 
0051  */
0052 typedef Matcher<PhotonMatcher> MatchPhoton;
0053 
0054 /**
0055  * A Matcher class which matches top quarks
0056  */
0057 struct TopMatcher: public MatcherType {
0058   /** Typedef the class matching the complex conjugate particles. */
0059   typedef TopMatcher CC;
0060   /** The main static function to check if a given particle type \a pd
0061       matches. */
0062   static bool Check(const ParticleData & pd) {
0063     return abs(pd.id())==ParticleID::t;
0064   }
0065   /** A simplified but unique class name. */
0066   static string className() { return "Top"; }
0067 };
0068 
0069 /**
0070  * Gives a MatcherBase class based on TopMatcher. 
0071  */
0072 typedef Matcher<TopMatcher> MatchTop;
0073 
0074 /**
0075  * A Matcher class which matches bottom quarks
0076  */
0077 struct BottomMatcher: public MatcherType {
0078   /** Typedef the class matching the complex conjugate particles. */
0079   typedef BottomMatcher CC;
0080   /** The main static function to check if a given particle type \a pd
0081       matches. */
0082   static bool Check(const ParticleData & pd) {
0083     return abs(pd.id())==ParticleID::b;
0084   }
0085   /** A simplified but unique class name. */
0086   static string className() { return "Bottom"; }
0087 };
0088 
0089 /**
0090  * Gives a MatcherBase class based on BottomMatcher. 
0091  */
0092 typedef Matcher<BottomMatcher> MatchBottom;
0093 
0094 /**
0095  * A Matcher class which matches any hadron.
0096  */
0097 struct HadronMatcher: public MatcherType {
0098   /** Typedef the class matching the complex conjugate particles. */
0099   typedef HadronMatcher CC;
0100   /** The main static function to check if a given particle type \a pd
0101       matches. */
0102   static bool Check(const ParticleData & pd) {
0103     if (pd.id() != ParticleID::gamma) return Check(pd.id()); 
0104     else {
0105       Ptr<BeamParticleData>::const_pointer beam = 
0106     dynamic_ptr_cast< Ptr<BeamParticleData>::const_pointer>(&pd);
0107       return beam && beam->pdf();
0108     }
0109   }
0110   /** The main static function to check if a given particle with type
0111       \a id matches. */
0112   static bool Check(long id) {
0113     bool hadron = (id/10)%10 && (id/100)%10;
0114     if(hadron) return true;
0115     // special for gamma when acting like a hadron
0116     if (id != ParticleID::gamma) return false;
0117     tcPDPtr gamma = CurrentGenerator::current().getParticleData(ParticleID::gamma);
0118     Ptr<BeamParticleData>::const_pointer beam = 
0119       dynamic_ptr_cast< Ptr<BeamParticleData>::const_pointer>(gamma);
0120     return beam && beam->pdf();
0121   }
0122   /** A simplified but unique class name. */
0123   static string className() { return "Hadron"; }
0124 };
0125 /** Gives a MatcherBase class based on HadronMatcher. */
0126 typedef Matcher<HadronMatcher> MatchHadron;
0127 
0128 /**
0129  * A Matcher class which matches W bosons
0130  */
0131 struct WBosonMatcher: public MatcherType {
0132   /** Typedef the class matching the complex conjugate particles. */
0133   typedef WBosonMatcher CC;
0134   /** The main static function to check if a given particle type \a pd
0135       matches. */
0136   static bool Check(const ParticleData & pd) {
0137     return abs(pd.id())==ParticleID::Wplus;
0138   }
0139   /** A simplified but unique class name. */
0140   static string className() { return "WBoson"; }
0141 };
0142 
0143 /**
0144  * Gives a MatcherBase class based on WBosonMatcher. 
0145  */
0146 typedef Matcher<WBosonMatcher> MatchWBoson;
0147 
0148 /**
0149  * A Matcher class which matches Z bosons
0150  */
0151 struct ZBosonMatcher: public MatcherType {
0152   /** Typedef the class matching the complex conjugate particles. */
0153   typedef ZBosonMatcher CC;
0154   /** The main static function to check if a given particle type \a pd
0155       matches. */
0156   static bool Check(const ParticleData & pd) {
0157     return abs(pd.id())==ParticleID::Z0;
0158   }
0159   /** A simplified but unique class name. */
0160   static string className() { return "ZBoson"; }
0161 };
0162 
0163 /**
0164  * Gives a MatcherBase class based on ZBosonMatcher. 
0165  */
0166 typedef Matcher<ZBosonMatcher> MatchZBoson;
0167 
0168 /**
0169  * A Matcher class which matches Higgs bosons
0170  */
0171 struct HiggsBosonMatcher: public MatcherType {
0172   /** Typedef the class matching the complex conjugate particles. */
0173   typedef HiggsBosonMatcher CC;
0174   /** The main static function to check if a given particle type \a pd
0175       matches. */
0176   static bool Check(const ParticleData & pd) {
0177     return abs(pd.id())==ParticleID::h0;
0178   }
0179   /** A simplified but unique class name. */
0180   static string className() { return "HiggsBoson"; }
0181 };
0182 
0183 /**
0184  * Gives a MatcherBase class based on HiggsBosonMatcher. 
0185  */
0186 typedef Matcher<HiggsBosonMatcher> MatchHiggsBoson;
0187 
0188 /**
0189  * A Matcher class which matches any charged lepton.
0190  */
0191 struct ChargedLeptonMatcher: public MatcherType {
0192   /** Typedef the class matching the complex conjugate particles. */
0193   typedef ChargedLeptonMatcher CC;
0194   /** The main static function to check if a given particle type \a pd
0195       matches. */
0196   static bool Check(const ParticleData & pd) {
0197     return Check(pd.id());
0198   }
0199   static bool Check(long id) {
0200     return abs(id) > 10 && abs(id) <= 20 && abs(id)%2!=0;
0201   }
0202 
0203   /** A simplified but unique class name. */
0204   static string className() { return "ChargedLepton"; }
0205 };
0206 /** Gives a MatcherBase class based on ChargedLeptonMatcher. */
0207 typedef Matcher<ChargedLeptonMatcher> MatchChargedLepton;
0208 
0209 /**
0210  * A Matcher class which matches any light (<1GeV) particles other than the photon
0211  */
0212 struct LightParticleMatcher: public MatcherType {
0213   /** Typedef the class matching the complex conjugate particles. */
0214   typedef LightParticleMatcher CC;
0215   /** The main static function to check if a given particle type \a pd
0216       matches. */
0217   static bool Check(const ParticleData & pd) {
0218     return pd.id()!=22 && abs(pd.id()) > 6 && abs(pd.id())!=11 &&
0219       abs(pd.id())!=13 && abs(pd.id())!=15 && abs(pd.mass())<=GeV;
0220   }
0221   /** A simplified but unique class name. */
0222   static string className() { return "LightParticle"; }
0223 };
0224 
0225 /**
0226  * Gives a MatcherBase class based on LightParticleatcher. 
0227  */
0228 typedef Matcher<LightParticleMatcher> MatchLightParticle;
0229 
0230 }
0231 #endif /* Herwig_StandardMatchers_H */