1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 // Author: Andrei Gheata, 28/07/2009
19 //==============================================================================
20 // AliTrigEvent - Base class for generic information exchanged by a trigger
21 // device. Trigger inputs and outputs are represented and
22 // handled via AliTrigEvent objects. Trigger events are typically
23 // wrappers for the information exchanged on a single I/O slot
24 // or a group of correlated inputs.
25 //==============================================================================
27 #include "AliTrigEvent.h"
34 ClassImp(AliTrigEvent)
36 //______________________________________________________________________________
37 AliTrigEvent::Activate()
39 // Activate/deactivate this signal.
40 TObject::SetBit(kActive, flag);
43 ClassImp(AliTrigEventWithMask)
45 //______________________________________________________________________________
46 Bool_t AliTrigEventWithMask::ImportData(AliTrigEvent *source)
48 // Import data from likewise signal.
49 AliTrigEventWithMask *src = (AliTrigEventWithMask *)source;
50 fValue = src->GetValue();
54 ClassImp(AliTrigEventWithObject)
56 //______________________________________________________________________________
57 AliTrigEventWithObject::AliTrigEventWithObject(const char *classname)
62 // Normal constructor where a class name is provided for the embedded object.
63 // If the event is created in this way one will only be able to connect to
64 // events embedding the same object type (via connectors). Otherwise the type
65 // will be set upon the first call of SetValue.
66 fType = gROOT->GetClass(classname);
67 if (!fType) Error("ctor", "No class named <%s> available.", classname);
70 //______________________________________________________________________________
71 AliTrigEventWithObject::AliTrigEventWithObject(const AliTrigEventWithObject &other)
79 //______________________________________________________________________________
80 AliTrigEventWithObject::operator=(const AliTrigEventWithObject &other)
82 // Assignment operator.
83 if (&other == this) return *this;
84 AliTrigEvent::operator=(other);
85 fValue = other.fValue;
89 //______________________________________________________________________________
90 Bool_t AliTrigEventWithObject::ImportData(AliTrigEvent *source)
92 // Import data from likewise signal.
93 AliTrigEventWithObject *src = (AliTrigEventWithObject *)source;
94 Bool_t done = SetValue(src->GetValue());
95 if (!done) Error("ImportData", "Cannot import object <%s> of class <%s> since event type was set to: <%s>",
96 src->GetValue()->GetName(), src->GetValue()->ClassName(), fType->GetName());
100 //______________________________________________________________________________
101 Bool_t AliTrigEventWithObject::SetType(const char *classname)
103 // Set the type of this event. Can be done only once.
104 TClass *type = gROOT->GetClass(classname);
106 Error("SetType", "Unknown class %s", classname);
109 if (!fType) fType = type;
111 Error("SetType", "Type %s not matching the one defined for this event <%s>",
112 classname, fType->GetName());
118 //______________________________________________________________________________
119 Bool_t AliTrigEventWithObject::SetValue(TObject *value)
121 // Set the current event content. Checks consistency with event type.
123 // Reset current value.
127 TClass *type = value->IsA();
128 // Set the type if used for the first time.
129 if (!fType) fType = type;
130 // Check consistency of the value with event type.
131 if (type != fType) return kFALSE;