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 // -----------------------
142 if (iResult<0) break;
145 fCorrObj = new AliHLTMultiplicityCorrelations;
151 fESDTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","HLT");
152 if (!fESDTrackCuts) {
159 // implement further initialization
170 delete fESDTrackCuts;
171 fESDTrackCuts = NULL;
175 SetDefaultConfiguration();
177 // -- Read configuration object : HLT/ConfigGlobal/MultiplicityCorrelations
178 TString cdbPath="HLT/ConfigGlobal/";
179 cdbPath+=GetComponentID();
180 iResult=ConfigureFromCDBTObjString(cdbPath);
182 // -- Read the component arguments
184 iResult=ConfigureFromArgumentString(argc, argv);
189 HLTInfo("ESD track cuts : %s",fESDTrackCuts->GetTitle() );
191 fCorrObj->SetESDTrackCuts(fESDTrackCuts);
192 fCorrObj->Initialize();
198 // #################################################################################
199 void AliHLTMultiplicityCorrelationsComponent::SetDefaultConfiguration() {
200 // see header file for class documentation
203 fESDTrackCuts->SetEtaRange(-0.9,0.9);
204 fESDTrackCuts->SetPtRange(0.2,200);
205 fESDTrackCuts->SetMinNClustersTPC(80);
207 fESDTrackCuts->SetDCAToVertex2D(kFALSE);
208 fESDTrackCuts->SetRequireSigmaToVertex(kFALSE);
210 fESDTrackCuts->SetMaxDCAToVertexXY(3.0);
211 fESDTrackCuts->SetMaxDCAToVertexZ(3.0);
213 fESDTrackCuts->SetRequireTPCRefit(kFALSE);
214 fESDTrackCuts->SetRequireITSRefit(kFALSE);
220 // #################################################################################
221 Int_t AliHLTMultiplicityCorrelationsComponent::ScanConfigurationArgument(Int_t argc, const Char_t** argv) {
222 // Scan configuration arguments
223 // Return the number of processed arguments
224 // -EPROTO if argument format error (e.g. number expected but not found)
226 // The AliHLTComponent base class implements a parsing loop for argument strings and
227 // arrays of strings which is invoked by ConfigureFromArgumentString/ConfigureFromCDBTObjString
228 // The component needs to implement ScanConfigurationArgument in order to decode the arguments.
230 if (argc<=0) return 0;
232 TString argument=argv[ii];
234 if (argument.IsNull()) return 0;
237 HLTError("No ESD track cuts availible");
241 // ---------------------
244 if (argument.CompareTo("-maxpt")==0) {
245 if (++ii>=argc) return -EPROTO;
248 Float_t minPt, maxPt;
249 fESDTrackCuts->GetPtRange(minPt,maxPt);
250 maxPt = argument.Atof();
251 fESDTrackCuts->SetPtRange(minPt,maxPt);
253 TString title = fESDTrackCuts->GetTitle();
254 if (!title.CompareTo("No track cuts")) title = "";
255 else title += " && ";
256 title += Form("p_t < %f", maxPt);
257 fESDTrackCuts->SetTitle(title);
262 if (argument.CompareTo("-minpt")==0) {
263 if (++ii>=argc) return -EPROTO;
266 Float_t minPt, maxPt;
267 fESDTrackCuts->GetPtRange(minPt,maxPt);
268 minPt = argument.Atof();
269 fESDTrackCuts->SetPtRange(minPt,maxPt);
271 TString title = fESDTrackCuts->GetTitle();
272 if (!title.CompareTo("No track cuts")) title = "";
273 else title += " && ";
274 title += Form("p_t > %f", minPt);
275 fESDTrackCuts->SetTitle(title);
280 // minimum longitudinal dca to vertex
281 if (argument.CompareTo("-min-ldca")==0) {
282 if (++ii>=argc) return -EPROTO;
285 fESDTrackCuts->SetMinDCAToVertexZ(argument.Atof());
286 TString title = fESDTrackCuts->GetTitle();
287 if (!title.CompareTo("No track cuts")) title = "";
288 else title += " && ";
289 title += Form("DCAz > %f", argument.Atof());
290 fESDTrackCuts->SetTitle(title);
295 // maximum longitudinal dca to vertex
296 if (argument.CompareTo("-max-ldca")==0) {
297 if (++ii>=argc) return -EPROTO;
300 fESDTrackCuts->SetMaxDCAToVertexZ(argument.Atof());
301 TString title = fESDTrackCuts->GetTitle();
302 if (!title.CompareTo("No track cuts")) title = "";
303 else title += " && ";
304 title += Form("DCAz < %f", argument.Atof());
305 fESDTrackCuts->SetTitle(title);
310 // minimum transverse dca to vertex
311 if (argument.CompareTo("-min-tdca")==0) {
312 if (++ii>=argc) return -EPROTO;
315 fESDTrackCuts->SetMinDCAToVertexXY(argument.Atof());
316 TString title = fESDTrackCuts->GetTitle();
317 if (!title.CompareTo("No track cuts")) title = "";
318 else title += " && ";
319 title += Form("DCAr > %f", argument.Atof());
320 fESDTrackCuts->SetTitle(title);
325 // maximum transverse dca to vertex
326 if (argument.CompareTo("-max-tdca")==0) {
327 if (++ii>=argc) return -EPROTO;
330 fESDTrackCuts->SetMaxDCAToVertexXY(argument.Atof());
331 TString title = fESDTrackCuts->GetTitle();
332 if (!title.CompareTo("No track cuts")) title = "";
333 else title += " && ";
334 title += Form("DCAr < %f", argument.Atof());
335 fESDTrackCuts->SetTitle(title);
341 if (argument.CompareTo("-etarange")==0) {
342 if (++ii>=argc) return -EPROTO;
344 Float_t eta = argument.Atof();
346 fESDTrackCuts->SetEtaRange(-eta,eta);
347 TString title = fESDTrackCuts->GetTitle();
348 if (!title.CompareTo("No track cuts")) title = "";
349 else title += " && ";
350 title += Form("Eta[%f,%f]", argument.Atof());
351 fESDTrackCuts->SetTitle(title);
355 // -- BINNING --------------
358 if (argument.CompareTo("-binningVzero")==0) {
359 if (++ii>=argc) return -EPROTO;
361 Int_t binning = argument.Atoi();
362 if (++ii>=argc) return -EPROTO;
364 Float_t min = argument.Atof();
365 if (++ii>=argc) return -EPROTO;
367 Float_t max = argument.Atof();
369 fCorrObj->SetBinningVzero(binning, min, max);
374 if (argument.CompareTo("-binningTpc")==0) {
375 if (++ii>=argc) return -EPROTO;
377 Int_t binning = argument.Atoi();
378 if (++ii>=argc) return -EPROTO;
380 Float_t min = argument.Atof();
381 if (++ii>=argc) return -EPROTO;
383 Float_t max = argument.Atof();
385 fCorrObj->SetBinningTpc(binning, min, max);
390 if (argument.CompareTo("-binningSpd")==0) {
391 if (++ii>=argc) return -EPROTO;
393 Int_t binning = argument.Atoi();
394 if (++ii>=argc) return -EPROTO;
396 Float_t min = argument.Atof();
397 if (++ii>=argc) return -EPROTO;
399 Float_t max = argument.Atof();
401 fCorrObj->SetBinningSpd(binning, min, max);
406 if (argument.CompareTo("-binningZdc")==0) {
407 if (++ii>=argc) return -EPROTO;
409 Int_t binning = argument.Atoi();
410 if (++ii>=argc) return -EPROTO;
412 Float_t min = argument.Atof();
413 if (++ii>=argc) return -EPROTO;
415 Float_t max = argument.Atof();
417 fCorrObj->SetBinningZdc(binning, min, max);
422 if (argument.CompareTo("-binningZnp")==0) {
423 if (++ii>=argc) return -EPROTO;
425 Int_t binning = argument.Atoi();
426 if (++ii>=argc) return -EPROTO;
428 Float_t min = argument.Atof();
429 if (++ii>=argc) return -EPROTO;
431 Float_t max = argument.Atof();
433 fCorrObj->SetBinningZnp(binning, min, max);
438 if (argument.CompareTo("-binningZem")==0) {
439 if (++ii>=argc) return -EPROTO;
441 Int_t binning = argument.Atoi();
442 if (++ii>=argc) return -EPROTO;
444 Float_t min = argument.Atof();
445 if (++ii>=argc) return -EPROTO;
447 Float_t max = argument.Atof();
449 fCorrObj->SetBinningZem(binning, min, max);
453 if (argument.CompareTo("-binningCalo")==0) {
454 if (++ii>=argc) return -EPROTO;
456 Int_t binning = argument.Atoi();
457 if (++ii>=argc) return -EPROTO;
459 Float_t min = argument.Atof();
460 if (++ii>=argc) return -EPROTO;
462 Float_t max = argument.Atof();
464 fCorrObj->SetBinningCalo(binning, min, max);
467 if (argument.CompareTo("-enablePhos")==0) {
468 if (++ii>=argc) return -EPROTO;
470 Int_t enabled = argument.Atoi();
471 fCorrObj->SetProcessPhos(enabled);
474 if (argument.CompareTo("-enableEmcal")==0) {
475 if (++ii>=argc) return -EPROTO;
477 Int_t enabled = argument.Atoi();
478 fCorrObj->SetProcessEmcal(enabled);
483 if (argument.CompareTo("-enableCALO")==0) {
484 fCorrObj->SetProcessCALO(kTRUE);
487 if (argument.CompareTo("-enableVZERO")==0) {
488 fCorrObj->SetProcessVZERO(kTRUE);
491 if (argument.CompareTo("-enableZDC")==0) {
492 fCorrObj->SetProcessZDC(kTRUE);
495 if (argument.CompareTo("-enableTPC")==0) {
496 fCorrObj->SetProcessTPC(kTRUE);
499 if (argument.CompareTo("-enableSPD")==0) {
500 fCorrObj->SetProcessSPD(kTRUE);
505 if (argument.CompareTo("-disableCALO")==0) {
506 fCorrObj->SetProcessCALO(kFALSE);
509 if (argument.CompareTo("-disableVZERO")==0) {
510 fCorrObj->SetProcessVZERO(kFALSE);
513 if (argument.CompareTo("-disableZDC")==0) {
514 fCorrObj->SetProcessZDC(kFALSE);
517 if (argument.CompareTo("-disableTPC")==0) {
518 fCorrObj->SetProcessTPC(kFALSE);
521 if (argument.CompareTo("-disableSPD")==0) {
522 fCorrObj->SetProcessSPD(kFALSE);
530 // #################################################################################
531 Int_t AliHLTMultiplicityCorrelationsComponent::DoDeinit() {
532 // see header file for class documentation
539 delete fESDTrackCuts;
540 fESDTrackCuts = NULL;
547 // #################################################################################
548 Int_t AliHLTMultiplicityCorrelationsComponent::DoEvent(const AliHLTComponentEventData& evtData,
549 AliHLTComponentTriggerData& /*trigData*/) {
550 // see header file for class documentation
554 // -- Only use data event
560 fUID = ( gSystem->GetPid() + t.GetNanoSec())*10 + evtData.fEventID;
564 AliESDEvent *esdEvent = NULL;
565 for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDObject); iter != NULL; iter = GetNextInputObject() ) {
566 esdEvent = dynamic_cast<AliESDEvent*>(const_cast<TObject*>( iter ) );
568 HLTWarning("Wrong ESDEvent object received");
572 esdEvent->GetStdContent();
575 // -- Get VZEROESD object
576 AliESDVZERO *esdVZERO = NULL;
577 for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDContent|kAliHLTDataOriginVZERO);
578 iter != NULL; iter = GetNextInputObject() ) {
579 esdVZERO = dynamic_cast<AliESDVZERO*>(const_cast<TObject*>( iter ) );
581 HLTWarning("Wrong VZERO ESDEvent object received");
587 // -- Get SPD clusters
588 // ---------------------
589 const AliHLTComponentBlockData* iter = NULL;
590 Int_t totalClusters = 0;
591 Int_t innerClusters = 0;
592 Int_t outerClusters = 0;
594 for ( iter = GetFirstInputBlock(kAliHLTDataTypeClusters|kAliHLTDataOriginITSSPD);
595 iter != NULL; iter = GetNextInputBlock() ) {
597 AliHLTITSClusterData *clusterData = reinterpret_cast<AliHLTITSClusterData*>(iter->fPtr);
598 Int_t nClusters = clusterData->fSpacePointCnt;
599 for( int icl=0; icl<nClusters; icl++ ) {
600 AliHLTITSSpacePointData &d = clusterData->fSpacePoints[icl];
601 if ( d.fLayer == 0 ) ++innerClusters;
602 else if ( d.fLayer == 1 ) ++outerClusters;
605 totalClusters += nClusters;
608 fCorrObj->SetSPDClusters(innerClusters,outerClusters);
611 // ------------------
613 iResult = fCorrObj->ProcessEvent(esdEvent,esdVZERO,totalClusters);
616 HLTError("Error while processing event inside multiplicity correlation object");
621 PushBack(dynamic_cast<TObject*>(fCorrObj->GetHistList()),
622 kAliHLTDataTypeTObject|kAliHLTDataOriginHLT,fUID);
627 // #################################################################################
628 Int_t AliHLTMultiplicityCorrelationsComponent::Reconfigure(const Char_t* cdbEntry, const Char_t* chainId) {
629 // see header file for class documentation
636 cdbPath="HLT/ConfigGlobal/";
637 cdbPath+=GetComponentID();
640 AliInfoClass(Form("reconfigure '%s' from entry %s%s", chainId, cdbPath.Data(), cdbEntry?"":" (default)"));
641 iResult=ConfigureFromCDBTObjString(cdbPath);
646 // #################################################################################
647 Int_t AliHLTMultiplicityCorrelationsComponent::ReadPreprocessorValues(const Char_t* /*modules*/) {
648 // see header file for class documentation
649 ALIHLTERRORGUARD(5, "ReadPreProcessorValues not implemented for this component");