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