class HSUExeMacro: public TObject

 A class to make live easier with chains and branches in an executive macro.
 It is dedicated for making complicate correlation between branches.

 It supports:
 - TChain with files consists of HADES 'T' Tree
 - automatic access to branches' data by HCategory or TClonesArray
 - easy access to program arguments
 - easy access to parameters in a parameter files

 A simple program which shows possibility may looks like:

 Int_t main(Int_t iArg, Char_t* vArg[])
 {
 HSUExeMacro eEM;

     eEM.loadArgs(iArg, vArg);
     eEM.openInput();
     eEM.openParamFile();
     eEM.openOutput();

 HCategory *pMdcCategory;
 TCutG     *pCut = NULL;
 HMdcSeg   *pSeg;

     if(eEM.getOptBool())
         pCut = (TCutG *)eEM.getParamObject("some_cut");

     pMdcCategory = eEM.getHCategory("HMdcSeg");

     while(eEM.nextEvent() >= 0)
     {
         for(i = 0; i < pMdcCategory->getEntries(); i++)
         {
             if((pSeg = (HMdcSeg * )pMdcCategory->getObject(i)) == NULL)
                 continue;


         }
     }

     eEM.writeOutput();

     return 0;
 }

 Arguments of the program supported by the class:
 -i file_name - (may appear many times) define a list of input files.
                If the file is *.root it is added to the chain.
                Otherwise it is taken as a text file with a list of root files
                all empty lines and lines starting with # are skipped
 -o file_name - a name of an output file
 -e number    - maximum number of events to process
 -p file_name - a name of an optional file with some object for the program;
                they are easy to get by getParamObject() method
 -h           - prints a help message

 Other program arguments which may be used by the program:
 -s string    - string can be get by getOptString() method
 -n Int_t       - can be get by getOptInt()
 -f Float_t     - can be get by getOptFloat()
 -b           - existence of the parameter can be get by getOptBool()


Function Members (Methods)

