Anp::FillData Class Reference

#include <FillData.h>

Inheritance diagram for Anp::FillData:
Anp::AlgSnarl Anp::Base

List of all members.

Classes

struct  Tree

Public Member Functions

 FillData ()
virtual ~FillData ()
bool Run (Record &record)
void Config (const Registry &reg)
void Set (TDirectory *dir)
void End (const DataBlock &)

Private Types

typedef std::map< std::string,
Tree
TreeMap

Private Member Functions

void Fill (DataIter ibeg, DataIter iend, const std::string &key)

Private Attributes

TDirectory * fDir
TFile * fFile
std::string fDirName
TreeMap fTree

Detailed Description

Definition at line 21 of file FillData.h.


Member Typedef Documentation

typedef std::map<std::string, Tree> Anp::FillData::TreeMap [private]

Definition at line 46 of file FillData.h.


Constructor & Destructor Documentation

Anp::FillData::FillData (  ) 

Definition at line 21 of file FillData.cxx.

00022    :fDir(0),
00023     fFile(0),
00024     fDirName("fill")
00025 {   
00026 }

Anp::FillData::~FillData (  )  [virtual]

Definition at line 29 of file FillData.cxx.

00030 {
00031 }


Member Function Documentation

void Anp::FillData::Config ( const Registry reg  )  [virtual]

Reimplemented from Anp::AlgSnarl.

Definition at line 101 of file FillData.cxx.

References fDir, fDirName, fFile, Registry::Get(), Anp::GetDir(), and Registry::KeyExists().

00102 {
00103    //
00104    // create an output file if a path is given
00105    //
00106 
00107    const char *value_char = 0;
00108    if(reg.Get("FillDataDirName", value_char) && value_char)
00109    {
00110       fDirName = value_char;
00111    }
00112 
00113    const char *path_char = 0;
00114    if(reg.Get("FillDataPath", path_char) && path_char)
00115    {
00116       fFile = new TFile(path_char, "RECREATE");   
00117       if(!fFile || !fFile -> IsOpen())
00118       {
00119          cerr << "FillData::Config - failed to create ROOT file:\n   " << path_char << endl;
00120          fFile = 0;
00121       }
00122       else
00123       {
00124          cout << "FillData::Config - recreated ROOT file:\n   " << path_char << endl;
00125       }
00126    
00127       fDir = Anp::GetDir(fDirName, fFile);
00128    }
00129 
00130    if(reg.KeyExists("PrintConfig"))
00131    {
00132       cout << "FillData::Config" << endl
00133            << "   DirName = " << fDirName << endl;
00134       
00135       if(path_char)
00136       {
00137          cout << "   Path = " << path_char << endl;
00138       }
00139    }
00140 }

void Anp::FillData::End ( const DataBlock  )  [virtual]

Reimplemented from Anp::AlgSnarl.

Definition at line 143 of file FillData.cxx.

References fFile.

00144 {
00145    if(fFile)
00146    {
00147       fFile -> Write();
00148       fFile -> Close();
00149    }
00150 }

void Anp::FillData::Fill ( DataIter  ibeg,
DataIter  iend,
const std::string &  key 
) [private]

Referenced by Run().

bool Anp::FillData::Run ( Record record  )  [virtual]

Implements Anp::AlgSnarl.

Definition at line 34 of file FillData.cxx.

References Anp::Record::EventBeg(), Anp::Record::EventEnd(), fDir, Fill(), Anp::Record::TrackBeg(), and Anp::Record::TrackEnd().

00035 {
00036    if(!fDir)
00037    {
00038       return true;
00039    }
00040 
00041    for(EventIter ievent = record.EventBeg(); ievent != record.EventEnd(); ++ievent)
00042    {
00043       Fill(ievent -> DataBeg(), ievent -> DataEnd(), "event");
00044    }
00045    for(TrackIter itrack = record.TrackBeg(); itrack != record.TrackEnd(); ++itrack)
00046    {
00047       Fill(itrack -> DataBeg(), itrack -> DataEnd(), "track");
00048    }  
00049 
00050    return true;
00051 }

void Anp::FillData::Set ( TDirectory *  dir  )  [virtual]

Reimplemented from Anp::AlgSnarl.

Definition at line 89 of file FillData.cxx.

References fDir, fDirName, and Anp::GetDir().

00090 {
00091    //
00092    // If not ROOT file exist, then use outside TDirectory pointer if it is valid
00093    //
00094    if(!fDir)
00095    {
00096       fDir = Anp::GetDir(fDirName, dir);
00097    }
00098 }


Member Data Documentation

TDirectory* Anp::FillData::fDir [private]

Definition at line 54 of file FillData.h.

Referenced by Config(), Run(), and Set().

std::string Anp::FillData::fDirName [private]

Definition at line 57 of file FillData.h.

Referenced by Config(), and Set().

TFile* Anp::FillData::fFile [private]

Definition at line 55 of file FillData.h.

Referenced by Config(), and End().

Definition at line 59 of file FillData.h.


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

Generated on 15 Jul 2018 for loon by  doxygen 1.6.1