CLHEP 2.4.7.1
C++ Class Library for High Energy Physics
CutBase.icc
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id: CutBase.icc,v 1.3 2008/11/19 16:11:44 boudreau Exp $
3//-------------------------------------------------------------------//
4// //
5// Implementations for the Cut class //
6// //
7//-------------------------------------------------------------------//
8template <class Type>
10
11template <class Type>
13
14template <class Type>
16
17template <class Type>
19 return OR(*this,A);
20}
21
22template <class Type>
24 return AND(*this,A);
25}
26
27template <class Type>
29 return NOT(*this);
30}
31//-------------------------------------------------------------------//
32// //
33// Implementations for the AND class //
34// //
35//-------------------------------------------------------------------//
36
37template <class Type>
38Cut<Type>::AND::AND(const AND & right):Cut<Type>(),
39 _pA(right._pA->clone()),
40 _pB(right._pB->clone())
41{
42
43}
44
45template <class Type>
46Cut<Type>::AND::AND(const Cut<Type> & A, const Cut<Type> & B):Cut<Type>(),
47 _pA(A.clone()),
48 _pB(B.clone())
49{
50}
51
52template <class Type>
54{
55 delete _pA;
56 delete _pB;
57}
58
59
60template <class Type>
62{
63 return new AND(*this);
64}
65
66template <class Type>
67bool Cut<Type>::AND::operator () (const Type & t) const {
68 return _pA->operator()(t) && _pB->operator()(t);
69}
70
71//-------------------------------------------------------------------//
72// //
73// Implementations for the OR class //
74// //
75//-------------------------------------------------------------------//
76
77template <class Type>
78Cut<Type>::OR::OR(const OR & right):Cut<Type>(),
79 _pA(right._pA->clone()),
80 _pB(right._pB->clone())
81{
82
83}
84
85template <class Type>
86Cut<Type>::OR::OR(const Cut<Type> & A, const Cut<Type> & B):Cut<Type>(),
87 _pA(A.clone()),
88 _pB(B.clone())
89{
90}
91
92template <class Type>
94{
95 delete _pA;
96 delete _pB;
97}
98
99
100template <class Type>
102{
103 return new OR(*this);
104}
105
106template <class Type>
107bool Cut<Type>::OR::operator () (const Type & t) const {
108 return _pA->operator()(t) || _pB->operator()(t);
109}
110
111
112//-------------------------------------------------------------------//
113// //
114// Implementations for the NOT class //
115// //
116//-------------------------------------------------------------------//
117
118template <class Type>
119Cut<Type>::NOT::NOT(const NOT & right):Cut<Type>(),
120 _pA(right._pA->clone())
121{
122
123}
124
125template <class Type>
127 _pA(A.clone())
128{
129}
130
131template <class Type>
133{
134 delete _pA;
135}
136
137
138template <class Type>
140{
141 return new NOT(*this);
142}
143
144template <class Type>
145bool Cut<Type>::NOT::operator () (const Type & t) const {
146 return !_pA->operator()(t);
147}
148
149
150//-------------------------------------------------------------------//
151// //
152// Implementations for the Predicate class, representing a unary //
153// No-op and useful as a user-level data type, because it is //
154// concrete, and clones on copy, therefore is useful in e.g. STL //
155// routines. //
156// //
157//-------------------------------------------------------------------//
158
159template <class Type>
161 _pA(right._pA->clone())
162{
163
164}
165
166template <class Type>
168 _pA(A.clone())
169{
170}
171
172template <class Type>
174{
175 delete _pA;
176}
177
178
179template <class Type>
181{
182 return new Predicate(*this);
183}
184
185template <class Type>
186bool Cut<Type>::Predicate::operator () (const Type & t) const {
187 return _pA->operator()(t);
188}
189
virtual ~AND()
Definition CutBase.icc:53
virtual bool operator()(const Type &t) const
Definition CutBase.icc:67
virtual AND * clone(void) const
Definition CutBase.icc:61
AND(const AND &right)
Definition CutBase.icc:38
virtual ~NOT()
Definition CutBase.icc:132
virtual bool operator()(const Type &t) const
Definition CutBase.icc:145
virtual NOT * clone(void) const
Definition CutBase.icc:139
NOT(const NOT &right)
Definition CutBase.icc:119
virtual ~OR()
Definition CutBase.icc:93
virtual OR * clone(void) const
Definition CutBase.icc:101
OR(const OR &right)
Definition CutBase.icc:78
virtual bool operator()(const Type &t) const
Definition CutBase.icc:107
virtual ~Predicate()
Definition CutBase.icc:173
Predicate(const Predicate &right)
Definition CutBase.icc:160
virtual bool operator()(const Type &t) const
Definition CutBase.icc:186
virtual Predicate * clone(void) const
Definition CutBase.icc:180
Definition CutBase.hh:58
virtual Cut * clone() const =0
OR operator||(const Cut< Type > &A) const
Definition CutBase.icc:18
NOT operator!(void) const
Definition CutBase.icc:28
AND operator&&(const Cut< Type > &A) const
Definition CutBase.icc:23
virtual ~Cut()
Definition CutBase.icc:15
Cut()
Definition CutBase.icc:9