-
Notifications
You must be signed in to change notification settings - Fork 0
/
Detector.h
57 lines (44 loc) · 1.7 KB
/
Detector.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Simple detector base class
#ifndef PPODD_DETECTOR
#define PPODD_DETECTOR
#include "Podd.h"
#include <string>
#include <vector>
#include <memory>
class Decoder;
class Detector {
public:
Detector( std::string name, int imod );
virtual ~Detector() = default;
virtual void Clear();
[[nodiscard]] virtual std::unique_ptr<Detector> Clone() const = 0;
virtual int Init( bool shared );
virtual int Decode( Decoder& evdata );
virtual int Analyze() = 0;
virtual void Print() const;
void SetVarList( std::shared_ptr<varlst_t> lst ) { fVars = std::move(lst); }
[[nodiscard]] const std::string& GetName() const { return name; }
[[nodiscard]] const std::string& GetType() const { return type; }
protected:
std::string name; // Name
std::string type; // Type (for identifying subclass)
int imod; // Module number (for decoding)
std::vector<double> data; // Raw data
// Pointer to list of all analysis variables. The list is held in the
// Context that also holds this detector (see Context.h). Each detector
// adds its particular variables to this list in the call to
// DefineVariables at Init time.
std::shared_ptr<varlst_t> fVars;
// Define global variables holding analysis results.
// Returns the number of variables defined.
// If 'remove' is true, remove any existing variables.
//
// These "global" variables are always thread-specific, never shared,
// since they hold results for the event associated with the thread.
// To be implemented by derived classes.
virtual int DefineVariables( bool remove );
// Read database for this detector.
// If 'shared' is true, sets parameters shared among threads.
virtual int ReadDatabase( bool shared );
};
#endif