]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/OnlineAnalysis/AliHLTMUONMansoTrackerFSMComponent.h
Added the dimuon trigger decision component, its default configuration CDB entries...
[u/mrichter/AliRoot.git] / HLT / MUON / OnlineAnalysis / AliHLTMUONMansoTrackerFSMComponent.h
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.                                                   *
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     *
16  * about the suitability of this software for any purpose. It is          * 
17  * provided "as is" without express or implied warranty.                  *
18  **************************************************************************/
19
20 /* $Id$ */
21
22 ///
23 ///  @file   AliHLTMUONMansoTrackerFSMComponent.h
24 ///  @author Artur Szostak <artursz@iafrica.com>,
25 ///          Indranil Das <indra.das@saha.ac.in>
26 ///  @date   
27 ///  @brief  Tracker component for the dimuon HLT using the Manso algorithm
28 ///          implemented as a finite state machine.
29 ///
30
31 #include "AliHLTProcessor.h"
32 #include "AliHLTMUONDataTypes.h"
33 #include "AliHLTMUONMansoTrackerFSMCallback.h"
34 #include <vector>
35
36 #if __GNUC__ && __GNUC__ < 3
37 #define std
38 #endif
39
40 class AliHLTMUONMansoTrackerFSM;
41 //class AliHLTMUONMansoTracksBlockWriter;
42 extern "C" {
43 struct AliHLTMUONRecHitStruct;
44 } // extern C
45
46
47 /**
48  * @class AliHLTMUONMansoTrackerFSMComponent
49  * @brief Dimuon HLT tracker component using the Manso tracking algorithm
50  *        implemented as a finite state machine.
51  */
52 class AliHLTMUONMansoTrackerFSMComponent
53         : public AliHLTProcessor, public AliHLTMUONMansoTrackerFSMCallback
54 {
55 public:
56         AliHLTMUONMansoTrackerFSMComponent();
57         virtual ~AliHLTMUONMansoTrackerFSMComponent();
58
59         // Public functions to implement the AliHLTProcessor interface.
60         // These functions are required for the registration process.
61         virtual const char* GetComponentID();
62         virtual void GetInputDataTypes(std::vector<AliHLTComponentDataType>& list);
63         virtual AliHLTComponentDataType GetOutputDataType();
64         virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
65         virtual AliHLTComponent* Spawn();
66         
67         // Inherited from AliHLTMUONMansoTrackerFSMCallback:
68         virtual void RequestClusters(
69                         AliHLTMUONMansoTrackerFSM* tracker,
70                         AliHLTFloat32_t left, AliHLTFloat32_t right,
71                         AliHLTFloat32_t bottom, AliHLTFloat32_t top,
72                         AliHLTMUONChamberName chamber, const void* tag
73                 );
74         virtual void EndOfClusterRequests(AliHLTMUONMansoTrackerFSM* tracker);
75         virtual void FoundTrack(AliHLTMUONMansoTrackerFSM* tracker);
76         virtual void NoTrackFound(AliHLTMUONMansoTrackerFSM* tracker);
77
78 protected:
79
80         // Protected functions to implement the AliHLTProcessor interface.
81         // These functions provide initialization as well as the actual processing
82         // capabilities of the component. 
83         virtual int DoInit(int argc, const char** argv);
84         virtual int DoDeinit();
85         virtual int DoEvent(
86                         const AliHLTComponentEventData& evtData,
87                         const AliHLTComponentBlockData* blocks,
88                         AliHLTComponentTriggerData& trigData,
89                         AliHLTUInt8_t* outputPtr,
90                         AliHLTUInt32_t& size,
91                         std::vector<AliHLTComponentBlockData>& outputBlocks
92                 );
93         
94         using AliHLTProcessor::DoEvent;
95
96 private:
97
98         // Do not allow copying of this class.
99         AliHLTMUONMansoTrackerFSMComponent(const AliHLTMUONMansoTrackerFSMComponent& /*obj*/);
100         AliHLTMUONMansoTrackerFSMComponent& operator = (const AliHLTMUONMansoTrackerFSMComponent& /*obj*/);
101
102         void Reset();
103         void FreeMemory();
104         
105         void AddRecHits(
106                         AliHLTUInt32_t specification,
107                         const AliHLTMUONRecHitStruct* recHits,
108                         AliHLTUInt32_t count
109                 );
110
111         AliHLTMUONMansoTrackerFSM* fTracker;  //! Tracker to do the actual work.
112         
113         AliHLTUInt32_t fTrackCount;  //! Number of tracks currently found.
114         /*AliHLTMUONMansoTracksBlockWriter*/void* fBlock;  //! The current data block we are writing.
115         
116         class AliRecHitBlockInfo
117         {
118         public:
119         
120                 AliRecHitBlockInfo(AliHLTUInt32_t count = 0, const AliHLTMUONRecHitStruct* data = NULL) :
121                         fCount(count), fData(data)
122                 {}
123         
124                 // Perform a shallow copy.
125                 AliRecHitBlockInfo(const AliRecHitBlockInfo& obj) :
126                         fCount(obj.fCount), fData(obj.fData)
127                 {}
128                 
129                 AliRecHitBlockInfo& operator = (const AliRecHitBlockInfo& obj)
130                 {
131                         fCount = obj.fCount;
132                         fData = obj.fData;
133                         return *this;
134                 }
135                 
136                 AliHLTUInt32_t Count() const { return fCount; }
137                 const AliHLTMUONRecHitStruct* Data() const { return fData; }
138         
139         private:
140                 AliHLTUInt32_t fCount;  // Number of elements in fData.
141                 const AliHLTMUONRecHitStruct* fData; // Pointer to the array of rec hits.
142         };
143         
144         //std::vector<AliRecHitBlockInfo> fRecHitBlock[4];  //! Arrays of rec hit block data.
145         AliHLTUInt32_t fRecHitBlockArraySize;  // The array size of each array in fRecHitBlock.
146         AliHLTUInt32_t fRecHitBlockCount[4];   // The number of records actually stored in fRecHitBlock[i].
147         // The following are 4 dynamic arrays of AliRecHitBlockInfo structures.
148         // These arrays will all have the same size = fRecHitBlockArraySize.
149         // The array itself is actually allocated only once and the pointer stored in fRecHitBlock[0],
150         // while the other pointers fRecHitBlock[i] {i>0} will just be set relative to fRecHitBlock[0].
151         // The allocated memory is: 4 * fRecHitBlockArraySize * sizeof(AliRecHitBlockInfo).
152         AliRecHitBlockInfo* fRecHitBlock[4];  //! Arrays of rec hit block data.
153
154         bool fWarnForUnexpecedBlock;  // Flag indicating if we should log a warning if we got a block of an unexpected type.
155         
156         ClassDef(AliHLTMUONMansoTrackerFSMComponent, 0);  // Manso tracker component implemented as a finite state machine (FSM).
157 };
158
159 #endif // AliHLTMUONMANSOTRACKERFSMCOMPONENT_H