1 #ifndef AliHLTMUONMANSOTRACKERFSMCOMPONENT_H
2 #define AliHLTMUONMANSOTRACKERFSMCOMPONENT_H
3 /**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * All rights reserved. *
8 * Artur Szostak <artursz@iafrica.com> *
9 * Indranil Das <indra.das@saha.ac.in> *
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 *
16 * about the suitability of this software for any purpose. It is *
17 * provided "as is" without express or implied warranty. *
18 **************************************************************************/
23 /// @file AliHLTMUONMansoTrackerFSMComponent.h
24 /// @author Artur Szostak <artursz@iafrica.com>,
25 /// Indranil Das <indra.das@saha.ac.in>
27 /// @brief Tracker component for the dimuon HLT using the Manso algorithm.
29 /// The tracker component performs minimal track reconstruction in stations 4 & 5.
30 /// It uses the Manso algorithm implemented as a finite state machine.
33 #include "AliHLTMUONProcessor.h"
34 #include "AliHLTMUONDataTypes.h"
35 #include "AliHLTMUONMansoTrackerFSMCallback.h"
37 #if __GNUC__ && __GNUC__ < 3
41 class AliHLTMUONMansoTrackerFSM;
42 //class AliHLTMUONMansoTracksBlockWriter;
44 struct AliHLTMUONRecHitStruct;
49 * @class AliHLTMUONMansoTrackerFSMComponent
50 * @brief Dimuon HLT tracker using the Manso tracking algorithm implemented as a FSM.
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.
62 * <h2>General properties:</h2>
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>
69 * <h2>Mandatory arguments:</h2>
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>
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
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>
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>
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>
143 * <h2>Default CDB entries:</h2>
144 * The component loads the reconstruction parameters from the MUON subdirectory
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.
149 * <h2>Performance:</h2>
150 * Can achieve about 3kHz processing rate for nominal event sizes containing
151 * 150 tracks per event.
153 * <h2>Memory consumption:</h2>
154 * Minimal memory consumption on the order of megabytes.
155 * 5 Mbytes should be more than enough.
157 * <h2>Output size:</h2>
158 * Output size is about equivalent to the incoming reconstructed hit and trigger
161 * @ingroup alihlt_dimuon_component
163 class AliHLTMUONMansoTrackerFSMComponent
164 : public AliHLTMUONProcessor, public AliHLTMUONMansoTrackerFSMCallback
167 AliHLTMUONMansoTrackerFSMComponent();
168 virtual ~AliHLTMUONMansoTrackerFSMComponent();
170 // Public functions to implement the AliHLTProcessor interface.
171 // These functions are required for the registration process.
172 virtual const char* GetComponentID();
173 virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list);
174 virtual AliHLTComponentDataType GetOutputDataType();
175 virtual int GetOutputDataTypes(AliHLTComponentDataTypeList& list);
176 virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
177 virtual AliHLTComponent* Spawn();
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
186 virtual void EndOfClusterRequests(AliHLTMUONMansoTrackerFSM* tracker);
187 virtual void FoundTrack(AliHLTMUONMansoTrackerFSM* tracker);
188 virtual void NoTrackFound(AliHLTMUONMansoTrackerFSM* tracker);
192 // Protected functions to implement the AliHLTProcessor interface.
193 // These functions provide initialization as well as the actual processing
194 // capabilities of the component.
195 virtual int DoInit(int argc, const char** argv);
196 virtual int Reconfigure(const char* cdbEntry, const char* componentId);
197 virtual int ReadPreprocessorValues(const char* modules);
198 virtual int DoDeinit();
200 const AliHLTComponentEventData& evtData,
201 const AliHLTComponentBlockData* blocks,
202 AliHLTComponentTriggerData& trigData,
203 AliHLTUInt8_t* outputPtr,
204 AliHLTUInt32_t& size,
205 AliHLTComponentBlockDataList& outputBlocks
208 using AliHLTProcessor::DoEvent;
212 // Do not allow copying of this class.
213 AliHLTMUONMansoTrackerFSMComponent(const AliHLTMUONMansoTrackerFSMComponent& /*obj*/);
214 AliHLTMUONMansoTrackerFSMComponent& operator = (const AliHLTMUONMansoTrackerFSMComponent& /*obj*/);
220 AliHLTUInt32_t specification,
221 const AliHLTMUONRecHitStruct* recHits,
225 void ResetCanLoadFlags();
226 bool AtLeastOneCanLoadFlagsIsSet() const;
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
235 * \return 0 if no errors occured and negative error code compatible with
236 * the HLT framework on errors.
238 int ReadConfigFromCDB();
241 AliHLTMUONMansoTrackerFSM* fTracker; //! Tracker to do the actual work.
243 AliHLTUInt32_t fTrackCount; //! Number of tracks currently found.
244 /*AliHLTMUONMansoTracksBlockWriter*/void* fBlock; //! The current data block we are writing.
246 class AliRecHitBlockInfo
250 AliRecHitBlockInfo(AliHLTUInt32_t count = 0, const AliHLTMUONRecHitStruct* data = NULL) :
251 fCount(count), fData(data)
254 // Perform a shallow copy.
255 AliRecHitBlockInfo(const AliRecHitBlockInfo& obj) :
256 fCount(obj.fCount), fData(obj.fData)
259 AliRecHitBlockInfo& operator = (const AliRecHitBlockInfo& obj)
261 if(&obj == this) return *this;
267 AliHLTUInt32_t Count() const { return fCount; }
268 const AliHLTMUONRecHitStruct* Data() const { return fData; }
271 AliHLTUInt32_t fCount; // Number of elements in fData.
272 const AliHLTMUONRecHitStruct* fData; // Pointer to the array of rec hits.
275 //std::vector<AliRecHitBlockInfo> fRecHitBlock[4]; //! Arrays of rec hit block data.
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].
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.
285 bool fWarnForUnexpecedBlock; ///< Flag indicating if we should log a warning if we got a block of an unexpected type.
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.
292 ClassDef(AliHLTMUONMansoTrackerFSMComponent, 0); // Manso tracker component implemented as a finite state machine (FSM).
295 #endif // AliHLTMUONMANSOTRACKERFSMCOMPONENT_H