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"
27 #include "AliHLTReadoutList.h"
29 ClassImp(AliHLTTrigger)
32 AliHLTTrigger::AliHLTTrigger() :
38 fTriggerEventResult(0),
43 // Default constructor sets pointers to NULL.
47 AliHLTTrigger::~AliHLTTrigger()
49 // Default destructor.
53 void AliHLTTrigger::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
55 // Returns output data size estimate.
56 // See header file for more details.
58 // Matthias 2009-07-03 this is presumably to small as the streamed object might be
59 // bigger. This is actually the case in root v5-24-00
60 // Just take 2x the size of the object
61 constBase = 2*sizeof(AliHLTTriggerDecision);
66 int AliHLTTrigger::DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData)
68 // Sets the pointers to the evtData and trigData, then calls the DoTrigger to
69 // execute the actual trigger algorithm.
71 fEventData = &evtData;
72 fTriggerData = &trigData;
73 fDecisionMade = false;
74 fTriggerEventResult = 0;
75 // Reset the description, readout list and trigger domain used by TriggerEvent
76 // if requested to do so.
81 fTriggerDomain.Clear();
84 int result = DoTrigger();
85 if (result != 0) return result;
87 // Fill in a default decision of false if none was made.
88 if (not fDecisionMade)
96 return fTriggerEventResult;
100 int AliHLTTrigger::TriggerEvent(bool value)
102 // Sets the trigger decision for the current event.
103 // See header file for more details.
105 if (fTriggerEventResult != 0) return fTriggerEventResult; // Do not do anything if a previous call failed.
106 AliHLTTriggerDecision triggerResult(value, GetTriggerName(), fTriggerDomain, fDescription);
107 // Append the readout list if it contains anything.
108 triggerResult.TriggerDomain().Add(fReadoutList);
109 return TriggerEvent(&triggerResult, kAliHLTDataTypeTObject|kAliHLTDataOriginOut);
113 int AliHLTTrigger::TriggerEvent(
114 AliHLTTriggerDecision* result, const AliHLTComponentDataType& type,
118 // Sets a custom trigger decision for the current event.
119 // See header file for more details.
121 if (fTriggerEventResult != 0) return fTriggerEventResult; // Do not do anything if a previous call failed.
122 fTriggerEventResult = PushBack(result, type, spec);
123 if (fTriggerEventResult == 0) {
124 fTriggerEventResult = PushBack(result->ReadoutList().Buffer(), result->ReadoutList().BufferSize(), "HLTRDLST", "HLT "/*kAliHLTDataTypeDAQRDOUT|kAliHLTDataOriginOut*/);
127 if (fTriggerEventResult == 0) fDecisionMade = true;
128 return fTriggerEventResult;
132 void AliHLTTrigger::GetInputDataTypes(AliHLTComponentDataTypeList& list)
134 // Calls the const version of this method.
136 // Assign to const temporary variable to make sure we call the constant version
137 // of the GetOutputDataTypes method.
138 const AliHLTTrigger* t = this;
139 t->GetInputDataTypes(list);
143 int AliHLTTrigger::GetOutputDataTypes(AliHLTComponentDataTypeList& list)
145 // Calls the const version of this method.
147 // Assign to const temporary variable to make sure we call the constant version
148 // of the GetOutputDataTypes method.
149 const AliHLTTrigger* t = this;
150 t->GetOutputDataTypes(list);
151 list.push_back(kAliHLTDataTypeTObject|kAliHLTDataOriginOut);