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 #include "AliHLTMisc.h"
30 ClassImp(AliHLTGlobalTriggerDecision)
33 AliHLTGlobalTriggerDecision::AliHLTGlobalTriggerDecision() :
34 AliHLTTriggerDecision(0, "HLTGlobalTrigger"),
35 fContributingTriggers(AliHLTTriggerDecision::Class()),
39 // Default constructor.
43 AliHLTGlobalTriggerDecision::AliHLTGlobalTriggerDecision(
44 bool result, const AliHLTTriggerDomain& triggerDomain, const char* description
46 AliHLTTriggerDecision(result, "HLTGlobalTrigger", triggerDomain, description),
47 fContributingTriggers(AliHLTTriggerDecision::Class()),
51 // Constructor specifying multiple information fields.
54 fInputObjects.SetOwner(kTRUE);
58 AliHLTGlobalTriggerDecision::~AliHLTGlobalTriggerDecision()
60 // Default destructor.
64 void AliHLTGlobalTriggerDecision::Print(Option_t* option) const
66 // Prints the contents of the trigger decision.
69 if (opt.Contains("compact"))
72 AliHLTTriggerDecision::Print("");
74 else if (opt.Contains("short"))
77 AliHLTTriggerDecision::Print(option);
78 cout << "#################### Input trigger decisions ####################" << endl;
79 for (Int_t i = 0; i < NumberOfTriggerInputs(); i++)
81 if (TriggerInput(i)) TriggerInput(i)->Print(option);
83 if (NumberOfTriggerInputs() == 0)
85 cout << "(none)" << endl;
88 else if (opt.Contains("counters"))
90 cout << "Counter\tValue" << endl;
91 for (Int_t i = 0; i < fCounters.GetSize(); i++)
93 cout << i << "\t" << fCounters[i] << endl;
95 if (fCounters.GetSize() == 0)
97 cout << "(none)" << endl;
103 AliHLTTriggerDecision::Print(option);
104 cout << "#################### Input trigger decisions ####################" << endl;
105 for (Int_t i = 0; i < NumberOfTriggerInputs(); i++)
107 cout << "-------------------- Input trigger decision " << i << " --------------------" << endl;
108 if (TriggerInput(i)) TriggerInput(i)->Print(option);
110 if (NumberOfTriggerInputs() == 0)
112 cout << "(none)" << endl;
114 cout << "###################### Other input objects ######################" << endl;
115 for (Int_t i = 0; i < NumberOfInputObjects(); i++)
117 cout << "------------------------ Input object " << i << " ------------------------" << endl;
118 if (InputObject(i)) InputObject(i)->Print(option);
120 if (NumberOfInputObjects() == 0)
122 cout << "(none)" << endl;
124 cout << "#################### Event class counters ####################" << endl;
125 cout << "Counter\tValue" << endl;
126 for (Int_t i = 0; i < fCounters.GetSize(); i++)
128 cout << i << "\t" << fCounters[i] << endl;
130 if (fCounters.GetSize() == 0)
132 cout << "(none)" << endl;
137 void AliHLTGlobalTriggerDecision::Copy(TObject &object) const
139 // copy this to the specified object
141 if (object.IsA() == AliHLTMisc::Instance().IsAliESDHLTDecision()) {
142 AliHLTMisc::Instance().Copy(this, &object);
146 AliHLTGlobalTriggerDecision* pDecision=dynamic_cast<AliHLTGlobalTriggerDecision*>(&object);
149 // copy members if target is a AliHLTGlobalTriggerDecision
152 // copy the base class
153 AliHLTTriggerDecision::Copy(object);
156 TObject *AliHLTGlobalTriggerDecision::Clone(const char */*newname*/) const
158 // create a new clone, classname is ignored
160 return new AliHLTGlobalTriggerDecision(*this);
163 AliHLTGlobalTriggerDecision::AliHLTGlobalTriggerDecision(const AliHLTGlobalTriggerDecision& src) :
164 AliHLTTriggerDecision(src),
165 fContributingTriggers(AliHLTTriggerDecision::Class()),
173 AliHLTGlobalTriggerDecision& AliHLTGlobalTriggerDecision::operator=(const AliHLTGlobalTriggerDecision& src)
175 // assignment operator
177 fContributingTriggers.Delete();
178 for (int triggerInput=0; triggerInput<src.NumberOfTriggerInputs(); triggerInput++) {
179 const AliHLTTriggerDecision* pTriggerObject=src.TriggerInput(triggerInput);
180 if (pTriggerObject) {
181 // the AddTriggerInput function uses the copy constructor and
182 // makes a new object from the reference
183 AddTriggerInput(*pTriggerObject);
185 //Error("failed to get trigger input #%d", triggerInput);
189 fInputObjects.Delete();
190 for (int inputObject=0; inputObject<src.NumberOfTriggerInputs(); inputObject++) {
191 const TObject* pInputObject=src.InputObject(inputObject);
193 // the AddInputObject function uses Clone() and
194 // makes a new object from the reference
195 AddInputObject(pInputObject);
197 //Error("failed to get trigger input #%d", inputObject);
201 SetCounters(src.Counters());
206 void AliHLTGlobalTriggerDecision::SetCounters(const TArrayL64& counters, Long64_t eventCount)
208 // Sets the counter array.
209 // If the number of events is specified, an additional counter is added at the end.
210 fCounters = counters;
212 int size=fCounters.GetSize();
213 fCounters.Set(size+1);
214 fCounters[size]=eventCount;