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