]>
Commit | Line | Data |
---|---|---|
4a035340 | 1 | // $Id$ |
1b9a175e | 2 | /************************************************************************** |
3 | * This file is property of and copyright by the ALICE HLT Project * | |
4 | * ALICE Experiment at CERN, All rights reserved. * | |
5 | * * | |
6 | * Primary Authors: Artur Szostak <artursz@iafrica.com> * | |
7 | * for The ALICE HLT Project. * | |
8 | * * | |
9 | * Permission to use, copy, modify and distribute this software and its * | |
10 | * documentation strictly for non-commercial purposes is hereby granted * | |
11 | * without fee, provided that the above copyright notice appears in all * | |
12 | * copies and that both the copyright notice and this permission notice * | |
13 | * appear in the supporting documentation. The authors make no claims * | |
14 | * about the suitability of this software for any purpose. It is * | |
15 | * provided "as is" without express or implied warranty. * | |
16 | **************************************************************************/ | |
17 | ||
18 | /// @file AliHLTGlobalTriggerDecision.cxx | |
19 | /// @author Artur Szostak <artursz@iafrica.com> | |
20 | /// @date 26 Nov 2008 | |
21 | /// @brief Implementation of the AliHLTGlobalTriggerDecision class. | |
22 | /// | |
23 | /// The global trigger decision class stores the global HLT decision. | |
24 | ||
25 | #include "AliHLTGlobalTriggerDecision.h" | |
26 | #include "Riostream.h" | |
27 | ||
28 | ClassImp(AliHLTGlobalTriggerDecision) | |
29 | ||
30 | ||
31 | AliHLTGlobalTriggerDecision::AliHLTGlobalTriggerDecision() : | |
30d84601 | 32 | AliHLTTriggerDecision(0, "HLTGlobalTrigger"), |
1b9a175e | 33 | fContributingTriggers(AliHLTTriggerDecision::Class()), |
52f67e50 | 34 | fInputObjects(), |
1b9a175e | 35 | fCounters() |
36 | { | |
37 | // Default constructor. | |
38 | } | |
39 | ||
40 | ||
41 | AliHLTGlobalTriggerDecision::AliHLTGlobalTriggerDecision( | |
52f67e50 | 42 | bool result, const AliHLTTriggerDomain& triggerDomain, const char* description |
1b9a175e | 43 | ) : |
52f67e50 | 44 | AliHLTTriggerDecision(result, "HLTGlobalTrigger", triggerDomain, description), |
1b9a175e | 45 | fContributingTriggers(AliHLTTriggerDecision::Class()), |
52f67e50 | 46 | fInputObjects(), |
1b9a175e | 47 | fCounters() |
48 | { | |
49 | // Constructor specifying multiple information fields. | |
50 | ||
51 | Result(result); | |
52f67e50 | 52 | fInputObjects.SetOwner(kTRUE); |
1b9a175e | 53 | } |
54 | ||
55 | ||
56 | AliHLTGlobalTriggerDecision::~AliHLTGlobalTriggerDecision() | |
57 | { | |
58 | // Default destructor. | |
59 | } | |
60 | ||
61 | ||
62 | void AliHLTGlobalTriggerDecision::Print(Option_t* option) const | |
63 | { | |
64 | // Prints the contents of the trigger decision. | |
65 | ||
66 | TString opt(option); | |
52f67e50 | 67 | if (opt.Contains("compact")) |
68 | { | |
69 | cout << "Global "; | |
70 | AliHLTTriggerDecision::Print(""); | |
71 | } | |
72 | else if (opt.Contains("short")) | |
1b9a175e | 73 | { |
74 | cout << "Global "; | |
75 | AliHLTTriggerDecision::Print(option); | |
52f67e50 | 76 | cout << "#################### Input trigger decisions ####################" << endl; |
1b9a175e | 77 | for (Int_t i = 0; i < NumberOfTriggerInputs(); i++) |
78 | { | |
60a3fc9b | 79 | if (TriggerInput(i)) TriggerInput(i)->Print(option); |
1b9a175e | 80 | } |
52f67e50 | 81 | if (NumberOfTriggerInputs() == 0) |
82 | { | |
83 | cout << "(none)" << endl; | |
84 | } | |
85 | } | |
86 | else if (opt.Contains("counters")) | |
87 | { | |
88 | cout << "Counter\tValue" << endl; | |
89 | for (Int_t i = 0; i < fCounters.GetSize(); i++) | |
90 | { | |
91 | cout << i << "\t" << fCounters[i] << endl; | |
92 | } | |
93 | if (fCounters.GetSize() == 0) | |
94 | { | |
95 | cout << "(none)" << endl; | |
96 | } | |
1b9a175e | 97 | } |
98 | else | |
99 | { | |
100 | cout << "Global "; | |
101 | AliHLTTriggerDecision::Print(option); | |
52f67e50 | 102 | cout << "#################### Input trigger decisions ####################" << endl; |
1b9a175e | 103 | for (Int_t i = 0; i < NumberOfTriggerInputs(); i++) |
104 | { | |
52f67e50 | 105 | cout << "-------------------- Input trigger decision " << i << " --------------------" << endl; |
60a3fc9b | 106 | if (TriggerInput(i)) TriggerInput(i)->Print(option); |
1b9a175e | 107 | } |
52f67e50 | 108 | if (NumberOfTriggerInputs() == 0) |
109 | { | |
110 | cout << "(none)" << endl; | |
111 | } | |
112 | cout << "###################### Other input objects ######################" << endl; | |
113 | for (Int_t i = 0; i < NumberOfInputObjects(); i++) | |
114 | { | |
115 | cout << "------------------------ Input object " << i << " ------------------------" << endl; | |
60a3fc9b | 116 | if (InputObject(i)) InputObject(i)->Print(option); |
52f67e50 | 117 | } |
118 | if (NumberOfInputObjects() == 0) | |
119 | { | |
120 | cout << "(none)" << endl; | |
121 | } | |
122 | cout << "#################### Event class counters ####################" << endl; | |
1b9a175e | 123 | cout << "Counter\tValue" << endl; |
124 | for (Int_t i = 0; i < fCounters.GetSize(); i++) | |
125 | { | |
126 | cout << i << "\t" << fCounters[i] << endl; | |
127 | } | |
52f67e50 | 128 | if (fCounters.GetSize() == 0) |
129 | { | |
130 | cout << "(none)" << endl; | |
131 | } | |
1b9a175e | 132 | } |
133 | } | |
134 | ||
4a035340 | 135 | void AliHLTGlobalTriggerDecision::Copy(TObject &object) const |
136 | { | |
137 | // copy this to the specified object | |
138 | ||
139 | AliHLTGlobalTriggerDecision* pDecision=dynamic_cast<AliHLTGlobalTriggerDecision*>(&object); | |
140 | if (pDecision) | |
141 | { | |
142 | // copy members if target is a AliHLTGlobalTriggerDecision | |
143 | *pDecision=*this; | |
144 | } | |
4a035340 | 145 | // copy the base class |
146 | AliHLTTriggerDecision::Copy(object); | |
147 | } | |
148 | ||
149 | TObject *AliHLTGlobalTriggerDecision::Clone(const char */*newname*/) const | |
150 | { | |
151 | // create a new clone, classname is ignored | |
152 | ||
153 | return new AliHLTGlobalTriggerDecision(*this); | |
154 | } | |
30d84601 | 155 | |
156 | AliHLTGlobalTriggerDecision::AliHLTGlobalTriggerDecision(const AliHLTGlobalTriggerDecision& src) : | |
157 | AliHLTTriggerDecision(src), | |
158 | fContributingTriggers(AliHLTTriggerDecision::Class()), | |
159 | fInputObjects(), | |
160 | fCounters() | |
161 | { | |
162 | // copy constructor | |
163 | *this=src; | |
164 | } | |
165 | ||
166 | AliHLTGlobalTriggerDecision& AliHLTGlobalTriggerDecision::operator=(const AliHLTGlobalTriggerDecision& src) | |
167 | { | |
168 | // assignment operator | |
169 | ||
170 | fContributingTriggers.Delete(); | |
171 | for (int triggerInput=0; triggerInput<src.NumberOfTriggerInputs(); triggerInput++) { | |
172 | const AliHLTTriggerDecision* pTriggerObject=src.TriggerInput(triggerInput); | |
173 | if (pTriggerObject) { | |
174 | // the AddTriggerInput function uses the copy constructor and | |
175 | // makes a new object from the reference | |
176 | AddTriggerInput(*pTriggerObject); | |
177 | } else { | |
178 | //Error("failed to get trigger input #%d", triggerInput); | |
179 | } | |
180 | } | |
181 | ||
182 | fInputObjects.Delete(); | |
183 | for (int inputObject=0; inputObject<src.NumberOfTriggerInputs(); inputObject++) { | |
184 | const TObject* pInputObject=src.InputObject(inputObject); | |
185 | if (pInputObject) { | |
186 | // the AddInputObject function uses Clone() and | |
187 | // makes a new object from the reference | |
188 | AddInputObject(pInputObject); | |
189 | } else { | |
190 | //Error("failed to get trigger input #%d", inputObject); | |
191 | } | |
192 | } | |
193 | ||
194 | SetCounters(src.Counters()); | |
195 | ||
196 | return *this; | |
197 | } | |
d4ed5215 | 198 | |
199 | void AliHLTGlobalTriggerDecision::SetCounters(const TArrayL64& counters, Long64_t eventCount) | |
200 | { | |
201 | // Sets the counter array. | |
202 | // If the number of events is specified, an additional counter is added at the end. | |
203 | fCounters = counters; | |
81d62bb4 | 204 | if (eventCount>=0) { |
d4ed5215 | 205 | int size=fCounters.GetSize(); |
206 | fCounters.Set(size+1); | |
207 | fCounters[size]=eventCount; | |
208 | } | |
209 | } |