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 // --------------------------------------------------------
18 enum AliTRDptrgFEBType_t{ kUndefined = (Int_t)0,
21 enum AliTRDptrgOperatingMode_t{ kHits = (Int_t)0, kDigits = (Int_t)1 };
22 enum AliTRDptrgFEBPosition_t{ kB = (Int_t)0,
25 kUnknown = (Int_t)3 };
28 class AliTRDptrgParam : public TObject {
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?
33 Bool_t fLUTs[3]; // CB-B look up results contribution to pretrigger decision
34 Bool_t fTLMU[8]; // TLMU output signal contribution to pretrigger decisions
44 for (Int_t i = 0; i < 8; i++) {
49 virtual ~AliTRDptrgParam();
51 static AliTRDptrgParam *Instance(); // Singleton
52 static void Terminate(); // delete Singleton
54 void LoadStandardConfiguration(); // initialize with standard values
55 Bool_t LoadConfigurationFromFile(TString filename); // load file
57 Int_t GenerateLUTs(); // generates all LUTs
59 // --- GETTER FUNCTIONS -----------------------------------------------------
61 const UInt_t* GetTLMUInputMask() const { return this->fTLMUInputMask; };
62 // get TLMU input mask
64 UInt_t** GetTLMUcmatrices() const { return this->fTLMUcmatrices; };
65 // get TLMU coincidence matrices
67 UInt_t** GetTLMUmultiplicity() const { return this->fTLMUmultiplicity; };
68 // get TLMU multiplicity slices
70 Int_t** GetTLMUoutput() const { return this->fTLMUoutput; };
71 // get TLMU output mux configuration
74 UInt_t* GetFEBT0Thresholds(AliTRDptrgFEBPosition_t FEBposition) const;
75 // get T0 FEB Thresholds
77 Int_t* GetFEBT0LUT(AliTRDptrgFEBPosition_t FEBposition, Int_t iLUT);
81 UInt_t* GetFEBV0Thresholds(AliTRDptrgFEBPosition_t FEBposition, Int_t iCard) const;
82 // get V0 FEB Thresholds
84 Int_t* GetFEBV0LUT(AliTRDptrgFEBPosition_t FEBposition, Int_t iCard,
88 Int_t* GetCBLUT(UInt_t CB, Int_t LUTid);
89 // returns the corresponding LUT (control boxes only)
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
96 Int_t CheckVariables() const; // returns -1 if a variable is already deleted
99 UInt_t GetMultiplicity(UInt_t BitVector) const;
100 // returns the multiplicity ('1's)
102 UInt_t GetMultiplicity(Int_t BitVector) const;
103 // returns the multiplicity ('1's)
105 // helper functions for configuration file reading
106 // -----------------------------------------------
107 Bool_t ParseTLMU(TString identifier, TString value);
108 // parses the TLMU configuration parameters
110 Bool_t ParseCBB(TString identifier, TString value);
111 // parses the CBB configuration parameters
113 Bool_t ParseCBAC(TString identifier, TString value);
114 // parses the CB-A and CB-C configuration parameters
116 Bool_t ParseFEB(TString identifier, TString value);
117 // parses the FEB configuration parameters
119 Bool_t ParseMultiplicityCondition(TString condition, UInt_t* threshold,
121 // parses a multiplicity condition "M(#mask#)>#threshold#"
123 UInt_t BinaryTStringToInt(TString number) const;
124 // converts TString containing a binary number to a unsigned integer
126 void SplitUpValues(TString value, TObjArray& arr);
127 // splits a value string which contains multiple values seperated by ' '
130 TString CleanTString(TString string);
131 // removes ' ' and '\t' in a TString
133 void PrepareLine(TString line, TString& identifier, TString& value);
134 // divides identifier and value (seperator is the first ' ' or '\t'
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
142 void MergeResults(TArrayI*& partResult1, TArrayI*& partResult2,
143 TArrayI*& results, TArrayI*& signalsInvolved1,
144 TArrayI*& signalsInvolved2, TArrayI*& signalsInvolved,
146 // merges the results of to logical equation parts
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!
153 void CheckSignalsInvolved(TArrayI*& results, TArrayI*& signalsInvolved,
155 // adds all signal combinations needed to behave correctly in every state of
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)
161 static AliTRDptrgParam *fgInstance; // instance pointer
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
169 UInt_t** fTLMUmultiplicity; // [slice][0 = lower bound, 1 = upper bound]
170 // use a lower bound above 576 to disable
172 Int_t** fTLMUoutput; // [output][0 = cmatrix, 1 = multslice]
173 // output bit assignment, -1 disables
175 // T0 ------------------------------------------------------------------------
176 // [position][channel] 12 channels at A and C side
177 UInt_t** fFEBT0Thresholds; // threshold for analog value discrimination
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]
183 // V0 ------------------------------------------------------------------------
184 // [position][feb][channel] 4x8 channels per side (A and C)
185 UInt_t*** fFEBV0Thresholds; // threshold for analog value discrimation
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]
193 // 0 = B, 1 = A, 2 = C
194 Int_t*** fCBLUTs; // control box look up tables
196 // CB-A ----------------------------------------------------------------------
197 TString fCBALUTequ[2]; // logical equations used for LUT generation for CB-A
199 // CB-C ----------------------------------------------------------------------
200 TString fCBCLUTequ[2]; // logical equations used for LUT generation for CB-C
202 // CBB -----------------------------------------------------------------------
203 TString fCBBLUTequ[3]; // logical equations used for LUT generation for CB-B
205 // CTP -----------------------------------------------------------------------
207 AliTRDptrgPTmasks fPTmasks;
208 // masks usage of internal signals for the pretrigger wake up signal
211 AliTRDptrgParam(); // instance only via Instance()
212 AliTRDptrgParam(const AliTRDptrgParam &rhs); // not implemented
213 AliTRDptrgParam& operator=(const AliTRDptrgParam &rhs); // not implemented
215 ClassDef(AliTRDptrgParam, 1);