Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 09:06:49

0001 // -*- C++ -*-
0002 #ifndef RIVET_TRIGGERPROJECTION_HH
0003 #define RIVET_TRIGGERPROJECTION_HH
0004 
0005 #include "Rivet/Projection.hh"
0006 
0007 namespace Rivet {
0008 
0009   
0010   /// @brief Base class for projections returning a bool corresponding
0011   /// to a trigger.
0012   ///
0013   /// @author Leif Lönnblad
0014   ///
0015   /// Project an event down to a single true or false value accessible
0016   /// through the operator() function, where true means that the event
0017   /// has passed some trigger criterion.
0018   class TriggerProjection: public Projection {
0019   public:
0020 
0021     /// The default constructor.
0022     TriggerProjection() : _passed(true) {
0023       setName("TriggerProjection");
0024     }
0025     
0026     virtual ~TriggerProjection() {}
0027 
0028     /// Clone on the heap.
0029     RIVET_DEFAULT_PROJ_CLONE(TriggerProjection);
0030 
0031     /// Import to avoid warnings about overload-hiding
0032     using Projection::operator =;
0033 
0034     /// Return true if the event has passed some trigger or selection criteria.
0035     bool operator()() const {
0036       return _passed;
0037     }
0038 
0039     
0040   protected:
0041 
0042     virtual void project(const Event&) {
0043       pass();
0044     }
0045 
0046     /// Indicate that the event has passed the trigger.
0047     void pass() {
0048       _passed = true;
0049     }
0050 
0051     /// Compare projections
0052     virtual CmpState compare(const Projection&) const {
0053       return CmpState::EQ;
0054     }
0055 
0056     /// Indicate that the event has failed the trigger.
0057     void fail() {
0058       _passed = false;
0059     }
0060 
0061   protected:
0062 
0063     bool _passed;
0064 
0065   };
0066 
0067   
0068 }
0069 
0070 #endif