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