Update master to aliroot
[u/mrichter/AliRoot.git] / HLT / CALO / AliHLTCaloRawAnalyzerComponentv3.h
CommitLineData
1882b7fd 1//-*- Mode: C++ -*-
2// $Id$
178dd351 3
4/**************************************************************************
5 * This file is property of and copyright by the ALICE HLT Project *
6 * All rights reserved. *
7 * *
8 * Primary Authors: Per Thomas Hille, Oystein Djuvsland *
9 * *
10 * Permission to use, copy, modify and distribute this software and its *
11 * documentation strictly for non-commercial purposes is hereby granted *
12 * without fee, provided that the above copyright notice appears in all *
13 * copies and that both the copyright notice and this permission notice *
14 * appear in the supporting documentation. The authors make no claims *
15 * about the suitability of this software for any purpose. It is *
16 * provided "as is" without express or implied warranty. *
17 **************************************************************************/
18
19
20#ifndef ALIHLTCALORAWANALYZERCOMPONENTV3_H
21#define ALIHLTCALORAWANALYZERCOMPONENTV3_H
22
23
24/**
25 * Raw data analyzer component base class for PHOS HLT
26 *
27 * @file AliHLTCaloRawAnalyzerComponentv3.h
28 * @author Oystein Djuvsland
29 * @date
7fbe22e7 30 * @brief Extraction of Amplitude and Peak position for PHOS/EMCAL HLT
178dd351 31*/
32
33// see below for class documentation
34// or
35// refer to README to build package
36// or
37// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
38
178dd351 39
72a884c8 40class AliCaloRawAnalyzer;
178dd351 41class AliHLTCaloRcuCellEnergyDataStruct;
42class AliHLTCaloMapper;
43class AliHLTCaloSanityInspector;
44class AliHLTCaloDigitMaker;
45class AliHLTCaloDigitContainerDataStruct;
46class AliRawReaderMemory;
47class AliAltroRawStreamV3;
48
72a884c8 49
178dd351 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
3800a654 98
4bc4be28 99// #include "AliHLTProcessor.h"
100// #include "AliHLTCaloDefinitions.h"
101
4f4b7ba4 102#include "AliHLTCaloConstantsHandler.h"
7fbe22e7 103#include "AliHLTCaloProcessor.h"
92d9f317 104#include "AliCaloRawAnalyzer.h"
097e19a7 105
baf0b40f 106
92d9f317 107#include "AliCaloConstants.h"
108using namespace Algo;
109
178dd351 110class AliHLTCaloMapper;
111
112
7fbe22e7 113class AliHLTCaloRawAnalyzerComponentv3 : public AliHLTCaloProcessor, protected AliHLTCaloConstantsHandler
178dd351 114{
115 public:
116
77f350f7 117 /** Constructor must be initialized to specific calorimeter */
92d9f317 118 AliHLTCaloRawAnalyzerComponentv3(TString det, fitAlgorithm algo );
178dd351 119 virtual ~AliHLTCaloRawAnalyzerComponentv3();
a9705807 120 virtual int DoInit(int argc =0, const char** argv = 0) ;
c375e15d 121 virtual int DoDeinit();
178dd351 122 virtual const char* GetComponentID() = 0;
72a884c8 123 virtual void GetInputDataTypes( vector <AliHLTComponentDataType>& list) = 0;
72a884c8 124 virtual AliHLTComponentDataType GetOutputDataType() = 0;
f9baa094 125 virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
178dd351 126 virtual AliHLTComponent* Spawn() = 0;
127
128 protected:
1e46316a 129 bool CheckInputDataType(const AliHLTComponentDataType &datatype);
178dd351 130 virtual int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
baf0b40f 131 AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
1e46316a 132 AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks );
133
178dd351 134
135 /**
136 * Do the real processing in the component
137 * @param iter is the pointer to the data blocks
138 * @param outputPtr is the pointer to the output buffer
139 * @param size is the available size for output
140 * @param totSize is the total size used for output
141 * @return the size output size used
142 */
1e46316a 143 virtual Int_t DoIt(const AliHLTComponentBlockData* iter, AliHLTUInt8_t* outputPtr,
144 const AliHLTUInt32_t size, UInt_t& totSize);
178dd351 145
1e46316a 146
147 protected:
148 virtual void InitMapping(const int specification ) = 0;
149 void PrintDebugInfo();
72a884c8 150 AliCaloRawAnalyzer *fAnalyzerPtr; //COMMENT
4f4b7ba4 151 AliHLTCaloMapper *fMapperPtr; //COMMENT
bdaaafe2 152 AliHLTUInt32_t fCurrentSpec; // Data specification (RCU)
153 bool fDebug; // Turn on to enable debug info
44175a17 154
178dd351 155 private:
77f350f7 156 AliHLTCaloRawAnalyzerComponentv3();
178dd351 157 AliHLTCaloRawAnalyzerComponentv3(const AliHLTCaloRawAnalyzerComponentv3 & );
178dd351 158 AliHLTCaloRawAnalyzerComponentv3 & operator = (const AliHLTCaloRawAnalyzerComponentv3 &);
baf0b40f 159 AliHLTCaloSanityInspector *fSanityInspectorPtr; //!transient /** Pointer to object which may check the integrity of the data */
178dd351 160
161 /** Pointer to the raw data reader which reads from memory */
162 AliRawReaderMemory* fRawReaderMemoryPtr; //!transient
163
164 /** Pointer to the raw stream */
165 AliAltroRawStreamV3* fAltroRawStreamPtr; //!transient
166
1882b7fd 167 /** detector */
168 TString fDetector; // detector string id
169
178dd351 170 /** Describing which algorithm we are using */
171 Short_t fAlgorithm; //COMMENT
172
173 /** The offset applied before ZS */
174 Int_t fOffset; //COMMENT
175
176 /** The minimum length a bunch can have to be considered */
177 Int_t fBunchSizeCut; //COMMENT
178
179 /** The lowest position a peak can have to be considered */
180 Int_t fMinPeakPosition; //COMMENT
181
182 /** The maximum position a peak can have to be considered */
183 Int_t fMaxPeakPosition; //COMMENT
184
baf0b40f 185 /** Should we push the raw data when the channel is crazy? */
c6d582d5 186 Bool_t fDoPushBadRawData; //COMMENT
187
188 /** Should we push all raw data (using the raw data writer) */
baf0b40f 189 Bool_t fDoPushRawData; //COMMENT
1e46316a 190
bdaaafe2 191 class RawDataWriter
178dd351 192 {
193 public:
77f350f7 194 RawDataWriter(AliHLTCaloConstants* cConst);
1e46316a 195 virtual ~RawDataWriter();
178dd351 196 void NewChannel( );
197 void WriteBunchData(const UShort_t *bunchdata, const int length, const UInt_t starttimebin );
198 void ResetBuffer();
199 void SetChannelId( const UShort_t channeldid );
178dd351 200 int CopyBufferToSharedMemory(UShort_t *memPtr, const int sizetotal, const int sizeused );
201 void NewEvent();
1e46316a 202
f3e5fbc0 203 private:
77f350f7 204 RawDataWriter();
178dd351 205 RawDataWriter (const RawDataWriter & );
206 RawDataWriter & operator = (const RawDataWriter &);
207 void Init();
bdaaafe2 208 UShort_t* fRawDataBuffer; // Buffer for storing of rawdata
209 int fCurrentChannelSize; //Comment
210 int fBufferIndex; //Position in buffer
211 int fBufferSize; //Comment
212 UShort_t *fCurrentChannelIdPtr; //Channel ID (module, row, column)
213 UShort_t *fCurrentChannelSizePtr; //Comment
214 UShort_t *fCurrentChannelDataPtr; //Comment
215 int fTotalSize; //Comment
178dd351 216 };
217
218 RawDataWriter *fRawDataWriter;
1882b7fd 219 ClassDef(AliHLTCaloRawAnalyzerComponentv3, 0)
4f4b7ba4 220
178dd351 221};
222
223#endif
224