]>
Commit | Line | Data |
---|---|---|
f9720615 | 1 | #ifndef ALITRDPTRGPARAM_H |
2 | #define ALITRDPTRGPARAM_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | /* $Id$ */ | |
7 | ||
8 | // -------------------------------------------------------- | |
9 | // | |
10 | // Singleton class to hold the parameters steering the PTRG | |
11 | // | |
12 | // -------------------------------------------------------- | |
c93255fe | 13 | |
14 | class TArrayI; | |
15 | class TObjArray; | |
f9720615 | 16 | #include "TObject.h" |
17 | ||
18 | enum AliTRDptrgFEBType_t{ kUndefined = (Int_t)0, | |
19 | kTZERO = (Int_t)1, | |
20 | kVZERO = (Int_t)2 }; | |
21 | enum AliTRDptrgOperatingMode_t{ kHits = (Int_t)0, kDigits = (Int_t)1 }; | |
22 | enum AliTRDptrgFEBPosition_t{ kB = (Int_t)0, | |
23 | kA = (Int_t)1, | |
24 | kC = (Int_t)2, | |
25 | kUnknown = (Int_t)3 }; | |
26 | ||
27 | ||
28 | class AliTRDptrgParam : public TObject { | |
29 | public: | |
30 | struct AliTRDptrgPTmasks { | |
31 | Bool_t fCBA[2]; // contribute CB-A look up results to pretrigger decision? | |
32 | Bool_t fCBC[2]; // contribute CB-C look up results to pretrigger decision? | |
7788992c | 33 | Bool_t fLUTs[3]; // CB-B look up results contribution to pretrigger decision |
f9720615 | 34 | Bool_t fTLMU[8]; // TLMU output signal contribution to pretrigger decisions |
35 | ||
36 | AliTRDptrgPTmasks() { | |
37 | fCBA[0] = kFALSE; | |
38 | fCBA[1] = kFALSE; | |
39 | fCBC[0] = kFALSE; | |
40 | fCBC[1] = kFALSE; | |
41 | fLUTs[0] = kFALSE; | |
42 | fLUTs[1] = kFALSE; | |
7788992c | 43 | fLUTs[2] = kFALSE; |
f9720615 | 44 | for (Int_t i = 0; i < 8; i++) { |
45 | fTLMU[i] = kFALSE; | |
46 | } | |
47 | } | |
48 | }; | |
49 | virtual ~AliTRDptrgParam(); | |
50 | ||
51 | static AliTRDptrgParam *Instance(); // Singleton | |
52 | static void Terminate(); // delete Singleton | |
53 | ||
54 | void LoadStandardConfiguration(); // initialize with standard values | |
55 | Bool_t LoadConfigurationFromFile(TString filename); // load file | |
56 | ||
57 | Int_t GenerateLUTs(); // generates all LUTs | |
58 | ||
59 | // --- GETTER FUNCTIONS ----------------------------------------------------- | |
60 | // -- TLMU -- | |
61 | const UInt_t* GetTLMUInputMask() const { return this->fTLMUInputMask; }; | |
62 | // get TLMU input mask | |
63 | ||
64 | UInt_t** GetTLMUcmatrices() const { return this->fTLMUcmatrices; }; | |
65 | // get TLMU coincidence matrices | |
66 | ||
67 | UInt_t** GetTLMUmultiplicity() const { return this->fTLMUmultiplicity; }; | |
68 | // get TLMU multiplicity slices | |
69 | ||
70 | Int_t** GetTLMUoutput() const { return this->fTLMUoutput; }; | |
71 | // get TLMU output mux configuration | |
72 | ||
73 | // -- T0 -- | |
74 | UInt_t* GetFEBT0Thresholds(AliTRDptrgFEBPosition_t FEBposition) const; | |
75 | // get T0 FEB Thresholds | |
76 | ||
77 | Int_t* GetFEBT0LUT(AliTRDptrgFEBPosition_t FEBposition, Int_t iLUT); | |
78 | // get T0 FEB LUTs | |
79 | ||
80 | // -- V0 -- | |
81 | UInt_t* GetFEBV0Thresholds(AliTRDptrgFEBPosition_t FEBposition, Int_t iCard) const; | |
82 | // get V0 FEB Thresholds | |
83 | ||
84 | Int_t* GetFEBV0LUT(AliTRDptrgFEBPosition_t FEBposition, Int_t iCard, | |
85 | Int_t iLUT); | |
86 | // get V0 FEB LUTs | |
87 | ||
88 | Int_t* GetCBLUT(UInt_t CB, Int_t LUTid); | |
89 | // returns the corresponding LUT (control boxes only) | |
90 | ||
91 | const AliTRDptrgPTmasks* GetPTmasks() const { return &fPTmasks; }; | |
92 | // returns the list containing the information which CB-B inputs are masked | |
93 | // out or forwarded as pre trigger output to the CTP | |
94 | ||
95 | ||
96 | Int_t CheckVariables() const; // returns -1 if a variable is already deleted | |
97 | ||
98 | protected: | |
99 | UInt_t GetMultiplicity(UInt_t BitVector) const; | |
100 | // returns the multiplicity ('1's) | |
101 | ||
102 | UInt_t GetMultiplicity(Int_t BitVector) const; | |
103 | // returns the multiplicity ('1's) | |
104 | ||
105 | // helper functions for configuration file reading | |
106 | // ----------------------------------------------- | |
107 | Bool_t ParseTLMU(TString identifier, TString value); | |
108 | // parses the TLMU configuration parameters | |
109 | ||
110 | Bool_t ParseCBB(TString identifier, TString value); | |
111 | // parses the CBB configuration parameters | |
112 | ||
113 | Bool_t ParseCBAC(TString identifier, TString value); | |
114 | // parses the CB-A and CB-C configuration parameters | |
115 | ||
116 | Bool_t ParseFEB(TString identifier, TString value); | |
117 | // parses the FEB configuration parameters | |
118 | ||
119 | Bool_t ParseMultiplicityCondition(TString condition, UInt_t* threshold, | |
120 | UInt_t* mask); | |
121 | // parses a multiplicity condition "M(#mask#)>#threshold#" | |
122 | ||
123 | UInt_t BinaryTStringToInt(TString number) const; | |
124 | // converts TString containing a binary number to a unsigned integer | |
125 | ||
126 | void SplitUpValues(TString value, TObjArray& arr); | |
127 | // splits a value string which contains multiple values seperated by ' ' | |
128 | // and '\t' | |
129 | ||
130 | TString CleanTString(TString string); | |
131 | // removes ' ' and '\t' in a TString | |
132 | ||
133 | void PrepareLine(TString line, TString& identifier, TString& value); | |
134 | // divides identifier and value (seperator is the first ' ' or '\t' | |
135 | ||
136 | ||
137 | // (helper) functions for conversion of logical equations into LUTs | |
138 | // ---------------------------------------------------------------- | |
139 | Int_t LookUp(TString* const identifier) const; // translates an identifier used in a | |
140 | // logical equation into an address bit of the corresponding LUT | |
141 | ||
142 | void MergeResults(TArrayI*& partResult1, TArrayI*& partResult2, | |
143 | TArrayI*& results, TArrayI*& signalsInvolved1, | |
144 | TArrayI*& signalsInvolved2, TArrayI*& signalsInvolved, | |
145 | Bool_t useOR); | |
146 | // merges the results of to logical equation parts | |
147 | ||
148 | void ConvertLogicalEqToBitVectors(TString eq, TArrayI*& results, | |
149 | TArrayI*& signalsInvolved); | |
150 | // converts logical equations to bit vectors | |
151 | // neglected input signals are for now assumed to be 0! | |
152 | ||
153 | void CheckSignalsInvolved(TArrayI*& results, TArrayI*& signalsInvolved, | |
154 | Int_t inputWidth); | |
155 | // adds all signal combinations needed to behave correctly in every state of | |
156 | // neglected signals | |
157 | ||
158 | Int_t* GenerateLUTbasedOnEq(TString eq, Int_t inputWidth, Int_t initValue); | |
159 | // generates a lut based on a logical functions (uses the functions above) | |
160 | ||
161 | static AliTRDptrgParam *fgInstance; // instance pointer | |
162 | ||
163 | // TLMU configuration -------------------------------------------------------- | |
164 | UInt_t fTLMUInputMask[18]; // masks TOF-to-TRD bits | |
165 | UInt_t fTLMUInputStretch; // designates how long TLMU input is stretched | |
166 | UInt_t** fTLMUcmatrices; // [matrix][section] unsigned int values | |
167 | // Bits 0..17 identify supermodules, bits equal 1 are checked for coincidence | |
168 | ||
169 | UInt_t** fTLMUmultiplicity; // [slice][0 = lower bound, 1 = upper bound] | |
170 | // use a lower bound above 576 to disable | |
171 | ||
172 | Int_t** fTLMUoutput; // [output][0 = cmatrix, 1 = multslice] | |
173 | // output bit assignment, -1 disables | |
174 | ||
175 | // T0 ------------------------------------------------------------------------ | |
176 | // [position][channel] 12 channels at A and C side | |
177 | UInt_t** fFEBT0Thresholds; // threshold for analog value discrimination | |
f9720615 | 178 | |
179 | // [position][LUT][0 = threshold, 1 = bitmask] 2 LUTs at A and C side | |
180 | UInt_t*** fFEBT0Multiplicities; // multiplicity threshold for T0 | |
181 | Int_t*** fFEBT0LUTs; // look up tables [position][LUT][entry] | |
182 | ||
183 | // V0 ------------------------------------------------------------------------ | |
184 | // [position][feb][channel] 4x8 channels per side (A and C) | |
185 | UInt_t*** fFEBV0Thresholds; // threshold for analog value discrimation | |
f9720615 | 186 | |
187 | // [position][feb][LUT][0 = threshold, 1 = bitmask] 2 LUTs per FEB | |
188 | // (4 per Side) at each side ( A and C) | |
189 | UInt_t**** fFEBV0Multiplicities; // multiplicity threshold for V0 | |
190 | Int_t**** fFEBV0LUTs; // look up tables [position][feb][LUT][entry] | |
191 | ||
192 | // CB-{A/B/C} | |
193 | // 0 = B, 1 = A, 2 = C | |
194 | Int_t*** fCBLUTs; // control box look up tables | |
195 | ||
196 | // CB-A ---------------------------------------------------------------------- | |
7788992c | 197 | TString fCBALUTequ[2]; // logical equations used for LUT generation for CB-A |
f9720615 | 198 | |
199 | // CB-C ---------------------------------------------------------------------- | |
7788992c | 200 | TString fCBCLUTequ[2]; // logical equations used for LUT generation for CB-C |
f9720615 | 201 | |
202 | // CBB ----------------------------------------------------------------------- | |
7788992c | 203 | TString fCBBLUTequ[3]; // logical equations used for LUT generation for CB-B |
f9720615 | 204 | |
205 | // CTP ----------------------------------------------------------------------- | |
206 | // PT mask | |
207 | AliTRDptrgPTmasks fPTmasks; | |
208 | // masks usage of internal signals for the pretrigger wake up signal | |
209 | ||
f9720615 | 210 | private: |
211 | AliTRDptrgParam(); // instance only via Instance() | |
212 | AliTRDptrgParam(const AliTRDptrgParam &rhs); // not implemented | |
213 | AliTRDptrgParam& operator=(const AliTRDptrgParam &rhs); // not implemented | |
214 | ||
215 | ClassDef(AliTRDptrgParam, 1); | |
216 | }; | |
217 | #endif |