]>
Commit | Line | Data |
---|---|---|
8b12d288 | 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: Matthias.Richter@ift.uib.no * | |
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 AliESDHLTDecision.cxx | |
19 | /// @author matthias.richter@ift.uib.no | |
20 | /// @date 23 Nov 2009 | |
21 | /// @brief Container for HLT decision within the ESD | |
22 | /// | |
23 | /// A container for the HLT trigger decision stored in the ESD. | |
24 | /// The HLT trigger decision is evaluated by the HLTGlobalTrigger component | |
25 | /// according to different trigger inputs and the HLT trigger menu. | |
26 | ||
27 | #include "AliESDHLTDecision.h" | |
28 | #include <iostream> | |
29 | ||
30 | using namespace std; | |
31 | ||
32 | ClassImp(AliESDHLTDecision) | |
33 | ||
34 | AliESDHLTDecision::AliESDHLTDecision() | |
35 | : TNamed(fgkName, "") | |
36 | , fInputObjectInfo(TNamed::Class()) | |
37 | , fTriggerItems() | |
38 | , fCounters() | |
39 | { | |
40 | /// constructor | |
41 | } | |
42 | ||
43 | const char* AliESDHLTDecision::fgkName="HLTGlobalTrigger"; | |
44 | ||
45 | AliESDHLTDecision::AliESDHLTDecision(bool result, const char* description) | |
46 | : TNamed(fgkName, description) | |
47 | , fInputObjectInfo(TNamed::Class()) | |
48 | , fTriggerItems() | |
49 | , fCounters() | |
50 | { | |
51 | /// constructor | |
52 | SetBit(kTriggerResult, result); | |
53 | } | |
54 | ||
55 | AliESDHLTDecision::AliESDHLTDecision(const AliESDHLTDecision& src) | |
56 | : TNamed(src) | |
57 | , fInputObjectInfo(src.fInputObjectInfo) | |
58 | , fTriggerItems(src.fTriggerItems) | |
59 | , fCounters(src.fCounters) | |
60 | { | |
61 | /// copy constructor, performs a deep copy | |
62 | } | |
63 | ||
64 | AliESDHLTDecision& AliESDHLTDecision::operator=(const AliESDHLTDecision& src) | |
65 | { | |
66 | /// assignment operator | |
67 | TNamed::operator=(src); | |
68 | ||
69 | fInputObjectInfo=src.fInputObjectInfo; | |
70 | fTriggerItems=src.fTriggerItems; | |
71 | fCounters=src.fCounters; | |
72 | ||
73 | return *this; | |
74 | } | |
75 | ||
76 | AliESDHLTDecision::~AliESDHLTDecision() | |
77 | { | |
78 | /// destructor | |
79 | fInputObjectInfo.Delete(); | |
80 | } | |
81 | ||
82 | const char* AliESDHLTDecision::GetDescription() const | |
83 | { | |
84 | /// get the description of the global trigger decision | |
85 | return GetTitle(); | |
86 | } | |
87 | ||
88 | Bool_t AliESDHLTDecision::IsTriggerFired(const char* name) const | |
89 | { | |
90 | /// check whether the HLT global trigger has fired, or | |
91 | /// for a specific HLT trigger class if specified | |
92 | ||
93 | // TODO: the complete functionality must be implemented | |
94 | // The HLT global trigger evaluates the trigger decision | |
95 | // according to the trigger input and the trigger menu. It | |
96 | // supports priority groups, allowing items to take precedence | |
97 | // over others. The simplest scheme is an 'OR' of all items. | |
98 | // This is implemented here, and the full and correct handling | |
99 | // needs to be implemented. | |
100 | Option_t* option=this->GetOption(); | |
101 | if (option==NULL || *option!='1') return kFALSE; | |
102 | ||
103 | if (name) { | |
104 | TString description=GetDescription(); | |
105 | Int_t index=description.Index(name); | |
106 | if (index<0) return kFALSE; | |
107 | index+=strlen(name); | |
108 | if (index>=description.Length()) return kFALSE; | |
109 | if (description[index]!=0 && description[index]!=' ') return kFALSE; | |
110 | } | |
111 | return kTRUE; | |
112 | } | |
113 | ||
114 | void AliESDHLTDecision::Print(Option_t* option ) const | |
115 | { | |
116 | /// Inherited from TObject. Print Information. | |
117 | TString opt(option); | |
118 | if (opt.Contains("compact")) | |
119 | { | |
120 | cout << "Global Trigger " << GetName() << ": result = " << TestBit(kTriggerResult) << endl; | |
121 | cout << " Description = \"" << GetDescription() << "\"" << endl; | |
122 | } | |
123 | else if (opt.Contains("short")) | |
124 | { | |
125 | cout << "Global Trigger " << GetName() << ": result = " << TestBit(kTriggerResult) << endl; | |
126 | cout << " Description = \"" << GetDescription() << "\"" << endl; | |
127 | cout << "#################### Input trigger decisions ####################" << endl; | |
128 | TIter next(&fInputObjectInfo); | |
129 | TObject* object=NULL; | |
130 | int count=0; | |
131 | while ((object=next())) { | |
132 | if (object->TestBit(kTriggerDecision)) { | |
133 | count++; | |
134 | cout << "Trigger " << object->GetName() << ": result = " << object->TestBit(kTriggerResult) << endl; | |
135 | cout << " Description = \"" << object->GetTitle() << "\"" << endl; | |
136 | } | |
137 | } | |
138 | if (count==0) { | |
139 | cout << "(none)" << endl; | |
140 | } | |
141 | } | |
142 | else if (opt.Contains("counters")) | |
143 | { | |
144 | cout << "Counter\tValue" << endl; | |
145 | for (Int_t i = 0; i < fCounters.GetSize(); i++) | |
146 | { | |
147 | cout << i << "\t" << fCounters[i] << endl; | |
148 | } | |
149 | if (fCounters.GetSize() == 0) | |
150 | { | |
151 | cout << "(none)" << endl; | |
152 | } | |
153 | } | |
154 | else | |
155 | { | |
156 | TObject* object=NULL; | |
157 | cout << "Global Trigger " << GetName() << ": result = " << TestBit(kTriggerResult) << endl; | |
158 | cout << " Description = \"" << GetDescription() << "\"" << endl; | |
159 | cout << "#################### Input trigger decisions ####################" << endl; | |
160 | TIter next(&fInputObjectInfo); | |
161 | int count=0; | |
162 | while ((object=next())) { | |
163 | if (object->TestBit(kTriggerDecision)) { | |
164 | count++; | |
165 | cout << "Trigger " << object->GetName() << ": result = " << object->TestBit(kTriggerResult) << endl; | |
166 | cout << " Description = \"" << object->GetTitle() << "\"" << endl; | |
167 | } | |
168 | } | |
169 | if (count==0) { | |
170 | cout << "(none)" << endl; | |
171 | } | |
172 | cout << "###################### Other input objects ######################" << endl; | |
173 | count=0; | |
174 | next.Reset(); | |
175 | while ((object=next())) { | |
176 | if (!object->TestBit(kTriggerDecision)) { | |
177 | cout << "------------------------ Input object " << count << " ------------------------" << endl; | |
178 | object->Print(option); | |
179 | count++; | |
180 | } | |
181 | } | |
182 | if (count==0) { | |
183 | cout << "(none)" << endl; | |
184 | } | |
185 | cout << "#################### Event class counters ####################" << endl; | |
186 | cout << "Counter\tValue" << endl; | |
187 | for (Int_t i = 0; i < fCounters.GetSize(); i++) | |
188 | { | |
189 | cout << i << "\t" << fCounters[i] << endl; | |
190 | } | |
191 | if (fCounters.GetSize() == 0) | |
192 | { | |
193 | cout << "(none)" << endl; | |
194 | } | |
195 | } | |
196 | } | |
197 | ||
198 | void AliESDHLTDecision::Copy(TObject &object) const | |
199 | { | |
200 | /// Inherited from TObject. Copy this to the specified object. | |
201 | if (object.IsA() != IsA()) return; | |
202 | ||
203 | AliESDHLTDecision& target=dynamic_cast<AliESDHLTDecision&>(object); | |
204 | target=*this; | |
205 | } | |
206 | ||
207 | TObject *AliESDHLTDecision::Clone(const char */*newname*/) const | |
208 | { | |
209 | /// Inherited from TObject. Create a new clone. | |
210 | return new AliESDHLTDecision(*this); | |
211 | } |