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