]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/FMD/AliHLTFMDReconstructionComponent.cxx
New production macros (Yves)
[u/mrichter/AliRoot.git] / HLT / FMD / AliHLTFMDReconstructionComponent.cxx
CommitLineData
629266d1 1
2#if __GNUC__ >= 3
3using namespace std;
4#endif
5
6#include "AliHLTSystem.h"
7#include "AliRawReaderMemory.h"
8#include "AliFMDRawReader.h"
9#include "AliESDFMD.h"
10#include "AliHLTDataTypes.h"
11#include "TClonesArray.h"
12#include "AliHLTFMDReconstructionComponent.h"
13#include "AliHLTDefinitions.h"
14#include "AliCDBManager.h"
15#include "AliFMDParameters.h"
16#include "AliHLTDataTypes.h"
17#include "TH1F.h"
18#include "AliLog.h"
19#include "AliGeomManager.h"
20#include "AliFMDGeometry.h"
21#include <cstdlib>
22#include <cerrno>
23
24ClassImp(AliHLTFMDReconstructionComponent)
25
26//_____________________________________________________________________
27
28AliHLTFMDReconstructionComponent::AliHLTFMDReconstructionComponent()
29 : fRunNumber(0)
30{
31
32}
33
34//_____________________________________________________________________
35
36AliHLTFMDReconstructionComponent::~AliHLTFMDReconstructionComponent()
37{
38 // see header file for class documentation
39}
40
41//_____________________________________________________________________
42AliHLTFMDReconstructionComponent::AliHLTFMDReconstructor::AliHLTFMDReconstructor()
43 : AliFMDReconstructor()
44{
45 fDiagnostics = kFALSE;
46
47}
48
49//_____________________________________________________________________
50void AliHLTFMDReconstructionComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
51{
52 list.push_back(kAliHLTDataTypeDDLRaw);
53
54}
55
56//______________________________________________________________________
57AliHLTComponentDataType AliHLTFMDReconstructionComponent::GetOutputDataType()
58{
59 return kAliHLTDataTypeESDTree;
60}
61
62//______________________________________________________________________
63void AliHLTFMDReconstructionComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
64{
65
66 constBase = 2000000;
67 inputMultiplier = 1;
68}
69
70//______________________________________________________________________
71
72AliHLTComponent* AliHLTFMDReconstructionComponent::Spawn()
73{
74
75 return new AliHLTFMDReconstructionComponent;
76}
77
78//______________________________________________________________________
79int AliHLTFMDReconstructionComponent::DoInit( int argc, const char** argv )
80{
81 char* cpErr;
82 Int_t i = 0;
83 while ( i < argc )
84 {
85 if ( !strcmp( argv[i], "run_number" ) ||
86 !strcmp( argv[i], "-run_number" ))
87 {
88 if ( i+1>=argc )
89 {
90 HLTError("Missing run_number parameter");
91 return -EINVAL;
92 }
93 fRunNumber = strtoul( argv[i+1], &cpErr, 0 );
94 if ( *cpErr )
95 {
96 HLTError("Cannot convert run_number parameter '%s'", argv[i+1] );
97 return -EINVAL;
98 }
99 HLTInfo("Run Number set to %lu %%", fRunNumber );
100 i += 2;
101 continue;
102 }
103 HLTError("Unknown option '%s'", argv[i] );
104 return -EINVAL;
105 }
106
107 AliLog::EnableDebug(kFALSE);
108
109 if (GetRunNo() == kAliHLTVoidRunNo) {
110 AliCDBManager* cdb = AliCDBManager::Instance();
111 cdb->SetRun(fRunNumber);
112 }
113 AliFMDParameters::Instance()->Init();
114
115 if (AliGeomManager::GetGeometry() == NULL)
116 AliGeomManager::LoadGeometry();
117
118 AliFMDGeometry* geo = AliFMDGeometry::Instance();
119 geo->Init();
120 geo->InitTransformations();
121
122 return 0;
123}
124
125//______________________________________________________________________
126int AliHLTFMDReconstructionComponent::DoDeinit()
127{
128
129
130 return 0;
131}
132
133//______________________________________________________________________
134int AliHLTFMDReconstructionComponent::DoEvent( const AliHLTComponentEventData& evtData,
135 const AliHLTComponentBlockData* blocks,
136 AliHLTComponentTriggerData& /*trigData*/,
137 AliHLTUInt8_t* /*outputPtr*/,
138 AliHLTUInt32_t& size,
139 vector<AliHLTComponentBlockData>& /*outputBlocks*/ )
140{
141 if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )){
142 size=0;
143 return 0;
144 }
145 // -- Iterator over Data Blocks --
146 const AliHLTComponentBlockData* iter = NULL;
147
148 AliESDEvent esd;
149 esd.CreateStdContent();
150
151 // Process an event
152 //unsigned long totalSize = 0;
153 // Loop over all input blocks in the event
154
155 AliHLTFMDReconstructor rec;
156 rec.Init();
157 for ( unsigned long n = 0; n < evtData.fBlockCnt; n++ ) {
158
159 iter = blocks + n;
160
161 // -- Check for the correct data type
162 if ( iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginFMD) )
163 continue;
164
165 AliRawReaderMemory* reader = new AliRawReaderMemory();
166
167 reader->SetMemory((UChar_t*) iter->fPtr, iter->fSize );
168
169 AliHLTUInt32_t spec = iter->fSpecification;
170
171 Int_t id = 3072;
172 for ( Int_t ii = 0; ii < 24 ; ii++ ) {
173 if ( spec & 0x00000001 ) {
174 id += ii;
175 break;
176 }
177 spec = spec >> 1 ;
178 }
179
180 reader->SetEquipmentID( id );
181
182 AliFMDRawReader* fmdReader = new AliFMDRawReader(reader,0);
183 TClonesArray* digitArray = new TClonesArray("AliFMDDigit",0);
184
185 digitArray->Clear();
186 fmdReader->ReadAdcs(digitArray);
187 rec.ReconstructDigits(digitArray);
188
08dff036 189 delete reader;
190 delete fmdReader;
191 delete digitArray;
192
193 reader = NULL;
194 fmdReader = NULL;
195 digitArray = NULL;
629266d1 196 }
197
198 Int_t iResult = 0;
199
200 esd.SetFMDData(rec.GetFMDData());
201
202 iResult=PushBack(&esd, kAliHLTDataTypeESDObject|kAliHLTDataOriginFMD, 0);
203
08dff036 204
205
206
629266d1 207 return 0;
208}
209