]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TRD/AliHLTTRDOfflineClusterizerComponent.cxx
add histograms: distributions of eta, phi and pt (Theo)
[u/mrichter/AliRoot.git] / HLT / TRD / AliHLTTRDOfflineClusterizerComponent.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 AliHLTTRDOfflineClusterizerComponent.cxx
80984499 20 @author Theodor Rascanu
4de61263 21 @date
80984499 22 @brief Processes digits (with MC) and raw data (without MC). For debug purposes only
4de61263 23*/
24
25// see header file for class documentation //
26// or //
27// refer to README to build package //
28// or //
29// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt //
30
31#include "AliHLTTRDOfflineClusterizerComponent.h"
e47650f5 32#include "AliHLTTRDDefinitions.h"
33#include "AliHLTTRDClusterizer.h"
34#include "AliHLTTRDUtils.h"
4de61263 35#include "AliCDBManager.h"
e47650f5 36#include "TTree.h"
37#include "TClonesArray.h"
38#include "TObjString.h"
4de61263 39
40ClassImp(AliHLTTRDOfflineClusterizerComponent)
41
e47650f5 42AliHLTTRDOfflineClusterizerComponent::AliHLTTRDOfflineClusterizerComponent()
43 :AliHLTTRDClusterizerComponent()
44 ,fOffClusterizer(NULL)
4de61263 45{
46 // Default constructor
4de61263 47}
48
49AliHLTTRDOfflineClusterizerComponent::~AliHLTTRDOfflineClusterizerComponent()
50{
51 // Destructor
52 // Work is Done in DoDeInit()
53}
54
55AliHLTComponent* AliHLTTRDOfflineClusterizerComponent::Spawn()
56{
57 // Spawn function, return new instance of this class
58 return new AliHLTTRDOfflineClusterizerComponent;
59};
60
61const char* AliHLTTRDOfflineClusterizerComponent::GetComponentID()
62{
63 // Return the component ID const char *
64 return "TRDOfflineClusterizer"; // The ID of this component
65}
66
e47650f5 67void AliHLTTRDOfflineClusterizerComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
4de61263 68{
e47650f5 69 // Get the list of input data
70 list.clear();
71 AliHLTTRDClusterizerComponent::GetInputDataTypes(list);
72 list.push_back(AliHLTTRDDefinitions::fgkDigitsDataType);
4de61263 73}
74
e47650f5 75AliHLTComponentDataType AliHLTTRDOfflineClusterizerComponent::GetOutputDataType()
76{
77 // Get the output data type
78 return kAliHLTMultipleDataType;
79}
80
81int AliHLTTRDOfflineClusterizerComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
82{
83 // Get the output data types
84 tgtList.clear();
85 AliHLTTRDClusterizerComponent::GetOutputDataTypes(tgtList);
86 tgtList.push_back(AliHLTTRDDefinitions::fgkHiLvlClusterDataType);
87 return tgtList.size();
4de61263 88}
9cafabed 89
e47650f5 90void AliHLTTRDOfflineClusterizerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
9cafabed 91{
e47650f5 92 // Get the output data size
93 AliHLTTRDClusterizerComponent::GetOutputDataSize(constBase, inputMultiplier);
94 constBase += 500;
95 inputMultiplier *= 10;
96}
97
98int AliHLTTRDOfflineClusterizerComponent::DoInit( int argc, const char** argv )
99{
100 int iResult = 0;
101 iResult=AliHLTTRDClusterizerComponent::DoInit(argc, argv);
102
103 return iResult;
9cafabed 104}
105
106int AliHLTTRDOfflineClusterizerComponent::DoEvent(const AliHLTComponent_EventData& evtData, const AliHLTComponent_BlockData* blocks,
107 AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr,
108 AliHLTUInt32_t& size, vector<AliHLTComponent_BlockData>& outputBlocks )
109{
dd986ca2 110 if(!IsDataEvent())return 0;
9cafabed 111
e47650f5 112 if(!GetFirstInputBlock(AliHLTTRDDefinitions::fgkDigitsDataType))
113 return AliHLTTRDClusterizerComponent::DoEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks );
114
115 AliHLTUInt32_t offset = 0;
116
117 for(const TObject *iter = GetFirstInputObject(AliHLTTRDDefinitions::fgkDigitsDataType); iter; iter = GetNextInputObject())
118 {
119 AliTRDclusterizer* clusterizer = new AliTRDclusterizer("TRDCclusterizer", "TRDCclusterizer");
120 clusterizer->SetReconstructor(fReconstructor);
121 clusterizer->SetUseLabels(kTRUE);
122
123 TTree* digitsTree = dynamic_cast<TTree*>(const_cast<TObject*>(iter));
124 clusterizer->ReadDigits(digitsTree);
125 clusterizer->MakeClusters();
126 TClonesArray* clusterArray = clusterizer->RecPoints();
127 clusterizer->SetClustersOwner(kFALSE);
128
80984499 129 AliHLTUInt32_t spec = GetSpecification(iter);
e47650f5 130 if(fHighLevelOutput){
131 if(fEmulateHLTClusters){
132 TClonesArray* temp = clusterArray;
133 clusterArray = new TClonesArray(*temp);
134 temp->Delete();
135 delete temp;
136 AliHLTTRDUtils::EmulateHLTClusters(clusterArray);
137 }
138 TObjString strg;
139 strg.String() += clusterizer->GetNTimeBins();
80984499 140 PushBack(clusterArray, AliHLTTRDDefinitions::fgkHiLvlClusterDataType, spec);
141 PushBack(&strg, AliHLTTRDDefinitions::fgkHiLvlClusterDataType, spec);
e47650f5 142 } else {
143 Int_t nTimeBins = clusterizer->GetNTimeBins();
144 Int_t addedSize = AliHLTTRDUtils::AddClustersToOutput(clusterArray, outputPtr+offset, nTimeBins);
145
146 AliHLTComponentBlockData bd;
147 FillBlockData( bd );
148 bd.fOffset = offset;
149 bd.fSize = addedSize;
80984499 150 bd.fSpecification = spec;
e47650f5 151 bd.fDataType = AliHLTTRDDefinitions::fgkClusterDataType;
152 outputBlocks.push_back( bd );
153 HLTDebug( "BD ptr 0x%x, offset %i, size %i, dataType %s, spec 0x%x ", bd.fPtr, bd.fOffset, bd.fSize, DataType2Text(bd.fDataType).c_str(), bd.fSpecification);
154 offset += addedSize;
155 }
156 clusterArray->Delete();
157 delete clusterArray;
158 delete clusterizer;
159 }
160
161 return 0;
162
163}