]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTTriggerDecision.cxx
bugfix: correct range of DDL for specified detector
[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(const AliHLTTriggerDecision& obj) :
42   TObject(obj),
43   fName(obj.fName),
44   fDescription(obj.fDescription),
45   fTriggerDomain(obj.fTriggerDomain)
46 {
47   // Copy constructor performs a deep copy.
48   
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)
52   {
53     ResetBit(15);  // We can clear 'this' objects bit because we performed a deep copy.
54     SetBit(BIT(15));
55   }
56 }
57
58
59 AliHLTTriggerDecision::AliHLTTriggerDecision(bool result, const char* name) :
60   TObject(),
61   fName(name),
62   fDescription(),
63   fTriggerDomain()
64 {
65   // Constructor specifying the name and result of the trigger decision.
66   
67   Result(result);
68 }
69
70
71 AliHLTTriggerDecision::AliHLTTriggerDecision(
72     bool result, const char* name,
73     const AliHLTTriggerDomain& triggerDomain,
74     const char* description
75   ) :
76   TObject(),
77   fName(name),
78   fDescription(description),
79   fTriggerDomain(triggerDomain)
80 {
81   // Constructor specifying all information fields.
82   
83   Result(result);
84 }
85
86
87 AliHLTTriggerDecision::~AliHLTTriggerDecision()
88 {
89   // Default destructor.
90 }
91
92
93 bool AliHLTTriggerDecision::Result() const
94 {
95   // Returns the result of the trigger decision.
96   
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;
100   
101   return TestBit(BIT(15)) == 1;
102 }
103
104
105 void AliHLTTriggerDecision::Result(bool value)
106 {
107   // Sets the result of the trigger decision.
108   SetBit(BIT(15), value);
109   
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
116   // and cleanup.
117   if (TestBits(15) == 15) ResetBit(6);
118 }
119
120
121 void AliHLTTriggerDecision::ReadoutList(const AliHLTReadoutList& value)
122 {
123   // Replaces the readout list in the trigger domain with the new value.
124   
125   AliHLTReadoutList fullReadout = ~ AliHLTReadoutList(0x0);
126   fTriggerDomain.Remove(fullReadout);
127   fTriggerDomain.Add(value);
128 }
129
130
131 void AliHLTTriggerDecision::Print(Option_t* option) const
132 {
133   // Prints the contents of the trigger decision.
134   
135   cout << "Trigger (" << fName.Data() << ") result = " << Result() << endl;
136   TString opt(option);
137   if (opt.Contains("short")) return;
138   cout << "Description = \"" << fDescription.Data() << "\"" << endl;
139   fTriggerDomain.Print();
140 }
141
142 void AliHLTTriggerDecision::Copy(TObject &object) const
143 {
144   // copy this to the specified object
145
146   AliHLTTriggerDecision* pDecision=dynamic_cast<AliHLTTriggerDecision*>(&object);
147   if (pDecision) {
148     // copy members if target is a AliHLTTriggerDecision
149     *pDecision=*this;
150   }
151
152   // copy the base class
153   TObject::Copy(object);
154 }
155
156 TObject *AliHLTTriggerDecision::Clone(const char */*newname*/) const
157 {
158   // create a new clone, classname is ignored
159
160   return new AliHLTTriggerDecision(*this);
161 }
162
163 Option_t *AliHLTTriggerDecision::GetOption() const
164 {
165   // Return the result of the trigger.
166   // "0" or "1"
167   if (Result()) return "1";
168   return "0";
169 }
170
171
172 AliHLTTriggerDecision& AliHLTTriggerDecision::operator = (const AliHLTTriggerDecision& obj)
173 {
174   // Assignment operator performs a deep copy.
175   
176   if (this == &obj) return *this;
177   
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)
182   {
183     ResetBit(15);  // We can clear 'this' objects bit because we performed a deep copy.
184     SetBit(BIT(15));
185   }
186   
187   fName = obj.fName;
188   fDescription = obj.fDescription;
189   fTriggerDomain = obj.fTriggerDomain;
190   return *this;
191 }
192
193
194 void AliHLTTriggerDecision::Clear(Option_t* option)
195 {
196   // Clears the trigger domain and resets the decision result.
197   
198   Result(false);
199   fTriggerDomain.Clear(option);
200 }