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
30 #include "TTimeStamp.h"
31 #include "TObjString.h"
32 #include "AliESDVZERO.h"
33 #include "AliESDtrackCuts.h"
34 #include "AliHLTMultiplicityCorrelations.h"
35 #include <AliHLTDAQ.h>
37 #include "AliHLTErrorGuard.h"
38 #include "AliHLTDataTypes.h"
39 #include "AliHLTMultiplicityCorrelationsComponent.h"
40 #include "AliHLTITSClusterDataFormat.h"
42 /** ROOT macro for the implementation of ROOT specific class methods */
43 ClassImp(AliHLTMultiplicityCorrelationsComponent)
46 * ---------------------------------------------------------------------------------
47 * Constructor / Destructor
48 * ---------------------------------------------------------------------------------
51 // #################################################################################
52 AliHLTMultiplicityCorrelationsComponent::AliHLTMultiplicityCorrelationsComponent() :
57 // an example component which implements the ALICE HLT processor
58 // interface and does some analysis on the input raw data
60 // see header file for class documentation
62 // refer to README to build package
64 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
66 // NOTE: all helper classes should be instantiated in DoInit()
69 // #################################################################################
70 AliHLTMultiplicityCorrelationsComponent::~AliHLTMultiplicityCorrelationsComponent() {
71 // see header file for class documentation
75 * ---------------------------------------------------------------------------------
76 * Public functions to implement AliHLTComponent's interface.
77 * These functions are required for the registration process
78 * ---------------------------------------------------------------------------------
81 // #################################################################################
82 const Char_t* AliHLTMultiplicityCorrelationsComponent::GetComponentID() {
83 // see header file for class documentation
84 return "MultiplicityCorrelations";
87 // #################################################################################
88 void AliHLTMultiplicityCorrelationsComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
89 // see header file for class documentation
90 list.push_back(kAliHLTDataTypeESDObject|kAliHLTDataOriginAny);
91 list.push_back(kAliHLTDataTypeClusters|kAliHLTDataOriginITSSPD);
92 list.push_back(kAliHLTDataTypeESDContent|kAliHLTDataOriginVZERO);
95 // #################################################################################
96 AliHLTComponentDataType AliHLTMultiplicityCorrelationsComponent::GetOutputDataType() {
97 // see header file for class documentation
98 return kAliHLTDataTypeTObject|kAliHLTDataOriginHLT;
101 // #################################################################################
102 void AliHLTMultiplicityCorrelationsComponent::GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier ) {
103 // see header file for class documentation
105 inputMultiplier = 0.5;
108 // #################################################################################
109 void AliHLTMultiplicityCorrelationsComponent::GetOCDBObjectDescription( TMap* const targetMap) {
110 // see header file for class documentation
112 if (!targetMap) return;
113 targetMap->Add(new TObjString("HLT/ConfigGlobal/MultiplicityCorrelations"),
114 new TObjString("configuration object"));
119 // #################################################################################
120 AliHLTComponent* AliHLTMultiplicityCorrelationsComponent::Spawn() {
121 // see header file for class documentation
122 return new AliHLTMultiplicityCorrelationsComponent;
126 * ---------------------------------------------------------------------------------
127 * Protected functions to implement AliHLTComponent's interface.
128 * These functions provide initialization as well as the actual processing
129 * capabilities of the component.
130 * ---------------------------------------------------------------------------------
133 // #################################################################################
134 Int_t AliHLTMultiplicityCorrelationsComponent::DoInit( Int_t argc, const Char_t** argv ) {
135 // see header file for class documentation
139 // -- Initialize members
140 // -----------------------
143 fCorrObj = new AliHLTMultiplicityCorrelations;
149 fESDTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","HLT");
150 if (!fESDTrackCuts) {
157 // implement further initialization
168 delete fESDTrackCuts;
169 fESDTrackCuts = NULL;
173 SetDefaultConfiguration();
175 // -- Read configuration object : HLT/ConfigGlobal/MultiplicityCorrelations
176 TString cdbPath="HLT/ConfigGlobal/";
177 cdbPath+=GetComponentID();
178 iResult=ConfigureFromCDBTObjString(cdbPath);
180 // -- Read the component arguments
182 iResult=ConfigureFromArgumentString(argc, argv);
187 HLTInfo("ESD track cuts : %s",fESDTrackCuts->GetTitle() );
189 fCorrObj->SetESDTrackCuts(fESDTrackCuts);
190 fCorrObj->Initialize();
196 // #################################################################################
197 void AliHLTMultiplicityCorrelationsComponent::SetDefaultConfiguration() {
198 // see header file for class documentation
201 fESDTrackCuts->SetEtaRange(-0.9,0.9);
202 fESDTrackCuts->SetPtRange(0.2,200);
203 fESDTrackCuts->SetMinNClustersTPC(80);
205 fESDTrackCuts->SetDCAToVertex2D(kFALSE);
206 fESDTrackCuts->SetRequireSigmaToVertex(kFALSE);
208 fESDTrackCuts->SetMaxDCAToVertexXY(3.0);
209 fESDTrackCuts->SetMaxDCAToVertexZ(3.0);
211 fESDTrackCuts->SetRequireTPCRefit(kFALSE);
212 fESDTrackCuts->SetRequireITSRefit(kFALSE);
218 // #################################################################################
219 Int_t AliHLTMultiplicityCorrelationsComponent::ScanConfigurationArgument(Int_t argc, const Char_t** argv) {
220 // Scan configuration arguments
221 // Return the number of processed arguments
222 // -EPROTO if argument format error (e.g. number expected but not found)
224 // The AliHLTComponent base class implements a parsing loop for argument strings and
225 // arrays of strings which is invoked by ConfigureFromArgumentString/ConfigureFromCDBTObjString
226 // The component needs to implement ScanConfigurationArgument in order to decode the arguments.
228 if (argc<=0) return 0;
230 TString argument=argv[ii];
232 if (argument.IsNull()) return 0;
235 HLTError("No ESD track cuts availible");
239 // ---------------------
242 if (argument.CompareTo("-maxpt")==0) {
243 if (++ii>=argc) return -EPROTO;
246 Float_t minPt, maxPt;
247 fESDTrackCuts->GetPtRange(minPt,maxPt);
248 maxPt = argument.Atof();
249 fESDTrackCuts->SetPtRange(minPt,maxPt);
251 TString title = fESDTrackCuts->GetTitle();
252 if (!title.CompareTo("No track cuts")) title = "";
253 else title += " && ";
254 title += Form("p_t < %f", maxPt);
255 fESDTrackCuts->SetTitle(title);
260 if (argument.CompareTo("-minpt")==0) {
261 if (++ii>=argc) return -EPROTO;
264 Float_t minPt, maxPt;
265 fESDTrackCuts->GetPtRange(minPt,maxPt);
266 minPt = argument.Atof();
267 fESDTrackCuts->SetPtRange(minPt,maxPt);
269 TString title = fESDTrackCuts->GetTitle();
270 if (!title.CompareTo("No track cuts")) title = "";
271 else title += " && ";
272 title += Form("p_t > %f", minPt);
273 fESDTrackCuts->SetTitle(title);
278 // minimum longitudinal dca to vertex
279 if (argument.CompareTo("-min-ldca")==0) {
280 if (++ii>=argc) return -EPROTO;
283 fESDTrackCuts->SetMinDCAToVertexZ(argument.Atof());
284 TString title = fESDTrackCuts->GetTitle();
285 if (!title.CompareTo("No track cuts")) title = "";
286 else title += " && ";
287 title += Form("DCAz > %f", argument.Atof());
288 fESDTrackCuts->SetTitle(title);
293 // maximum longitudinal dca to vertex
294 if (argument.CompareTo("-max-ldca")==0) {
295 if (++ii>=argc) return -EPROTO;
298 fESDTrackCuts->SetMaxDCAToVertexZ(argument.Atof());
299 TString title = fESDTrackCuts->GetTitle();
300 if (!title.CompareTo("No track cuts")) title = "";
301 else title += " && ";
302 title += Form("DCAz < %f", argument.Atof());
303 fESDTrackCuts->SetTitle(title);
308 // minimum transverse dca to vertex
309 if (argument.CompareTo("-min-tdca")==0) {
310 if (++ii>=argc) return -EPROTO;
313 fESDTrackCuts->SetMinDCAToVertexXY(argument.Atof());
314 TString title = fESDTrackCuts->GetTitle();
315 if (!title.CompareTo("No track cuts")) title = "";
316 else title += " && ";
317 title += Form("DCAr > %f", argument.Atof());
318 fESDTrackCuts->SetTitle(title);
323 // maximum transverse dca to vertex
324 if (argument.CompareTo("-max-tdca")==0) {
325 if (++ii>=argc) return -EPROTO;
328 fESDTrackCuts->SetMaxDCAToVertexXY(argument.Atof());
329 TString title = fESDTrackCuts->GetTitle();
330 if (!title.CompareTo("No track cuts")) title = "";
331 else title += " && ";
332 title += Form("DCAr < %f", argument.Atof());
333 fESDTrackCuts->SetTitle(title);
339 if (argument.CompareTo("-etarange")==0) {
340 if (++ii>=argc) return -EPROTO;
342 Float_t eta = argument.Atof();
344 fESDTrackCuts->SetEtaRange(-eta,eta);
345 TString title = fESDTrackCuts->GetTitle();
346 if (!title.CompareTo("No track cuts")) title = "";
347 else title += " && ";
348 title += Form("Eta[%f,%f]", argument.Atof(),argument.Atof());
349 fESDTrackCuts->SetTitle(title);
353 // -- BINNING --------------
356 if (argument.CompareTo("-binningVzero")==0) {
357 if (++ii>=argc) return -EPROTO;
359 Int_t binning = argument.Atoi();
360 if (++ii>=argc) return -EPROTO;
362 Float_t min = argument.Atof();
363 if (++ii>=argc) return -EPROTO;
365 Float_t max = argument.Atof();
367 fCorrObj->SetBinningVzero(binning, min, max);
372 if (argument.CompareTo("-binningTpc")==0) {
373 if (++ii>=argc) return -EPROTO;
375 Int_t binning = argument.Atoi();
376 if (++ii>=argc) return -EPROTO;
378 Float_t min = argument.Atof();
379 if (++ii>=argc) return -EPROTO;
381 Float_t max = argument.Atof();
383 fCorrObj->SetBinningTpc(binning, min, max);
388 if (argument.CompareTo("-binningSpd")==0) {
389 if (++ii>=argc) return -EPROTO;
391 Int_t binning = argument.Atoi();
392 if (++ii>=argc) return -EPROTO;
394 Float_t min = argument.Atof();
395 if (++ii>=argc) return -EPROTO;
397 Float_t max = argument.Atof();
399 fCorrObj->SetBinningSpd(binning, min, max);
404 if (argument.CompareTo("-binningZdc")==0) {
405 if (++ii>=argc) return -EPROTO;
407 Int_t binning = argument.Atoi();
408 if (++ii>=argc) return -EPROTO;
410 Float_t min = argument.Atof();
411 if (++ii>=argc) return -EPROTO;
413 Float_t max = argument.Atof();
415 fCorrObj->SetBinningZdc(binning, min, max);
420 if (argument.CompareTo("-binningZnp")==0) {
421 if (++ii>=argc) return -EPROTO;
423 Int_t binning = argument.Atoi();
424 if (++ii>=argc) return -EPROTO;
426 Float_t min = argument.Atof();
427 if (++ii>=argc) return -EPROTO;
429 Float_t max = argument.Atof();
431 fCorrObj->SetBinningZnp(binning, min, max);
436 if (argument.CompareTo("-binningZem")==0) {
437 if (++ii>=argc) return -EPROTO;
439 Int_t binning = argument.Atoi();
440 if (++ii>=argc) return -EPROTO;
442 Float_t min = argument.Atof();
443 if (++ii>=argc) return -EPROTO;
445 Float_t max = argument.Atof();
447 fCorrObj->SetBinningZem(binning, min, max);
451 if (argument.CompareTo("-binningCalo")==0) {
452 if (++ii>=argc) return -EPROTO;
454 Int_t binning = argument.Atoi();
455 if (++ii>=argc) return -EPROTO;
457 Float_t min = argument.Atof();
458 if (++ii>=argc) return -EPROTO;
460 Float_t max = argument.Atof();
462 fCorrObj->SetBinningCalo(binning, min, max);
465 if (argument.CompareTo("-enablePhos")==0) {
466 if (++ii>=argc) return -EPROTO;
468 Int_t enabled = argument.Atoi();
469 fCorrObj->SetProcessPhos(enabled);
472 if (argument.CompareTo("-enableEmcal")==0) {
473 if (++ii>=argc) return -EPROTO;
475 Int_t enabled = argument.Atoi();
476 fCorrObj->SetProcessEmcal(enabled);
481 if (argument.CompareTo("-enableCALO")==0) {
482 fCorrObj->SetProcessCALO(kTRUE);
485 if (argument.CompareTo("-enableVZERO")==0) {
486 fCorrObj->SetProcessVZERO(kTRUE);
489 if (argument.CompareTo("-enableZDC")==0) {
490 fCorrObj->SetProcessZDC(kTRUE);
493 if (argument.CompareTo("-enableTPC")==0) {
494 fCorrObj->SetProcessTPC(kTRUE);
497 if (argument.CompareTo("-enableSPD")==0) {
498 fCorrObj->SetProcessSPD(kTRUE);
503 if (argument.CompareTo("-disableCALO")==0) {
504 fCorrObj->SetProcessCALO(kFALSE);
507 if (argument.CompareTo("-disableVZERO")==0) {
508 fCorrObj->SetProcessVZERO(kFALSE);
511 if (argument.CompareTo("-disableZDC")==0) {
512 fCorrObj->SetProcessZDC(kFALSE);
515 if (argument.CompareTo("-disableTPC")==0) {
516 fCorrObj->SetProcessTPC(kFALSE);
519 if (argument.CompareTo("-disableSPD")==0) {
520 fCorrObj->SetProcessSPD(kFALSE);
528 // #################################################################################
529 Int_t AliHLTMultiplicityCorrelationsComponent::DoDeinit() {
530 // see header file for class documentation
537 delete fESDTrackCuts;
538 fESDTrackCuts = NULL;
545 // #################################################################################
546 Int_t AliHLTMultiplicityCorrelationsComponent::DoEvent(const AliHLTComponentEventData& evtData,
547 AliHLTComponentTriggerData& /*trigData*/) {
548 // see header file for class documentation
552 // -- Only use data event
558 fUID = ( gSystem->GetPid() + t.GetNanoSec())*10 + evtData.fEventID;
562 AliESDEvent *esdEvent = NULL;
563 for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDObject); iter != NULL; iter = GetNextInputObject() ) {
564 esdEvent = dynamic_cast<AliESDEvent*>(const_cast<TObject*>( iter ) );
566 HLTWarning("Wrong ESDEvent object received");
570 esdEvent->GetStdContent();
573 // -- Get VZEROESD object
574 AliESDVZERO *esdVZERO = NULL;
575 for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDContent|kAliHLTDataOriginVZERO);
576 iter != NULL; iter = GetNextInputObject() ) {
577 esdVZERO = dynamic_cast<AliESDVZERO*>(const_cast<TObject*>( iter ) );
579 HLTWarning("Wrong VZERO ESDEvent object received");
585 // -- Get SPD clusters
586 // ---------------------
587 const AliHLTComponentBlockData* iter = NULL;
588 Int_t totalClusters = 0;
589 Int_t innerClusters = 0;
590 Int_t outerClusters = 0;
592 for ( iter = GetFirstInputBlock(kAliHLTDataTypeClusters|kAliHLTDataOriginITSSPD);
593 iter != NULL; iter = GetNextInputBlock() ) {
595 AliHLTITSClusterData *clusterData = reinterpret_cast<AliHLTITSClusterData*>(iter->fPtr);
596 Int_t nClusters = clusterData->fSpacePointCnt;
597 for( int icl=0; icl<nClusters; icl++ ) {
598 AliHLTITSSpacePointData &d = clusterData->fSpacePoints[icl];
599 if ( d.fLayer == 0 ) ++innerClusters;
600 else if ( d.fLayer == 1 ) ++outerClusters;
603 totalClusters += nClusters;
606 fCorrObj->SetSPDClusters(innerClusters,outerClusters);
609 // ------------------
611 iResult = fCorrObj->ProcessEvent(esdEvent,esdVZERO,totalClusters);
614 HLTError("Error while processing event inside multiplicity correlation object");
619 PushBack(dynamic_cast<TObject*>(fCorrObj->GetHistList()),
620 kAliHLTDataTypeTObject|kAliHLTDataOriginHLT,fUID);
625 // #################################################################################
626 Int_t AliHLTMultiplicityCorrelationsComponent::Reconfigure(const Char_t* cdbEntry, const Char_t* chainId) {
627 // see header file for class documentation
634 cdbPath="HLT/ConfigGlobal/";
635 cdbPath+=GetComponentID();
638 AliInfoClass(Form("reconfigure '%s' from entry %s%s", chainId, cdbPath.Data(), cdbEntry?"":" (default)"));
639 iResult=ConfigureFromCDBTObjString(cdbPath);
644 // #################################################################################
645 Int_t AliHLTMultiplicityCorrelationsComponent::ReadPreprocessorValues(const Char_t* /*modules*/) {
646 // see header file for class documentation
647 ALIHLTERRORGUARD(5, "ReadPreProcessorValues not implemented for this component");