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 // --------------------------------------------------------
20 class AliTRDptrgParam : public TObject {
22 enum AliTRDptrgFEBType_t{ kUndefined = (Int_t)0,
25 enum AliTRDptrgOperatingMode_t{ kHits = (Int_t)0, kDigits = (Int_t)1 };
26 enum AliTRDptrgFEBPosition_t{ kB = (Int_t)0,
29 kUnknown = (Int_t)3 };
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?
34 Bool_t fLUTs[3]; // CB-B look up results contribution to pretrigger decision
35 Bool_t fTLMU[8]; // TLMU output signal contribution to pretrigger decisions
45 for (Int_t i = 0; i < 8; i++) {
50 virtual ~AliTRDptrgParam();
52 static AliTRDptrgParam *Instance(); // Singleton
53 static void Terminate(); // delete Singleton
55 void LoadStandardConfiguration(); // initialize with standard values
56 Bool_t LoadConfigurationFromFile(TString filename); // load file
58 Int_t GenerateLUTs(); // generates all LUTs
60 // --- GETTER FUNCTIONS -----------------------------------------------------
62 const UInt_t* GetTLMUInputMask() const { return this->fTLMUInputMask; };
63 // get TLMU input mask
65 UInt_t** GetTLMUcmatrices() const { return this->fTLMUcmatrices; };
66 // get TLMU coincidence matrices
68 UInt_t** GetTLMUmultiplicity() const { return this->fTLMUmultiplicity; };
69 // get TLMU multiplicity slices
71 Int_t** GetTLMUoutput() const { return this->fTLMUoutput; };
72 // get TLMU output mux configuration
75 UInt_t* GetFEBT0Thresholds(AliTRDptrgFEBPosition_t FEBposition) const;
76 // get T0 FEB Thresholds
78 Int_t* GetFEBT0LUT(AliTRDptrgFEBPosition_t FEBposition, Int_t iLUT);
82 UInt_t* GetFEBV0Thresholds(AliTRDptrgFEBPosition_t FEBposition, Int_t iCard) const;
83 // get V0 FEB Thresholds
85 Int_t* GetFEBV0LUT(AliTRDptrgFEBPosition_t FEBposition, Int_t iCard,
89 Int_t* GetCBLUT(UInt_t CB, Int_t LUTid);
90 // returns the corresponding LUT (control boxes only)
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
97 Int_t CheckVariables() const; // returns -1 if a variable is already deleted
100 UInt_t GetMultiplicity(UInt_t BitVector) const;
101 // returns the multiplicity ('1's)
103 UInt_t GetMultiplicity(Int_t BitVector) const;
104 // returns the multiplicity ('1's)
106 // helper functions for configuration file reading
107 // -----------------------------------------------
108 Bool_t ParseTLMU(TString identifier, TString value);
109 // parses the TLMU configuration parameters
111 Bool_t ParseCBB(TString identifier, TString value);
112 // parses the CBB configuration parameters
114 Bool_t ParseCBAC(TString identifier, TString value);
115 // parses the CB-A and CB-C configuration parameters
117 Bool_t ParseFEB(TString identifier, TString value);
118 // parses the FEB configuration parameters
120 Bool_t ParseMultiplicityCondition(TString condition, UInt_t* threshold,
122 // parses a multiplicity condition "M(#mask#)>#threshold#"
124 UInt_t BinaryTStringToInt(TString number) const;
125 // converts TString containing a binary number to a unsigned integer
127 void SplitUpValues(TString value, TObjArray& arr);
128 // splits a value string which contains multiple values seperated by ' '
131 TString CleanTString(TString string);
132 // removes ' ' and '\t' in a TString
134 void PrepareLine(TString line, TString& identifier, TString& value);
135 // divides identifier and value (seperator is the first ' ' or '\t'
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
143 void MergeResults(TArrayI*& partResult1, TArrayI*& partResult2,
144 TArrayI*& results, TArrayI*& signalsInvolved1,
145 TArrayI*& signalsInvolved2, TArrayI*& signalsInvolved,
147 // merges the results of to logical equation parts
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!
154 void CheckSignalsInvolved(TArrayI*& results, TArrayI*& signalsInvolved,
156 // adds all signal combinations needed to behave correctly in every state of
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)
162 static AliTRDptrgParam *fgInstance; // instance pointer
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
170 UInt_t** fTLMUmultiplicity; // [slice][0 = lower bound, 1 = upper bound]
171 // use a lower bound above 576 to disable
173 Int_t** fTLMUoutput; // [output][0 = cmatrix, 1 = multslice]
174 // output bit assignment, -1 disables
176 // T0 ------------------------------------------------------------------------
177 // [position][channel] 12 channels at A and C side
178 UInt_t** fFEBT0Thresholds; // threshold for analog value discrimination
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]
184 // V0 ------------------------------------------------------------------------
185 // [position][feb][channel] 4x8 channels per side (A and C)
186 UInt_t*** fFEBV0Thresholds; // threshold for analog value discrimation
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]
194 // 0 = B, 1 = A, 2 = C
195 Int_t*** fCBLUTs; // control box look up tables
197 // CB-A ----------------------------------------------------------------------
198 TString fCBALUTequ[2]; // logical equations used for LUT generation for CB-A
200 // CB-C ----------------------------------------------------------------------
201 TString fCBCLUTequ[2]; // logical equations used for LUT generation for CB-C
203 // CBB -----------------------------------------------------------------------
204 TString fCBBLUTequ[3]; // logical equations used for LUT generation for CB-B
206 // CTP -----------------------------------------------------------------------
208 AliTRDptrgPTmasks fPTmasks;
209 // masks usage of internal signals for the pretrigger wake up signal
212 AliTRDptrgParam(); // instance only via Instance()
213 AliTRDptrgParam(const AliTRDptrgParam &rhs); // not implemented
214 AliTRDptrgParam& operator=(const AliTRDptrgParam &rhs); // not implemented
216 ClassDef(AliTRDptrgParam, 1);