Line data Source code
1 : #ifndef ALIHLTMUONHITRECONSTRUCTORCOMPONENT_H
2 : #define ALIHLTMUONHITRECONSTRUCTORCOMPONENT_H
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 */
6 :
7 : // $Id$
8 :
9 : ///
10 : /// @file AliHLTMUONHitReconstructorComponent.h
11 : /// @author Indranil Das <indra.das@saha.ac.in> | <indra.ehep@gmail.com>, Artur Szostak <artursz@iafrica.com>
12 : /// @date 28 May 2007
13 : /// @brief Hit Reconstruction processing component for the dimuon HLT.
14 : ///
15 :
16 : #include "AliHLTMUONProcessor.h"
17 : #include "AliHLTMUONHitReconstructor.h"
18 :
19 : #if __GNUC__ && __GNUC__ < 3
20 : #define std
21 : #endif
22 :
23 :
24 : extern "C" struct AliHLTMUONHitRecoLutRow;
25 :
26 : /**
27 : * @class AliHLTMUONHitReconstructorComponent
28 : * @brief A processing component for the dHLT tracker DDL reconstruction.
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'); ('CLUSTERS', 'MUON'); ('CHANNELS', '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 (i.e. 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>
89 : * \li -tryrecover <i>mode</i> <br>
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>
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 : * if no <i>mode</i> option is specified then full recovery logic is enabled. <br>
101 : * \li -skipparityerrors <br>
102 : * Skips any ADC digit data words that contain parity errors. <br>
103 : * \li -dontprintparityerrors <br>
104 : * If specified then no error or warning messages are printed if any parity
105 : * errors are found in the ADC digit data words. <br>
106 : * \li -makeclusters <br>
107 : * This option will cause the component to generate extra cluster information
108 : * in the form of CLUSTERS data blocks. <br>
109 : * \li -makechannels <br>
110 : * This option will cause the component to generate extra channel information
111 : * for each cluster found in the form of CHANNELS data blocks. <br>
112 : * \li -warnifpadskipped <br>
113 : * If this option is set the a warning message is generated for every pad that
114 : * is skipped because it contains invalid value markers in the calibration data. <br>
115 : * \li -dumponerror <br>
116 : * This flag will cause the component to dump the data blocks it received if
117 : * an error occurs during the processing of an event. <br>
118 : * \li -dumppath <i>path</i> <br>
119 : * Allows one to specify the path in which to dump the received data blocks
120 : * if an error occurs. <br>
121 : *
122 : * <h2>Standard configuration:</h2>
123 : * This component should normally be configured with either of the two sets of
124 : * options in the XML configuration. <br>
125 : * \li -delaysetup <br>
126 : * \li -ddlid ${DDL_ID} <br>
127 : *
128 : * <h2>Default CDB entries:</h2>
129 : * The component loads electronics mapping and calibration information from the MUON
130 : * subdirectory in the CDB, MUON/Calib and MUON/Align.
131 : * The DC cut parameter is stored in a TMap under HLT/ConfigMUON/HitReconstructor
132 : * with a default value of 50 ADC channels.
133 : *
134 : * <h2>Performance:</h2>
135 : * Can achieve about 2kHz processing rate for nominal event sizes containing
136 : * 150 tracks per event.
137 : *
138 : * <h2>Memory consumption:</h2>
139 : * The lookup table requires about 3.5 MBytes of memory.
140 : *
141 : * <h2>Output size:</h2>
142 : * Output size is about 10% of incoming raw input data for nominal p+p events.
143 : *
144 : * @ingroup alihlt_muon_components
145 : */
146 : class AliHLTMUONHitReconstructorComponent : public AliHLTMUONProcessor
147 : {
148 : public:
149 : AliHLTMUONHitReconstructorComponent();
150 : virtual ~AliHLTMUONHitReconstructorComponent();
151 :
152 : // Public functions to implement AliHLTComponent's interface.
153 : // These functions are required for the registration process
154 :
155 : virtual const char* GetComponentID();
156 : virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list);
157 : virtual AliHLTComponentDataType GetOutputDataType();
158 : virtual int GetOutputDataTypes(AliHLTComponentDataTypeList& list);
159 : virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
160 : virtual AliHLTComponent* Spawn();
161 :
162 : /**
163 : * Generates an ASCII text file containing the lookup table (LUT) from
164 : * the CDB, which can be used for the hit reconstructor component later.
165 : * @param ddl Must be the DDL for which to generate the DDL,
166 : * in the range [12..19].
167 : * @param filename The name of the LUT file to generate.
168 : * @param cdbPath The CDB path to use.
169 : * @param run The run number to use for the CDB.
170 : * @return True if the generation of the LUT file succeeded.
171 : */
172 : static bool GenerateLookupTable(
173 : AliHLTInt32_t ddl, const char* filename,
174 : const char* cdbPath, Int_t run
175 : );
176 :
177 : protected:
178 :
179 : // Protected functions to implement AliHLTComponent's interface.
180 : // These functions provide initialization as well as the actual processing
181 : // capabilities of the component.
182 :
183 : virtual int DoInit(int argc, const char** argv);
184 : virtual int Reconfigure(const char* cdbEntry, const char* componentId);
185 : virtual int ReadPreprocessorValues(const char* modules);
186 : virtual int DoDeinit();
187 : virtual int DoEvent(
188 : const AliHLTComponentEventData& evtData,
189 : const AliHLTComponentBlockData* blocks,
190 : AliHLTComponentTriggerData& trigData,
191 : AliHLTUInt8_t* outputPtr,
192 : AliHLTUInt32_t& size,
193 : AliHLTComponentBlockDataList& outputBlocks
194 : );
195 :
196 : using AliHLTProcessor::DoEvent;
197 :
198 : private:
199 :
200 : // Do not allow copying of this class.
201 : /// Not implemented.
202 : AliHLTMUONHitReconstructorComponent(const AliHLTMUONHitReconstructorComponent& /*obj*/);
203 : /// Not implemented.
204 : AliHLTMUONHitReconstructorComponent& operator = (const AliHLTMUONHitReconstructorComponent& /*obj*/);
205 :
206 : void FreeMemory();
207 : int ReadLookUpTable(const char* lutpath);
208 : int ReadLutFromCDB();
209 : int ReadDCCutFromCDB();
210 :
211 : AliHLTMUONHitReconstructor* fHitRec; ///< Internal class instance implementing the hit reconstruction algorithm.
212 : AliHLTInt32_t fDDL; ///< DDL number in the range [12..19]. Set to -1 for invalid/unspecified value.
213 : AliHLTUInt32_t fLutSize; ///< The number of rows / entries in the LUT.
214 : AliHLTMUONHitRecoLutRow* fLut; ///< The lookup table used by the hit reconstruction algorithm (Owned by this component however).
215 : IdManuChannelToEntry fIdToEntry; ///< id to line mapping.
216 : MaxEntryPerBusPatch fMaxEntryPerBusPatch ;///< map to load maximum allowed buspatch entries for each buspatch
217 : bool fWarnForUnexpecedBlock; ///< Flag indicating if we should log a warning if we got a block of an unexpected type.
218 : bool fWarnIfPadSkipped; ///< Flag for controlling if extensive warnings should be generated when skipping pads.
219 :
220 6 : ClassDef(AliHLTMUONHitReconstructorComponent, 0) // Hit reconstructor component for dHLT tracker DDL raw data.
221 : };
222 :
223 : #endif // ALIHLTMUONHITRECONSTRUCTORCOMPONENT_H
|