a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
LhefParser.hpp
Go to the documentation of this file.
1/*
2 * LhefParser.hpp
3 *
4 * Created on: Jan 11, 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 LHEFPARSER_HPP_
15#define LHEFPARSER_HPP_
16
18#include "LhefEvent.hpp"
20#include "FilterRuleClasses.hpp"
21#include "../PCAD/NineDigitSlhaCodes.hpp"
22#include "../PCAD/SevenDigitSlhaCodes.hpp"
23
24namespace LHPC
25{
26 // this is a class for reading in a LHEF format file & parsing the events
27 // from it.
29 {
30 public:
31 LhefParser( std::string const eventFileName = "",
32 bool const isVerbose = true );
34
37 // this adds a pointer to filterToUpdate to automaticFilters so that its
38 // updateForNewEvent(...) gets called at the end of readNextEvent().
39 bool
40 openFile( std::string const& eventFileName );
41 // this opens the file with the given name as the source of its events &
42 // returns true, unless the file could not be opened.
43 bool
45 // this returns true if the last event that was read was also successfully
46 // interpreted.
47 bool
49 // this reads in the next event in the event file, & returns true if
50 // successful.
51 LHEF::LhefEvent const&
52 getEvent() const;
53 // this returns the last parsed event.
54
55
56 protected:
57 static std::string const eventTag;
58
62 std::vector< LHEF::AutomaticEventFilter* > automaticFilters;
64 std::string eventAsString;
66 };
67
68
69
70
71
72 inline LhefParser&
74 // this adds a pointer to filterToUpdate to automaticFilters so that its
75 // updateForNewEvent(...) gets called at the end of readNextEvent().
76 {
77 automaticFilters.push_back( &filterToUpdate );
78 return *this;
79 }
80
81 inline bool
82 LhefParser::openFile( std::string const& eventFileName )
83 // this opens the file with the given name as the source of its events &
84 // returns true, unless the file could not be opened.
85 {
87 return fileIsOpen;
88 }
89
90 inline bool
92 // this returns true if the last event that was read was also successfully
93 // interpreted.
94 {
95 return eventIsValid;
96 }
97
98 inline LHEF::LhefEvent const&
100 // this returns the last parsed event.
101 {
102 return currentEvent;
103 }
104
105}
106
107#endif /* LHEFPARSER_HPP_ */
bool openRootElementOfFile(std::string const &fileName)
LHEF::LhefEvent currentEvent
Definition: LhefParser.hpp:61
std::string eventAsString
Definition: LhefParser.hpp:64
static std::string const eventTag
Definition: LhefParser.hpp:57
std::vector< LHEF::AutomaticEventFilter * > automaticFilters
Definition: LhefParser.hpp:62
LhefParser & registerFilter(LHEF::AutomaticEventFilter &filterToUpdate)
Definition: LhefParser.hpp:73
bool readNextEvent()
Definition: LhefParser.cpp:43
LHEF::LhefEvent const & getEvent() const
Definition: LhefParser.hpp:99
LhefParser(std::string const eventFileName="", bool const isVerbose=true)
Definition: LhefParser.cpp:20
BOL::AsciiXmlParser fileParser
Definition: LhefParser.hpp:60
bool eventReadSuccessfully()
Definition: LhefParser.hpp:91
bool openFile(std::string const &eventFileName)
Definition: LhefParser.hpp:82