public:
HSUExeMacro()
HSUExeMacro(const HSUExeMacro&)
virtual~HSUExeMacro()
voidTObject::AbstractMethod(const char* method) const
Bool_taddFilesFromList(const Char_t* pStr)
Bool_taddInputFile(const Char_t* pStr)
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
Bool_tcheckBranches()
static TClass*Class()
virtual const char*TObject::ClassName() const
voidclear()
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
voiddeleteProgress()
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
TBranch*getBranch(const Char_t* pBranchName)
voidgetBranchesEntry(Int_t iEntry)
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
Int_tgetEvent() const
Int_tgetEvent(Int_t iEvent)
Int_tgetEvents() const
Bool_tgetExitOnError() const
HCategory*getHCategory(const Char_t* pCategoryName)
virtual const char*TObject::GetIconName() const
Float_tgetMdcPhi(Int_t iSector, Float_t fPhiMdc) const
Float_tgetMdcTheta(Float_t fThetaMdc) const
virtual const char*TObject::GetName() const
Bool_tgetNotFileChange()
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
Bool_tgetOptBool() const
Float_tgetOptFloat() const
Int_tgetOptInt() const
virtual Option_t*TObject::GetOption() const
const TString&getOptString() const
const TString&getParamFileName() const
TObject*getParamObject(const Char_t* pName)
HSUProgress*getProgress() const
TClonesArray*getTClonesArray(const Char_t* pBranchName)
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
Bool_tisParamFileOpened() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual Int_tloadArgs(Int_t iArg, Char_t** vArg)
Int_tloadTree(Int_t iEvent)
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
Int_tnextEvent()
virtual Bool_tTObject::Notify()
Bool_topenInput()
Bool_topenOutput()
Bool_topenParamFile(const Char_t* pParamFileName = 0)
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
HSUExeMacro&operator=(const HSUExeMacro&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
virtual voidprintInfo(const Char_t* pProgramName) const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
voidsetExitOnError(Bool_t b = kTRUE)
voidsetNotFileChange(Bool_t b)
static voidTObject::SetObjectStat(Bool_t stat)
voidsetProgress(HSUProgress* pProgress)
voidsetProgress(Bool_t bSet = kTRUE)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
Bool_twriteOutput()
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
private:
HSUBranchElement*findAciveBranch(const Char_t* pBranchName)
TClonesArray*getNewArrayFromBranch(const Char_t* pBranchName)
HCategory*getNewHCategoryFromBranch(const Char_t* pBranchName)
Bool_tnotifyBranches()

Data Members

public:
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
Bool_tm_bExitOnErrorif exit on any error
Bool_tm_bNotFileChangenotify when the file changes
Bool_tm_bOptBoolboolean from parameters
Float_tm_fOptFloatFloat_t from parameters
Int_tm_iCurrentFilecurrent file in the chain
Int_tm_iEventcurrent event
Int_tm_iEventsmax number of events
Int_tm_iOptIntInt_t from parameters
TObjArray*m_pActiveBranchesarray with active branches
TChain*m_pChainchain of input files
TObjArray*m_pInputArraylist of input files
TFile*m_pOutputFileoutput file
TFile*m_pParamFilefile with parameters
HSUProgress*m_pProgressprogress bar
TStringm_sOptStringstring from parameters
TStringm_sOutputNamename of the output file
TStringm_sParamFileNamename of a file with parameters

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

HSUExeMacro(const HSUExeMacro& )
 A constructor of the class
~HSUExeMacro()
 Destructor.
 Close all input and output files opened by the class and delete what was used
void setProgress(HSUProgress *pProgress)
 Set a progress bar used by the class during the events loop
void setProgress(Bool_t bSet)
 Set a default progress bar used by the class during the events loop.
 If bSet == kFALSE - removes the progress bar
HSUProgress* getProgress(void)
 Return the progress bar used by the class
void deleteProgress(void)
 Delete the progress bar used by the class
Int_t loadArgs(Int_t iArg, Char_t** vArg)
 Load all arguments from the program arguments given as the parameters.
 All parameters supported by the class are listed in the class description.
void printInfo(const Char_t* pProgramName) const
 Print info about all standard options. Used when `-h' is in the arguments.
Bool_t openInput(void)
 Create the chain from all files given as the arguments of the program
Bool_t addInputFile(const Char_t* pStr)
 Add a root file to the chain
Bool_t addFilesFromList(const Char_t* pStr)
 Add all root files listed in a text file given as the argument.
 All empty lines or lines starting with `#' are skipped.
 File names are trimmed before use
 (all start and tail white characters are removed)
Bool_t openOutput(void)
 Open the output file
Bool_t writeOutput(void)
 Simple close the output file. All root objects created since the openOutput
 are written to the file
TClonesArray* getTClonesArray(const Char_t* pBranchName)
 Get the TClonesArray from the file.
 To get a proper branch a `.fData' suffix is added to `pBranchName'
HCategory* getHCategory(const Char_t* pCategoryName)
 Get the HCategory from the file.
 To get a proper branch a `.' suffix is added to `pCategoryName'
TBranch* getBranch(const Char_t* pBranchName)
 Get the brach from the `T'
 if was activated by getHCategory or getTClonesArray
TClonesArray* getNewArrayFromBranch(const Char_t* pBranchName)
 Create new branch and a TClonesArray for it
HCategory* getNewHCategoryFromBranch(const Char_t* pBranchName)
 Create new branch and a HCategory for it
HSUBranchElement* findAciveBranch(const Char_t* pBranchName)
 Find an active branch by name
Int_t loadTree(Int_t iEvent)
 Load the event from tree.
 All active categories and array are filled with the new data.
 If switch of the files is needed then new branches are created automatically.
Bool_t notifyBranches(void)
 Get branches from a new file in the chain.
 Called by loadTree if needed
void clear(void)
 Clear all arrays and categories before next event
void getBranchesEntry(Int_t iEntry)
 Fill the array or category with the data of the current event
Int_t getEvent(Int_t iEvent)
 Get all data for the event.
 If no events left return value < 0
Bool_t checkBranches(void)
 Check if all activated branches exist in the every file in the chain
Int_t nextEvent(void)
 Get next event
 Return >= 0 if ok, or < 0 when at the end of the events list
Bool_t openParamFile(const Char_t* pParamFileName = 0)
 Open a file with parameters. The parameters from the file may be get by:
 HSUExeMacro::getParamObject method
TObject* getParamObject(const Char_t* pName)
 Get an object from the parameter file (if opened)
const TString& getParamFileName(void)
 Return param file name or empty string if the name not set
Float_t getMdcPhi(Int_t iSector, Float_t fPhiMdc) const
 Convert MDC's phi angle to the coordinate system used in other detectors
Float_t getMdcTheta(Float_t fThetaMdc) const
 Convert MDC's theta angle to the coordinate system used in other detectors
HSUExeMacro()
Int_t getEvent(Int_t iEvent)
Bool_t getExitOnError(void)
{ return m_bExitOnError; }
void setExitOnError(Bool_t b = kTRUE)
{ m_bExitOnError = b; }
Bool_t isParamFileOpened(void)
{ return m_pParamFile != NULL; }
const TString& getOptString(void)
{ return m_sOptString; }
Int_t getOptInt(void)
{ return m_iOptInt; }
Float_t getOptFloat(void)
{ return m_fOptFloat; }
Bool_t getOptBool(void)
{ return m_bOptBool; }
Int_t getEvents(void)
{ return m_iEvents; }
Bool_t getNotFileChange(void)
{ return m_bNotFileChange; }
void setNotFileChange(Bool_t b)
{ m_bNotFileChange = b; }

Last change: Sat May 22 13:12:53 2010
Last generated: 2010-05-22 13:12

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.