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 AliHLTTriggerDecision.cxx
19 /// @author Artur Szostak <artursz@iafrica.com>
21 /// @brief Implementation of the AliHLTTriggerDecision class.
23 /// The trigger decision class stores the HLT decision from an AliHLTTrigger component.
25 #include "AliHLTTriggerDecision.h"
26 #include "Riostream.h"
28 ClassImp(AliHLTTriggerDecision)
31 AliHLTTriggerDecision::AliHLTTriggerDecision() :
37 // Default constructor.
41 AliHLTTriggerDecision::AliHLTTriggerDecision(const AliHLTTriggerDecision& obj) :
44 fDescription(obj.fDescription),
45 fTriggerDomain(obj.fTriggerDomain)
47 // Copy constructor performs a deep copy.
49 // The following is a backward compatibility fix to be able to read trigger
50 // decisions recorded before the fix in AliRoot trunk rev. 35998 correctly.
51 if (obj.TestBits(15) == 15)
53 ResetBit(15); // We can clear 'this' objects bit because we performed a deep copy.
59 AliHLTTriggerDecision::AliHLTTriggerDecision(bool result, const char* name) :
65 // Constructor specifying the name and result of the trigger decision.
71 AliHLTTriggerDecision::AliHLTTriggerDecision(
72 bool result, const char* name,
73 const AliHLTTriggerDomain& triggerDomain,
74 const char* description
78 fDescription(description),
79 fTriggerDomain(triggerDomain)
81 // Constructor specifying all information fields.
87 AliHLTTriggerDecision::~AliHLTTriggerDecision()
89 // Default destructor.
93 bool AliHLTTriggerDecision::Result() const
95 // Returns the result of the trigger decision.
97 // The following is a backward compatibility fix to be able to read trigger
98 // decisions recorded before the fix in AliRoot trunk rev. 35998 correctly.
99 if (TestBits(15) == 15) return true;
101 return TestBit(BIT(15)) == 1;
105 void AliHLTTriggerDecision::Result(bool value)
107 // Sets the result of the trigger decision.
108 SetBit(BIT(15), value);
110 // The following is a backward compatibility fix to be able to read trigger
111 // decisions recorded before the fix in AliRoot trunk rev. 35998 correctly.
112 // It looks like bit 1 and 2 of fBits are not used in the case of the
113 // AliHLTTriggerDecision class, so reset those to prevent "TestBits(15) == 15"
114 // from succeeding in the "Result() const" method above.
115 // We do not touch the other two bits because they could affect memory handling
117 if (TestBits(15) == 15) ResetBit(6);
121 void AliHLTTriggerDecision::ReadoutList(const AliHLTReadoutList& value)
123 // Replaces the readout list in the trigger domain with the new value.
125 AliHLTReadoutList fullReadout = ~ AliHLTReadoutList(0x0);
126 fTriggerDomain.Remove(fullReadout);
127 fTriggerDomain.Add(value);
131 void AliHLTTriggerDecision::Print(Option_t* option) const
133 // Prints the contents of the trigger decision.
135 cout << "Trigger (" << fName.Data() << ") result = " << Result() << endl;
137 if (opt.Contains("short")) return;
138 cout << "Description = \"" << fDescription.Data() << "\"" << endl;
139 fTriggerDomain.Print();
142 void AliHLTTriggerDecision::Copy(TObject &object) const
144 // copy this to the specified object
146 AliHLTTriggerDecision* pDecision=dynamic_cast<AliHLTTriggerDecision*>(&object);
148 // copy members if target is a AliHLTTriggerDecision
152 // copy the base class
153 TObject::Copy(object);
156 TObject *AliHLTTriggerDecision::Clone(const char */*newname*/) const
158 // create a new clone, classname is ignored
160 return new AliHLTTriggerDecision(*this);
163 Option_t *AliHLTTriggerDecision::GetOption() const
165 // Return the result of the trigger.
167 if (Result()) return "1";
172 AliHLTTriggerDecision& AliHLTTriggerDecision::operator = (const AliHLTTriggerDecision& obj)
174 // Assignment operator performs a deep copy.
176 if (this == &obj) return *this;
178 TObject::operator = (obj);
179 // The following is a backward compatibility fix to be able to read trigger
180 // decisions recorded before the fix in AliRoot trunk rev. 35998 correctly.
181 if (obj.TestBits(15) == 15)
183 ResetBit(15); // We can clear 'this' objects bit because we performed a deep copy.
188 fDescription = obj.fDescription;
189 fTriggerDomain = obj.fTriggerDomain;
194 void AliHLTTriggerDecision::Clear(Option_t* option)
196 // Clears the trigger domain and resets the decision result.
199 fTriggerDomain.Clear(option);