Using common HLT track data format for TRD tracks (Theodor)
[u/mrichter/AliRoot.git] / HLT / global / AliHLTGlobalTrackMergerComponent.cxx
CommitLineData
ec6160d5 1// $Id$
2
3//**************************************************************************
4//* This file is property of and copyright by the ALICE HLT Project *
5//* ALICE Experiment at CERN, All rights reserved. *
6//* *
7//* Primary Authors: Jacek Otwinowski <Jacek.Otwinowski@gsi.de> *
8//* for The ALICE HLT Project. *
9//* *
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//**************************************************************************
18
19/** @file AliHLTGlobalTrackMergerComponent.cxx
20 @author Jacek Otwinowski
21 @date
22 @brief HLT global track merger component.
23*/
24
25using namespace std;
26#include <climits>
27#include <cassert>
ec6160d5 28#include <cstdlib>
29#include <cerrno>
30
31#include "AliESDEvent.h"
32#include "AliTracker.h"
ec6160d5 33#include "AliHLTGlobalTrackMerger.h"
ec6160d5 34#include "AliHLTGlobalTrackMergerComponent.h"
35
36/** ROOT macro for the implementation of ROOT specific class methods */
18ada816 37ClassImp(AliHLTGlobalTrackMergerComponent)
ec6160d5 38
39//_____________________________________________________________________________
18ada816 40AliHLTGlobalTrackMergerComponent::AliHLTGlobalTrackMergerComponent() : AliHLTGlobalEsdConverterComponent(),
41 fGlobalTrackMerger(0)
ec6160d5 42{
43}
44
45//_____________________________________________________________________________
46AliHLTGlobalTrackMergerComponent::~AliHLTGlobalTrackMergerComponent()
47{
48 // see header file for class documentation
49}
50
51//_____________________________________________________________________________
52const char* AliHLTGlobalTrackMergerComponent::GetComponentID()
53{
54 // see header file for class documentation
55 return "GlobalTrackMerger";
56}
57
58//_____________________________________________________________________________
59void AliHLTGlobalTrackMergerComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
60{
61 // see header file for class documentation
18ada816 62 list.push_back( kAliHLTDataTypeTrack );
ec6160d5 63}
64
65//_____________________________________________________________________________
18ada816 66// AliHLTComponentDataType AliHLTGlobalTrackMergerComponent::GetOutputDataType()
67// {
68// // see header file for class documentation
69// return kAliHLTDataTypeESDObject|kAliHLTDataOriginTPC;
70// }
ec6160d5 71
72//_____________________________________________________________________________
18ada816 73// void AliHLTGlobalTrackMergerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
74// {
75// // see header file for class documentation
76// // XXX TODO: Find more realistic values.
77// constBase = 20000;
78// inputMultiplier = 1.0;
79// }
ec6160d5 80
81//_____________________________________________________________________________
82AliHLTComponent* AliHLTGlobalTrackMergerComponent::Spawn()
83{
84 // see header file for class documentation
85 return new AliHLTGlobalTrackMergerComponent;
86}
87
88//_____________________________________________________________________________
89void AliHLTGlobalTrackMergerComponent::SetMergerParameters(Double_t maxy,Double_t maxz,Double_t maxkappa,Double_t maxpsi,Double_t maxtgl)
90{
91 // see header file for class documentation
92 fGlobalTrackMerger->SetParameter( maxy, maxz, maxkappa, maxpsi, maxtgl );
93}
94
95//_____________________________________________________________________________
96int AliHLTGlobalTrackMergerComponent::DoInit( int /*argc*/, const char** /*argv*/ )
97{
98 // see header file for class documentation
18ada816 99 const char* argv = "-notree";
100 AliHLTGlobalEsdConverterComponent::DoInit(1,&argv);
101
ec6160d5 102 int iResult = 0;
103
104 // Init merger
105 fGlobalTrackMerger = new AliHLTGlobalTrackMerger();
ec6160d5 106
18ada816 107 if (!fGlobalTrackMerger ) {
ec6160d5 108 HLTError("failed creating internal objects");
109 iResult=-ENOMEM;
110 return iResult;
111 }
112
113 SetMergerParameters();
114
115 return iResult;
116}
117
118//_____________________________________________________________________________
119int AliHLTGlobalTrackMergerComponent::DoDeinit()
120{
121 // see header file for class documentation
122 if(fGlobalTrackMerger) delete fGlobalTrackMerger; fGlobalTrackMerger =0;
18ada816 123 AliHLTGlobalEsdConverterComponent::DoDeinit();
ec6160d5 124 return 0;
125}
126
127//_____________________________________________________________________________
18ada816 128int AliHLTGlobalTrackMergerComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
129 AliHLTComponentTriggerData& /*trigData*/)
ec6160d5 130{
131 //
132 // global track merger function
133 // takes TRD and TPC tracks and merges them
134 //
135 HLTInfo("DoEvent processing data");
136
137 // see header file for class documentation
138 int iResult=0;
139
140 if(!fGlobalTrackMerger || !fESD) {
141 HLTError("component not initialized");
142 iResult=-ENOMEM;
143 return iResult;
144 }
145
18ada816 146 fESD->Reset();
147 fESD->SetMagneticField(fSolenoidBz);
148 //fESD->SetMagneticField(AliTracker::GetBz());
ec6160d5 149
18ada816 150 if ((iResult=ProcessBlocks(NULL, fESD))<0) return iResult;
151 if(!fESD->GetNumberOfTracks()>0) return iResult;
ec6160d5 152
153 // merge tracks
154 Bool_t isMerged = fGlobalTrackMerger->Merge(fESD);
155 if(!isMerged) {
a9f060e5 156 HLTInfo("No merged tracks");
ec6160d5 157 }
158
159 // try to propagate all tracks to DCA to primary vertex
160 fGlobalTrackMerger->PropagateTracksToDCA(fESD);
161
162 // calculate specification
163 // AliHLTUInt32_t iSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( minSlice, maxSlice, 0, 5 );
164 // HLTInfo("minSlice %d, maxSlice %d", minSlice, maxSlice);
165
166 // send output data
167 //PushBack(fESD, kAliHLTDataTypeESDObject|kAliHLTDataOriginTPC, iSpecification);
18ada816 168 PushBack(fESD, kAliHLTDataTypeESDObject|kAliHLTDataOriginOut);
ec6160d5 169
a9f060e5 170 // clean ESD event content
ec6160d5 171 fESD->Reset();
172
173return iResult;
174}
175
176