cafe::Write Class Reference
[CAF Environment (Cafe)]

#include <Write.hpp>

Inheritance diagram for cafe::Write:

cafe::Processor List of all members.

Detailed Description

Write selected branches for each event into a new output file.

Configuration options:

To create SAM metadata output, the following options have to be all set:

Definition at line 50 of file Write.hpp.

Public Member Functions

 Write (const char *name)
 ~Write ()
void finish ()
 Called at end of processing.

bool processEvent (Event &event)
 Called for every event.

void inputFileOpened (TFile *file)
 Called for every new input file that was opened.

void inputFileOpened (TFile *file, bool force)
 ClassDef (Write, 0)

Private Member Functions

void check_file ()
 This method checks that the file object embedded in _tree matches _file.

void copy_file ()
void writeMetaData ()
bool containsUpdatedClass (TBranch *br)
 Returns true if the branch references a class of some sort that has a class version different from the one we currently have loaded in memory.

void updateBranch (TTree *input_tree, const std::string &branch_name)
 Update the current output tree with a new version of this branch.


Private Attributes

std::string _treeName
std::string _oldFileName
std::vector< std::string > _branches
std::vector< std::string > _disable
TFile * _input_file
TFile * _file
TTree * _tree
FilePattern _pattern
Long64_t _autosave
bool _fileOwner
std::string _destination
unsigned int _filesPerOutput
unsigned int _filesPerOutputDone
Long64_t _rootMaxTreeSize
unsigned int _maxEventsPerFile
unsigned int _maxBytesPerFile
std::string _samFamily
 SAM parameters SAM.Family:.

std::string _samApplication
 SAM.Application:.

std::string _samVersion
 SAM.Version:.

bool _doMetaData
std::vector< std::string > _parents
 List of parent files.

std::set< int > _runs
 List of runs.

int _firstEvent
 Lowest event no.

int _lastEvent
 Highest event no.

Variables _vars
 To read event number and run.

bool _updateObjectVersion
 Should we re-write branches that contain new versions of objects.

std::vector< std::string > _updatedBranches
 List of top level branch names that need updating.


Constructor & Destructor Documentation

cafe::Write::Write const char *  name  ) 
 

Definition at line 51 of file Write.cpp.

References _autosave, _branches, _destination, _disable, _doMetaData, _filesPerOutput, _filesPerOutputDone, _maxBytesPerFile, _maxEventsPerFile, _pattern, _rootMaxTreeSize, _samApplication, _samFamily, _samVersion, _treeName, _updateObjectVersion, cafe::Config::get(), cafe::Config::getVString(), cafe::Processor::name(), and cafe::FilePattern::set().

cafe::Write::~Write  ) 
 

Definition at line 93 of file Write.cpp.


Member Function Documentation

void cafe::Write::check_file  )  [private]
 

This method checks that the file object embedded in _tree matches _file.

If the file objects don't match, crash.

Definition at line 462 of file Write.cpp.

References _file, _fileOwner, _oldFileName, _tree, cafe::Processor::err(), and cafe::Processor::name().

Referenced by finish(), inputFileOpened(), processEvent(), and writeMetaData().

cafe::Write::ClassDef Write  ,
 

bool cafe::Write::containsUpdatedClass TBranch *  br  )  [private]
 

Returns true if the branch references a class of some sort that has a class version different from the one we currently have loaded in memory.

Definition at line 420 of file Write.cpp.

Referenced by inputFileOpened().

void cafe::Write::copy_file  )  [private]
 

Definition at line 480 of file Write.cpp.

References _destination, _file, cafe::Processor::err(), cafe::Processor::name(), and cafe::Processor::out().

Referenced by finish(), and inputFileOpened().

void cafe::Write::finish  )  [virtual]
 

Called at end of processing.

Reimplemented from cafe::Processor.

Definition at line 98 of file Write.cpp.

References _destination, _file, _fileOwner, check_file(), copy_file(), and writeMetaData().

void cafe::Write::inputFileOpened TFile *  file,
bool  force
 

Definition at line 169 of file Write.cpp.

References _branches, _destination, _disable, _file, _fileOwner, _filesPerOutput, _filesPerOutputDone, _input_file, _oldFileName, _parents, _pattern, _tree, _treeName, _updatedBranches, _updateObjectVersion, check_file(), containsUpdatedClass(), copy_file(), disableBranch(), enableBranch(), cafe::Processor::err(), cafe::Processor::getDirectory(), cafe::Processor::name(), cafe::Processor::out(), cafe::FilePattern::replace(), updateBranch(), and writeMetaData().

void cafe::Write::inputFileOpened TFile *  file  )  [inline, virtual]
 

Called for every new input file that was opened.

Reimplemented from cafe::Processor.

Definition at line 58 of file Write.hpp.

Referenced by processEvent().

bool cafe::Write::processEvent Event event  )  [virtual]
 

Called for every event.

Reimplemented from cafe::Processor.

Definition at line 113 of file Write.cpp.

References _autosave, _doMetaData, _fileOwner, _firstEvent, _input_file, _lastEvent, _maxBytesPerFile, _maxEventsPerFile, _runs, _tree, _vars, check_file(), cafe::Processor::eventCount(), TMBGlobal::evtno(), cafe::Event::getGlobal(), inputFileOpened(), cafe::EventBase::readBranch(), and TMBGlobal::runno().

