]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRIGGER/AliTrigDevice.h
Some of the trigger base classes. Steering part not yet in.
[u/mrichter/AliRoot.git] / TRIGGER / AliTrigDevice.h
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
17 class AliTrigScheduler;
18
19 class AliTrigDevice : public TNamed {
20
21 public:
22   AliTrigDevice() : TNamed(), fNinputs(0), fNoutputs(0) {}
23   AliTrigDevice(const char *name, UInt_t ninputs, UInt_t noutputs) 
24               : TNamed(name,""), fNinputs(ninputs), fNoutputs(noutputs) {}
25   AliTrigDevice(const AliTrigDevice &other);
26   virtual ~AliTrigDevice();
27   AliTrigDevice &operator=(const AliTrigDevice &other);
28
29   virtual void              AddDevice(AliTrigDevice *other);
30   Int_t                     GetNcomponents() const;
31   AliTrigDevice            *GetComponent(Int_t n);
32   //____________________________________________________________________________
33   // Connectivity to other devices. The method will create a connector between
34   // an output of this device to one input of the other.
35   virtual Bool_t            Connect(UInt_t output, AliTrigDevice *other, UInt_t at_input) = 0;
36
37   //____________________________________________________________________________
38   // Response functions to be overloaded by specific devices. Has to propagate
39   // the response to all connected devices. Representing the output #n of the device.
40   virtual Bool_t            Response(UInt_t output = 0) = 0;
41
42   //____________________________________________________________________________
43   // Register the response functions to be replayed by the global scheduler.
44   // The delay argument is in arbitrary time units with respect to the startup
45   // reference.
46   Bool_t                    RegisterResponseFunction(AliTrigScheduler *calendar, UInt_t output, Int_t delay, Int_t group) const;
47
48   //____________________________________________________________________________
49   // Setting the value for a given input for digital devices of general ones
50   // that are handling generic signals.
51   virtual const char       *GetOutputType(UInt_t output) {return 0;}
52   virtual Bool_t            SetInputType(UInt_t input, const char *classname) = 0;
53   virtual Bool_t            SetInputValue(UInt_t input, Bool_t value) = 0;
54   virtual Bool_t            SetInputValue(UInt_t input, AliTrigSignal *signal) = 0;
55
56   //____________________________________________________________________________
57   // Device-dependent inputs reset method
58   virtual void              ResetInputs() = 0;
59
60   UInt_t                    GetNinputs() const {return fNinputs;}
61   UInt_t                    GetNoutputs() const {return fNoutputs;}
62    
63 protected:
64   UInt_t                    fNinputs;  // Number of inputs.
65   UInt_t                    fNoutputs; // Number of outputs.
66   TObjArray                *fComponents; // Component devices if any
67    
68   ClassDef(AliTrigDevice,1)  // Base class for trigger devices
69 };
70 #endif