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.
41 fInputObjects.SetOwner(kTRUE);
45 AliHLTGlobalTriggerDecision::AliHLTGlobalTriggerDecision(
46 bool result, const AliHLTTriggerDomain& triggerDomain, const char* description
48 AliHLTTriggerDecision(result, "HLTGlobalTrigger", triggerDomain, description),
49 fContributingTriggers(AliHLTTriggerDecision::Class()),
53 // Constructor specifying multiple information fields.
56 fInputObjects.SetOwner(kTRUE);
60 AliHLTGlobalTriggerDecision::~AliHLTGlobalTriggerDecision()
62 // Default destructor.
66 void AliHLTGlobalTriggerDecision::Print(Option_t* option) const
68 // Prints the contents of the trigger decision.
71 if (opt.Contains("compact"))
74 AliHLTTriggerDecision::Print("");
76 else if (opt.Contains("short"))
79 AliHLTTriggerDecision::Print(option);
80 cout << "#################### Input trigger decisions ####################" << endl;
81 for (Int_t i = 0; i < NumberOfTriggerInputs(); i++)
83 if (TriggerInput(i)) TriggerInput(i)->Print(option);
85 if (NumberOfTriggerInputs() == 0)
87 cout << "(none)" << endl;
90 else if (opt.Contains("counters"))
92 cout << "Counter\tValue" << endl;
93 for (Int_t i = 0; i < fCounters.GetSize(); i++)
95 cout << i << "\t" << fCounters[i] << endl;
97 if (fCounters.GetSize() == 0)
99 cout << "(none)" << endl;
105 AliHLTTriggerDecision::Print(option);
106 cout << "#################### Input trigger decisions ####################" << endl;
107 for (Int_t i = 0; i < NumberOfTriggerInputs(); i++)
109 cout << "-------------------- Input trigger decision " << i << " --------------------" << endl;
110 if (TriggerInput(i)) TriggerInput(i)->Print(option);
112 if (NumberOfTriggerInputs() == 0)
114 cout << "(none)" << endl;
116 cout << "###################### Other input objects ######################" << endl;
117 for (Int_t i = 0; i < NumberOfInputObjects(); i++)
119 cout << "------------------------ Input object " << i << " ------------------------" << endl;
120 if (InputObject(i)) InputObject(i)->Print(option);
122 if (NumberOfInputObjects() == 0)
124 cout << "(none)" << endl;
126 cout << "#################### Event class counters ####################" << endl;
127 cout << "Counter\tValue" << endl;
128 for (Int_t i = 0; i < fCounters.GetSize(); i++)
130 cout << i << "\t" << fCounters[i] << endl;
132 if (fCounters.GetSize() == 0)
134 cout << "(none)" << endl;
139 void AliHLTGlobalTriggerDecision::Copy(TObject &object) const
141 // copy this to the specified object
143 if (object.IsA() == AliHLTMisc::Instance().IsAliESDHLTDecision()) {
144 AliHLTMisc::Instance().Copy(this, &object);
148 AliHLTGlobalTriggerDecision* pDecision=dynamic_cast<AliHLTGlobalTriggerDecision*>(&object);
151 // copy members if target is a AliHLTGlobalTriggerDecision
154 // copy the base class
155 AliHLTTriggerDecision::Copy(object);
158 TObject *AliHLTGlobalTriggerDecision::Clone(const char */*newname*/) const
160 // create a new clone, classname is ignored
162 return new AliHLTGlobalTriggerDecision(*this);
165 AliHLTGlobalTriggerDecision::AliHLTGlobalTriggerDecision(const AliHLTGlobalTriggerDecision& src) :
166 AliHLTTriggerDecision(src),
167 fContributingTriggers(AliHLTTriggerDecision::Class()),
172 fInputObjects.SetOwner(kTRUE);
176 AliHLTGlobalTriggerDecision& AliHLTGlobalTriggerDecision::operator=(const AliHLTGlobalTriggerDecision& src)
178 // assignment operator
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);
188 //Error("failed to get trigger input #%d", triggerInput);
192 fInputObjects.Delete();
193 for (int inputObject=0; inputObject<src.NumberOfTriggerInputs(); inputObject++) {
194 const TObject* pInputObject=src.InputObject(inputObject);
196 // the AddInputObject function uses Clone() and
197 // makes a new object from the reference
198 AddInputObject(pInputObject);
200 //Error("failed to get trigger input #%d", inputObject);
204 SetCounters(src.Counters());
209 void AliHLTGlobalTriggerDecision::SetCounters(const TArrayL64& counters, Long64_t eventCount)
211 // Sets the counter array.
212 // If the number of events is specified, an additional counter is added at the end.
213 fCounters = counters;
215 int size=fCounters.GetSize();
216 fCounters.Set(size+1);
217 fCounters[size]=eventCount;