]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/trigger/AliHLTTriggerTrdClusterMultiplicity.cxx
make generation of monitoring trigger an optional feature
[u/mrichter/AliRoot.git] / HLT / trigger / AliHLTTriggerTrdClusterMultiplicity.cxx
CommitLineData
495570cd 1// $Id$
2//-*- Mode: C++ -*-
3//**************************************************************************
4//* This file is property of and copyright by the ALICE HLT Project *
5//* ALICE Experiment at CERN, All rights reserved. *
6//* *
7//* Primary Authors: Svein Lindal <svein.lindal@fys.uio.no> *
8//* for The ALICE HLT Project. *
9//* *
10//* Permission to use, copy, modify and distribute this software and its *
11//* documentation strictly for non-commercial purposes is hereby granted *
12//* without fee, provided that the above copyright notice appears in all *
13//* copies and that both the copyright notice and this permission notice *
14//* appear in the supporting documentation. The authors make no claims *
15//* about the suitability of this software for any purpose. It is *
16//* provided "as is" without express or implied warranty. *
17//**************************************************************************
18
19/// @file AliHLTTriggerTrdClusterMultiplicity.cxx
20/// @author Svein Lindal
21/// @date 2009-08-19
22/// @brief HLT Minimum Ionizing Particle (MIP) trigger for PHOS
23
24// see header file for class documentation
25// or
26// refer to README to build package
27// or
28// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
29
30
31#include "AliHLTTriggerTrdClusterMultiplicity.h"
32#include "AliHLTTriggerDecision.h"
33#include "AliHLTDomainEntry.h"
34#include "AliHLTTRDDefinitions.h"
35#include "AliHLTTRDUtils.h"
36#include "AliHLTTRDCluster.h"
37#include "AliTRDgeometry.h"
38#include "TObjString.h"
39
40/** ROOT macro for the implementation of ROOT specific class methods */
41ClassImp(AliHLTTriggerTrdClusterMultiplicity)
42
43AliHLTTriggerTrdClusterMultiplicity::AliHLTTriggerTrdClusterMultiplicity()
44 : AliHLTTrigger()
45 , fClusterMult(10)
46 , fClusterArray(NULL)
47{
48 // see header file for class documentation
49 // or
50 // refer to README to build package
51 // or
52 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlts
53}
54
55AliHLTTriggerTrdClusterMultiplicity::~AliHLTTriggerTrdClusterMultiplicity()
56{
57 // see header file for class documentation
58}
59
60const char* AliHLTTriggerTrdClusterMultiplicity::GetTriggerName() const
61{
62 // see header file for class documentation
63 return "TrdClusterMultiplicityTrigger";
64}
65
66AliHLTComponent* AliHLTTriggerTrdClusterMultiplicity::Spawn()
67{
68 // see header file for class documentation
69 return new AliHLTTriggerTrdClusterMultiplicity;
70}
71
72int AliHLTTriggerTrdClusterMultiplicity::DoTrigger()
73{
74 // see header file for class documentation
75
76 TString description;
77
78 for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(AliHLTTRDDefinitions::fgkClusterDataType);
79 pBlock!=NULL; pBlock=GetNextInputBlock()) {
80
81 AliHLTTRDUtils::ReadClusters(fClusterArray, pBlock->fPtr, pBlock->fSize);
82
83 AliTRDcluster* inCluster;
84 Int_t stack[5] = {0,0,0,0,0};
85 for(Int_t count=0; count<fClusterArray->GetEntriesFast(); count++)
86 {
87 inCluster=(AliTRDcluster*)fClusterArray->UncheckedAt(count);
88 stack[AliTRDgeometry::GetStack(inCluster->GetDetector())]++;
89 }
90
91 Bool_t trigger=kFALSE;
92 for(Int_t count=0; count<5; count++)
93 {
94 if(stack[count]>fClusterMult)trigger=kTRUE;
95 }
96
97 if(trigger){
98 description.Form("Event contains at least one stack with at least %i TRD clusters", fClusterMult);
99 SetDescription(description.Data());
100
101 // Enable the detectors for readout.
102 GetReadoutList().Enable( AliHLTReadoutList::kTRD );
103
104 // Add the available HLT information for readout too.
105 GetTriggerDomain().Add(kAliHLTAnyDataTypeID, "TRD");
106
107 //Set trigger decision
108 TriggerEvent(true);
109
110 }else{
111 description.Form("No stack in this event contains enough clusters");
112 SetDescription(description.Data());
113 TriggerEvent(false);
114 }
115
116 HLTDebug(description.Data());
117 fClusterArray->Delete();
118
119 return 0;
120 }
121 return 0;
122}
123
124int AliHLTTriggerTrdClusterMultiplicity::DoInit(int argc, const char** argv)
125{
126 // see header file for class documentation
127 int iResult=0;
128
129 TString configuration="";
130 TString argument="";
131 for (int i=0; i<argc && iResult>=0; i++) {
132 argument=argv[i];
133 if (!configuration.IsNull()) configuration+=" ";
134 configuration+=argument;
135 }
136
137 if (!configuration.IsNull()) {
138 iResult=Configure(configuration.Data());
139 }
140
141 fClusterArray = new TClonesArray("AliTRDcluster");
142 return 0;
143}
144
145int AliHLTTriggerTrdClusterMultiplicity::DoDeinit()
146{
147 // see header file for class documentation
148
149 fClusterArray->Delete();
150 delete fClusterArray;
151
152 return 0;
153}
154
155int AliHLTTriggerTrdClusterMultiplicity::Reconfigure(const char* /*cdbEntry*/, const char* /*chainId*/)
156{
157 // see header file for class documentation
158
159 // configure from the specified antry or the default one
160
161 return 0;
162}
163
164int AliHLTTriggerTrdClusterMultiplicity::Configure(const char* arguments){
165 int iResult=0;
166 if (!arguments) return iResult;
167
168 TString allArgs=arguments;
169 TString argument;
170 int bMissingParam=0;
171
172 TObjArray* pTokens=allArgs.Tokenize(" ");
173 if (pTokens) {
174 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
175 argument=((TObjString*)pTokens->At(i))->GetString();
176 if (argument.IsNull()) continue;
177
178 if (argument.CompareTo("-MultiplicityThresh")==0) {
179 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
180 HLTInfo("Setting multiplicity threshold to: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
181 fClusterMult=((TObjString*)pTokens->At(i))->GetString().Atoi();
182 continue;
183 }
184
185 else {
186 HLTError("unknown argument: %s", argument.Data());
187 iResult=-EINVAL;
188 break;
189 }
190 }
191 delete pTokens;
192 }
193 if (bMissingParam) {
194 HLTError("missing parameter for argument %s", argument.Data());
195 iResult=-EINVAL;
196 }
197 return iResult;
198}