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. *
7 * Primary Authors: Jochen Thaeder <jochen@thaeder.de> *
8 * for The ALICE HLT Project. *
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 **************************************************************************/
19 /** @file AliHLTMultiplicityCorrelationsComponent.cxx
20 @author Jochen Thaeder <jochen@thaeder.de>
21 @brief Component for Multiplicty Correlations
29 #include "TObjString.h"
31 #include "AliESDtrackCuts.h"
32 #include "AliHLTMultiplicityCorrelations.h"
34 #include "AliHLTErrorGuard.h"
35 #include "AliHLTDataTypes.h"
36 #include "AliHLTMultiplicityCorrelationsComponent.h"
38 /** ROOT macro for the implementation of ROOT specific class methods */
39 ClassImp(AliHLTMultiplicityCorrelationsComponent)
42 * ---------------------------------------------------------------------------------
43 * Constructor / Destructor
44 * ---------------------------------------------------------------------------------
47 // #################################################################################
48 AliHLTMultiplicityCorrelationsComponent::AliHLTMultiplicityCorrelationsComponent() :
52 // an example component which implements the ALICE HLT processor
53 // interface and does some analysis on the input raw data
55 // see header file for class documentation
57 // refer to README to build package
59 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
61 // NOTE: all helper classes should be instantiated in DoInit()
64 // #################################################################################
65 AliHLTMultiplicityCorrelationsComponent::~AliHLTMultiplicityCorrelationsComponent() {
66 // see header file for class documentation
70 * ---------------------------------------------------------------------------------
71 * Public functions to implement AliHLTComponent's interface.
72 * These functions are required for the registration process
73 * ---------------------------------------------------------------------------------
76 // #################################################################################
77 const Char_t* AliHLTMultiplicityCorrelationsComponent::GetComponentID() {
78 // see header file for class documentation
79 return "MultiplicityCorrelations";
82 // #################################################################################
83 void AliHLTMultiplicityCorrelationsComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
84 // see header file for class documentation
85 list.push_back(kAliHLTDataTypeESDObject|kAliHLTDataOriginAny);
88 // #################################################################################
89 AliHLTComponentDataType AliHLTMultiplicityCorrelationsComponent::GetOutputDataType() {
90 // see header file for class documentation
91 return kAliHLTDataTypeTObject|kAliHLTDataOriginHLT;
94 // #################################################################################
95 void AliHLTMultiplicityCorrelationsComponent::GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier ) {
96 // see header file for class documentation
98 inputMultiplier = 0.5;
101 // #################################################################################
102 void AliHLTMultiplicityCorrelationsComponent::GetOCDBObjectDescription( TMap* const targetMap) {
103 // see header file for class documentation
105 if (!targetMap) return;
106 targetMap->Add(new TObjString("HLT/ConfigGlobal/MultiplicityCorrelations"),
107 new TObjString("configuration object"));
112 // #################################################################################
113 AliHLTComponent* AliHLTMultiplicityCorrelationsComponent::Spawn() {
114 // see header file for class documentation
115 return new AliHLTMultiplicityCorrelationsComponent;
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 * ---------------------------------------------------------------------------------
126 // #################################################################################
127 Int_t AliHLTMultiplicityCorrelationsComponent::DoInit( Int_t argc, const Char_t** argv ) {
128 // see header file for class documentation
132 // -- Initialize members
133 // -----------------------
135 if (iResult<0) break;
138 fCorrObj = new AliHLTMultiplicityCorrelations;
144 fESDTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","HLT");
145 if (!fESDTrackCuts) {
150 // implement further initialization
161 delete fESDTrackCuts;
162 fESDTrackCuts = NULL;
166 SetDefaultConfiguration();
168 // -- Read configuration object : HLT/ConfigGlobal/MultiplicityCorrelations
169 TString cdbPath="HLT/ConfigGlobal/";
170 cdbPath+=GetComponentID();
171 iResult=ConfigureFromCDBTObjString(cdbPath);
173 // -- Read the component arguments
175 iResult=ConfigureFromArgumentString(argc, argv);
180 HLTInfo("ESD track cuts : %s",fESDTrackCuts->GetTitle() );
182 fCorrObj->SetESDTrackCuts(fESDTrackCuts);
183 fCorrObj->Initialize();
189 // #################################################################################
190 void AliHLTMultiplicityCorrelationsComponent::SetDefaultConfiguration() {
191 // see header file for class documentation
194 fESDTrackCuts->SetEtaRange(-0.9,0.9);
195 fESDTrackCuts->SetPtRange(0.2,200);
196 fESDTrackCuts->SetMinNClustersTPC(80);
198 fESDTrackCuts->SetDCAToVertex2D(kFALSE);
199 fESDTrackCuts->SetRequireSigmaToVertex(kFALSE);
201 fESDTrackCuts->SetMaxDCAToVertexXY(3.0);
202 fESDTrackCuts->SetMaxDCAToVertexZ(3.0);
204 fESDTrackCuts->SetRequireTPCRefit(kFALSE);
205 fESDTrackCuts->SetRequireITSRefit(kFALSE);
211 // #################################################################################
212 Int_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)
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.
221 if (argc<=0) return 0;
223 TString argument=argv[ii];
225 if (argument.IsNull()) return 0;
228 HLTError("No ESD track cuts availible");
232 // ---------------------
235 if (argument.CompareTo("-maxpt")==0) {
236 if (++ii>=argc) return -EPROTO;
239 Float_t minPt, maxPt;
240 fESDTrackCuts->GetPtRange(minPt,maxPt);
241 maxPt = argument.Atof();
242 fESDTrackCuts->SetPtRange(minPt,maxPt);
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);
253 if (argument.CompareTo("-minpt")==0) {
254 if (++ii>=argc) return -EPROTO;
257 Float_t minPt, maxPt;
258 fESDTrackCuts->GetPtRange(minPt,maxPt);
259 minPt = argument.Atof();
260 fESDTrackCuts->SetPtRange(minPt,maxPt);
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);
271 // minimum longitudinal dca to vertex
272 if (argument.CompareTo("-min-ldca")==0) {
273 if (++ii>=argc) return -EPROTO;
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);
286 // maximum longitudinal dca to vertex
287 if (argument.CompareTo("-max-ldca")==0) {
288 if (++ii>=argc) return -EPROTO;
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);
301 // minimum transverse dca to vertex
302 if (argument.CompareTo("-min-tdca")==0) {
303 if (++ii>=argc) return -EPROTO;
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);
316 // maximum transverse dca to vertex
317 if (argument.CompareTo("-max-tdca")==0) {
318 if (++ii>=argc) return -EPROTO;
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);
332 if (argument.CompareTo("-etarange")==0) {
333 if (++ii>=argc) return -EPROTO;
335 Float_t eta = argument.Atof();
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);
347 // -- BINNING --------------
350 if (argument.CompareTo("-binningVzero")==0) {
351 if (++ii>=argc) return -EPROTO;
353 Int_t binning = argument.Atoi();
354 if (++ii>=argc) return -EPROTO;
356 Float_t min = argument.Atof();
357 if (++ii>=argc) return -EPROTO;
359 Float_t max = argument.Atof();
361 fCorrObj->SetBinningVzero(binning, min, max);
366 if (argument.CompareTo("-binningTpc")==0) {
367 if (++ii>=argc) return -EPROTO;
369 Int_t binning = argument.Atoi();
370 if (++ii>=argc) return -EPROTO;
372 Float_t min = argument.Atof();
373 if (++ii>=argc) return -EPROTO;
375 Float_t max = argument.Atof();
377 fCorrObj->SetBinningTpc(binning, min, max);
382 if (argument.CompareTo("-binningZdc")==0) {
383 if (++ii>=argc) return -EPROTO;
385 Int_t binning = argument.Atoi();
386 if (++ii>=argc) return -EPROTO;
388 Float_t min = argument.Atof();
389 if (++ii>=argc) return -EPROTO;
391 Float_t max = argument.Atof();
393 fCorrObj->SetBinningZdc(binning, min, max);
398 if (argument.CompareTo("-binningZnp")==0) {
399 if (++ii>=argc) return -EPROTO;
401 Int_t binning = argument.Atoi();
402 if (++ii>=argc) return -EPROTO;
404 Float_t min = argument.Atof();
405 if (++ii>=argc) return -EPROTO;
407 Float_t max = argument.Atof();
409 fCorrObj->SetBinningZnp(binning, min, max);
414 if (argument.CompareTo("-binningZem")==0) {
415 if (++ii>=argc) return -EPROTO;
417 Int_t binning = argument.Atoi();
418 if (++ii>=argc) return -EPROTO;
420 Float_t min = argument.Atof();
421 if (++ii>=argc) return -EPROTO;
423 Float_t max = argument.Atof();
425 fCorrObj->SetBinningZem(binning, min, max);
429 if (argument.CompareTo("-binningCalo")==0) {
430 if (++ii>=argc) return -EPROTO;
432 Int_t binning = argument.Atoi();
433 if (++ii>=argc) return -EPROTO;
435 Float_t min = argument.Atof();
436 if (++ii>=argc) return -EPROTO;
438 Float_t max = argument.Atof();
440 fCorrObj->SetBinningCalo(binning, min, max);
448 // #################################################################################
449 Int_t AliHLTMultiplicityCorrelationsComponent::DoDeinit() {
450 // see header file for class documentation
457 delete fESDTrackCuts;
458 fESDTrackCuts = NULL;
463 // #################################################################################
464 Int_t AliHLTMultiplicityCorrelationsComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
465 AliHLTComponentTriggerData& /*trigData*/) {
466 // see header file for class documentation
470 // -- Only use data event
475 for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDObject); iter != NULL; iter = GetNextInputObject() ) {
477 AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(const_cast<TObject*>( iter ) );
479 HLTWarning("Wrong ESDEvent object received");
483 esdEvent->GetStdContent();
484 iResult = fCorrObj->ProcessEvent(esdEvent);
488 HLTError("Error while processing event inside multiplicity correlation object");
493 PushBack(dynamic_cast<TObject*>(fCorrObj->GetHistList()),
494 kAliHLTDataTypeTObject|kAliHLTDataOriginHLT,0);
499 // #################################################################################
500 Int_t AliHLTMultiplicityCorrelationsComponent::Reconfigure(const Char_t* cdbEntry, const Char_t* chainId) {
501 // see header file for class documentation
508 cdbPath="HLT/ConfigGlobal/";
509 cdbPath+=GetComponentID();
512 AliInfoClass(Form("reconfigure '%s' from entry %s%s", chainId, cdbPath.Data(), cdbEntry?"":" (default)"));
513 iResult=ConfigureFromCDBTObjString(cdbPath);
518 // #################################################################################
519 Int_t AliHLTMultiplicityCorrelationsComponent::ReadPreprocessorValues(const Char_t* /*modules*/) {
520 // see header file for class documentation
521 ALIHLTERRORGUARD(5, "ReadPreProcessorValues not implemented for this component");