1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * ALICE Experiment at CERN, All rights reserved. *
5 * Primary Authors: Artur Szostak <artursz@iafrica.com> *
6 * for The ALICE HLT Project. *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
17 /// @file AliHLTTrigger.h
18 /// @author Artur Szostak <artursz@iafrica.com>
20 /// @brief Implementation of the AliHLTTrigger base component class.
22 /// The AliHLTTrigger class is the base class from which all HLT trigger components
23 /// should be derived.
25 #include "AliHLTTrigger.h"
26 #include "AliHLTTriggerDecision.h"
28 ClassImp(AliHLTTrigger)
31 AliHLTTrigger::AliHLTTrigger() :
37 fTriggerEventResult(0),
42 // Default constructor sets pointers to NULL.
46 AliHLTTrigger::~AliHLTTrigger()
48 // Default destructor.
52 void AliHLTTrigger::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
54 // Returns output data size estimate.
55 // See header file for more details.
57 constBase = sizeof(AliHLTTriggerDecision);
62 int AliHLTTrigger::DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData)
64 // Sets the pointers to the evtData and trigData, then calls the DoTrigger to
65 // execute the actual trigger algorithm.
67 fEventData = &evtData;
68 fTriggerData = &trigData;
69 fDecisionMade = false;
70 fTriggerEventResult = 0;
71 // Reset the description, readout list and trigger domain used by TriggerEvent
72 // if requested to do so.
77 fTriggerDomain.Clear();
80 int result = DoTrigger();
81 if (result != 0) return result;
83 // Fill in a default decision of false if none was made.
84 if (not fDecisionMade)
92 return fTriggerEventResult;
96 int AliHLTTrigger::TriggerEvent(bool value)
98 // Sets the trigger decision for the current event.
99 // See header file for more details.
101 if (fTriggerEventResult != 0) return fTriggerEventResult; // Do not do anything if a previous call failed.
102 AliHLTTriggerDecision triggerResult(value, GetTriggerName(), fTriggerDomain, fDescription);
103 // Append the readout list if it contains anything.
104 triggerResult.TriggerDomain().Add(fReadoutList);
105 fTriggerEventResult = PushBack(&triggerResult, kAliHLTDataTypeTObject|kAliHLTDataOriginOut);
106 if (fTriggerEventResult == 0) fDecisionMade = true;
107 return fTriggerEventResult;
111 int AliHLTTrigger::TriggerEvent(
112 AliHLTTriggerDecision* result, const AliHLTComponentDataType& type,
116 // Sets a custom trigger decision for the current event.
117 // See header file for more details.
119 if (fTriggerEventResult != 0) return fTriggerEventResult; // Do not do anything if a previous call failed.
120 fTriggerEventResult = PushBack(result, type, spec);
121 if (fTriggerEventResult == 0) fDecisionMade = true;
122 return fTriggerEventResult;
126 void AliHLTTrigger::GetInputDataTypes(AliHLTComponentDataTypeList& list)
128 // Calls the const version of this method.
130 // Assign to const temporary variable to make sure we call the constant version
131 // of the GetOutputDataTypes method.
132 const AliHLTTrigger* t = this;
133 t->GetInputDataTypes(list);
137 int AliHLTTrigger::GetOutputDataTypes(AliHLTComponentDataTypeList& list)
139 // Calls the const version of this method.
141 // Assign to const temporary variable to make sure we call the constant version
142 // of the GetOutputDataTypes method.
143 const AliHLTTrigger* t = this;
144 t->GetOutputDataTypes(list);
145 list.push_back(kAliHLTDataTypeTObject|kAliHLTDataOriginOut);