]>
Commit | Line | Data |
---|---|---|
b92524d0 | 1 | #ifndef AliHLTMUONMANSOTRACKERFSMCOMPONENT_H |
2 | #define AliHLTMUONMANSOTRACKERFSMCOMPONENT_H | |
3 | /************************************************************************** | |
bc5cb6d6 | 4 | * This file is property of and copyright by the ALICE HLT Project * |
b92524d0 | 5 | * All rights reserved. * |
6 | * * | |
7 | * Primary Authors: * | |
8 | * Artur Szostak <artursz@iafrica.com> * | |
9 | * Indranil Das <indra.das@saha.ac.in> * | |
10 | * * | |
11 | * Permission to use, copy, modify and distribute this software and its * | |
12 | * documentation strictly for non-commercial purposes is hereby granted * | |
13 | * without fee, provided that the above copyright notice appears in all * | |
14 | * copies and that both the copyright notice and this permission notice * | |
15 | * appear in the supporting documentation. The authors make no claims * | |
bc5cb6d6 | 16 | * about the suitability of this software for any purpose. It is * |
b92524d0 | 17 | * provided "as is" without express or implied warranty. * |
18 | **************************************************************************/ | |
19 | ||
1d8ae082 | 20 | // $Id$ |
b92524d0 | 21 | |
6253e09b | 22 | /// |
23 | /// @file AliHLTMUONMansoTrackerFSMComponent.h | |
24 | /// @author Artur Szostak <artursz@iafrica.com>, | |
25 | /// Indranil Das <indra.das@saha.ac.in> | |
4e22efc4 | 26 | /// @date 18 Sep 2007 |
4d76a068 | 27 | /// @brief Tracker component for the dimuon HLT using the Manso algorithm. |
28 | /// | |
29 | /// The tracker component performs minimal track reconstruction in stations 4 & 5. | |
30 | /// It uses the Manso algorithm implemented as a finite state machine. | |
6253e09b | 31 | /// |
b92524d0 | 32 | |
154cba94 | 33 | #include "AliHLTMUONProcessor.h" |
b92524d0 | 34 | #include "AliHLTMUONDataTypes.h" |
35 | #include "AliHLTMUONMansoTrackerFSMCallback.h" | |
b92524d0 | 36 | |
e29a165d | 37 | #if __GNUC__ && __GNUC__ < 3 |
4e150e47 | 38 | #define std |
39 | #endif | |
40 | ||
b92524d0 | 41 | class AliHLTMUONMansoTrackerFSM; |
42 | //class AliHLTMUONMansoTracksBlockWriter; | |
43 | extern "C" { | |
44 | struct AliHLTMUONRecHitStruct; | |
45 | } // extern C | |
46 | ||
47 | ||
48 | /** | |
49 | * @class AliHLTMUONMansoTrackerFSMComponent | |
4d76a068 | 50 | * @brief Dimuon HLT tracker using the Manso tracking algorithm implemented as a FSM. |
51 | * | |
52 | * This is a tracker component for the muon spectrometer. It performs minimal track | |
53 | * reconstruction in stations 4 & 5. | |
54 | * The Manso algorithm is used, implemented as a finite state machine (FSM). | |
55 | * This makes the component fast, insensitive to residual missalignment and gives | |
56 | * reasonable pT resolution for improved event selectivity. | |
57 | * However, because of its minimalism and simplicity, it does suffer from an increased | |
58 | * fake track rate, in particular for higher multiplicity events. | |
59 | * This should not pose a problem at all for p+p or peripheral A+A events, while | |
60 | * central events should and will be triggered anyway. | |
61 | * | |
62 | * <h2>General properties:</h2> | |
63 | * | |
64 | * Component ID: \b MUONMansoTrackerFSM <br> | |
65 | * Library: \b libAliHLTMUON.so <br> | |
66 | * Input Data Types: ('RECHITS ', 'MUON'); ('TRIGRECS', 'MUON') <br> | |
67 | * Output Data Types: ('MANTRACK', 'MUON'); ('MNCANDID', 'MUON') <br> | |
68 | * | |
69 | * <h2>Mandatory arguments:</h2> | |
70 | * None. <br> | |
71 | * | |
72 | * <h2>Optional arguments:</h2> | |
73 | * \li -zmiddle <i>number</i> <br> | |
74 | * Sets the value for the Z coordinate for the middle of the magnetic field. | |
75 | * The <i>number</i> should be a floating point number representing the Z | |
76 | * coordinate in centimeters (cm). | |
77 | * A reasponable value is around -975cm (the default). <br> | |
78 | * \li -bfieldintegral <i>number</i> <br> | |
79 | * Sets the value for the dipole's magnetic field integral. | |
80 | * The <i>number</i> should be a floating point number representing the integral | |
81 | * in units of Tesla meters (T.m). | |
82 | * The value can be negative or possitive to indicate the dipole's polarity. <br> | |
83 | * \li -a7 <i>number</i> <br> | |
84 | * \li -a8 <i>number</i> <br> | |
85 | * \li -a9 <i>number</i> <br> | |
86 | * \li -a10 <i>number</i> <br> | |
87 | * \li -b7 <i>number</i> <br> | |
88 | * \li -b8 <i>number</i> <br> | |
89 | * \li -b9 <i>number</i> <br> | |
90 | * \li -b10 <i>number</i> <br> | |
91 | * These allow one to set the A and B region of interest parameters used by the | |
92 | * tracker to search for correlated hits on subsequent chambers. | |
93 | * The number indicated after -a* or -b* indicates the chamber to set the parameter for. | |
94 | * i.e. "-a7 123" will set the A parameter for chamber 7 to the value of 123. | |
95 | * The region of interest parameters are defined as follows: Rs = a*Rp + b, | |
96 | * where Rs is the region of interest radius and Rp is the distance from the beam line | |
97 | * to the centre of the region of interest (in cm). | |
98 | * The <i>number</i> should be a floating point number in each case and the values | |
99 | * for the B parameters should always be positive. <br> | |
100 | * \li -z7 <i>number</i> <br> | |
101 | * \li -z8 <i>number</i> <br> | |
102 | * \li -z9 <i>number</i> <br> | |
103 | * \li -z10 <i>number</i> <br> | |
104 | * \li -z11 <i>number</i> <br> | |
105 | * \li -z13 <i>number</i> <br> | |
106 | * These allow one to set the Z coordinate used for the chamber position in the | |
107 | * trackers internal calculations. | |
108 | * The number after -z* indicates the chamber number to set the value for. | |
109 | * Thus, "-z11 -123" sets chamber 11's Z coordinate position to -123 cm. | |
110 | * The <i>number</i> should be a floating point number in each case and negative, | |
111 | * since the spectrometer is located in the negative Z direction. | |
112 | * The units are in centimeters (cm). | |
113 | * The default values are the nominal chamber Z coordinates. <br> | |
114 | * \li -warn_on_unexpected_block <br> | |
115 | * This will cause the component to generate warnings when it receives data block | |
116 | * types it does not know how to handle. Without this option the component only | |
117 | * generates debug messages when they are compiled in. <br> | |
1d8ae082 | 118 | * \li -cdbpath <i>path</i> <br> |
119 | * This allows one to override the path to use for the CDB location. | |
120 | * <i>path</i> must be a valid CDB URI. By default the HLT system framework | |
121 | * sets the CDB path. <br> | |
122 | * \li -run <i>number</i> <br> | |
123 | * This allows one to override the run number to use. <i>number</i> must be | |
124 | * a positive integer number. By default the HLT system framework sets the | |
125 | * run number. <br> | |
126 | * \li -delaysetup <br> | |
127 | * If indicated then part of the initialisation of the component is forcefully | |
128 | * delayed to the first event received, i.e. the Start-of-Run event. <br> | |
129 | * \li -dumponerror <br> | |
130 | * This flag will cause the component to dump the data blocks it received if | |
131 | * an error occurs during the processing of an event. <br> | |
132 | * \li -dumppath <i>path</i> <br> | |
133 | * Allows one to specify the path in which to dump the received data blocks | |
134 | * if an error occurs. <br> | |
bc5cb6d6 | 135 | * \li -makecandidates <br> |
136 | * Indicates if the Manso track candidates data block should be generated. | |
137 | * This kind of information is useful for debugging. <br> | |
4d76a068 | 138 | * |
139 | * <h2>Standard configuration:</h2> | |
140 | * This component should normally be configured with no extra options. | |
141 | * It will automatically load the required reconstruction parameters from the CDB. <br> | |
142 | * | |
143 | * <h2>Default CDB entries:</h2> | |
144 | * The component loads the reconstruction parameters from the MUON subdirectory | |
145 | * in the CDB. | |
146 | * The magnetic field integral, A and B region of interest parameters, | |
147 | * and nominal Z coordinates are stored in a TMap under HLT/ConfigMUON/MansoTrackerFSM. | |
148 | * | |
149 | * <h2>Performance:</h2> | |
150 | * Can achieve about 3kHz processing rate for nominal event sizes containing | |
151 | * 150 tracks per event. | |
152 | * | |
153 | * <h2>Memory consumption:</h2> | |
154 | * Minimal memory consumption on the order of megabytes. | |
155 | * 5 Mbytes should be more than enough. | |
156 | * | |
157 | * <h2>Output size:</h2> | |
158 | * Output size is about equivalent to the incoming reconstructed hit and trigger | |
159 | * record input data. | |
160 | * | |
ebf7a8e8 | 161 | * @ingroup alihlt_muon_components |
b92524d0 | 162 | */ |
163 | class AliHLTMUONMansoTrackerFSMComponent | |
154cba94 | 164 | : public AliHLTMUONProcessor, public AliHLTMUONMansoTrackerFSMCallback |
b92524d0 | 165 | { |
166 | public: | |
167 | AliHLTMUONMansoTrackerFSMComponent(); | |
168 | virtual ~AliHLTMUONMansoTrackerFSMComponent(); | |
169 | ||
170 | // Public functions to implement the AliHLTProcessor interface. | |
171 | // These functions are required for the registration process. | |
172 | virtual const char* GetComponentID(); | |
ffb64d3e | 173 | virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list); |
b92524d0 | 174 | virtual AliHLTComponentDataType GetOutputDataType(); |
4d76a068 | 175 | virtual int GetOutputDataTypes(AliHLTComponentDataTypeList& list); |
b92524d0 | 176 | virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier); |
177 | virtual AliHLTComponent* Spawn(); | |
178 | ||
179 | // Inherited from AliHLTMUONMansoTrackerFSMCallback: | |
180 | virtual void RequestClusters( | |
181 | AliHLTMUONMansoTrackerFSM* tracker, | |
182 | AliHLTFloat32_t left, AliHLTFloat32_t right, | |
183 | AliHLTFloat32_t bottom, AliHLTFloat32_t top, | |
184 | AliHLTMUONChamberName chamber, const void* tag | |
185 | ); | |
186 | virtual void EndOfClusterRequests(AliHLTMUONMansoTrackerFSM* tracker); | |
187 | virtual void FoundTrack(AliHLTMUONMansoTrackerFSM* tracker); | |
188 | virtual void NoTrackFound(AliHLTMUONMansoTrackerFSM* tracker); | |
189 | ||
190 | protected: | |
191 | ||
192 | // Protected functions to implement the AliHLTProcessor interface. | |
193 | // These functions provide initialization as well as the actual processing | |
194 | // capabilities of the component. | |
6253e09b | 195 | virtual int DoInit(int argc, const char** argv); |
2b7af22a | 196 | virtual int Reconfigure(const char* cdbEntry, const char* componentId); |
197 | virtual int ReadPreprocessorValues(const char* modules); | |
6253e09b | 198 | virtual int DoDeinit(); |
199 | virtual int DoEvent( | |
b92524d0 | 200 | const AliHLTComponentEventData& evtData, |
201 | const AliHLTComponentBlockData* blocks, | |
202 | AliHLTComponentTriggerData& trigData, | |
203 | AliHLTUInt8_t* outputPtr, | |
204 | AliHLTUInt32_t& size, | |
ffb64d3e | 205 | AliHLTComponentBlockDataList& outputBlocks |
b92524d0 | 206 | ); |
6253e09b | 207 | |
208 | using AliHLTProcessor::DoEvent; | |
b92524d0 | 209 | |
210 | private: | |
211 | ||
6253e09b | 212 | // Do not allow copying of this class. |
213 | AliHLTMUONMansoTrackerFSMComponent(const AliHLTMUONMansoTrackerFSMComponent& /*obj*/); | |
214 | AliHLTMUONMansoTrackerFSMComponent& operator = (const AliHLTMUONMansoTrackerFSMComponent& /*obj*/); | |
215 | ||
b92524d0 | 216 | void Reset(); |
a6b16447 | 217 | void FreeMemory(); |
b92524d0 | 218 | |
219 | void AddRecHits( | |
5bf92d6f | 220 | AliHLTUInt32_t specification, |
b92524d0 | 221 | const AliHLTMUONRecHitStruct* recHits, |
222 | AliHLTUInt32_t count | |
223 | ); | |
2b7af22a | 224 | |
225 | void ResetCanLoadFlags(); | |
226 | bool AtLeastOneCanLoadFlagsIsSet() const; | |
227 | ||
228 | /** | |
229 | * Reads this component's configuration parameters from the CDB. | |
230 | * These include the middle of the dipole Z coordinate (zmiddle), the | |
231 | * integrated magnetic field of the dipole, Z coordinates of the chambers | |
232 | * and the region of interest parameters used during the tracking. | |
233 | * \note Only those parameters are loaded from CDB for which the fCanLoadxyz | |
234 | * flags are true. | |
235 | * \return 0 if no errors occured and negative error code compatible with | |
236 | * the HLT framework on errors. | |
237 | */ | |
238 | int ReadConfigFromCDB(); | |
239 | ||
b92524d0 | 240 | |
241 | AliHLTMUONMansoTrackerFSM* fTracker; //! Tracker to do the actual work. | |
242 | ||
243 | AliHLTUInt32_t fTrackCount; //! Number of tracks currently found. | |
244 | /*AliHLTMUONMansoTracksBlockWriter*/void* fBlock; //! The current data block we are writing. | |
245 | ||
5bf92d6f | 246 | class AliRecHitBlockInfo |
b92524d0 | 247 | { |
5bf92d6f | 248 | public: |
249 | ||
250 | AliRecHitBlockInfo(AliHLTUInt32_t count = 0, const AliHLTMUONRecHitStruct* data = NULL) : | |
251 | fCount(count), fData(data) | |
252 | {} | |
253 | ||
254 | // Perform a shallow copy. | |
255 | AliRecHitBlockInfo(const AliRecHitBlockInfo& obj) : | |
256 | fCount(obj.fCount), fData(obj.fData) | |
257 | {} | |
258 | ||
259 | AliRecHitBlockInfo& operator = (const AliRecHitBlockInfo& obj) | |
260 | { | |
e99fb5c9 | 261 | if(&obj == this) return *this; |
5bf92d6f | 262 | fCount = obj.fCount; |
263 | fData = obj.fData; | |
264 | return *this; | |
265 | } | |
266 | ||
267 | AliHLTUInt32_t Count() const { return fCount; } | |
268 | const AliHLTMUONRecHitStruct* Data() const { return fData; } | |
269 | ||
270 | private: | |
b92524d0 | 271 | AliHLTUInt32_t fCount; // Number of elements in fData. |
272 | const AliHLTMUONRecHitStruct* fData; // Pointer to the array of rec hits. | |
273 | }; | |
274 | ||
5bf92d6f | 275 | //std::vector<AliRecHitBlockInfo> fRecHitBlock[4]; //! Arrays of rec hit block data. |
2b7af22a | 276 | AliHLTUInt32_t fRecHitBlockArraySize; ///< The array size of each array in fRecHitBlock. |
277 | AliHLTUInt32_t fRecHitBlockCount[4]; ///< The number of records actually stored in fRecHitBlock[i]. | |
5bf92d6f | 278 | // The following are 4 dynamic arrays of AliRecHitBlockInfo structures. |
279 | // These arrays will all have the same size = fRecHitBlockArraySize. | |
280 | // The array itself is actually allocated only once and the pointer stored in fRecHitBlock[0], | |
281 | // while the other pointers fRecHitBlock[i] {i>0} will just be set relative to fRecHitBlock[0]. | |
282 | // The allocated memory is: 4 * fRecHitBlockArraySize * sizeof(AliRecHitBlockInfo). | |
283 | AliRecHitBlockInfo* fRecHitBlock[4]; //! Arrays of rec hit block data. | |
b92524d0 | 284 | |
ffb64d3e | 285 | bool fWarnForUnexpecedBlock; ///< Flag indicating if we should log a warning if we got a block of an unexpected type. |
2b7af22a | 286 | bool fCanLoadZmiddle; ///< Indicates if the zmiddle parameter can be loaded from CDB. |
287 | bool fCanLoadBL; ///< Indicates if the bfieldintegral parameter can be loaded from CDB. | |
288 | bool fCanLoadA[4]; ///< Indicates if the roi_paramA_chamber[7..10] parameter can be loaded from CDB. | |
289 | bool fCanLoadB[4]; ///< Indicates if the roi_paramB_chamber[7..10] parameter can be loaded from CDB. | |
290 | bool fCanLoadZ[6]; ///< Indicates if the chamber[7..11,13]postion parameter can be loaded from CDB. | |
d42549e3 | 291 | |
b92524d0 | 292 | ClassDef(AliHLTMUONMansoTrackerFSMComponent, 0); // Manso tracker component implemented as a finite state machine (FSM). |
293 | }; | |
294 | ||
295 | #endif // AliHLTMUONMANSOTRACKERFSMCOMPONENT_H |