a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
StandardPreselector.hpp
Go to the documentation of this file.
1/*
2 * StandardPreselector.hpp
3 *
4 * Created on: Jan 25, 2013
5 * Author: Ben O'Leary (benjamin.oleary@gmail.com)
6 * Copyright 2013 Ben O'Leary
7 *
8 * This file is part of LesHouchesParserClasses, released under the
9 * GNU General Public License. Please see the accompanying
10 * README.LHPC_CPP.txt file for a full list of files, brief documentation
11 * on how to use these classes, and further details on the license.
12 */
13
14#ifndef STANDARDPRESELECTOR_HPP_
15#define STANDARDPRESELECTOR_HPP_
16
17#include <stdexcept>
18#include "../../MEC.hpp"
19#include "../FilterRuleClasses.hpp"
20
21namespace LHPC
22{
23 namespace LHEF
24 {
25 namespace PreselectorClass
26 {
27 // this is a class to streamline the process of creating an
28 // AutomaticEventFilter & set of FilterRules to select final-state
29 // particles with a given particle code, and optionally, filtering on a
30 // minimum transverse momentum and on a maximum pseudorapidity magnitude.
32 {
33 public:
35 int const soughtParticleCode,
36 double const transverseMomentumCut = 0.0,
37 double const pseudorapidityCut = -1.0 );
38 // transverseMomentumCut is a lower bound on the transverse momentum of
39 // a ParticleLine to be selected.
40 // pseudorapidityCut is an upper bound on the absolute value of the
41 // pseudorapidity of a ParticleLine to be selected, and negative a
42 // value indicates that no cut on pseudorapidity should be used.
44 std::vector< int > const& soughtParticleCodes,
45 double const transverseMomentumCut = 0.0,
46 double const pseudorapidityCut = -1.0 );
47 // constructor taking a vector of ints to select all particles with any
48 // of the given ints as particle code.
50 MassEigenstate const& soughtMassEigenstate,
51 double const transverseMomentumCut = 0.0,
52 double const pseudorapidityCut = -1.0 );
53 // constructor taking a MassEigenstate reference instead of an int.
54 virtual
56
57 ParticleLine const&
58 operator[]( int elementIndex ) const;
59 // this accesses the elements starting with index 0 (like normal
60 // arrays).
61 bool
62 isEmpty() const;
63 int
64 getSize() const;
65 std::list< LHPC::LHEF::ParticleLine const* >&
66 getList();
67
68
69 protected:
70 std::vector< FilterRule* > filterRules;
72 std::list< LHPC::LHEF::ParticleLine const* >& filteredLines;
73
74 void
75 setUpFilter( LhefParser& lhefParser,
76 std::vector< int > const& soughtParticleCodes,
77 double const transverseMomentumCut,
78 double const pseudorapidityCut );
79 };
80
81
82
83
84
85 inline ParticleLine const&
86 StandardPreselector::operator[]( int elementIndex ) const
87 // this accesses the elements starting with index 0 (like normal arrays).
88 {
89 if( ( 0 > elementIndex )
90 ||
91 ( filteredLines.size() <= (unsigned int)elementIndex ) )
92 {
93 throw std::out_of_range(
94 "StandardPreselector::operator[] index out of range" );
95 }
96 std::list< LHPC::LHEF::ParticleLine const* >::iterator
97 lineIterator( filteredLines.begin() );
98 while( 0 <= (--elementIndex ) )
99 {
100 ++lineIterator;
101 }
102 return *(*lineIterator);
103 }
104
105 inline bool
107 {
108 return filteredLines.empty();
109 }
110
111 inline int
113 {
114 return (int)(filteredLines.size());
115 }
116
117 inline std::list< LHPC::LHEF::ParticleLine const* >&
119 {
120 return filteredLines;
121 }
122
123 } /* namespace PreselectorClass */
124 } /* namespace LHEF */
125} /* namespace LHPC */
126#endif /* STANDARDPRESELECTOR_HPP_ */
std::list< LHPC::LHEF::ParticleLine const * > & filteredLines
ParticleLine const & operator[](int elementIndex) const
StandardPreselector(LhefParser &lhefParser, int const soughtParticleCode, double const transverseMomentumCut=0.0, double const pseudorapidityCut=-1.0)
void setUpFilter(LhefParser &lhefParser, std::vector< int > const &soughtParticleCodes, double const transverseMomentumCut, double const pseudorapidityCut)
std::list< LHPC::LHEF::ParticleLine const * > & getList()