File: LeadingParticlesFinalState.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 (79 lines) | stat: -rw-r--r-- 2,100 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
// -*- C++ -*-
#ifndef RIVET_LeadingParticlesFinalState_HH
#define RIVET_LeadingParticlesFinalState_HH

#include "Rivet/Event.hh"
#include "Rivet/Projection.hh"
#include "Rivet/Projections/FinalState.hh"

namespace Rivet {

  class Particle;

  /// @brief Get the highest-pT occurrences of FS particles with the specified PDG IDs.
  class LeadingParticlesFinalState : public FinalState {

  public:

    /// Constructor: the supplied FinalState projection is assumed to live through the run.
    LeadingParticlesFinalState(const FinalState& fsp)
      :  FinalState(), _leading_only(false)
    {
      setName("LeadingParticlesFinalState");
      addProjection(fsp, "FS");
    }

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

    /// Add a particle ID to the list of leading particles selected
    LeadingParticlesFinalState& addParticleId(long id) {
      _ids.insert(id);
      return *this;
    }

    /// Add a particle ID to the list of leading particles selected
    LeadingParticlesFinalState& addParticleIdPair(long id) {
      _ids.insert(id);
      _ids.insert(-id);
      return *this;
    }

    /// Toggle whether to keep track only of the leading particle of any ID,
    /// or the leading particle of all IDs separately
    /// Default is the latter (=false)
    void setLeadingOnly(const bool& leadingonly) {
      _leading_only = leadingonly;
    }

    // /// Check if a particle of a particular ID was found in the current event
    // bool hasParticleId(const PdgId pid) const;

    // /// Get a particle of a particular ID (check it exists first)
    // bool get(const PdgId pid) const;


  protected:

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

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

    /// Check if the particle's ID is in the list
    bool inList(const Particle& particle) const;

  private:

    /// IDs of the leading particles to be selected
    std::set<long>_ids;
    bool _leading_only;

  };

}

#endif