a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
StandardPreselector.cpp
Go to the documentation of this file.
1/*
2 * StandardPreselector.cpp
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#include "LHEF.hpp"
15
16namespace LHPC
17{
18 namespace LHEF
19 {
20 namespace PreselectorClass
21 {
23 int const soughtParticleCode,
24 double const transverseMomentumCut,
25 double const pseudorapidityCut ) :
26 filterRules(),
27 lineFilter(),
28 filteredLines( lineFilter.getFilteredLines() )
29 // transverseMomentumCut is a lower bound on the transverse momentum of a
30 // ParticleLine to be selected.
31 // pseudorapidityCut is an upper bound on the absolute value of the
32 // pseudorapidity of a ParticleLine to be selected, and negative a value
33 // indicates that no cut on pseudorapidity should be used.
34 {
35 setUpFilter( lhefParser,
36 std::vector< int >( 1,
37 soughtParticleCode ),
38 transverseMomentumCut,
39 pseudorapidityCut );
40 }
41
43 std::vector< int > const& soughtParticleCodes,
44 double const transverseMomentumCut,
45 double const pseudorapidityCut ) :
46 filterRules(),
47 lineFilter(),
48 filteredLines( lineFilter.getFilteredLines() )
49 // constructor taking a vector of ints to select all particles with any
50 // of the given ints as particle code.
51 {
52 setUpFilter( lhefParser,
53 soughtParticleCodes,
54 transverseMomentumCut,
55 pseudorapidityCut );
56 }
57
59 MassEigenstate const& soughtMassEigenstate,
60 double const transverseMomentumCut,
61 double const pseudorapidityCut ) :
62 filterRules(),
63 lineFilter(),
64 filteredLines( lineFilter.getFilteredLines() )
65 // constructor taking a vector of ints to select all particles with any
66 // of the given ints as particle code.
67 {
68 setUpFilter( lhefParser,
69 soughtMassEigenstate.getAllCodes(),
70 transverseMomentumCut,
71 pseudorapidityCut );
72 }
73
75 {
76 for( std::vector< FilterRule* >::iterator
77 whichRule( filterRules.begin() );
78 filterRules.end() > whichRule;
79 ++whichRule )
80 {
81 delete *whichRule;
82 }
83 }
84
85
86 void
88 std::vector< int > const& soughtParticleCodes,
89 double const transverseMomentumCut,
90 double const pseudorapidityCut )
91 {
93 true ) );
94 filterRules.push_back( new FilterOnParticleCode( soughtParticleCodes,
95 true ) );
96 if( 0.0 < transverseMomentumCut )
97 {
99 transverseMomentumCut,
100 true ) );
101 }
102 if( 0.0 < pseudorapidityCut )
103 {
104 filterRules.push_back( new FilterOnPseudorapidity( pseudorapidityCut,
105 true ) );
106 }
107 for( std::vector< FilterRule* >::iterator
108 whichRule( filterRules.begin() );
109 filterRules.end() > whichRule;
110 ++whichRule )
111 {
112 lineFilter.addFilterRule( *(*whichRule) );
113 }
114 lhefParser.registerFilter( lineFilter );
115 }
116
117 } /* namespace PreselectorClass */
118 } /* namespace LHEF */
119} /* namespace LHPC */
AutomaticEventFilter & addFilterRule(FilterRule const &ruleToAdd)
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)
LhefParser & registerFilter(LHEF::AutomaticEventFilter &filterToUpdate)
Definition: LhefParser.hpp:73
std::vector< int > const & getAllCodes() const
FilterRuleClass::PseudorapidityCut FilterOnPseudorapidity
FilterRuleClass::TransverseMomentumCut FilterOnTransverseMomentum
FilterRuleClass::ParticleCode FilterOnParticleCode
FilterRuleClass::InitialOrIntermediateOrFinalState FilterOnState