1717
1818#include < Vc/Vc>
1919
20- #include " TPCBase/PadSecPos.h"
20+ #include " TPCBase/PadPos.h"
21+ #include " TPCBase/CalDet.h"
22+ #include " TPCBase/CRU.h"
23+ #include " TPCBase/RandomRing.h"
2124#include " TPCBase/ParameterDetector.h"
2225#include " TPCBase/ParameterElectronics.h"
2326#include " TPCBase/ParameterGas.h"
24- #include " TPCSimulation/Baseline.h"
2527
2628#include " TSpline.h"
2729
@@ -59,11 +61,12 @@ class SAMPAProcessing
5961 // / \return ADC value of the (saturated) SAMPA
6062 float getADCSaturation (const float signal) const ;
6163
62- // / Make the full signal including noise and pedestals from the Baseline class
64+ // / Make the full signal including noise and pedestals from the OCDB
6365 // / \param ADCcounts ADC value of the signal (common mode already subtracted)
64- // / \param padSecPos PadSecPos of the signal
66+ // / \param cru CRU of the signal
67+ // / \param padPos PadPos of the signal
6568 // / \return ADC value after application of noise, pedestal and saturation
66- float makeSignal (float ADCcounts, const PadSecPos& padSecPos, float & pedestal, float & noise) const ;
69+ float makeSignal (float ADCcounts, const CRU& cru, const PadPos& pos, float & pedestal, float & noise);
6770
6871 // / A delta signal is shaped by the FECs and thus spread over several time bins
6972 // / This function returns an array with the signal spread into the following time bins
@@ -106,6 +109,18 @@ class SAMPAProcessing
106109 // / \return Time of the time bin of the charge
107110 float getTimeBinTime (float time) const ;
108111
112+ // / Get the noise for a given channel
113+ // / \param cru CRU of the channel of interest
114+ // / \param padPos PadPos of the channel of interest
115+ // / \return Noise on the channel of interest
116+ float getNoise (const CRU& cru, const PadPos& pos);
117+
118+ // / Get the pedestal for a given channel
119+ // / \param cru CRU of the channel of interest
120+ // / \param padPos PadPos of the channel of interest
121+ // / \return Pedestal on the channel of interest
122+ float getPedestal (const CRU& cru, const PadPos& pos) const ;
123+
109124 private:
110125 SAMPAProcessing ();
111126
@@ -120,6 +135,9 @@ class SAMPAProcessing
120135 const ParameterGas* mGasParam ; // /< Caching of the parameter class to avoid multiple CDB calls
121136 const ParameterDetector* mDetParam ; // /< Caching of the parameter class to avoid multiple CDB calls
122137 const ParameterElectronics* mEleParam ; // /< Caching of the parameter class to avoid multiple CDB calls
138+ const CalPad* mNoiseMap ; // /< Caching of the parameter class to avoid multiple CDB calls
139+ const CalPad* mPedestalMap ; // /< Caching of the parameter class to avoid multiple CDB calls
140+ RandomRing mRandomNoiseRing ; // /< Ring with random number for noise
123141};
124142
125143template <typename T>
@@ -130,14 +148,12 @@ inline T SAMPAProcessing::getADCvalue(T nElectrons) const
130148 return nElectrons * conversion;
131149}
132150
133- inline float SAMPAProcessing::makeSignal (float ADCcounts, const PadSecPos& padSecPos ,
134- float & pedestal, float & noise) const
151+ inline float SAMPAProcessing::makeSignal (float ADCcounts, const CRU& cru, const PadPos& pos ,
152+ float & pedestal, float & noise)
135153{
136- static Baseline baseline;
137154 float signal = ADCcounts;
138- // / \todo Pedestal to be implemented in baseline class
139- // pedestal = baseline.getPedestal(padSecPos);
140- noise = baseline.getNoise (padSecPos);
155+ pedestal = getPedestal (cru, pos);
156+ noise = getNoise (cru, pos);
141157 switch (mEleParam ->getDigitizationMode ()) {
142158 case DigitzationMode::FullMode: {
143159 signal += noise;
@@ -216,6 +232,16 @@ inline float SAMPAProcessing::getTimeBinTime(float time) const
216232 TimeBin timeBin = getTimeBinFromTime (time);
217233 return getTimeFromBin (timeBin);
218234}
235+
236+ inline float SAMPAProcessing::getNoise (const CRU& cru, const PadPos& pos)
237+ {
238+ return mRandomNoiseRing .getNextValue () * mNoiseMap ->getValue (cru, pos.getRow (), pos.getPad ());
239+ }
240+
241+ inline float SAMPAProcessing::getPedestal (const CRU& cru, const PadPos& pos) const
242+ {
243+ return mPedestalMap ->getValue (cru, pos.getRow (), pos.getPad ());
244+ }
219245}
220246}
221247
0 commit comments