ComPWA
Common Partial-Wave-Analysis Framework
ComPWA::Data::Ascii::AsciiHeader Class Reference

Representation of data contained in an ASCII header. More...

#include <AsciiHeaderIO.hpp>

Public Member Functions

 AsciiHeader (std::vector< int > PIDs={}, std::string Unit="GeV", bool EnergyFirst=false)
 
void importYAML (const std::string &HeaderContent)
 Set data members by reading a YAML-like string (including newlines). More...
 
void importYAML (std::istream &InputStream)
 
void dumpToYAML (std::ostream &os) const
 Serialise data members to YAML format, embedded in XML header tags. More...
 
const std::vector< int > getFinalStatePIDs () const
 
bool isEnergyFirst () const
 
const std::string & getUnit () const
 

Static Public Member Functions

static std::string extractHeaderContent (std::istream &InputStream)
 Extract the part that is between the XML/HTML tags <header>...</header> including newlines. More...
 

Private Attributes

std::vector< int > PIDs
 
std::string Unit
 
bool EnergyFirst
 

Detailed Description

Representation of data contained in an ASCII header.

This object takes care of reading and writing data concerning a set of events from and to a data file. The concept of a header was introduced to allow the user to document data files and facilitate comparison between Pawian and ComPWA.

Definition at line 21 of file AsciiHeaderIO.hpp.

+ Collaboration diagram for ComPWA::Data::Ascii::AsciiHeader:

Constructor & Destructor Documentation

◆ AsciiHeader()

ComPWA::Data::Ascii::AsciiHeader::AsciiHeader ( std::vector< int >  PIDs = {},
std::string  Unit = "GeV",
bool  EnergyFirst = false 
)
inline

Definition at line 23 of file AsciiHeaderIO.hpp.

Member Function Documentation

◆ dumpToYAML()

void ComPWA::Data::Ascii::AsciiHeader::dumpToYAML ( std::ostream &  os) const

Serialise data members to YAML format, embedded in XML header tags.

See also
extractHeaderContent
importYAML
  1. Write PIDs if available
  2. Write order
  3. Write unit

Definition at line 118 of file AsciiHeaderIO.cpp.

◆ extractHeaderContent()

std::string ComPWA::Data::Ascii::AsciiHeader::extractHeaderContent ( std::istream &  InputStream)
static

Extract the part that is between the XML/HTML tags <header>...</header> including newlines.

  1. Define regular expressions
  2. Define buffers
  3. Find header beginning
  4. Escape if header content contains closing tag already
  5. Abort if end of file is reached already
  6. Import header content

Definition at line 36 of file AsciiHeaderIO.cpp.

◆ getFinalStatePIDs()

const std::vector<int> ComPWA::Data::Ascii::AsciiHeader::getFinalStatePIDs ( ) const
inline

Definition at line 50 of file AsciiHeaderIO.hpp.

◆ getUnit()

const std::string& ComPWA::Data::Ascii::AsciiHeader::getUnit ( ) const
inline

Definition at line 52 of file AsciiHeaderIO.hpp.

◆ importYAML() [1/2]

void ComPWA::Data::Ascii::AsciiHeader::importYAML ( const std::string &  HeaderContent)

Set data members by reading a YAML-like string (including newlines).

Set data members by reading a YAML-like string (including newline characters).

Example:

Pids: [211, 421, -411]
Unit: GeV
Order: px py pz E

Note that even though the syntax within the header is YAML-like, there is no full YAML support. In addition, key words are case-insensitive.

Definition at line 85 of file AsciiHeaderIO.cpp.

◆ importYAML() [2/2]

void ComPWA::Data::Ascii::AsciiHeader::importYAML ( std::istream &  InputStream)
inline

Definition at line 41 of file AsciiHeaderIO.hpp.

◆ isEnergyFirst()

bool ComPWA::Data::Ascii::AsciiHeader::isEnergyFirst ( ) const
inline

Definition at line 51 of file AsciiHeaderIO.hpp.

Member Data Documentation

◆ EnergyFirst

bool ComPWA::Data::Ascii::AsciiHeader::EnergyFirst
private

Definition at line 57 of file AsciiHeaderIO.hpp.

◆ PIDs

std::vector<int> ComPWA::Data::Ascii::AsciiHeader::PIDs
private

Definition at line 55 of file AsciiHeaderIO.hpp.

◆ Unit

std::string ComPWA::Data::Ascii::AsciiHeader::Unit
private

Definition at line 56 of file AsciiHeaderIO.hpp.


The documentation for this class was generated from the following files: