]>
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" | |
95ea76b5 | 27 | #include "TClass.h" |
28 | #include "AliHLTMisc.h" | |
1b9a175e | 29 | |
30 | ClassImp(AliHLTGlobalTriggerDecision) | |
31 | ||
32 | ||
33 | AliHLTGlobalTriggerDecision::AliHLTGlobalTriggerDecision() : | |
34dec501 | 34 | AliHLTTriggerDecision(0, "HLTGlobalTrigger"), |
1b9a175e | 35 | fContributingTriggers(AliHLTTriggerDecision::Class()), |
52f67e50 | 36 | fInputObjects(), |
1b9a175e | 37 | fCounters() |
38 | { | |
39 | // Default constructor. | |
34dec501 | 40 | |
41 | fInputObjects.SetOwner(kTRUE); | |
1b9a175e | 42 | } |
43 | ||
44 | ||
45 | AliHLTGlobalTriggerDecision::AliHLTGlobalTriggerDecision( | |
52f67e50 | 46 | bool result, const AliHLTTriggerDomain& triggerDomain, const char* description |
1b9a175e | 47 | ) : |
52f67e50 | 48 | AliHLTTriggerDecision(result, "HLTGlobalTrigger", triggerDomain, description), |
1b9a175e | 49 | fContributingTriggers(AliHLTTriggerDecision::Class()), |
52f67e50 | 50 | fInputObjects(), |
1b9a175e | 51 | fCounters() |
52 | { | |
53 | // Constructor specifying multiple information fields. | |
54 | ||
55 | Result(result); | |
52f67e50 | 56 | fInputObjects.SetOwner(kTRUE); |
1b9a175e | 57 | } |
58 | ||
59 | ||
60 | AliHLTGlobalTriggerDecision::~AliHLTGlobalTriggerDecision() | |
61 | { | |
62 | // Default destructor. | |
63 | } | |
64 | ||
65 | ||
66 | void AliHLTGlobalTriggerDecision::Print(Option_t* option) const | |
67 | { | |
68 | // Prints the contents of the trigger decision. | |
69 | ||
70 | TString opt(option); | |
52f67e50 | 71 | if (opt.Contains("compact")) |
72 | { | |
73 | cout << "Global "; | |
74 | AliHLTTriggerDecision::Print(""); | |
75 | } | |
76 | else if (opt.Contains("short")) | |
1b9a175e | 77 | { |
78 | cout << "Global "; | |
79 | AliHLTTriggerDecision::Print(option); | |
52f67e50 | 80 | cout << "#################### Input trigger decisions ####################" << endl; |
1b9a175e | 81 | for (Int_t i = 0; i < NumberOfTriggerInputs(); i++) |
82 | { | |
60a3fc9b | 83 | if (TriggerInput(i)) TriggerInput(i)->Print(option); |
1b9a175e | 84 | } |
52f67e50 | 85 | if (NumberOfTriggerInputs() == 0) |
86 | { | |
87 | cout << "(none)" << endl; | |
88 | } | |
89 | } | |
90 | else if (opt.Contains("counters")) | |
91 | { | |
92 | cout << "Counter\tValue" << endl; | |
93 | for (Int_t i = 0; i < fCounters.GetSize(); i++) | |
94 | { | |
95 | cout << i << "\t" << fCounters[i] << endl; | |
96 | } | |
97 | if (fCounters.GetSize() == 0) | |
98 | { | |
99 | cout << "(none)" << endl; | |
100 | } | |
1b9a175e | 101 | } |
102 | else | |
103 | { | |
104 | cout << "Global "; | |
105 | AliHLTTriggerDecision::Print(option); | |
52f67e50 | 106 | cout << "#################### Input trigger decisions ####################" << endl; |
1b9a175e | 107 | for (Int_t i = 0; i < NumberOfTriggerInputs(); i++) |
108 | { | |
52f67e50 | 109 | cout << "-------------------- Input trigger decision " << i << " --------------------" << endl; |
60a3fc9b | 110 | if (TriggerInput(i)) TriggerInput(i)->Print(option); |
1b9a175e | 111 | } |
52f67e50 | 112 | if (NumberOfTriggerInputs() == 0) |
113 | { | |
114 | cout << "(none)" << endl; | |
115 | } | |
116 | cout << "###################### Other input objects ######################" << endl; | |
117 | for (Int_t i = 0; i < NumberOfInputObjects(); i++) | |
118 | { | |
119 | cout << "------------------------ Input object " << i << " ------------------------" << endl; | |
60a3fc9b | 120 | if (InputObject(i)) InputObject(i)->Print(option); |
52f67e50 | 121 | } |
122 | if (NumberOfInputObjects() == 0) | |
123 | { | |
124 | cout << "(none)" << endl; | |
125 | } | |
126 | cout << "#################### Event class counters ####################" << endl; | |
1b9a175e | 127 | cout << "Counter\tValue" << endl; |
128 | for (Int_t i = 0; i < fCounters.GetSize(); i++) | |
129 | { | |
130 | cout << i << "\t" << fCounters[i] << endl; | |
131 | } | |
52f67e50 | 132 | if (fCounters.GetSize() == 0) |
133 | { | |
134 | cout << "(none)" << endl; | |
135 | } | |
1b9a175e | 136 | } |
137 | } | |
138 | ||
4a035340 | 139 | void AliHLTGlobalTriggerDecision::Copy(TObject &object) const |
140 | { | |
141 | // copy this to the specified object | |
142 | ||
95ea76b5 | 143 | if (object.IsA() == AliHLTMisc::Instance().IsAliESDHLTDecision()) { |
144 | AliHLTMisc::Instance().Copy(this, &object); | |
145 | return; | |
146 | } | |
147 | ||
4a035340 | 148 | AliHLTGlobalTriggerDecision* pDecision=dynamic_cast<AliHLTGlobalTriggerDecision*>(&object); |
149 | if (pDecision) | |
150 | { | |
151 | // copy members if target is a AliHLTGlobalTriggerDecision | |
152 | *pDecision=*this; | |
153 | } | |
4a035340 | 154 | // copy the base class |
155 | AliHLTTriggerDecision::Copy(object); | |
156 | } | |
157 | ||
158 | TObject *AliHLTGlobalTriggerDecision::Clone(const char */*newname*/) const | |
159 | { | |
160 | // create a new clone, classname is ignored | |
161 | ||
162 | return new AliHLTGlobalTriggerDecision(*this); | |
163 | } | |
30d84601 | 164 | |
165 | AliHLTGlobalTriggerDecision::AliHLTGlobalTriggerDecision(const AliHLTGlobalTriggerDecision& src) : | |
166 | AliHLTTriggerDecision(src), | |
167 | fContributingTriggers(AliHLTTriggerDecision::Class()), | |
168 | fInputObjects(), | |
169 | fCounters() | |
170 | { | |
171 | // copy constructor | |
34dec501 | 172 | fInputObjects.SetOwner(kTRUE); |
30d84601 | 173 | *this=src; |
174 | } | |
175 | ||
176 | AliHLTGlobalTriggerDecision& AliHLTGlobalTriggerDecision::operator=(const AliHLTGlobalTriggerDecision& src) | |
177 | { | |
178 | // assignment operator | |
179 | ||
180 | fContributingTriggers.Delete(); | |
181 | for (int triggerInput=0; triggerInput<src.NumberOfTriggerInputs(); triggerInput++) { | |
182 | const AliHLTTriggerDecision* pTriggerObject=src.TriggerInput(triggerInput); | |
183 | if (pTriggerObject) { | |
184 | // the AddTriggerInput function uses the copy constructor and | |
185 | // makes a new object from the reference | |
186 | AddTriggerInput(*pTriggerObject); | |
187 | } else { | |
188 | //Error("failed to get trigger input #%d", triggerInput); | |
189 | } | |
190 | } | |
191 | ||
192 | fInputObjects.Delete(); | |
193 | for (int inputObject=0; inputObject<src.NumberOfTriggerInputs(); inputObject++) { | |
194 | const TObject* pInputObject=src.InputObject(inputObject); | |
195 | if (pInputObject) { | |
196 | // the AddInputObject function uses Clone() and | |
197 | // makes a new object from the reference | |
198 | AddInputObject(pInputObject); | |
199 | } else { | |
200 | //Error("failed to get trigger input #%d", inputObject); | |
201 | } | |
202 | } | |
203 | ||
204 | SetCounters(src.Counters()); | |
205 | ||
206 | return *this; | |
207 | } | |
d4ed5215 | 208 | |
209 | void AliHLTGlobalTriggerDecision::SetCounters(const TArrayL64& counters, Long64_t eventCount) | |
210 | { | |
211 | // Sets the counter array. | |
212 | // If the number of events is specified, an additional counter is added at the end. | |
213 | fCounters = counters; | |
81d62bb4 | 214 | if (eventCount>=0) { |
d4ed5215 | 215 | int size=fCounters.GetSize(); |
216 | fCounters.Set(size+1); | |
217 | fCounters[size]=eventCount; | |
218 | } | |
219 | } |