2 /**************************************************************************
3 * This file is property of and copyright by the ALICE HLT Project *
4 * ALICE Experiment at CERN, All rights reserved. *
6 * Primary Authors: Artur Szostak <artursz@iafrica.com> *
7 * for The ALICE HLT Project. *
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 **************************************************************************/
18 /// @file AliHLTGlobalTriggerDecision.cxx
19 /// @author Artur Szostak <artursz@iafrica.com>
21 /// @brief Implementation of the AliHLTGlobalTriggerDecision class.
23 /// The global trigger decision class stores the global HLT decision.
25 #include "AliHLTGlobalTriggerDecision.h"
26 #include "Riostream.h"
28 ClassImp(AliHLTGlobalTriggerDecision)
31 AliHLTGlobalTriggerDecision::AliHLTGlobalTriggerDecision() :
32 AliHLTTriggerDecision(0, "HLTGlobalTrigger"),
33 fContributingTriggers(AliHLTTriggerDecision::Class()),
37 // Default constructor.
41 AliHLTGlobalTriggerDecision::AliHLTGlobalTriggerDecision(
42 bool result, const AliHLTTriggerDomain& triggerDomain, const char* description
44 AliHLTTriggerDecision(result, "HLTGlobalTrigger", triggerDomain, description),
45 fContributingTriggers(AliHLTTriggerDecision::Class()),
49 // Constructor specifying multiple information fields.
52 fInputObjects.SetOwner(kTRUE);
56 AliHLTGlobalTriggerDecision::~AliHLTGlobalTriggerDecision()
58 // Default destructor.
62 void AliHLTGlobalTriggerDecision::Print(Option_t* option) const
64 // Prints the contents of the trigger decision.
67 if (opt.Contains("compact"))
70 AliHLTTriggerDecision::Print("");
72 else if (opt.Contains("short"))
75 AliHLTTriggerDecision::Print(option);
76 cout << "#################### Input trigger decisions ####################" << endl;
77 for (Int_t i = 0; i < NumberOfTriggerInputs(); i++)
79 TriggerInput(i)->Print(option);
81 if (NumberOfTriggerInputs() == 0)
83 cout << "(none)" << endl;
86 else if (opt.Contains("counters"))
88 cout << "Counter\tValue" << endl;
89 for (Int_t i = 0; i < fCounters.GetSize(); i++)
91 cout << i << "\t" << fCounters[i] << endl;
93 if (fCounters.GetSize() == 0)
95 cout << "(none)" << endl;
101 AliHLTTriggerDecision::Print(option);
102 cout << "#################### Input trigger decisions ####################" << endl;
103 for (Int_t i = 0; i < NumberOfTriggerInputs(); i++)
105 cout << "-------------------- Input trigger decision " << i << " --------------------" << endl;
106 TriggerInput(i)->Print(option);
108 if (NumberOfTriggerInputs() == 0)
110 cout << "(none)" << endl;
112 cout << "###################### Other input objects ######################" << endl;
113 for (Int_t i = 0; i < NumberOfInputObjects(); i++)
115 cout << "------------------------ Input object " << i << " ------------------------" << endl;
116 InputObject(i)->Print(option);
118 if (NumberOfInputObjects() == 0)
120 cout << "(none)" << endl;
122 cout << "#################### Event class counters ####################" << endl;
123 cout << "Counter\tValue" << endl;
124 for (Int_t i = 0; i < fCounters.GetSize(); i++)
126 cout << i << "\t" << fCounters[i] << endl;
128 if (fCounters.GetSize() == 0)
130 cout << "(none)" << endl;
135 void AliHLTGlobalTriggerDecision::Copy(TObject &object) const
137 // copy this to the specified object
139 AliHLTGlobalTriggerDecision* pDecision=dynamic_cast<AliHLTGlobalTriggerDecision*>(&object);
142 // copy members if target is a AliHLTGlobalTriggerDecision
145 // copy the base class
146 AliHLTTriggerDecision::Copy(object);
149 TObject *AliHLTGlobalTriggerDecision::Clone(const char */*newname*/) const
151 // create a new clone, classname is ignored
153 return new AliHLTGlobalTriggerDecision(*this);
156 AliHLTGlobalTriggerDecision::AliHLTGlobalTriggerDecision(const AliHLTGlobalTriggerDecision& src) :
157 AliHLTTriggerDecision(src),
158 fContributingTriggers(AliHLTTriggerDecision::Class()),
166 AliHLTGlobalTriggerDecision& AliHLTGlobalTriggerDecision::operator=(const AliHLTGlobalTriggerDecision& src)
168 // assignment operator
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);
178 //Error("failed to get trigger input #%d", triggerInput);
182 fInputObjects.Delete();
183 for (int inputObject=0; inputObject<src.NumberOfTriggerInputs(); inputObject++) {
184 const TObject* pInputObject=src.InputObject(inputObject);
186 // the AddInputObject function uses Clone() and
187 // makes a new object from the reference
188 AddInputObject(pInputObject);
190 //Error("failed to get trigger input #%d", inputObject);
194 SetCounters(src.Counters());
199 void AliHLTGlobalTriggerDecision::SetCounters(const TArrayL64& counters, Long64_t eventCount)
201 // Sets the counter array.
202 // If the number of events is specified, an additional counter is added at the end.
203 fCounters = counters;
205 int size=fCounters.GetSize();
206 fCounters.Set(size+1);
207 fCounters[size]=eventCount;