]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSRawAnalyzerComponentv3.h
- data member was shadowed (fTree)
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSRawAnalyzerComponentv3.h
1
2 /**************************************************************************
3  * This file is property of and copyright by the ALICE HLT Project        * 
4  * All rights reserved.                                                   *
5  *                                                                        *
6  * Primary Authors: Per Thomas Hille, Oystein Djuvsland                   *
7  *                                                                        *
8  * Permission to use, copy, modify and distribute this software and its   *
9  * documentation strictly for non-commercial purposes is hereby granted   *
10  * without fee, provided that the above copyright notice appears in all   *
11  * copies and that both the copyright notice and this permission notice   *
12  * appear in the supporting documentation. The authors make no claims     *
13  * about the suitability of this software for any purpose. It is          * 
14  * provided "as is" without express or implied warranty.                  *
15  **************************************************************************/
16
17
18 #ifndef ALIHLTPHOSRAWANALYZERCOMPONENTV3_H
19 #define ALIHLTPHOSRAWANALYZERCOMPONENTV3_H
20
21
22 /**
23  * Raw data analyzer component base class for PHOS HLT
24  *
25  * @file   AliHLTPHOSRawAnalyzerComponentv3.h
26  * @author Oystein Djuvsland
27  * @date   
28  * @brief  A clusterizer component for PHOS HLT
29 */
30
31 // see below for class documentation
32 // or
33 // refer to README to build package
34 // or
35 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
36
37 #include "AliHLTPHOSRcuProcessor.h"
38
39
40
41 class AliHLTPHOSRawAnalyzer;
42 class AliHLTPHOSRcuCellEnergyDataStruct;
43 class AliHLTPHOSMapper;
44 class AliHLTPHOSSanityInspector;
45 class AliHLTPHOSDigitMaker;
46 class AliHLTPHOSDigitContainerDataStruct;
47 class AliRawReaderMemory;
48 class AliAltroRawStreamV3;
49 class AliHLTPHOSChannelDataStruct;
50
51 //class RawDataWriter;
52
53
54 /**
55  * @class AliHLTPHOSRawAnalyzerComponentv3
56  * This the new and fast version of the component taking care of the decoding and energy and timing 
57  * extraction of the raw data from PHOS.
58  *
59  * <h2>General properties:</h2>
60  *
61  * Component ID: \b PhosRawAnalyzerv3 <br>
62  * Library: \b libAliHLTPHOS.so     <br>
63  * Input Data Types: @ref <br>
64  * Output Data Types: @ref AliHLTPHOSDefinitions::fgkChannelDataType<br>
65  *
66  * <h2>Mandatory arguments:</h2>
67  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
68  * \li No mandatory arguments for component                           <br>
69  *
70  * <h2>Optional arguments:</h2>
71  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
72  * \li -offset      <i> value </i> <br>
73  *      gives the offset added to the data during zero suppression (default value: 0)
74  * \li -bunchsizecut <i> value </i> <br>
75  *      minimum number of samples a bunch must contain to be considered  (default value: 0)
76  * \li -minpeakposition <i> value </i> <br>
77  *      cut on minimum postion of the peak in the bunch (defaul value: 0)
78  * \li -maxpeakposition <i> value </i> <br>
79  *      cut on maximum postion of the peak in the bunch (defaul value: 100)
80  *
81  * <h2>Configuration:</h2>
82  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
83  * \li No configuration arguments 
84  *
85  * <h2>Default CDB entries:</h2>
86  * \li No CDB entry yet, will come.
87  *
88  * <h2>Performance:</h2>
89  * Pretty good (~ 3 kHz), depends on amount of data...
90  *
91  * <h2>Memory consumption:</h2>
92  * Depends on the amount of data, but pretty godd
93  *
94  * <h2>Output size:</h2>
95  * Depends on the amount of data...
96  *
97  * More detailed description. (Soon)
98  *
99  * @ingroup alihlt_phos
100  */ 
101
102
103 class AliHLTPHOSRawAnalyzerComponentv3 : public AliHLTPHOSRcuProcessor
104 {
105  public:
106
107   /** Standard constructor */
108   AliHLTPHOSRawAnalyzerComponentv3();
109
110   /** Destructor */
111   virtual ~AliHLTPHOSRawAnalyzerComponentv3();
112
113   /** interface function, see @ref AliHLTComponent for description */
114   virtual int DoInit(int argc =0, const char** argv  = 0);
115
116   /** interface function, see @ref AliHLTComponent for description */
117   virtual int Deinit();
118
119   /** interface function, see @ref AliHLTComponent for description */
120   virtual const char* GetComponentID() = 0;
121
122   /** interface function, see @ref AliHLTComponent for description */
123   virtual void GetInputDataTypes( vector <AliHLTComponentDataType>& list);
124
125   /** interface function, see @ref AliHLTComponent for description */
126   virtual AliHLTComponentDataType GetOutputDataType();
127
128   /** interface function, see @ref AliHLTComponent for description */
129   virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
130
131   /** interface function, see @ref AliHLTComponent for description */
132   virtual AliHLTComponent* Spawn() = 0; 
133
134  protected:
135
136   /** interface function, see @ref AliHLTComponent for description */
137   using AliHLTPHOSRcuProcessor::DoEvent;
138
139   /** interface function, see @ref AliHLTComponent for description */
140   virtual int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, 
141                      AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, 
142                        AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks );  
143
144   /** 
145    * Do the real processing in the component 
146    * @param iter is the pointer to the data blocks
147    * @param outputPtr is the pointer to the output buffer
148    * @param size is the available size for output
149    * @param totSize is the total size used for output
150    * @return the size output size used
151    */
152   virtual Int_t DoIt(const AliHLTComponentBlockData* iter, AliHLTUInt8_t* outputPtr, const AliHLTUInt32_t size, UInt_t& totSize); 
153
154
155   /** Pointer to an analyzer object used for raw data anlysis */ 
156   AliHLTPHOSRawAnalyzer *fAnalyzerPtr;   //COMMENT
157
158  private:
159
160   int WriteRawData( AliHLTPHOSChannelDataStruct *dtaPtr );
161
162   /** Keep the copy constructor private since it should not be used */
163   AliHLTPHOSRawAnalyzerComponentv3(const AliHLTPHOSRawAnalyzerComponentv3 & );
164
165   /** Keep the assignement operator private since it should not be used */
166   AliHLTPHOSRawAnalyzerComponentv3 & operator = (const AliHLTPHOSRawAnalyzerComponentv3 &);
167
168   /** Mapping from harware address to geometrical address */
169   AliHLTPHOSMapper *fMapperPtr;                       //!transient 
170
171   /** Pointer to object which may check the integrity of the data */
172   AliHLTPHOSSanityInspector *fSanityInspectorPtr;     //!transient
173
174   /** Pointer to the raw data reader which reads from memory */
175   AliRawReaderMemory* fRawReaderMemoryPtr;            //!transient
176   
177   /** Pointer to the raw stream */
178   AliAltroRawStreamV3* fAltroRawStreamPtr;              //!transient
179
180   /** Describing which algorithm we are using */
181   Short_t fAlgorithm;                                 //COMMENT
182
183   /** The offset applied before ZS */
184   Int_t fOffset;                                      //COMMENT
185
186   /** The minimum length a bunch can have to be considered */
187   Int_t fBunchSizeCut;                                //COMMENT
188
189   /** The lowest position a peak can have to be considered */
190   Int_t fMinPeakPosition;                             //COMMENT
191   
192   /** The maximum position a peak can have to be considered */
193   Int_t fMaxPeakPosition;                             //COMMENT
194
195   /** Should we push raw data? */
196   bool fDoPushRawData;                                //COMMENT
197   
198   /** Should we check for and heal insanity? */
199   bool fInspectSanity;                                //COMMENT
200
201   // const UShort_t* fRawDataBuffer;
202   // RawDataWriter *fRawDataWriter; 
203
204   //  class RawDataWriter : public AliHLTLogging
205  
206   class RawDataWriter 
207   {
208   public:
209     RawDataWriter();
210     ~RawDataWriter();
211     //   void WriteChannelId(const UShort_t channeldid );
212     void NewChannel( );
213     void WriteBunchData(const UShort_t *bunchdata,  const int length,   const UInt_t starttimebin );
214     void ResetBuffer();
215     void SetChannelId( const UShort_t channeldid );
216
217     //void CopyBufferToSharedMemory(UShort_t *memPtr, const int sizetotal, const int sizeused );
218     int CopyBufferToSharedMemory(UShort_t *memPtr, const int sizetotal, const int sizeused );
219   
220  void NewEvent();
221  
222  private:
223     RawDataWriter (const RawDataWriter  & );
224     RawDataWriter & operator = (const RawDataWriter &);
225     
226     void Init();
227     
228     //    bool fIsFirstChannel;
229     UShort_t* fRawDataBuffer;
230     int fCurrentChannelSize;
231     int fBufferIndex;
232     int fBufferSize;
233     UShort_t *fCurrentChannelIdPtr;
234     UShort_t *fCurrentChannelSizePtr; 
235     UShort_t *fCurrentChannelDataPtr; 
236     int fTotalSize;
237  };
238
239   RawDataWriter *fRawDataWriter; 
240
241 };
242
243 #endif
244