]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/global/physics/AliHLTMultiplicityCorrelationsComponent.cxx
- adding E_t - V0 correlations
[u/mrichter/AliRoot.git] / HLT / global / physics / AliHLTMultiplicityCorrelationsComponent.cxx
CommitLineData
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
25using namespace std;
26#endif
27
28#include "TMap.h"
29#include "TObjString.h"
30
31#include "AliESDtrackCuts.h"
32#include "AliHLTMultiplicityCorrelations.h"
33
34#include "AliHLTErrorGuard.h"
35#include "AliHLTDataTypes.h"
36#include "AliHLTMultiplicityCorrelationsComponent.h"
37
38/** ROOT macro for the implementation of ROOT specific class methods */
39ClassImp(AliHLTMultiplicityCorrelationsComponent)
40
41/*
42 * ---------------------------------------------------------------------------------
43 * Constructor / Destructor
44 * ---------------------------------------------------------------------------------
45 */
46
47// #################################################################################
48AliHLTMultiplicityCorrelationsComponent::AliHLTMultiplicityCorrelationsComponent() :
49 AliHLTProcessor(),
50 fESDTrackCuts(NULL),
51 fCorrObj(NULL) {
52 // an example component which implements the ALICE HLT processor
53 // interface and does some analysis on the input raw data
54 //
55 // see header file for class documentation
56 // or
57 // refer to README to build package
58 // or
59 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
60 //
61 // NOTE: all helper classes should be instantiated in DoInit()
62}
63
64// #################################################################################
65AliHLTMultiplicityCorrelationsComponent::~AliHLTMultiplicityCorrelationsComponent() {
66 // see header file for class documentation
67}
68
69/*
70 * ---------------------------------------------------------------------------------
71 * Public functions to implement AliHLTComponent's interface.
72 * These functions are required for the registration process
73 * ---------------------------------------------------------------------------------
74 */
75
76// #################################################################################
77const Char_t* AliHLTMultiplicityCorrelationsComponent::GetComponentID() {
78 // see header file for class documentation
79 return "MultiplicityCorrelations";
80}
81
82// #################################################################################
83void AliHLTMultiplicityCorrelationsComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
84 // see header file for class documentation
85 list.push_back(kAliHLTDataTypeESDObject|kAliHLTDataOriginAny);
86}
87
88// #################################################################################
89AliHLTComponentDataType AliHLTMultiplicityCorrelationsComponent::GetOutputDataType() {
90 // see header file for class documentation
91 return kAliHLTDataTypeTObject|kAliHLTDataOriginHLT;
92}
93
94// #################################################################################
95void AliHLTMultiplicityCorrelationsComponent::GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier ) {
96 // see header file for class documentation
97 constBase = 1000;
98 inputMultiplier = 0.5;
99}
100
101// #################################################################################
102void AliHLTMultiplicityCorrelationsComponent::GetOCDBObjectDescription( TMap* const targetMap) {
103 // see header file for class documentation
104
105 if (!targetMap) return;
106 targetMap->Add(new TObjString("HLT/ConfigGlobal/MultiplicityCorrelations"),
107 new TObjString("configuration object"));
108
109 return;
110}
111
112// #################################################################################
113AliHLTComponent* AliHLTMultiplicityCorrelationsComponent::Spawn() {
114 // see header file for class documentation
115 return new AliHLTMultiplicityCorrelationsComponent;
116}
117
118/*
119 * ---------------------------------------------------------------------------------
120 * Protected functions to implement AliHLTComponent's interface.
121 * These functions provide initialization as well as the actual processing
122 * capabilities of the component.
123 * ---------------------------------------------------------------------------------
124 */
125
126// #################################################################################
127Int_t AliHLTMultiplicityCorrelationsComponent::DoInit( Int_t argc, const Char_t** argv ) {
128 // see header file for class documentation
129
130 Int_t iResult=0;
131
132 // -- Initialize members
133 // -----------------------
134 do {
135 if (iResult<0) break;
136
137
138 fCorrObj = new AliHLTMultiplicityCorrelations;
139 if (!fCorrObj) {
140 iResult=-ENOMEM;
141 break;
142 }
143
144 fESDTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","HLT");
145 if (!fESDTrackCuts) {
146 iResult=-ENOMEM;
147 break;
148 }
149
150 // implement further initialization
151 } while (0);
152
153 if (iResult<0) {
154 // implement cleanup
155
156 if (fCorrObj)
157 delete fCorrObj;
158 fCorrObj = NULL;
159
160 if (fESDTrackCuts)
161 delete fESDTrackCuts;
162 fESDTrackCuts = NULL;
163 }
164
165 if (iResult>=0) {
166 SetDefaultConfiguration();
167
168 // -- Read configuration object : HLT/ConfigGlobal/MultiplicityCorrelations
169 TString cdbPath="HLT/ConfigGlobal/";
170 cdbPath+=GetComponentID();
171 iResult=ConfigureFromCDBTObjString(cdbPath);
172
173 // -- Read the component arguments
174 if (iResult>=0) {
175 iResult=ConfigureFromArgumentString(argc, argv);
176 }
177 }
178
179 if (iResult>=0) {
180 HLTInfo("ESD track cuts : %s",fESDTrackCuts->GetTitle() );
181
182 fCorrObj->SetESDTrackCuts(fESDTrackCuts);
183 fCorrObj->Initialize();
184 }
185
186 return iResult;
187}
188
189// #################################################################################
190void AliHLTMultiplicityCorrelationsComponent::SetDefaultConfiguration() {
191 // see header file for class documentation
192
193 if (fESDTrackCuts) {
194 fESDTrackCuts->SetEtaRange(-0.9,0.9);
195 fESDTrackCuts->SetPtRange(0.2,200);
196 fESDTrackCuts->SetMinNClustersTPC(80);
197
198 fESDTrackCuts->SetDCAToVertex2D(kFALSE);
199 fESDTrackCuts->SetRequireSigmaToVertex(kFALSE);
200
201 fESDTrackCuts->SetMaxDCAToVertexXY(3.0);
202 fESDTrackCuts->SetMaxDCAToVertexZ(3.0);
203
204 fESDTrackCuts->SetRequireTPCRefit(kFALSE);
205 fESDTrackCuts->SetRequireITSRefit(kFALSE);
206 }
207
208 return;
209}
210
211// #################################################################################
212Int_t AliHLTMultiplicityCorrelationsComponent::ScanConfigurationArgument(Int_t argc, const Char_t** argv) {
213 // Scan configuration arguments
214 // Return the number of processed arguments
215 // -EPROTO if argument format error (e.g. number expected but not found)
216 //
217 // The AliHLTComponent base class implements a parsing loop for argument strings and
218 // arrays of strings which is invoked by ConfigureFromArgumentString/ConfigureFromCDBTObjString
219 // The component needs to implement ScanConfigurationArgument in order to decode the arguments.
220
221 if (argc<=0) return 0;
222 Int_t ii =0;
223 TString argument=argv[ii];
224
225 if (argument.IsNull()) return 0;
226
227 if( !fESDTrackCuts){
228 HLTError("No ESD track cuts availible");
229 return -ENOMEM;
230 }
231
232 // ---------------------
233
234 // -maxpt
235 if (argument.CompareTo("-maxpt")==0) {
236 if (++ii>=argc) return -EPROTO;
237 argument=argv[ii];
238
239 Float_t minPt, maxPt;
240 fESDTrackCuts->GetPtRange(minPt,maxPt);
241 maxPt = argument.Atof();
242 fESDTrackCuts->SetPtRange(minPt,maxPt);
243
244 TString title = fESDTrackCuts->GetTitle();
245 if (!title.CompareTo("No track cuts")) title = "";
246 else title += " && ";
247 title += Form("p_t < %f", maxPt);
248 fESDTrackCuts->SetTitle(title);
249 return 2;
250 }
251
252 // -minpt
253 if (argument.CompareTo("-minpt")==0) {
254 if (++ii>=argc) return -EPROTO;
255 argument=argv[ii];
256
257 Float_t minPt, maxPt;
258 fESDTrackCuts->GetPtRange(minPt,maxPt);
259 minPt = argument.Atof();
260 fESDTrackCuts->SetPtRange(minPt,maxPt);
261
262 TString title = fESDTrackCuts->GetTitle();
263 if (!title.CompareTo("No track cuts")) title = "";
264 else title += " && ";
265 title += Form("p_t > %f", minPt);
266 fESDTrackCuts->SetTitle(title);
267 return 2;
268 }
269
270 // -min-ldca
271 // minimum longitudinal dca to vertex
272 if (argument.CompareTo("-min-ldca")==0) {
273 if (++ii>=argc) return -EPROTO;
274 argument=argv[ii];
275
276 fESDTrackCuts->SetMinDCAToVertexZ(argument.Atof());
277 TString title = fESDTrackCuts->GetTitle();
278 if (!title.CompareTo("No track cuts")) title = "";
279 else title += " && ";
280 title += Form("DCAz > %f", argument.Atof());
281 fESDTrackCuts->SetTitle(title);
282 return 2;
283 }
284
285 // -max-ldca
286 // maximum longitudinal dca to vertex
287 if (argument.CompareTo("-max-ldca")==0) {
288 if (++ii>=argc) return -EPROTO;
289 argument=argv[ii];
290
291 fESDTrackCuts->SetMaxDCAToVertexZ(argument.Atof());
292 TString title = fESDTrackCuts->GetTitle();
293 if (!title.CompareTo("No track cuts")) title = "";
294 else title += " && ";
295 title += Form("DCAz < %f", argument.Atof());
296 fESDTrackCuts->SetTitle(title);
297 return 2;
298 }
299
300 // -min-tdca
301 // minimum transverse dca to vertex
302 if (argument.CompareTo("-min-tdca")==0) {
303 if (++ii>=argc) return -EPROTO;
304 argument=argv[ii];
305
306 fESDTrackCuts->SetMinDCAToVertexXY(argument.Atof());
307 TString title = fESDTrackCuts->GetTitle();
308 if (!title.CompareTo("No track cuts")) title = "";
309 else title += " && ";
310 title += Form("DCAr > %f", argument.Atof());
311 fESDTrackCuts->SetTitle(title);
312 return 2;
313 }
314
315 // -max-tdca
316 // maximum transverse dca to vertex
317 if (argument.CompareTo("-max-tdca")==0) {
318 if (++ii>=argc) return -EPROTO;
319 argument=argv[ii];
320
321 fESDTrackCuts->SetMaxDCAToVertexXY(argument.Atof());
322 TString title = fESDTrackCuts->GetTitle();
323 if (!title.CompareTo("No track cuts")) title = "";
324 else title += " && ";
325 title += Form("DCAr < %f", argument.Atof());
326 fESDTrackCuts->SetTitle(title);
327 return 2;
328 }
329
330 // -etarange
331 // +/- eta
332 if (argument.CompareTo("-etarange")==0) {
333 if (++ii>=argc) return -EPROTO;
334 argument=argv[ii];
335 Float_t eta = argument.Atof();
336
337 fESDTrackCuts->SetEtaRange(-eta,eta);
338 TString title = fESDTrackCuts->GetTitle();
339 if (!title.CompareTo("No track cuts")) title = "";
340 else title += " && ";
341 title += Form("Eta[%f,%f]", argument.Atof());
342 fESDTrackCuts->SetTitle(title);
343 return 2;
344 }
345
346
347 // -- BINNING --------------
348
349 // binningVzero
350 if (argument.CompareTo("-binningVzero")==0) {
351 if (++ii>=argc) return -EPROTO;
352 argument=argv[ii];
353 Int_t binning = argument.Atoi();
354 if (++ii>=argc) return -EPROTO;
355 argument=argv[ii];
356 Float_t min = argument.Atof();
357 if (++ii>=argc) return -EPROTO;
358 argument=argv[ii];
359 Float_t max = argument.Atof();
360
361 fCorrObj->SetBinningVzero(binning, min, max);
362 return 4;
363 }
364
365 // binningTpc
366 if (argument.CompareTo("-binningTpc")==0) {
367 if (++ii>=argc) return -EPROTO;
368 argument=argv[ii];
369 Int_t binning = argument.Atoi();
370 if (++ii>=argc) return -EPROTO;
371 argument=argv[ii];
372 Float_t min = argument.Atof();
373 if (++ii>=argc) return -EPROTO;
374 argument=argv[ii];
375 Float_t max = argument.Atof();
376
377 fCorrObj->SetBinningTpc(binning, min, max);
378 return 4;
379 }
380
381 // binningZdc
382 if (argument.CompareTo("-binningZdc")==0) {
383 if (++ii>=argc) return -EPROTO;
384 argument=argv[ii];
385 Int_t binning = argument.Atoi();
386 if (++ii>=argc) return -EPROTO;
387 argument=argv[ii];
388 Float_t min = argument.Atof();
389 if (++ii>=argc) return -EPROTO;
390 argument=argv[ii];
391 Float_t max = argument.Atof();
392
393 fCorrObj->SetBinningZdc(binning, min, max);
394 return 4;
395 }
396
397 // binningZnp
398 if (argument.CompareTo("-binningZnp")==0) {
399 if (++ii>=argc) return -EPROTO;
400 argument=argv[ii];
401 Int_t binning = argument.Atoi();
402 if (++ii>=argc) return -EPROTO;
403 argument=argv[ii];
404 Float_t min = argument.Atof();
405 if (++ii>=argc) return -EPROTO;
406 argument=argv[ii];
407 Float_t max = argument.Atof();
408
409 fCorrObj->SetBinningZnp(binning, min, max);
410 return 4;
411 }
412
413 // binningZem
414 if (argument.CompareTo("-binningZem")==0) {
415 if (++ii>=argc) return -EPROTO;
416 argument=argv[ii];
417 Int_t binning = argument.Atoi();
418 if (++ii>=argc) return -EPROTO;
419 argument=argv[ii];
420 Float_t min = argument.Atof();
421 if (++ii>=argc) return -EPROTO;
422 argument=argv[ii];
423 Float_t max = argument.Atof();
424
425 fCorrObj->SetBinningZem(binning, min, max);
426 return 4;
427 }
a75a9dbe 428 // binningZem
429 if (argument.CompareTo("-binningCalo")==0) {
430 if (++ii>=argc) return -EPROTO;
431 argument=argv[ii];
432 Int_t binning = argument.Atoi();
433 if (++ii>=argc) return -EPROTO;
434 argument=argv[ii];
435 Float_t min = argument.Atof();
436 if (++ii>=argc) return -EPROTO;
437 argument=argv[ii];
438 Float_t max = argument.Atof();
439
440 fCorrObj->SetBinningCalo(binning, min, max);
441 return 4;
442 }
06f2306d 443
444 // unknown argument
445 return -EINVAL;
446}
447
448// #################################################################################
449Int_t AliHLTMultiplicityCorrelationsComponent::DoDeinit() {
450 // see header file for class documentation
451
452 if (fCorrObj)
453 delete fCorrObj;
454 fCorrObj = NULL;
455
456 if (fESDTrackCuts)
457 delete fESDTrackCuts;
458 fESDTrackCuts = NULL;
459
460 return 0;
461}
462
463// #################################################################################
464Int_t AliHLTMultiplicityCorrelationsComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
465 AliHLTComponentTriggerData& /*trigData*/) {
466 // see header file for class documentation
467
468 Int_t iResult=0;
469
470 // -- Only use data event
471 if (!IsDataEvent())
472 return 0;
473
474 // -- Get ESD object
475 for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDObject); iter != NULL; iter = GetNextInputObject() ) {
476
477 AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(const_cast<TObject*>( iter ) );
478 if( !esdEvent ){
479 HLTWarning("Wrong ESDEvent object received");
480 iResult = -1;
481 continue;
482 }
483 esdEvent->GetStdContent();
484 iResult = fCorrObj->ProcessEvent(esdEvent);
485 }
486
487 if (iResult) {
488 HLTError("Error while processing event inside multiplicity correlation object");
489 return iResult;
490 }
491
492 // -- Send histlist
493 PushBack(dynamic_cast<TObject*>(fCorrObj->GetHistList()),
494 kAliHLTDataTypeTObject|kAliHLTDataOriginHLT,0);
495
496 return iResult;
497}
498
499// #################################################################################
500Int_t AliHLTMultiplicityCorrelationsComponent::Reconfigure(const Char_t* cdbEntry, const Char_t* chainId) {
501 // see header file for class documentation
502
503 Int_t iResult=0;
504 TString cdbPath;
505 if (cdbEntry) {
506 cdbPath=cdbEntry;
507 } else {
508 cdbPath="HLT/ConfigGlobal/";
509 cdbPath+=GetComponentID();
510 }
511
512 AliInfoClass(Form("reconfigure '%s' from entry %s%s", chainId, cdbPath.Data(), cdbEntry?"":" (default)"));
513 iResult=ConfigureFromCDBTObjString(cdbPath);
514
515 return iResult;
516}
517
518// #################################################################################
519Int_t AliHLTMultiplicityCorrelationsComponent::ReadPreprocessorValues(const Char_t* /*modules*/) {
520 // see header file for class documentation
521 ALIHLTERRORGUARD(5, "ReadPreProcessorValues not implemented for this component");
522 return 0;
523}