Line data Source code
1 : #ifndef ALI_TPC_ALTRO_EMULATOR_H
2 : #define ALI_TPC_ALTRO_EMULATOR_H
3 :
4 :
5 : /** @file AliTPCAltroEmulator.h
6 : * @brief This the header File for the Altro class
7 : *
8 : * @author Roland Bramm
9 : * @version $LastChangedRevision: 688 $
10 : * @date $LastChangedDate: 2005-12-16 14:07:11 +0100 (Fri, 16 Dec 2005) $
11 : *
12 : * \verbinclude Altro/Altro.h.log
13 : */
14 :
15 :
16 : ///////////////////////////////////////////////////////////////////////////////
17 : // Class AliTPCAltroEmulator //
18 : // Class for emulation of the ALTRO chip (Altro digital Chain) in C++ //
19 : ///////////////////////////////////////////////////////////////////////////////
20 :
21 : #include "TNamed.h"
22 :
23 : class AliRawReader;
24 : class AliTPCRawStreamV3;
25 : class AliRawVEvent;
26 :
27 : class AliTPCAltroEmulator : public TNamed {
28 :
29 : public:
30 : AliTPCAltroEmulator(Int_t timebins=0, Short_t* Channel=0);
31 :
32 : ~AliTPCAltroEmulator();
33 :
34 : void ConfigAltro(Int_t ONBaselineCorrection1, Int_t ONTailcancellation, Int_t ONBaselineCorrection2, Int_t ONClipping, Int_t ONZerosuppression, Int_t ONDataFormatting);
35 : void ConfigBaselineCorrection1(Int_t mode, Int_t ValuePeDestal, Int_t *PedestalMem, Int_t polarity);
36 : void ConfigTailCancellationFilter(Int_t K1, Int_t K2, Int_t K3, Int_t L1, Int_t L2, Int_t L3);
37 : void ConfigTailCancellationFilterForRAWfiles(const Int_t* K1, const Int_t* K2, const Int_t* K3,
38 : const Int_t* L1, const Int_t* L2, const Int_t* L3);
39 : void ConfigBaselineCorrection2(Int_t HighThreshold, Int_t LowThreshold, Int_t Offset, Int_t Presamples, Int_t Postsamples);
40 : void ConfigZerosuppression(Int_t Threshold, Int_t MinSamplesaboveThreshold, Int_t Presamples, Int_t Postsamples);
41 :
42 : void SetChannelData(Int_t timebins, Short_t* Channel);
43 : void PrintParameters();
44 : void RunEmulation(Int_t roc=-1); // if -1, the standard "single" TCF is used
45 : Float_t CalculateCompression();
46 :
47 : // perform altro emulation on raw-reader level
48 :
49 : void RunEmulationOnRAWdata(AliRawReader *reader, Int_t plotFlag=0);
50 :
51 0 : TString GetDDLFolderName() const {return fDDLFolderName ;}
52 0 : TString GetOutputDateFileName() const {return fOutputDateFileName;}
53 0 : TString GetOutputRootFileName() const {return fOutputRootFileName;}
54 0 : void SetDDLFolderName (const TString &name) {fDDLFolderName =name;}
55 0 : void SetOutputDateFileName(const TString &name) {fOutputDateFileName=name;}
56 0 : void SetOutputRootFileName(const TString &name) {fOutputRootFileName=name;}
57 :
58 :
59 :
60 :
61 : enum {
62 : /**din - fpd*/ kDINxFPD,
63 : /**din - f(t)*/ kDINxFT,
64 : /**din - f(din)*/ kDINxFDIN,
65 : /**din - f(din-vpd)*/ kDINxFDINxVPD,
66 : /**din - vpd - fpd*/ kDINxVPDxFPD,
67 : /**din - vpd - f(t)*/ kDINxVPDxFT,
68 : /**din - vpd - f(din)*/ kDINxVPDxFDIN,
69 : /**din - vpd - f(din - vpd)*/ kDINxVPDxFDINxVPD,
70 : /**f(din) - fpd*/ kFDINxFPD,
71 : /**f(din - vpd) - fpd*/ kFDINxVPDxFPD,
72 : /**f(t) - fpd*/ kFTxFPD,
73 : /**f(t) - f(t)*/ kFTxFT,
74 : /**f(din) - f(din)*/ kFDINxFDIN,
75 : /**f(din - vpd) - f(din - vpd)*/ kFDINxVPDxFDINxVPD,
76 : /**din - fpd*/ kDINxFPD1,
77 : /**din - fpd*/ kDINxFPD2,
78 : /** 16. din-mean*/ kDINxMPD
79 : };
80 :
81 : private:
82 :
83 : AliTPCAltroEmulator(const AliTPCAltroEmulator &sig);
84 : AliTPCAltroEmulator& operator = (const AliTPCAltroEmulator &source);
85 :
86 : Int_t ftimebins; // timebins
87 :
88 : // Short_t *fChannelIn; // ChannelIn
89 : Short_t *fChannelShort; // incoming signal in Short_t format
90 : Short_t *fADCkeep; // ADCkeep
91 :
92 : Int_t fOnBSL1; // Baseline correction and substraction 1 on
93 : Int_t fOnTCF; // Tail Cancelation Filter on
94 : Int_t fOnBSL2; // Baseline correction and substraction 2 (MAF) on
95 : Int_t fOnClip; // Clipping on (to reverse the signal for ZSU if BSL2 is on)
96 : Int_t fOnZSU; // Zero Suppression on
97 :
98 : Int_t fConfiguredAltro; // ConfiguredAltro
99 : Int_t fConfiguredBSL1; // ConfiguredBSL1
100 : Int_t fConfiguredTCF; // ConfiguredTCF
101 : Int_t fConfiguredTCFraw; // ConfiguredTCF for RAW data files
102 : Int_t fConfiguredBSL2; // ConfiguredBSL2
103 : Int_t fConfiguredZSU; // ConfiguredZSU
104 :
105 : Int_t fBSL1mode; // BSL1mode
106 : Int_t fBSL1ValuePeDestal; // BSL1ValuePeDestal
107 : Int_t* fBSL1PedestalMem; // BSL1PedestalMem
108 : Int_t fBSL1polarity; // BSL1polarity
109 :
110 : Float_t fTCFK1; // K1
111 : Float_t fTCFK2; // K2
112 : Float_t fTCFK3; // K3
113 : Float_t fTCFL1; // L1
114 : Float_t fTCFL2; // L2
115 : Float_t fTCFL3; // L3
116 :
117 : Int_t fTCFK1Int; // K1Int
118 : Int_t fTCFK2Int; // K2Int
119 : Int_t fTCFK3Int; // K3Int
120 : Int_t fTCFL1Int; // L1Int
121 : Int_t fTCFL2Int; // L2Int
122 : Int_t fTCFL3Int; // L3Int
123 :
124 : Int_t fTCFK1IntROC[2]; // K1Int (IROC/OROC)
125 : Int_t fTCFK2IntROC[2]; // K2Int (IROC/OROC)
126 : Int_t fTCFK3IntROC[2]; // K3Int (IROC/OROC)
127 : Int_t fTCFL1IntROC[2]; // L1Int (IROC/OROC)
128 : Int_t fTCFL2IntROC[2]; // L2Int (IROC/OROC)
129 : Int_t fTCFL3IntROC[2]; // L3Int (IROC/OROC)
130 :
131 : Int_t fBSL2HighThreshold; // BSL2HighThreshold
132 : Int_t fBSL2LowThreshold; // BSL2LowThreshold
133 : Int_t fBSL2Offset; // BSL2Offset
134 : Int_t fBSL2Presamples; // BSL2Presamples;
135 : Int_t fBSL2Postsamples; // BSL2Postsamples
136 :
137 : Int_t fZSUThreshold; // ZSUThreshold
138 : Int_t fZSUMinSamplesaboveThreshold; // ZSUMinSamplesaboveThreshold
139 : Int_t fZSUPresamples; // ZSUPresamples
140 : Int_t fZSUPostsamples; // ZSUPostsamples
141 :
142 : void BaselineCorrection1(Int_t mode, Int_t FixedPeDestal, Int_t *PedestalMem, Int_t polarity);
143 : void TailCancellationFilterFixedPoint(Int_t K1, Int_t K2, Int_t K3, Int_t L1, Int_t L2, Int_t L3);
144 : void BaselineCorrection2RTL(Int_t HighThreshold, Int_t LowThreshold, Int_t Offset, Int_t Presamples, Int_t Postsamples);
145 : void Clipping();
146 : void Zerosuppression(Int_t Threshold, Int_t MinSamplesaboveThreshold, Int_t Presamples, Int_t Postsamples);
147 : void DataFormater();
148 :
149 : Short_t GetElement(short* Array,Int_t index);
150 : void SetElement(short* Array,Int_t index,Short_t value);
151 :
152 : Int_t InBand(Int_t ADC,Int_t bsl, Int_t LowThreshold, Int_t HighThreshold);
153 : Int_t InRange(Int_t parameter,Int_t Low,Int_t High,const char *Module,const char *ParameterName);
154 : Short_t GetShortChannel(Int_t i);
155 : Short_t GetKeepChannel(Int_t i);
156 : Int_t Multiply36(Int_t P, Int_t N);
157 : long long Mask(long long in, Int_t left, Int_t right);
158 : long long Maskandshift(long long in, Int_t left, Int_t right);
159 :
160 :
161 :
162 : void InitBuffers();
163 : Bool_t AddEvent(Int_t dt,Bool_t isFirst);
164 : Bool_t CreateEvent(Int_t ievent);
165 : Bool_t GDC2DDLs(AliRawVEvent *gdc,Int_t ievent);
166 : Bool_t ConvertRawFilesToDate(Int_t nevents);
167 : Bool_t ConvertDateToRoot();
168 : Bool_t WriteEvent(Int_t ievent);
169 :
170 : AliRawReader *fReader ; // RAW reader
171 : AliTPCRawStreamV3 *fDecoder; // ALTRO decoder
172 :
173 : Int_t fRunNumber; // Run Number
174 :
175 : TString fDDLFolderName; // folder name for ddl files
176 : TString fOutputDateFileName; // filename for date output
177 : TString fOutputRootFileName; // filename for root output
178 :
179 : // Float_t fP[2047] ; // Interaction probabilities for times (T-1023,...T,...T+1023)
180 : Bool_t fIsRandom; // Indicates if fP are treated as probabilities (in terms of Possionian statistics), or fixed numbers
181 : Bool_t *fChannels; //! field of active channels
182 : UInt_t *fCDHs ; //! CDHs
183 : Short_t *fADCs ; //! field of ADC counts
184 : UInt_t *fTrailers; //! RCU trailers
185 : UInt_t *fRawData ; //! Raw Data
186 :
187 :
188 12 : ClassDef(AliTPCAltroEmulator,1);
189 : };
190 : #endif
|