]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/global/AliHLTGlobalTrackMergerComponent.cxx
Removing obsolete macros
[u/mrichter/AliRoot.git] / HLT / global / AliHLTGlobalTrackMergerComponent.cxx
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
25 using namespace std;
26 #include <climits>
27 #include <cassert>
28 #include <cstdlib>
29 #include <cerrno>
30
31 #include "AliESDEvent.h"
32 #include "AliTracker.h"
33 #include "AliHLTGlobalTrackMerger.h"
34 #include "AliHLTGlobalTrackMergerComponent.h"
35
36 /** ROOT macro for the implementation of ROOT specific class methods */
37 ClassImp(AliHLTGlobalTrackMergerComponent)
38
39 //_____________________________________________________________________________
40 AliHLTGlobalTrackMergerComponent::AliHLTGlobalTrackMergerComponent() : AliHLTGlobalEsdConverterComponent(), 
41   fGlobalTrackMerger(0)
42 {
43 }
44
45 //_____________________________________________________________________________
46 AliHLTGlobalTrackMergerComponent::~AliHLTGlobalTrackMergerComponent()
47 {
48   // see header file for class documentation
49 }
50
51 //_____________________________________________________________________________
52 const char* AliHLTGlobalTrackMergerComponent::GetComponentID()
53 {
54   // see header file for class documentation
55   return "GlobalTrackMerger";
56 }
57
58 //_____________________________________________________________________________
59 void AliHLTGlobalTrackMergerComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
60 {
61   // see header file for class documentation
62   list.push_back( kAliHLTDataTypeTrack );
63 }
64
65 //_____________________________________________________________________________
66 // AliHLTComponentDataType AliHLTGlobalTrackMergerComponent::GetOutputDataType()
67 // {
68 //   // see header file for class documentation
69 //   return kAliHLTDataTypeESDObject|kAliHLTDataOriginTPC;
70 // }
71
72 //_____________________________________________________________________________
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 // }
80
81 //_____________________________________________________________________________
82 AliHLTComponent* AliHLTGlobalTrackMergerComponent::Spawn()
83 {
84   // see header file for class documentation
85   return new AliHLTGlobalTrackMergerComponent;
86 }
87
88 //_____________________________________________________________________________
89 void 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 //_____________________________________________________________________________
96 int AliHLTGlobalTrackMergerComponent::DoInit( int /*argc*/, const char** /*argv*/ )
97 {
98   // see header file for class documentation
99   const char* argv = "-notree";
100   AliHLTGlobalEsdConverterComponent::DoInit(1,&argv);
101
102   int iResult = 0;
103   
104   // Init merger
105   fGlobalTrackMerger = new AliHLTGlobalTrackMerger();
106
107   if (!fGlobalTrackMerger ) {
108      HLTError("failed creating internal objects");
109      iResult=-ENOMEM;
110      return iResult;
111   }
112
113   SetMergerParameters();
114
115   return iResult;
116 }
117
118 //_____________________________________________________________________________
119 int AliHLTGlobalTrackMergerComponent::DoDeinit()
120 {
121   // see header file for class documentation
122   if(fGlobalTrackMerger) delete fGlobalTrackMerger; fGlobalTrackMerger =0;
123   AliHLTGlobalEsdConverterComponent::DoDeinit();
124   return 0;
125 }
126
127 //_____________________________________________________________________________
128 int AliHLTGlobalTrackMergerComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/, 
129                                               AliHLTComponentTriggerData& /*trigData*/)
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
146   fESD->Reset(); 
147   fESD->SetMagneticField(fSolenoidBz);
148   //fESD->SetMagneticField(AliTracker::GetBz());
149
150   if ((iResult=ProcessBlocks(NULL, fESD))<0) return iResult;
151   if(!fESD->GetNumberOfTracks()>0) return iResult;
152
153    // merge tracks
154    Bool_t isMerged = fGlobalTrackMerger->Merge(fESD);
155    if(!isMerged) {
156      HLTInfo("No merged tracks");
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);
168    PushBack(fESD, kAliHLTDataTypeESDObject|kAliHLTDataOriginOut);
169
170    // clean ESD event content
171    fESD->Reset();
172   
173 return iResult;
174 }
175
176