88// granted to it by virtue of its status as an Intergovernmental Organization
99// or submit itself to any jurisdiction.
1010
11- #ifndef O2_TRDFEEPARAM_H
12- #define O2_TRDFEEPARAM_H
13-
14- // Forwards to standard header with protection for GPU compilation
15- #include " GPUCommonRtypes.h" // for ClassDef
11+ #ifndef O2_TRD_FEEPARAM_H
12+ #define O2_TRD_FEEPARAM_H
1613
1714namespace o2
1815{
@@ -27,30 +24,30 @@ namespace trd
2724// //
2825// Author: //
2926// Ken Oyama (oyama@physi.uni-heidelberg.de) //
30- // //
31- // many things now configured by AliTRDtrapConfig reflecting //
32- // the real memory structure of the TRAP (Jochen) //
27+ // Merging LTUParam in here for Run3 //
28+ // TrapChip configs remain inside the TrapConfig class reflecting //
29+ // the real memory structure of the TRAP (Jochen and a tiny bit of Sean) //
3330// //
3431// //////////////////////////////////////////////////////////////////////////
3532
36- class TRootIoCtor ;
33+ #include < iosfwd>
34+ #include < array>
3735
3836class TRDCommonParam ;
3937class TRDPadPlane ;
4038class TRDGeometry ;
4139
4240// _____________________________________________________________________________
43- class TRDFeeParam
41+ class FeeParam
4442{
4543
4644 public:
47- TRDFeeParam (TRootIoCtor*);
48- TRDFeeParam (const TRDFeeParam& p);
49- virtual ~TRDFeeParam ();
50- TRDFeeParam& operator =(const TRDFeeParam& p);
51- virtual void Copy (TRDFeeParam& p) const ;
45+ FeeParam (const FeeParam& p);
46+ virtual ~FeeParam ();
47+ FeeParam& operator =(const FeeParam& p);
48+ virtual void Copy (FeeParam& p) const ;
5249
53- static TRDFeeParam * instance (); // Singleton
50+ static FeeParam * instance (); // Singleton
5451 static void terminate ();
5552
5653 // Translation from MCM to Pad and vice versa
@@ -71,7 +68,7 @@ class TRDFeeParam
7168 static Short_t getRobAB (UShort_t robsel, UShort_t linkpair); // Returns the chamber side (A=0, B=0) of a ROB
7269
7370 // geometry
74- static Float_t getSamplingFrequency () { return (Float_t)mgkLHCfrequency / 4000000.0 ; }
71+ static Float_t getSamplingFrequency () { return (Float_t)mgkLHCfrequency / 4000000.0 ; } // TODO put the 40MHz into a static variable somewhere.
7572 static int getNmcmRob () { return mgkNmcmRob; }
7673 static int getNmcmRobInRow () { return mgkNmcmRobInRow; }
7774 static int getNmcmRobInCol () { return mgkNmcmRobInCol; }
@@ -99,9 +96,53 @@ class TRDFeeParam
9996
10097 inline short padMcmLUT (int index) { return mgLUTPadNumbering[index]; }
10198
99+ // configuration settings
100+ // called with special SCSN commands
101+ void setPtMin (int data)
102+ {
103+ mPtMin = float (data) / 1000 .;
104+ mInvPtMin = 1 / mPtMin ;
105+ }
106+ void setMagField (int data) { mMagField = float (data) / 1000 .; }
107+ void setOmegaTau (int data) { mOmegaTau = float (data) / 1 .e6 ; }
108+ void setNtimebins (int data) { mNtimebins = data; }
109+ void setScaleQ0 (int data) { mScaleQ0 = data; }
110+ void setScaleQ1 (int data) { mScaleQ1 = data; }
111+ void setLengthCorrectionEnable (int data) { mPidTracklengthCorr = bool (data); }
112+ void setTiltCorrectionEnable (int data) { mTiltCorr = bool (data); }
113+ void setPIDgainCorrectionEnable (bool data) { mPidGainCorr = data; }
114+
115+ // set values directly
116+ void setRawPtMin (float data) { mPtMin = data; }
117+ void setRawMagField (float data) { mMagField = data; }
118+ void setRawOmegaTau (float data) { mOmegaTau = data; }
119+ void setRawNtimebins (int data) { mNtimebins = data; }
120+ void setRawScaleQ0 (int data) { mScaleQ0 = data; }
121+ void setRawScaleQ1 (int data) { mScaleQ1 = data; }
122+ void setRawLengthCorrectionEnable (bool data) { mPidTracklengthCorr = data; }
123+ void setRawTiltCorrectionEnable (bool data) { mTiltCorr = data; }
124+ void setRawPIDgainCorrectionEnable (bool data) { mPidGainCorr = data; }
125+
126+ // retrieve the calculated information
127+ // which is written to the TRAPs
128+ int getDyCorrection (int det, int rob, int mcm) const ;
129+ void getDyRange (int det, int rob, int mcm, int ch, int & dyMinInt, int & dyMaxInt) const ;
130+ void getCorrectionFactors (int det, int rob, int mcm, int ch,
131+ unsigned int & cor0, unsigned int & cor1, float gain = 1 .) const ;
132+ int getNtimebins () const ;
133+
134+ float getX (int det, int rob, int mcm) const ;
135+ float getLocalY (int det, int rob, int mcm, int ch) const ;
136+ float getLocalZ (int det, int rob, int mcm) const ;
137+
138+ float getDist (int det, int rob, int mcm, int ch) const ;
139+ float getElongation (int det, int rob, int mcm, int ) const ;
140+ float getPhi (int det, int rob, int mcm, int ch) const ;
141+ float getPerp (int det, int rob, int mcm, int ch) const ;
142+
102143 protected:
103- static TRDFeeParam * mgInstance; // Singleton instance
104- static bool mgTerminated; // Defines if this class has already been terminated
144+ static FeeParam * mgInstance; // Singleton instance
145+ static bool mgTerminated; // Defines if this class has already been terminated
105146
106147 TRDCommonParam* mCP = nullptr ; // TRD common parameters class
107148
@@ -132,10 +173,39 @@ class TRDFeeParam
132173 // For raw production
133174 int mRAWversion {3 }; // Raw data production version
134175 static const int mgkMaxRAWversion = 3 ; // Maximum raw version number supported
135- private:
136- TRDFeeParam ();
137176
138- ClassDefNV (TRDFeeParam, 1 ); // The TRD front end electronics parameter
177+ // geometry constants
178+ static std::array<float , 30 > mgZrow; // z-position of pad row edge 6x5
179+ static std::array<float , 6 > mgX; // x-position for all layers
180+ static std::array<float , 6 > mgInvX; // inverse x-position for all layers (to remove divisions)
181+ static std::array<float , 6 > mgTiltingAngle; // tilting angle for every layer
182+ static std::array<float , 6 > mgTiltingAngleTan; // tan of tilting angle for every layer (look up table to avoid tan calculations)
183+ static std::array<float , 6 > mgWidthPad; // pad width for all layers
184+ static std::array<float , 6 > mgInvWidthPad; // inverse pad width for all layers (to remove divisions)
185+ static float mgLengthInnerPadC0; // inner pad length C0 chamber
186+ static float mgLengthOuterPadC0; // outer pad length C0 chamber
187+ static std::array<float , 6 > mgLengthInnerPadC1; // inner pad length C1 chambers
188+ static std::array<float , 6 > mgLengthOuterPadC1; // outer pad length C1 chambers
189+ static float mgScalePad; // scaling factor for pad width
190+ static float mgDriftLength; // length of the parse gaintbl Krypton_2009-01 drift region
191+ static float mgBinDy; // bin in dy (140 um)
192+ static int mgDyMax; // max dy for a tracklet (hard limit)
193+ static int mgDyMin; // min dy for a tracklet (hard limit)
194+
195+ // settings
196+ float mMagField ; // magnetic field
197+ float mOmegaTau ; // omega tau, i.e. tan(Lorentz angle)
198+ float mPtMin ; // min. pt for deflection cut
199+ float mInvPtMin ; // min. pt for deflection cut (Inverted to remove division)
200+ int mNtimebins ; // drift time in units of timebins << 5n
201+ unsigned int mScaleQ0 ; // scale factor for accumulated charge Q0
202+ unsigned int mScaleQ1 ; // scale factor for accumulated charge Q1
203+ bool mPidTracklengthCorr ; // enable tracklet length correction
204+ bool mTiltCorr ; // enable tilt correction
205+ bool mPidGainCorr ; // enable MCM gain correction factor for PID
206+
207+ private:
208+ FeeParam ();
139209};
140210
141211} // namespace trd
0 commit comments