test
Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
L1Trigger
GlobalCaloTrigger
src
L1GctJetCount.h
Go to the documentation of this file.
1
#ifndef L1GCTJETCOUNT_H
2
#define L1GCTJETCOUNT_H
3
4
#include "
L1Trigger/GlobalCaloTrigger/src/L1GctUnsignedInt.h
"
5
#include "
L1Trigger/GlobalCaloTrigger/src/L1GctTwosComplement.h
"
6
7
#include <boost/cstdint.hpp>
8
#include <ostream>
9
30
template
<
int
nBits>
31
class
L1GctJetCount
:
public
L1GctUnsignedInt
<nBits> {
32
33
public
:
34
36
L1GctJetCount
();
38
L1GctJetCount
(
unsigned
value
);
40
~L1GctJetCount
();
41
43
template
<
int
mBits>
44
L1GctJetCount
(
const
L1GctJetCount<mBits>
& rhs);
45
47
void
setValue
(
unsigned
value);
48
50
void
setOverFlow
(
bool
oflow);
51
53
L1GctJetCount&
operator++
();
54
L1GctJetCount
operator++
(
int
);
55
57
L1GctJetCount
operator+
(
const
L1GctJetCount &rhs)
const
;
58
60
L1GctJetCount&
operator=
(
int
value);
61
62
};
63
64
template
<
int
nBits>
65
L1GctJetCount<nBits>::L1GctJetCount
() :
L1GctUnsignedInt
<nBits>() {}
66
67
template
<
int
nBits>
68
L1GctJetCount<nBits>::L1GctJetCount
(
unsigned
value
) :
L1GctUnsignedInt
<nBits>(value) {}
69
70
template
<
int
nBits>
71
L1GctJetCount<nBits>::~L1GctJetCount
() {}
72
73
// copy contructor to move data between
74
// representations with different numbers of bits
75
template
<
int
nBits>
76
template
<
int
mBits>
77
L1GctJetCount<nBits>::L1GctJetCount
(
const
L1GctJetCount<mBits>
& rhs) {
78
this->m_nBits = nBits>0 && nBits<this->MAX_NBITS ? nBits : 16 ;
79
this->
setValue
( rhs.
value
() );
80
this->setOverFlow( this->overFlow() || rhs.
overFlow
() );
81
}
82
83
template
<
int
nBits>
84
void
L1GctJetCount<nBits>::setValue
(
unsigned
value
)
85
{
86
// check for overflow
87
if
(value >= (static_cast<unsigned>((1<<this->m_nBits) - 1)) ) {
88
this->m_overFlow =
true
;
89
this->m_value = ((1<<this->m_nBits) - 1);
90
}
else
{
91
this->m_value =
value
;
92
}
93
94
}
95
96
template
<
int
nBits>
97
void
L1GctJetCount<nBits>::setOverFlow
(
bool
oflow)
98
{
99
this->m_overFlow = oflow;
100
if
(oflow) { this->m_value = ((1<<this->m_nBits) - 1); }
101
}
102
103
// increment operators
104
template
<
int
nBits>
105
L1GctJetCount<nBits>
&
106
L1GctJetCount<nBits>::operator++
() {
107
108
this->
setValue
(this->m_value+1);
109
return
*
this
;
110
}
111
112
template
<
int
nBits>
113
L1GctJetCount<nBits>
114
L1GctJetCount<nBits>::operator++
(
int
) {
115
116
L1GctJetCount<nBits>
temp
(this->m_value);
117
temp.
setOverFlow
(this->m_overFlow);
118
this->
setValue
(this->m_value+1);
119
return
temp
;
120
}
121
122
// add two jet counts
123
template
<
int
nBits>
124
L1GctJetCount<nBits>
125
L1GctJetCount<nBits>::operator+
(
const
L1GctJetCount<nBits>
&rhs)
const
{
126
127
// temporary variable for storing the result (need to set its size)
128
L1GctJetCount<nBits>
temp
;
129
130
unsigned
sum;
131
bool
ofl;
132
133
// do the addition here
134
sum = this->
value
() + rhs.
value
();
135
ofl = this->overFlow() || rhs.
overFlow
();
136
137
//fill the temporary argument
138
temp.
setValue
(sum);
139
temp.
setOverFlow
(temp.
overFlow
() || ofl);
140
141
// return the temporary
142
return
temp
;
143
144
}
145
146
// overload assignment by int
147
template
<
int
nBits>
148
L1GctJetCount<nBits>
&
L1GctJetCount<nBits>::operator=
(
int
value
) {
149
150
this->
setValue
(value);
151
return
*
this
;
152
153
}
154
155
// overload ostream<<
156
template
<
int
nBits>
157
std::ostream& operator<<(std::ostream& s, const L1GctJetCount<nBits>&
data
) {
158
159
s
<<
"L1GctJetCount value : "
<<
data
.value();
160
if
(
data
.overFlow()) {
s
<<
" Overflow set! "
; }
161
162
return
s
;
163
164
}
165
166
// removed typedefs for slc4 compilation
167
169
//typedef L1GctJetCount<5> L1GctJcFinalType;
171
//typedef L1GctJetCount<3> L1GctJcWheelType;
172
173
174
#endif
L1GctJetCount::operator=
L1GctJetCount & operator=(int value)
overload = operator
Definition:
L1GctJetCount.h:148
L1GctJetCount
Definition of unsigned integer types with increment and overflow.
Definition:
L1GctJetCount.h:31
L1GctJetCount::setOverFlow
void setOverFlow(bool oflow)
set the overflow bit
Definition:
L1GctJetCount.h:97
relativeConstraints.value
tuple value
Definition:
relativeConstraints.py:54
L1GctJetCount::setValue
void setValue(unsigned value)
Set value from unsigned.
Definition:
L1GctJetCount.h:84
groupFilesInBlocks.temp
temp
Definition:
groupFilesInBlocks.py:140
L1GctUnsignedInt
Definition of unsigned integer types with overflow.
Definition:
L1GctUnsignedInt.h:29
reco::JetExtendedAssociation::setValue
bool setValue(Container &, const reco::JetBaseRef &, const JetExtendedData &)
associate jet with value. Returns false and associate nothing if jet is already associated ...
Definition:
JetExtendedAssociation.cc:44
L1GctJetCount::operator++
L1GctJetCount & operator++()
Define increment operators, since this is a counter.
Definition:
L1GctJetCount.h:106
L1GctUnsignedInt::value
unsigned value() const
access value as unsigned
Definition:
L1GctUnsignedInt.h:53
L1GctUnsignedInt.h
L1GctTwosComplement.h
L1GctJetCount::operator+
L1GctJetCount operator+(const L1GctJetCount &rhs) const
add two numbers
Definition:
L1GctJetCount.h:125
alignCSCRings.s
list s
Definition:
alignCSCRings.py:91
L1GctUnsignedInt::overFlow
bool overFlow() const
access overflow
Definition:
L1GctUnsignedInt.h:56
L1GctJetCount::L1GctJetCount
L1GctJetCount()
Construct a counter and initialise its value to zero.
Definition:
L1GctJetCount.h:65
L1GctJetCount::~L1GctJetCount
~L1GctJetCount()
Destructor.
Definition:
L1GctJetCount.h:71
AlCaHLTBitMon_QueryRunRegistry.data
tuple data
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:288
Generated for CMSSW Reference Manual by
1.8.5