]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/CALO/AliHLTCaloRawAnalyzerComponentv3.h
- fixing compilation warnings
[u/mrichter/AliRoot.git] / HLT / CALO / AliHLTCaloRawAnalyzerComponentv3.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 ALIHLTCALORAWANALYZERCOMPONENTV3_H
19 #define ALIHLTCALORAWANALYZERCOMPONENTV3_H
20
21
22 /**
23  * Raw data analyzer component base class for PHOS HLT
24  *
25  * @file   AliHLTCaloRawAnalyzerComponentv3.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 "AliHLTCaloRcuProcessor.h"
38
39
40 class AliHLTCaloRawAnalyzer;
41 class AliHLTCaloRcuCellEnergyDataStruct;
42 class AliHLTCaloMapper;
43 class AliHLTCaloSanityInspector;
44 class AliHLTCaloDigitMaker;
45 class AliHLTCaloDigitContainerDataStruct;
46 class AliRawReaderMemory;
47 class AliAltroRawStreamV3;
48
49 /**
50  * @class AliHLTCaloRawAnalyzerComponentv3
51  * This the new and fast version of the component taking care of the decoding and energy and timing 
52  * extraction of the raw data from PHOS.
53  *
54  * <h2>General properties:</h2>
55  *
56  * Component ID: \b PhosRawAnalyzerv3 <br>
57  * Library: \b libAliHLTCalo.so     <br>
58  * Input Data Types: @ref <br>
59  * Output Data Types: @ref AliHLTCaloDefinitions::fgkChannelDataType<br>
60  *
61  * <h2>Mandatory arguments:</h2>
62  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
63  * \li No mandatory arguments for component                           <br>
64  *
65  * <h2>Optional arguments:</h2>
66  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
67  * \li -offset      <i> value </i> <br>
68  *      gives the offset added to the data during zero suppression (default value: 0)
69  * \li -bunchsizecut <i> value </i> <br>
70  *      minimum number of samples a bunch must contain to be considered  (default value: 0)
71  * \li -minpeakposition <i> value </i> <br>
72  *      cut on minimum postion of the peak in the bunch (defaul value: 0)
73  * \li -maxpeakposition <i> value </i> <br>
74  *      cut on maximum postion of the peak in the bunch (defaul value: 100)
75  *
76  * <h2>Configuration:</h2>
77  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
78  * \li No configuration arguments 
79  *
80  * <h2>Default CDB entries:</h2>
81  * \li No CDB entry yet, will come.
82  *
83  * <h2>Performance:</h2>
84  * Pretty good (~ 3 kHz), depends on amount of data...
85  *
86  * <h2>Memory consumption:</h2>
87  * Depends on the amount of data, but pretty godd
88  *
89  * <h2>Output size:</h2>
90  * Depends on the amount of data...
91  *
92  * More detailed description. (Soon)
93  *
94  * @ingroup alihlt_phos
95  */ 
96
97
98 #include "AliHLTProcessor.h"
99 #include "AliHLTCaloDefinitions.h"
100 #include "AliHLTCaloConstants.h"
101 #include "AliHLTCaloRcuProcessor.h"
102
103 class AliHLTCaloConstants;
104 class AliHLTCaloMapper;
105
106
107 //class AliHLTCaloRawAnalyzerComponentv3 : public AliHLTCaloRcuProcessor
108 class AliHLTCaloRawAnalyzerComponentv3 : public AliHLTCaloRcuProcessor 
109 {
110  public:
111
112   /** Constructor must be initialized to specific calorimeter */
113   AliHLTCaloRawAnalyzerComponentv3(TString det);
114   
115   /** Destructor */
116   virtual ~AliHLTCaloRawAnalyzerComponentv3();
117
118   // virtual bool CheckInputDataType(const AliHLTComponentDataType &datatype) = 0;
119
120   /** interface function, see @ref AliHLTComponent for description */
121   virtual int DoInit(int argc =0, const char** argv  = 0);
122
123   /** interface function, see @ref AliHLTComponent for description */
124   virtual int DoDeinit();
125
126   /** interface function, see @ref AliHLTComponent for description */
127   virtual const char* GetComponentID() = 0;
128
129   /** interface function, see @ref AliHLTComponent for description */
130   virtual void GetInputDataTypes( vector <AliHLTComponentDataType>& list);
131
132   /** interface function, see @ref AliHLTComponent for description */
133   virtual AliHLTComponentDataType GetOutputDataType();
134
135   /** interface function, see @ref AliHLTComponent for description */
136   virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
137
138   /** interface function, see @ref AliHLTComponent for description */
139   virtual AliHLTComponent* Spawn() = 0; 
140
141  protected:
142
143   //virtual bool CheckInputDataType(const AliHLTComponentDataType &datatype) = 0;
144   /** interface function, see @ref AliHLTComponent for description */
145
146   using AliHLTCaloRcuProcessor::DoEvent;
147
148   /** interface function, see @ref AliHLTComponent for description */
149   virtual int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, 
150                      AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, 
151                        AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks ) = 0;  
152
153   /** 
154    * Do the real processing in the component 
155    * @param iter is the pointer to the data blocks
156    * @param outputPtr is the pointer to the output buffer
157    * @param size is the available size for output
158    * @param totSize is the total size used for output
159    * @return the size output size used
160    */
161   virtual Int_t DoIt(const AliHLTComponentBlockData* iter, AliHLTUInt8_t* outputPtr, const AliHLTUInt32_t size, UInt_t& totSize); 
162
163   unsigned long fCaloEventCount;
164
165   /** Pointer to an analyzer object used for raw data anlysis */ 
166   AliHLTCaloRawAnalyzer *fAnalyzerPtr;   //COMMENT
167
168   AliHLTCaloMapper *fMapperPtr;     
169
170  private:
171
172 /** Keep default constructor private since it should not be used */
173   AliHLTCaloRawAnalyzerComponentv3();
174
175   /** Keep the copy constructor private since it should not be used */
176   AliHLTCaloRawAnalyzerComponentv3(const AliHLTCaloRawAnalyzerComponentv3 & );
177
178   /** Keep the assignement operator private since it should not be used */
179   AliHLTCaloRawAnalyzerComponentv3 & operator = (const AliHLTCaloRawAnalyzerComponentv3 &);
180
181   virtual void InitMapping(const int specification ) = 0;
182   
183   const bool fkDoPushRawData;
184   /** Mapping from harware address to geometrical address */
185   //  AliHLTCaloMapper *fMapperPtr;                       //!transient 
186
187
188
189   /** Pointer to object which may check the integrity of the data */
190   AliHLTCaloSanityInspector *fSanityInspectorPtr;     //!transient
191
192   /** Pointer to the raw data reader which reads from memory */
193   AliRawReaderMemory* fRawReaderMemoryPtr;            //!transient
194   
195   /** Pointer to the raw stream */
196   AliAltroRawStreamV3* fAltroRawStreamPtr;              //!transient
197
198   /** Describing which algorithm we are using */
199   Short_t fAlgorithm;                                 //COMMENT
200
201   /** The offset applied before ZS */
202   Int_t fOffset;                                      //COMMENT
203
204   /** The minimum length a bunch can have to be considered */
205   Int_t fBunchSizeCut;                                //COMMENT
206
207   /** The lowest position a peak can have to be considered */
208   Int_t fMinPeakPosition;                             //COMMENT
209   
210   /** The maximum position a peak can have to be considered */
211   Int_t fMaxPeakPosition;                             //COMMENT
212   
213   // AliHLTCaloMapper *fMapperPtr;
214
215   /** Constants class instance */
216   AliHLTCaloConstants *fCaloConstants;
217       
218
219
220   class RawDataWriter 
221   {
222   public:
223     RawDataWriter(AliHLTCaloConstants* cConst);
224     ~RawDataWriter();
225     //   void WriteChannelId(const UShort_t channeldid );
226     void NewChannel( );
227     void WriteBunchData(const UShort_t *bunchdata,  const int length,   const UInt_t starttimebin );
228     void ResetBuffer();
229     void SetChannelId( const UShort_t channeldid );
230     //void CopyBufferToSharedMemory(UShort_t *memPtr, const int sizetotal, const int sizeused );
231     int CopyBufferToSharedMemory(UShort_t *memPtr, const int sizetotal, const int sizeused );
232     void NewEvent();
233    
234   private:
235     
236     //Default constructor, should not be used. 
237     RawDataWriter();    
238     RawDataWriter (const RawDataWriter  & );
239     RawDataWriter & operator = (const RawDataWriter &);
240     void Init();
241     //    bool fIsFirstChannel;
242     UShort_t* fRawDataBuffer;
243     int fCurrentChannelSize;
244     int fBufferIndex;
245     int fBufferSize;
246     UShort_t *fCurrentChannelIdPtr;
247     UShort_t *fCurrentChannelSizePtr; 
248     UShort_t *fCurrentChannelDataPtr; 
249     int fTotalSize;
250   };
251
252   RawDataWriter *fRawDataWriter; 
253
254 };
255
256 #endif
257