ComPWA
Common Partial-Wave-Analysis Framework
ComPWA::Data::Ascii Namespace Reference

Classes

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

Functions

EventCollection readData (const std::string &InputFilePath, long long NumberEventsToRead=-1)
 Read momentum tuples from an ASCII file. More...
 
void writeData (const EventCollection &DataSample, const std::string &OutputFilePath, bool OverwriteFile)
 

Function Documentation

◆ readData()

EventCollection ComPWA::Data::Ascii::readData ( const std::string &  InputFilePath,
long long  NumberEventsToRead = -1 
)

Read momentum tuples from an ASCII file.

The file should start with a header that defines the final state, like so:

<header>
Pids: [211, -211, 22]
Order: E px Py pz
Unit: GeV
</header>

Note that the section within the header tags is YAML syntax.This header is followed by rows of momentum tuples, grouped per event. In this case, you would have a row for the $\pi^+$, then for the $\pi^-$, then one for the $\gamma$, and finally back to $\pi^+$. You may choose to start each event group with a weight value, but you don't need to.

  1. Open file
  2. Extract header
  3. Determine whether has header
  4. Determine whether weights or not
  5. Check number of particles (if it has weights)
  6. Check E,p or p,E
  7. Import events

Definition at line 18 of file AsciiDataIO.cpp.

◆ writeData()

void ComPWA::Data::Ascii::writeData ( const EventCollection DataSample,
const std::string &  OutputFilePath,
bool  OverwriteFile 
)
  1. Determine stream mode
  2. Open file
  3. Write header
  4. Write events

Definition at line 114 of file AsciiDataIO.cpp.