/[PAMELA software]/chewbacca/event/Algorithm.h
ViewVC logotype

Annotation of /chewbacca/event/Algorithm.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Fri Jul 24 13:53:48 2009 UTC (15 years, 4 months ago) by mocchiut
Branch: MAIN
CVS Tags: v10RED, v9r00, v9r01, HEAD
Changes since 1.1: +5 -4 lines
File MIME type: text/plain
Runtime error with ROOT 5.24 fixed, many small changes and warnings fixing

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

  ViewVC Help
Powered by ViewVC 1.1.23