]>
Commit | Line | Data |
---|---|---|
88f843f1 | 1 | #ifndef ALITRIGDEVICE_H |
2 | #define ALITRIGDEVICE_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | /* $Id$ */ | |
7 | // Author: Andrei Gheata, 27/07/2009 | |
8 | ||
9 | //============================================================================== | |
10 | // AliTrigDevice - Base class for a generic device. | |
11 | //============================================================================== | |
12 | ||
13 | #ifndef ROOT_TNamed | |
14 | #include "TNamed.h" | |
15 | #endif | |
16 | ||
79e35bac | 17 | class AliTrigEvent; |
88f843f1 | 18 | class AliTrigScheduler; |
79e35bac | 19 | class AliTrigScheduledResponse; |
88f843f1 | 20 | |
21 | class AliTrigDevice : public TNamed { | |
22 | ||
79e35bac | 23 | private: |
88f843f1 | 24 | AliTrigDevice(const AliTrigDevice &other); |
88f843f1 | 25 | AliTrigDevice &operator=(const AliTrigDevice &other); |
26 | ||
79e35bac | 27 | public: |
28 | AliTrigDevice(); | |
29 | AliTrigDevice(const char *name, Int_t ninputs, Int_t noutputs); | |
30 | virtual ~AliTrigDevice(); | |
31 | ||
88f843f1 | 32 | virtual void AddDevice(AliTrigDevice *other); |
33 | Int_t GetNcomponents() const; | |
34 | AliTrigDevice *GetComponent(Int_t n); | |
79e35bac | 35 | AliTrigScheduledResponse *GetResponseFunction(const char *name); |
36 | AliTrigScheduler *GetScheduler() const {return fScheduler;} | |
37 | ||
38 | //____________________________________________________________________________ | |
39 | // Device creation method to be implemented by derived classes. The response | |
40 | // functions are registered here. Connections between component devices should | |
41 | // also be handled in this method. | |
42 | virtual Bool_t CreateDevice() {return kTRUE;} | |
88f843f1 | 43 | //____________________________________________________________________________ |
44 | // Connectivity to other devices. The method will create a connector between | |
45 | // an output of this device to one input of the other. | |
79e35bac | 46 | virtual Bool_t Connect(Int_t /*output*/, AliTrigDevice */*other*/, Int_t /*at_input*/) {return kTRUE;} |
88f843f1 | 47 | |
48 | //____________________________________________________________________________ | |
79e35bac | 49 | // Response functions to be implemented by specific devices. Has to propagate |
88f843f1 | 50 | // the response to all connected devices. Representing the output #n of the device. |
79e35bac | 51 | virtual Bool_t Response(Int_t output = 0) = 0; |
88f843f1 | 52 | |
53 | //____________________________________________________________________________ | |
79e35bac | 54 | // Create the response functions of the device. |
88f843f1 | 55 | // The delay argument is in arbitrary time units with respect to the startup |
79e35bac | 56 | // reference. Note that the created scheduled entry must be registered to the |
57 | // device scheduler via: fDevice->AddScheduledEntry() method | |
58 | AliTrigScheduledResponse *RegisterResponseFunction(const char *name, Int_t output, Int_t delay); | |
88f843f1 | 59 | |
60 | //____________________________________________________________________________ | |
61 | // Setting the value for a given input for digital devices of general ones | |
62 | // that are handling generic signals. | |
79e35bac | 63 | virtual const char *GetOutputType(Int_t /*output*/) {return 0;} |
64 | virtual Bool_t SetInputType(Int_t input, const char *classname) = 0; | |
65 | virtual Bool_t SetInputValue(Int_t input, Bool_t value) = 0; | |
66 | virtual Bool_t SetInputValue(Int_t input, AliTrigEvent *event) = 0; | |
88f843f1 | 67 | |
68 | //____________________________________________________________________________ | |
69 | // Device-dependent inputs reset method | |
70 | virtual void ResetInputs() = 0; | |
71 | ||
90719948 | 72 | void SetNinputs(Int_t ninputs) {fNinputs = ninputs;} |
73 | void SetNoutputs(Int_t noutputs) {fNoutputs = noutputs;} | |
74 | Int_t GetNinputs() const {return fNinputs;} | |
75 | Int_t GetNoutputs() const {return fNoutputs;} | |
88f843f1 | 76 | |
77 | protected: | |
90719948 | 78 | Int_t fNinputs; // Number of inputs |
79 | Int_t fNoutputs; // Number of outputs | |
79e35bac | 80 | AliTrigScheduler *fScheduler; // Device scheduler |
81 | TObjArray *fComponents; // Component devices | |
82 | TObjArray *fResponseFunctions; // List of response functions | |
88f843f1 | 83 | |
84 | ClassDef(AliTrigDevice,1) // Base class for trigger devices | |
85 | }; | |
86 | #endif |