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 | |
4aa41877 |
17 | #include "AliHLTTrigger.h" |
5a806c0e |
18 | |
4aa41877 |
19 | ClassImp(AliHLTTrigger) |
5a806c0e |
20 | |
5a806c0e |
21 | |
a9670afe |
22 | AliHLTTrigger::AliHLTTrigger() : |
23 | AliHLTProcessor(), |
24 | fEventData(NULL), |
25 | fTriggerData(NULL), |
26 | fDecisionMade(false), |
27 | fTriggerEventResult(0) |
5a806c0e |
28 | { |
a9670afe |
29 | // Default constructor sets pointers to NULL. |
5a806c0e |
30 | } |
31 | |
5a806c0e |
32 | |
a9670afe |
33 | AliHLTTrigger::~AliHLTTrigger() |
5a806c0e |
34 | { |
a9670afe |
35 | // Default destructor. |
5a806c0e |
36 | } |
37 | |
5a806c0e |
38 | |
a9670afe |
39 | int AliHLTTrigger::DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData) |
5a806c0e |
40 | { |
a9670afe |
41 | /// Sets the pointers to the evtData and trigData, then calls the DoTrigger to |
42 | /// execute the actual trigger algorithm. |
5a806c0e |
43 | |
a9670afe |
44 | fEventData = &evtData; |
45 | fTriggerData = &trigData; |
46 | fDecisionMade = false; |
47 | fTriggerEventResult = 0; |
48 | |
49 | int result = DoTrigger(); |
50 | if (result != 0) return result; |
51 | |
52 | // Fill in a default decision of false if none was made. |
53 | if (not fDecisionMade) |
54 | { |
55 | TriggerEvent(false); |
56 | } |
57 | // Cleanup |
58 | fEventData = NULL; |
59 | fTriggerData = NULL; |
60 | return fTriggerEventResult; |
5a806c0e |
61 | } |
62 | |
5a806c0e |
63 | |
a9670afe |
64 | void AliHLTTrigger::TriggerEvent(bool value) |
5a806c0e |
65 | { |
a9670afe |
66 | /// Sets the trigger decision for the current event. |
5a806c0e |
67 | |
a9670afe |
68 | if (fTriggerEventResult != 0) return; // Do not do anything if a previous call failed. |
69 | TObjString triggerResult(GetTriggerName()); |
70 | triggerResult.SetBit(BIT(14), value); // Use bit 14 for the boolean decision. |
71 | fTriggerEventResult = PushBack(triggerResult, kAliHLTDataTypeTObject|kAliHLTDataOriginOut); |
5a806c0e |
72 | } |
73 | |