]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/trigger/AliHLTTriggerMenu.cxx
Finished code for global HLT trigger and the trigger menu implementation.
[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 {
37   // Default constructor.
38 }
39
40
41 AliHLTTriggerMenu::~AliHLTTriggerMenu()
42 {
43   // Default destructor.
44 }
45
46
47 AliHLTTriggerMenu::AliHLTTriggerMenu(const AliHLTTriggerMenu& obj) :
48   TObject(obj),
49   fName(obj.fName),
50   fSymbols(AliHLTTriggerMenuSymbol::Class(), obj.fSymbols.GetEntriesFast()),
51   fItems(AliHLTTriggerMenuItem::Class(), obj.fItems.GetEntriesFast())
52 {
53   // Copy constructor performs a deep copy.
54   
55   for (UInt_t i = 0; i < obj.NumberOfSymbols(); i++)
56   {
57     AddSymbol(*obj.Symbol(i));
58   }
59   for (UInt_t i = 0; i < obj.NumberOfItems(); i++)
60   {
61     AddItem(*obj.Item(i));
62   }
63 }
64
65
66 AliHLTTriggerMenu& AliHLTTriggerMenu::operator = (const AliHLTTriggerMenu& obj)
67 {
68   // Assignment operator performs a deep copy.
69   
70   if (this != &obj)
71   {
72     TObject::operator = (obj);
73     fName = obj.fName;
74     fItems.Clear();
75     for (UInt_t i = 0; i < obj.NumberOfSymbols(); i++)
76     {
77       AddSymbol(*obj.Symbol(i));
78     }
79     for (UInt_t i = 0; i < obj.NumberOfItems(); i++)
80     {
81       AddItem(*obj.Item(i));
82     }
83   }
84   return *this;
85 }
86
87
88 void AliHLTTriggerMenu::Print(Option_t* option) const
89 {
90   // Prints the contents of the trigger menu.
91   
92   cout << "HLT Trigger Menu: " << fName.Data();
93   TString opt = option;
94   if (opt.Contains("short"))
95   {
96     cout << ", contains " << NumberOfItems() << " entries." << endl;
97     return;
98   }
99   cout << endl;
100   cout << setw(10) << "Prescalar" <<  " | "
101        << setw(60) << "Trigger condition" << " | "
102        << setw(60) << "Domain merge expression" << setw(0) << endl;
103   cout << setfill('-') << setw(10) << "-" <<  "-+-"
104        << setw(60) << "-" << "-+-"
105        << setw(60) << "-" << setw(0) << setfill(' ') << endl;
106   for (UInt_t i = 0; i < NumberOfItems(); i++)
107   {
108     Item(i)->Print("compact");
109   }
110   if (NumberOfItems() == 0) cout << "(none)" << endl;
111   cout << "Symbol list:" << endl;
112   cout << setw(15) << "Name"
113        << " | " << setw(20) << "Data type"
114        << " | " << setw(24) << "Block type & spec"
115        << " | " << setw(20) << "Class name"
116        << " | " << setw(25) << "Assigned value"
117        << " | " << setw(25) << "Default value"
118        << setw(0) << endl;
119   cout << setw(15) << setfill('-') << "-"
120        << "-+-" << setw(20) << "-"
121        << "-+-" << setw(24) << "-"
122        << "-+-" << setw(20) << "-"
123        << "-+-" << setw(25) << "-"
124        << "-+-" << setw(25) << "-"
125        << setw(0) << setfill(' ') << endl;
126   for (UInt_t i = 0; i < NumberOfSymbols(); i++)
127   {
128     Symbol(i)->Print("compact");
129   }
130   if (NumberOfSymbols() == 0) cout << "(none)" << endl;
131 }
132