3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Svein Lindal <svein.lindal@fys.uio.no> *
8 //* for The ALICE HLT Project. *
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 //**************************************************************************
19 /// @file AliHLTTriggerTrdClusterMultiplicity.cxx
20 /// @author Svein Lindal
22 /// @brief HLT Minimum Ionizing Particle (MIP) trigger for PHOS
24 // see header file for class documentation
26 // refer to README to build package
28 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
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"
40 /** ROOT macro for the implementation of ROOT specific class methods */
41 ClassImp(AliHLTTriggerTrdClusterMultiplicity)
43 AliHLTTriggerTrdClusterMultiplicity::AliHLTTriggerTrdClusterMultiplicity()
48 // see header file for class documentation
50 // refer to README to build package
52 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlts
55 AliHLTTriggerTrdClusterMultiplicity::~AliHLTTriggerTrdClusterMultiplicity()
57 // see header file for class documentation
60 const char* AliHLTTriggerTrdClusterMultiplicity::GetTriggerName() const
62 // see header file for class documentation
63 return "TrdClusterMultiplicityTrigger";
66 AliHLTComponent* AliHLTTriggerTrdClusterMultiplicity::Spawn()
68 // see header file for class documentation
69 return new AliHLTTriggerTrdClusterMultiplicity;
72 int AliHLTTriggerTrdClusterMultiplicity::DoTrigger()
74 // see header file for class documentation
78 for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(AliHLTTRDDefinitions::fgkClusterDataType);
79 pBlock!=NULL; pBlock=GetNextInputBlock()) {
81 AliHLTTRDUtils::ReadClusters(fClusterArray, pBlock->fPtr, pBlock->fSize);
83 AliTRDcluster* inCluster;
84 Int_t stack[5] = {0,0,0,0,0};
85 for(Int_t count=0; count<fClusterArray->GetEntriesFast(); count++)
87 inCluster=(AliTRDcluster*)fClusterArray->UncheckedAt(count);
88 stack[AliTRDgeometry::GetStack(inCluster->GetDetector())]++;
91 Bool_t trigger=kFALSE;
92 for(Int_t count=0; count<5; count++)
94 if(stack[count]>fClusterMult)trigger=kTRUE;
98 description.Form("Event contains at least one stack with at least %i TRD clusters", fClusterMult);
99 SetDescription(description.Data());
101 // Enable the detectors for readout.
102 GetReadoutList().Enable( AliHLTReadoutList::kTRD );
104 // Add the available HLT information for readout too.
105 GetTriggerDomain().Add(kAliHLTAnyDataTypeID, "TRD");
107 //Set trigger decision
111 description.Form("No stack in this event contains enough clusters");
112 SetDescription(description.Data());
116 HLTDebug(description.Data());
117 fClusterArray->Delete();
124 int AliHLTTriggerTrdClusterMultiplicity::DoInit(int argc, const char** argv)
126 // see header file for class documentation
129 TString configuration="";
131 for (int i=0; i<argc && iResult>=0; i++) {
133 if (!configuration.IsNull()) configuration+=" ";
134 configuration+=argument;
137 if (!configuration.IsNull()) {
138 iResult=Configure(configuration.Data());
141 fClusterArray = new TClonesArray("AliTRDcluster");
145 int AliHLTTriggerTrdClusterMultiplicity::DoDeinit()
147 // see header file for class documentation
149 fClusterArray->Delete();
150 delete fClusterArray;
155 int AliHLTTriggerTrdClusterMultiplicity::Reconfigure(const char* /*cdbEntry*/, const char* /*chainId*/)
157 // see header file for class documentation
159 // configure from the specified antry or the default one
164 int AliHLTTriggerTrdClusterMultiplicity::Configure(const char* arguments){
166 if (!arguments) return iResult;
168 TString allArgs=arguments;
172 TObjArray* pTokens=allArgs.Tokenize(" ");
174 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
175 argument=((TObjString*)pTokens->At(i))->GetString();
176 if (argument.IsNull()) continue;
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();
186 HLTError("unknown argument: %s", argument.Data());
194 HLTError("missing parameter for argument %s", argument.Data());