File: FinalState.hh

package info (click to toggle)
rivet 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 22,900 kB
  • sloc: cpp: 47,222; sh: 10,328; python: 6,469; ansic: 1,710; makefile: 1,221
file content (129 lines) | stat: -rw-r--r-- 3,681 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// -*- C++ -*-
#ifndef RIVET_FinalState_HH
#define RIVET_FinalState_HH

#include "Rivet/Projection.hh"
#include "Rivet/Particle.hh"
#include "Rivet/Event.hh"

namespace Rivet {


  /// @brief Project out all final-state particles in an event.
  /// Probably the most important projection in Rivet!
  class FinalState : public Projection {
  public:

    /// @name Standard constructors and destructors.
    //@{
    /// The default constructor. May specify the minimum and maximum
    /// pseudorapidity \f$ \eta \f$ and the min \f$ p_T \f$ (in GeV).
    FinalState(double mineta = -MAXRAPIDITY,
               double maxeta =  MAXRAPIDITY,
               double minpt  =  0.0*GeV);

    /// A constructor which allows to specify multiple eta ranges
    /// and the min \f$ p_T \f$ (in GeV).
    FinalState(const vector<pair<double, double> >& etaRanges,
               double minpt = 0.0*GeV);

    /// Clone on the heap.
    virtual const Projection* clone() const {
      return new FinalState(*this);
    }

    //@}


    /// Get the final-state particles.
    virtual const ParticleVector& particles() const { return _theParticles; }

    /// Get the final-state particles, ordered by supplied sorting function object.
    template <typename F>
    const ParticleVector& particles(F sorter) const {
      std::sort(_theParticles.begin(), _theParticles.end(), sorter);
      return _theParticles;
    }

    /// Get the final-state particles, ordered by decreasing \f$ p_T \f$.
    const ParticleVector& particlesByPt() const {
      return particles(cmpParticleByPt);
    }

    /// Get the final-state particles, ordered by decreasing \f$ p \f$.
    const ParticleVector& particlesByP() const {
      return particles(cmpParticleByP);
    }

    /// Get the final-state particles, ordered by decreasing \f$ E \f$.
    const ParticleVector& particlesByE() const {
      return particles(cmpParticleByE);
    }

    /// Get the final-state particles, ordered by decreasing \f$ E_T \f$.
    const ParticleVector& particlesByEt() const {
      return particles(cmpParticleByEt);
    }

    /// Get the final-state particles, ordered by increasing \f$ \eta \f$.
    const ParticleVector& particlesByEta() const {
      return particles(cmpParticleByAscPseudorapidity);
    }

    /// Get the final-state particles, ordered by increasing \f$ |\eta| \f$.
    const ParticleVector& particlesByModEta() const {
      return particles(cmpParticleByAscAbsPseudorapidity);
    }

    /// Access the projected final-state particles.
    virtual size_t size() const { return _theParticles.size(); }

    /// Is this final state empty?
    virtual bool empty() const { return _theParticles.empty(); }
    /// @deprecated Is this final state empty?
    virtual bool isEmpty() const { return _theParticles.empty(); }

    /// Minimum-\f$ p_\perp \f$ requirement.
    virtual double ptMin() const { return _ptmin; }


  public:

    typedef Particle entity_type;
    typedef ParticleVector collection_type;

    /// Template-usable interface common to JetAlg.
    const collection_type& entities() const {
      return particles();
    }


  protected:

    /// Apply the projection to the event.
    virtual void project(const Event& e);

    /// Compare projections.
    virtual int compare(const Projection& p) const;

    /// Decide if a particle is to be accepted or not.
    bool accept(const Particle& p) const;


  protected:

    /// The ranges allowed for pseudorapidity.
    vector<pair<double,double> > _etaRanges;

    /// The minimum allowed transverse momentum.
    double _ptmin;

    /// The final-state particles.
    mutable ParticleVector _theParticles;

  };


}

#endif