]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/trigger/AliHLTTriggerMenu.cxx
dding default trigger description and trigger domain parameters for AliHLTTriggerMenu...
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTTriggerMenu.cxx
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project        *
3  * ALICE Experiment at CERN, All rights reserved.                         *
4  *                                                                        *
5  * Primary Authors: Artur Szostak <artursz@iafrica.com>                   *
6  *                  for The ALICE HLT Project.                            *
7  *                                                                        *
8  * Permission to use, copy, modify and distribute this software and its   *
9  * documentation strictly for non-commercial purposes is hereby granted   *
10  * without fee, provided that the above copyright notice appears in all   *
11  * copies and that both the copyright notice and this permission notice   *
12  * appear in the supporting documentation. The authors make no claims     *
13  * about the suitability of this software for any purpose. It is          *
14  * provided "as is" without express or implied warranty.                  *
15  **************************************************************************/
16
17 /// @file   AliHLTTriggerMenu.cxx
18 /// @author Artur Szostak <artursz@iafrica.com>
19 /// @date   19 Dec 2008
20 /// @brief  Implementation of the AliHLTTriggerMenu base class.
21 ///
22 /// The AliHLTTriggerMenu class implements the HLT global trigger menu,
23 /// which defines how and on what events the HLT triggers.
24
25 #include "AliHLTTriggerMenu.h"
26 #include "Riostream.h"
27
28 ClassImp(AliHLTTriggerMenu)
29
30
31 AliHLTTriggerMenu::AliHLTTriggerMenu() :
32   TObject(),
33   fName("Unknown"),
34   fSymbols(AliHLTTriggerMenuSymbol::Class(), 100),
35   fItems(AliHLTTriggerMenuItem::Class(), 100),
36   fDefaultDescription(),
37   fDefaultDomain()
38 {
39   // Default constructor.
40 }
41
42
43 AliHLTTriggerMenu::~AliHLTTriggerMenu()
44 {
45   // Default destructor.
46 }
47
48
49 AliHLTTriggerMenu::AliHLTTriggerMenu(const AliHLTTriggerMenu& obj) :
50   TObject(obj),
51   fName(obj.fName),
52   fSymbols(AliHLTTriggerMenuSymbol::Class(), obj.fSymbols.GetEntriesFast()),
53   fItems(AliHLTTriggerMenuItem::Class(), obj.fItems.GetEntriesFast()),
54   fDefaultDescription(obj.fDefaultDescription),
55   fDefaultDomain(obj.fDefaultDomain)
56 {
57   // Copy constructor performs a deep copy.
58   
59   for (UInt_t i = 0; i < obj.NumberOfSymbols(); i++)
60   {
61     AddSymbol(*obj.Symbol(i));
62   }
63   for (UInt_t i = 0; i < obj.NumberOfItems(); i++)
64   {
65     AddItem(*obj.Item(i));
66   }
67 }
68
69
70 AliHLTTriggerMenu& AliHLTTriggerMenu::operator = (const AliHLTTriggerMenu& obj)
71 {
72   // Assignment operator performs a deep copy.
73   
74   if (this != &obj)
75   {
76     TObject::operator = (obj);
77     fName = obj.fName;
78     fSymbols.Clear();
79     for (UInt_t i = 0; i < obj.NumberOfSymbols(); i++)
80     {
81       AddSymbol(*obj.Symbol(i));
82     }
83     fItems.Clear();
84     for (UInt_t i = 0; i < obj.NumberOfItems(); i++)
85     {
86       AddItem(*obj.Item(i));
87     }
88     fDefaultDescription = obj.fDefaultDescription;
89     fDefaultDomain = obj.fDefaultDomain;
90   }
91   return *this;
92 }
93
94
95 void AliHLTTriggerMenu::Print(Option_t* option) const
96 {
97   // Prints the contents of the trigger menu.
98   
99   cout << "HLT Trigger Menu: " << fName.Data();
100   TString opt = option;
101   if (opt.Contains("short"))
102   {
103     cout << ", contains " << NumberOfItems() << " entries." << endl;
104     return;
105   }
106   cout << endl;
107   cout << setw(10) << "Prescalar" <<  " | "
108        << setw(60) << "Trigger condition" << " | "
109        << setw(60) << "Domain merge expression" << setw(0) << endl;
110   cout << setfill('-') << setw(10) << "-" <<  "-+-"
111        << setw(60) << "-" << "-+-"
112        << setw(60) << "-" << setw(0) << setfill(' ') << endl;
113   for (UInt_t i = 0; i < NumberOfItems(); i++)
114   {
115     Item(i)->Print("compact");
116   }
117   if (NumberOfItems() == 0) cout << "(none)" << endl;
118   cout << "Symbol list:" << endl;
119   cout << setw(15) << "Name"
120        << " | " << setw(20) << "Data type"
121        << " | " << setw(24) << "Block type & spec"
122        << " | " << setw(20) << "Class name"
123        << " | " << setw(25) << "Assigned value"
124        << " | " << setw(25) << "Default value"
125        << setw(0) << endl;
126   cout << setw(15) << setfill('-') << "-"
127        << "-+-" << setw(20) << "-"
128        << "-+-" << setw(24) << "-"
129        << "-+-" << setw(20) << "-"
130        << "-+-" << setw(25) << "-"
131        << "-+-" << setw(25) << "-"
132        << setw(0) << setfill(' ') << endl;
133   for (UInt_t i = 0; i < NumberOfSymbols(); i++)
134   {
135     Symbol(i)->Print("compact");
136   }
137   if (NumberOfSymbols() == 0) cout << "(none)" << endl;
138   cout << "Default trigger description: \"" << fDefaultDescription << "\"" << endl;
139   cout << "Default "; fDefaultDomain.Print();
140 }
141
142
143 void AliHLTTriggerMenu::Clear(Option_t* option)
144 {
145   // Clears the internal symbol and items arrays.
146   
147   fSymbols.Clear(option);
148   fItems.Clear(option);
149 }