]>
Commit | Line | Data |
---|---|---|
06f2306d | 1 | //-*- Mode: C++ -*- |
2 | // $Id: AliHLTMultiplicityCorrelationsComponent.cxx $ | |
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: Jochen Thaeder <jochen@thaeder.de> * | |
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 AliHLTMultiplicityCorrelationsComponent.cxx | |
20 | @author Jochen Thaeder <jochen@thaeder.de> | |
21 | @brief Component for Multiplicty Correlations | |
22 | */ | |
23 | ||
06f2306d | 24 | #include "TMap.h" |
571ad3a5 | 25 | #include "TSystem.h" |
26 | #include "TTimeStamp.h" | |
06f2306d | 27 | #include "TObjString.h" |
82647f59 | 28 | #include "TH1F.h" |
29 | #include "TList.h" | |
11e88ff8 | 30 | #include "AliESDVZERO.h" |
06f2306d | 31 | #include "AliESDtrackCuts.h" |
82647f59 | 32 | #include "AliHLTGlobalTriggerDecision.h" |
06f2306d | 33 | #include "AliHLTMultiplicityCorrelations.h" |
571ad3a5 | 34 | #include <AliHLTDAQ.h> |
82647f59 | 35 | #include "AliHLTCTPData.h" |
06f2306d | 36 | #include "AliHLTErrorGuard.h" |
37 | #include "AliHLTDataTypes.h" | |
38 | #include "AliHLTMultiplicityCorrelationsComponent.h" | |
6c552baa | 39 | #include "AliHLTITSClusterDataFormat.h" |
06f2306d | 40 | |
a7f38894 | 41 | using namespace std; |
42 | ||
06f2306d | 43 | /** ROOT macro for the implementation of ROOT specific class methods */ |
44 | ClassImp(AliHLTMultiplicityCorrelationsComponent) | |
45 | ||
46 | /* | |
47 | * --------------------------------------------------------------------------------- | |
48 | * Constructor / Destructor | |
49 | * --------------------------------------------------------------------------------- | |
50 | */ | |
51 | ||
52 | // ################################################################################# | |
53 | AliHLTMultiplicityCorrelationsComponent::AliHLTMultiplicityCorrelationsComponent() : | |
54 | AliHLTProcessor(), | |
55 | fESDTrackCuts(NULL), | |
571ad3a5 | 56 | fCorrObj(NULL), |
82647f59 | 57 | fUID(0), |
58 | fCentHistV0Mpercentile(NULL), | |
59 | fListTriggerDescriptor(NULL), | |
60 | fListTrigger(NULL), | |
61 | fCTPData(NULL) { | |
06f2306d | 62 | // an example component which implements the ALICE HLT processor |
63 | // interface and does some analysis on the input raw data | |
64 | // | |
65 | // see header file for class documentation | |
66 | // or | |
67 | // refer to README to build package | |
68 | // or | |
69 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
70 | // | |
71 | // NOTE: all helper classes should be instantiated in DoInit() | |
72 | } | |
73 | ||
74 | // ################################################################################# | |
75 | AliHLTMultiplicityCorrelationsComponent::~AliHLTMultiplicityCorrelationsComponent() { | |
76 | // see header file for class documentation | |
77 | } | |
78 | ||
79 | /* | |
80 | * --------------------------------------------------------------------------------- | |
81 | * Public functions to implement AliHLTComponent's interface. | |
82 | * These functions are required for the registration process | |
83 | * --------------------------------------------------------------------------------- | |
84 | */ | |
85 | ||
86 | // ################################################################################# | |
87 | const Char_t* AliHLTMultiplicityCorrelationsComponent::GetComponentID() { | |
88 | // see header file for class documentation | |
89 | return "MultiplicityCorrelations"; | |
90 | } | |
91 | ||
92 | // ################################################################################# | |
93 | void AliHLTMultiplicityCorrelationsComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) { | |
94 | // see header file for class documentation | |
95 | list.push_back(kAliHLTDataTypeESDObject|kAliHLTDataOriginAny); | |
6c552baa | 96 | list.push_back(kAliHLTDataTypeClusters|kAliHLTDataOriginITSSPD); |
11e88ff8 | 97 | list.push_back(kAliHLTDataTypeESDContent|kAliHLTDataOriginVZERO); |
06f2306d | 98 | } |
99 | ||
100 | // ################################################################################# | |
101 | AliHLTComponentDataType AliHLTMultiplicityCorrelationsComponent::GetOutputDataType() { | |
102 | // see header file for class documentation | |
103 | return kAliHLTDataTypeTObject|kAliHLTDataOriginHLT; | |
104 | } | |
105 | ||
106 | // ################################################################################# | |
107 | void AliHLTMultiplicityCorrelationsComponent::GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier ) { | |
108 | // see header file for class documentation | |
1cff6424 | 109 | constBase = 100000; |
06f2306d | 110 | inputMultiplier = 0.5; |
111 | } | |
112 | ||
113 | // ################################################################################# | |
114 | void AliHLTMultiplicityCorrelationsComponent::GetOCDBObjectDescription( TMap* const targetMap) { | |
115 | // see header file for class documentation | |
116 | ||
117 | if (!targetMap) return; | |
118 | targetMap->Add(new TObjString("HLT/ConfigGlobal/MultiplicityCorrelations"), | |
119 | new TObjString("configuration object")); | |
82647f59 | 120 | targetMap->Add(new TObjString("HLT/ConfigGlobal/MultiplicityCorrelationsCentrality"), |
121 | new TObjString("centrality configuration object")); | |
06f2306d | 122 | |
123 | return; | |
124 | } | |
125 | ||
126 | // ################################################################################# | |
127 | AliHLTComponent* AliHLTMultiplicityCorrelationsComponent::Spawn() { | |
128 | // see header file for class documentation | |
129 | return new AliHLTMultiplicityCorrelationsComponent; | |
130 | } | |
131 | ||
132 | /* | |
133 | * --------------------------------------------------------------------------------- | |
134 | * Protected functions to implement AliHLTComponent's interface. | |
135 | * These functions provide initialization as well as the actual processing | |
136 | * capabilities of the component. | |
137 | * --------------------------------------------------------------------------------- | |
138 | */ | |
139 | ||
140 | // ################################################################################# | |
141 | Int_t AliHLTMultiplicityCorrelationsComponent::DoInit( Int_t argc, const Char_t** argv ) { | |
142 | // see header file for class documentation | |
143 | ||
144 | Int_t iResult=0; | |
145 | ||
146 | // -- Initialize members | |
147 | // ----------------------- | |
148 | do { | |
06f2306d | 149 | |
150 | fCorrObj = new AliHLTMultiplicityCorrelations; | |
151 | if (!fCorrObj) { | |
152 | iResult=-ENOMEM; | |
153 | break; | |
154 | } | |
155 | ||
156 | fESDTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","HLT"); | |
157 | if (!fESDTrackCuts) { | |
158 | iResult=-ENOMEM; | |
159 | break; | |
160 | } | |
161 | ||
82647f59 | 162 | fListTriggerDescriptor = new TList; |
163 | if (!fListTriggerDescriptor) { | |
164 | iResult=-ENOMEM; | |
165 | break; | |
166 | } | |
167 | fListTriggerDescriptor->SetOwner(kTRUE); | |
168 | ||
169 | fListTrigger = new TList; | |
170 | if (!fListTrigger) { | |
171 | iResult=-ENOMEM; | |
172 | break; | |
173 | } | |
174 | fListTrigger->SetOwner(kTRUE); | |
175 | ||
571ad3a5 | 176 | fUID = 0; |
06f2306d | 177 | // implement further initialization |
178 | } while (0); | |
179 | ||
180 | if (iResult<0) { | |
181 | // implement cleanup | |
182 | ||
183 | if (fCorrObj) | |
184 | delete fCorrObj; | |
185 | fCorrObj = NULL; | |
186 | ||
187 | if (fESDTrackCuts) | |
188 | delete fESDTrackCuts; | |
189 | fESDTrackCuts = NULL; | |
190 | } | |
191 | ||
192 | if (iResult>=0) { | |
193 | SetDefaultConfiguration(); | |
194 | ||
195 | // -- Read configuration object : HLT/ConfigGlobal/MultiplicityCorrelations | |
196 | TString cdbPath="HLT/ConfigGlobal/"; | |
197 | cdbPath+=GetComponentID(); | |
198 | iResult=ConfigureFromCDBTObjString(cdbPath); | |
199 | ||
200 | // -- Read the component arguments | |
201 | if (iResult>=0) { | |
202 | iResult=ConfigureFromArgumentString(argc, argv); | |
203 | } | |
82647f59 | 204 | |
205 | // -- Read configuration object : HLT/ConfigGlobal/MultiplicityCorrelationsCentrality | |
206 | TString cdbPathCent="HLT/ConfigGlobal/"; | |
207 | cdbPathCent+=GetComponentID(); | |
208 | cdbPathCent+="Centrality"; | |
209 | ||
210 | TObject* obj = LoadAndExtractOCDBObject(cdbPathCent); | |
211 | if (obj && obj->IsA() != TH1F::Class()) | |
212 | iResult=-1; | |
213 | else | |
214 | fCentHistV0Mpercentile = static_cast<TH1F*>(obj); | |
06f2306d | 215 | } |
216 | ||
217 | if (iResult>=0) { | |
218 | HLTInfo("ESD track cuts : %s",fESDTrackCuts->GetTitle() ); | |
219 | ||
220 | fCorrObj->SetESDTrackCuts(fESDTrackCuts); | |
82647f59 | 221 | fCorrObj->SetCentralityEstimator(fCentHistV0Mpercentile); |
06f2306d | 222 | fCorrObj->Initialize(); |
223 | } | |
224 | ||
225 | return iResult; | |
226 | } | |
227 | ||
228 | // ################################################################################# | |
229 | void AliHLTMultiplicityCorrelationsComponent::SetDefaultConfiguration() { | |
230 | // see header file for class documentation | |
231 | ||
232 | if (fESDTrackCuts) { | |
233 | fESDTrackCuts->SetEtaRange(-0.9,0.9); | |
234 | fESDTrackCuts->SetPtRange(0.2,200); | |
235 | fESDTrackCuts->SetMinNClustersTPC(80); | |
236 | ||
237 | fESDTrackCuts->SetDCAToVertex2D(kFALSE); | |
238 | fESDTrackCuts->SetRequireSigmaToVertex(kFALSE); | |
239 | ||
240 | fESDTrackCuts->SetMaxDCAToVertexXY(3.0); | |
241 | fESDTrackCuts->SetMaxDCAToVertexZ(3.0); | |
242 | ||
243 | fESDTrackCuts->SetRequireTPCRefit(kFALSE); | |
244 | fESDTrackCuts->SetRequireITSRefit(kFALSE); | |
245 | } | |
246 | ||
247 | return; | |
248 | } | |
249 | ||
250 | // ################################################################################# | |
251 | Int_t AliHLTMultiplicityCorrelationsComponent::ScanConfigurationArgument(Int_t argc, const Char_t** argv) { | |
252 | // Scan configuration arguments | |
253 | // Return the number of processed arguments | |
254 | // -EPROTO if argument format error (e.g. number expected but not found) | |
255 | // | |
256 | // The AliHLTComponent base class implements a parsing loop for argument strings and | |
257 | // arrays of strings which is invoked by ConfigureFromArgumentString/ConfigureFromCDBTObjString | |
258 | // The component needs to implement ScanConfigurationArgument in order to decode the arguments. | |
259 | ||
260 | if (argc<=0) return 0; | |
261 | Int_t ii =0; | |
262 | TString argument=argv[ii]; | |
263 | ||
264 | if (argument.IsNull()) return 0; | |
265 | ||
266 | if( !fESDTrackCuts){ | |
267 | HLTError("No ESD track cuts availible"); | |
268 | return -ENOMEM; | |
269 | } | |
270 | ||
271 | // --------------------- | |
272 | ||
82647f59 | 273 | // -maxpt |
06f2306d | 274 | if (argument.CompareTo("-maxpt")==0) { |
275 | if (++ii>=argc) return -EPROTO; | |
276 | argument=argv[ii]; | |
277 | ||
278 | Float_t minPt, maxPt; | |
279 | fESDTrackCuts->GetPtRange(minPt,maxPt); | |
280 | maxPt = argument.Atof(); | |
281 | fESDTrackCuts->SetPtRange(minPt,maxPt); | |
282 | ||
283 | TString title = fESDTrackCuts->GetTitle(); | |
284 | if (!title.CompareTo("No track cuts")) title = ""; | |
285 | else title += " && "; | |
286 | title += Form("p_t < %f", maxPt); | |
287 | fESDTrackCuts->SetTitle(title); | |
288 | return 2; | |
289 | } | |
290 | ||
291 | // -minpt | |
292 | if (argument.CompareTo("-minpt")==0) { | |
293 | if (++ii>=argc) return -EPROTO; | |
294 | argument=argv[ii]; | |
295 | ||
296 | Float_t minPt, maxPt; | |
297 | fESDTrackCuts->GetPtRange(minPt,maxPt); | |
298 | minPt = argument.Atof(); | |
299 | fESDTrackCuts->SetPtRange(minPt,maxPt); | |
300 | ||
301 | TString title = fESDTrackCuts->GetTitle(); | |
302 | if (!title.CompareTo("No track cuts")) title = ""; | |
303 | else title += " && "; | |
304 | title += Form("p_t > %f", minPt); | |
305 | fESDTrackCuts->SetTitle(title); | |
306 | return 2; | |
307 | } | |
308 | ||
309 | // -min-ldca | |
310 | // minimum longitudinal dca to vertex | |
311 | if (argument.CompareTo("-min-ldca")==0) { | |
312 | if (++ii>=argc) return -EPROTO; | |
313 | argument=argv[ii]; | |
314 | ||
315 | fESDTrackCuts->SetMinDCAToVertexZ(argument.Atof()); | |
316 | TString title = fESDTrackCuts->GetTitle(); | |
317 | if (!title.CompareTo("No track cuts")) title = ""; | |
318 | else title += " && "; | |
319 | title += Form("DCAz > %f", argument.Atof()); | |
320 | fESDTrackCuts->SetTitle(title); | |
321 | return 2; | |
322 | } | |
323 | ||
324 | // -max-ldca | |
325 | // maximum longitudinal dca to vertex | |
326 | if (argument.CompareTo("-max-ldca")==0) { | |
327 | if (++ii>=argc) return -EPROTO; | |
328 | argument=argv[ii]; | |
329 | ||
330 | fESDTrackCuts->SetMaxDCAToVertexZ(argument.Atof()); | |
331 | TString title = fESDTrackCuts->GetTitle(); | |
332 | if (!title.CompareTo("No track cuts")) title = ""; | |
333 | else title += " && "; | |
334 | title += Form("DCAz < %f", argument.Atof()); | |
335 | fESDTrackCuts->SetTitle(title); | |
336 | return 2; | |
337 | } | |
338 | ||
339 | // -min-tdca | |
340 | // minimum transverse dca to vertex | |
341 | if (argument.CompareTo("-min-tdca")==0) { | |
342 | if (++ii>=argc) return -EPROTO; | |
343 | argument=argv[ii]; | |
344 | ||
345 | fESDTrackCuts->SetMinDCAToVertexXY(argument.Atof()); | |
346 | TString title = fESDTrackCuts->GetTitle(); | |
347 | if (!title.CompareTo("No track cuts")) title = ""; | |
348 | else title += " && "; | |
349 | title += Form("DCAr > %f", argument.Atof()); | |
350 | fESDTrackCuts->SetTitle(title); | |
351 | return 2; | |
352 | } | |
353 | ||
354 | // -max-tdca | |
355 | // maximum transverse dca to vertex | |
356 | if (argument.CompareTo("-max-tdca")==0) { | |
357 | if (++ii>=argc) return -EPROTO; | |
358 | argument=argv[ii]; | |
359 | ||
360 | fESDTrackCuts->SetMaxDCAToVertexXY(argument.Atof()); | |
361 | TString title = fESDTrackCuts->GetTitle(); | |
362 | if (!title.CompareTo("No track cuts")) title = ""; | |
363 | else title += " && "; | |
364 | title += Form("DCAr < %f", argument.Atof()); | |
365 | fESDTrackCuts->SetTitle(title); | |
366 | return 2; | |
367 | } | |
368 | ||
369 | // -etarange | |
370 | // +/- eta | |
371 | if (argument.CompareTo("-etarange")==0) { | |
372 | if (++ii>=argc) return -EPROTO; | |
373 | argument=argv[ii]; | |
374 | Float_t eta = argument.Atof(); | |
375 | ||
376 | fESDTrackCuts->SetEtaRange(-eta,eta); | |
377 | TString title = fESDTrackCuts->GetTitle(); | |
378 | if (!title.CompareTo("No track cuts")) title = ""; | |
379 | else title += " && "; | |
8be55b74 | 380 | title += Form("Eta[%f,%f]", argument.Atof(),argument.Atof()); |
06f2306d | 381 | fESDTrackCuts->SetTitle(title); |
382 | return 2; | |
383 | } | |
384 | ||
06f2306d | 385 | // -- BINNING -------------- |
386 | ||
387 | // binningVzero | |
388 | if (argument.CompareTo("-binningVzero")==0) { | |
389 | if (++ii>=argc) return -EPROTO; | |
390 | argument=argv[ii]; | |
391 | Int_t binning = argument.Atoi(); | |
392 | if (++ii>=argc) return -EPROTO; | |
393 | argument=argv[ii]; | |
394 | Float_t min = argument.Atof(); | |
395 | if (++ii>=argc) return -EPROTO; | |
396 | argument=argv[ii]; | |
397 | Float_t max = argument.Atof(); | |
398 | ||
399 | fCorrObj->SetBinningVzero(binning, min, max); | |
400 | return 4; | |
401 | } | |
402 | ||
403 | // binningTpc | |
404 | if (argument.CompareTo("-binningTpc")==0) { | |
405 | if (++ii>=argc) return -EPROTO; | |
406 | argument=argv[ii]; | |
407 | Int_t binning = argument.Atoi(); | |
408 | if (++ii>=argc) return -EPROTO; | |
409 | argument=argv[ii]; | |
410 | Float_t min = argument.Atof(); | |
411 | if (++ii>=argc) return -EPROTO; | |
412 | argument=argv[ii]; | |
413 | Float_t max = argument.Atof(); | |
414 | ||
415 | fCorrObj->SetBinningTpc(binning, min, max); | |
416 | return 4; | |
417 | } | |
418 | ||
6c552baa | 419 | // binningSpd |
420 | if (argument.CompareTo("-binningSpd")==0) { | |
421 | if (++ii>=argc) return -EPROTO; | |
422 | argument=argv[ii]; | |
423 | Int_t binning = argument.Atoi(); | |
424 | if (++ii>=argc) return -EPROTO; | |
425 | argument=argv[ii]; | |
426 | Float_t min = argument.Atof(); | |
427 | if (++ii>=argc) return -EPROTO; | |
428 | argument=argv[ii]; | |
429 | Float_t max = argument.Atof(); | |
430 | ||
431 | fCorrObj->SetBinningSpd(binning, min, max); | |
432 | return 4; | |
433 | } | |
434 | ||
06f2306d | 435 | // binningZdc |
436 | if (argument.CompareTo("-binningZdc")==0) { | |
437 | if (++ii>=argc) return -EPROTO; | |
438 | argument=argv[ii]; | |
439 | Int_t binning = argument.Atoi(); | |
440 | if (++ii>=argc) return -EPROTO; | |
441 | argument=argv[ii]; | |
442 | Float_t min = argument.Atof(); | |
443 | if (++ii>=argc) return -EPROTO; | |
444 | argument=argv[ii]; | |
445 | Float_t max = argument.Atof(); | |
446 | ||
447 | fCorrObj->SetBinningZdc(binning, min, max); | |
448 | return 4; | |
449 | } | |
450 | ||
06f2306d | 451 | // binningZem |
452 | if (argument.CompareTo("-binningZem")==0) { | |
453 | if (++ii>=argc) return -EPROTO; | |
454 | argument=argv[ii]; | |
455 | Int_t binning = argument.Atoi(); | |
456 | if (++ii>=argc) return -EPROTO; | |
457 | argument=argv[ii]; | |
458 | Float_t min = argument.Atof(); | |
459 | if (++ii>=argc) return -EPROTO; | |
460 | argument=argv[ii]; | |
461 | Float_t max = argument.Atof(); | |
462 | ||
463 | fCorrObj->SetBinningZem(binning, min, max); | |
464 | return 4; | |
465 | } | |
a75a9dbe | 466 | // binningZem |
467 | if (argument.CompareTo("-binningCalo")==0) { | |
468 | if (++ii>=argc) return -EPROTO; | |
469 | argument=argv[ii]; | |
470 | Int_t binning = argument.Atoi(); | |
471 | if (++ii>=argc) return -EPROTO; | |
472 | argument=argv[ii]; | |
473 | Float_t min = argument.Atof(); | |
474 | if (++ii>=argc) return -EPROTO; | |
475 | argument=argv[ii]; | |
476 | Float_t max = argument.Atof(); | |
477 | ||
478 | fCorrObj->SetBinningCalo(binning, min, max); | |
479 | return 4; | |
480 | } | |
60f79eda | 481 | |
482 | // -- enable | |
60f79eda | 483 | if (argument.CompareTo("-enableVZERO")==0) { |
484 | fCorrObj->SetProcessVZERO(kTRUE); | |
485 | return 1; | |
486 | } | |
487 | if (argument.CompareTo("-enableZDC")==0) { | |
488 | fCorrObj->SetProcessZDC(kTRUE); | |
489 | return 1; | |
490 | } | |
491 | if (argument.CompareTo("-enableTPC")==0) { | |
492 | fCorrObj->SetProcessTPC(kTRUE); | |
493 | return 1; | |
494 | } | |
495 | if (argument.CompareTo("-enableSPD")==0) { | |
496 | fCorrObj->SetProcessSPD(kTRUE); | |
497 | return 1; | |
498 | } | |
82647f59 | 499 | if (argument.CompareTo("-enableCentrality")==0) { |
500 | fCorrObj->SetProcessCentrality(kTRUE); | |
60f79eda | 501 | return 1; |
502 | } | |
82647f59 | 503 | |
504 | // -- disable | |
60f79eda | 505 | if (argument.CompareTo("-disableVZERO")==0) { |
506 | fCorrObj->SetProcessVZERO(kFALSE); | |
507 | return 1; | |
508 | } | |
509 | if (argument.CompareTo("-disableZDC")==0) { | |
510 | fCorrObj->SetProcessZDC(kFALSE); | |
511 | return 1; | |
512 | } | |
513 | if (argument.CompareTo("-disableTPC")==0) { | |
514 | fCorrObj->SetProcessTPC(kFALSE); | |
515 | return 1; | |
516 | } | |
517 | if (argument.CompareTo("-disableSPD")==0) { | |
518 | fCorrObj->SetProcessSPD(kFALSE); | |
519 | return 1; | |
520 | } | |
82647f59 | 521 | if (argument.CompareTo("-disableCentrality")==0) { |
522 | fCorrObj->SetProcessCentrality(kFALSE); | |
523 | return 1; | |
524 | } | |
525 | ||
526 | // -- TRIGGER -------------- | |
527 | ||
528 | // -add trigger descriptor | |
529 | if (argument.CompareTo("-addTrigger")==0) { | |
530 | if (++ii>=argc) return -EPROTO; | |
531 | fListTriggerDescriptor->Add(new TObjString(argv[ii])); | |
532 | return 2; | |
533 | } | |
534 | ||
535 | // -- UNKNOWN -------------- | |
60f79eda | 536 | |
06f2306d | 537 | // unknown argument |
538 | return -EINVAL; | |
539 | } | |
540 | ||
541 | // ################################################################################# | |
542 | Int_t AliHLTMultiplicityCorrelationsComponent::DoDeinit() { | |
543 | // see header file for class documentation | |
544 | ||
545 | if (fCorrObj) | |
546 | delete fCorrObj; | |
547 | fCorrObj = NULL; | |
548 | ||
549 | if (fESDTrackCuts) | |
550 | delete fESDTrackCuts; | |
551 | fESDTrackCuts = NULL; | |
552 | ||
571ad3a5 | 553 | fUID = 0; |
554 | ||
06f2306d | 555 | return 0; |
556 | } | |
557 | ||
558 | // ################################################################################# | |
571ad3a5 | 559 | Int_t AliHLTMultiplicityCorrelationsComponent::DoEvent(const AliHLTComponentEventData& evtData, |
06f2306d | 560 | AliHLTComponentTriggerData& /*trigData*/) { |
561 | // see header file for class documentation | |
562 | ||
563 | Int_t iResult=0; | |
564 | ||
565 | // -- Only use data event | |
566 | if (!IsDataEvent()) | |
567 | return 0; | |
571ad3a5 | 568 | |
569 | if( fUID == 0 ){ | |
570 | TTimeStamp t; | |
571 | fUID = ( gSystem->GetPid() + t.GetNanoSec())*10 + evtData.fEventID; | |
572 | } | |
82647f59 | 573 | |
574 | // -- Get ESD object | |
575 | // ------------------- | |
6c552baa | 576 | AliESDEvent *esdEvent = NULL; |
06f2306d | 577 | for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDObject); iter != NULL; iter = GetNextInputObject() ) { |
6c552baa | 578 | esdEvent = dynamic_cast<AliESDEvent*>(const_cast<TObject*>( iter ) ); |
06f2306d | 579 | if( !esdEvent ){ |
580 | HLTWarning("Wrong ESDEvent object received"); | |
581 | iResult = -1; | |
582 | continue; | |
583 | } | |
584 | esdEvent->GetStdContent(); | |
06f2306d | 585 | } |
586 | ||
82647f59 | 587 | // -- Get GlobalTriggerDecision object |
588 | // ------------------------------------- | |
589 | AliHLTGlobalTriggerDecision *globalTrigDec = NULL; | |
590 | for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeGlobalTrigger); iter != NULL; iter = GetNextInputObject() ) { | |
591 | globalTrigDec = dynamic_cast<AliHLTGlobalTriggerDecision*>(const_cast<TObject*>( iter ) ); | |
592 | if( !globalTrigDec ){ | |
593 | HLTWarning("Wrong GlobalTriggerDecision object received"); | |
594 | iResult = -1; | |
595 | continue; | |
596 | } | |
597 | } | |
598 | ||
599 | // -- Get CTP data object | |
600 | // ------------------------ | |
601 | fCTPData = NULL; | |
602 | ||
603 | if (globalTrigDec) { | |
604 | for (Int_t idx = 0; idx < globalTrigDec->NumberOfInputObjects(); ++idx) { | |
605 | const TObject *obj = globalTrigDec->InputObject(idx); | |
606 | ||
607 | if (obj && obj->IsA() == AliHLTCTPData::Class()) | |
608 | fCTPData = static_cast<const AliHLTCTPData*>(obj); | |
609 | } | |
610 | } | |
611 | ||
11e88ff8 | 612 | // -- Get VZEROESD object |
82647f59 | 613 | // ------------------------ |
11e88ff8 | 614 | AliESDVZERO *esdVZERO = NULL; |
615 | for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDContent|kAliHLTDataOriginVZERO); | |
616 | iter != NULL; iter = GetNextInputObject() ) { | |
617 | esdVZERO = dynamic_cast<AliESDVZERO*>(const_cast<TObject*>( iter ) ); | |
618 | if( !esdVZERO ){ | |
619 | HLTWarning("Wrong VZERO ESDEvent object received"); | |
620 | iResult = -1; | |
621 | continue; | |
622 | } | |
623 | } | |
624 | ||
6c552baa | 625 | // -- Get SPD clusters |
626 | // --------------------- | |
627 | const AliHLTComponentBlockData* iter = NULL; | |
571ad3a5 | 628 | Int_t totalClusters = 0; |
629 | Int_t innerClusters = 0; | |
630 | Int_t outerClusters = 0; | |
6c552baa | 631 | |
632 | for ( iter = GetFirstInputBlock(kAliHLTDataTypeClusters|kAliHLTDataOriginITSSPD); | |
633 | iter != NULL; iter = GetNextInputBlock() ) { | |
571ad3a5 | 634 | |
635 | AliHLTITSClusterData *clusterData = reinterpret_cast<AliHLTITSClusterData*>(iter->fPtr); | |
636 | Int_t nClusters = clusterData->fSpacePointCnt; | |
637 | for( int icl=0; icl<nClusters; icl++ ) { | |
638 | AliHLTITSSpacePointData &d = clusterData->fSpacePoints[icl]; | |
639 | if ( d.fLayer == 0 ) ++innerClusters; | |
640 | else if ( d.fLayer == 1 ) ++outerClusters; | |
641 | } | |
6c552baa | 642 | |
571ad3a5 | 643 | totalClusters += nClusters; |
6c552baa | 644 | } |
645 | ||
571ad3a5 | 646 | fCorrObj->SetSPDClusters(innerClusters,outerClusters); |
647 | ||
6c552baa | 648 | // -- Process Event |
649 | // ------------------ | |
82647f59 | 650 | // check that event is selected by PhysicsSelection and TriggerSelection |
651 | if ( esdEvent && IsEventTriggered() && SelectEvent(esdEvent,esdVZERO) ) | |
571ad3a5 | 652 | iResult = fCorrObj->ProcessEvent(esdEvent,esdVZERO,totalClusters); |
6c552baa | 653 | |
06f2306d | 654 | if (iResult) { |
655 | HLTError("Error while processing event inside multiplicity correlation object"); | |
656 | return iResult; | |
657 | } | |
658 | ||
659 | // -- Send histlist | |
660 | PushBack(dynamic_cast<TObject*>(fCorrObj->GetHistList()), | |
571ad3a5 | 661 | kAliHLTDataTypeTObject|kAliHLTDataOriginHLT,fUID); |
06f2306d | 662 | |
663 | return iResult; | |
664 | } | |
665 | ||
666 | // ################################################################################# | |
667 | Int_t AliHLTMultiplicityCorrelationsComponent::Reconfigure(const Char_t* cdbEntry, const Char_t* chainId) { | |
668 | // see header file for class documentation | |
669 | ||
670 | Int_t iResult=0; | |
671 | TString cdbPath; | |
672 | if (cdbEntry) { | |
673 | cdbPath=cdbEntry; | |
674 | } else { | |
675 | cdbPath="HLT/ConfigGlobal/"; | |
676 | cdbPath+=GetComponentID(); | |
677 | } | |
678 | ||
679 | AliInfoClass(Form("reconfigure '%s' from entry %s%s", chainId, cdbPath.Data(), cdbEntry?"":" (default)")); | |
680 | iResult=ConfigureFromCDBTObjString(cdbPath); | |
681 | ||
682 | return iResult; | |
683 | } | |
684 | ||
685 | // ################################################################################# | |
686 | Int_t AliHLTMultiplicityCorrelationsComponent::ReadPreprocessorValues(const Char_t* /*modules*/) { | |
687 | // see header file for class documentation | |
688 | ALIHLTERRORGUARD(5, "ReadPreProcessorValues not implemented for this component"); | |
689 | return 0; | |
690 | } | |
82647f59 | 691 | |
692 | // ################################################################################# | |
693 | Bool_t AliHLTMultiplicityCorrelationsComponent::IsEventTriggered() { | |
694 | // see header file for class documentation | |
695 | ||
696 | if (!fCTPData) | |
697 | return kFALSE; | |
698 | ||
699 | // -- Check if MinBiasTrigger list exists - otherwise create it | |
700 | if ( fListTrigger->GetEntries() == 0 ) | |
701 | CreateTriggerList(); | |
702 | ||
703 | // -- Check if event is selected by one of the MinBiasTriggers | |
704 | for (Int_t ii = 0; ii < fListTrigger->GetEntries(); ++ii) { | |
705 | TObjString *oStr = static_cast<TObjString*>(fListTrigger->At(ii)); | |
706 | TString trigger(oStr->String()); | |
707 | ||
708 | if (fCTPData->EvaluateCTPTriggerClass(trigger)) | |
709 | return kTRUE; | |
710 | } | |
711 | ||
712 | return kFALSE; | |
713 | } | |
714 | ||
715 | // ################################################################################# | |
716 | void AliHLTMultiplicityCorrelationsComponent::CreateTriggerList() { | |
717 | // see header file for class documentation | |
718 | ||
719 | // -- loop over all trigger bits | |
54f70bb6 | 720 | for (Int_t idx = 0 ; idx < 50 ; ++idx) { |
82647f59 | 721 | |
722 | TString triggerName(fCTPData->Name(idx)); | |
723 | ||
724 | // -- used bit | |
725 | if (!triggerName.CompareTo("AliHLTReadoutList")) | |
726 | continue; | |
727 | ||
728 | // -- check for interaction trigger | |
729 | if (!triggerName.Contains("-B-") && !triggerName.Contains("-I-")) | |
730 | continue; | |
731 | ||
732 | Bool_t isMinBias = kFALSE; | |
733 | ||
734 | for (Int_t ii = 0; !isMinBias && ii < fListTriggerDescriptor->GetEntries(); ++ii) { | |
735 | TObjString *oStr = static_cast<TObjString*>(fListTriggerDescriptor->At(ii)); | |
736 | TString str(oStr->String()); | |
737 | ||
738 | if (triggerName.BeginsWith(oStr->String()+"-") || triggerName.BeginsWith(oStr->String()+"WU-") || | |
739 | triggerName.BeginsWith(oStr->String()+"_") || triggerName.BeginsWith(oStr->String()+"WU_")) | |
740 | isMinBias = kTRUE; | |
741 | } | |
742 | ||
743 | if (!isMinBias) | |
744 | continue; | |
745 | ||
746 | fListTrigger->Add(new TObjString(triggerName)); | |
747 | } | |
748 | ||
749 | return; | |
750 | } | |
751 | ||
752 | // ################################################################################# | |
753 | Bool_t AliHLTMultiplicityCorrelationsComponent::SelectEvent(AliESDEvent *esdEvent, AliESDVZERO* esdV0) { | |
754 | // see header file for class documentation | |
755 | ||
756 | if (!esdEvent) | |
757 | return kFALSE; | |
758 | ||
759 | if (!esdV0) | |
760 | esdV0 = esdEvent->GetVZEROData(); | |
761 | ||
762 | if (!esdV0) | |
763 | return kFALSE; | |
764 | ||
765 | return ((esdV0->GetV0ADecision() == 1) && (esdV0->GetV0CDecision() == 1)); | |
766 | } |