next up previous contents
Next: Module Parameter Setting Up: Using Phat 5.0 Previous: TPhEvent and TPhObjectManager   Contents

Modules, Supermodules and Context

As mentioned above, as a general rule, the storage and handling of data and the algorithms themselves are separated. One of the most important changes in PhAT V5.0 was to formalize the basic design of the algorithmic classes by introducing the TPhModule class. All analysis classes are supposed to inherit from TPhModule. The common interface of all modules are five member functions that are called upon initialization, start of a new run, for each event, at the end of a run and at the end of the analysis.

 virtual EReturnCode StartAnalysis();
 virtual EReturnCode StartRun();
 virtual EReturnCode Process(TPhEvent*);
 virtual EReturnCode EndRun();
 virtual EReturnCode EndAnalysis();
In general, not all of these functions have to be implemented by all modules.

TPhModule provides a default constructor for compatibility with the ROOT system - this should not be used to create a module in user code. Instead, the standard way to instantiate a module is the following constructor:


TPhModule(const Text_t* name, const Text_t* title, 
TPhModuleContext* context);
This provides a name and a title to the module, allowing them to be stored in a ROOT database or within the hash list of a supermodule (see below). As a convention the 'title' of the module is set automatically to the module class name, with the 'name' characterizing the specific instance. In a user macro, the creation of a module typically looks like this:

    TPhVertexFinderMod *VertexFinder = new
            TPhVertexFinderMod("MyVertexFinder",context);
Besides creating a vertex finding module named MyVertexFinder this constructor also provides the module with a pointer to a TPhModuleContext object (see below).



Subsections
next up previous contents
Next: Module Parameter Setting Up: Using Phat 5.0 Previous: TPhEvent and TPhObjectManager   Contents
Gunther Roland
2000-05-05