]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTTriggerDecision.cxx
adding Copy and Clone methods inherited from TObject for abstract access and
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTTriggerDecision.cxx
1 // $Id$
2 /**************************************************************************
3  * This file is property of and copyright by the ALICE HLT Project        *
4  * ALICE Experiment at CERN, All rights reserved.                         *
5  *                                                                        *
6  * Primary Authors: Artur Szostak <artursz@iafrica.com>                   *
7  *                  for The ALICE HLT Project.                            *
8  *                                                                        *
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  **************************************************************************/
17
18 /// @file   AliHLTTriggerDecision.cxx
19 /// @author Artur Szostak <artursz@iafrica.com>
20 /// @date   21 Nov 2008
21 /// @brief  Implementation of the AliHLTTriggerDecision class.
22 /// 
23 /// The trigger decision class stores the HLT decision from an AliHLTTrigger component.
24
25 #include "AliHLTTriggerDecision.h"
26 #include "Riostream.h"
27
28 ClassImp(AliHLTTriggerDecision)
29
30
31 AliHLTTriggerDecision::AliHLTTriggerDecision() :
32   TObject(),
33   fName(),
34   fDescription(),
35   fTriggerDomain()
36 {
37   // Default constructor.
38 }
39
40
41 AliHLTTriggerDecision::AliHLTTriggerDecision(bool result, const char* name) :
42   TObject(),
43   fName(name),
44   fDescription(),
45   fTriggerDomain()
46 {
47   // Constructor specifying the name and result of the trigger decision.
48   
49   Result(result);
50 }
51
52
53 AliHLTTriggerDecision::AliHLTTriggerDecision(
54     bool result, const char* name,
55     const AliHLTTriggerDomain& triggerDomain,
56     const char* description
57   ) :
58   TObject(),
59   fName(name),
60   fDescription(description),
61   fTriggerDomain(triggerDomain)
62 {
63   // Constructor specifying all information fields.
64   
65   Result(result);
66 }
67
68
69 AliHLTTriggerDecision::~AliHLTTriggerDecision()
70 {
71   // Default destructor.
72 }
73
74
75 void AliHLTTriggerDecision::Print(Option_t* option) const
76 {
77   // Prints the contents of the trigger decision.
78   
79   cout << "Trigger (" << fName.Data() << ") result = " << Result() << endl;
80   TString opt(option);
81   if (opt.Contains("short")) return;
82   cout << "Description = \"" << fDescription.Data() << "\"" << endl;
83   fTriggerDomain.Print();
84 }
85
86 void AliHLTTriggerDecision::Copy(TObject &object) const
87 {
88   // copy this to the specified object
89
90   AliHLTTriggerDecision* pDecision=dynamic_cast<AliHLTTriggerDecision*>(&object);
91   if (pDecision) {
92     // copy members if target is a AliHLTTriggerDecision
93     *pDecision=*this;
94   }
95
96   // copy the base class
97   TObject::Copy(object);
98 }
99
100 TObject *AliHLTTriggerDecision::Clone(const char */*newname*/) const
101 {
102   // create a new clone, classname is ignored
103
104   return new AliHLTTriggerDecision(*this);
105 }
106
107 Option_t *AliHLTTriggerDecision::GetOption() const
108 {
109   // Return the result of the trigger.
110   // "0" or "1"
111   if (Result()) return "1";
112   return "0";
113 }