]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCHWClusterDecoderComponent.h
class for mapping cluster hlt ID to offline ID.
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCHWClusterDecoderComponent.h
CommitLineData
ca761b13 1 // -*- Mode: C++ -*-
2
3#ifndef ALIHLTTPCHWCLUSTERDECODERCOMPONENT_H
4#define ALIHLTTPCHWCLUSTERDECODERCOMPONENT_H
5
6//* This file is property of and copyright by the ALICE HLT Project *
7//* ALICE Experiment at CERN, All rights reserved. *
8//* See cxx source for full Copyright notice *
9
10// @file AliHLTTPCHWClusterDecoderComponent.h
11//
12// @author Sergey Gorbunov <sergey.gorbunov@fias.uni-frankfurt.de>
13// @author Matthias Richter <matthias.richter@cern.ch>
14// @author Torsten Alt <talt@cern.ch>
15//
16// @brief This HLT Component converts output of FPGA clusterfinder
17// @brief to AliHLTTPCRawClusterData format. It also merges splitted clusters
18// @brief at branch borders and between the patches.
19// @note
20
21// see below for class documentation
22// or
23// refer to README to build package
24// or
25// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
26
27#include "AliHLTProcessor.h"
28#include "AliHLTComponentBenchmark.h"
29
30class AliHLTTPCHWCFData;
31class AliHLTTPCHWClusterMergerV1;
32
33/**
34 * @class AliHLTTPCHWClusterDecoderComponent
35 *
36 * The format of the incoming HW clusters is as follows:
37 *
38 * WORD 0 : CDH0
39 * WORD 1 : CDH1
40 * WORD 2 : CDH2
41 * WORD 3 : CDH3
42 * WORD 4 : CDH4 8 32-bit words for the common data header
43 * WORD 5 : CDH5
44 * WORD 6 : CDH6
45 * WORD 7 : CDH7
46 *
47 * WORD 8 : contains cluster identification (bits 30-31), Row (6 bits (bit 24-29)) and Charge (24 bits (bit 0-23))
48 * WORD 9 : contain the pad (32 bits)
49 * WORD 10 : contain the time (32 bits)
50 * WORD 11 : contain the pad error (32 bits)
51 * WORD 12 : contain the time error (32 bits)
52 *
53 * WORD 13 : contains cluster identification (bits 30-31), Row (6 bits (bit 24-29)) and Charge (24 bits (bit 0-23))
54 * WORD 14 : contains the pad (32 bits)
55 * WORD 15 : contains the time (32 bits)
56 * WORD 16 : contains the pad error (32 bits)
57 * WORD 17 : contains the time error (32 bits)
58
59 * WORD 18 : RCU TRAILER WORD 0
60 * WORD 19 : RCU TRAILER WORD 1
61 * ...
62 * WORD 18+N : RCU TRAILER WORD N
63 *
64 * The cluster is signified with bits 30 and 31 being 11 (0x3).
65 * The RCU trailer is signified with bits 30 and 31 being 10 (0x2).
66 *
67 * A buffer reads the incoming data block. We skip the first 8 words of the CDH.
68 * Then we shift 30 bits to the right to get the last 2 bits of the next word, 30 and 31.
69 *
70 * If bit3031 = 0x3 (11), we are in the beginning of a cluster.
71 * We apply a 24-bit mask to get the first 24 bits that represent the charge of the cluster.
72 * We cast the word buffer to an 8-bit pointer that will point at bit 0 (for little endian),
73 * then increment it by 3 bytes, which takes us to bit 24. The last byte of the word
74 * contains row info and the cluster tag (11).
75 *
76 * With a & bit operation the row info is retrieved (6 bits).
77 * The rest of the cluster information is contained in the following 4 words.
78 *
79 * If bit3031 = 0x2 (10), we have reached the RCU trailer.
80 *
81 * -------------------------------------------------------
82 *
83 * Short note about little endian:
84 *
85 * DE AD BE EF (a 4 byte word)
86 *
87 * The byte order in memory to represent this word will be:
88 *
89 * EF
90 * BE
91 * AD
92 * DE
93 *
94 * The least significant byte value is stored at the lowest address.
95 * http://en.wikipedia.org/wiki/Endianness#Little-endian
96 *
97 * @ingroup alihlt_tpc_components
98 */
99
100class AliHLTTPCHWClusterDecoderComponent : public AliHLTProcessor {
101
102public:
103
104 /** standard constructor */
105 AliHLTTPCHWClusterDecoderComponent();
106 /** destructor */
107 virtual ~AliHLTTPCHWClusterDecoderComponent();
108
109 // Public functions to implement AliHLTComponent's interface.
110 // These functions are required for the registration process
111
112 /** interface function, see AliHLTComponent for description */
113 const char* GetComponentID();
114 /** interface function, see AliHLTComponent for description */
115 void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
116 /** interface function, see AliHLTComponent for description */
117 AliHLTComponentDataType GetOutputDataType();
118 /** interface function, see AliHLTComponent for description */
119 int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList);
120 /** interface function, see AliHLTComponent for description */
121 virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
122 /** interface function, see AliHLTComponent for description */
123 AliHLTComponent* Spawn();
124 /** interface function, see @ref AliHLTComponent for description */
125 void GetOCDBObjectDescription( TMap* const targetMap);
126
127 void PrintDebug(AliHLTUInt32_t * buffer, Int_t size);
128
129protected:
130
131 // Protected functions to implement AliHLTComponent's interface.
132 // These functions provide initialization as well as the actual processing capabilities of the component.
133
134 int DoInit( int argc, const char** argv );
135 int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
136 AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
137 AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks );
138 int DoDeinit();
139
140 int Reconfigure(const char* cdbEntry, const char* chainId);
141
142 using AliHLTProcessor::DoEvent;
143
144private:
145
146 int ScanConfigurationArgument(int argc, const char** argv);
147
148 /** copy constructor prohibited */
149 AliHLTTPCHWClusterDecoderComponent(const AliHLTTPCHWClusterDecoderComponent&);
150
151 /** assignment operator prohibited */
152 AliHLTTPCHWClusterDecoderComponent& operator=(const AliHLTTPCHWClusterDecoderComponent&);
153
154 int InitClusterMerger();
155
156 static const char* fgkOCDBEntry; //!transient
157
158 AliHLTTPCHWCFData* fpDecoder; // decoder
159 AliHLTTPCHWClusterMergerV1* fpClusterMerger; //! merger instance
160 Bool_t fDoMerge; // flag
161
162 AliHLTComponentBenchmark fBenchmark; // benchmarks
163};
164
165#endif