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