]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/OnlineAnalysis/AliHLTMUONMansoTrackerFSMComponent.cxx
Improving documentation and macros.
[u/mrichter/AliRoot.git] / HLT / MUON / OnlineAnalysis / AliHLTMUONMansoTrackerFSMComponent.cxx
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project        * 
3  * All rights reserved.                                                   *
4  *                                                                        *
5  * Primary Authors:                                                       *
6  *   Artur Szostak <artursz@iafrica.com>                                  *
7  *   Indranil Das <indra.das@saha.ac.in>                                  *
8  *                                                                        *
9  * Permission to use, copy, modify and distribute this software and its   *
10  * documentation strictly for non-commercial purposes is hereby granted   *
11  * without fee, provided that the above copyright notice appears in all   *
12  * copies and that both the copyright notice and this permission notice   *
13  * appear in the supporting documentation. The authors make no claims     *
14  * about the suitability of this software for any purpose. It is          * 
15  * provided "as is" without express or implied warranty.                  *
16  **************************************************************************/
17
18 // $Id$
19
20 ///
21 ///  @file   AliHLTMUONMansoTrackerFSMComponent.cxx
22 ///  @author Artur Szostak <artursz@iafrica.com>,
23 ///          Indranil Das <indra.das@saha.ac.in>
24 ///  @date   18 Sep 2007
25 ///  @brief  Implementation of AliHLTMUONMansoTrackerFSMComponent class.
26 ///
27
28 #include "AliHLTMUONMansoTrackerFSMComponent.h"
29 #include "AliHLTMUONConstants.h"
30 #include "AliHLTMUONCalculations.h"
31 #include "AliHLTMUONUtils.h"
32 #include "AliHLTMUONMansoTrackerFSM.h"
33 #include "AliHLTMUONDataBlockReader.h"
34 #include "AliHLTMUONDataBlockWriter.h"
35 #include <cstdlib>
36 #include <cstring>
37 #include <cerrno>
38 #include <new>
39
40 ClassImp(AliHLTMUONMansoTrackerFSMComponent);
41
42
43 AliHLTMUONMansoTrackerFSMComponent::AliHLTMUONMansoTrackerFSMComponent() :
44         AliHLTMUONProcessor(),
45         AliHLTMUONMansoTrackerFSMCallback(),
46         fTracker(NULL),
47         fTrackCount(0),
48         fBlock(NULL),
49         fRecHitBlockArraySize(0),
50         fWarnForUnexpecedBlock(false),
51         fCanLoadZmiddle(true),
52         fCanLoadBL(true)
53 {
54         ///
55         /// Default constructor.
56         ///
57         
58         for (int i = 0; i < 4; i++)
59         {
60                 fRecHitBlockCount[i] = 0;
61                 fRecHitBlock[i] = NULL;
62         }
63         
64         ResetCanLoadFlags();
65 }
66
67
68 AliHLTMUONMansoTrackerFSMComponent::~AliHLTMUONMansoTrackerFSMComponent()
69 {
70         ///
71         /// Default destructor.
72         ///
73         
74         // Should never have the following 2 pointers non-NULL since DoDeinit
75         // should have been called before, but handle this case anyway.
76         if (fTracker != NULL) delete fTracker;
77         
78         // Remember that only fRecHitBlock[0] stores the pointer to the allocated
79         // memory. The other pointers are just reletive to this.
80         if (fRecHitBlock[0] != NULL) delete [] fRecHitBlock[0];
81 }
82
83
84 const char* AliHLTMUONMansoTrackerFSMComponent::GetComponentID()
85 {
86         ///
87         /// Inherited from AliHLTComponent. Returns the component ID.
88         ///
89         
90         return AliHLTMUONConstants::MansoTrackerFSMId();
91 }
92
93
94 void AliHLTMUONMansoTrackerFSMComponent::GetInputDataTypes(
95                 AliHLTComponentDataTypeList& list
96         )
97 {
98         ///
99         /// Inherited from AliHLTProcessor. Returns the list of expected input data types.
100         ///
101         
102         assert( list.empty() );
103         list.push_back( AliHLTMUONConstants::TriggerRecordsBlockDataType() );
104         list.push_back( AliHLTMUONConstants::RecHitsBlockDataType() );
105 }
106
107
108 AliHLTComponentDataType AliHLTMUONMansoTrackerFSMComponent::GetOutputDataType()
109 {
110         ///
111         /// Inherited from AliHLTComponent. Returns the output data type.
112         ///
113         
114         return kAliHLTMultipleDataType;
115 }
116
117
118 int AliHLTMUONMansoTrackerFSMComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& list)
119 {
120         /// Inherited from AliHLTComponent. Returns the output data types.
121         
122         assert( list.empty() );
123         list.push_back( AliHLTMUONConstants::MansoTracksBlockDataType() );
124         list.push_back( AliHLTMUONConstants::MansoCandidatesBlockDataType() );
125         return list.size();
126 }
127
128
129 void AliHLTMUONMansoTrackerFSMComponent::GetOutputDataSize(
130                 unsigned long& constBase, double& inputMultiplier
131         )
132 {
133         ///
134         /// Inherited from AliHLTComponent. Returns an estimate of the expected output data size.
135         ///
136         
137         constBase = sizeof(AliHLTMUONMansoTracksBlockStruct) + 1024*1024;
138         inputMultiplier = 1;
139 }
140
141
142 AliHLTComponent* AliHLTMUONMansoTrackerFSMComponent::Spawn()
143 {
144         ///
145         /// Inherited from AliHLTComponent. Creates a new object instance.
146         ///
147         
148         return new AliHLTMUONMansoTrackerFSMComponent;
149 }
150
151
152 int AliHLTMUONMansoTrackerFSMComponent::DoInit(int argc, const char** argv)
153 {
154         ///
155         /// Inherited from AliHLTComponent.
156         /// Parses the command line parameters and initialises the component.
157         ///
158         
159         HLTInfo("Initialising dHLT manso tracker FSM component.");
160         
161         // Inherit the parents functionality.
162         int result = AliHLTMUONProcessor::DoInit(argc, argv);
163         if (result != 0) return result;
164
165         // Just in case for whatever reason we still have some of the internal
166         // object allocated previously still hanging around delete them now.
167         FreeMemory();
168         
169         fWarnForUnexpecedBlock = false;
170         ResetCanLoadFlags();
171         double zmiddle = 0;
172         double bfieldintegral = 0;
173         double roiA[4] = {0, 0, 0, 0};
174         double roiB[4] = {0, 0, 0, 0};
175         double chamberZ[6] = {0, 0, 0, 0, 0, 0};
176         
177         for (int i = 0; i < argc; i++)
178         {
179                 if (ArgumentAlreadyHandled(i, argv[i])) continue;
180
181                 if (strcmp( argv[i], "-zmiddle" ) == 0)
182                 {
183                         if (not fCanLoadZmiddle)
184                         {
185                                 HLTWarning("The Z coordinate for the middle of the dipole was already specified."
186                                         " Will replace previous value given by -zmiddle."
187                                 );
188                         }
189                         
190                         if ( argc <= i+1 )
191                         {
192                                 HLTError("The Z coordinate for the middle of the dipole was not specified." );
193                                 return -EINVAL;
194                         }
195                         
196                         char* cpErr = NULL;
197                         zmiddle = strtod(argv[i+1], &cpErr);
198                         if (cpErr == NULL or *cpErr != '\0')
199                         {
200                                 HLTError("Cannot convert '%s' to a valid floating point number.",
201                                         argv[i+1]
202                                 );
203                                 return -EINVAL;
204                         }
205                         
206                         fCanLoadZmiddle = false;  // Prevent loading from CDB.
207                         i++;
208                         continue;
209                 }
210         
211                 if (strcmp( argv[i], "-bfieldintegral" ) == 0)
212                 {
213                         if (not fCanLoadBL)
214                         {
215                                 HLTWarning("The magnetic field integral was already specified."
216                                         " Will replace previous value given by -bfieldintegral."
217                                 );
218                         }
219                         
220                         if ( argc <= i+1 )
221                         {
222                                 HLTError("The magnetic field integral was not specified." );
223                                 return -EINVAL;
224                         }
225                         
226                         char* cpErr = NULL;
227                         bfieldintegral = strtod(argv[i+1], &cpErr);
228                         if (cpErr == NULL or *cpErr != '\0')
229                         {
230                                 HLTError("Cannot convert '%s' to a valid floating point number.",
231                                         argv[i+1]
232                                 );
233                                 return -EINVAL;
234                         }
235                         
236                         fCanLoadBL = false;  // Prevent loading from CDB.
237                         i++;
238                         continue;
239                 }
240         
241                 if (strcmp(argv[i], "-a7") == 0 or strcmp(argv[i], "-a8") == 0 or
242                     strcmp(argv[i], "-a9") == 0 or strcmp(argv[i], "-a10") == 0
243                    )
244                 {
245                         int chamber = 7; int chamberIndex = 0;
246                         switch (argv[i][2])
247                         {
248                         case '7': chamber = 7; chamberIndex = 0; break;
249                         case '8': chamber = 8; chamberIndex = 1; break;
250                         case '9': chamber = 9; chamberIndex = 2; break;
251                         case '1': chamber = 10; chamberIndex = 3; break;
252                         }
253                         
254                         if (not fCanLoadA[chamberIndex])
255                         {
256                                 HLTWarning("The region of interest parameter 'A' for chamber %d was"
257                                         " already specified. Will replace previous value given by -a%d.",
258                                         chamber, chamber
259                                 );
260                         }
261                         
262                         if ( argc <= i+1 )
263                         {
264                                 HLTError("The region of interest parameter was not specified." );
265                                 return -EINVAL;
266                         }
267                         
268                         char* cpErr = NULL;
269                         roiA[chamberIndex] = strtod(argv[i+1], &cpErr);
270                         if (cpErr == NULL or *cpErr != '\0')
271                         {
272                                 HLTError("Cannot convert '%s' to a valid floating point number.",
273                                         argv[i+1]
274                                 );
275                                 return -EINVAL;
276                         }
277                         
278                         fCanLoadA[chamberIndex] = false;  // Prevent loading from CDB.
279                         i++;
280                         continue;
281                 }
282         
283                 if (strcmp(argv[i], "-b7") == 0 or strcmp(argv[i], "-b8") == 0 or
284                     strcmp(argv[i], "-b9") == 0 or strcmp(argv[i], "-b10") == 0
285                    )
286                 {
287                         int chamber = 7; int chamberIndex = 0;
288                         switch (argv[i][2])
289                         {
290                         case '7': chamber = 7; chamberIndex = 0; break;
291                         case '8': chamber = 8; chamberIndex = 1; break;
292                         case '9': chamber = 9; chamberIndex = 2; break;
293                         case '1': chamber = 10; chamberIndex = 3; break;
294                         }
295                         
296                         if (not fCanLoadB[chamberIndex])
297                         {
298                                 HLTWarning("The region of interest parameter 'B' for chamber %d was"
299                                         " already specified. Will replace previous value given by -b%d.",
300                                         chamber, chamber
301                                 );
302                         }
303                         
304                         if ( argc <= i+1 )
305                         {
306                                 HLTError("The region of interest parameter was not specified." );
307                                 return -EINVAL;
308                         }
309                         
310                         char* cpErr = NULL;
311                         roiB[chamberIndex] = strtod(argv[i+1], &cpErr);
312                         if (cpErr == NULL or *cpErr != '\0')
313                         {
314                                 HLTError("Cannot convert '%s' to a valid floating point number.",
315                                         argv[i+1]
316                                 );
317                                 return -EINVAL;
318                         }
319                         
320                         fCanLoadB[chamberIndex] = false;  // Prevent loading from CDB.
321                         i++;
322                         continue;
323                 }
324                 
325                 if (strcmp(argv[i], "-z7") == 0 or strcmp(argv[i], "-z8") == 0 or
326                     strcmp(argv[i], "-z9") == 0 or strcmp(argv[i], "-z10") == 0 or
327                     strcmp(argv[i], "-z11") == 0 or strcmp(argv[i], "-z13") == 0
328                    )
329                 {
330                         int chamber = 7; int chamberIndex = 0;
331                         switch (argv[i][2])
332                         {
333                         case '7': chamber = 7; chamberIndex = 0; break;
334                         case '8': chamber = 8; chamberIndex = 1; break;
335                         case '9': chamber = 9; chamberIndex = 2; break;
336                         case '1':
337                                 switch (argv[i][3])
338                                 {
339                                 case '0': chamber = 10; chamberIndex = 3; break;
340                                 case '1': chamber = 11; chamberIndex = 4; break;
341                                 case '3': chamber = 13; chamberIndex = 5; break;
342                                 }
343                                 break;
344                         }
345                         
346                         if (not fCanLoadZ[chamberIndex])
347                         {
348                                 HLTWarning("The nominal Z coordinate of chamber %d was already"
349                                         " specified. Will replace previous value given by -z%d.",
350                                         chamber, chamber
351                                 );
352                         }
353                         
354                         if ( argc <= i+1 )
355                         {
356                                 HLTError("The region of interest parameter was not specified." );
357                                 return -EINVAL;
358                         }
359                         
360                         char* cpErr = NULL;
361                         chamberZ[chamberIndex] = strtod(argv[i+1], &cpErr);
362                         if (cpErr == NULL or *cpErr != '\0')
363                         {
364                                 HLTError("Cannot convert '%s' to a valid floating point number.",
365                                         argv[i+1]
366                                 );
367                                 return -EINVAL;
368                         }
369                         
370                         fCanLoadZ[chamberIndex] = false;  // Prevent loading from CDB.
371                         i++;
372                         continue;
373                 }
374                 
375                 if (strcmp(argv[i], "-warn_on_unexpected_block") == 0)
376                 {
377                         fWarnForUnexpecedBlock = true;
378                         continue;
379                 }
380
381                 HLTError("Unknown option '%s'.", argv[i]);
382                 return -EINVAL;
383         }
384         
385         try
386         {
387                 fTracker = new AliHLTMUONMansoTrackerFSM();
388         }
389         catch (const std::bad_alloc&)
390         {
391                 HLTError("Could not allocate more memory for the tracker component.");
392                 return -ENOMEM;
393         }
394         fTracker->SetCallback(this);
395         
396         // Set all the parameters that were found on the command line.
397         if (not fCanLoadZmiddle) AliHLTMUONCalculations::Zf(zmiddle);
398         if (not fCanLoadBL) AliHLTMUONCalculations::QBL(bfieldintegral);
399         if (not fCanLoadA[0]) fTracker->SetA7(roiA[0]);
400         if (not fCanLoadA[1]) fTracker->SetA8(roiA[1]);
401         if (not fCanLoadA[2]) fTracker->SetA9(roiA[2]);
402         if (not fCanLoadA[3]) fTracker->SetA10(roiA[3]);
403         if (not fCanLoadB[0]) fTracker->SetB7(roiB[0]);
404         if (not fCanLoadB[1]) fTracker->SetB8(roiB[1]);
405         if (not fCanLoadB[2]) fTracker->SetB9(roiB[2]);
406         if (not fCanLoadB[3]) fTracker->SetB10(roiB[3]);
407         if (not fCanLoadZ[0]) fTracker->SetZ7(chamberZ[0]);
408         if (not fCanLoadZ[1]) fTracker->SetZ8(chamberZ[1]);
409         if (not fCanLoadZ[2]) fTracker->SetZ9(chamberZ[2]);
410         if (not fCanLoadZ[3]) fTracker->SetZ10(chamberZ[3]);
411         if (not fCanLoadZ[4]) fTracker->SetZ11(chamberZ[4]);
412         if (not fCanLoadZ[5]) fTracker->SetZ13(chamberZ[5]);
413         
414         if (not DelaySetup())
415         {
416                 if (AtLeastOneCanLoadFlagsIsSet())
417                 {
418                         HLTInfo("Loading configuration parameters from CDB.");
419                         
420                         result = ReadConfigFromCDB();
421                         if (result != 0)
422                         {
423                                 // Error messages already generated in ReadConfigFromCDB.
424                                 FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
425                                 return result;
426                         }
427                 }
428                 else
429                 {
430                         // Print the debug messages here since ReadConfigFromCDB does not get called,
431                         // in-which the debug messages would have been printed.
432                         HLTDebug("Using the following configuration parameters:");
433                         HLTDebug("                    Middle of dipole Z coordinate = %f cm", AliHLTMUONCalculations::Zf());
434                         HLTDebug("                          Magnetic field integral = %f T.m", AliHLTMUONCalculations::QBL());
435                         HLTDebug("   Region of interest parameter 'A' for chamber 7 = %f",    fTracker->GetA7());
436                         HLTDebug("   Region of interest parameter 'B' for chamber 7 = %f cm", fTracker->GetB7());
437                         HLTDebug("   Region of interest parameter 'A' for chamber 8 = %f",    fTracker->GetA8());
438                         HLTDebug("   Region of interest parameter 'B' for chamber 8 = %f cm", fTracker->GetB8());
439                         HLTDebug("   Region of interest parameter 'A' for chamber 9 = %f",    fTracker->GetA9());
440                         HLTDebug("   Region of interest parameter 'B' for chamber 9 = %f cm", fTracker->GetB9());
441                         HLTDebug("  Region of interest parameter 'A' for chamber 10 = %f",    fTracker->GetA10());
442                         HLTDebug("  Region of interest parameter 'B' for chamber 10 = %f cm", fTracker->GetB10());
443                         HLTDebug("               Nominal Z coordinate for chamber 7 = %f cm", fTracker->GetZ7());
444                         HLTDebug("               Nominal Z coordinate for chamber 8 = %f cm", fTracker->GetZ8());
445                         HLTDebug("               Nominal Z coordinate for chamber 9 = %f cm", fTracker->GetZ9());
446                         HLTDebug("              Nominal Z coordinate for chamber 10 = %f cm", fTracker->GetZ10());
447                         HLTDebug("              Nominal Z coordinate for chamber 11 = %f cm", fTracker->GetZ11());
448                         HLTDebug("              Nominal Z coordinate for chamber 13 = %f cm", fTracker->GetZ13());
449                 }
450                 
451                 ResetCanLoadFlags();  // From this point read all parameters from CDB.
452         }
453         
454         const int initArraySize = 10;
455         // Allocate some initial memory for the reconstructed hit arrays.
456         try
457         {
458                 fRecHitBlock[0] = new AliRecHitBlockInfo[initArraySize*4];
459         }
460         catch (const std::bad_alloc&)
461         {
462                 HLTError("Could not allocate more memory for the reconstructed hit arrays.");
463                 FreeMemory(); // Make sure we cleanup to avoid partial initialisation.
464                 return -ENOMEM;
465         }
466         // Only set the arrays' size once we have successfully allocated the memory for the arrays.
467         fRecHitBlockArraySize = initArraySize;
468         // Now we need to set the pointers fRecHitBlock[i] {i>0} relative to fRecHitBlock[0].
469         for (Int_t i = 1; i < 4; i++)
470         {
471                 fRecHitBlock[i] = fRecHitBlock[i-1] + fRecHitBlockArraySize;
472         }
473         // And reset the number of records actually stored in the arrays.
474         for (Int_t i = 0; i < 4; i++)
475         {
476                 fRecHitBlockCount[i] = 0;
477         }
478         
479         return 0;
480 }
481
482
483 int AliHLTMUONMansoTrackerFSMComponent::Reconfigure(
484                 const char* cdbEntry, const char* componentId
485         )
486 {
487         /// Inherited from AliHLTComponent. This method will reload CDB configuration
488         /// entries for this component from the CDB.
489         /// \param cdbEntry If this is NULL or equals "HLT/ConfigMUON/MansoTrackerFSM"
490         ///     then new configuration parameters are loaded, otherwise nothing is done.
491         /// \param componentId  The name of the component in the current chain.
492         
493         bool givenConfigPath = strcmp(cdbEntry, AliHLTMUONConstants::MansoTrackerFSMCDBPath()) == 0;
494         
495         if (cdbEntry == NULL or givenConfigPath)
496         {
497                 HLTInfo("Reading new configuration entries from CDB for component '%s'.", componentId);
498                 ResetCanLoadFlags();  // Make sure to allow reading all values from CDB.
499                 int result = ReadConfigFromCDB();
500                 if (result != 0) return result;
501         }
502         
503         return 0;
504 }
505
506
507 int AliHLTMUONMansoTrackerFSMComponent::ReadPreprocessorValues(const char* modules)
508 {
509         /// Inherited from AliHLTComponent. 
510         /// Updates the configuration of this component if HLT or ALL has been
511         /// specified in the 'modules' list.
512
513         TString mods = modules;
514         if (mods.Contains("ALL"))
515         {
516                 return Reconfigure(NULL, GetComponentID());
517         }
518         if (mods.Contains("HLT"))
519         {
520                 return Reconfigure(AliHLTMUONConstants::MansoTrackerFSMCDBPath(), GetComponentID());
521         }
522         return 0;
523 }
524
525
526 int AliHLTMUONMansoTrackerFSMComponent::ReadConfigFromCDB()
527 {
528         /// Reads this component's configuration parameters from the CDB.
529         /// These include the middle of the dipole Z coordinate (zmiddle), the
530         /// integrated magnetic field of the dipole, Z coordinates of the chambers
531         /// and the region of interest parameters used during the tracking.
532         /// \param setZmiddle Indicates if the zmiddle parameter should be set
533         ///       (default true).
534         /// \param setBL Indicates if the integrated magnetic field parameter should
535         ///       be set (default true).
536         /// \return 0 if no errors occured and negative error code compatible with
537         ///       the HLT framework on errors.
538
539         const char* pathToEntry = AliHLTMUONConstants::MansoTrackerFSMCDBPath();
540         
541         TMap* map = NULL;
542         int result = FetchTMapFromCDB(pathToEntry, map);
543         if (result != 0) return result;
544         
545         Double_t value = 0;
546         if (fCanLoadZmiddle)
547         {
548                 result = GetFloatFromTMap(map, "zmiddle", value, pathToEntry, "dipole middle Z coordinate");
549                 if (result != 0) return result;
550                 AliHLTMUONCalculations::Zf(value);
551         }
552         
553         if (fCanLoadBL)
554         {
555                 result = GetFloatFromTMap(map, "bfieldintegral", value, pathToEntry, "integrated magnetic field");
556                 if (result != 0) return result;
557                 AliHLTMUONCalculations::QBL(value);
558         }
559         
560         if (fCanLoadA[0])
561         {
562                 result = GetFloatFromTMap(map, "roi_paramA_chamber7", value, pathToEntry, "chamber 7 region of interest 'A'");
563                 if (result != 0) return result;
564                 fTracker->SetA7(value);
565         }
566         if (fCanLoadA[1])
567         {
568                 result = GetFloatFromTMap(map, "roi_paramA_chamber8", value, pathToEntry, "chamber 8 region of interest 'A'");
569                 if (result != 0) return result;
570                 fTracker->SetA8(value);
571         }
572         if (fCanLoadA[2])
573         {
574                 result = GetFloatFromTMap(map, "roi_paramA_chamber9", value, pathToEntry, "chamber 9 region of interest 'A'");
575                 if (result != 0) return result;
576                 fTracker->SetA9(value);
577         }
578         if (fCanLoadA[3])
579         {
580                 result = GetFloatFromTMap(map, "roi_paramA_chamber10", value, pathToEntry, "chamber 10 region of interest 'A'");
581                 if (result != 0) return result;
582                 fTracker->SetA10(value);
583         }
584         
585         if (fCanLoadB[0])
586         {
587                 result = GetFloatFromTMap(map, "roi_paramB_chamber7", value, pathToEntry, "chamber 7 region of interest 'B'");
588                 if (result != 0) return result;
589                 fTracker->SetB7(value);
590         }
591         if (fCanLoadB[1])
592         {
593                 result = GetFloatFromTMap(map, "roi_paramB_chamber8", value, pathToEntry, "chamber 8 region of interest 'B'");
594                 if (result != 0) return result;
595                 fTracker->SetB8(value);
596         }
597         if (fCanLoadB[2])
598         {
599                 result = GetFloatFromTMap(map, "roi_paramB_chamber9", value, pathToEntry, "chamber 9 region of interest 'B'");
600                 if (result != 0) return result;
601                 fTracker->SetB9(value);
602         }
603         if (fCanLoadB[3])
604         {
605                 result = GetFloatFromTMap(map, "roi_paramB_chamber10", value, pathToEntry, "chamber 10 region of interest 'B'");
606                 if (result != 0) return result;
607                 fTracker->SetB10(value);
608         }
609         
610         if (fCanLoadZ[0])
611         {
612                 result = GetFloatFromTMap(map, "chamber7postion", value, pathToEntry, "nominal chamber 7 Z coordinate");
613                 if (result != 0) return result;
614                 fTracker->SetZ7(value);
615         }
616         if (fCanLoadZ[1])
617         {
618                 result = GetFloatFromTMap(map, "chamber8postion", value, pathToEntry, "nominal chamber 8 Z coordinate");
619                 if (result != 0) return result;
620                 fTracker->SetZ8(value);
621         }
622         if (fCanLoadZ[2])
623         {
624                 result = GetFloatFromTMap(map, "chamber9postion", value, pathToEntry, "nominal chamber 9 Z coordinate");
625                 if (result != 0) return result;
626                 fTracker->SetZ9(value);
627         }
628         if (fCanLoadZ[3])
629         {
630                 result = GetFloatFromTMap(map, "chamber10postion", value, pathToEntry, "nominal chamber 10 Z coordinate");
631                 if (result != 0) return result;
632                 fTracker->SetZ10(value);
633         }
634         if (fCanLoadZ[4])
635         {
636                 result = GetFloatFromTMap(map, "chamber11postion", value, pathToEntry, "nominal chamber 11 Z coordinate");
637                 if (result != 0) return result;
638                 fTracker->SetZ11(value);
639         }
640         if (fCanLoadZ[5])
641         {
642                 result = GetFloatFromTMap(map, "chamber13postion", value, pathToEntry, "nominal chamber 13 Z coordinate");
643                 if (result != 0) return result;
644                 fTracker->SetZ13(value);
645         }
646         
647         HLTDebug("Using the following configuration parameters:");
648         HLTDebug("                    Middle of dipole Z coordinate = %f cm", AliHLTMUONCalculations::Zf());
649         HLTDebug("                          Magnetic field integral = %f T.m", AliHLTMUONCalculations::QBL());
650         HLTDebug("   Region of interest parameter 'A' for chamber 7 = %f",    fTracker->GetA7());
651         HLTDebug("   Region of interest parameter 'B' for chamber 7 = %f cm", fTracker->GetB7());
652         HLTDebug("   Region of interest parameter 'A' for chamber 8 = %f",    fTracker->GetA8());
653         HLTDebug("   Region of interest parameter 'B' for chamber 8 = %f cm", fTracker->GetB8());
654         HLTDebug("   Region of interest parameter 'A' for chamber 9 = %f",    fTracker->GetA9());
655         HLTDebug("   Region of interest parameter 'B' for chamber 9 = %f cm", fTracker->GetB9());
656         HLTDebug("  Region of interest parameter 'A' for chamber 10 = %f",    fTracker->GetA10());
657         HLTDebug("  Region of interest parameter 'B' for chamber 10 = %f cm", fTracker->GetB10());
658         HLTDebug("               Nominal Z coordinate for chamber 7 = %f cm", fTracker->GetZ7());
659         HLTDebug("               Nominal Z coordinate for chamber 8 = %f cm", fTracker->GetZ8());
660         HLTDebug("               Nominal Z coordinate for chamber 9 = %f cm", fTracker->GetZ9());
661         HLTDebug("              Nominal Z coordinate for chamber 10 = %f cm", fTracker->GetZ10());
662         HLTDebug("              Nominal Z coordinate for chamber 11 = %f cm", fTracker->GetZ11());
663         HLTDebug("              Nominal Z coordinate for chamber 13 = %f cm", fTracker->GetZ13());
664         
665         return 0;
666 }
667
668
669 int AliHLTMUONMansoTrackerFSMComponent::DoDeinit()
670 {
671         ///
672         /// Inherited from AliHLTComponent. Performs a cleanup of the component.
673         ///
674         
675         HLTInfo("Deinitialising dHLT manso tracker FSM component.");
676         FreeMemory();
677         return 0;
678 }
679
680
681 int AliHLTMUONMansoTrackerFSMComponent::DoEvent(
682                 const AliHLTComponentEventData& evtData,
683                 const AliHLTComponentBlockData* blocks,
684                 AliHLTComponentTriggerData& trigData,
685                 AliHLTUInt8_t* outputPtr,
686                 AliHLTUInt32_t& size,
687                 AliHLTComponentBlockDataList& outputBlocks
688         )
689 {
690         ///
691         /// Inherited from AliHLTProcessor. Processes the new event data.
692         ///
693         
694         // Initialise the configuration parameters from CDB if we were
695         // requested to initialise only when the first event was received.
696         if (DelaySetup())
697         {
698                 // Load the configuration paramters from CDB if they have not
699                 // been given on the command line.
700                 if (AtLeastOneCanLoadFlagsIsSet())
701                 {
702                         HLTInfo("Loading configuration parameters from CDB.");
703                         int result = ReadConfigFromCDB();
704                         if (result != 0) return result;
705                 }
706                 
707                 DoneDelayedSetup();
708                 ResetCanLoadFlags();  // From this point read all parameters from CDB.
709         }
710         
711         Reset();
712         AliHLTUInt32_t specification = 0;  // Contains the output data block spec bits.
713         
714         // Resize the rec hit arrays if we possibly will need more space.
715         // To guarantee that they will not overflow we need to make sure each
716         // array is at least as big as the number of input data blocks.
717         if (fRecHitBlockArraySize < evtData.fBlockCnt)
718         {
719                 // Release the old memory block and allocate more memory.
720                 if (fRecHitBlock[0] != NULL)
721                 {
722                         delete [] fRecHitBlock[0];
723                 }
724                 
725                 // Reset the number of records actually stored in the arrays.
726                 for (Int_t i = 0; i < 4; i++)
727                 {
728                         fRecHitBlockCount[i] = 0;
729                 }
730                 
731                 try
732                 {
733                         fRecHitBlock[0] = new AliRecHitBlockInfo[evtData.fBlockCnt*4];
734                 }
735                 catch (const std::bad_alloc&)
736                 {
737                         HLTError("Could not allocate more memory for the reconstructed hit arrays.");
738                         // Ok so now we need to clear all the pointers because we actually
739                         // deleted the memory.
740                         fRecHitBlockArraySize = 0;
741                         for (Int_t i = 0; i < 4; i++)
742                         {
743                                 fRecHitBlock[i] = NULL;
744                         }
745                         if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
746                         return -ENOMEM;
747                 }
748                 // Only set the arrays' size once we have successfully allocated the memory for the arrays.
749                 fRecHitBlockArraySize = evtData.fBlockCnt;
750                 // Now we need to set the pointers fRecHitBlock[i] {i>0} relative to fRecHitBlock[0].
751                 for (Int_t i = 1; i < 4; i++)
752                 {
753                         fRecHitBlock[i] = fRecHitBlock[i-1] + fRecHitBlockArraySize;
754                 }
755         }
756         
757         AliHLTMUONMansoTracksBlockWriter block(outputPtr, size);
758         fBlock = &block;
759         
760         if (not block.InitCommonHeader())
761         {
762                 Logging(kHLTLogError,
763                         "AliHLTMUONMansoTrackerFSMComponent::DoEvent",
764                         "Buffer overflow",
765                         "The buffer is only %d bytes in size. We need a minimum of %d bytes.",
766                         size, sizeof(AliHLTMUONMansoTracksBlockWriter::HeaderType)
767                 );
768                 if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
769                 size = 0; // Important to tell framework that nothing was generated.
770                 return -ENOBUFS;
771         }
772
773         // Loop over all input blocks in the event and add the ones that contain
774         // reconstructed hits into the hit buffers. The blocks containing trigger
775         // records are ignored for now and will be processed later.
776         for (AliHLTUInt32_t n = 0; n < evtData.fBlockCnt; n++)
777         {
778                 HLTDebug("Handling block: %u, with fDataType = '%s', fPtr = %p and fSize = %u bytes.",
779                         n, DataType2Text(blocks[n].fDataType).c_str(), blocks[n].fPtr, blocks[n].fSize
780                 );
781                 
782                 if (blocks[n].fDataType == AliHLTMUONConstants::RecHitsBlockDataType())
783                 {
784                         specification |= blocks[n].fSpecification;
785                         
786                         AliHLTMUONRecHitsBlockReader inblock(blocks[n].fPtr, blocks[n].fSize);
787                         if (not BlockStructureOk(inblock))
788                         {
789                                 if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
790                                 continue;
791                         }
792                         
793                         if (inblock.Nentries() != 0)
794                                 AddRecHits(blocks[n].fSpecification, inblock.GetArray(), inblock.Nentries());
795                         else
796                         {
797                                 Logging(kHLTLogDebug,
798                                         "AliHLTMUONMansoTrackerFSMComponent::DoEvent",
799                                         "Block empty",
800                                         "Received a reconstructed hits data block which contains no entries."
801                                 );
802                         }
803                 }
804                 else if (blocks[n].fDataType != AliHLTMUONConstants::TriggerRecordsBlockDataType())
805                 {
806                         // Log a message indicating that we got a data block that we
807                         // do not know how to handle.
808                         if (fWarnForUnexpecedBlock)
809                                 HLTWarning("Received a data block of a type we cannot handle: '%s', spec: 0x%X",
810                                         DataType2Text(blocks[n].fDataType).c_str(), blocks[n].fSpecification
811                                 );
812 #ifdef __DEBUG
813                         else
814                                 HLTDebug("Received a data block of a type we cannot handle: '%s', spec: 0x%X",
815                                         DataType2Text(blocks[n].fDataType).c_str(), blocks[n].fSpecification
816                                 );
817 #endif
818                 }
819         }
820   
821         // Again loop over all input blocks in the event, but this time look for
822         // the trigger record blocks and process these.
823         for (AliHLTUInt32_t n = 0; n < evtData.fBlockCnt; n++)
824         {
825                 if (blocks[n].fDataType != AliHLTMUONConstants::TriggerRecordsBlockDataType())
826                         continue;
827                 
828                 AliHLTMUONTriggerRecordsBlockReader inblock(blocks[n].fPtr, blocks[n].fSize);
829                 if (not BlockStructureOk(inblock))
830                 {
831                         if (DumpDataOnError()) DumpEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
832                         continue;
833                 }
834                 
835                 DebugTrace("Processing a trigger block with "
836                         << inblock.Nentries() << " entries."
837                 );
838                 
839                 specification |= blocks[n].fSpecification;
840                 
841                 for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
842                 {
843                         fTracker->FindTrack(inblock[i]);
844                         
845                         // Reset the tracker so that we do not double count tracks.
846                         fTracker->Reset();
847                 }
848         }
849         
850         AliHLTComponentBlockData bd;
851         FillBlockData(bd);
852         bd.fPtr = outputPtr;
853         bd.fOffset = 0;
854         bd.fSize = block.BytesUsed();
855         bd.fDataType = AliHLTMUONConstants::MansoTracksBlockDataType();
856         bd.fSpecification = specification;
857         outputBlocks.push_back(bd);
858         size = block.BytesUsed();
859
860         return 0;
861 }
862
863
864 void AliHLTMUONMansoTrackerFSMComponent::Reset()
865 {
866         ///
867         /// Reset the track count and reconstructed hit data block arrays.
868         ///
869         
870         DebugTrace("Resetting AliHLTMUONMansoTrackerFSMComponent.");
871
872         //fTracker->Reset();  // Not necessary here because it is done after every FindTrack call.
873         fTrackCount = 0;
874         fBlock = NULL;  // Do not delete. Already done implicitly at the end of DoEvent.
875         for (int i = 0; i < 4; i++)
876         {
877                 fRecHitBlockCount[i] = 0;
878         }
879 }
880
881
882 void AliHLTMUONMansoTrackerFSMComponent::FreeMemory()
883 {
884         /// Deletes any objects and arrays allocated by this component and releases
885         /// the memory used. This is called as a helper routine by the init and deinit
886         /// methods. If some or all of the object pointers are already NULL then
887         /// nothing is done for those. This method guarantees that all the relevant
888         /// pointers will be NULL after returning from this method.
889
890         if (fTracker != NULL)
891         {
892                 delete fTracker;
893                 fTracker = NULL;
894         }
895         
896         // Remember that only fRecHitBlock[0] stores the pointer to the allocated memory.
897         // The other pointers are just reletive to this.
898         if (fRecHitBlock[0] != NULL)
899                 delete [] fRecHitBlock[0];
900         
901         fRecHitBlockArraySize = 0;
902         for (Int_t i = 0; i < 4; i++)
903         {
904                 fRecHitBlockCount[i] = 0;
905                 fRecHitBlock[i] = NULL;
906         }
907 }
908
909
910 void AliHLTMUONMansoTrackerFSMComponent::AddRecHits(
911                 AliHLTUInt32_t specification,
912                 const AliHLTMUONRecHitStruct* recHits,
913                 AliHLTUInt32_t count
914         )
915 {
916         ///
917         /// Adds a new reconstructed hit data block to the internal list of blocks
918         /// for the tracker to process.
919         /// These lists will later be used when the tracker requests them through
920         /// the callback method 'RequestClusters'.
921         ///
922         
923         DebugTrace("AliHLTMUONMansoTrackerFSMComponent::AddRecHits called with specification = 0x"
924                  << std::hex << specification << std::dec << " and count = "
925                  << count << " rec hits."
926         );
927         
928         AliHLTUInt8_t chamberMap[20] = {
929                 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10
930         };
931         
932         // Identify the chamber the rec hits came from using the specifications field.
933         bool gotDataFromDDL[22];
934         AliHLTMUONUtils::UnpackSpecBits(specification, gotDataFromDDL);
935                 
936         AliHLTInt8_t chamber = -1;
937         for (int i = 0; i < 20; i++)
938         {
939                 if (not gotDataFromDDL[i]) continue;
940                 if (7 <= chamberMap[i] and chamberMap[i] <= 10)
941                 {
942                         if (chamber != -1 and chamber != chamberMap[i])
943                         {
944                                 Logging(kHLTLogError,
945                                         "AliHLTMUONMansoTrackerFSMComponent::AddRecHits",
946                                         "Invalid block",
947                                         "Received a data block with data from multiple chambers."
948                                           " This component cannot handle such a case."
949                                 );
950                                 return;
951                         }
952                         else
953                                 chamber = chamberMap[i];
954                 }
955                 else
956                 {
957                         Logging(kHLTLogError,
958                                 "AliHLTMUONMansoTrackerFSMComponent::AddRecHits",
959                                 "Invalid chamber",
960                                 "Received a data block with data from chamber %d"
961                                   " which is outside the expected range: [7..10].",
962                                 chamberMap[i]
963                         );
964                         return;
965                 }
966         }
967         
968         // Make sure we got one chamber number.
969         if (chamber < 7 or 10 < chamber)
970         {
971                 Logging(kHLTLogError,
972                         "AliHLTMUONMansoTrackerFSMComponent::AddRecHits",
973                         "Invalid block",
974                         "Received a reconstructed hit data block with a null specification."
975                          " Cannot know which chamber the data comes from."
976                 );
977                 return;
978         }
979         
980         DebugTrace("Added " << count << " reconstructed hits from chamber "
981                 << (int)chamber << " to the internal arrays."
982         );
983         
984         assert( fRecHitBlockCount[chamber-7] < fRecHitBlockArraySize );
985         AliRecHitBlockInfo info(count, recHits);
986         fRecHitBlock[chamber-7][fRecHitBlockCount[chamber-7]] = info;
987         fRecHitBlockCount[chamber-7]++;
988 }
989
990
991 void AliHLTMUONMansoTrackerFSMComponent::ResetCanLoadFlags()
992 {
993         /// Resets all the fCanLoad* flags to true. This enables loading of all
994         /// those CDB entries in the method ReadConfigFromCDB.
995         
996         fCanLoadZmiddle = true;
997         fCanLoadBL = true;
998         for (int i = 0; i < 4; i++)
999         {
1000                 fCanLoadA[i] = true;
1001                 fCanLoadB[i] = true;
1002         }
1003         for (int i = 0; i < 6; i++)
1004         {
1005                 fCanLoadZ[i] = true;
1006         }
1007 }
1008
1009
1010 bool AliHLTMUONMansoTrackerFSMComponent::AtLeastOneCanLoadFlagsIsSet() const
1011 {
1012         /// Returns true if at least one fCanLoad* flag was true and false otherwise.
1013
1014         if (fCanLoadZmiddle or fCanLoadBL) return true;
1015         for (int i = 0; i < 4; i++)
1016         {
1017                 if (fCanLoadA[i]) return true;
1018                 if (fCanLoadB[i]) return true;
1019         }
1020         for (int i = 0; i < 6; i++)
1021         {
1022                 if (fCanLoadZ[i]) return true;
1023         }
1024         return false;
1025 }
1026
1027
1028 void AliHLTMUONMansoTrackerFSMComponent::RequestClusters(
1029                 AliHLTMUONMansoTrackerFSM* tracker,
1030                 AliHLTFloat32_t left, AliHLTFloat32_t right,
1031                 AliHLTFloat32_t bottom, AliHLTFloat32_t top,
1032                 AliHLTMUONChamberName chamber, const void* tag
1033         )
1034 {
1035         ///
1036         /// Inherited from AliHLTMUONMansoTrackerFSMCallback.
1037         /// This is the call back method used by the tracker algorithm to request
1038         /// clusters on a certain chamber.
1039         ///
1040
1041         DebugTrace("AliHLTMUONMansoTracker::RequestClusters(chamber = " << chamber << ")");
1042         void* ctag = const_cast<void*>(tag);
1043         int chNo = -1;
1044         AliHLTUInt32_t recHitsCount = 0;
1045         AliRecHitBlockInfo* recHitsBlock = NULL;
1046         switch (chamber)
1047         {
1048         case kChamber7:
1049                 recHitsCount = fRecHitBlockCount[0];
1050                 recHitsBlock = fRecHitBlock[0];
1051                 chNo = 7;
1052                 break;
1053
1054         case kChamber8:
1055                 recHitsCount = fRecHitBlockCount[1];
1056                 recHitsBlock = fRecHitBlock[1];
1057                 chNo = 8;
1058                 break;
1059
1060         case kChamber9:
1061                 recHitsCount = fRecHitBlockCount[2];
1062                 recHitsBlock = fRecHitBlock[2];
1063                 chNo = 9;
1064                 break;
1065
1066         case kChamber10:
1067                 recHitsCount = fRecHitBlockCount[3];
1068                 recHitsBlock = fRecHitBlock[3];
1069                 chNo = 10;
1070                 break;
1071
1072         default: return;
1073         }
1074         
1075         DebugTrace("Returning requested hits for chamber " << chNo << ":");
1076         for (AliHLTUInt32_t i = 0; i < recHitsCount; i++)
1077         for (AliHLTUInt32_t j = 0; j < recHitsBlock[i].Count(); j++)
1078         {
1079                 const AliHLTMUONRecHitStruct* hit = &(recHitsBlock[i].Data()[j]);
1080                 if (left < hit->fX and hit->fX < right and bottom < hit->fY and hit->fY < top)
1081                         tracker->ReturnClusters(ctag, hit, 1);
1082         }
1083         DebugTrace("Done returning hits from chamber " << chNo << ".");
1084         tracker->EndOfClusters(ctag);
1085 }
1086
1087
1088 void AliHLTMUONMansoTrackerFSMComponent::EndOfClusterRequests(
1089                 AliHLTMUONMansoTrackerFSM* /*tracker*/
1090         )
1091 {
1092         ///
1093         /// Inherited from AliHLTMUONMansoTrackerFSMCallback.
1094         /// Nothing special to do here.
1095         ///
1096         
1097         DebugTrace("End of cluster requests.");
1098 }
1099
1100
1101 void AliHLTMUONMansoTrackerFSMComponent::FoundTrack(AliHLTMUONMansoTrackerFSM* tracker)
1102 {
1103         ///
1104         /// Inherited from AliHLTMUONMansoTrackerFSMCallback.
1105         /// This is the call back method used by the tracker algorithm to declare
1106         /// that a new track has been found.
1107         ///
1108         
1109         DebugTrace("AliHLTMUONMansoTrackerFSMComponent::FoundTrack()");
1110         
1111         AliHLTMUONMansoTracksBlockWriter* block =
1112                 reinterpret_cast<AliHLTMUONMansoTracksBlockWriter*>(fBlock);
1113         
1114         AliHLTMUONMansoTrackStruct newTrack;
1115         tracker->FillTrackData(newTrack);
1116         
1117         // The indicies of the duplicate tracks. If set to block->Nentries() then
1118         // this indicates the index is not used.
1119         AliHLTUInt32_t dup1 = block->Nentries();
1120         AliHLTUInt32_t dup2 = block->Nentries();
1121         
1122         // Check if there are any tracks that use the same hits as the one found.
1123         // If there are, then use the one that has the highest pT.
1124         // There will be at most 2 duplicate tracks.
1125         for (AliHLTUInt32_t i = 0; i < block->Nentries(); i++)
1126         {
1127                 AliHLTMUONMansoTrackStruct& track = (*block)[i];
1128                 bool hasNoDuplicates = true;
1129                 for (AliHLTUInt32_t j = 0; j < 4; j++)
1130                 {
1131                         if (track.fHit[j] == AliHLTMUONConstants::NilRecHitStruct()) continue;
1132                         if (newTrack.fHit[j] == AliHLTMUONConstants::NilRecHitStruct()) continue;
1133                         if (track.fHit[j] == newTrack.fHit[j])
1134                         {
1135                                 hasNoDuplicates = false;
1136                                 break;
1137                         }
1138                 }
1139                 if (hasNoDuplicates) continue;
1140                 
1141                 if (dup1 == block->Nentries())
1142                 {
1143                         dup1 = i;
1144                 }
1145                 else if (dup2 == block->Nentries())
1146                 {
1147                         dup2 = i;
1148                 }
1149                 else
1150                 {
1151                         HLTError("Found more than 2 tracks with duplicate hits. This is completely unexpected. Something is seriously wrong!");
1152                 }
1153         }
1154         
1155         if (dup1 != block->Nentries() and dup2 != block->Nentries())
1156         {
1157                 // In this case we found 2 duplicate entries.
1158                 // Figure out which one has the highest pT and keep only that one.
1159                 AliHLTMUONMansoTrackStruct& track1 = (*block)[dup1];
1160                 AliHLTMUONMansoTrackStruct& track2 = (*block)[dup2];
1161                 double newPt = sqrt(newTrack.fPx * newTrack.fPx + newTrack.fPy * newTrack.fPy);
1162                 double dupPt1 = sqrt(track1.fPx * track1.fPx + track1.fPy * track1.fPy);
1163                 double dupPt2 = sqrt(track2.fPx * track2.fPx + track2.fPy * track2.fPy);
1164                 
1165                 if (newPt >= dupPt1 and newPt >= dupPt2)
1166                 {
1167                         // The new track must replace both existing tracks.
1168                         track1 = newTrack;
1169                         track2 = (*block)[block->Nentries()-1];
1170                 }
1171                 else if (dupPt1 >= newPt and dupPt1 >= dupPt2)
1172                 {
1173                         // track1 has the highest pT so ignore the new track and delete track2.
1174                         track2 = (*block)[block->Nentries()-1];
1175                 }
1176                 else
1177                 {
1178                         // In this case track2 must have the highest pT so ignore the new
1179                         // track and delete track1.
1180                         track1 = (*block)[block->Nentries()-1];
1181                 }
1182                 
1183                 // Decrement the number of entries because we deleted a track.
1184                 assert(fTrackCount > 0);
1185                 assert(block->Nentries() > 0);
1186                 block->SetNumberOfEntries(block->Nentries()-1);
1187                 fTrackCount--;
1188         }
1189         else if (dup1 != block->Nentries())
1190         {
1191                 // Only one track with duplicate hits found.
1192                 // See if the new track has higher pT. If it does then replace the
1193                 // exisiting track, otherwise ignore the new track.
1194                 AliHLTMUONMansoTrackStruct& track1 = (*block)[dup1];
1195                 double newPt = sqrt(newTrack.fPx * newTrack.fPx + newTrack.fPy * newTrack.fPy);
1196                 double dupPt1 = sqrt(track1.fPx * track1.fPx + track1.fPy * track1.fPy);
1197                 if (newPt >= dupPt1)
1198                 {
1199                         track1 = newTrack;
1200                 }
1201         }
1202         else
1203         {
1204                 // No track found with duplicate hits so we can add the new track as it is.
1205                 AliHLTMUONMansoTrackStruct* track = block->AddEntry();
1206                 if (track == NULL)
1207                 {
1208                         Logging(kHLTLogError,
1209                                 "AliHLTMUONMansoTrackerFSMComponent::FoundTrack",
1210                                 "Buffer overflow",
1211                                 "We have overflowed the output buffer for Manso track data."
1212                                 " The output buffer size is only %d bytes.",
1213                                 block->BufferSize()
1214                         );
1215                         return;
1216                 }
1217         
1218                 fTrackCount++;
1219                 *track = newTrack;
1220                 DebugTrace("\tAdded new track: " << *track);
1221         }
1222 }
1223
1224
1225 void AliHLTMUONMansoTrackerFSMComponent::NoTrackFound(AliHLTMUONMansoTrackerFSM* /*tracker*/)
1226 {
1227         ///
1228         /// Inherited from AliHLTMUONMansoTrackerFSMCallback.
1229         /// Nothing special to do here.
1230         ///
1231         
1232         DebugTrace("No track found.");
1233 }
1234