]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/trigger/AliHLTGlobalTrigger.cxx
including the CTPData to the input objects of the HLTGlobalTriggerDecision
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTGlobalTrigger.cxx
CommitLineData
c580e182 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 AliHLTGlobalTrigger.cxx
19/// @author Artur Szostak <artursz@iafrica.com>
20/// @date 19 Dec 2008
21/// @brief Implementation of the AliHLTGlobalTrigger base class.
22///
23/// The AliHLTGlobalTriggerComponent class is an abstract class from which a
24/// derived class is constructed by AliHLTTriggerMenu on the fly. The derived
25/// class then implements triggering based on the particular trigger menu.
26
27#include "AliHLTGlobalTrigger.h"
28#include "AliHLTGlobalTriggerDecision.h"
29#include <cstring>
30
31ClassImp(AliHLTGlobalTrigger)
32
33// Static factory array.
34AliHLTGlobalTrigger::Factory*
35AliHLTGlobalTrigger::Factory::fFactory[AliHLTGlobalTrigger::Factory::kMaxFactories]
36 = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
37
38
39AliHLTGlobalTrigger::AliHLTGlobalTrigger() :
52f67e50 40 AliHLTLogging(),
e2bb8ddd 41 fCounters()
42{
43 // Default constructor.
44}
45
46
47AliHLTGlobalTrigger::~AliHLTGlobalTrigger()
48{
49 // Default destructor.
50}
51
52
53AliHLTGlobalTrigger* AliHLTGlobalTrigger::Factory::CreateNew(const char* name)
54{
55 // Creates a new instance of the named trigger class.
56
57 for (int i = 0; i < kMaxFactories; i++)
58 {
59 if (fFactory[i] != NULL)
60 {
61 if (strcmp(fFactory[i]->ClassName(), name) == 0)
62 {
63 return fFactory[i]->New();
64 }
65 }
66 }
67 return NULL;
68}
69
70
52f67e50 71AliHLTGlobalTrigger::Factory::Factory() : AliHLTLogging()
e2bb8ddd 72{
73 // Default constructor resisters the class factory.
74
75 for (int i = 0; i < kMaxFactories; i++)
76 {
77 if (fFactory[i] == NULL)
78 {
79 fFactory[i] = this;
80 return;
81 }
82 }
83
84 HLTFatal("Trying to register too many global trigger factories.");
85}
86
87
88AliHLTGlobalTrigger::Factory::~Factory()
89{
90 // The default destructor deregisters the factory.
91
92 for (int i = 0; i < kMaxFactories; i++)
93 {
94 if (fFactory[i] == this)
95 {
96 fFactory[i] = NULL;
97 return;
98 }
99 }
100
101 HLTFatal("Could not find factory to deregister.");
102}
103
52f67e50 104
105void AliHLTGlobalTrigger::ResetCounters(UInt_t number)
106{
107 // Resets the trigger counters.
108
109 fCounters.Set(number);
110 for (UInt_t i = 0; i < number; i++)
111 {
112 fCounters[i] = 0;
113 }
114}
115