- AliITSv11GeometrySDD.h : improved prototype of private method
[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),
4adf50d6 36 fTriggerEventResult(0),
1b9a175e 37 fDescription(),
38 fReadoutList(),
39 fTriggerDomain()
5a806c0e 40{
5d79eb88 41 // Default constructor sets pointers to NULL.
5a806c0e 42}
43
5a806c0e 44
a9670afe 45AliHLTTrigger::~AliHLTTrigger()
5a806c0e 46{
5d79eb88 47 // Default destructor.
4adf50d6 48}
49
50
51void AliHLTTrigger::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
52{
5d79eb88 53 // Returns output data size estimate.
54 // See header file for more details.
4adf50d6 55
1b9a175e 56 constBase = sizeof(AliHLTTriggerDecision);
4adf50d6 57 inputMultiplier = 1;
5a806c0e 58}
59
5a806c0e 60
a9670afe 61int AliHLTTrigger::DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData)
5a806c0e 62{
5d79eb88 63 // Sets the pointers to the evtData and trigData, then calls the DoTrigger to
64 // execute the actual trigger algorithm.
5a806c0e 65
a9670afe 66 fEventData = &evtData;
67 fTriggerData = &trigData;
68 fDecisionMade = false;
69 fTriggerEventResult = 0;
70
71 int result = DoTrigger();
72 if (result != 0) return result;
73
74 // Fill in a default decision of false if none was made.
75 if (not fDecisionMade)
76 {
77 TriggerEvent(false);
78 }
4adf50d6 79
a9670afe 80 // Cleanup
81 fEventData = NULL;
82 fTriggerData = NULL;
83 return fTriggerEventResult;
5a806c0e 84}
85
5a806c0e 86
a9670afe 87void AliHLTTrigger::TriggerEvent(bool value)
5a806c0e 88{
5d79eb88 89 // Sets the trigger decision for the current event.
90 // See header file for more details.
5a806c0e 91
a9670afe 92 if (fTriggerEventResult != 0) return; // Do not do anything if a previous call failed.
52f67e50 93 AliHLTTriggerDecision triggerResult(value, GetTriggerName(), fTriggerDomain, fDescription);
8b745301 94 // Append the readout list if it contains anything.
95 triggerResult.TriggerDomain().Add(fReadoutList);
4adf50d6 96 fTriggerEventResult = PushBack(&triggerResult, kAliHLTDataTypeTObject|kAliHLTDataOriginOut);
5d79eb88 97 if (fTriggerEventResult == 0) fDecisionMade = true;
98}
99
100
101void AliHLTTrigger::TriggerEvent(
102 AliHLTTriggerDecision* result, const AliHLTComponentDataType& type,
103 AliHLTUInt32_t spec
104 )
105{
106 // Sets a custom trigger decision for the current event.
107 // See header file for more details.
108
109 if (fTriggerEventResult != 0) return; // Do not do anything if a previous call failed.
110 fTriggerEventResult = PushBack(result, type, spec);
111 if (fTriggerEventResult == 0) fDecisionMade = true;
112}
113
114
115void AliHLTTrigger::GetInputDataTypes(AliHLTComponentDataTypeList& list)
116{
117 // Calls the const version of this method.
118
119 // Assign to const temporary variable to make sure we call the constant version
120 // of the GetOutputDataTypes method.
121 const AliHLTTrigger* t = this;
122 t->GetOutputDataTypes(list);
123}
124
125
126int AliHLTTrigger::GetOutputDataTypes(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;
133 t->GetOutputDataTypes(list);
134 list.push_back(kAliHLTDataTypeTObject|kAliHLTDataOriginOut);
135 return list.size();
5a806c0e 136}
137