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