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"
37 #include "AliHLTITSClusterDataFormat.h"
39 /** ROOT macro for the implementation of ROOT specific class methods */
40 ClassImp(AliHLTMultiplicityCorrelationsComponent)
43 * ---------------------------------------------------------------------------------
44 * Constructor / Destructor
45 * ---------------------------------------------------------------------------------
48 // #################################################################################
49 AliHLTMultiplicityCorrelationsComponent::AliHLTMultiplicityCorrelationsComponent() :
53 // an example component which implements the ALICE HLT processor
54 // interface and does some analysis on the input raw data
56 // see header file for class documentation
58 // refer to README to build package
60 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
62 // NOTE: all helper classes should be instantiated in DoInit()
65 // #################################################################################
66 AliHLTMultiplicityCorrelationsComponent::~AliHLTMultiplicityCorrelationsComponent() {
67 // see header file for class documentation
71 * ---------------------------------------------------------------------------------
72 * Public functions to implement AliHLTComponent's interface.
73 * These functions are required for the registration process
74 * ---------------------------------------------------------------------------------
77 // #################################################################################
78 const Char_t* AliHLTMultiplicityCorrelationsComponent::GetComponentID() {
79 // see header file for class documentation
80 return "MultiplicityCorrelations";
83 // #################################################################################
84 void AliHLTMultiplicityCorrelationsComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
85 // see header file for class documentation
86 list.push_back(kAliHLTDataTypeESDObject|kAliHLTDataOriginAny);
87 list.push_back(kAliHLTDataTypeClusters|kAliHLTDataOriginITSSPD);
90 // #################################################################################
91 AliHLTComponentDataType AliHLTMultiplicityCorrelationsComponent::GetOutputDataType() {
92 // see header file for class documentation
93 return kAliHLTDataTypeTObject|kAliHLTDataOriginHLT;
96 // #################################################################################
97 void AliHLTMultiplicityCorrelationsComponent::GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier ) {
98 // see header file for class documentation
100 inputMultiplier = 0.5;
103 // #################################################################################
104 void AliHLTMultiplicityCorrelationsComponent::GetOCDBObjectDescription( TMap* const targetMap) {
105 // see header file for class documentation
107 if (!targetMap) return;
108 targetMap->Add(new TObjString("HLT/ConfigGlobal/MultiplicityCorrelations"),
109 new TObjString("configuration object"));
114 // #################################################################################
115 AliHLTComponent* AliHLTMultiplicityCorrelationsComponent::Spawn() {
116 // see header file for class documentation
117 return new AliHLTMultiplicityCorrelationsComponent;
121 * ---------------------------------------------------------------------------------
122 * Protected functions to implement AliHLTComponent's interface.
123 * These functions provide initialization as well as the actual processing
124 * capabilities of the component.
125 * ---------------------------------------------------------------------------------
128 // #################################################################################
129 Int_t AliHLTMultiplicityCorrelationsComponent::DoInit( Int_t argc, const Char_t** argv ) {
130 // see header file for class documentation
134 // -- Initialize members
135 // -----------------------
137 if (iResult<0) break;
140 fCorrObj = new AliHLTMultiplicityCorrelations;
146 fESDTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","HLT");
147 if (!fESDTrackCuts) {
152 // implement further initialization
163 delete fESDTrackCuts;
164 fESDTrackCuts = NULL;
168 SetDefaultConfiguration();
170 // -- Read configuration object : HLT/ConfigGlobal/MultiplicityCorrelations
171 TString cdbPath="HLT/ConfigGlobal/";
172 cdbPath+=GetComponentID();
173 iResult=ConfigureFromCDBTObjString(cdbPath);
175 // -- Read the component arguments
177 iResult=ConfigureFromArgumentString(argc, argv);
182 HLTInfo("ESD track cuts : %s",fESDTrackCuts->GetTitle() );
184 fCorrObj->SetESDTrackCuts(fESDTrackCuts);
185 fCorrObj->Initialize();
191 // #################################################################################
192 void AliHLTMultiplicityCorrelationsComponent::SetDefaultConfiguration() {
193 // see header file for class documentation
196 fESDTrackCuts->SetEtaRange(-0.9,0.9);
197 fESDTrackCuts->SetPtRange(0.2,200);
198 fESDTrackCuts->SetMinNClustersTPC(80);
200 fESDTrackCuts->SetDCAToVertex2D(kFALSE);
201 fESDTrackCuts->SetRequireSigmaToVertex(kFALSE);
203 fESDTrackCuts->SetMaxDCAToVertexXY(3.0);
204 fESDTrackCuts->SetMaxDCAToVertexZ(3.0);
206 fESDTrackCuts->SetRequireTPCRefit(kFALSE);
207 fESDTrackCuts->SetRequireITSRefit(kFALSE);
213 // #################################################################################
214 Int_t AliHLTMultiplicityCorrelationsComponent::ScanConfigurationArgument(Int_t argc, const Char_t** argv) {
215 // Scan configuration arguments
216 // Return the number of processed arguments
217 // -EPROTO if argument format error (e.g. number expected but not found)
219 // The AliHLTComponent base class implements a parsing loop for argument strings and
220 // arrays of strings which is invoked by ConfigureFromArgumentString/ConfigureFromCDBTObjString
221 // The component needs to implement ScanConfigurationArgument in order to decode the arguments.
223 if (argc<=0) return 0;
225 TString argument=argv[ii];
227 if (argument.IsNull()) return 0;
230 HLTError("No ESD track cuts availible");
234 // ---------------------
237 if (argument.CompareTo("-maxpt")==0) {
238 if (++ii>=argc) return -EPROTO;
241 Float_t minPt, maxPt;
242 fESDTrackCuts->GetPtRange(minPt,maxPt);
243 maxPt = argument.Atof();
244 fESDTrackCuts->SetPtRange(minPt,maxPt);
246 TString title = fESDTrackCuts->GetTitle();
247 if (!title.CompareTo("No track cuts")) title = "";
248 else title += " && ";
249 title += Form("p_t < %f", maxPt);
250 fESDTrackCuts->SetTitle(title);
255 if (argument.CompareTo("-minpt")==0) {
256 if (++ii>=argc) return -EPROTO;
259 Float_t minPt, maxPt;
260 fESDTrackCuts->GetPtRange(minPt,maxPt);
261 minPt = argument.Atof();
262 fESDTrackCuts->SetPtRange(minPt,maxPt);
264 TString title = fESDTrackCuts->GetTitle();
265 if (!title.CompareTo("No track cuts")) title = "";
266 else title += " && ";
267 title += Form("p_t > %f", minPt);
268 fESDTrackCuts->SetTitle(title);
273 // minimum longitudinal dca to vertex
274 if (argument.CompareTo("-min-ldca")==0) {
275 if (++ii>=argc) return -EPROTO;
278 fESDTrackCuts->SetMinDCAToVertexZ(argument.Atof());
279 TString title = fESDTrackCuts->GetTitle();
280 if (!title.CompareTo("No track cuts")) title = "";
281 else title += " && ";
282 title += Form("DCAz > %f", argument.Atof());
283 fESDTrackCuts->SetTitle(title);
288 // maximum longitudinal dca to vertex
289 if (argument.CompareTo("-max-ldca")==0) {
290 if (++ii>=argc) return -EPROTO;
293 fESDTrackCuts->SetMaxDCAToVertexZ(argument.Atof());
294 TString title = fESDTrackCuts->GetTitle();
295 if (!title.CompareTo("No track cuts")) title = "";
296 else title += " && ";
297 title += Form("DCAz < %f", argument.Atof());
298 fESDTrackCuts->SetTitle(title);
303 // minimum transverse dca to vertex
304 if (argument.CompareTo("-min-tdca")==0) {
305 if (++ii>=argc) return -EPROTO;
308 fESDTrackCuts->SetMinDCAToVertexXY(argument.Atof());
309 TString title = fESDTrackCuts->GetTitle();
310 if (!title.CompareTo("No track cuts")) title = "";
311 else title += " && ";
312 title += Form("DCAr > %f", argument.Atof());
313 fESDTrackCuts->SetTitle(title);
318 // maximum transverse dca to vertex
319 if (argument.CompareTo("-max-tdca")==0) {
320 if (++ii>=argc) return -EPROTO;
323 fESDTrackCuts->SetMaxDCAToVertexXY(argument.Atof());
324 TString title = fESDTrackCuts->GetTitle();
325 if (!title.CompareTo("No track cuts")) title = "";
326 else title += " && ";
327 title += Form("DCAr < %f", argument.Atof());
328 fESDTrackCuts->SetTitle(title);
334 if (argument.CompareTo("-etarange")==0) {
335 if (++ii>=argc) return -EPROTO;
337 Float_t eta = argument.Atof();
339 fESDTrackCuts->SetEtaRange(-eta,eta);
340 TString title = fESDTrackCuts->GetTitle();
341 if (!title.CompareTo("No track cuts")) title = "";
342 else title += " && ";
343 title += Form("Eta[%f,%f]", argument.Atof());
344 fESDTrackCuts->SetTitle(title);
349 // -- BINNING --------------
352 if (argument.CompareTo("-binningVzero")==0) {
353 if (++ii>=argc) return -EPROTO;
355 Int_t binning = argument.Atoi();
356 if (++ii>=argc) return -EPROTO;
358 Float_t min = argument.Atof();
359 if (++ii>=argc) return -EPROTO;
361 Float_t max = argument.Atof();
363 fCorrObj->SetBinningVzero(binning, min, max);
368 if (argument.CompareTo("-binningTpc")==0) {
369 if (++ii>=argc) return -EPROTO;
371 Int_t binning = argument.Atoi();
372 if (++ii>=argc) return -EPROTO;
374 Float_t min = argument.Atof();
375 if (++ii>=argc) return -EPROTO;
377 Float_t max = argument.Atof();
379 fCorrObj->SetBinningTpc(binning, min, max);
384 if (argument.CompareTo("-binningSpd")==0) {
385 if (++ii>=argc) return -EPROTO;
387 Int_t binning = argument.Atoi();
388 if (++ii>=argc) return -EPROTO;
390 Float_t min = argument.Atof();
391 if (++ii>=argc) return -EPROTO;
393 Float_t max = argument.Atof();
395 fCorrObj->SetBinningSpd(binning, min, max);
400 if (argument.CompareTo("-binningZdc")==0) {
401 if (++ii>=argc) return -EPROTO;
403 Int_t binning = argument.Atoi();
404 if (++ii>=argc) return -EPROTO;
406 Float_t min = argument.Atof();
407 if (++ii>=argc) return -EPROTO;
409 Float_t max = argument.Atof();
411 fCorrObj->SetBinningZdc(binning, min, max);
416 if (argument.CompareTo("-binningZnp")==0) {
417 if (++ii>=argc) return -EPROTO;
419 Int_t binning = argument.Atoi();
420 if (++ii>=argc) return -EPROTO;
422 Float_t min = argument.Atof();
423 if (++ii>=argc) return -EPROTO;
425 Float_t max = argument.Atof();
427 fCorrObj->SetBinningZnp(binning, min, max);
432 if (argument.CompareTo("-binningZem")==0) {
433 if (++ii>=argc) return -EPROTO;
435 Int_t binning = argument.Atoi();
436 if (++ii>=argc) return -EPROTO;
438 Float_t min = argument.Atof();
439 if (++ii>=argc) return -EPROTO;
441 Float_t max = argument.Atof();
443 fCorrObj->SetBinningZem(binning, min, max);
447 if (argument.CompareTo("-binningCalo")==0) {
448 if (++ii>=argc) return -EPROTO;
450 Int_t binning = argument.Atoi();
451 if (++ii>=argc) return -EPROTO;
453 Float_t min = argument.Atof();
454 if (++ii>=argc) return -EPROTO;
456 Float_t max = argument.Atof();
458 fCorrObj->SetBinningCalo(binning, min, max);
461 if (argument.CompareTo("-enablePhos")==0) {
462 if (++ii>=argc) return -EPROTO;
464 Int_t enabled = argument.Atoi();
465 fCorrObj->SetProcessPhos(enabled);
468 if (argument.CompareTo("-enableEmcal")==0) {
469 if (++ii>=argc) return -EPROTO;
471 Int_t enabled = argument.Atoi();
472 fCorrObj->SetProcessEmcal(enabled);
479 // #################################################################################
480 Int_t AliHLTMultiplicityCorrelationsComponent::DoDeinit() {
481 // see header file for class documentation
488 delete fESDTrackCuts;
489 fESDTrackCuts = NULL;
494 // #################################################################################
495 Int_t AliHLTMultiplicityCorrelationsComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
496 AliHLTComponentTriggerData& /*trigData*/) {
497 // see header file for class documentation
501 // -- Only use data event
507 AliESDEvent *esdEvent = NULL;
508 for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDObject); iter != NULL; iter = GetNextInputObject() ) {
509 esdEvent = dynamic_cast<AliESDEvent*>(const_cast<TObject*>( iter ) );
511 HLTWarning("Wrong ESDEvent object received");
515 esdEvent->GetStdContent();
518 // -- Get SPD clusters
519 // ---------------------
520 const AliHLTComponentBlockData* iter = NULL;
521 Int_t totalSpacePoint = 0;
523 for ( iter = GetFirstInputBlock(kAliHLTDataTypeClusters|kAliHLTDataOriginITSSPD);
524 iter != NULL; iter = GetNextInputBlock() ) {
526 const AliHLTITSClusterData* clusterData = (const AliHLTITSClusterData*) iter->fPtr;
527 Int_t nSpacepoint = (Int_t) clusterData->fSpacePointCnt;
528 totalSpacePoint += nSpacepoint;
532 // ------------------
534 iResult = fCorrObj->ProcessEvent(esdEvent,totalSpacePoint);
537 HLTError("Error while processing event inside multiplicity correlation object");
542 PushBack(dynamic_cast<TObject*>(fCorrObj->GetHistList()),
543 kAliHLTDataTypeTObject|kAliHLTDataOriginHLT,0);
548 // #################################################################################
549 Int_t AliHLTMultiplicityCorrelationsComponent::Reconfigure(const Char_t* cdbEntry, const Char_t* chainId) {
550 // see header file for class documentation
557 cdbPath="HLT/ConfigGlobal/";
558 cdbPath+=GetComponentID();
561 AliInfoClass(Form("reconfigure '%s' from entry %s%s", chainId, cdbPath.Data(), cdbEntry?"":" (default)"));
562 iResult=ConfigureFromCDBTObjString(cdbPath);
567 // #################################################################################
568 Int_t AliHLTMultiplicityCorrelationsComponent::ReadPreprocessorValues(const Char_t* /*modules*/) {
569 // see header file for class documentation
570 ALIHLTERRORGUARD(5, "ReadPreProcessorValues not implemented for this component");