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"
30 #include "AliESDVZERO.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);
88 list.push_back(kAliHLTDataTypeESDContent|kAliHLTDataOriginVZERO);
91 // #################################################################################
92 AliHLTComponentDataType AliHLTMultiplicityCorrelationsComponent::GetOutputDataType() {
93 // see header file for class documentation
94 return kAliHLTDataTypeTObject|kAliHLTDataOriginHLT;
97 // #################################################################################
98 void AliHLTMultiplicityCorrelationsComponent::GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier ) {
99 // see header file for class documentation
101 inputMultiplier = 0.5;
104 // #################################################################################
105 void AliHLTMultiplicityCorrelationsComponent::GetOCDBObjectDescription( TMap* const targetMap) {
106 // see header file for class documentation
108 if (!targetMap) return;
109 targetMap->Add(new TObjString("HLT/ConfigGlobal/MultiplicityCorrelations"),
110 new TObjString("configuration object"));
115 // #################################################################################
116 AliHLTComponent* AliHLTMultiplicityCorrelationsComponent::Spawn() {
117 // see header file for class documentation
118 return new AliHLTMultiplicityCorrelationsComponent;
122 * ---------------------------------------------------------------------------------
123 * Protected functions to implement AliHLTComponent's interface.
124 * These functions provide initialization as well as the actual processing
125 * capabilities of the component.
126 * ---------------------------------------------------------------------------------
129 // #################################################################################
130 Int_t AliHLTMultiplicityCorrelationsComponent::DoInit( Int_t argc, const Char_t** argv ) {
131 // see header file for class documentation
135 // -- Initialize members
136 // -----------------------
138 if (iResult<0) break;
141 fCorrObj = new AliHLTMultiplicityCorrelations;
147 fESDTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","HLT");
148 if (!fESDTrackCuts) {
153 // implement further initialization
164 delete fESDTrackCuts;
165 fESDTrackCuts = NULL;
169 SetDefaultConfiguration();
171 // -- Read configuration object : HLT/ConfigGlobal/MultiplicityCorrelations
172 TString cdbPath="HLT/ConfigGlobal/";
173 cdbPath+=GetComponentID();
174 iResult=ConfigureFromCDBTObjString(cdbPath);
176 // -- Read the component arguments
178 iResult=ConfigureFromArgumentString(argc, argv);
183 HLTInfo("ESD track cuts : %s",fESDTrackCuts->GetTitle() );
185 fCorrObj->SetESDTrackCuts(fESDTrackCuts);
186 fCorrObj->Initialize();
192 // #################################################################################
193 void AliHLTMultiplicityCorrelationsComponent::SetDefaultConfiguration() {
194 // see header file for class documentation
197 fESDTrackCuts->SetEtaRange(-0.9,0.9);
198 fESDTrackCuts->SetPtRange(0.2,200);
199 fESDTrackCuts->SetMinNClustersTPC(80);
201 fESDTrackCuts->SetDCAToVertex2D(kFALSE);
202 fESDTrackCuts->SetRequireSigmaToVertex(kFALSE);
204 fESDTrackCuts->SetMaxDCAToVertexXY(3.0);
205 fESDTrackCuts->SetMaxDCAToVertexZ(3.0);
207 fESDTrackCuts->SetRequireTPCRefit(kFALSE);
208 fESDTrackCuts->SetRequireITSRefit(kFALSE);
214 // #################################################################################
215 Int_t AliHLTMultiplicityCorrelationsComponent::ScanConfigurationArgument(Int_t argc, const Char_t** argv) {
216 // Scan configuration arguments
217 // Return the number of processed arguments
218 // -EPROTO if argument format error (e.g. number expected but not found)
220 // The AliHLTComponent base class implements a parsing loop for argument strings and
221 // arrays of strings which is invoked by ConfigureFromArgumentString/ConfigureFromCDBTObjString
222 // The component needs to implement ScanConfigurationArgument in order to decode the arguments.
224 if (argc<=0) return 0;
226 TString argument=argv[ii];
228 if (argument.IsNull()) return 0;
231 HLTError("No ESD track cuts availible");
235 // ---------------------
238 if (argument.CompareTo("-maxpt")==0) {
239 if (++ii>=argc) return -EPROTO;
242 Float_t minPt, maxPt;
243 fESDTrackCuts->GetPtRange(minPt,maxPt);
244 maxPt = argument.Atof();
245 fESDTrackCuts->SetPtRange(minPt,maxPt);
247 TString title = fESDTrackCuts->GetTitle();
248 if (!title.CompareTo("No track cuts")) title = "";
249 else title += " && ";
250 title += Form("p_t < %f", maxPt);
251 fESDTrackCuts->SetTitle(title);
256 if (argument.CompareTo("-minpt")==0) {
257 if (++ii>=argc) return -EPROTO;
260 Float_t minPt, maxPt;
261 fESDTrackCuts->GetPtRange(minPt,maxPt);
262 minPt = argument.Atof();
263 fESDTrackCuts->SetPtRange(minPt,maxPt);
265 TString title = fESDTrackCuts->GetTitle();
266 if (!title.CompareTo("No track cuts")) title = "";
267 else title += " && ";
268 title += Form("p_t > %f", minPt);
269 fESDTrackCuts->SetTitle(title);
274 // minimum longitudinal dca to vertex
275 if (argument.CompareTo("-min-ldca")==0) {
276 if (++ii>=argc) return -EPROTO;
279 fESDTrackCuts->SetMinDCAToVertexZ(argument.Atof());
280 TString title = fESDTrackCuts->GetTitle();
281 if (!title.CompareTo("No track cuts")) title = "";
282 else title += " && ";
283 title += Form("DCAz > %f", argument.Atof());
284 fESDTrackCuts->SetTitle(title);
289 // maximum longitudinal dca to vertex
290 if (argument.CompareTo("-max-ldca")==0) {
291 if (++ii>=argc) return -EPROTO;
294 fESDTrackCuts->SetMaxDCAToVertexZ(argument.Atof());
295 TString title = fESDTrackCuts->GetTitle();
296 if (!title.CompareTo("No track cuts")) title = "";
297 else title += " && ";
298 title += Form("DCAz < %f", argument.Atof());
299 fESDTrackCuts->SetTitle(title);
304 // minimum transverse dca to vertex
305 if (argument.CompareTo("-min-tdca")==0) {
306 if (++ii>=argc) return -EPROTO;
309 fESDTrackCuts->SetMinDCAToVertexXY(argument.Atof());
310 TString title = fESDTrackCuts->GetTitle();
311 if (!title.CompareTo("No track cuts")) title = "";
312 else title += " && ";
313 title += Form("DCAr > %f", argument.Atof());
314 fESDTrackCuts->SetTitle(title);
319 // maximum transverse dca to vertex
320 if (argument.CompareTo("-max-tdca")==0) {
321 if (++ii>=argc) return -EPROTO;
324 fESDTrackCuts->SetMaxDCAToVertexXY(argument.Atof());
325 TString title = fESDTrackCuts->GetTitle();
326 if (!title.CompareTo("No track cuts")) title = "";
327 else title += " && ";
328 title += Form("DCAr < %f", argument.Atof());
329 fESDTrackCuts->SetTitle(title);
335 if (argument.CompareTo("-etarange")==0) {
336 if (++ii>=argc) return -EPROTO;
338 Float_t eta = argument.Atof();
340 fESDTrackCuts->SetEtaRange(-eta,eta);
341 TString title = fESDTrackCuts->GetTitle();
342 if (!title.CompareTo("No track cuts")) title = "";
343 else title += " && ";
344 title += Form("Eta[%f,%f]", argument.Atof());
345 fESDTrackCuts->SetTitle(title);
350 // -- BINNING --------------
353 if (argument.CompareTo("-binningVzero")==0) {
354 if (++ii>=argc) return -EPROTO;
356 Int_t binning = argument.Atoi();
357 if (++ii>=argc) return -EPROTO;
359 Float_t min = argument.Atof();
360 if (++ii>=argc) return -EPROTO;
362 Float_t max = argument.Atof();
364 fCorrObj->SetBinningVzero(binning, min, max);
369 if (argument.CompareTo("-binningTpc")==0) {
370 if (++ii>=argc) return -EPROTO;
372 Int_t binning = argument.Atoi();
373 if (++ii>=argc) return -EPROTO;
375 Float_t min = argument.Atof();
376 if (++ii>=argc) return -EPROTO;
378 Float_t max = argument.Atof();
380 fCorrObj->SetBinningTpc(binning, min, max);
385 if (argument.CompareTo("-binningSpd")==0) {
386 if (++ii>=argc) return -EPROTO;
388 Int_t binning = argument.Atoi();
389 if (++ii>=argc) return -EPROTO;
391 Float_t min = argument.Atof();
392 if (++ii>=argc) return -EPROTO;
394 Float_t max = argument.Atof();
396 fCorrObj->SetBinningSpd(binning, min, max);
401 if (argument.CompareTo("-binningZdc")==0) {
402 if (++ii>=argc) return -EPROTO;
404 Int_t binning = argument.Atoi();
405 if (++ii>=argc) return -EPROTO;
407 Float_t min = argument.Atof();
408 if (++ii>=argc) return -EPROTO;
410 Float_t max = argument.Atof();
412 fCorrObj->SetBinningZdc(binning, min, max);
417 if (argument.CompareTo("-binningZnp")==0) {
418 if (++ii>=argc) return -EPROTO;
420 Int_t binning = argument.Atoi();
421 if (++ii>=argc) return -EPROTO;
423 Float_t min = argument.Atof();
424 if (++ii>=argc) return -EPROTO;
426 Float_t max = argument.Atof();
428 fCorrObj->SetBinningZnp(binning, min, max);
433 if (argument.CompareTo("-binningZem")==0) {
434 if (++ii>=argc) return -EPROTO;
436 Int_t binning = argument.Atoi();
437 if (++ii>=argc) return -EPROTO;
439 Float_t min = argument.Atof();
440 if (++ii>=argc) return -EPROTO;
442 Float_t max = argument.Atof();
444 fCorrObj->SetBinningZem(binning, min, max);
448 if (argument.CompareTo("-binningCalo")==0) {
449 if (++ii>=argc) return -EPROTO;
451 Int_t binning = argument.Atoi();
452 if (++ii>=argc) return -EPROTO;
454 Float_t min = argument.Atof();
455 if (++ii>=argc) return -EPROTO;
457 Float_t max = argument.Atof();
459 fCorrObj->SetBinningCalo(binning, min, max);
462 if (argument.CompareTo("-enablePhos")==0) {
463 if (++ii>=argc) return -EPROTO;
465 Int_t enabled = argument.Atoi();
466 fCorrObj->SetProcessPhos(enabled);
469 if (argument.CompareTo("-enableEmcal")==0) {
470 if (++ii>=argc) return -EPROTO;
472 Int_t enabled = argument.Atoi();
473 fCorrObj->SetProcessEmcal(enabled);
480 // #################################################################################
481 Int_t AliHLTMultiplicityCorrelationsComponent::DoDeinit() {
482 // see header file for class documentation
489 delete fESDTrackCuts;
490 fESDTrackCuts = NULL;
495 // #################################################################################
496 Int_t AliHLTMultiplicityCorrelationsComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
497 AliHLTComponentTriggerData& /*trigData*/) {
498 // see header file for class documentation
502 // -- Only use data event
508 AliESDEvent *esdEvent = NULL;
509 for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDObject); iter != NULL; iter = GetNextInputObject() ) {
510 esdEvent = dynamic_cast<AliESDEvent*>(const_cast<TObject*>( iter ) );
512 HLTWarning("Wrong ESDEvent object received");
516 esdEvent->GetStdContent();
519 // -- Get VZEROESD object
520 AliESDVZERO *esdVZERO = NULL;
521 for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDContent|kAliHLTDataOriginVZERO);
522 iter != NULL; iter = GetNextInputObject() ) {
523 esdVZERO = dynamic_cast<AliESDVZERO*>(const_cast<TObject*>( iter ) );
525 HLTWarning("Wrong VZERO ESDEvent object received");
531 // -- Get SPD clusters
532 // ---------------------
533 const AliHLTComponentBlockData* iter = NULL;
534 Int_t totalSpacePoint = 0;
536 for ( iter = GetFirstInputBlock(kAliHLTDataTypeClusters|kAliHLTDataOriginITSSPD);
537 iter != NULL; iter = GetNextInputBlock() ) {
539 const AliHLTITSClusterData* clusterData = (const AliHLTITSClusterData*) iter->fPtr;
540 Int_t nSpacepoint = (Int_t) clusterData->fSpacePointCnt;
541 totalSpacePoint += nSpacepoint;
545 // ------------------
547 iResult = fCorrObj->ProcessEvent(esdEvent,esdVZERO,totalSpacePoint);
550 HLTError("Error while processing event inside multiplicity correlation object");
555 PushBack(dynamic_cast<TObject*>(fCorrObj->GetHistList()),
556 kAliHLTDataTypeTObject|kAliHLTDataOriginHLT,0);
561 // #################################################################################
562 Int_t AliHLTMultiplicityCorrelationsComponent::Reconfigure(const Char_t* cdbEntry, const Char_t* chainId) {
563 // see header file for class documentation
570 cdbPath="HLT/ConfigGlobal/";
571 cdbPath+=GetComponentID();
574 AliInfoClass(Form("reconfigure '%s' from entry %s%s", chainId, cdbPath.Data(), cdbEntry?"":" (default)"));
575 iResult=ConfigureFromCDBTObjString(cdbPath);
580 // #################################################################################
581 Int_t AliHLTMultiplicityCorrelationsComponent::ReadPreprocessorValues(const Char_t* /*modules*/) {
582 // see header file for class documentation
583 ALIHLTERRORGUARD(5, "ReadPreProcessorValues not implemented for this component");