Update master to aliroot
[u/mrichter/AliRoot.git] / HLT / ITS / AliHLTITSClusterFinderComponent.h
CommitLineData
6e34b293 1//-*- Mode: C++ -*-
2// $Id$
6b7742a2 3#ifndef ALIHLTITSCLUSTERFINDERCOMPONENT_H
4#define ALIHLTITSCLUSTERFINDERCOMPONENT_H
5f2721d5 5
6//* This file is property of and copyright by the ALICE HLT Project *
7//* ALICE Experiment at CERN, All rights reserved. *
8//* See cxx source for full Copyright notice *
9
29d7dbc9 10/// @file AliHLTITSClusterFinderComponent.cxx
11/// @author Gaute Ovrebekk <st05886@alf.uib.no>
12/// @date
13/// @brief Component to run the offline clusterfinder.
14///
5f2721d5 15
16#include "AliHLTProcessor.h"
17#include "AliRawReaderMemory.h"
5f2721d5 18#include "AliITSDetTypeRec.h"
5f2721d5 19#include "AliITSgeom.h"
20#include "AliITSInitGeometry.h"
d293cef8 21#include "TClonesArray.h"
a2a2a7ce 22#include "AliHLTDataTypes.h"
618f422f 23#include "TTree.h"
57a4102f 24#include "AliHLTComponentBenchmark.h"
8e5edf3c 25#include "AliITSRecPoint.h"
5f2721d5 26
3f61e9ce 27class AliHLTITSClusterFinderSPD;
a2a2a7ce 28class AliHLTITSClusterFinderSSD;
8e5edf3c 29class AliHLTITSClusterData;
29d7dbc9 30class AliLoader;
3f61e9ce 31
5f2721d5 32/**
6b7742a2 33 * @class AliHLTITSClusterFinderComponent
34 * HLT Component to run the ITS offline clusterfinders.
21de9ddd 35 *
36 * <h2>General properties:</h2>
37 *
6b7742a2 38 * Component ID: \b ITSClusterFinderSPD or ITSClusterFinderSDD or ITSClusterFinderSSD <br>
21de9ddd 39 * Library: \b libAliHLTITS.so <br>
40 * Input Data Types: <br>
6b7742a2 41 * kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITSSPD or kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITSSDD or kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITSSD <br>
21de9ddd 42 *
43 * Output Data Types: <br>
6b7742a2 44 * kAliHLTDataTypeClusters|kAliHLTDataOriginITSSPD or kAliHLTDataTypeClusters|kAliHLTDataOriginITSSDD or kAliHLTDataTypeClusters|kAliHLTDataOriginITSSSD <br>
21de9ddd 45 *
46 * <h2>Mandatory arguments:</h2>
47 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
48 *
49 * <h2>Optional arguments:</h2>
50 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
51 *
52 * <h2>Configuration:</h2>
53 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
54 * \li -config1 <i> teststring </i> <br>
55 * a configuration argument with one parameter
56 * \li -config2 <br>
57 * a configuration argument without parameters
58 *
59 * <h2>Default CDB entries:</h2>
2bd1335e 60 * ITS/Calib/SPDNoisy
61 * ITS/Calib/SPDDead
62 * TRIGGER/SPD/PITConditions
63 * ITS/Calib/CalibSDD
64 * ITS/Calib/RespSDD
65 * ITS/Calib/DriftSpeedSDD
66 * ITS/Calib/DDLMapSDD
67 * ITS/Calib/MapsTimeSDD
68 * ITS/Calib/NoiseSSD
69 * ITS/Calib/GainSSD
70 * ITS/Calib/BadChannelsSSD
71 * GRP/CTP/Scalers
21de9ddd 72 *
73 * <h2>Performance:</h2>
74 * TODO
75 *
76 * <h2>Memory consumption:</h2>
77 * TODO
78 *
79 * <h2>Output size:</h2>
80 * TODO
5f2721d5 81 *
29d7dbc9 82 * <h2>Pending issues:</h2>
83 * There is a general problem with the streaming of the digit tree. A description
84 * is in the GetEvent function. For many events the hotfix for that caused bug
85 * https://savannah.cern.ch/bugs/?72815
86 * This has been fixed by accessing the AliLoader in the CF component via the
87 * global AliRunLoader. This breaks the idea of components, however it's used in
88 * simulation inside AliRoot only.
89 *
5f2721d5 90 * @ingroup alihlt_its_components
91 */
6b7742a2 92class AliHLTITSClusterFinderComponent : public AliHLTProcessor
5f2721d5 93{
94 public:
6b7742a2 95 /**
96 * Defines for selecting clusterfinder for SPD, SDD or SSD.
97 */
98 enum {
99 kClusterFinderSPD,
100 kClusterFinderSDD,
618f422f 101 kClusterFinderSSD,
102 kClusterFinderDigits
6b7742a2 103 };
5f2721d5 104 /*
105 * ---------------------------------------------------------------------------------
106 * Constructor / Destructor
107 * ---------------------------------------------------------------------------------
108 */
109
6b7742a2 110 /** constructor
111 * @param mode input type see e.g. @ref kClusterFinderSPD
112 */
113 AliHLTITSClusterFinderComponent(int mode);
5f2721d5 114
115 /** destructor */
6b7742a2 116 virtual ~AliHLTITSClusterFinderComponent();
5f2721d5 117
118 /*
119 * ---------------------------------------------------------------------------------
120 * Public functions to implement AliHLTComponent's interface.
121 * These functions are required for the registration process
122 * ---------------------------------------------------------------------------------
123 */
124
125 /** interface function, see @ref AliHLTComponent for description */
126 const char* GetComponentID();
127
128 /** interface function, see @ref AliHLTComponent for description */
129 void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
130
131 /** interface function, see @ref AliHLTComponent for description */
132 AliHLTComponentDataType GetOutputDataType();
133
134 /** interface function, see @ref AliHLTComponent for description */
135 virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
136
137 /** interface function, see @ref AliHLTComponent for description */
6eb9783a 138 void GetOCDBObjectDescription( TMap* const targetMap);
139
140 /** interface function, see @ref AliHLTComponent for description */
5f2721d5 141 AliHLTComponent* Spawn();
142
143 protected:
144
145 /*
146 * ---------------------------------------------------------------------------------
147 * Protected functions to implement AliHLTComponent's interface.
148 * These functions provide initialization as well as the actual processing
149 * capabilities of the component.
150 * ---------------------------------------------------------------------------------
151 */
152
153 /** Initialization */
154 Int_t DoInit( int argc, const char** argv );
155
156 /** DeInitialization */
157 Int_t DoDeinit();
158
5f2721d5 159 /** EventLoop */
a2a2a7ce 160
161 Int_t DoEvent(
162 const AliHLTComponentEventData& evtData,
163 const AliHLTComponentBlockData* blocks,
164 AliHLTComponentTriggerData& /*trigData*/,
165 AliHLTUInt8_t* outputPtr,
166 AliHLTUInt32_t& size,
167 vector<AliHLTComponentBlockData>& outputBlocks );
5f2721d5 168
a2a2a7ce 169 //Int_t DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/);
6b7742a2 170
171 int Reconfigure(const char* cdbEntry, const char* chainId);
6eb9783a 172
5f2721d5 173 using AliHLTProcessor::DoEvent;
174
175 ///////////////////////////////////////////////////////////////////////////////////
176
6b7742a2 177 private:
178 /** standard constructor prohibited */
179 AliHLTITSClusterFinderComponent();
5f2721d5 180 /** copy constructor prohibited */
6b7742a2 181 AliHLTITSClusterFinderComponent(const AliHLTITSClusterFinderComponent&);
5f2721d5 182 /** assignment operator prohibited */
6b7742a2 183 AliHLTITSClusterFinderComponent& operator=(const AliHLTITSClusterFinderComponent&);
184 /**
185 * Configure the component.
186 * Parse a string for the configuration arguments and set the component
187 * properties.
188 */
189 int Configure(const char* arguments);
618f422f 190
191 void RecPointToSpacePoint(AliHLTUInt8_t* outputPtr,AliHLTUInt32_t& size);
8e5edf3c 192 void RecpointToOutput(AliHLTITSClusterData *outputClusters, AliITSRecPoint *recpoint, int &clustIdx);
5f2721d5 193 /*
194 * ---------------------------------------------------------------------------------
195 * Members - private
196 * ---------------------------------------------------------------------------------
197 */
198
6b7742a2 199 /**
200 * switch to indicated the ClusterFinder
201 * use fModeSwitch = 0 for SPD
202 * use fModeSwitch = 1 for SDD
203 * use fModeSwitch = 2 for SSD
618f422f 204 * use fModeSwitch = 3 for ClusterFinding on Digits (Full ITS)
6b7742a2 205 */
a2a2a7ce 206 Int_t fModeSwitch; // !
207 AliHLTComponentDataType fInputDataType; // !
208 AliHLTComponentDataType fOutputDataType; // !
209
210 Bool_t fUseOfflineFinder; // flag to use the offline clusterfinder
6b7742a2 211 Int_t fNModules; // total number of modules
212 Int_t fId; // ddl offset
213 Int_t fNddl; // number of ddl's
214
5f2721d5 215 /** the reader object for data decoding */
5f2721d5 216
a2a2a7ce 217 AliRawReaderMemory* fRawReader; //!transient
5f2721d5 218 AliITSDetTypeRec* fDettype; //!transient
5f2721d5 219 AliITSgeom* fgeom; //!transient
5f2721d5 220 AliITSInitGeometry* fgeomInit; //!transient
618f422f 221
222 AliHLTITSClusterFinderSPD *fSPD; //!transient
223 AliHLTITSClusterFinderSSD *fSSD; //!transient
6e34b293 224
618f422f 225 TTree *tD; //!transient
226 TTree *tR; //!transient
3f61e9ce 227
01ef1bd4 228 Int_t fSPDNModules; //!transient
229 Int_t fSDDNModules; //!transient
230 Int_t fSSDNModules; //!transient
231
232 Int_t fFirstModule; //!transient
233 Int_t fLastModule; //!transient
8e5edf3c 234 Int_t fnClusters; //!transient
01ef1bd4 235
618f422f 236 std::vector<AliITSRecPoint> fclusters; //!transient
57a4102f 237
238 AliHLTComponentBenchmark fBenchmark;// benchmark
3f61e9ce 239
29d7dbc9 240 unsigned long fOutputSizeOffset; //! const offset for output size estimation
241 // 2011-01-27: the transport of digits via the AliLoaderPublisher is
242 // not working stably at the moment. In particular the size of the
243 // streamed digit tree seems not to be correlated with the content
244 // furthermore the CF implements a hotfix accessing the root file
245 // directly. The variable fInputMultiplierDigits will be used for a
246 // dynamic adaption of the buffer size. The component will then return
247 // -ENOSPC and AliHLTTask carries out the event processing once again
248 // with adjusted buffer size
249 float fInputMultiplierDigits; //! variable input multiplier for CF type digits
250 AliLoader* fpLoader; //! ITS loader for getting digit tree
251
6b7742a2 252 ClassDef(AliHLTITSClusterFinderComponent, 0)
5f2721d5 253
a2a2a7ce 254};
5f2721d5 255#endif