File: IdentifiedFinalState.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 (121 lines) | stat: -rw-r--r-- 2,850 bytes parent folder | download | duplicates (2)
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
// -*- C++ -*-
#ifndef RIVET_IdentifiedFinalState_HH
#define RIVET_IdentifiedFinalState_HH

#include "Rivet/Tools/Logging.hh"
#include "Rivet/Rivet.hh"
#include "Rivet/Particle.hh"
#include "Rivet/Event.hh"
#include "Rivet/Projection.hh"
#include "Rivet/Projections/FinalState.hh"

namespace Rivet {


  /// @brief Produce a final state which only contains specified particle IDs.
  class IdentifiedFinalState : public FinalState {
  public:

    /// @name Constructors
    //@{

    /// Constructor with specific FinalState.
    IdentifiedFinalState(const FinalState& fsp);

    /// Constructor with a single eta range argument.
    IdentifiedFinalState(double etamin=-MAXRAPIDITY,
                         double etamax=MAXRAPIDITY,
                         double ptMin=0.0*GeV);

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

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


  public:

    /// Get the list of particle IDs to accept.
    const set<PdgId>& acceptedIds() const {
      return _pids;
    }

    /// Add an accepted particle ID.
    IdentifiedFinalState& acceptId(PdgId pid) {
      _pids.insert(pid);
      return *this;
    }

    /// Add a set of accepted particle IDs.
    IdentifiedFinalState& acceptIds(const vector<PdgId>& pids) {
      foreach (const PdgId pid, pids) {
        _pids.insert(pid);
      }
      return *this;
    }

    /// Add an accepted particle ID and its antiparticle.
    IdentifiedFinalState& acceptIdPair(PdgId pid) {
      _pids.insert(pid);
      _pids.insert(-pid);
      return *this;
    }

    /// Add a set of accepted particle IDs and their antiparticles.
    IdentifiedFinalState& acceptIdPairs(const vector<PdgId>& pids) {
      foreach (const PdgId pid, pids) {
        _pids.insert(pid);
        _pids.insert(-pid);
      }
      return *this;
    }

    /// Accept all neutrinos (convenience method).
    IdentifiedFinalState& acceptNeutrinos() {
      acceptIdPair(NU_E);
      acceptIdPair(NU_MU);
      acceptIdPair(NU_TAU);
      return *this;
    }

    /// Accept all charged leptons (convenience method).
    IdentifiedFinalState& acceptChLeptons() {
      acceptIdPair(ELECTRON);
      acceptIdPair(MUON);
      acceptIdPair(TAU);
      return *this;
    }

    /// Reset the list of particle IDs to accept.
    void reset() {
      _pids.clear();
    }


  protected:

    /// Apply the projection on the supplied event.
    void project(const Event& e);

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


  private:

    /// The final-state particles.
    set<PdgId> _pids;

  };


}


#endif