master
a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models
ParticleCode.hpp
Go to the documentation of this file.
1
/*
2
* ParticleCode.hpp
3
*
4
* Created on: Jan 26, 2012
5
* Author: Ben O'Leary (benjamin.oleary@gmail.com)
6
* Copyright 2012 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 PARTICLECODE_HPP_
15
#define PARTICLECODE_HPP_
16
17
#include <vector>
18
#include "../FilterRule.hpp"
19
20
namespace
LHPC
21
{
22
namespace
LHEF
23
{
24
namespace
FilterRuleClass
25
{
26
// this class returns acceptRatherThanReject if it finds that
27
// lineToCheck.getParticleCode() matches an int in acceptableValues.
28
class
ParticleCode
:
public
FilterRule
29
{
30
public
:
31
ParticleCode
( std::vector< int >
const
&
acceptableValues
,
32
bool
const
acceptRatherThanReject
=
true
);
33
ParticleCode
(
int
const
acceptableValue,
34
bool
const
acceptRatherThanReject
=
true
);
35
virtual
36
~ParticleCode
();
37
38
virtual
bool
39
operator()
(
ParticleLine
const
& lineToCheck )
const
;
40
41
42
protected
:
43
std::vector< int >
acceptableValues
;
44
};
45
46
47
48
inline
bool
49
ParticleCode::operator()
(
ParticleLine
const
& lineToCheck )
const
50
{
51
bool
returnValue( !
acceptRatherThanReject
);
52
for
(
int
valueIndex(
acceptableValues
.size() - 1 );
53
0 <= valueIndex;
54
--valueIndex )
55
{
56
if
( lineToCheck.
getParticleCode
() ==
acceptableValues
[ valueIndex ] )
57
{
58
returnValue =
acceptRatherThanReject
;
59
valueIndex = -1;
60
}
61
}
62
return
returnValue;
63
}
64
65
}
66
typedef
FilterRuleClass::ParticleCode
FilterOnParticleCode
;
67
68
}
69
70
}
71
72
#endif
/* PARTICLECODE_HPP_ */
LHPC::LHEF::FilterRuleClass::ParticleCode
Definition:
ParticleCode.hpp:29
LHPC::LHEF::FilterRuleClass::ParticleCode::operator()
virtual bool operator()(ParticleLine const &lineToCheck) const
Definition:
ParticleCode.hpp:49
LHPC::LHEF::FilterRuleClass::ParticleCode::~ParticleCode
virtual ~ParticleCode()
Definition:
ParticleCode.cpp:39
LHPC::LHEF::FilterRuleClass::ParticleCode::ParticleCode
ParticleCode(std::vector< int > const &acceptableValues, bool const acceptRatherThanReject=true)
Definition:
ParticleCode.cpp:22
LHPC::LHEF::FilterRuleClass::ParticleCode::acceptableValues
std::vector< int > acceptableValues
Definition:
ParticleCode.hpp:43
LHPC::LHEF::FilterRule
Definition:
FilterRule.hpp:26
LHPC::LHEF::FilterRule::acceptRatherThanReject
bool const acceptRatherThanReject
Definition:
FilterRule.hpp:36
LHPC::LHEF::ParticleLine
Definition:
ParticleLine.hpp:30
LHPC::LHEF::ParticleLine::getParticleCode
int getParticleCode() const
Definition:
ParticleLine.hpp:285
LHPC::LHEF::FilterOnParticleCode
FilterRuleClass::ParticleCode FilterOnParticleCode
Definition:
ParticleCode.hpp:66
LHPC
Definition:
FourMomentum.hpp:24
LHPC
include
LHEF
FilterRuleClasses
ParticleCode.hpp
Generated on Mon Aug 4 2025 for $\texttt{HEPfit}$ using
1.9.2