a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
LhcoEvent.hpp
Go to the documentation of this file.
1/*
2 * LhcoEvent.hpp
3 *
4 * Created on: Jun 29, 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 LHCOEVENT_HPP_
15#define LHCOEVENT_HPP_
16
17#include <list>
18#include <vector>
19#include "ObjectLine.hpp"
20
21
22namespace LHPC
23{
24 namespace LHCO
25 {
27 {
28 public:
30 {
37 };
38 LhcoEvent( bool const isVerbose );
39 LhcoEvent( LhcoEvent const& copySource );
40 ~LhcoEvent();
41
42 int
43 getNumberOfObjects() const;
44 int
45 getEventNumber() const;
46 int
47 getTriggerWord() const;
48 ObjectLine const&
49 operator[]( int const whichLine ) const;
50 std::list< ObjectLine const* > const&
51 getPhotons() const;
52 std::list< ObjectLine const* > const&
53 getElectrons() const;
54 std::list< ObjectLine const* > const&
55 getMuons() const;
56 std::list< ObjectLine const* > const&
57 getTaus() const;
58 std::list< ObjectLine const* > const&
59 getJets() const;
60 ObjectLine const*
61 getMissingEnergy() const;
62 std::list< ObjectLine const* > const&
63 getObjectsOfType( int const whichType ) const;
64 std::string const&
65 getAsString() const;
66
67 // stuff for setting up the LhcoEvent:
68 int
69 recordLine( std::string const& lineAsString );
70 // this parses the 1st word of lineAsString and returns it, first adding
71 // a new ObjectLine if appropriate, noting its pointer in the appropriate
72 // std::list. if lineAsString is the start of a new event (as the line
73 // begins with 0, which is also what this function will return), it
74 // prepares nextEventNumber & nextTriggerWord based on this line.
75 void
77 // this clears objectLines, copies nextEventNumber & nextTriggerWord
78 // into eventNumber & triggerWord, & prepares eventAsString.
79
80
81 protected:
82 static std::string const trimmingChars;
83 static bool const trueForVerbosity;
84 static std::string const eventCommentLine;
85 static int const charactersForEventNumber;
86 static int const charactersForTriggerWord;
87
89 // the number of the event, given in line 0.
91 // the number encoding information about the trigger, given in line 0.
93 // eventNumber for the next event.
95 // triggerWord for the next event.
96
99
101 std::vector< std::list< ObjectLine const* > > objectLists;
102
103 bool const isVerbose;
104 std::string eventAsString;
106 // this is for parsing the data line:
108
109 std::list< ObjectLine const* >&
110 getObjectList( unsigned int const whichType );
111 // the type of object:
112 // 0: photon
113 // 1: electron
114 // 2: muon
115 // 3: hadronically-decaying tau lepton
116 // 4: jet
117 // 5: not defined
118 // 6: missing transverse energy
119 // anything else that appears is also undefined.
120 };
121
122
123
124
125
126 inline int
128 {
129 return objectLines.getSize();
130 }
131
132 inline int
134 {
135 return eventNumber;
136 }
137
138 inline int
140 {
141 return triggerWord;
142 }
143
144 inline ObjectLine const&
145 LhcoEvent::operator[]( int const whichLine ) const
146 {
147 return objectLines[ ( whichLine - 1 ) ];
148 }
149
150 inline std::list< ObjectLine const* > const&
152 {
153 return objectLists[ (unsigned int)photonObject ];
154 }
155
156 inline std::list< ObjectLine const* > const&
158 {
159 return objectLists[ (unsigned int)electronObject ];
160 }
161
162 inline std::list< ObjectLine const* > const&
164 {
165 return objectLists[ (unsigned int)muonObject ];
166 }
167
168 inline std::list< ObjectLine const* > const&
170 {
171 return objectLists[ (unsigned int)tauObject ];
172 }
173
174 inline std::list< ObjectLine const* > const&
176 {
177 return objectLists[ (unsigned int)jetObject ];
178 }
179
180 inline ObjectLine const*
182 {
184 }
185
186 inline std::list< ObjectLine const* > const&
187 LhcoEvent::getObjectsOfType( int const whichType ) const
188 {
189 return objectLists[ whichType ];
190 }
191
192 inline std::string const&
194 {
195 return eventAsString;
196 }
197
198 inline void
200 // this clears objectLines, copies nextEventNumber & nextTriggerWord
201 // into eventNumber & triggerWord, & prepares eventAsString.
202 {
203 objectLines.clearEntries();
204 for( int whichList( objectLists.size() - 1 );
205 0 <= whichList;
206 --whichList )
207 {
208 objectLists[ whichList ].clear();
209 }
214 eventAsString.append( "0 " );
218 eventAsString.append( " " );
222 }
223
224 inline std::list< ObjectLine const* >&
225 LhcoEvent::getObjectList( unsigned int const whichType )
226 // the type of object:
227 // 0: photon
228 // 1: electron
229 // 2: muon
230 // 3: hadronically-decaying tau lepton
231 // 4: jet
232 // 5: not defined
233 // 6: missing transverse energy
234 // anything else that appears is also undefined.
235 {
236 if( objectLists.size() <= whichType )
237 {
238 objectLists.resize( whichType + 1 );
239 }
240 return objectLists[ whichType ];
241 }
242
243 }
244
245}
246
247#endif /* LHCOEVENT_HPP_ */
static std::string intToSpacePaddedString(int inputInt, int const minimumNumberOfChars, std::string const prefixForPositiveNumbers="+", std::string const prefixForNegativeNumbers="-")
std::list< ObjectLine const * > const & getJets() const
Definition: LhcoEvent.hpp:175
std::list< ObjectLine const * > const & getElectrons() const
Definition: LhcoEvent.hpp:157
static int const charactersForEventNumber
Definition: LhcoEvent.hpp:85
int getEventNumber() const
Definition: LhcoEvent.hpp:133
std::list< ObjectLine const * > const & getMuons() const
Definition: LhcoEvent.hpp:163
BOL::VectorlikeArray< ObjectLine > objectLines
Definition: LhcoEvent.hpp:97
std::list< ObjectLine const * > & getObjectList(unsigned int const whichType)
Definition: LhcoEvent.hpp:225
std::string eventAsString
Definition: LhcoEvent.hpp:104
std::list< ObjectLine const * > const & getTaus() const
Definition: LhcoEvent.hpp:169
std::list< ObjectLine const * > const & getPhotons() const
Definition: LhcoEvent.hpp:151
static std::string const eventCommentLine
Definition: LhcoEvent.hpp:84
ObjectLine const * interpretingObjectLine
Definition: LhcoEvent.hpp:105
std::string const & getAsString() const
Definition: LhcoEvent.hpp:193
std::list< ObjectLine const * > const & getObjectsOfType(int const whichType) const
Definition: LhcoEvent.hpp:187
std::vector< std::list< ObjectLine const * > > objectLists
Definition: LhcoEvent.hpp:101
ObjectLine const * getMissingEnergy() const
Definition: LhcoEvent.hpp:181
ObjectLine const * missingEnergyLinePointer
Definition: LhcoEvent.hpp:100
int recordLine(std::string const &lineAsString)
Definition: LhcoEvent.cpp:82
ObjectLine const & operator[](int const whichLine) const
Definition: LhcoEvent.hpp:145
int getTriggerWord() const
Definition: LhcoEvent.hpp:139
LhcoEvent(bool const isVerbose)
Definition: LhcoEvent.cpp:28
BOL::VectorlikeArray< std::string > lineParser
Definition: LhcoEvent.hpp:107
static std::string const trimmingChars
Definition: LhcoEvent.hpp:82
static bool const trueForVerbosity
Definition: LhcoEvent.hpp:83
int getNumberOfObjects() const
Definition: LhcoEvent.hpp:127
static int const charactersForTriggerWord
Definition: LhcoEvent.hpp:86