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