| 1 |
/** @file |
| 2 |
* $Source: /home/cvsmanager/yoda/event/Algorithm.h,v $ |
| 3 |
* $Id: Algorithm.h,v 4.4 2005/05/28 10:44:08 kusanagi Exp $ |
| 4 |
* $Author: kusanagi $ |
| 5 |
* |
| 6 |
* Header file for the Algorithm class. |
| 7 |
*/ |
| 8 |
#ifndef ALGORITHM_H |
| 9 |
#define ALGORITHM_H |
| 10 |
|
| 11 |
#include <string> |
| 12 |
#include <map> |
| 13 |
#include <list> |
| 14 |
#include <TObject.h> //Substituted by Maurizio 05 Feb 2004 |
| 15 |
#include "event/PamelaRun.h" |
| 16 |
|
| 17 |
|
| 18 |
namespace pamela { |
| 19 |
class PamelaRun; |
| 20 |
|
| 21 |
/** |
| 22 |
* Abstract base class for all processing algorithms. You need to deviate |
| 23 |
* from this class and overwrite the functions Init(), RunEvent() and |
| 24 |
* Finish(), if necessary. For logging purposes, you also need to write |
| 25 |
* the functions GetName() and GetVersionInfo(). |
| 26 |
*/ |
| 27 |
class Algorithm: public TObject { |
| 28 |
protected: |
| 29 |
/** |
| 30 |
* The packet type of the events processed by this algorithm. |
| 31 |
*/ |
| 32 |
const pamela::PacketType *type; //! |
| 33 |
/** |
| 34 |
* The name of the algorithm. |
| 35 |
*/ |
| 36 |
std::string AlgorithmName; |
| 37 |
public: |
| 38 |
|
| 39 |
Algorithm(const pamela::PacketType*, std::string); |
| 40 |
/** |
| 41 |
* Get the name of the algorithm. |
| 42 |
*/ |
| 43 |
std::string GetAlgorithmName(void) const { return AlgorithmName; } |
| 44 |
/** |
| 45 |
* Get a string with the version info of the algorithm. |
| 46 |
* Must be overwritten. |
| 47 |
*/ |
| 48 |
virtual std::string GetVersionInfo(void) const = 0; |
| 49 |
/** |
| 50 |
* Get the type this algorithm is used for. |
| 51 |
*/ |
| 52 |
const pamela::PacketType *GetPacketType(void) const { return type; } |
| 53 |
/** |
| 54 |
* Initialize the algorithm with a special run. Default: Do nothing. |
| 55 |
*/ |
| 56 |
virtual void Init(pamela::PamelaRun *) { } |
| 57 |
/** |
| 58 |
* Run the algorithm with a certain event. Default: Do nothing. |
| 59 |
*/ |
| 60 |
virtual void RunEvent(int) { } |
| 61 |
/** |
| 62 |
* Finish up the algorithm. Default: Do nothing. |
| 63 |
*/ |
| 64 |
virtual void Finish(void) { } |
| 65 |
ClassDef(Algorithm, 1) |
| 66 |
}; |
| 67 |
|
| 68 |
/** |
| 69 |
* A minimal algorithm that does nothing. |
| 70 |
*/ |
| 71 |
class NullAlgorithm: public pamela::Algorithm { |
| 72 |
public: |
| 73 |
NullAlgorithm(const pamela::PacketType *); |
| 74 |
virtual std::string GetVersionInfo(void) const = 0; |
| 75 |
ClassDef(NullAlgorithm, 1) |
| 76 |
}; |
| 77 |
|
| 78 |
} |
| 79 |
|
| 80 |
#endif /* ALGORITHM_H */ |