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