]>
Commit | Line | Data |
---|---|---|
88f843f1 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | // Author: Andrei Gheata, 28/07/2009 | |
18 | ||
19 | //============================================================================== | |
20 | // AliTrigDigitalCircuit - Device that has N Boolean inputs and one Boolean | |
21 | // output. This is a base class and derived digital circuits must implement the | |
22 | // response function Trigger() | |
23 | //============================================================================== | |
24 | ||
25 | #include "AliTrigDigitalCircuit.h" | |
26 | ||
27 | ClassImp(AliTrigDigitalCircuit) | |
28 | ||
29 | //______________________________________________________________________________ | |
30 | AliTrigDigitalCircuit::AliTrigDigitalCircuit(const AliTrigDigitalCircuit &other) | |
31 | :AliTrigDevice(other), | |
32 | fLastOutput(other.fLastOutput), | |
33 | fConnector(0), | |
34 | fInputs(other.fInputs) | |
35 | { | |
36 | // Copy ctor. | |
37 | if (other.fConnector) fConnector = new AliTrigConnector(*other.fConnector); | |
38 | } | |
39 | ||
40 | //______________________________________________________________________________ | |
41 | AliTrigDigitalCircuit::~AliTrigDigitalCircuit() | |
42 | { | |
43 | // Destructor | |
44 | if (fConnector) delete fConnector; | |
45 | } | |
46 | ||
47 | //______________________________________________________________________________ | |
48 | AliTrigDigitalCircuit& AliTrigDigitalCircuit::operator=(const AliTrigDigitalCircuit &other) | |
49 | { | |
50 | // Assignment | |
51 | if (&other == this) return *this; | |
52 | AliTrigDevice::operator=(other); | |
53 | fLastOutput = other.fLastOutput; | |
54 | if (other.fConnector) fConnector = new AliTrigConnector(*other.fConnector); | |
55 | else fConnector = 0; | |
56 | fInputs = other.fInputs; | |
57 | return *this; | |
58 | } | |
59 | ||
60 | //______________________________________________________________________________ | |
61 | Bool_t AliTrigDigitalCircuit::Connect(UInt_t output, AliTrigDevice *other, UInt_t at_input) | |
62 | { | |
63 | // Connect to an input of another device. | |
64 | if (!fConnector) fConnector = new AliTrigConnector(this, 0); | |
65 | fConnector->Connect(other, at_input); | |
66 | } | |
67 | ||
68 | //______________________________________________________________________________ | |
69 | Bool_t AliTrigDigitalCircuit::Response(UInt_t /*output*/) | |
70 | { | |
71 | // Response function of the digital circuit. Calling user-defined one. | |
72 | fLastOutput = CircuitResponse(); | |
73 | if (fConnector) fConnector->Transmit(fLastOutput); | |
74 | return fLastOutput; | |
75 | } |