eic-smear  1.0.3
A collection of ROOT classes for Monte Carlo events and a fast-smearing code simulating detector effects for the Electron-Ion Collider task force
erhic::Forester Class Reference

#include <Forester.h>

Inheritance diagram for erhic::Forester:

Classes

class  Status
 

Public Member Functions

 Forester ()
 
virtual ~Forester ()
 
Long64_t Plant ()
 
void SetInputFileName (const std::string &)
 
void SetOutputFileName (const std::string &)
 
void SetTreeName (const std::string &="EICTree")
 
void SetBranchName (const std::string &="event")
 
std::string GetInputFileName () const
 
std::string GetOutputFileName () const
 
std::string GetTreeName () const
 
std::string GetBranchName () const
 
void SetMaxNEvents (Long64_t=0)
 
Long64_t GetMaxNEvents () const
 
void SetMessageInterval (Long64_t=10000)
 
void Print (std::ostream &stream) const
 
void Print (Option_t *="not used") const
 
void SetBeVerbose (bool=false)
 
bool BeVerbose () const
 
const erhic::FileTypeGetFileType () const
 

Protected Member Functions

const StatusGetGetStatus () const
 
bool OpenInput ()
 
bool SetupOutput ()
 
void Finish ()
 
bool AllocateEvent ()
 
bool FindFirstEvent ()
 
void PrintStatus () const
 
bool MustQuit () const
 
void SetMustQuit (bool quit)
 

Protected Attributes

Bool_t mQuit
 Quit status. Set to true once EoF or max events reached.
 
Bool_t mVerbose
 Verbosity flag.
 
TTree * mTree
 Output TTree, owned by mRootFile.
 
VirtualEventmEvent
 Stores event branch address.
 
const erhic::FileTypemFile
 File type information.
 
TFile * mRootFile
 Pointer to output ROOT file.
 
Long64_t mMaxNEvents
 Maximum number of events to process.
 
Long64_t mInterval
 Event interval between printing status messages.
 
std::ifstream * mTextFile
 Input text file.
 
std::string mInputName
 Name of the input text file.
 
std::string mOutputName
 Name of the output ROOT file.
 
std::string mTreeName
 Name of the output TTree.
 
std::string mBranchName
 Name of the event TBranch.
 
std::string mLine
 Stores the latest text line read from the input file.
 
Status mStatus
 Forester status information.
 
VirtualEventFactorymFactory
 Pointer to the event-builder object.
 

Detailed Description

Manages the creation of trees from plain-text Monte Carlo files. Bad pun, I know, but the ROOT guys started it.

Definition at line 39 of file Forester.h.

Constructor & Destructor Documentation

erhic::Forester::Forester ( )

Default constructor.

Definition at line 25 of file Forester.cxx.

erhic::Forester::~Forester ( )
virtual

Destructor.

Definition at line 42 of file Forester.cxx.

Member Function Documentation

bool erhic::Forester::AllocateEvent ( )
protected

Allocate an event buffer for the TTree based on the generator type. Returns false if the generator has not yet been successfully determined.

Definition at line 213 of file Forester.cxx.

bool erhic::Forester::BeVerbose ( ) const
inline

Returns the verbosity i.e. whether to print status messages.

Definition at line 348 of file Forester.h.

bool erhic::Forester::FindFirstEvent ( )
protected

Aligns the input text file on the first line of the first event. After a successful call, mLine stores the first line of the event and true is returned. If unsuccessful, mLine is blank and false is returned.

Definition at line 228 of file Forester.cxx.

void erhic::Forester::Finish ( )
protected

Writes output and takes end-of-file actions.

Definition at line 191 of file Forester.cxx.

std::string erhic::Forester::GetBranchName ( ) const
inline

Returns the name of the TBranch containing event objects.

Definition at line 320 of file Forester.h.

const FileType * erhic::Forester::GetFileType ( ) const
inline

Returns the file type information for the last processed file. Returns NULL if no input has been processed. Do not delete the returned object.

