]>
Commit | Line | Data |
---|---|---|
eb7e0771 | 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 | ||
b479e253 | 21 | #include "TSystem.h" |
22 | ||
23 | ||
eb7e0771 | 24 | #include <iostream> |
25 | #include <stdlib.h> | |
26 | #include <stdio.h> | |
27 | #include <string.h> | |
28 | ||
29 | using namespace std; | |
30 | ||
b479e253 | 31 | class AliTPCAltroEmulator : public TNamed { |
32 | ||
33 | public: | |
eb7e0771 | 34 | AliTPCAltroEmulator(int timebins, short* Channel); |
35 | AliTPCAltroEmulator(const AliTPCAltroEmulator &sig); | |
36 | ~AliTPCAltroEmulator(); | |
37 | AliTPCAltroEmulator& operator = (const AliTPCAltroEmulator &source); | |
38 | ||
39 | void ConfigAltro(int ONBaselineCorrection1, int ONTailcancellation, int ONBaselineCorrection2, int ONClipping, int ONZerosuppression, int ONDataFormatting); | |
40 | void ConfigBaselineCorrection1(int mode, int ValuePeDestal, int *PedestalMem, int polarity); | |
41 | void ConfigTailCancellationFilter(int K1, int K2, int K3, int L1, int L2, int L3); | |
42 | void ConfigBaselineCorrection2(int HighThreshold, int LowThreshold, int Offset, int Presamples, int Postsamples); | |
43 | void ConfigZerosuppression(int Threshold, int MinSamplesaboveThreshold, int Presamples, int Postsamples); | |
44 | void PrintParameters(); | |
45 | void RunEmulation(); | |
46 | float CalculateCompression(); | |
47 | ||
48 | enum { | |
49 | /**din - fpd*/ kDINxFPD, | |
50 | /**din - f(t)*/ kDINxFT, | |
51 | /**din - f(din)*/ kDINxFDIN, | |
52 | /**din - f(din-vpd)*/ kDINxFDINxVPD, | |
53 | /**din - vpd - fpd*/ kDINxVPDxFPD, | |
54 | /**din - vpd - f(t)*/ kDINxVPDxFT, | |
55 | /**din - vpd - f(din)*/ kDINxVPDxFDIN, | |
56 | /**din - vpd - f(din - vpd)*/ kDINxVPDxFDINxVPD, | |
57 | /**f(din) - fpd*/ kFDINxFPD, | |
58 | /**f(din - vpd) - fpd*/ kFDINxVPDxFPD, | |
59 | /**f(t) - fpd*/ kFTxFPD, | |
60 | /**f(t) - f(t)*/ kFTxFT, | |
61 | /**f(din) - f(din)*/ kFDINxFDIN, | |
62 | /**f(din - vpd) - f(din - vpd)*/ kFDINxVPDxFDINxVPD, | |
63 | /**din - fpd*/ kDINxFPD1, | |
64 | /**din - fpd*/ kDINxFPD2 | |
65 | }; | |
66 | ||
67 | private: | |
68 | int ftimebins; // timebins | |
69 | ||
b479e253 | 70 | // short *fChannelIn; // ChannelIn |
eb7e0771 | 71 | short *fChannelShort; // incoming signal in short format |
72 | short *fADCkeep; // ADCkeep | |
73 | ||
74 | int fOnBSL1; // Baseline correction and substraction 1 on | |
75 | int fOnTCF; // Tail Cancelation Filter on | |
76 | int fOnBSL2; // Baseline correction and substraction 2 (MAF) on | |
77 | int fOnClip; // Clipping on (to reverse the signal for ZSU if BSL2 is on) | |
78 | int fOnZSU; // Zero Suppression on | |
79 | ||
80 | int fConfiguredAltro; // ConfiguredAltro | |
81 | int fConfiguredBSL1; // ConfiguredBSL1 | |
82 | int fConfiguredTCF; // ConfiguredTCF | |
83 | int fConfiguredBSL2; // ConfiguredBSL2 | |
84 | int fConfiguredZSU; // ConfiguredZSU | |
85 | ||
86 | int fBSL1mode; // BSL1mode | |
87 | int fBSL1ValuePeDestal; // BSL1ValuePeDestal | |
88 | int* fBSL1PedestalMem; // BSL1PedestalMem | |
89 | int fBSL1polarity; // BSL1polarity | |
90 | ||
91 | float fTCFK1; // K1 | |
92 | float fTCFK2; // K2 | |
93 | float fTCFK3; // K3 | |
94 | float fTCFL1; // L1 | |
95 | float fTCFL2; // L2 | |
96 | float fTCFL3; // L3 | |
97 | ||
98 | int fTCFK1Int; // K1Int | |
99 | int fTCFK2Int; // K2Int | |
100 | int fTCFK3Int; // K3Int | |
101 | int fTCFL1Int; // L1Int | |
102 | int fTCFL2Int; // L2Int | |
103 | int fTCFL3Int; // L3Int | |
104 | ||
105 | int fBSL2HighThreshold; // BSL2HighThreshold | |
106 | int fBSL2LowThreshold; // BSL2LowThreshold | |
107 | int fBSL2Offset; // BSL2Offset | |
108 | int fBSL2Presamples; // BSL2Presamples; | |
109 | int fBSL2Postsamples; // BSL2Postsamples | |
110 | ||
111 | int fZSUThreshold; // ZSUThreshold | |
112 | int fZSUMinSamplesaboveThreshold; // ZSUMinSamplesaboveThreshold | |
113 | int fZSUPresamples; // ZSUPresamples | |
114 | int fZSUPostsamples; // ZSUPostsamples | |
115 | ||
116 | void BaselineCorrection1(int mode, int FixedPeDestal, int *PedestalMem, int polarity); | |
117 | void TailCancellationFilterFixedPoint(int K1, int K2, int K3, int L1, int L2, int L3); | |
118 | void BaselineCorrection2RTL(int HighThreshold, int LowThreshold, int Offset, int Presamples, int Postsamples); | |
119 | void Clipping(); | |
120 | void Zerosuppression(int Threshold, int MinSamplesaboveThreshold, int Presamples, int Postsamples); | |
121 | void DataFormater(); | |
122 | ||
123 | short GetElement(short* Array,int index); | |
124 | void SetElement(short* Array,int index,short value); | |
125 | ||
126 | int InBand(int ADC,int bsl, int LowThreshold, int HighThreshold); | |
a6e0ebfe | 127 | int InRange(int parameter,int Low,int High,const char *Module,const char *ParameterName); |
eb7e0771 | 128 | short GetShortChannel(int i); |
129 | short GetKeepChannel(int i); | |
130 | int Multiply36(int P, int N); | |
131 | long long Mask(long long in, int left, int right); | |
132 | long long Maskandshift(long long in, int left, int right); | |
9389f9a4 | 133 | ClassDef(AliTPCAltroEmulator,0) |
eb7e0771 | 134 | }; |
135 | #endif |