]>
Commit | Line | Data |
---|---|---|
1b41ab20 | 1 | // $Id$ |
2 | ||
d8122453 | 3 | /************************************************************************** |
4 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
5 | * * | |
6 | * Authors: Oystein Djuvsland <oysteind@ift.uib.no> * | |
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 | #include <iostream> | |
18 | ||
19 | #include "AliHLTPHOSMonitorTriggerComponent.h" | |
7fc04b67 | 20 | #include "AliHLTCaloClusterDataStruct.h" |
d8122453 | 21 | #include "AliHLTDataTypes.h" |
22 | ||
23 | /** @file AliHLTPHOSMonitorTriggerComponent.h | |
24 | @author Oystein Djuvsland | |
25 | @date | |
26 | @brief | |
27 | */ | |
28 | ||
29 | // see header file for class documentation | |
30 | // or | |
31 | // refer to README to build package | |
32 | // or | |
33 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
34 | ||
35 | #if __GNUC__>= 3 | |
36 | using namespace std; | |
37 | #endif | |
38 | ||
e304ea31 | 39 | const AliHLTComponentDataType AliHLTPHOSMonitorTriggerComponent::fgkInputDataTypes[]= |
40 | { | |
41 | kAliHLTVoidDataType,{0,"",""} | |
42 | }; | |
43 | ||
d8122453 | 44 | AliHLTPHOSMonitorTriggerComponent gAliHLTPHOSMonitorTriggerComponent; |
45 | ||
46 | ||
47 | AliHLTPHOSMonitorTriggerComponent::AliHLTPHOSMonitorTriggerComponent(): | |
48 | AliHLTPHOSProcessor(), | |
49 | fCheckClusterEnergy(false), | |
50 | fCheckClusterMultiplicities(false), | |
51 | fClusterEnergyThreshold(1), | |
52 | fMultiplicityThreshold(5), | |
53 | fMultEnergyThreshold(0.5), | |
54 | fDigitMultiplicityThreshold(16), | |
e304ea31 | 55 | fMultDigitMultiplicityThreshold(9), |
56 | fLowerCentrality(0.5), | |
57 | fUpperCentrality(0.9) | |
d8122453 | 58 | { |
59 | //See headerfile for documentation | |
60 | } | |
61 | ||
62 | AliHLTPHOSMonitorTriggerComponent::~AliHLTPHOSMonitorTriggerComponent() | |
63 | { | |
64 | //See headerfile for documentation | |
65 | ||
66 | ||
67 | } | |
68 | ||
69 | ||
70 | int | |
71 | AliHLTPHOSMonitorTriggerComponent::Deinit() | |
72 | { | |
73 | //See headerfile for documentation | |
74 | ||
75 | ||
76 | return 0; | |
77 | } | |
78 | ||
79 | const Char_t* | |
80 | AliHLTPHOSMonitorTriggerComponent::GetComponentID() | |
81 | { | |
82 | //See headerfile for documentation | |
83 | ||
84 | return "PhosMonitorTrigger"; | |
85 | } | |
86 | ||
87 | void | |
88 | AliHLTPHOSMonitorTriggerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) | |
89 | { | |
90 | list.clear(); | |
91 | list.push_back(AliHLTPHOSDefinitions::fgkClusterDataType); | |
92 | } | |
93 | ||
94 | AliHLTComponentDataType | |
95 | AliHLTPHOSMonitorTriggerComponent::GetOutputDataType() | |
96 | { | |
97 | //See headerfile for documentation | |
98 | return AliHLTPHOSDefinitions::fgkSandboxDataType; | |
99 | } | |
100 | ||
101 | void | |
102 | AliHLTPHOSMonitorTriggerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier ) | |
103 | ||
104 | { | |
105 | //See headerfile for documentation | |
106 | constBase = sizeof(int); | |
107 | inputMultiplier = 0; | |
108 | } | |
109 | ||
110 | int | |
111 | AliHLTPHOSMonitorTriggerComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, | |
8394d59f | 112 | AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* /*outputPtr*/, AliHLTUInt32_t& /*size*/, |
e304ea31 | 113 | std::vector<AliHLTComponentBlockData>& /*outputBlocks*/) |
d8122453 | 114 | { |
115 | //See headerfile for documentation | |
116 | ||
117 | Int_t specification = 0; | |
118 | Bool_t monitorflag = 0; | |
119 | UInt_t ndx = 0; | |
120 | ||
121 | const AliHLTComponentBlockData* iter = NULL; | |
122 | ||
123 | for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) | |
124 | { | |
125 | iter = blocks+ndx; | |
126 | if ( iter->fDataType != AliHLTPHOSDefinitions::fgkDDLPackedRawDataType ) | |
127 | { | |
128 | HLTDebug("Data block is not of type fgkDDLPackedRawDataType"); | |
129 | continue; | |
130 | } | |
131 | specification |= iter->fSpecification; | |
132 | ||
7fc04b67 | 133 | monitorflag += CheckClusters(reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(iter->fPtr)); |
d8122453 | 134 | |
135 | } | |
136 | ||
137 | if(monitorflag == true) | |
138 | { | |
139 | Int_t blockCount = 1; | |
140 | int ret = ReserveEventDoneData( 1+2+blockCount*4 ); | |
141 | if(!ret) | |
142 | { | |
143 | AliHLTUInt32_t eddWord; | |
144 | ||
145 | eddWord = 5; // kAliHLTEventDoneFlagMonitorEventCmd | |
146 | PushEventDoneData( eddWord ); | |
147 | eddWord = 4; // kAliHLTEventDoneMonitorListCmd | |
148 | PushEventDoneData( eddWord ); | |
149 | eddWord = blockCount; | |
150 | PushEventDoneData( eddWord ); | |
151 | ||
e304ea31 | 152 | //Int_t blockIndex = 0; |
d8122453 | 153 | // low data type |
154 | eddWord = 0; | |
155 | ||
156 | for ( unsigned ii=0; ii<4; ii++ ) | |
157 | { | |
158 | eddWord |= ((AliHLTUInt32_t)(AliHLTPHOSDefinitions::fgkDDLPackedRawDataType.fID[8-1-ii])) << (ii*8); | |
159 | } | |
160 | PushEventDoneData( eddWord ); | |
161 | ||
162 | // high data type | |
163 | eddWord = 0; | |
164 | for ( unsigned ii=0; ii<4; ii++ ) | |
165 | { | |
166 | eddWord |= ((AliHLTUInt32_t)(AliHLTPHOSDefinitions::fgkDDLPackedRawDataType.fID[8-5-ii])) << (ii*8); | |
167 | } | |
168 | PushEventDoneData( eddWord ); | |
169 | ||
170 | // data spec | |
171 | eddWord = 0; | |
172 | for ( unsigned ii=0; ii<4; ii++ ) | |
173 | { | |
174 | eddWord |= ((AliHLTUInt32_t)(AliHLTPHOSDefinitions::fgkDDLPackedRawDataType.fOrigin[4-1-ii])) << (ii*8); | |
175 | } | |
176 | PushEventDoneData( eddWord ); | |
177 | ||
178 | eddWord = specification; | |
179 | PushEventDoneData( eddWord ); | |
180 | } | |
181 | else | |
182 | { | |
183 | HLTWarning("Could not get Event Done Data blocks"); | |
184 | } | |
185 | } | |
186 | ||
187 | return 0; | |
188 | } | |
189 | ||
190 | Bool_t | |
7fc04b67 | 191 | AliHLTPHOSMonitorTriggerComponent::CheckClusters(AliHLTCaloClusterHeaderStruct* clusterHeaderPtr) |
d8122453 | 192 | { |
193 | //See headerfile for documentation | |
e304ea31 | 194 | |
195 | UInt_t nClusters = clusterHeaderPtr->fNClusters; | |
7fdb2519 | 196 | // Float_t* ampFracPtr = 0; |
d8122453 | 197 | |
7fc04b67 | 198 | AliHLTCaloClusterDataStruct* clusterPtr = 0; |
d8122453 | 199 | |
7fc04b67 | 200 | clusterPtr = reinterpret_cast<AliHLTCaloClusterDataStruct*>(clusterHeaderPtr + sizeof(AliHLTCaloClusterHeaderStruct)); |
d8122453 | 201 | |
e304ea31 | 202 | for(UInt_t n = 0; n < nClusters; n++) |
d8122453 | 203 | { |
d8122453 | 204 | if(fCheckClusterEnergy == true && clusterPtr->fEnergy > fClusterEnergyThreshold && clusterPtr->fNCells > fDigitMultiplicityThreshold) |
205 | { | |
7fdb2519 | 206 | /* ampFracPtr = &(clusterPtr->fCellsAmpFraction); |
e304ea31 | 207 | for(UInt_t i = 0; i < clusterPtr->fNCells; i++) |
208 | { | |
209 | if(*ampFracPtr > fLowerCentrality && *ampFracPtr < fUpperCentrality) return true; | |
210 | ampFracPtr += 6; // 6 = sizeof(Short_t) + sizeof(Float_t) | |
7fdb2519 | 211 | }*/ |
d8122453 | 212 | } |
213 | if(fCheckClusterMultiplicities == true && clusterPtr->fEnergy > fMultEnergyThreshold && clusterPtr->fNCells > fMultDigitMultiplicityThreshold) | |
214 | { | |
215 | nClusters++; | |
216 | if(nClusters > fMultiplicityThreshold) | |
217 | { | |
218 | return true; | |
219 | } | |
220 | } | |
7fc04b67 | 221 | clusterPtr += sizeof(AliHLTCaloClusterDataStruct) + 5*clusterPtr->fNCells; //5 = sizeof(Short_t) + sizeof(Float_t) - 1(pair already included) |
d8122453 | 222 | } |
223 | ||
224 | return false; | |
225 | ||
226 | } | |
227 | ||
228 | ||
229 | int | |
230 | AliHLTPHOSMonitorTriggerComponent::DoInit(int argc, const char** argv ) | |
231 | { | |
232 | //See headerfile for documentation | |
233 | ||
d8122453 | 234 | for (int i = 0; i < argc; i++) |
235 | { | |
236 | if(!strcmp("-checkenergy", argv[i])) | |
237 | { | |
238 | fCheckClusterEnergy = true; | |
239 | } | |
240 | if(!strcmp("-checkmultiplicity", argv[i])) | |
241 | { | |
242 | fCheckClusterMultiplicities = true; | |
243 | } | |
244 | if(!strcmp("-energythreshold", argv[i])) | |
245 | { | |
246 | fClusterEnergyThreshold = atof(argv[i+1]); | |
247 | fCheckClusterEnergy = true; | |
248 | } | |
e304ea31 | 249 | if(!strcmp("-multiplicityinclusterE", argv[i])) |
250 | { | |
251 | fDigitMultiplicityThreshold = atoi(argv[i+1]); | |
252 | } | |
d8122453 | 253 | if(!strcmp("-multiplicitythreshold", argv[i])) |
254 | { | |
255 | fMultiplicityThreshold = atoi(argv[i+1]); | |
256 | fCheckClusterMultiplicities = true; | |
257 | } | |
e304ea31 | 258 | if(!strcmp("-multiplicityinclusterMult", argv[i])) |
259 | { | |
260 | fMultDigitMultiplicityThreshold = atoi(argv[i+1]); | |
261 | } | |
262 | if(!strcmp("-centralitylimits", argv[i])) | |
263 | { | |
264 | fLowerCentrality = atof(argv[i+1]); | |
265 | fUpperCentrality = atof(argv[i+2]); | |
266 | } | |
d8122453 | 267 | } |
268 | return 0; | |
269 | } | |
270 | ||
271 | AliHLTComponent* | |
272 | AliHLTPHOSMonitorTriggerComponent::Spawn() | |
273 | { | |
274 | //See headerfile for documentation | |
275 | ||
276 | return new AliHLTPHOSMonitorTriggerComponent(); | |
277 | } |