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