]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructorComponent.h
sdigits reading macro cleaned up
[u/mrichter/AliRoot.git] / HLT / MUON / OnlineAnalysis / AliHLTMUONHitReconstructorComponent.h
CommitLineData
b0201cbe 1#ifndef ALIHLTMUONHITRECONSTRUCTORCOMPONENT_H
6253e09b 2#define ALIHLTMUONHITRECONSTRUCTORCOMPONENT_H
ee3678d3 3/* This file is property of and copyright by the ALICE HLT Project *
4 * ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
b0201cbe 6
7/* $Id$ */
8
6253e09b 9///
10/// @file AliHLTMUONHitReconstructorComponent.h
ffc1a6f6 11/// @author Indranil Das <indra.das@saha.ac.in> | <indra.ehep@gmail.com>, Artur Szostak <artursz@iafrica.com>
7e05ec60 12/// @date 28 May 2007
a6b16447 13/// @brief Hit Reconstruction processing component for the dimuon HLT.
6253e09b 14///
b0201cbe 15
154cba94 16#include "AliHLTMUONProcessor.h"
93a75941 17#include "AliHLTMUONHitReconstructor.h"
b0201cbe 18
e29a165d 19#if __GNUC__ && __GNUC__ < 3
960d54ad 20#define std
21#endif
22
23
ee3678d3 24extern "C" struct AliHLTMUONHitRecoLutRow;
25
7e05ec60 26/**
27 * @class AliHLTMUONHitReconstructorComponent
28 * @brief A processing component for the dHLT tracker DDL reconstruction.
ffc1a6f6 29 *
30 * This is the hit reconstruction component which forms part of the online dHLT
31 * reconstruction algorithm. It processes the raw DDL data from a dimuon spectrometer
32 * tracker station, applies simple 3 pad cluster finding and then a centre of gravity
33 * calculation to reconstruct the hit coordinate.
34 *
35 * <h2>General properties:</h2>
36 *
37 * Component ID: \b MUONHitReconstructor <br>
38 * Library: \b libAliHLTMUON.so <br>
39 * Input Data Types: ('DDL_RAW ', 'MUON') <br>
40 * Output Data Types: ('RECHITS ', 'MUON') <br>
41 *
42 * <h2>Mandatory arguments:</h2>
43 * \li -ddl <i>number</i> <br>
44 * This indicates the DDL from which the component is expect to receive data
45 * and for which it should load the appropriate electronics mapping lookup
46 * table.
47 * The <i>number</i> should be in the range [13..20], following local dimuon
48 * spectrometer DDL numbering. If either the -ddlid, -lut or -delaysetup
49 * arguments are used, then -ddl becomes optional. <br>
50 * \li -ddlid <i>number</i> <br>
51 * This indicates the DDL by equipment ID, from which the component is expect
52 * to receive data and for which it should load the appropriate electronics
53 * mapping lookup table.
54 * The <i>number</i> should be in the range [2572..2579].
55 * If either the -ddl, -lut or -delaysetup arguments are used, then -ddlid
56 * becomes optional. <br>
57 * \li -delaysetup <br>
58 * Specifying this option causes the component to initialise the lookup table
59 * and DC cut parameters from CDB only after receiving the first event to
60 * process in DoEvent.
61 * If -ddl or -ddlid were not used, then the DDL number will be taken from
62 * the first block's specification during runtime from the first
63 * event (Start-of-Run event).
64 * Using the -lut or -dccut arguments will override loading from CDB for a
65 * delayed setup. <br>
66 *
67 * <h2>Optional arguments:</h2>
68 * \li -lut <i>filename</i> <br>
69 * A pree-built lookup table for the electronics mapping and calibration
70 * information can be loaded with this argument. The file should have been
71 * generated with the GenerateLookupTable method. The location of the file
72 * is given by the parameter <i>filename</i> <br>
73 * \li -cdb <br>
74 * Indicates that the component should load from CDB. This option is implicit
75 * if the -cdbpath is given. It will also override the -lut option.<br>
76 * \li -cdbpath <i>path</i> <br>
77 * Specifies the CDB path to use, given by <i>path</i>. This option will override
78 * the CDB path automatically set by the HLT framework. <br>
79 * \li -run <i>number</i> <br>
80 * Specifies the run number to use, given by <i>number</i>. This option will
81 * override the current run number automatically set by the HLT framework. <br>
82 * \li -dccut <i>number</i> <br>
83 * Used to override the DC cut parameter in the CDB with the value given by
84 * <i>number</i>. <br>
85 * \li -warn_on_unexpected_block <br>
86 * This will cause the component to generate warnings when it receives data block
87 * types it does not know how to handle. Without this option the component only
88 * generates debug messages when they are compiled in. <br>
a9afae73 89 * \li -tryrecover <i>mode</i> <br>
ffc1a6f6 90 * This is a special option to the raw data decoder to turn on logic which will
91 * try and recover from corrupt raw DDL data. This is off by default. <br>
a9afae73 92 * The <i>mode</i> is and optional parameter which can be one of the
93 * following: <br>
94 * - full This turns on all recovery logic and the decoder tries is best
95 * to recover from all data corruption. <br>
96 * - skip This will just skip any data structures that are found to be
97 * corrupt in the raw data, without trying to recover the data inside. <br>
98 * - parityerrors Will only continue decoding if parity errors are found
99 * but the decoder will stop if any other corruption is found. <br>
100 * \li -skipparityerrors <br>
101 * Skips any ADC digit data words that contain parity errors. <br>
102 * \li -dontprintparityerrors <br>
103 * If specified then no error or warning messages are printed if any parity
104 * errors are found in the ADC digit data words. <br>
90af8855 105 * \li -useidealgain <br>
106 * When this option is used then the gain correction parameters are not loaded
107 * from the CDB but ideal linear gain is assumed. <br>
83d66053 108 * \li -makeclusters <br>
109 * This option will cause the component to generate extra cluster information
110 * in the form of CLUSTERS data blocks. <br>
111 * \li -makechannels <br>
112 * This option will cause the component to generate extra channel information
113 * for each cluster found in the form of CHANNELS data blocks. <br>
ffc1a6f6 114 *
115 * <h2>Standard configuration:</h2>
116 * This component should normally be configured with either of the two sets of
117 * options in the XML configuration. <br>
118 * \li -delaysetup <br>
119 * \li -ddlid ${DDL_ID} <br>
120 *
121 * <h2>Default CDB entries:</h2>
122 * The component loads electronics mapping and calibration information from the MUON
123 * subdirectory in the CDB, MUON/Calib and MUON/Align.
124 * The DC cut parameter is stored in a TMap under HLT/ConfigMUON/HitReconstructor
125 * with a default value of 50 ADC channels.
126 *
127 * <h2>Performance:</h2>
128 * Can achieve about 2kHz processing rate for nominal event sizes containing
129 * 150 tracks per event.
130 *
131 * <h2>Memory consumption:</h2>
132 * The lookup table requires about 3.5 MBytes of memory.
133 *
134 * <h2>Output size:</h2>
135 * Output size is about 10% of incoming raw input data for nominal p+p events.
136 *
137 * @ingroup alihlt_dimuon_component
7e05ec60 138 */
154cba94 139class AliHLTMUONHitReconstructorComponent : public AliHLTMUONProcessor
960d54ad 140{
ee3678d3 141public:
960d54ad 142 AliHLTMUONHitReconstructorComponent();
143 virtual ~AliHLTMUONHitReconstructorComponent();
144
145 // Public functions to implement AliHLTComponent's interface.
146 // These functions are required for the registration process
147
6253e09b 148 virtual const char* GetComponentID();
ffb64d3e 149 virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list);
6253e09b 150 virtual AliHLTComponentDataType GetOutputDataType();
ffb64d3e 151 virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
6253e09b 152 virtual AliHLTComponent* Spawn();
960d54ad 153
93a75941 154 /**
dba14d7d 155 * Generates an ASCII text file containing the lookup table (LUT) from
93a75941 156 * the CDB, which can be used for the hit reconstructor component later.
157 * @param ddl Must be the DDL for which to generate the DDL,
158 * in the range [12..19].
159 * @param filename The name of the LUT file to generate.
160 * @param cdbPath The CDB path to use.
161 * @param run The run number to use for the CDB.
162 * @return True if the generation of the LUT file succeeded.
163 */
164 static bool GenerateLookupTable(
165 AliHLTInt32_t ddl, const char* filename,
166 const char* cdbPath, Int_t run
167 );
168
ee3678d3 169protected:
960d54ad 170
171 // Protected functions to implement AliHLTComponent's interface.
172 // These functions provide initialization as well as the actual processing
dba14d7d 173 // capabilities of the component.
960d54ad 174
6253e09b 175 virtual int DoInit(int argc, const char** argv);
ffc1a6f6 176 virtual int Reconfigure(const char* cdbEntry, const char* componentId);
177 virtual int ReadPreprocessorValues(const char* modules);
6253e09b 178 virtual int DoDeinit();
179 virtual int DoEvent(
960d54ad 180 const AliHLTComponentEventData& evtData,
181 const AliHLTComponentBlockData* blocks,
182 AliHLTComponentTriggerData& trigData,
ee3678d3 183 AliHLTUInt8_t* outputPtr,
960d54ad 184 AliHLTUInt32_t& size,
ffb64d3e 185 AliHLTComponentBlockDataList& outputBlocks
960d54ad 186 );
187
6253e09b 188 using AliHLTProcessor::DoEvent;
189
ee3678d3 190private:
6253e09b 191
192 // Do not allow copying of this class.
dba14d7d 193 /// Not implemented.
6253e09b 194 AliHLTMUONHitReconstructorComponent(const AliHLTMUONHitReconstructorComponent& /*obj*/);
dba14d7d 195 /// Not implemented.
6253e09b 196 AliHLTMUONHitReconstructorComponent& operator = (const AliHLTMUONHitReconstructorComponent& /*obj*/);
960d54ad 197
a6b16447 198 void FreeMemory();
93a75941 199 int ReadLookUpTable(const char* lutpath);
ffc1a6f6 200 int ReadLutFromCDB();
2b7af22a 201 int ReadDCCutFromCDB();
93a75941 202
7e05ec60 203 AliHLTMUONHitReconstructor* fHitRec; ///< Internal class instance implementing the hit reconstruction algorithm.
204 AliHLTInt32_t fDDL; ///< DDL number in the range [12..19]. Set to -1 for invalid/unspecified value.
205 AliHLTUInt32_t fLutSize; ///< The number of rows / entries in the LUT.
206 AliHLTMUONHitRecoLutRow* fLut; ///< The lookup table used by the hit reconstruction algorithm (Owned by this component however).
207 IdManuChannelToEntry fIdToEntry; ///< id to line mapping.
83d66053 208 MaxEntryPerBusPatch fMaxEntryPerBusPatch ;///< map to load maximum allowed buspatch entries for each buspatch
7e05ec60 209 bool fWarnForUnexpecedBlock; ///< Flag indicating if we should log a warning if we got a block of an unexpected type.
90af8855 210 bool fUseIdealGain; ///< Flag to indicate that ideal gain should be used and not loaded from the CDB.
ee3678d3 211
7e05ec60 212 ClassDef(AliHLTMUONHitReconstructorComponent, 0) // Hit reconstructor component for dHLT tracker DDL raw data.
b0201cbe 213};
214
215#endif // ALIHLTMUONHITRECONSTRUCTORCOMPONENT_H