]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructorComponent.h
Improving documentation and macros.
[u/mrichter/AliRoot.git] / HLT / MUON / OnlineAnalysis / AliHLTMUONTriggerReconstructorComponent.h
CommitLineData
6efe69e7 1#ifndef AliHLTMUONTRIGGERRECONSTRUCTORCOMPONENT_H
2#define AliHLTMUONTRIGGERRECONSTRUCTORCOMPONENT_H
b39b98c8 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 */
6efe69e7 6
1d8ae082 7// $Id$
6efe69e7 8
6253e09b 9///
10/// @file AliHLTMUONTriggerReconstructorComponent.h
11/// @author Indranil Das <indra.das@saha.ac.in>, Artur Szostak <artursz@iafrica.com>
7e05ec60 12/// @date 18 Sep 2007
6253e09b 13/// @brief A processing component for the dHLT trigger DDL reconstruction.
14///
6efe69e7 15
154cba94 16#include "AliHLTMUONProcessor.h"
b39b98c8 17#include "AliHLTMUONDataTypes.h"
6efe69e7 18
e29a165d 19#if __GNUC__ && __GNUC__ < 3
960d54ad 20#define std
21#endif
6efe69e7 22
b39b98c8 23class AliHLTMUONTriggerReconstructor;
24
6efe69e7 25/**
26 * @class AliHLTMUONTriggerReconstructorComponent
b39b98c8 27 * @brief A processing component for the dHLT trigger DDL reconstruction.
1d8ae082 28 *
29 * The trigger reconstructor component is used to decode the raw data coming
30 * from the trigger chambers and electronics of the muon spectrometer.
31 * The local trigger decisions are converted into trigger records which is a
32 * usable format by the tracking stage.
33 * No full cluster finding is performed, rather just the fired strip information
34 * as received from the trigger electronics is converted into global coordinates
35 * to be used by the tracker as track seeds.
36 *
37 * <h2>General properties:</h2>
38 *
39 * Component ID: \b MUONTriggerReconstructor <br>
40 * Library: \b libAliHLTMUON.so <br>
41 * Input Data Types: AliHLTMUONConstants::DDLRawDataType() = "DDL_RAW :MUON" <br>
42 * Output Data Types: AliHLTMUONConstants::TriggerRecordsBlockDataType() = "TRIGRECS:MUON" <br>
43 *
44 * <h2>Mandatory arguments:</h2>
45 * \li -ddl <i>number</i> <br>
46 * This indicates the DDL from which the component is expect to receive data
47 * and for which it should load the appropriate electronics mapping lookup
48 * table.
49 * The <i>number</i> should be in the range [21..22], following local dimuon
50 * spectrometer DDL numbering. If either the -ddlid, -lut or -delaysetup
51 * arguments are used, then -ddl becomes optional. <br>
52 * \li -ddlid <i>number</i> <br>
53 * This indicates the DDL by equipment ID, from which the component is expect
54 * to receive data and for which it should load the appropriate electronics
55 * mapping lookup table.
56 * The <i>number</i> should be in the range [2816..2817].
57 * If either the -ddl, -lut or -delaysetup arguments are used, then -ddlid
58 * becomes optional. <br>
59 * \li -delaysetup <br>
60 * Specifying this option causes the component to initialise the lookup table
61 * and magnetic field parameters from CDB only after receiving the first event
62 * to process in DoEvent.
63 * If -ddl or -ddlid were not used, then the DDL number will be taken from
64 * the first block's specification during runtime from the first
65 * event (i.e. Start-of-Run event).
66 * Using the -lut, -zmiddle or -bfieldintegral arguments will override loading
67 * from CDB for a delayed setup. <br>
68 *
69 * <h2>Optional arguments:</h2>
70 * \li -lut <i>filename</i> <br>
71 * A pree-built lookup table for the electronics mapping and calibration
72 * information can be loaded with this argument. The file should have been
73 * generated with the GenerateLookupTable method. The location of the file
74 * is given by the parameter <i>filename</i> <br>
75 * \li -cdb <br>
76 * Indicates that the component should load from CDB. This option is implicit
77 * if the -cdbpath is given. It will also override the -lut option.<br>
78 * \li -cdbpath <i>path</i> <br>
79 * Specifies the CDB path to use, given by <i>path</i>. This option will override
80 * the CDB path automatically set by the HLT framework. <br>
81 * \li -run <i>number</i> <br>
82 * Specifies the run number to use, given by <i>number</i>. This option will
83 * override the current run number automatically set by the HLT framework. <br>
84 * \li -zmiddle <i>position</i> <br>
85 * This indicates the Z coordinate position of the middle of the dipole magnetic
86 * field. <i>position</i> is a floating point value in centimeters. Specifying
87 * this argument on the will override the value loaded from CDB. <br>
88 * \li -bfieldintegral <i>field</i> <br>
89 * This indicates the magnetic field integral for the dipole magnetic field.
90 * <i>field</i> must be a floating point value in Tesla meters (T.m).
91 * The sign of the value will indicate the polarity setting of the dipole magnet.
92 * Specifying this argument on the will override the value loaded from CDB. <br>
93 * \li -warn_on_unexpected_block <br>
94 * This will cause the component to generate warnings when it receives data block
95 * types it does not know how to handle. Without this option the component only
96 * generates debug messages when they are compiled in. <br>
97 * \li -suppress_partial_triggers <br>
98 * This option forces all trigger records that have less than 3 hits in them
99 * to be removed from the output. This is the default setting. <br>
100 * \li -generate_partial_triggers <br>
101 * With this option all trigger records, even partial ones with just one or two
102 * hits is written to the output. <br>
103 * \li -stop_on_buffer_overflow <br>
104 * If this option is specified then the component will stop processing and generate
105 * an error code in the DoEvent method as soon as the output buffer has been filled.
106 * Otherwise the component normally just keeps processing but some data might be lost
107 * due to full buffers. <br>
108 * \li -tryrecover <br>
109 * This is a special option to the raw data decoder to turn on logic which will
110 * try and recover from corrupt raw DDL data. This is off by default. <br>
111 * \li -dont_use_crateid <br>
112 * This option indicates that the crate ID values found in the regional structures
113 * in the raw DDL data should not be used to identify the channels in the offline
114 * mapping. Rather the position of the raw data structure instead. <br>
115 * \li -dont_use_localid <br>
116 * This option indicates that the local structure ID values found in the raw DDL
117 * data should not be used to identify the channels in the offline mapping, but
118 * rather the position of the local structure in the DDL should be used instead. <br>
119 * \li -dumponerror <br>
120 * This flag will cause the component to dump the data blocks it received if
121 * an error occurs during the processing of an event. <br>
122 * \li -dumppath <i>path</i> <br>
123 * Allows one to specify the path in which to dump the received data blocks
124 * if an error occurs. <br>
125 *
126 * <h2>Standard configuration:</h2>
127 * The configuration is taken from the CDB by default. It can be overridden with
128 * the command line arguments.
129 *
130 * <h2>Default CDB entries:</h2>
131 * HLT/ConfigHLT/HLTGlobalTrigger - Contains the global trigger menu.
132 *
133 * <h2>Performance:</h2>
134 * This is a linear function of the number of input triggers (AliHLTTrigger) that
135 * need to be processed.
136 * For a modest trigger menu configurations the processing time per event should
137 * be on the order of a few milliseconds.
138 *
139 * <h2>Memory consumption:</h2>
140 * This is a linear function of the input data size, but only a fraction. Thus the
141 * memory usage is minimal. It should be under 1 MBytes.
142 *
143 * <h2>Output size:</h2>
144 * This will depend linearly on the number of tracks found. But for nominal multiplicities
145 * this should be less than 16 kBytes.
146 *
147 * @ingroup alihlt_dimuon_component
6efe69e7 148 */
154cba94 149class AliHLTMUONTriggerReconstructorComponent : public AliHLTMUONProcessor
227e7192 150{
151public:
6efe69e7 152 AliHLTMUONTriggerReconstructorComponent();
153 virtual ~AliHLTMUONTriggerReconstructorComponent();
154
155 // Public functions to implement AliHLTComponent's interface.
156 // These functions are required for the registration process
157
6253e09b 158 virtual const char* GetComponentID();
ffb64d3e 159 virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list);
6253e09b 160 virtual AliHLTComponentDataType GetOutputDataType();
960d54ad 161 virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
6253e09b 162 virtual AliHLTComponent* Spawn();
c95cf30c 163
164 /**
165 * Generates a binary file containing the lookup table (LUT) from the
166 * CDB, which can be used for the trigger reconstructor component later.
167 * @param ddl Must be the DDL for which to generate the DDL,
168 * in the range [20..21].
169 * @param filename The name of the LUT file to generate.
170 * @param cdbPath The CDB path to use.
171 * @param run The run number to use for the CDB.
2b7af22a 172 * @param useCrateId Indicates that the crate ID should be used rather
173 * than a sequencial number (default is true).
c95cf30c 174 * @return True if the generation of the LUT file succeeded.
175 */
176 static bool GenerateLookupTable(
177 AliHLTInt32_t ddl, const char* filename,
2b7af22a 178 const char* cdbPath, Int_t run, bool useCrateId = true
c95cf30c 179 );
227e7192 180
181protected:
182
6efe69e7 183 // Protected functions to implement AliHLTComponent's interface.
184 // These functions provide initialization as well as the actual processing
b39b98c8 185 // capabilities of the component.
186
187 virtual int DoInit(int argc, const char** argv);
2b7af22a 188 virtual int Reconfigure(const char* cdbEntry, const char* componentId);
189 virtual int ReadPreprocessorValues(const char* modules);
b39b98c8 190 virtual int DoDeinit();
6efe69e7 191
b39b98c8 192 virtual int DoEvent(
960d54ad 193 const AliHLTComponentEventData& evtData,
b39b98c8 194 const AliHLTComponentBlockData* blocks,
960d54ad 195 AliHLTComponentTriggerData& trigData,
b39b98c8 196 AliHLTUInt8_t* outputPtr,
960d54ad 197 AliHLTUInt32_t& size,
ffb64d3e 198 AliHLTComponentBlockDataList& outputBlocks
960d54ad 199 );
6253e09b 200
201 using AliHLTProcessor::DoEvent;
227e7192 202
203private:
204
6253e09b 205 // Do not allow copying of this class.
dba14d7d 206 /// Not implemented.
6253e09b 207 AliHLTMUONTriggerReconstructorComponent(const AliHLTMUONTriggerReconstructorComponent& /*obj*/);
dba14d7d 208 /// Not implemented.
6253e09b 209 AliHLTMUONTriggerReconstructorComponent& operator = (const AliHLTMUONTriggerReconstructorComponent& /*obj*/);
210
1d8ae082 211 /**
212 * Read in the lookup table from file.
213 * \param lutpath The file to read the lookup table from.
214 */
c95cf30c 215 int ReadLookUpTable(const char* lutpath);
1d8ae082 216
217 /**
218 * Loads the lookup table containing channel and geometrical position
219 * information about trigger strips from CDB.
220 *
221 * \note To override the default CDB path and/or run number the
222 * SetCDBPathAndRunNo(cdbPath, run) method should be called before this
223 * method.
224 *
225 * \return 0 on success and non zero codes for errors.
226 */
ffc1a6f6 227 int ReadLutFromCDB();
b39b98c8 228
2b7af22a 229 /**
230 * Reads this component's configuration parameters from the CDB.
231 * These include the middle of the dipole Z coordinate (zmiddle) and the
232 * integrated magnetic field of the dipole.
233 * \param setZmiddle Indicates if the zmiddle parameter should be set
234 * (default true).
235 * \param setBL Indicates if the integrated magnetic field parameter should
236 * be set (default true).
237 * \return 0 if no errors occured and negative error code compatible with
238 * the HLT framework on errors.
239 */
240 int ReadConfigFromCDB(bool setZmiddle = true, bool setBL = true);
241
7e05ec60 242 AliHLTMUONTriggerReconstructor* fTrigRec; ///< The trigger reconstructor class implementing the algorithm.
243 AliHLTInt32_t fDDL; ///< The DDL number in the range 20..21 from which to expect input. Set to -1 for invalid/unspecified value.
244 bool fWarnForUnexpecedBlock; ///< Flag indicating if we should log a warning if we got a block of an unexpected type.
a3d4b6ba 245 bool fStopOnOverflow; ///< Flag indicating if we should fail in the DoEvent method if the output buffer was overflowed.
246 bool fUseCrateId; ///< Flag to indicate if the crate ID as found in the regional header structures should be used or not.
2b7af22a 247 bool fZmiddleSpecified; ///< Indicates if the zmiddle parameter was specified on the command line.
248 bool fBLSpecified; ///< Indicates if the bfieldintegral parameter was specified on the command line.
249 bool fLutInitialised; ///< Flag to indicate if the LUT was loaded yet or not.
6efe69e7 250
7e05ec60 251 ClassDef(AliHLTMUONTriggerReconstructorComponent, 0) // Trigger reconstructor component for dHLT trigger DDL raw data.
6efe69e7 252
227e7192 253};
b39b98c8 254
6efe69e7 255#endif // AliHLTMUONTRIGGERRECONSTRUCTORCOMPONENT_H