00001 // -*- C++ -*- 00002 // 00003 // CombinedMatcher.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_CombinedMatcher_H 00010 #define ThePEG_CombinedMatcher_H 00011 // This is the declaration of the AndMatcher, OrMatcher and NotMatcher. 00012 00013 00014 #include "Matcher.h" 00015 00016 namespace ThePEG { 00017 00024 template <class T1, class T2> 00025 struct AndMatcher: public MatcherType { 00026 00031 typedef AndMatcher<typename T1::CC, typename T2::CC> CC; 00032 00037 static bool Check(const ParticleData & pd) { 00038 return T1::Check(pd) && T2::Check(pd); 00039 } 00040 00041 }; 00042 00049 template <class T1, class T2> 00050 struct OrMatcher: public MatcherType { 00051 00056 typedef OrMatcher<typename T1::CC, typename T2::CC> CC; 00057 00062 static bool Check(const ParticleData & pd) { 00063 return T1::Check(pd) || T2::Check(pd); 00064 } 00065 00066 }; 00067 00074 template <class T> 00075 struct NotMatcher: public MatcherType { 00076 00081 typedef NotMatcher<typename T::CC> CC; 00082 00088 static bool Check(const ParticleData & pd) { 00089 return !T::Check(pd); 00090 } 00091 00092 }; 00093 00094 } 00095 00096 #endif /* ThePEG_CombinedMatcher_H */