]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCAgent.cxx
Trigger bit mask and multiplicity per PMT in the VZERO ESD. Related changes and class...
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCAgent.cxx
CommitLineData
5578cf60 1// @(#) $Id$
2
0efebbac 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: Matthias Richter <Matthias.Richter@ift.uib.no> *
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//**************************************************************************
5578cf60 18
19/** @file AliHLTTPCAgent.cxx
20 @author Matthias Richter
21 @date
22 @brief Agent of the libAliHLTTPC library
23*/
24
25#include "AliHLTTPCAgent.h"
26#include "AliHLTConfiguration.h"
626bfcc1 27#include "AliHLTTPCDefinitions.h"
28#include "AliHLTOUT.h"
352670bf 29#include "AliRunLoader.h"
5578cf60 30
31/** global instance for agent registration */
32AliHLTTPCAgent gAliHLTTPCAgent;
33
e1440dab 34// component headers
672f8b8c 35#include "AliHLTTPCRunStatisticsProducerComponent.h"
36#include "AliHLTTPCEventStatisticsProducerComponent.h"
37#include "AliHLTTPCCompModelInflaterComponent.h"
38#include "AliHLTTPCCompModelDeflaterComponent.h"
39#include "AliHLTTPCCompModelDeconverterComponent.h"
40#include "AliHLTTPCCompModelConverterComponent.h"
41#include "AliHLTTPCCompDumpComponent.h"
42#include "AliHLTTPCCalibCEComponent.h"
43#include "AliHLTTPCCalibPulserComponent.h"
44#include "AliHLTTPCCalibPedestalComponent.h"
45#include "AliHLTTPCCATrackerComponent.h"
46#include "AliHLTTPCGlobalMergerComponent.h"
47#include "AliHLTTPCSliceTrackerComponent.h"
48#include "AliHLTTPCVertexFinderComponent.h"
49#include "AliHLTTPCClusterFinderComponent.h"
50#include "AliHLTTPCRawDataUnpackerComponent.h"
51#include "AliHLTTPCDigitPublisherComponent.h"
52#include "AliHLTTPCZeroSuppressionComponent.h"
e1440dab 53#include "AliHLTTPCDigitDumpComponent.h"
0efebbac 54#include "AliHLTTPCClusterDumpComponent.h"
f32b83e1 55#include "AliHLTTPCEsdWriterComponent.h"
1ac82ce6 56#include "AliHLTTPCOfflineClustererComponent.h"
57#include "AliHLTTPCOfflineTrackerComponent.h"
0efebbac 58#include "AliHLTTPCClusterHistoComponent.h"
e1440dab 59
5578cf60 60/** ROOT macro for the implementation of ROOT specific class methods */
61ClassImp(AliHLTTPCAgent)
62
63AliHLTTPCAgent::AliHLTTPCAgent()
626bfcc1 64 :
65 AliHLTModuleAgent("TPC"),
66 fRawDataHandler(NULL),
67 fNofRawDataHandler(0)
5578cf60 68{
69 // see header file for class documentation
70 // or
71 // refer to README to build package
72 // or
73 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
74}
75
76AliHLTTPCAgent::~AliHLTTPCAgent()
77{
78 // see header file for class documentation
79}
80
81int AliHLTTPCAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
dee38f1b 82 AliRawReader* /*rawReader*/,
298ef463 83 AliRunLoader* /*runloader*/) const
5578cf60 84{
85 // see header file for class documentation
86 if (handler) {
672f8b8c 87
88 // This the tracking configuration for the full TPC
89 // - 216 clusterfinders (1 per partition)
90 // - 36 slice trackers
91 // - one global merger
92 // - the esd converter
93 // The ESD is shipped embedded into a TTree
dfa1592e 94 int iMinSlice=0;
672f8b8c 95 int iMaxSlice=35;
dfa1592e 96 int iMinPart=0;
672f8b8c 97 int iMaxPart=5;
98 TString mergerInput;
dfa1592e 99 for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
100 TString trackerInput;
101 for (int part=iMinPart; part<=iMaxPart; part++) {
102 TString arg, publisher, cf;
103
104 // digit publisher components
105 arg.Form("-slice %d -partition %d", slice, part);
0ba35c53 106 publisher.Form("TPC-DP_%02d_%d", slice, part);
dfa1592e 107 handler->CreateConfiguration(publisher.Data(), "TPCDigitPublisher", NULL , arg.Data());
108
109 // cluster finder components
0ba35c53 110 cf.Form("TPC-CF_%02d_%d", slice, part);
dfa1592e 111 handler->CreateConfiguration(cf.Data(), "TPCClusterFinderUnpacked", publisher.Data(), "pp-run timebins 446");
112 if (trackerInput.Length()>0) trackerInput+=" ";
113 trackerInput+=cf;
114 }
115 TString tracker;
116 // tracker finder components
0ba35c53 117 tracker.Form("TPC-TR_%02d", slice);
672f8b8c 118 handler->CreateConfiguration(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "-pp-run -bfield 0.5");
dfa1592e 119
672f8b8c 120 if (mergerInput.Length()>0) mergerInput+=" ";
121 mergerInput+=tracker;
dfa1592e 122
dfa1592e 123 }
5578cf60 124
672f8b8c 125 // GlobalMerger component
0ba35c53 126 handler->CreateConfiguration("TPC-globalmerger","TPCGlobalMerger",mergerInput.Data(),"");
672f8b8c 127
128 // the esd converter configuration
0ba35c53 129 handler->CreateConfiguration("TPC-esd-converter", "TPCEsdConverter" , "TPC-globalmerger", "-tree");
5578cf60 130 }
131 return 0;
132}
133
dee38f1b 134const char* AliHLTTPCAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
ff6648de 135 AliRunLoader* runloader) const
5578cf60 136{
137 // see header file for class documentation
ff6648de 138 if (runloader) {
139 // reconstruction chains for AliRoot simulation
140 // Note: run loader is only available while running embedded into
141 // AliRoot simulation
352670bf 142 if (runloader->GetLoader("TPCLoader") != NULL)
143 return "TPC-esd-converter";
ff6648de 144 }
145 return NULL;
5578cf60 146}
147
148const char* AliHLTTPCAgent::GetRequiredComponentLibraries() const
149{
150 // see header file for class documentation
5ad1e184 151
152 // actually, the TPC library has dependencies to Util and RCU
153 // so the two has to be loaded anyhow before we get here
154 //return "libAliHLTUtil.so libAliHLTRCU.so";
5578cf60 155 return NULL;
156}
f3506ea2 157
e1440dab 158int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
f3506ea2 159{
e1440dab 160 // see header file for class documentation
161 if (!pHandler) return -EINVAL;
672f8b8c 162
163 pHandler->AddComponent(new AliHLTTPCRunStatisticsProducerComponent);
164 pHandler->AddComponent(new AliHLTTPCEventStatisticsProducerComponent);
165 pHandler->AddComponent(new AliHLTTPCCalibCEComponent);
166 pHandler->AddComponent(new AliHLTTPCCalibPulserComponent);
167 pHandler->AddComponent(new AliHLTTPCCalibPedestalComponent);
168 pHandler->AddComponent(new AliHLTTPCCompModelInflaterComponent);
169 pHandler->AddComponent(new AliHLTTPCCompModelDeflaterComponent);
170 pHandler->AddComponent(new AliHLTTPCCompModelDeconverterComponent);
171 pHandler->AddComponent(new AliHLTTPCCompModelConverterComponent);
172 pHandler->AddComponent(new AliHLTTPCCompDumpComponent);
173 pHandler->AddComponent(new AliHLTTPCCATrackerComponent);
174 pHandler->AddComponent(new AliHLTTPCGlobalMergerComponent);
175 pHandler->AddComponent(new AliHLTTPCSliceTrackerComponent);
176 pHandler->AddComponent(new AliHLTTPCVertexFinderComponent);
177 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderPacked));
178 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderUnpacked));
179 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderDecoder));
180 pHandler->AddComponent(new AliHLTTPCRawDataUnpackerComponent);
181 pHandler->AddComponent(new AliHLTTPCDigitPublisherComponent);
182 pHandler->AddComponent(new AliHLTTPCZeroSuppressionComponent);
e1440dab 183 pHandler->AddComponent(new AliHLTTPCDigitDumpComponent);
0efebbac 184 pHandler->AddComponent(new AliHLTTPCClusterDumpComponent);
f32b83e1 185 pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliWriter);
186 pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliConverter);
1ac82ce6 187 pHandler->AddComponent(new AliHLTTPCOfflineClustererComponent);
188 pHandler->AddComponent(new AliHLTTPCOfflineTrackerComponent);
0efebbac 189 pHandler->AddComponent(new AliHLTTPCClusterHistoComponent);
f32b83e1 190
f3506ea2 191 return 0;
192}
626bfcc1 193
194int AliHLTTPCAgent::GetHandlerDescription(AliHLTComponentDataType dt,
195 AliHLTUInt32_t spec,
196 AliHLTOUTHandlerDesc& desc) const
197{
198 // see header file for class documentation
199 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
200 int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
201 int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
202 if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
203 part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
204 desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
205 return 1;
206 } else {
207 HLTWarning("handler can not process merged data from multiple ddls:"
208 " min slice %d, max slice %d, min part %d, max part %d",
209 slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
210 part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));
211 return 0;
212 }
213 }
214 return 0;
215}
216
217AliHLTOUTHandler* AliHLTTPCAgent::GetOutputHandler(AliHLTComponentDataType dt,
b0914d2e 218 AliHLTUInt32_t /*spec*/)
626bfcc1 219{
220 // see header file for class documentation
221 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
222 if (!fRawDataHandler) {
223 fRawDataHandler=new AliHLTTPCAgent::AliHLTTPCRawDataHandler;
224 }
225 fNofRawDataHandler++;
226 return fRawDataHandler;
227 }
228 return NULL;
229}
230
231int AliHLTTPCAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
232{
233 // see header file for class documentation
234 if (pInstance==NULL) return -EINVAL;
235
236 if (pInstance==fRawDataHandler) {
237 if (--fNofRawDataHandler<=0) {
238 delete fRawDataHandler;
239 fRawDataHandler=NULL;
240 }
241 }
242 return 0;
243}
244
245AliHLTTPCAgent::AliHLTTPCRawDataHandler::AliHLTTPCRawDataHandler()
246{
247 // see header file for class documentation
248}
249
250AliHLTTPCAgent::AliHLTTPCRawDataHandler::~AliHLTTPCRawDataHandler()
251{
252 // see header file for class documentation
253}
254
255int AliHLTTPCAgent::AliHLTTPCRawDataHandler::ProcessData(AliHLTOUT* pData)
256{
257 // see header file for class documentation
258 if (!pData) return -EINVAL;
259 AliHLTComponentDataType dt=kAliHLTVoidDataType;
260 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
261 int iResult=pData->GetDataBlockDescription(dt, spec);
262 if (iResult>=0) {
263 int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
264 int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
265 if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
266 part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
267 iResult=768;
268 if (part>1) iResult+=72+4*slice+(part-2);
269 else iResult+=2*slice+part;
270 } else {
271 HLTError("handler can not process merged data from multiple ddls:"
272 " min slice %d, max slice %d, min part %d, max part %d",
273 slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
274 part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));
275 iResult=-EBADMSG;
276 }
277 }
278 return iResult;
279}