a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
ObjectLine.hpp
Go to the documentation of this file.
1/*
2 * ObjectLine.hpp
3 *
4 * Created on: Jun 25, 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 OBJECTLINE_HPP_
15#define OBJECTLINE_HPP_
16
18
19namespace LHPC
20{
21 namespace LHCO
22 {
23 // this is a class to hold the data in a single line of an event in the
24 // Large Hadron Collider Olympics format.
26 {
27 public:
28 static ObjectLine*
29 copyObjectLine( ObjectLine const& copySource );
30 static bool
32 ObjectLine const* firstObjectLine,
33 ObjectLine const* secondObjectLine );
34 // this returns true if firstObjectLine.getTransverseMomentum() is lower
35 // than or equal to secondObjectLine.getTransverseMomentum().
36 static bool
38 ObjectLine const* firstObjectLine,
39 ObjectLine const* secondObjectLine );
40 // this returns true if firstObjectLine.getTransverseMomentum() is
41 // greater than or equal to secondObjectLine.getTransverseMomentum().
42
43 ObjectLine();
44 ObjectLine( ObjectLine const& copySource );
46
47 double
48 operator[]( int const whichElement );
49 // this returns the element of the line treating all the values as
50 // doubles. it starts from 0, rather than 1 (so entry [ 2 ] is the
51 // pseudorapidity, for example).
52 int
53 getLineNumber() const;
54 int
55 hash() const { return getLineNumber(); }
56 int
57 getObjectType() const;
58 int
59 typ() const { return getObjectType(); }
60 double
61 getPseudorapidity() const;
62 double
63 eta() const { return getPseudorapidity(); }
64 double
65 getAzimuthalAngle() const;
66 double
67 phi() const { return getAzimuthalAngle(); }
68 double
70 double
71 pt() const { return getTransverseMomentum(); }
72 double
73 getInvariantMass() const;
74 double
75 jmass() const { return getInvariantMass(); }
76 double
77 getNumberOfTracks() const;
78 double
79 ntrk() const { return getNumberOfTracks(); }
80 double
81 getTagNumber() const;
82 double
83 btag() const { return getTagNumber(); }
84 double
86 double
88 double
89 getColumnTen() const;
90 double
91 getColumnEleven() const;
92 ObjectLine const*
93 recordLine( int const lineNumber,
94 BOL::VectorlikeArray< std::string > const& lineAsStrings );
95 double
96 getAzimuthalDistanceTo( ObjectLine const& comparisonObject ) const;
97 // this returns the value of the azimuthal angle difference, in the range
98 // -pi to +pi, with the sign indicating the direction of comparisonObject
99 // from this ObjectLine, e.g. a positive value means that
100 // comparisonObject is anticlockwise from this ObjectLine.
101 double
102 getPseudorapidityDistanceTo( ObjectLine const& comparisonObject ) const;
103 // this returns the value of the pseudorapidity difference with the sign
104 // indicating the direction of comparisonObject from this ObjectLine.
105 double
107 ObjectLine const& comparisonObject ) const;
108 // this returns the sum of the squares of the azimuthal and
109 // pseudorapidity differences.
110 double
112 ObjectLine const& comparisonObject ) const;
113 // this returns the square root of the sum of the squares of the
114 // azimuthal and pseudorapidity differences.
115
116
117 protected:
118 static int const minimumNumberOfEntries;
119 // this is the minimum number of numbers expected for a valid line.
120
122 // the number of the line for the object within the list of the event.
124 // the type of object:
125 // 0: photon
126 // 1: electron
127 // 2: muon
128 // 3: hadronically-decaying tau lepton
129 // 4: jet
130 // 5: not defined
131 // 6: missing transverse energy
132 std::vector< double > valueVector;
133 // the entries in the vector are, in order:
134 // lineNumber, as a double,
135 // objectType, as a double,
136 // the pseudorapidity,
137 // the azimuthal angle,
138 // the transverse momentum,
139 // the invariant mass,
140 // the number of tracks,
141 // the number for the b-tag, which has a special meaning for muons,
142 // the ratio of hadronic to electromagnetic energies.
143 // any further numbers have not been defined by 2012-06-29,
144 // but the standard includes 2 dummy numbers. this class only requires
145 // the minimum of 9 numbers, assumes that it will read 11 numbers (but
146 // fills the 10th & 11th entries with NaN), yet can cope with longer
147 // lines (assuming that all space-separated strings represent doubles).
148 };
149
150
151
152
153
154 inline ObjectLine*
156 {
157 return new ObjectLine( copySource );
158 }
159
160 inline bool
162 ObjectLine const* firstObjectLine,
163 ObjectLine const* secondObjectLine )
164 // this returns true if firstObjectLine.getTransverseMomentum() is lower
165 // than or equal to secondObjectLine.getTransverseMomentum().
166 {
167 return ( firstObjectLine->getTransverseMomentum()
168 <= secondObjectLine->getTransverseMomentum() );
169 }
170
171 inline bool
173 ObjectLine const* firstObjectLine,
174 ObjectLine const* secondObjectLine )
175 // this returns true if firstObjectLine.getTransverseMomentum() is
176 // greater than or equal to secondObjectLine.getTransverseMomentum().
177 {
178 return ( secondObjectLine->getTransverseMomentum()
179 <= firstObjectLine->getTransverseMomentum() );
180 }
181
182 inline double
183 ObjectLine::operator[]( int const whichElement )
184 {
185 return valueVector[ whichElement ];
186 }
187
188 inline int
190 {
191 return lineNumber;
192 }
193
194 inline int
196 {
197 return objectType;
198 }
199
200 inline double
202 {
203 return valueVector[ 2 ];
204 }
205
206 inline double
208 {
209 return valueVector[ 3 ];
210 }
211
212 inline double
214 {
215 return valueVector[ 4 ];
216 }
217
218 inline double
220 {
221 return valueVector[ 5 ];
222 }
223
224 inline double
226 {
227 return valueVector[ 6 ];
228 }
229
230 inline double
232 {
233 return valueVector[ 7 ];
234 }
235
236 inline double
238 {
239 return valueVector[ 8 ];
240 }
241
242 inline double
244 {
245 return valueVector[ 9 ];
246 }
247
248 inline double
250 {
251 return valueVector[ 10 ];
252 }
253
254 inline double
256 ObjectLine const& comparisonObject ) const
257 // this returns the value of the azimuthal angle difference, in the range
258 // -pi to +pi, with the sign indicating the direction of comparisonObject
259 // from this ObjectLine, e.g. a positive value means that
260 // comparisonObject is anticlockwise from this ObjectLine.
261 {
262 double angularSeparation( comparisonObject.getAzimuthalAngle()
263 - getAzimuthalAngle() );
264 while( M_PI <= angularSeparation )
265 {
266 angularSeparation -= BOL::UsefulStuff::twicePi;
267 }
268 while( -(M_PI) >= angularSeparation )
269 {
270 angularSeparation += BOL::UsefulStuff::twicePi;
271 }
272 return angularSeparation;
273 }
274
275 inline double
277 ObjectLine const& comparisonObject ) const
278 // this returns the value of the pseudorapidity difference with the sign
279 // indicating the direction of comparisonObject from this ObjectLine.
280 {
281 return ( comparisonObject.getPseudorapidity()
282 - getPseudorapidity() );
283 }
284
285 inline double
287 ObjectLine const& comparisonObject ) const
288 // this returns the sum of the squares of the azimuthal and pseudorapidity
289 // differences.
290 {
291 double azimuthalDistance( getAzimuthalDistanceTo( comparisonObject ) );
292 double pseudorapidityDistance(
293 getPseudorapidityDistanceTo( comparisonObject ) );
294 return ( ( azimuthalDistance * azimuthalDistance )
295 + ( pseudorapidityDistance * pseudorapidityDistance ) );
296 }
297
298 inline double
300 ObjectLine const& comparisonObject ) const
301 // this returns the square root of the sum of the squares of the
302 // azimuthal and pseudorapidity differences.
303 {
304 return
305 sqrt( getPseudorapidityAngularDistanceSquaredTo( comparisonObject ) );
306 }
307
308 }
309
310}
311
312#endif /* OBJECTLINE_HPP_ */
static double const twicePi
Definition: UsefulStuff.hpp:30
double jmass() const
Definition: ObjectLine.hpp:75
double phi() const
Definition: ObjectLine.hpp:67
double getPseudorapidityAngularDistanceTo(ObjectLine const &comparisonObject) const
Definition: ObjectLine.hpp:299
double ntrk() const
Definition: ObjectLine.hpp:79
static bool isOrderedByTransverseMomentumLowToHigh(ObjectLine const *firstObjectLine, ObjectLine const *secondObjectLine)
Definition: ObjectLine.hpp:161
double eta() const
Definition: ObjectLine.hpp:63
double getNumberOfTracks() const
Definition: ObjectLine.hpp:225
double getTransverseMomentum() const
Definition: ObjectLine.hpp:213
double getTagNumber() const
Definition: ObjectLine.hpp:231
static int const minimumNumberOfEntries
Definition: ObjectLine.hpp:118
double hadem() const
Definition: ObjectLine.hpp:87
double getInvariantMass() const
Definition: ObjectLine.hpp:219
double operator[](int const whichElement)
Definition: ObjectLine.hpp:183
double getColumnEleven() const
Definition: ObjectLine.hpp:249
double getHadronicToElectromagneticEnergyRatio() const
Definition: ObjectLine.hpp:237
ObjectLine const * recordLine(int const lineNumber, BOL::VectorlikeArray< std::string > const &lineAsStrings)
Definition: ObjectLine.cpp:47
double btag() const
Definition: ObjectLine.hpp:83
double getColumnTen() const
Definition: ObjectLine.hpp:243
double getPseudorapidityDistanceTo(ObjectLine const &comparisonObject) const
Definition: ObjectLine.hpp:276
int getObjectType() const
Definition: ObjectLine.hpp:195
double getPseudorapidity() const
Definition: ObjectLine.hpp:201
static bool isOrderedByTransverseMomentumHighToLow(ObjectLine const *firstObjectLine, ObjectLine const *secondObjectLine)
Definition: ObjectLine.hpp:172
double getAzimuthalAngle() const
Definition: ObjectLine.hpp:207
double getAzimuthalDistanceTo(ObjectLine const &comparisonObject) const
Definition: ObjectLine.hpp:255
int getLineNumber() const
Definition: ObjectLine.hpp:189
static ObjectLine * copyObjectLine(ObjectLine const &copySource)
Definition: ObjectLine.hpp:155
double getPseudorapidityAngularDistanceSquaredTo(ObjectLine const &comparisonObject) const
Definition: ObjectLine.hpp:286
double pt() const
Definition: ObjectLine.hpp:71
std::vector< double > valueVector
Definition: ObjectLine.hpp:132