Some of the trigger base classes. Steering part not yet in.
[u/mrichter/AliRoot.git] / TRIGGER / AliTrigDigitalCircuit.h
CommitLineData
88f843f1 1#ifndef ALITRIGDIGITALCIRCUIT_H
2#define ALITRIGDIGITALCIRCUIT_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// AliTrigDigitalCircuit - Base class for digital circuits having N Boolean
11// inputs and one Boolean output. Derived classes must implement the pure
12// virtual method Trigger() that will return the Boolean response
13// of the circuit as function of the inputs.
14//==============================================================================
15
16#ifndef ALITRIGDEVICE_H
17#include "AliTrigDevice.h"
18#endif
19
20#ifndef ROOT_TBits
21#include "TBits.h"
22#endif
23
24class AliTrigEvent;
25class AliTrigConnector;
26
27class AliTrigDigitalCircuit : public AliTrigDevice {
28
29public:
30 AliTrigDigitalCircuit() : AliTrigDevice(), fLastOutput(kFALSE), fConnector(0), fInputs() {}
31 AliTrigDigitalCircuit(const char *name, UInt_t ninputs) : AliTrigDevice(name, ninputs, 1), fLastOutput(kFALSE), fConnector(0), fInputs(ninputs) {}
32 AliTrigDigitalCircuit(const AliTrigDigitalCircuit &other);
33 virtual ~AliTrigDigitalCircuit() {}
34 AliTrigDigitalCircuit &operator=(const AliTrigDigitalCircuit &other);
35
36 virtual Bool_t Connect(UInt_t output, AliTrigDevice *other, UInt_t at_input);
37 virtual Bool_t Response(UInt_t output);
38 // Get/Set inputs
39 Bool_t GetInputValue(UInt_t input) const {return fInputs.TestBitNumber(input);}
40 virtual void ResetInputs() {fInputs.ResetAllBits();}
41 virtual void SetInputValue(UInt_t input, Bool_t value) {fInputs.SetBitNumber(input,value);}
42 virtual void SetInputValue(UInt_t input, AliTrigEvent *signal) {};
43private:
44 // Circuit response function.
45 virtual Bool_t Trigger() = 0;
46
47protected:
48 Bool_t fLastOutput; // Output recorded after the last Response() call.
49 AliTrigConnector *fConnector; // Connector for the circuit output
50 TBits fInputs;
51
52 ClassDef(AliTrigDigitalCircuit,1) // Base class for digital circuits
53};
54#endif