a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
LhefParser.cpp
Go to the documentation of this file.
1/*
2 * LhefParser.cpp
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#include "LHEF.hpp"
15
16namespace LHPC
17{
18 std::string const LhefParser::eventTag( "event" );
19
20 LhefParser::LhefParser( std::string const eventFileName,
21 bool const isVerbose ) :
22 isVerbose( isVerbose ),
23 fileParser( isVerbose ),
24 currentEvent( isVerbose ),
25 automaticFilters(),
26 fileIsOpen( false ),
27 eventAsString( "" ),
28 eventIsValid( false )
29 {
30 if( !(eventFileName.empty()) )
31 {
32 openFile( eventFileName );
33 }
34 }
35
37 {
38 // does nothing.
39 }
40
41
42 bool
44 // this reads in the next event in the event file, & returns true if
45 // successful.
46 {
47 if( fileIsOpen )
48 {
51 {
53 if( !fileIsOpen )
54 {
56 eventAsString.assign( "" );
57 return false;
58 }
59 }
62 for( int filterIndex( automaticFilters.size() - 1 );
63 0 <= filterIndex;
64 --filterIndex )
65 {
66 automaticFilters[ filterIndex ]->updateForNewEvent( currentEvent );
67 }
68 }
69 return fileIsOpen;
70 }
71
72}
std::string const & getCurrentElementContent() const
bool currentElementNameMatches(std::string const &comparisonString) const
bool recordEvent(std::string const &eventAsString)
Definition: LhefEvent.cpp:81
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
bool readNextEvent()
Definition: LhefParser.cpp:43
LhefParser(std::string const eventFileName="", bool const isVerbose=true)
Definition: LhefParser.cpp:20
BOL::AsciiXmlParser fileParser
Definition: LhefParser.hpp:60
bool openFile(std::string const &eventFileName)
Definition: LhefParser.hpp:82