]>
Commit | Line | Data |
---|---|---|
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 | **************************************************************************/ | |
16 | ||
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 | ||
25 | #include "AliHLTTrigger.h" | |
26 | #include "AliHLTTriggerDecision.h" | |
27 | ||
28 | ClassImp(AliHLTTrigger) | |
29 | ||
30 | ||
31 | AliHLTTrigger::AliHLTTrigger() : | |
32 | AliHLTProcessor(), | |
33 | fEventData(NULL), | |
34 | fTriggerData(NULL), | |
35 | fDecisionMade(false), | |
36 | fClearInfo(true), | |
37 | fTriggerEventResult(0), | |
38 | fDescription(), | |
39 | fReadoutList(), | |
40 | fTriggerDomain() | |
41 | { | |
42 | // Default constructor sets pointers to NULL. | |
43 | } | |
44 | ||
45 | ||
46 | AliHLTTrigger::~AliHLTTrigger() | |
47 | { | |
48 | // Default destructor. | |
49 | } | |
50 | ||
51 | ||
52 | void AliHLTTrigger::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier) | |
53 | { | |
54 | // Returns output data size estimate. | |
55 | // See header file for more details. | |
56 | ||
57 | // Matthias 2009-07-03 this is presumably to small as the streamed object might be | |
58 | // bigger. This is actually the case in root v5-24-00 | |
59 | // Just take 2x the size of the object | |
60 | constBase = 2*sizeof(AliHLTTriggerDecision); | |
61 | inputMultiplier = 1; | |
62 | } | |
63 | ||
64 | ||
65 | int AliHLTTrigger::DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData) | |
66 | { | |
67 | // Sets the pointers to the evtData and trigData, then calls the DoTrigger to | |
68 | // execute the actual trigger algorithm. | |
69 | ||
70 | fEventData = &evtData; | |
71 | fTriggerData = &trigData; | |
72 | fDecisionMade = false; | |
73 | fTriggerEventResult = 0; | |
74 | // Reset the description, readout list and trigger domain used by TriggerEvent | |
75 | // if requested to do so. | |
76 | if (fClearInfo) | |
77 | { | |
78 | fDescription = ""; | |
79 | fReadoutList.Clear(); | |
80 | fTriggerDomain.Clear(); | |
81 | } | |
82 | ||
83 | int result = DoTrigger(); | |
84 | if (result != 0) return result; | |
85 | ||
86 | // Fill in a default decision of false if none was made. | |
87 | if (not fDecisionMade) | |
88 | { | |
89 | TriggerEvent(false); | |
90 | } | |
91 | ||
92 | // Cleanup | |
93 | fEventData = NULL; | |
94 | fTriggerData = NULL; | |
95 | return fTriggerEventResult; | |
96 | } | |
97 | ||
98 | ||
99 | int AliHLTTrigger::TriggerEvent(bool value) | |
100 | { | |
101 | // Sets the trigger decision for the current event. | |
102 | // See header file for more details. | |
103 | ||
104 | if (fTriggerEventResult != 0) return fTriggerEventResult; // Do not do anything if a previous call failed. | |
105 | AliHLTTriggerDecision triggerResult(value, GetTriggerName(), fTriggerDomain, fDescription); | |
106 | // Append the readout list if it contains anything. | |
107 | triggerResult.TriggerDomain().Add(fReadoutList); | |
108 | fTriggerEventResult = PushBack(&triggerResult, kAliHLTDataTypeTObject|kAliHLTDataOriginOut); | |
109 | if (fTriggerEventResult == 0) fDecisionMade = true; | |
110 | return fTriggerEventResult; | |
111 | } | |
112 | ||
113 | ||
114 | int AliHLTTrigger::TriggerEvent( | |
115 | AliHLTTriggerDecision* result, const AliHLTComponentDataType& type, | |
116 | AliHLTUInt32_t spec | |
117 | ) | |
118 | { | |
119 | // Sets a custom trigger decision for the current event. | |
120 | // See header file for more details. | |
121 | ||
122 | if (fTriggerEventResult != 0) return fTriggerEventResult; // Do not do anything if a previous call failed. | |
123 | fTriggerEventResult = PushBack(result, type, spec); | |
124 | if (fTriggerEventResult == 0) fDecisionMade = true; | |
125 | return fTriggerEventResult; | |
126 | } | |
127 | ||
128 | ||
129 | void AliHLTTrigger::GetInputDataTypes(AliHLTComponentDataTypeList& list) | |
130 | { | |
131 | // Calls the const version of this method. | |
132 | ||
133 | // Assign to const temporary variable to make sure we call the constant version | |
134 | // of the GetOutputDataTypes method. | |
135 | const AliHLTTrigger* t = this; | |
136 | t->GetInputDataTypes(list); | |
137 | } | |
138 | ||
139 | ||
140 | int AliHLTTrigger::GetOutputDataTypes(AliHLTComponentDataTypeList& list) | |
141 | { | |
142 | // Calls the const version of this method. | |
143 | ||
144 | // Assign to const temporary variable to make sure we call the constant version | |
145 | // of the GetOutputDataTypes method. | |
146 | const AliHLTTrigger* t = this; | |
147 | t->GetOutputDataTypes(list); | |
148 | list.push_back(kAliHLTDataTypeTObject|kAliHLTDataOriginOut); | |
149 | return list.size(); | |
150 | } | |
151 |