Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:38:28

0001 // -*- C++ -*-
0002 //
0003 // CombinedMatcher.h is a part of ThePEG - Toolkit for HEP Event Generation
0004 // Copyright (C) 1999-2019 Leif Lonnblad
0005 //
0006 // ThePEG 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 ThePEG_CombinedMatcher_H
0010 #define ThePEG_CombinedMatcher_H
0011 // This is the declaration of the AndMatcher, OrMatcher and NotMatcher.
0012 
0013 
0014 #include "Matcher.h"
0015 
0016 namespace ThePEG {
0017 
0018 /**
0019  * The AndMatcher class represents the boolean <i>and</i> operation between
0020  * its two template argument classes of base type MatcherBase.
0021  *
0022  * @see MatcherBase
0023  */
0024 template <class T1, class T2>
0025 struct AndMatcher: public MatcherType {
0026 
0027   /**
0028    * Typedef for the class representing the matcher for the
0029    * charge-gonjugate of particles matched by this class.
0030    */
0031   typedef AndMatcher<typename T1::CC, typename T2::CC> CC;
0032 
0033   /**
0034    * Check match. Return true if the particle type \a pd is matched by
0035    * this class (ie. by both of the template argument classes).
0036    */
0037   static bool Check(const ParticleData & pd) {
0038     return T1::Check(pd) && T2::Check(pd);
0039   }
0040 
0041 };
0042 
0043 /**
0044  * The OrMatcher class represents the boolean <i>or</i> operation
0045  * between its two template argument classes of base type MatcherBase.
0046  *
0047  * @see MatcherBase
0048  */
0049 template <class T1, class T2>
0050 struct OrMatcher: public MatcherType {
0051 
0052   /**
0053    * Typedef for the class representing the matcher for the
0054    * charge-gonjugate of particles matched by this class.
0055    */
0056   typedef OrMatcher<typename T1::CC, typename T2::CC> CC;
0057 
0058   /**
0059    * Check match. Return true if the particle type \a pd is matched by
0060    * this class (ie. by either of the template argument classes).
0061    */
0062   static bool Check(const ParticleData & pd) {
0063     return T1::Check(pd) || T2::Check(pd);
0064   }
0065 
0066 };
0067 
0068 /**
0069  * The NotMatcher class represents the boolean <i>not</i> operation
0070  * for its template argument class of base type MatcherBase.
0071  *
0072  * @see MatcherBase
0073  */
0074 template <class T>
0075 struct NotMatcher: public MatcherType {
0076 
0077   /**
0078    * Typedef for the class representing the matcher for the
0079    * charge-gonjugate of particles matched by this class.
0080    */
0081   typedef NotMatcher<typename T::CC> CC;
0082 
0083   /**
0084    * Check match. Return true if the particle type \a pd is matched by
0085    * this class (ie. if it is not matched by the template argument
0086    * class).
0087    */
0088   static bool Check(const ParticleData & pd) {
0089     return !T::Check(pd);
0090   }
0091 
0092 };
0093 
0094 }
0095 
0096 #endif /* ThePEG_CombinedMatcher_H */