]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - TRIGGER/AliTrigDevice.h
Momentum smearing added
[u/mrichter/AliRoot.git] / TRIGGER / AliTrigDevice.h
... / ...
CommitLineData
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
17class AliTrigEvent;
18class AliTrigScheduler;
19class AliTrigScheduledResponse;
20
21class AliTrigDevice : public TNamed {
22
23private:
24 AliTrigDevice(const AliTrigDevice &other);
25 AliTrigDevice &operator=(const AliTrigDevice &other);
26
27public:
28 AliTrigDevice();
29 AliTrigDevice(const char *name, Int_t ninputs, Int_t noutputs);
30 virtual ~AliTrigDevice();
31
32 virtual void AddDevice(AliTrigDevice *other);
33 Int_t GetNcomponents() const;
34 AliTrigDevice *GetComponent(Int_t n);
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;}
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.
46 virtual Bool_t Connect(Int_t /*output*/, AliTrigDevice */*other*/, Int_t /*at_input*/) {return kTRUE;}
47
48 //____________________________________________________________________________
49 // Response functions to be implemented by specific devices. Has to propagate
50 // the response to all connected devices. Representing the output #n of the device.
51 virtual Bool_t Response(Int_t output = 0) = 0;
52
53 //____________________________________________________________________________
54 // Create the response functions of the device.
55 // The delay argument is in arbitrary time units with respect to the startup
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);
59
60 //____________________________________________________________________________
61 // Setting the value for a given input for digital devices of general ones
62 // that are handling generic signals.
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;
67
68 //____________________________________________________________________________
69 // Device-dependent inputs reset method
70 virtual void ResetInputs() = 0;
71
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;}
76
77protected:
78 Int_t fNinputs; // Number of inputs
79 Int_t fNoutputs; // Number of outputs
80 AliTrigScheduler *fScheduler; // Device scheduler
81 TObjArray *fComponents; // Component devices
82 TObjArray *fResponseFunctions; // List of response functions
83
84 ClassDef(AliTrigDevice,1) // Base class for trigger devices
85};
86#endif