]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TRD/AliHLTTRDOfflineTrackerV1Component.cxx
using function 'IsDataEvent' instead of checking for specific event types (Theo)
[u/mrichter/AliRoot.git] / HLT / TRD / AliHLTTRDOfflineTrackerV1Component.cxx
CommitLineData
4de61263 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: *
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 AliHLTTRDOfflineTrackerV1Component.cxx
80984499 20 @author Theodor Rascanu
21 @date
22 @brief Handles high level (object based) and low level (pod) input data (clusters). For debug purposes only
4de61263 23*/
24
25#include "AliHLTTRDOfflineTrackerV1Component.h"
2359a6ef 26#include "AliHLTTRDDefinitions.h"
c1c0ed93 27#include "AliHLTTRDUtils.h"
28#include "AliTRDrecoParam.h"
29#include "AliTRDtrackerV1.h"
30#include "AliTRDReconstructor.h"
31#include "AliCDBManager.h"
32#include "AliESDEvent.h"
33#include "TClonesArray.h"
34#include "TObjString.h"
35
36#include "AliTRDtrackV1.h"
37#include "AliTRDseedV1.h"
38#include "AliTRDcluster.h"
4de61263 39
40ClassImp(AliHLTTRDOfflineTrackerV1Component)
41
2359a6ef 42AliHLTTRDOfflineTrackerV1Component::AliHLTTRDOfflineTrackerV1Component()
43 :AliHLTTRDTrackerV1Component()
4de61263 44{
45 // Default constructor
4de61263 46}
47
48AliHLTTRDOfflineTrackerV1Component::~AliHLTTRDOfflineTrackerV1Component()
49{
50 // Destructor
51 // Work is Done in DoDeInit()
52}
53
c1c0ed93 54void AliHLTTRDOfflineTrackerV1Component::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
55{
56 // Get the list of input data
57 list.clear();
58 AliHLTTRDTrackerV1Component::GetInputDataTypes(list);
59 list.push_back(AliHLTTRDDefinitions::fgkHiLvlClusterDataType);
60}
61
62AliHLTComponentDataType AliHLTTRDOfflineTrackerV1Component::GetOutputDataType()
63{
64 // Get the output data type
65 return kAliHLTMultipleDataType;
66}
67
2359a6ef 68int AliHLTTRDOfflineTrackerV1Component::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
69{
70 // Get the output data types
71 tgtList.clear();
07f31c0e 72 tgtList.push_back(AliHLTTRDDefinitions::fgkHiLvlTracksDataType);
2359a6ef 73 return tgtList.size();
74}
75
76void AliHLTTRDOfflineTrackerV1Component::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
77{
78 // Get the output data size
c1c0ed93 79 AliHLTTRDTrackerV1Component::GetOutputDataSize(constBase, inputMultiplier);
80 constBase += 500;
2359a6ef 81}
82
4de61263 83AliHLTComponent* AliHLTTRDOfflineTrackerV1Component::Spawn()
84{
85 // Spawn function, return new instance of this class
86 return new AliHLTTRDOfflineTrackerV1Component;
87};
88
89int AliHLTTRDOfflineTrackerV1Component::DoInit( int argc, const char** argv )
90{
2359a6ef 91 int iResult = 0;
2359a6ef 92 iResult=AliHLTTRDTrackerV1Component::DoInit(argc, argv);
c1c0ed93 93 fRecoParam->SetStreamLevel(AliTRDrecoParam::kTracker, 1); // in order to have the friends written
2359a6ef 94 return iResult;
4de61263 95}
96
97const char* AliHLTTRDOfflineTrackerV1Component::GetComponentID()
98{
99 // Return the component ID const char *
100 return "TRDOfflineTrackerV1"; // The ID of this component
101}
102
9cafabed 103int AliHLTTRDOfflineTrackerV1Component::DoEvent(const AliHLTComponent_EventData& evtData, const AliHLTComponent_BlockData* blocks,
104 AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr,
105 AliHLTUInt32_t& size, vector<AliHLTComponent_BlockData>& outputBlocks )
106{
dd986ca2 107 if(!IsDataEvent())return 0;
c1c0ed93 108
109 if(!GetFirstInputBlock(AliHLTTRDDefinitions::fgkHiLvlClusterDataType))
110 return AliHLTTRDTrackerV1Component::DoEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks );
111
112 for(const TObject *iter = GetFirstInputObject(AliHLTTRDDefinitions::fgkHiLvlClusterDataType); iter; iter = GetNextInputObject())
113 {
114 TClonesArray* clusterArray = dynamic_cast<TClonesArray*>(const_cast<TObject*>(iter));
115 if(!clusterArray)continue;
116 TObjString* strg = dynamic_cast<TObjString*>(const_cast<TObject*>(GetNextInputObject()));
117 if(!strg)continue;
118
119 fNtimeBins = strg->String().Atoi();
120 fESD->Reset();
121 AliTRDtrackerV1::SetNTimeBins(fNtimeBins);
122 HLTDebug("TClonesArray of clusters: nbEntries = %i", clusterArray->GetEntriesFast());
123 fTracker->LoadClusters(clusterArray);
124 fTracker->Clusters2Tracks(fESD);
125 Int_t nTracks = fESD->GetNumberOfTracks();
126 HLTInfo("Number of tracks == %d ==", nTracks);
127 TClonesArray* trdTracks = fTracker->GetListOfTracks();
128
129 if(fEmulateHLTTracks && trdTracks){
130 trdTracks = new TClonesArray(*trdTracks);
131 AliHLTTRDUtils::EmulateHLTTracks(trdTracks);
132 }
133
80984499 134 AliHLTUInt32_t spec = GetSpecification(iter);
c2b5794c 135 if(trdTracks)
80984499 136 PushBack(trdTracks, AliHLTTRDDefinitions::fgkHiLvlTracksDataType, spec);
c2b5794c 137 else{
138 TClonesArray temp("AliTRDtrackV1");
80984499 139 PushBack(&temp, AliHLTTRDDefinitions::fgkHiLvlTracksDataType, spec);
c2b5794c 140 }
80984499 141 PushBack(strg, AliHLTTRDDefinitions::fgkHiLvlTracksDataType, spec);
c1c0ed93 142 fTracker->UnloadClusters();
143 AliTRDReconstructor::SetClusters(0x0);
144
145 if(fEmulateHLTTracks && trdTracks){
146 trdTracks->Delete();
147 delete trdTracks;
148 }
149 }
150 return 0;
9cafabed 151}