void cafe::Write::updateBranch TTree *  input_tree,
const std::string &  branch_name
[private]
 

Update the current output tree with a new version of this branch.

Get the address and use that

Definition at line 440 of file Write.cpp.

References _tree.

Referenced by inputFileOpened().

void cafe::Write::writeMetaData  )  [private]
 

Definition at line 334 of file Write.cpp.

References _doMetaData, _file, _fileOwner, _firstEvent, _lastEvent, _parents, _runs, _samApplication, _samFamily, _samVersion, _tree, check_file(), cafe::Processor::name(), and cafe::Processor::out().

Referenced by finish(), and inputFileOpened().


Member Data Documentation

Long64_t cafe::Write::_autosave [private]
 

Definition at line 73 of file Write.hpp.

Referenced by processEvent(), and Write().

std::vector<std::string> cafe::Write::_branches [private]
 

Definition at line 67 of file Write.hpp.

Referenced by inputFileOpened(), and Write().

std::string cafe::Write::_destination [private]
 

Definition at line 75 of file Write.hpp.

Referenced by copy_file(), finish(), inputFileOpened(), and Write().

std::vector<std::string> cafe::Write::_disable [private]
 

Definition at line 68 of file Write.hpp.

Referenced by inputFileOpened(), and Write().

bool cafe::Write::_doMetaData [private]
 

Definition at line 91 of file Write.hpp.

Referenced by processEvent(), Write(), and writeMetaData().

TFile* cafe::Write::_file [private]
 

Definition at line 70 of file Write.hpp.

Referenced by check_file(), copy_file(), finish(), inputFileOpened(), and writeMetaData().

bool cafe::Write::_fileOwner [private]
 

Definition at line 74 of file Write.hpp.

Referenced by check_file(), finish(), inputFileOpened(), processEvent(), and writeMetaData().

unsigned int cafe::Write::_filesPerOutput [private]
 

Definition at line 76 of file Write.hpp.

Referenced by inputFileOpened(), and Write().

unsigned int cafe::Write::_filesPerOutputDone [private]
 

Definition at line 77 of file Write.hpp.

Referenced by inputFileOpened(), and Write().

int cafe::Write::_firstEvent [private]
 

Lowest event no.

Definition at line 98 of file Write.hpp.

Referenced by processEvent(), and writeMetaData().

TFile* cafe::Write::_input_file [private]
 

Definition at line 69 of file Write.hpp.

Referenced by inputFileOpened(), and processEvent().

int cafe::Write::_lastEvent [private]
 

Highest event no.

Definition at line 100 of file Write.hpp.

Referenced by processEvent(), and writeMetaData().

unsigned int cafe::Write::_maxBytesPerFile [private]
 

Definition at line 80 of file Write.hpp.

Referenced by processEvent(), and Write().

unsigned int cafe::Write::_maxEventsPerFile [private]
 

Definition at line 79 of file Write.hpp.

Referenced by processEvent(), and Write().

std::string cafe::Write::_oldFileName [private]
 

Definition at line 66 of file Write.hpp.

Referenced by check_file(), and inputFileOpened().

std::vector<std::string> cafe::Write::_parents [private]
 

List of parent files.

Definition at line 94 of file Write.hpp.

Referenced by inputFileOpened(), and writeMetaData().

FilePattern cafe::Write::_pattern [private]
 

Definition at line 72 of file Write.hpp.

Referenced by inputFileOpened(), and Write().

Long64_t cafe::Write::_rootMaxTreeSize [private]
 

Definition at line 78 of file Write.hpp.

Referenced by Write().

std::set<int> cafe::Write::_runs [private]
 

List of runs.

Definition at line 96 of file Write.hpp.

Referenced by processEvent(), and writeMetaData().

std::string cafe::Write::_samApplication [private]
 

SAM.Application:.

Definition at line 87 of file Write.hpp.

Referenced by Write(), and writeMetaData().

std::string cafe::Write::_samFamily [private]
 

SAM parameters SAM.Family:.

Definition at line 85 of file Write.hpp.

Referenced by Write(), and writeMetaData().

std::string cafe::Write::_samVersion [private]
 

SAM.Version:.

Definition at line 89 of file Write.hpp.

Referenced by Write(), and writeMetaData().

TTree* cafe::Write::_tree [private]
 

Definition at line 71 of file Write.hpp.

Referenced by check_file(), inputFileOpened(), processEvent(), updateBranch(), and writeMetaData().

std::string cafe::Write::_treeName [private]
 

Definition at line 65 of file Write.hpp.

Referenced by inputFileOpened(), and Write().

std::vector<std::string> cafe::Write::_updatedBranches [private]
 

List of top level branch names that need updating.

Definition at line 109 of file Write.hpp.

Referenced by inputFileOpened().

bool cafe::Write::_updateObjectVersion [private]
 

Should we re-write branches that contain new versions of objects.

Definition at line 106 of file Write.hpp.

Referenced by inputFileOpened(), and Write().

Variables cafe::Write::_vars [private]
 

To read event number and run.

Definition at line 103 of file Write.hpp.

Referenced by processEvent().


The documentation for this class was generated from the following files:
Generated on Thu Apr 3 04:14:28 2008 for CAF by doxygen 1.3.4