1 #ifndef AliHLTMUONTRIGGERRECONSTRUCTORCOMPONENT_H
2 #define AliHLTMUONTRIGGERRECONSTRUCTORCOMPONENT_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 */
10 /// @file AliHLTMUONTriggerReconstructorComponent.h
11 /// @author Indranil Das <indra.das@saha.ac.in>, Artur Szostak <artursz@iafrica.com>
13 /// @brief A processing component for the dHLT trigger DDL reconstruction.
16 #include "AliHLTMUONProcessor.h"
17 #include "AliHLTMUONDataTypes.h"
19 #if __GNUC__ && __GNUC__ < 3
23 class AliHLTMUONTriggerReconstructor;
26 * @class AliHLTMUONTriggerReconstructorComponent
27 * @brief A processing component for the dHLT trigger DDL reconstruction.
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.
37 * <h2>General properties:</h2>
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>
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
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>
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>
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>
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.
130 * <h2>Default CDB entries:</h2>
131 * HLT/ConfigHLT/HLTGlobalTrigger - Contains the global trigger menu.
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.
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.
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.
147 * @ingroup alihlt_dimuon_component
149 class AliHLTMUONTriggerReconstructorComponent : public AliHLTMUONProcessor
152 AliHLTMUONTriggerReconstructorComponent();
153 virtual ~AliHLTMUONTriggerReconstructorComponent();
155 // Public functions to implement AliHLTComponent's interface.
156 // These functions are required for the registration process
158 virtual const char* GetComponentID();
159 virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list);
160 virtual AliHLTComponentDataType GetOutputDataType();
161 virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
162 virtual AliHLTComponent* Spawn();
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.
172 * @param useCrateId Indicates that the crate ID should be used rather
173 * than a sequencial number (default is true).
174 * @return True if the generation of the LUT file succeeded.
176 static bool GenerateLookupTable(
177 AliHLTInt32_t ddl, const char* filename,
178 const char* cdbPath, Int_t run, bool useCrateId = true
183 // Protected functions to implement AliHLTComponent's interface.
184 // These functions provide initialization as well as the actual processing
185 // capabilities of the component.
187 virtual int DoInit(int argc, const char** argv);
188 virtual int Reconfigure(const char* cdbEntry, const char* componentId);
189 virtual int ReadPreprocessorValues(const char* modules);
190 virtual int DoDeinit();
193 const AliHLTComponentEventData& evtData,
194 const AliHLTComponentBlockData* blocks,
195 AliHLTComponentTriggerData& trigData,
196 AliHLTUInt8_t* outputPtr,
197 AliHLTUInt32_t& size,
198 AliHLTComponentBlockDataList& outputBlocks
201 using AliHLTProcessor::DoEvent;
205 // Do not allow copying of this class.
207 AliHLTMUONTriggerReconstructorComponent(const AliHLTMUONTriggerReconstructorComponent& /*obj*/);
209 AliHLTMUONTriggerReconstructorComponent& operator = (const AliHLTMUONTriggerReconstructorComponent& /*obj*/);
212 * Read in the lookup table from file.
213 * \param lutpath The file to read the lookup table from.
215 int ReadLookUpTable(const char* lutpath);
218 * Loads the lookup table containing channel and geometrical position
219 * information about trigger strips from CDB.
221 * \note To override the default CDB path and/or run number the
222 * SetCDBPathAndRunNo(cdbPath, run) method should be called before this
225 * \return 0 on success and non zero codes for errors.
227 int ReadLutFromCDB();
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
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.
240 int ReadConfigFromCDB(bool setZmiddle = true, bool setBL = true);
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.
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.
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.
251 ClassDef(AliHLTMUONTriggerReconstructorComponent, 0) // Trigger reconstructor component for dHLT trigger DDL raw data.
255 #endif // AliHLTMUONTRIGGERRECONSTRUCTORCOMPONENT_H