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

Namespace with read/write functions for ROOT files. More...

Classes

class  RootAngleEfficiency
 Uses also TEfficiency object, but the variables are one invariant mass and the corresponding helicity angle. More...
 
class  RootEfficiency
 Efficiency provided by a histogram. More...
 
class  RootGenerator
 
class  RootUniformRealGenerator
 

Functions

std::vector< std::string > pidsToUniqueStrings (std::vector< pid > Pids)
 
std::vector< piduniqueStringsToPids (std::vector< std::string > UniqueStrings)
 
ComPWA::EventCollection readData (const std::string &InputFileName, const std::string &TreeName, long long NumberEventsToRead=-1)
 Create a vector of Events from a ROOT file. More...
 
void writeData (const EventCollection &OutputSample, const std::string &OutputFilePath, const std::string &TreeName, bool OverwriteFile=true)
 Write a vector of Events to a ROOT file. More...
 

Detailed Description

Namespace with read/write functions for ROOT files.

Function Documentation

◆ pidsToUniqueStrings()

std::vector<std::string> ComPWA::Data::Root::pidsToUniqueStrings ( std::vector< pid Pids)

Definition at line 24 of file RootDataIO.cpp.

◆ readData()

ComPWA::EventCollection ComPWA::Data::Root::readData ( const std::string &  InputFileName,
const std::string &  TreeName,
long long  NumberEventsToRead = -1 
)

Create a vector of Events from a ROOT file.

The input file should have at least one event-based TTree with:

  • A branch named "Particles" containing TClonesArrays. These arrays should contain TParticle objects with a defined 4-momentum.
  • A branch of doubles called "Weight".
    Parameters
    InputFileNameInput ROOT file(s); can take wildcards, see TChain::Add.
    TreeNameName of the event-based tree
    NumberEventsToReadLimit the resulting vector to this number of events (optional).
  1. Ignore custom streamer warning and error message for missing trees
  2. Use TChain to add files through wildcards if necessary
  3. Test TChain quality
  4. Get PIDs
  5. Set branch addresses
  6. Import data sample

Definition at line 60 of file RootDataIO.cpp.

◆ uniqueStringsToPids()

std::vector<pid> ComPWA::Data::Root::uniqueStringsToPids ( std::vector< std::string >  UniqueStrings)

Definition at line 46 of file RootDataIO.cpp.

◆ writeData()

void ComPWA::Data::Root::writeData ( const EventCollection OutputSample,
const std::string &  OutputFilePath,
const std::string &  TreeName,
bool  OverwriteFile = true 
)

Write a vector of Events to a ROOT file.

See readData for the structure of the output file.

Parameters
OutputSampleList of Events including a info header
OutputFilePathPath to the output ROOT file
TreeNameName of the event-based output TTree in the file
OverwriteFileSet to true if you do not want to append
  1. Ignore custom streamer warning
  2. Check EventCollection quality
  3. Open or create ROOT file
  4. Define TTree its branches
  5. Fill tree

Definition at line 145 of file RootDataIO.cpp.