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[2]; // CB-B look up results contribution to pretrigger decision
31 Bool_t fTLMU[8]; // TLMU output signal contribution to pretrigger decisions
40 for (Int_t i = 0; i < 8; i++) {
45 virtual ~AliTRDptrgParam();
47 static AliTRDptrgParam *Instance(); // Singleton
48 static void Terminate(); // delete Singleton
50 void LoadStandardConfiguration(); // initialize with standard values
51 Bool_t LoadConfigurationFromFile(TString filename); // load file
53 Int_t GenerateLUTs(); // generates all LUTs
55 // --- GETTER FUNCTIONS -----------------------------------------------------
57 const UInt_t* GetTLMUInputMask() const { return this->fTLMUInputMask; };
58 // get TLMU input mask
60 UInt_t** GetTLMUcmatrices() const { return this->fTLMUcmatrices; };
61 // get TLMU coincidence matrices
63 UInt_t** GetTLMUmultiplicity() const { return this->fTLMUmultiplicity; };
64 // get TLMU multiplicity slices
66 Int_t** GetTLMUoutput() const { return this->fTLMUoutput; };
67 // get TLMU output mux configuration
70 UInt_t* GetFEBT0Thresholds(AliTRDptrgFEBPosition_t FEBposition) const;
71 // get T0 FEB Thresholds
73 Int_t* GetFEBT0LUT(AliTRDptrgFEBPosition_t FEBposition, Int_t iLUT);
77 UInt_t* GetFEBV0Thresholds(AliTRDptrgFEBPosition_t FEBposition, Int_t iCard) const;
78 // get V0 FEB Thresholds
80 Int_t* GetFEBV0LUT(AliTRDptrgFEBPosition_t FEBposition, Int_t iCard,
84 Int_t* GetCBLUT(UInt_t CB, Int_t LUTid);
85 // returns the corresponding LUT (control boxes only)
87 const AliTRDptrgPTmasks* GetPTmasks() const { return &fPTmasks; };
88 // returns the list containing the information which CB-B inputs are masked
89 // out or forwarded as pre trigger output to the CTP
92 Int_t CheckVariables() const; // returns -1 if a variable is already deleted
95 UInt_t GetMultiplicity(UInt_t BitVector) const;
96 // returns the multiplicity ('1's)
98 UInt_t GetMultiplicity(Int_t BitVector) const;
99 // returns the multiplicity ('1's)
101 // helper functions for configuration file reading
102 // -----------------------------------------------
103 Bool_t ParseTLMU(TString identifier, TString value);
104 // parses the TLMU configuration parameters
106 Bool_t ParseCBB(TString identifier, TString value);
107 // parses the CBB configuration parameters
109 Bool_t ParseCBAC(TString identifier, TString value);
110 // parses the CB-A and CB-C configuration parameters
112 Bool_t ParseFEB(TString identifier, TString value);
113 // parses the FEB configuration parameters
115 Bool_t ParseMultiplicityCondition(TString condition, UInt_t* threshold,
117 // parses a multiplicity condition "M(#mask#)>#threshold#"
119 UInt_t BinaryTStringToInt(TString number) const;
120 // converts TString containing a binary number to a unsigned integer
122 void SplitUpValues(TString value, TObjArray& arr);
123 // splits a value string which contains multiple values seperated by ' '
126 TString CleanTString(TString string);
127 // removes ' ' and '\t' in a TString
129 void PrepareLine(TString line, TString& identifier, TString& value);
130 // divides identifier and value (seperator is the first ' ' or '\t'
133 // (helper) functions for conversion of logical equations into LUTs
134 // ----------------------------------------------------------------
135 Int_t LookUp(TString* const identifier) const; // translates an identifier used in a
136 // logical equation into an address bit of the corresponding LUT
138 void MergeResults(TArrayI*& partResult1, TArrayI*& partResult2,
139 TArrayI*& results, TArrayI*& signalsInvolved1,
140 TArrayI*& signalsInvolved2, TArrayI*& signalsInvolved,
142 // merges the results of to logical equation parts
144 void ConvertLogicalEqToBitVectors(TString eq, TArrayI*& results,
145 TArrayI*& signalsInvolved);
146 // converts logical equations to bit vectors
147 // neglected input signals are for now assumed to be 0!
149 void CheckSignalsInvolved(TArrayI*& results, TArrayI*& signalsInvolved,
151 // adds all signal combinations needed to behave correctly in every state of
154 Int_t* GenerateLUTbasedOnEq(TString eq, Int_t inputWidth, Int_t initValue);
155 // generates a lut based on a logical functions (uses the functions above)
157 static AliTRDptrgParam *fgInstance; // instance pointer
159 // TLMU configuration --------------------------------------------------------
160 UInt_t fTLMUInputMask[18]; // masks TOF-to-TRD bits
161 UInt_t fTLMUInputStretch; // designates how long TLMU input is stretched
162 UInt_t** fTLMUcmatrices; // [matrix][section] unsigned int values
163 // Bits 0..17 identify supermodules, bits equal 1 are checked for coincidence
165 UInt_t** fTLMUmultiplicity; // [slice][0 = lower bound, 1 = upper bound]
166 // use a lower bound above 576 to disable
168 Int_t** fTLMUoutput; // [output][0 = cmatrix, 1 = multslice]
169 // output bit assignment, -1 disables
171 // T0 ------------------------------------------------------------------------
172 // [position][channel] 12 channels at A and C side
173 UInt_t** fFEBT0Thresholds; // threshold for analog value discrimination
175 // [position][LUT][0 = threshold, 1 = bitmask] 2 LUTs at A and C side
176 UInt_t*** fFEBT0Multiplicities; // multiplicity threshold for T0
177 Int_t*** fFEBT0LUTs; // look up tables [position][LUT][entry]
179 // V0 ------------------------------------------------------------------------
180 // [position][feb][channel] 4x8 channels per side (A and C)
181 UInt_t*** fFEBV0Thresholds; // threshold for analog value discrimation
183 // [position][feb][LUT][0 = threshold, 1 = bitmask] 2 LUTs per FEB
184 // (4 per Side) at each side ( A and C)
185 UInt_t**** fFEBV0Multiplicities; // multiplicity threshold for V0
186 Int_t**** fFEBV0LUTs; // look up tables [position][feb][LUT][entry]
189 // 0 = B, 1 = A, 2 = C
190 Int_t*** fCBLUTs; // control box look up tables
192 // CB-A ----------------------------------------------------------------------
193 TString fCBALUTequX; // logical equation used for generation of LUT X of CB-A
194 TString fCBALUTequY; // logical equation used for generation of LUT Y of CB-A
196 // CB-C ----------------------------------------------------------------------
197 TString fCBCLUTequX; // logical equation used for generation of LUT X of CB-C
198 TString fCBCLUTequY; // logical equation used for generation of LUT Y of CB-C
200 // CBB -----------------------------------------------------------------------
201 TString fCBBLUTequX; // logical equation used for generation of LUT X of CB-B
202 TString fCBBLUTequY; // logical equation used for generation of LUT Y of CB-B
204 // CTP -----------------------------------------------------------------------
206 AliTRDptrgPTmasks fPTmasks;
207 // masks usage of internal signals for the pretrigger wake up signal
210 // CBB-LUT to TriggerInput assignment
212 // class state ---------------------------------------------------------------
215 AliTRDptrgParam(); // instance only via Instance()
216 AliTRDptrgParam(const AliTRDptrgParam &rhs); // not implemented
217 AliTRDptrgParam& operator=(const AliTRDptrgParam &rhs); // not implemented
219 ClassDef(AliTRDptrgParam, 1);