Definition at line 352 of file Forester.h.

const Status& erhic::Forester::GetGetStatus ( ) const
inlineprotected

Prints a summary of the last call to Plant() to the requested output stream.

Definition at line 217 of file Forester.h.

std::string erhic::Forester::GetInputFileName ( ) const
inline

Returns the name of the input text file containing Monte Carlo data.

Definition at line 308 of file Forester.h.

Long64_t erhic::Forester::GetMaxNEvents ( ) const
inline

Returns the maximum number of events to process.

Definition at line 328 of file Forester.h.

std::string erhic::Forester::GetOutputFileName ( ) const
inline

Returns the name of the ROOT tree file to create.

Definition at line 312 of file Forester.h.

std::string erhic::Forester::GetTreeName ( ) const
inline

Returns the name of the TTree to write to the file named by SetOutputFileName().

Definition at line 316 of file Forester.h.

bool erhic::Forester::MustQuit ( ) const
inlineprotected

Prints the quit flag status. A return value of true indicates that the input file has ended or the mMaxNEvents has been reached. Processing the file will quit after the end of the next call to FinishEvent().

Definition at line 336 of file Forester.h.

bool erhic::Forester::OpenInput ( )
protected

Opens the input file and checks that it was produced by a supported Monte Carlo generator. Returns true upon success or false upon and I/O error or if the Monte Carlo generator is unsupported or cannot be determined.

Definition at line 130 of file Forester.cxx.

Long64_t erhic::Forester::Plant ( )

Processes a text file into a ROOT file. Returns the number of events processed.

Todo:
Get rid of the static counter. Replace with a member that is reset every time Plant() is called.

Definition at line 67 of file Forester.cxx.

void erhic::Forester::Print ( std::ostream &  stream) const

Prints the current configuration to the requested output stream.

Definition at line 241 of file Forester.cxx.

void erhic::Forester::Print ( Option_t *  = "not used") const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

To avoid hiding TObject::Print()

Definition at line 252 of file Forester.cxx.

void erhic::Forester::PrintStatus ( ) const
protected

Prints the status of the current Plant() call to the standard output.

void erhic::Forester::SetBeVerbose ( bool  flag = false)
inline

If set to true, prints messages during running. If set to false, runs silently except in the case of critical errors.

Definition at line 344 of file Forester.h.

void erhic::Forester::SetBranchName ( const std::string &  name = "event")
inline

Sets the name of the TBranch containing event objects. This is the only branch written to the TTree named by SetTreeName().

Definition at line 304 of file Forester.h.

void erhic::Forester::SetInputFileName ( const std::string &  name)
inline

Sets the name of the input text file containing Monte Carlo data.

Definition at line 292 of file Forester.h.

void erhic::Forester::SetMaxNEvents ( Long64_t  number = 0)
inline

Sets the maximum number of events to process. Processing will terminate when this number of events or the end of the input file is reached, whichever occurs first. A value <= 0 indicates to process all events in the input file (this is the default).

Definition at line 324 of file Forester.h.

void erhic::Forester::SetMessageInterval ( Long64_t  number = 10000)
inline

Sets the event count interval at which to print a status message. A value <= 0 suppresses messages.

Definition at line 332 of file Forester.h.

void erhic::Forester::SetMustQuit ( bool  quit)
inlineprotected

Set the quit flag.

Definition at line 340 of file Forester.h.

void erhic::Forester::SetOutputFileName ( const std::string &  name)
inline

Sets the name of the ROOT tree file to create.

Definition at line 296 of file Forester.h.

void erhic::Forester::SetTreeName ( const std::string &  name = "EICTree")
inline

Sets the name of the TTree to write to the file named by SetOutputFileName().

Definition at line 300 of file Forester.h.

bool erhic::Forester::SetupOutput ( )
protected

Opens the output ROOT file and creates the TTree ready for filling.

Definition at line 158 of file Forester.cxx.


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