remove verbosity
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTTrigger.cxx
CommitLineData
a9670afe 1/**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * ALICE Experiment at CERN, All rights reserved. *
4 * *
5 * Primary Authors: Artur Szostak <artursz@iafrica.com> *
6 * for The ALICE HLT Project. *
7 * *
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 **************************************************************************/
5a806c0e 16
1b9a175e 17/// @file AliHLTTrigger.h
18/// @author Artur Szostak <artursz@iafrica.com>
19/// @date 12 Aug 2008
20/// @brief Implementation of the AliHLTTrigger base component class.
21///
22/// The AliHLTTrigger class is the base class from which all HLT trigger components
23/// should be derived.
24
4aa41877 25#include "AliHLTTrigger.h"
1b9a175e 26#include "AliHLTTriggerDecision.h"
5a806c0e 27
4aa41877 28ClassImp(AliHLTTrigger)
5a806c0e 29
5a806c0e 30
a9670afe 31AliHLTTrigger::AliHLTTrigger() :
32 AliHLTProcessor(),
33 fEventData(NULL),
34 fTriggerData(NULL),
35 fDecisionMade(false),
acc7214e 36 fClearInfo(true),
4adf50d6 37 fTriggerEventResult(0),
1b9a175e 38 fDescription(),
39 fReadoutList(),
40 fTriggerDomain()
5a806c0e 41{
5d79eb88 42 // Default constructor sets pointers to NULL.
5a806c0e 43}
44
5a806c0e 45
a9670afe 46AliHLTTrigger::~AliHLTTrigger()
5a806c0e 47{
5d79eb88 48 // Default destructor.
4adf50d6 49}
50
51
52void AliHLTTrigger::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
53{
5d79eb88 54 // Returns output data size estimate.
55 // See header file for more details.
4adf50d6 56
1b9a175e 57 constBase = sizeof(AliHLTTriggerDecision);
4adf50d6 58 inputMultiplier = 1;
5a806c0e 59}
60
5a806c0e 61
a9670afe 62int AliHLTTrigger::DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData)
5a806c0e 63{
5d79eb88 64 // Sets the pointers to the evtData and trigData, then calls the DoTrigger to
65 // execute the actual trigger algorithm.
5a806c0e 66
a9670afe 67 fEventData = &evtData;
68 fTriggerData = &trigData;
69 fDecisionMade = false;
70 fTriggerEventResult = 0;
acc7214e 71 // Reset the description, readout list and trigger domain used by TriggerEvent
72 // if requested to do so.
73 if (fClearInfo)
74 {
75 fDescription = "";
76 fReadoutList.Clear();
77 fTriggerDomain.Clear();
78 }
a9670afe 79
80 int result = DoTrigger();
81 if (result != 0) return result;
82
83 // Fill in a default decision of false if none was made.
84 if (not fDecisionMade)
85 {
86 TriggerEvent(false);
87 }
4adf50d6 88
a9670afe 89 // Cleanup
90 fEventData = NULL;
91 fTriggerData = NULL;
92 return fTriggerEventResult;
5a806c0e 93}
94
5a806c0e 95
4654280e 96int AliHLTTrigger::TriggerEvent(bool value)
5a806c0e 97{
5d79eb88 98 // Sets the trigger decision for the current event.
99 // See header file for more details.
5a806c0e 100
4654280e 101 if (fTriggerEventResult != 0) return fTriggerEventResult; // Do not do anything if a previous call failed.
52f67e50 102 AliHLTTriggerDecision triggerResult(value, GetTriggerName(), fTriggerDomain, fDescription);
8b745301 103 // Append the readout list if it contains anything.
104 triggerResult.TriggerDomain().Add(fReadoutList);
4adf50d6 105 fTriggerEventResult = PushBack(&triggerResult, kAliHLTDataTypeTObject|kAliHLTDataOriginOut);
5d79eb88 106 if (fTriggerEventResult == 0) fDecisionMade = true;
4654280e 107 return fTriggerEventResult;
5d79eb88 108}
109
110
4654280e 111int AliHLTTrigger::TriggerEvent(
5d79eb88 112 AliHLTTriggerDecision* result, const AliHLTComponentDataType& type,
113 AliHLTUInt32_t spec
114 )
115{
116 // Sets a custom trigger decision for the current event.
117 // See header file for more details.
118
4654280e 119 if (fTriggerEventResult != 0) return fTriggerEventResult; // Do not do anything if a previous call failed.
5d79eb88 120 fTriggerEventResult = PushBack(result, type, spec);
121 if (fTriggerEventResult == 0) fDecisionMade = true;
4654280e 122 return fTriggerEventResult;
5d79eb88 123}
124
125
126void AliHLTTrigger::GetInputDataTypes(AliHLTComponentDataTypeList& list)
127{
128 // Calls the const version of this method.
129
130 // Assign to const temporary variable to make sure we call the constant version
131 // of the GetOutputDataTypes method.
132 const AliHLTTrigger* t = this;
4a0b19b6 133 t->GetInputDataTypes(list);
5d79eb88 134}
135
136
137int AliHLTTrigger::GetOutputDataTypes(AliHLTComponentDataTypeList& list)
138{
139 // Calls the const version of this method.
140
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);
146 return list.size();
5a806c0e 147}
148