]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTTriggerDecision.cxx
Changes required to handle software triggers correctly in the global trigger component.
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTTriggerDecision.cxx
index a7e5bd62476f103df6d760f745bd255090e549cc..f934d3806c50ba76764e0437aca0c9ac79c1a4c6 100644 (file)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
 /**************************************************************************
  * This file is property of and copyright by the ALICE HLT Project        *
  * ALICE Experiment at CERN, All rights reserved.                         *
@@ -38,6 +38,24 @@ AliHLTTriggerDecision::AliHLTTriggerDecision() :
 }
 
 
+AliHLTTriggerDecision::AliHLTTriggerDecision(const AliHLTTriggerDecision& obj) :
+  TObject(obj),
+  fName(obj.fName),
+  fDescription(obj.fDescription),
+  fTriggerDomain(obj.fTriggerDomain)
+{
+  // Copy constructor performs a deep copy.
+  
+  // The following is a backward compatibility fix to be able to read trigger
+  // decisions recorded before the fix in AliRoot trunk rev. 35998 correctly.
+  if (obj.TestBits(15) == 15)
+  {
+    ResetBit(15);  // We can clear 'this' objects bit because we performed a deep copy.
+    SetBit(BIT(15));
+  }
+}
+
+
 AliHLTTriggerDecision::AliHLTTriggerDecision(bool result, const char* name) :
   TObject(),
   fName(name),
@@ -72,6 +90,44 @@ AliHLTTriggerDecision::~AliHLTTriggerDecision()
 }
 
 
+bool AliHLTTriggerDecision::Result() const
+{
+  // Returns the result of the trigger decision.
+  
+  // The following is a backward compatibility fix to be able to read trigger
+  // decisions recorded before the fix in AliRoot trunk rev. 35998 correctly.
+  if (TestBits(15) == 15) return true;
+  
+  return TestBit(BIT(15)) == 1;
+}
+
+
+void AliHLTTriggerDecision::Result(bool value)
+{
+  // Sets the result of the trigger decision.
+  SetBit(BIT(15), value);
+  
+  // The following is a backward compatibility fix to be able to read trigger
+  // decisions recorded before the fix in AliRoot trunk rev. 35998 correctly.
+  // It looks like bit 1 and 2 of fBits are not used in the case of the
+  // AliHLTTriggerDecision class, so reset those to prevent "TestBits(15) == 15"
+  // from succeeding in the "Result() const" method above.
+  // We do not touch the other two bits because they could affect memory handling
+  // and cleanup.
+  if (TestBits(15) == 15) ResetBit(6);
+}
+
+
+void AliHLTTriggerDecision::ReadoutList(const AliHLTReadoutList& value)
+{
+  // Replaces the readout list in the trigger domain with the new value.
+  
+  AliHLTReadoutList fullReadout = ~ AliHLTReadoutList(0x0);
+  fTriggerDomain.Remove(fullReadout);
+  fTriggerDomain.Add(value);
+}
+
+
 void AliHLTTriggerDecision::Print(Option_t* option) const
 {
   // Prints the contents of the trigger decision.
@@ -83,3 +139,62 @@ void AliHLTTriggerDecision::Print(Option_t* option) const
   fTriggerDomain.Print();
 }
 
+void AliHLTTriggerDecision::Copy(TObject &object) const
+{
+  // copy this to the specified object
+
+  AliHLTTriggerDecision* pDecision=dynamic_cast<AliHLTTriggerDecision*>(&object);
+  if (pDecision) {
+    // copy members if target is a AliHLTTriggerDecision
+    *pDecision=*this;
+  }
+
+  // copy the base class
+  TObject::Copy(object);
+}
+
+TObject *AliHLTTriggerDecision::Clone(const char */*newname*/) const
+{
+  // create a new clone, classname is ignored
+
+  return new AliHLTTriggerDecision(*this);
+}
+
+Option_t *AliHLTTriggerDecision::GetOption() const
+{
+  // Return the result of the trigger.
+  // "0" or "1"
+  if (Result()) return "1";
+  return "0";
+}
+
+
+AliHLTTriggerDecision& AliHLTTriggerDecision::operator = (const AliHLTTriggerDecision& obj)
+{
+  // Assignment operator performs a deep copy.
+  
+  if (this == &obj) return *this;
+  
+  TObject::operator = (obj);
+  // The following is a backward compatibility fix to be able to read trigger
+  // decisions recorded before the fix in AliRoot trunk rev. 35998 correctly.
+  if (obj.TestBits(15) == 15)
+  {
+    ResetBit(15);  // We can clear 'this' objects bit because we performed a deep copy.
+    SetBit(BIT(15));
+  }
+  
+  fName = obj.fName;
+  fDescription = obj.fDescription;
+  fTriggerDomain = obj.fTriggerDomain;
+  return *this;
+}
+
+
+void AliHLTTriggerDecision::Clear(Option_t* option)
+{
+  // Clears the trigger domain and resets the decision result.
+  
+  Result(false);
+  fTriggerDomain.Clear(option);
+}