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 |
28 | ClassImp(AliHLTTrigger) |
5a806c0e |
29 | |
5a806c0e |
30 | |
a9670afe |
31 | AliHLTTrigger::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 | { |
4adf50d6 |
41 | /// Default constructor sets pointers to NULL. |
5a806c0e |
42 | } |
43 | |
5a806c0e |
44 | |
a9670afe |
45 | AliHLTTrigger::~AliHLTTrigger() |
5a806c0e |
46 | { |
4adf50d6 |
47 | /// Default destructor. |
48 | } |
49 | |
50 | |
51 | void AliHLTTrigger::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier) |
52 | { |
53 | /// Returns output data size estimate. |
54 | |
1b9a175e |
55 | constBase = sizeof(AliHLTTriggerDecision); |
4adf50d6 |
56 | inputMultiplier = 1; |
5a806c0e |
57 | } |
58 | |
5a806c0e |
59 | |
a9670afe |
60 | int AliHLTTrigger::DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData) |
5a806c0e |
61 | { |
a9670afe |
62 | /// Sets the pointers to the evtData and trigData, then calls the DoTrigger to |
63 | /// execute the actual trigger algorithm. |
5a806c0e |
64 | |
a9670afe |
65 | fEventData = &evtData; |
66 | fTriggerData = &trigData; |
67 | fDecisionMade = false; |
68 | fTriggerEventResult = 0; |
69 | |
70 | int result = DoTrigger(); |
71 | if (result != 0) return result; |
72 | |
73 | // Fill in a default decision of false if none was made. |
74 | if (not fDecisionMade) |
75 | { |
76 | TriggerEvent(false); |
77 | } |
4adf50d6 |
78 | |
a9670afe |
79 | // Cleanup |
80 | fEventData = NULL; |
81 | fTriggerData = NULL; |
82 | return fTriggerEventResult; |
5a806c0e |
83 | } |
84 | |
5a806c0e |
85 | |
a9670afe |
86 | void AliHLTTrigger::TriggerEvent(bool value) |
5a806c0e |
87 | { |
a9670afe |
88 | /// Sets the trigger decision for the current event. |
5a806c0e |
89 | |
a9670afe |
90 | if (fTriggerEventResult != 0) return; // Do not do anything if a previous call failed. |
1b9a175e |
91 | AliHLTTriggerDecision triggerResult(value, GetTriggerName(), fReadoutList, fTriggerDomain, fDescription); |
4adf50d6 |
92 | fTriggerEventResult = PushBack(&triggerResult, kAliHLTDataTypeTObject|kAliHLTDataOriginOut); |
5a806c0e |
93 | } |
94 | |