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