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 #include "AliTrigEvent.h"
25 ClassImp(AliTrigEvent)
27 //==============================================================================
28 // AliTrigEvent - Base class for generic information exchanged by a trigger
29 // device. Trigger inputs and outputs are represented and
30 // handled via AliTrigEvent objects. Trigger events are typically
31 // wrappers for the information exchanged on a single I/O slot
32 // or a group of correlated inputs.
33 //==============================================================================
35 //______________________________________________________________________________
36 AliTrigEvent &AliTrigEvent::operator=(const AliTrigEvent &other)
38 // Assignment operator.
39 if (&other == this) return *this;
40 TNamed::operator=(other);
43 //______________________________________________________________________________
44 void AliTrigEvent::Activate(Bool_t flag)
46 // Activate/deactivate this signal.
47 TObject::SetBit(kActive, flag);
50 ClassImp(AliTrigEventWithMask)
52 //______________________________________________________________________________
53 Bool_t AliTrigEventWithMask::ImportData(AliTrigEvent *source)
55 // Import data from likewise signal.
56 AliTrigEventWithMask *src = (AliTrigEventWithMask *)source;
57 SetValue(src->GetValue());
61 //______________________________________________________________________________
62 void AliTrigEventWithMask::SetValue(TBits *value)
64 // Set the mask value.
68 //______________________________________________________________________________
69 AliTrigEventWithMask::AliTrigEventWithMask(const AliTrigEventWithMask &other)
74 *fValue = *other.fValue;
77 //______________________________________________________________________________
78 AliTrigEventWithMask &AliTrigEventWithMask::operator=(const AliTrigEventWithMask &other)
80 // Assignment operator.
81 if (&other == this) return *this;
82 AliTrigEvent::operator=(other);
83 *fValue = *other.fValue;
87 ClassImp(AliTrigEventWithObject)
89 //______________________________________________________________________________
90 AliTrigEventWithObject::AliTrigEventWithObject(const char *name,const char *classname)
95 // Normal constructor where a class name is provided for the embedded object.
96 // If the event is created in this way one will only be able to connect to
97 // events embedding the same object type (via connectors). If empty string the type
98 // will be set upon the first call of SetValue.
102 //______________________________________________________________________________
103 AliTrigEventWithObject::AliTrigEventWithObject(const AliTrigEventWithObject &other)
104 :AliTrigEvent(other),
109 TClass* pClass=TClass::GetClass(fType);
111 fValue = (TObject*)pClass->New();
112 fValue->Copy(*other.fValue);
115 //______________________________________________________________________________
116 AliTrigEventWithObject &AliTrigEventWithObject::operator=(const AliTrigEventWithObject &other)
118 // Assignment operator.
119 if (&other == this) return *this;
120 AliTrigEvent::operator=(other);
122 TClass* pClass=TClass::GetClass(fType);
123 if (!pClass) return *this;
124 fValue = (TObject*)pClass->New();
125 fValue->Copy(*other.fValue);
129 //______________________________________________________________________________
130 Bool_t AliTrigEventWithObject::ImportData(AliTrigEvent *source)
132 // Import data from likewise signal.
133 AliTrigEventWithObject *src = (AliTrigEventWithObject *)source;
134 Bool_t done = SetValue(src->GetValue());
135 if (!done) Error("ImportData", "Cannot import object <%s> of class <%s> since event type was set to: <%s>",
136 src->GetValue()->GetName(), src->GetValue()->ClassName(), fType.Data());
140 //______________________________________________________________________________
141 Bool_t AliTrigEventWithObject::SetType(const char *classname)
143 // Set the type of this event. Can be done only once.
144 if (!strlen(classname)) return kFALSE;
145 if (!fType.IsNull()) {
146 Error("SetType", "Type for this trigger event already set to: %s", fType.Data());
149 TClass *type = gROOT->GetClass(classname);
151 Error("SetType", "Unknown class %s", classname);
158 //______________________________________________________________________________
159 Bool_t AliTrigEventWithObject::SetValue(TObject *value)
161 // Set the current event content. Checks consistency with event type.
163 // Reset current value.
167 // Set the type if used for the first time.
168 if (!fType) fType = value->ClassName();