]>
Commit | Line | Data |
---|---|---|
81d62bb4 | 1 | // $Id$ |
e2bb8ddd | 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 AliHLTTriggerMenu.cxx | |
19 | /// @author Artur Szostak <artursz@iafrica.com> | |
20 | /// @date 19 Dec 2008 | |
21 | /// @brief Implementation of the AliHLTTriggerMenu base class. | |
22 | /// | |
23 | /// The AliHLTTriggerMenu class implements the HLT global trigger menu, | |
24 | /// which defines how and on what events the HLT triggers. | |
25 | ||
26 | #include "AliHLTTriggerMenu.h" | |
27 | #include "Riostream.h" | |
28 | ||
29 | ClassImp(AliHLTTriggerMenu) | |
30 | ||
31 | ||
32 | AliHLTTriggerMenu::AliHLTTriggerMenu() : | |
33 | TObject(), | |
34 | fName("Unknown"), | |
52f67e50 | 35 | fSymbols(AliHLTTriggerMenuSymbol::Class(), 100), |
acc7214e | 36 | fItems(AliHLTTriggerMenuItem::Class(), 100), |
37 | fDefaultDescription(), | |
81d62bb4 | 38 | fDefaultDomain(), |
39 | fDefaultConditionOperator("||"), | |
40 | fDefaultDomainOperator("|") | |
e2bb8ddd | 41 | { |
42 | // Default constructor. | |
43 | } | |
44 | ||
45 | ||
46 | AliHLTTriggerMenu::~AliHLTTriggerMenu() | |
47 | { | |
48 | // Default destructor. | |
49 | } | |
50 | ||
51 | ||
52 | AliHLTTriggerMenu::AliHLTTriggerMenu(const AliHLTTriggerMenu& obj) : | |
53 | TObject(obj), | |
54 | fName(obj.fName), | |
52f67e50 | 55 | fSymbols(AliHLTTriggerMenuSymbol::Class(), obj.fSymbols.GetEntriesFast()), |
acc7214e | 56 | fItems(AliHLTTriggerMenuItem::Class(), obj.fItems.GetEntriesFast()), |
57 | fDefaultDescription(obj.fDefaultDescription), | |
81d62bb4 | 58 | fDefaultDomain(obj.fDefaultDomain), |
59 | fDefaultConditionOperator(obj.fDefaultConditionOperator), | |
60 | fDefaultDomainOperator(obj.fDefaultDomainOperator) | |
e2bb8ddd | 61 | { |
62 | // Copy constructor performs a deep copy. | |
63 | ||
52f67e50 | 64 | for (UInt_t i = 0; i < obj.NumberOfSymbols(); i++) |
65 | { | |
66 | AddSymbol(*obj.Symbol(i)); | |
67 | } | |
e2bb8ddd | 68 | for (UInt_t i = 0; i < obj.NumberOfItems(); i++) |
69 | { | |
70 | AddItem(*obj.Item(i)); | |
71 | } | |
72 | } | |
73 | ||
74 | ||
75 | AliHLTTriggerMenu& AliHLTTriggerMenu::operator = (const AliHLTTriggerMenu& obj) | |
76 | { | |
77 | // Assignment operator performs a deep copy. | |
78 | ||
79 | if (this != &obj) | |
80 | { | |
81 | TObject::operator = (obj); | |
82 | fName = obj.fName; | |
acc7214e | 83 | fSymbols.Clear(); |
52f67e50 | 84 | for (UInt_t i = 0; i < obj.NumberOfSymbols(); i++) |
85 | { | |
86 | AddSymbol(*obj.Symbol(i)); | |
87 | } | |
acc7214e | 88 | fItems.Clear(); |
e2bb8ddd | 89 | for (UInt_t i = 0; i < obj.NumberOfItems(); i++) |
90 | { | |
91 | AddItem(*obj.Item(i)); | |
92 | } | |
acc7214e | 93 | fDefaultDescription = obj.fDefaultDescription; |
94 | fDefaultDomain = obj.fDefaultDomain; | |
81d62bb4 | 95 | fDefaultConditionOperator = obj.fDefaultConditionOperator; |
96 | fDefaultDomainOperator = obj.fDefaultDomainOperator; | |
e2bb8ddd | 97 | } |
98 | return *this; | |
99 | } | |
100 | ||
101 | ||
102 | void AliHLTTriggerMenu::Print(Option_t* option) const | |
103 | { | |
104 | // Prints the contents of the trigger menu. | |
105 | ||
106 | cout << "HLT Trigger Menu: " << fName.Data(); | |
107 | TString opt = option; | |
108 | if (opt.Contains("short")) | |
109 | { | |
110 | cout << ", contains " << NumberOfItems() << " entries." << endl; | |
111 | return; | |
112 | } | |
113 | cout << endl; | |
114 | cout << setw(10) << "Prescalar" << " | " | |
81d62bb4 | 115 | << setw(10) << "Priority" << " | " |
52f67e50 | 116 | << setw(60) << "Trigger condition" << " | " |
117 | << setw(60) << "Domain merge expression" << setw(0) << endl; | |
81d62bb4 | 118 | cout << setfill('-') << setw(10) << "-" << "-+-" << setw(10) << "-" << "-+-" |
52f67e50 | 119 | << setw(60) << "-" << "-+-" |
120 | << setw(60) << "-" << setw(0) << setfill(' ') << endl; | |
e2bb8ddd | 121 | for (UInt_t i = 0; i < NumberOfItems(); i++) |
122 | { | |
123 | Item(i)->Print("compact"); | |
124 | } | |
52f67e50 | 125 | if (NumberOfItems() == 0) cout << "(none)" << endl; |
126 | cout << "Symbol list:" << endl; | |
127 | cout << setw(15) << "Name" | |
128 | << " | " << setw(20) << "Data type" | |
129 | << " | " << setw(24) << "Block type & spec" | |
130 | << " | " << setw(20) << "Class name" | |
131 | << " | " << setw(25) << "Assigned value" | |
132 | << " | " << setw(25) << "Default value" | |
133 | << setw(0) << endl; | |
134 | cout << setw(15) << setfill('-') << "-" | |
135 | << "-+-" << setw(20) << "-" | |
136 | << "-+-" << setw(24) << "-" | |
137 | << "-+-" << setw(20) << "-" | |
138 | << "-+-" << setw(25) << "-" | |
139 | << "-+-" << setw(25) << "-" | |
140 | << setw(0) << setfill(' ') << endl; | |
141 | for (UInt_t i = 0; i < NumberOfSymbols(); i++) | |
142 | { | |
143 | Symbol(i)->Print("compact"); | |
144 | } | |
145 | if (NumberOfSymbols() == 0) cout << "(none)" << endl; | |
81d62bb4 | 146 | cout << "Default trigger condition operator: " << fDefaultConditionOperator << endl; |
147 | cout << " Default trigger domain operator: " << fDefaultDomainOperator << endl; | |
148 | cout << " Default trigger description: \"" << fDefaultDescription << "\"" << endl; | |
acc7214e | 149 | cout << "Default "; fDefaultDomain.Print(); |
e2bb8ddd | 150 | } |
151 | ||
acc7214e | 152 | |
153 | void AliHLTTriggerMenu::Clear(Option_t* option) | |
154 | { | |
155 | // Clears the internal symbol and items arrays. | |
156 | ||
157 | fSymbols.Clear(option); | |
158 | fItems.Clear(option); | |
159 | } | |
81d62bb4 | 160 | |
161 | ||
162 | void AliHLTTriggerMenu::AddSymbol(const AliHLTTriggerMenuSymbol& entry) | |
163 | { | |
164 | // Adds a new symbol to the trigger menu. | |
165 | ||
166 | for (Int_t i = 0; i < fSymbols.GetEntriesFast(); i++) | |
167 | { | |
168 | const char* symbolname = static_cast<AliHLTTriggerMenuSymbol*>(fSymbols.UncheckedAt(i))->Name(); | |
169 | if ( strcmp(symbolname, entry.Name()) == 0 ) | |
170 | { | |
171 | Warning("AliHLTTriggerMenu::AddSymbol", | |
172 | "The symbol '%s' already exists in the trigger menu. Will not add the new entry.", | |
173 | entry.RealName() | |
174 | ); | |
175 | return; | |
176 | } | |
177 | } | |
178 | new (fSymbols[fSymbols.GetEntriesFast()]) AliHLTTriggerMenuSymbol(entry); | |
179 | } | |
180 |