1 |
/** @file |
2 |
* $Source: /home/cvspamela/yoda/event/Algorithm.h,v $ |
3 |
* $Id: Algorithm.h,v 1.6 2004/03/16 10:18:28 nagni Exp $ |
4 |
* $Author: nagni $ |
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 <root/TObject.h> |
15 |
#include <TObject.h> //Substituted by Maurizio 05 Feb 2004 |
16 |
#include "event/PamelaRun.h" |
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 |
Algorithm(const pamela::PacketType*, std::string); |
39 |
/** |
40 |
* Get the name of the algorithm. |
41 |
*/ |
42 |
std::string GetAlgorithmName(void) const { return AlgorithmName; } |
43 |
/** |
44 |
* Get a string with the version info of the algorithm. |
45 |
* Must be overwritten. |
46 |
*/ |
47 |
virtual std::string GetVersionInfo(void) const = 0; |
48 |
/** |
49 |
* Get the type this algorithm is used for. |
50 |
*/ |
51 |
const pamela::PacketType *GetPacketType(void) const { return type; } |
52 |
/** |
53 |
* Initialize the algorithm with a special run. Default: Do nothing. |
54 |
*/ |
55 |
virtual void Init(pamela::PamelaRun *) { } |
56 |
/** |
57 |
* Run the algorithm with a certain event. Default: Do nothing. |
58 |
*/ |
59 |
virtual void RunEvent(int) { } |
60 |
/** |
61 |
* Finish up the algorithm. Default: Do nothing. |
62 |
*/ |
63 |
virtual void Finish(void) { } |
64 |
ClassDef(Algorithm, 1) |
65 |
}; |
66 |
|
67 |
/** |
68 |
* A minimal algorithm that does nothing. |
69 |
*/ |
70 |
class NullAlgorithm: public pamela::Algorithm { |
71 |
public: |
72 |
NullAlgorithm(const pamela::PacketType *); |
73 |
virtual std::string GetVersionInfo(void) const = 0; |
74 |
ClassDef(NullAlgorithm, 1) |
75 |
}; |
76 |
|
77 |
} |
78 |
|
79 |
#endif /* ALGORITHM_H */ |