]>
Commit | Line | Data |
---|---|---|
5f4502cc | 1 | // $Id$ |
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: Gaute Ovrebekk * | |
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 AliHLTTriggerITSMultiplicity.cxx | |
19 | /// @author Gaute Ovrebekk | |
20 | /// @date 2009-10-22 | |
21 | /// @brief HLT trigger component for cluster multiplicity | |
22 | /// in ITS. | |
23 | ||
24 | ||
25 | // see header file for class documentation | |
26 | // or | |
27 | // refer to README to build package | |
28 | // or | |
29 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
30 | ||
31 | #include "AliHLTTriggerITSMultiplicity.h" | |
32 | #include "AliHLTTriggerDecision.h" | |
33 | #include "AliHLTDomainEntry.h" | |
34 | #include "TObjString.h" | |
35 | #include "AliHLTITSClusterDataFormat.h" | |
36 | #include "AliHLTITSSpacePointData.h" | |
37 | ||
38 | /** ROOT macro for the implementation of ROOT specific class methods */ | |
39 | ClassImp(AliHLTTriggerITSMultiplicity) | |
40 | ||
41 | AliHLTTriggerITSMultiplicity::AliHLTTriggerITSMultiplicity() | |
42 | : AliHLTTrigger() | |
43 | , fnClusters(0) | |
44 | { | |
45 | // see header file for class documentation | |
46 | // or | |
47 | // refer to README to build package | |
48 | // or | |
49 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
50 | ||
51 | } | |
52 | ||
53 | const char* AliHLTTriggerITSMultiplicity::fgkOCDBEntry="HLT/ConfigHLT/ITSMultiplicityTrigger"; | |
54 | ||
55 | AliHLTTriggerITSMultiplicity::~AliHLTTriggerITSMultiplicity() | |
56 | { | |
57 | // see header file for class documentation | |
58 | } | |
59 | ||
60 | const char* AliHLTTriggerITSMultiplicity::GetTriggerName() const | |
61 | { | |
62 | // see header file for class documentation | |
63 | return "ITSMultiplicityTrigger"; | |
64 | } | |
65 | ||
66 | AliHLTComponent* AliHLTTriggerITSMultiplicity::Spawn() | |
67 | { | |
68 | // see header file for class documentation | |
69 | return new AliHLTTriggerITSMultiplicity; | |
70 | } | |
71 | ||
72 | int AliHLTTriggerITSMultiplicity::DoTrigger() | |
73 | { | |
74 | // see header file for class documentation | |
75 | int iResult=0; | |
76 | int numberOfClusters=-1; | |
77 | TString description; | |
78 | ||
79 | const AliHLTComponentBlockData* iter = NULL; | |
80 | ||
81 | if(!IsDataEvent()) return 0; | |
82 | ||
83 | for(iter = GetFirstInputBlock(kAliHLTDataTypeClusters); iter != NULL; iter = GetNextInputBlock()){ | |
84 | ||
85 | if(iter->fDataType!=(kAliHLTAnyDataType|kAliHLTDataOriginITSSPD) && | |
86 | iter->fDataType!=(kAliHLTAnyDataType|kAliHLTDataOriginITSSDD) && | |
87 | iter->fDataType!=(kAliHLTAnyDataType|kAliHLTDataOriginITSSSD)) | |
88 | continue; | |
89 | ||
90 | const AliHLTITSClusterData* clusterData = (const AliHLTITSClusterData*) iter->fPtr; | |
91 | Int_t nSpacepoint = (Int_t) clusterData->fSpacePointCnt; | |
92 | numberOfClusters += nSpacepoint; | |
93 | ||
94 | } | |
95 | ||
96 | if (iResult>=0 && numberOfClusters>=0) { | |
97 | ||
98 | if (numberOfClusters>=fnClusters) { | |
99 | description.Form("Event contains %d cluster(s)", numberOfClusters); | |
100 | SetDescription(description.Data()); | |
101 | // Enable the central detectors for readout. | |
102 | GetReadoutList().Enable( | |
103 | AliHLTReadoutList::kITSSPD | | |
104 | AliHLTReadoutList::kITSSDD | | |
105 | AliHLTReadoutList::kITSSSD | | |
106 | AliHLTReadoutList::kTPC | | |
107 | AliHLTReadoutList::kTRD | | |
108 | AliHLTReadoutList::kTOF | | |
109 | AliHLTReadoutList::kHMPID | | |
110 | AliHLTReadoutList::kPHOS | |
111 | ); | |
112 | // Add the available HLT information for readout too. | |
113 | GetTriggerDomain().Add("CLUSTERS", "ITS "); | |
114 | TriggerEvent(true); | |
115 | return 0; | |
116 | } | |
117 | description.Form("No clusters matching the tresholds found (min clusters %d ", fnClusters); | |
118 | } else { | |
119 | description.Form("No input blocks found"); | |
120 | } | |
121 | SetDescription(description.Data()); | |
122 | TriggerEvent(false); | |
123 | return iResult; | |
124 | } | |
125 | ||
126 | int AliHLTTriggerITSMultiplicity::DoInit(int argc, const char** argv) | |
127 | { | |
128 | // see header file for class documentation | |
129 | ||
130 | // first configure the default | |
131 | int iResult=0; | |
132 | if (iResult>=0) iResult=ConfigureFromCDBTObjString(fgkOCDBEntry); | |
133 | ||
134 | // configure from the command line parameters if specified | |
135 | if (iResult>=0 && argc>0) | |
136 | iResult=ConfigureFromArgumentString(argc, argv); | |
137 | return iResult; | |
138 | } | |
139 | ||
140 | int AliHLTTriggerITSMultiplicity::DoDeinit() | |
141 | { | |
142 | // see header file for class documentation | |
143 | return 0; | |
144 | } | |
145 | ||
146 | int AliHLTTriggerITSMultiplicity::Reconfigure(const char* cdbEntry, const char* /*chainId*/) | |
147 | { | |
148 | // see header file for class documentation | |
149 | ||
150 | // configure from the specified antry or the default one | |
151 | const char* entry=cdbEntry; | |
152 | if (!entry || entry[0]==0) { | |
153 | entry=fgkOCDBEntry; | |
154 | } | |
155 | ||
156 | return ConfigureFromCDBTObjString(entry); | |
157 | } | |
158 | ||
159 | int AliHLTTriggerITSMultiplicity::ScanConfigurationArgument(int argc, const char** argv) | |
160 | { | |
161 | // see header file for class documentation | |
162 | if (argc<=0) return 0; | |
163 | int i=0; | |
164 | TString argument=argv[i]; | |
165 | ||
166 | // -nclusters | |
167 | if (argument.CompareTo("-nclusters")==0) { | |
168 | if (++i>=argc) return -EPROTO; | |
169 | argument=argv[i]; | |
8fc88a5c | 170 | fnClusters=argument.Atoi(); |
5f4502cc | 171 | return 2; |
172 | } | |
173 | ||
174 | // unknown argument | |
175 | return -EINVAL; | |
176 | } |