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 */
8 // --------------------------------------------------------
10 // Singleton class to hold the parameters steering the PTRG
12 // --------------------------------------------------------
15 enum AliTRDptrgFEBType_t{ kUndefined = (Int_t)0,
18 enum AliTRDptrgOperatingMode_t{ kHits = (Int_t)0, kDigits = (Int_t)1 };
19 enum AliTRDptrgFEBPosition_t{ kB = (Int_t)0,
22 kUnknown = (Int_t)3 };
25 class AliTRDptrgParam : public TObject {
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?
30 Bool_t fLUTs[3]; // CB-B look up results contribution to pretrigger decision
31 Bool_t fTLMU[8]; // TLMU output signal contribution to pretrigger decisions
41 for (Int_t i = 0; i < 8; i++) {
46 virtual ~AliTRDptrgParam();
48 static AliTRDptrgParam *Instance(); // Singleton
49 static void Terminate(); // delete Singleton
51 void LoadStandardConfiguration(); // initialize with standard values
52 Bool_t LoadConfigurationFromFile(TString filename); // load file
54 Int_t GenerateLUTs(); // generates all LUTs
56 // --- GETTER FUNCTIONS -----------------------------------------------------
58 const UInt_t* GetTLMUInputMask() const { return this->fTLMUInputMask; };
59 // get TLMU input mask
61 UInt_t** GetTLMUcmatrices() const { return this->fTLMUcmatrices; };
62 // get TLMU coincidence matrices
64 UInt_t** GetTLMUmultiplicity() const { return this->fTLMUmultiplicity; };
65 // get TLMU multiplicity slices
67 Int_t** GetTLMUoutput() const { return this->fTLMUoutput; };
68 // get TLMU output mux configuration
71 UInt_t* GetFEBT0Thresholds(AliTRDptrgFEBPosition_t FEBposition) const;
72 // get T0 FEB Thresholds
74 Int_t* GetFEBT0LUT(AliTRDptrgFEBPosition_t FEBposition, Int_t iLUT);
78 UInt_t* GetFEBV0Thresholds(AliTRDptrgFEBPosition_t FEBposition, Int_t iCard) const;
79 // get V0 FEB Thresholds
81 Int_t* GetFEBV0LUT(AliTRDptrgFEBPosition_t FEBposition, Int_t iCard,
85 Int_t* GetCBLUT(UInt_t CB, Int_t LUTid);
86 // returns the corresponding LUT (control boxes only)
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
93 Int_t CheckVariables() const; // returns -1 if a variable is already deleted
96 UInt_t GetMultiplicity(UInt_t BitVector) const;
97 // returns the multiplicity ('1's)
99 UInt_t GetMultiplicity(Int_t BitVector) const;
100 // returns the multiplicity ('1's)
102 // helper functions for configuration file reading
103 // -----------------------------------------------
104 Bool_t ParseTLMU(TString identifier, TString value);
105 // parses the TLMU configuration parameters
107 Bool_t ParseCBB(TString identifier, TString value);
108 // parses the CBB configuration parameters
110 Bool_t ParseCBAC(TString identifier, TString value);
111 // parses the CB-A and CB-C configuration parameters
113 Bool_t ParseFEB(TString identifier, TString value);
114 // parses the FEB configuration parameters
116 Bool_t ParseMultiplicityCondition(TString condition, UInt_t* threshold,
118 // parses a multiplicity condition "M(#mask#)>#threshold#"
120 UInt_t BinaryTStringToInt(TString number) const;
121 // converts TString containing a binary number to a unsigned integer
123 void SplitUpValues(TString value, TObjArray& arr);
124 // splits a value string which contains multiple values seperated by ' '
127 TString CleanTString(TString string);
128 // removes ' ' and '\t' in a TString
130 void PrepareLine(TString line, TString& identifier, TString& value);
131 // divides identifier and value (seperator is the first ' ' or '\t'
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
139 void MergeResults(TArrayI*& partResult1, TArrayI*& partResult2,
140 TArrayI*& results, TArrayI*& signalsInvolved1,
141 TArrayI*& signalsInvolved2, TArrayI*& signalsInvolved,
143 // merges the results of to logical equation parts
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!
150 void CheckSignalsInvolved(TArrayI*& results, TArrayI*& signalsInvolved,
152 // adds all signal combinations needed to behave correctly in every state of
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)
158 static AliTRDptrgParam *fgInstance; // instance pointer
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
166 UInt_t** fTLMUmultiplicity; // [slice][0 = lower bound, 1 = upper bound]
167 // use a lower bound above 576 to disable
169 Int_t** fTLMUoutput; // [output][0 = cmatrix, 1 = multslice]
170 // output bit assignment, -1 disables
172 // T0 ------------------------------------------------------------------------
173 // [position][channel] 12 channels at A and C side
174 UInt_t** fFEBT0Thresholds; // threshold for analog value discrimination
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]
180 // V0 ------------------------------------------------------------------------
181 // [position][feb][channel] 4x8 channels per side (A and C)
182 UInt_t*** fFEBV0Thresholds; // threshold for analog value discrimation
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]
190 // 0 = B, 1 = A, 2 = C
191 Int_t*** fCBLUTs; // control box look up tables
193 // CB-A ----------------------------------------------------------------------
194 TString fCBALUTequ[2]; // logical equations used for LUT generation for CB-A
196 // CB-C ----------------------------------------------------------------------
197 TString fCBCLUTequ[2]; // logical equations used for LUT generation for CB-C
199 // CBB -----------------------------------------------------------------------
200 TString fCBBLUTequ[3]; // logical equations used for LUT generation for CB-B
202 // CTP -----------------------------------------------------------------------
204 AliTRDptrgPTmasks fPTmasks;
205 // masks usage of internal signals for the pretrigger wake up signal
208 AliTRDptrgParam(); // instance only via Instance()
209 AliTRDptrgParam(const AliTRDptrgParam &rhs); // not implemented
210 AliTRDptrgParam& operator=(const AliTRDptrgParam &rhs); // not implemented
212 ClassDef(AliTRDptrgParam, 1);