Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

Formula.cpp

Go to the documentation of this file.
00001 
00002 
00003 #include "cafe/Formula.hpp"
00004 #include "cafe/Processor.hpp"
00005 #include "TTreeFormula.h"
00006 #include "TFile.h"
00007 
00008 #include <iostream>
00009 
00010 namespace cafe {
00011 
00012     Formula::Formula(cafe::Processor *owner)
00013         : _owner(owner),
00014           _formula(0)
00015     {}
00016 
00017     Formula::~Formula()
00018     {
00019         delete _formula;
00020     }
00021 
00022     void Formula::inputFileOpened(TFile *file)
00023     {
00024         if(_formula == 0) {
00025             // first time
00026             _formula = new TTreeFormula(_owner->name().c_str(), _expr.c_str(), (TTree *)file->Get("TMBTree"));
00027         } else {
00028             _formula->SetTree((TTree *)file->Get("TMBTree"));
00029             _formula->UpdateFormulaLeaves();
00030         }
00031     }
00032 
00033     void Formula::setFormula(const std::string& formula)
00034     {
00035         _expr = formula;
00036     }
00037 
00038     TTreeFormula *Formula::getFormula()
00039     {
00040         return _formula;
00041     }
00042 
00043 }
00044 
00045 ClassImp(cafe::Formula)

Generated on Tue Mar 28 10:13:04 2006 for CAF by doxygen 1.3.4