ATLAS Offline Software
Loading...
Searching...
No Matches
ZDCPulseAnalyzer Class Reference

#include <ZDCPulseAnalyzer.h>

Public Types

enum  {
  PulseBit = 0 , LowGainBit = 1 , FailBit = 2 , HGOverflowBit = 3 ,
  HGUnderflowBit = 4 , PSHGOverUnderflowBit = 5 , LGOverflowBit = 6 , LGUnderflowBit = 7 ,
  PrePulseBit = 8 , PostPulseBit = 9 , FitFailedBit = 10 , BadChisqBit = 11 ,
  BadT0Bit = 12 , ExcludeEarlyLGBit = 13 , ExcludeLateLGBit = 14 , preExpTailBit = 15 ,
  FitMinAmpBit = 16 , RepassPulseBit = 17 , ArmSumIncludeBit = 18 , FailSigCutBit = 19 ,
  UnderFlowExclusionBit = 20 , N_STATUS_BITS
}
enum  LowGainMode { LGModeNormal = 0 , LGModeForceLG , LGModeRefitLG }
enum  TimingCorrMode { NoTimingCorr = 0 , TimingCorrLin , TimingCorrLog }
using JSON = ZDCJSONConfig::JSON

Public Member Functions

 ZDCPulseAnalyzer (ZDCMsg::MessageFunctionPtr msgFunc_p, const std::string &tag, int Nsample, float deltaTSample, size_t preSampleIdx, int pedestal, const std::string &fitFunction, int peak2ndDerivMinSample, float peak2DerivMinThreshHG, float peak2DerivMinThreshLG)
 ZDCPulseAnalyzer (ZDCMsg::MessageFunctionPtr msgFunc_p, const JSON &configJSON)
 ~ZDCPulseAnalyzer ()
void setFitOPtions (const std::string &fitOptions)
void saveFitFunc (bool save)
bool quietFits () const
void setQuietFits ()
void setUnquietFits ()
void enableDelayed (float deltaT, float pedestalShift, bool fixedBaseline=false)
void enableRepass (float peak2ndDerivMinRepassHG, float peak2ndDerivMinRepassLG)
void enableTimeSigCut (bool AND, float sigCut, const std::string &TF1String, const std::vector< double > &parsHG, const std::vector< double > &parsLG)
void enablePreExclusion (unsigned int maxSamplesExcl, unsigned int HGADCThresh, unsigned int LGADCThresh)
void enablePostExclusion (unsigned int maxSamplesExcl, unsigned int HGADCThresh, unsigned int LGADCThresh)
void SetPeak2ndDerivMinTolerance (size_t tolerance)
void setPerSampleNoiseSigmas (const std::vector< float > &sigmaHG, const std::vector< float > &sigmaLG)
void setLGMode (unsigned int mode)
unsigned int getLGMode () const
void set2ndDerivStep (size_t step)
void SetCutValues (float chisqDivAmpCutHG, float chisqDivAmpCutLG, float deltaT0MinHG, float deltaT0MaxHG, float deltaT0MinLG, float deltaT0MaxLG)
void SetTimeCuts (float deltaT0MinHG, float deltaT0MaxHG, float deltaT0MinLG, float deltaT0MaxLG)
void SetChisqCuts (float chisqDivAmpCutHG, float chisqDivAmpScaleHG, float chisqDivAmpOffsetHG, float chisqDivAmpPowerHG, float chisqDivAmpCutLG, float chisqDivAmpScaleLG, float chisqDivAmpOffsetLG, float chisqDivAmpPowerLG)
void SetNoiseSigmas (float noiseSigHG, float noiseSigLG)
void SetGainFactorsHGLG (float gainFactorHG, float gainFactorLG)
void SetFitMinMaxAmp (float minAmpHG, float minAmpLG, float maxAmpHG, float maxAmpLG)
void setMinimumSignificance (float sigMinHG, float sigMinLG)
void SetTauT0Values (bool fixTau1, bool fixTau2, float tau1, float tau2, float t0HG, float t0LG)
void enablePostPulseCheck (unsigned int postPulseSampleDelta, float postPulseDerivMinSig, float postPulseAbsDer2ndMinSig, float minMainDer2ndRatio)
void disablePostPulseCheck ()
void SetADCOverUnderflowValues (int HGOverflowADC, int HGUnderflowADC, int LGOverflowADC)
void SetTimingCorrParams (TimingCorrMode mode, float refADC, float refScale, const std::vector< float > &HGT0CorrParams, const std::vector< float > &LGT0CorrParams)
void SetFitTimeMax (float tmax)
void SetNonlinCorrParams (float refADC, float refScale, const std::vector< float > &paramsHG, const std::vector< float > &paramsLG)
void enableFADCCorrections (bool correctPerSample, std::unique_ptr< const TH1 > &correHistHG, std::unique_ptr< const TH1 > &correHistLG)
void disableFADCCorrections ()
bool LoadAndAnalyzeData (const std::vector< float > &ADCSamplesHG, const std::vector< float > &ADCSamplesLG)
bool LoadAndAnalyzeData (const std::vector< float > &ADCSamplesHG, const std::vector< float > &ADCSamplesLG, const std::vector< float > &ADCSamplesHGDelayed, const std::vector< float > &ADCSamplesLGDelayed)
bool ReanalyzeData ()
bool HaveData () const
bool havePulse () const
bool useLowGain () const
bool failed () const
bool HGOverflow () const
bool HGUnderflow () const
bool PSHGOverUnderflow () const
bool LGOverflow () const
bool LGUnderflow () const
bool prePulse () const
bool postPulse () const
bool fitFailed () const
bool badChisq () const
bool badT0 () const
bool excludeEarlyLG () const
bool excludeLateLG () const
bool preExpTail () const
bool fitMinimumAmplitude () const
bool repassPulse () const
bool armSumInclude () const
bool failSigCut () const
bool underflowExclusion () const
float GetFitAmplitude () const
float GetFitT0 () const
float GetT0Sub () const
float GetT0Corr () const
float getTimeSig () const
float GetChisq () const
float GetChisqRatio () const
float GetFitTau1 () const
float GetFitTau2 () const
float GetFitPreT0 () const
float GetFitPreAmp () const
float GetFitPostT0 () const
float GetFitPostAmp () const
float GetFitExpAmp () const
float GetAmpNoNonLin () const
float GetAmplitude () const
float GetAmpError () const
float GetPreExpAmp () const
const std::vector< float > & GetShapeParameters () const
float getRefitLGAmp () const
float getRefitLGFitAmp () const
float getRefitLGAmpCorr () const
float getRefitLGChisq () const
float getRefitLGChisqRatio () const
float getRefitLGTime () const
float getRefitLGTimeSub () const
float getPresample () const
float getMaxADCHG () const
float getMaxADCLG () const
float getMinADCHG () const
float getMinADCLG () const
float getMaxADCSub () const
float getMinADCSub () const
int getMaxADCSampleHG () const
int getMinADCSampleHG () const
int getMaxADCSampleLG () const
int getMinADCSampleLG () const
float getADCPeakHG () const
float getADCPeakLG () const
float GetMaxDelta () const
float GetMinDelta () const
float GetFitTMax () const
float GetFitTMin () const
float GetdelayBS () const
float GetMinDeriv2nd () const
float GetMinDeriv2ndIndex () const
unsigned int GetStatusMask () const
float GetPreSampleAmp () const
float GetBkgdMaxFraction () const
float GetDelayedBaselineShiftFit () const
float GetDelayedBaselineCorr () const
const TH1 * GetHistogramPtr (bool refitLG=false)
std::shared_ptr< TGraphErrors > GetCombinedGraph (bool forceLG=false)
std::shared_ptr< TGraphErrors > GetGraph (bool forceLG=false)
std::vector< float > GetFitPulls (bool forceLG=false) const
void dump () const
void dumpConfiguration () const
void dumpTF1 (const TF1 *) const
const std::vector< float > & GetSamplesSub () const
const std::vector< float > & GetSamplesDeriv2nd () const

Static Public Attributes

static const ZDCJSONConfig::JSONParamList JSONConfigParams

Private Types

typedef std::vector< float >::const_iterator SampleCIter
using ChisqCutLambdatype = std::function<bool(float,float,float, float&)>

Private Member Functions

void initialize ()
void reset (bool reanalyze=false)
void setDefaults ()
std::pair< bool, std::string > ValidateJSONConfig (const JSON &config)
std::pair< bool, std::string > ConfigFromJSON (const JSON &config)
void SetupFitFunctions ()
bool DoAnalysis (bool repass)
bool ScanAndSubtractSamples ()
bool AnalyzeData (size_t nSamples, size_t preSample, const std::vector< float > &samples, const std::vector< float > &samplesNoise, const std::vector< bool > &useSamples, float peak2ndDerivMinThresh, const std::vector< float > &toCorrParams, ChisqCutLambdatype chisqCutLambda, float minT0Corr, float maxT0Corr)
double getAmplitudeCorrection (bool highGain)
void prepareLGRefit (const std::vector< float > &samplesLG, const std::vector< float > &samplesNoise, const std::vector< bool > &useSamples)
void FillHistogram (bool refitLG)
void checkTF1Limits (TF1 *func)
void DoFit (bool refitLG=false)
void DoFitCombined (bool refitLG=false)
void UpdateFitterTimeLimits (TFitter *fitter, ZDCFitWrapper *wrapper, bool prePulse)

Static Private Member Functions

static std::vector< float > calculate2ndDerivative (const std::vector< float > &inputData, unsigned int step)
static std::pair< std::vector< float >, std::vector< float > > calculate2ndDerivative (const std::vector< float > &inputData, const std::vector< float > &inputNoise, unsigned int step)
static std::vector< float > calculateDerivative (const std::vector< float > &inputData, unsigned int step)
static float obtainDelayedBaselineCorr (const std::vector< float > &samples)
static std::unique_ptr< TFitter > MakeCombinedFitter (TF1 *func)
static void CombinedPulsesFCN (int &numParam, double *, double &f, double *par, int flag)

Private Attributes

ZDCMsg::MessageFunctionPtr m_msgFunc_p {}
std::string m_tag {}
unsigned int m_Nsample {}
unsigned int m_preSampleIdx {}
float m_freqMHz {}
float m_deltaTSample {}
int m_pedestal {}
unsigned int m_LGMode {LGModeNormal}
float m_tmin {}
float m_tmax {}
bool m_quietFits {true}
bool m_saveFitFunc {false}
std::string m_fitFunction
std::string m_fitParameterSetHG
std::string m_fitParameterSetLG
size_t m_2ndDerivStep {1}
size_t m_peak2ndDerivMinSample {}
size_t m_peak2ndDerivMinTolerance {1}
float m_peak2ndDerivMinThreshLG {}
float m_peak2ndDerivMinThreshHG {}
bool m_useDelayed {false}
bool m_enableRepass {false}
float m_peak2ndDerivMinRepassLG {}
float m_peak2ndDerivMinRepassHG {}
float m_gainFactorHG {}
float m_gainFactorLG {}
float m_noiseSigHG {}
float m_noiseSigLG {}
bool m_havePerSampleNoiseHG {false}
bool m_havePerSampleNoiseLG {false}
std::vector< float > m_setPerSampleNoiseHG
std::vector< float > m_setPerSampleNoiseLG
std::string m_fitOptions {}
int m_HGOverflowADC {}
int m_HGUnderflowADC {}
int m_LGOverflowADC {}
float m_nominalT0HG {}
float m_nominalT0LG {}
float m_nominalTau1HG {}
float m_nominalTau2HG {}
float m_nominalTau1LG {}
float m_nominalTau2LG {}
bool m_fixTau1HG {}
bool m_fixTau2HG {}
bool m_fixTau1LG {}
bool m_fixTau2LG {}
float m_inductPeriodHG {0}
float m_inductPeriodLG {0}
float m_inductbIHG {-1}
float m_inductbILG {-1}
float m_defaultFitTMax {}
float m_defaultFitTMin {}
float m_chisqDivAmpCutLG {}
float m_chisqDivAmpCutHG {}
float m_chisqDivAmpScaleLG {}
float m_chisqDivAmpScaleHG {}
float m_chisqDivAmpOffsetLG {}
float m_chisqDivAmpOffsetHG {}
float m_chisqDivAmpPowerLG {}
float m_chisqDivAmpPowerHG {}
float m_T0CutLowLG {}
float m_T0CutHighLG {}
float m_T0CutLowHG {}
float m_T0CutHighHG {}
std::unique_ptr< const TF1 > m_timeResFuncHG_p {}
std::unique_ptr< const TF1 > m_timeResFuncLG_p {}
float m_t0CutSig {}
unsigned int m_timeCutMode {0}
float m_defaultT0Max {}
float m_defaultT0Min {}
float m_fitAmpMinHG {}
float m_fitAmpMinLG {}
float m_fitAmpMaxHG {}
float m_fitAmpMaxLG {}
bool m_haveSignifCuts {false}
float m_sigMinHG {}
float m_sigMinLG {}
bool m_doPrePulseCheck {false}
bool m_doPostPulseCheck {false}
unsigned int m_postPulseDelta {0}
float m_postPulseDerivMinSig {}
float m_postPulseAbsDer2ndMinSig {}
float m_postPulseMainMinDer2ndRatio {}
unsigned int m_prePulseDelta {0}
bool m_enablePreExcl {false}
unsigned int m_maxSamplesPreExcl {0}
unsigned int m_preExclHGADCThresh {0}
unsigned int m_preExclLGADCThresh {0}
bool m_enablePostExcl {false}
unsigned int m_postExclHGADCThresh {0}
unsigned int m_postExclLGADCThresh {0}
unsigned int m_maxSamplesPostExcl {0}
bool m_enableUnderflowExclHG {false}
bool m_enableUnderflowExclLG {false}
unsigned int m_underFlowExclSamplesPreHG {0}
unsigned int m_underFlowExclSamplesPostHG {0}
unsigned int m_underFlowExclSamplesPreLG {0}
unsigned int m_underFlowExclSamplesPostLG {0}
unsigned int m_timingCorrMode {NoTimingCorr}
float m_timingCorrRefADC {500}
float m_timingCorrScale {100}
std::vector< float > m_LGT0CorrParams {}
std::vector< float > m_HGT0CorrParams {}
bool m_haveNonlinCorr {false}
float m_nonLinCorrRefADC {500}
float m_nonLinCorrRefScale {100}
std::vector< float > m_nonLinCorrParamsHG {}
std::vector< float > m_nonLinCorrParamsLG {}
bool m_haveFADCCorrections {false}
std::string m_fadcCorrFileName
bool m_FADCCorrPerSample {false}
std::unique_ptr< const TH1 > m_FADCCorrHG {}
std::unique_ptr< const TH1 > m_FADCCorrLG {}
std::unique_ptr< TH1 > m_fitHist {}
std::unique_ptr< TH1 > m_fitHistLGRefit {}
bool m_initialized {false}
bool m_initializedFits {false}
std::unique_ptr< ZDCFitWrapper > m_defaultFitWrapperHG {}
std::unique_ptr< ZDCFitWrapper > m_defaultFitWrapperLG {}
std::unique_ptr< ZDCPrePulseFitWrapper > m_prePulseFitWrapperHG {}
std::unique_ptr< ZDCPrePulseFitWrapper > m_prePulseFitWrapperLG {}
std::unique_ptr< ZDCPreExpFitWrapper > m_preExpFitWrapperHG {}
std::unique_ptr< ZDCPreExpFitWrapper > m_preExpFitWrapperLG {}
bool m_adjTimeRangeEvent {false}
unsigned int m_minSampleEvt {}
unsigned int m_maxSampleEvt {}
bool m_useFixedBaseline {}
float m_delayedDeltaT {}
float m_delayedPedestalDiff {}
std::unique_ptr< TH1 > m_delayedHist {}
std::unique_ptr< TH1 > m_delayedHistLGRefit {}
std::unique_ptr< TFitter > m_prePulseCombinedFitter {}
std::unique_ptr< TFitter > m_defaultCombinedFitter {}
bool m_haveData {false}
bool m_havePulse {false}
bool m_useLowGain {false}
bool m_fail {false}
bool m_HGOverflow {false}
bool m_HGUnderflow {false}
bool m_PSHGOverUnderflow {false}
bool m_LGOverflow {false}
bool m_LGUnderflow {false}
bool m_prePulse {false}
bool m_postPulse {false}
bool m_fitFailed {false}
bool m_badChisq {false}
bool m_badT0 {false}
bool m_ExcludeEarly {false}
bool m_ExcludeLate {false}
bool m_preExpTail {false}
bool m_fixPrePulse {false}
bool m_fitMinAmp {false}
bool m_repassPulse {false}
bool m_failSigCut {false}
bool m_underflowExclusion {false}
bool m_backToHG_pre {false}
float m_baselineCorr {}
int m_usedPresampIdx {}
float m_preSample {}
float m_minADCHG {}
float m_maxADCHG {}
int m_minADCSampleHG
int m_maxADCSampleHG
float m_maxADCLG {}
float m_minADCLG {}
int m_minADCSampleLG
int m_maxADCSampleLG
float m_ADCPeakHG {}
float m_ADCPeakLG {}
float m_maxDelta {}
float m_minDelta {}
float m_initialExpAmp {}
float m_minDeriv2nd {}
int m_minDeriv2ndIndex {}
float m_fitTMax {}
float m_fitTMin {}
float m_fitPostT0lo {}
float m_minDeriv2ndSig
float m_preExpSig
float m_prePulseSig
float m_initialPrePulseT0 {}
float m_initialPrePulseAmp {}
float m_initialPostPulseT0 {}
float m_fitAmplitude {}
float m_fitAmpError {}
float m_fitTime {}
float m_fitTimeSub {}
float m_fitTimeCorr {}
float m_timeSig {}
float m_fitTCorr2nd {}
float m_fitTau1 {}
float m_fitTau2 {}
float m_fitChisq {}
float m_chisqRatio {}
float m_fitNDoF {}
float m_fitPreT0 {}
float m_fitPreAmp {}
float m_fitPostT0 {}
float m_fitPostAmp {}
float m_fitExpAmp {}
float m_amplitude {}
float m_ampNoNonLin {}
float m_ampError {}
float m_preSampleAmp {}
float m_preAmplitude {}
float m_postAmplitude {}
float m_expAmplitude {}
float m_bkgdMaxFraction {}
float m_delayedBaselineShift {}
std::vector< float > m_shapeParameters
bool m_evtLGRefit {false}
float m_refitLGAmpl {0}
float m_refitLGFitAmpl {0}
float m_refitLGAmplCorr {0}
float m_refitLGAmpError {0}
float m_refitLGChisq {0}
float m_refitLGChisqRatio {0}
float m_refitLGTime {0}
float m_refitLGTimeSub {0}
int m_lastHGOverFlowSample {-1}
int m_firstHGOverFlowSample {-1}
unsigned int m_NSamplesAna {0}
std::vector< float > m_ADCSamplesHG
std::vector< float > m_ADCSamplesLG
std::vector< float > m_ADCSamplesHGSub
std::vector< float > m_ADCSamplesLGSub
std::vector< float > m_sampleNoiseHG
std::vector< float > m_sampleNoiseLG
std::vector< bool > m_useSampleLG
std::vector< bool > m_useSampleHG
std::vector< float > m_ADCSSampNoiseHG
std::vector< float > m_ADCSSampNoiseLG
std::vector< float > m_samplesSub
std::vector< float > m_samplesNoise
std::vector< float > m_samplesLGRefit
std::vector< float > m_samplesNoiseLGRefit
std::vector< float > m_samplesDeriv2nd
std::vector< float > m_samplesDeriv2ndErr
std::vector< float > m_fitPulls

Static Private Attributes

static TH1 * s_undelayedFitHist = nullptr
static TH1 * s_delayedFitHist = nullptr
static TF1 * s_combinedFitFunc = nullptr
static float s_combinedFitTMax = 1000
static float s_combinedFitTMin = -0.5
static std::vector< float > s_pullValues

Detailed Description

Definition at line 23 of file ZDCPulseAnalyzer.h.

Member Typedef Documentation

◆ ChisqCutLambdatype

using ZDCPulseAnalyzer::ChisqCutLambdatype = std::function<bool(float,float,float, float&)>
private

Definition at line 447 of file ZDCPulseAnalyzer.h.

◆ JSON

Definition at line 26 of file ZDCPulseAnalyzer.h.

◆ SampleCIter

typedef std::vector<float>::const_iterator ZDCPulseAnalyzer::SampleCIter
private

Definition at line 74 of file ZDCPulseAnalyzer.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
PulseBit 
LowGainBit 
FailBit 
HGOverflowBit 
HGUnderflowBit 
PSHGOverUnderflowBit 
LGOverflowBit 
LGUnderflowBit 
PrePulseBit 
PostPulseBit 
FitFailedBit 
BadChisqBit 
BadT0Bit 
ExcludeEarlyLGBit 
ExcludeLateLGBit 
preExpTailBit 
FitMinAmpBit 
RepassPulseBit 
ArmSumIncludeBit 
FailSigCutBit 
UnderFlowExclusionBit 
N_STATUS_BITS 

Definition at line 28 of file ZDCPulseAnalyzer.h.

28 {PulseBit = 0, // &1
29 LowGainBit = 1, // &2
30 FailBit = 2, // &4
31 HGOverflowBit = 3, // &8
32 // -------------------------
33 HGUnderflowBit = 4, // &16
34 PSHGOverUnderflowBit = 5, // &32
35 LGOverflowBit = 6, // &64
36 LGUnderflowBit = 7, // &128
37 // -------------------------
38 PrePulseBit = 8, // &256
39 PostPulseBit = 9, // &512
40 FitFailedBit = 10, // &1024
41 BadChisqBit = 11, // &2048
42 // -------------------------
43 BadT0Bit = 12, // &4096
44 ExcludeEarlyLGBit = 13, // &8192
45 ExcludeLateLGBit = 14, // &16384
46 preExpTailBit = 15, // &32768
47 //
48 FitMinAmpBit = 16, // 0x10000
49 RepassPulseBit = 17, // 0x20000
50 ArmSumIncludeBit = 18, // 0x40000
51 FailSigCutBit = 19, // 0x80000
52 UnderFlowExclusionBit = 20, // 0x100000
54 };

◆ LowGainMode

Enumerator
LGModeNormal 
LGModeForceLG 
LGModeRefitLG 

Definition at line 56 of file ZDCPulseAnalyzer.h.

◆ TimingCorrMode

Enumerator
NoTimingCorr 
TimingCorrLin 
TimingCorrLog 

Definition at line 62 of file ZDCPulseAnalyzer.h.

Constructor & Destructor Documentation

◆ ZDCPulseAnalyzer() [1/2]

ZDCPulseAnalyzer::ZDCPulseAnalyzer ( ZDCMsg::MessageFunctionPtr msgFunc_p,
const std::string & tag,
int Nsample,
float deltaTSample,
size_t preSampleIdx,
int pedestal,
const std::string & fitFunction,
int peak2ndDerivMinSample,
float peak2DerivMinThreshHG,
float peak2DerivMinThreshLG )

Definition at line 176 of file ZDCPulseAnalyzer.cxx.

178 :
179 m_msgFunc_p(std::move(msgFunc_p)),
180 m_tag(tag), m_Nsample(Nsample),
181 m_preSampleIdx(preSampleIdx),
182 m_deltaTSample(deltaTSample),
183 m_pedestal(pedestal), m_fitFunction(fitFunction),
184 m_peak2ndDerivMinSample(peak2ndDerivMinSample),
185 m_peak2ndDerivMinThreshLG(std::abs(peak2ndDerivMinThreshLG)),
186 m_peak2ndDerivMinThreshHG(std::abs(peak2ndDerivMinThreshHG))
187{
188 // Create the histogram used for fitting
189 //
190 m_tmin = -deltaTSample / 2;
191 m_tmax = m_tmin + ((float) Nsample) * deltaTSample;
194
195 std::string histName = "ZDCFitHist" + tag;
196 std::string histNameLGRefit = "ZDCFitHist" + tag + "_LGRefit";
197
198 m_fitHist = std::make_unique<TH1F>(histName.c_str(), "", m_Nsample, m_tmin, m_tmax);
199 m_fitHistLGRefit = std::make_unique<TH1F>(histNameLGRefit.c_str(), "", m_Nsample, m_tmin, m_tmax);
200
201 m_fitHist->SetDirectory(0);
202 m_fitHistLGRefit->SetDirectory(0);
203
204 setDefaults();
205 reset();
206}
std::string m_fitFunction
unsigned int m_preSampleIdx
unsigned int m_Nsample
std::unique_ptr< TH1 > m_fitHistLGRefit
std::unique_ptr< TH1 > m_fitHist
ZDCMsg::MessageFunctionPtr m_msgFunc_p
const std::string reset

◆ ZDCPulseAnalyzer() [2/2]

ZDCPulseAnalyzer::ZDCPulseAnalyzer ( ZDCMsg::MessageFunctionPtr msgFunc_p,
const JSON & configJSON )

Definition at line 208 of file ZDCPulseAnalyzer.cxx.

208 :
209 m_msgFunc_p(std::move(msgFunc_p))
210{
211 setDefaults();
212
213 // auto [result, resultString] = ValidateJSONConfig(configJSON);
214 // (*m_msgFunc_p)(ZDCMsg::Debug, "ValidateJSON produced result: " + resultString);
215
216 auto [result2, resultString2] = ConfigFromJSON(configJSON);
217 (*m_msgFunc_p)(ZDCMsg::Debug, "ConfigFromJSON produced result: "+ resultString2);
218
220
221 // Create the histogram used for fitting
222 //
223 if (m_freqMHz >1.e-6) m_deltaTSample = 1000./m_freqMHz;
224 m_tmin = -m_deltaTSample / 2;
227
228 std::string histName = "ZDCFitHist" + m_tag;
229 std::string histNameLGRefit = "ZDCFitHist" + m_tag + "_LGRefit";
230
231 m_fitHist = std::make_unique<TH1F>(histName.c_str(), "", m_Nsample, m_tmin, m_tmax);
232 m_fitHistLGRefit = std::make_unique<TH1F>(histNameLGRefit.c_str(), "", m_Nsample, m_tmin, m_tmax);
233
234 m_fitHist->SetDirectory(0);
235 m_fitHistLGRefit->SetDirectory(0);
236
237 if(m_useDelayed) {
239 }
240
241 reset();
242 ROOT::Math::MinimizerOptions::SetDefaultMaxIterations(2000);
243}
void dumpConfiguration() const
std::pair< bool, std::string > ConfigFromJSON(const JSON &config)
void enableDelayed(float deltaT, float pedestalShift, bool fixedBaseline=false)
@ Debug
Definition ZDCMsg.h:19

◆ ~ZDCPulseAnalyzer()

ZDCPulseAnalyzer::~ZDCPulseAnalyzer ( )
inline

Definition at line 543 of file ZDCPulseAnalyzer.h.

543{}

Member Function Documentation

◆ AnalyzeData()

bool ZDCPulseAnalyzer::AnalyzeData ( size_t nSamples,
size_t preSample,
const std::vector< float > & samples,
const std::vector< float > & samplesNoise,
const std::vector< bool > & useSamples,
float peak2ndDerivMinThresh,
const std::vector< float > & toCorrParams,
ChisqCutLambdatype chisqCutLambda,
float minT0Corr,
float maxT0Corr )
private

Definition at line 1386 of file ZDCPulseAnalyzer.cxx.

1395{
1396
1397 // We keep track of which sample we used to do the subtraction sepaate from m_minSampleEvt
1398 // because the corresponding time is the reference time we provide to the fit function when
1399 // we have pre-pulses and in case we change the m_minSampleEvt after doing the subtraction
1400 //
1401 // e.g. our refit when the chisquare cuts fails
1402 //
1403
1404 // Find the first used sample in the event
1405 //
1406 bool haveFirst = false;
1407 unsigned int lastUsed = 0;
1408
1409 for (unsigned int sample = preSampleIdx; sample < nSamples; sample++) {
1410 if (useSample[sample]) {
1411 //
1412 // We're going to use this sample in the analysis, update bookeeping
1413 //
1414 if (!haveFirst) {
1415 if (sample > m_minSampleEvt) m_minSampleEvt = sample;
1416 haveFirst = true;
1417 }
1418 else {
1419 lastUsed = sample;
1420 }
1421 }
1422 }
1423
1424 if (lastUsed < m_maxSampleEvt) m_maxSampleEvt = lastUsed;
1425
1426 // Check to see whether we've changed the range of samples used in the analysis
1427 //
1428 // Should be obseleted with reworking of the fitting using Root::Fit package
1429 //
1430 if (m_minSampleEvt > preSampleIdx) {
1431 m_ExcludeEarly = true;
1432 m_adjTimeRangeEvent = true;
1433 }
1434
1435 if (m_maxSampleEvt < nSamples - 1) {
1436 m_adjTimeRangeEvent = true;
1437 m_ExcludeLate = true;
1438 }
1439
1440 // Prepare for subtraction
1441 //
1443 m_preSample = samples[m_usedPresampIdx];
1444
1445 std::ostringstream pedMessage;
1446 pedMessage << "Pedestal index = " << m_usedPresampIdx << ", value = " << m_preSample;
1447 (*m_msgFunc_p)(ZDCMsg::Verbose, pedMessage.str().c_str());
1448
1449 m_samplesSub = samples;
1450 m_samplesNoise = samplesNoise;
1451
1452 //
1453 // When we are combinig delayed and undelayed samples we have to deal with the fact that
1454 // the two readouts can have different noise and thus different baselines. Which is a huge
1455 // headache.
1456 //
1457 if (m_useDelayed) {
1458 if (m_useFixedBaseline) {
1460 }
1461 else {
1462 //
1463 // Use much-improved method to match delayed and undelayed baselines
1464 //
1466 std::ostringstream baselineMsg;
1467 baselineMsg << "Delayed samples baseline correction = " << m_baselineCorr << std::endl;
1468 (*m_msgFunc_p)(ZDCMsg::Debug, baselineMsg.str().c_str());
1469 }
1470
1471 // Now apply the baseline correction to align ADC values for delayed and undelayed samples
1472 //
1473 for (size_t isample = 0; isample < nSamples; isample++) {
1474 if (isample % 2) m_samplesSub[isample] -= m_baselineCorr;
1475 }
1476
1477 // If we use one of the delayed samples for presample, we have to adjust the presample value as well
1478 //
1480 }
1481
1482 // Do the presample subtraction
1483 //
1484 std::for_each(m_samplesSub.begin(), m_samplesSub.end(), [psval = m_preSample] (float & adcUnsub) {return adcUnsub -= psval;} );
1485
1486 // Calculate the second derivatives using step size m_2ndDerivStep
1487 //
1489 m_samplesDeriv2nd = deriv2ndResult.first;
1490 m_samplesDeriv2ndErr = deriv2ndResult.second;
1491
1492 // Find the sample which has the lowest 2nd derivative. We loop over the range defined by the
1493 // tolerance on the position of the minimum second derivative. Note: the +1 in the upper iterator is because
1494 // that's where the loop terminates, not the last element.
1495 //
1496 SampleCIter minDeriv2ndIter;
1497
1498 int upperDelta = std::min(m_peak2ndDerivMinSample + m_peak2ndDerivMinTolerance + 1, nSamples);
1499
1500 minDeriv2ndIter = std::min_element(m_samplesDeriv2nd.begin() + m_peak2ndDerivMinSample - m_peak2ndDerivMinTolerance, m_samplesDeriv2nd.begin() + upperDelta);
1501
1502 m_minDeriv2nd = *minDeriv2ndIter;
1503 m_minDeriv2ndIndex = std::distance(m_samplesDeriv2nd.cbegin(), minDeriv2ndIter);
1505
1506 m_havePulse = false;
1507
1508 // If the second derivative is greater than the threshold, we may have a pulse
1509 //
1510 if (std::abs(m_minDeriv2nd) >= peak2ndDerivMinThresh) {
1511 //
1512 // Check that we have found a real maximum
1513 //
1518
1519 if ((deltaLeft2 > 0 || deltaLeft > 0) && (deltaRight2 > 0 || deltaRight > 0)) {
1520 m_havePulse = true;
1521 }
1522 else {
1523 // In the case that a fluctuation made the most negative 2nd derivative not at the real peak
1524 // check the 2nd derivative at the nominal peak position.
1525 //
1526 if (std::abs(m_samplesDeriv2nd[m_peak2ndDerivMinSample]) > peak2ndDerivMinThresh) {
1528
1529 // Now we re-do the check
1530 //
1535
1536 if ((deltaLeft2 > 0 || deltaLeft > 0) && (deltaRight2 > 0 || deltaRight > 0)) {
1537 m_havePulse = true;
1538 }
1539 }
1540 else {
1541 (*m_msgFunc_p)(ZDCMsg::Debug, ("ZDCPulseAnalyzer for " + m_tag + " found a fake maximum at sample " + std::to_string(m_minDeriv2ndIndex) ));
1542 }
1543 }
1544 }
1545
1546 // save the low and high gain ADC values at the peak -- if we have a pulse, at m_minDeriv2ndIndex
1547 // otherwise at m_peak2ndDerivMinSample
1548 //
1549 if (m_havePulse) {
1552 }
1553 else {
1556 }
1557
1558 // Now decide whether we have a preceeding pulse or not. There are two possible kinds of preceeding pulses:
1559 // 1) exponential tail from a preceeding pulse
1560 // 2) peaked pulse before the main pulse
1561 //
1562 // we can, of course, have both
1563 //
1564
1565 // To check for exponential tail, test the slope determined by the minimum ADC value (and pre-sample)
1566 // **beware** this can cause trouble in 2015 data where the pulses had overshoot due to the transformers
1567 //
1568
1569 // Implement a much simpler test for presence of an exponential tail from an OOT pulse
1570 // namely if the slope evaluated at the presample is significantly negative, then
1571 // we have a preceeding pulse.
1572 //
1573 // Note that we don't have to subtract the FADC value corresponding to the presample because
1574 // that subtraction has already been done.
1575 //
1576 if (m_havePulse) {
1577 if (m_doPrePulseCheck) {
1578 // If we've alreday excluded early samples, we have almost by construction have negative exponential tail
1579 //
1580 if (m_ExcludeEarly) m_preExpTail = true;
1581
1582 //
1583 // The subtracted ADC value at m_usedPresampIdx is, by construction, zero
1584 // The next sample has had the pre-sample subtracted, so it represents the initial derivative
1585 //
1586 float derivPresampleErr = std::sqrt(Sqr(m_samplesNoise[m_usedPresampIdx]) + Sqr(m_samplesNoise[m_usedPresampIdx+1]));
1587 float derivPresampleSig = m_samplesSub[m_usedPresampIdx+1]/derivPresampleErr;
1588 if (derivPresampleSig < -5) {
1589 m_preExpTail = true;
1590 m_preExpSig = derivPresampleSig;
1591 }
1592
1593 for (unsigned int isample = m_usedPresampIdx; isample <= m_minDeriv2ndIndex - m_prePulseDelta; isample++) {
1594 if (!useSample[isample]) continue;
1595
1596 float sampleSig = -m_samplesSub[isample]/m_samplesNoise[isample];
1597
1598 // Compare the derivative significant to the 2nd derivative significance,
1599 // so we don't waste time dealing with small perturbations on large signals
1600 //
1601 if ((sampleSig > 5 && sampleSig > 0.02*m_minDeriv2ndSig) || sampleSig > 0.5*m_minDeriv2ndSig) {
1602 m_preExpTail = true;
1603
1604 if (sampleSig > m_preExpSig) m_preExpSig = sampleSig;
1605 }
1606 }
1607
1608 // Now we search for maxima before the main pulse
1609 //
1610 int loopLimit = (m_havePulse ? m_minDeriv2ndIndex - 2 : m_peak2ndDerivMinSample - 2);
1611 int loopStart = m_minSampleEvt == 0 ? 1 : m_minSampleEvt;
1612
1613 float maxPrepulseSig = 0;
1614 unsigned int maxPrepulseSample = 0;
1615
1616 for (int isample = loopStart; isample <= loopLimit; isample++) {
1617 if (!useSample[isample]) continue;
1618
1619 //
1620 // If any of the second derivatives prior to the peak are significantly negative, we have a an extra pulse
1621 // prior to the main one -- as opposed to just an expnential tail
1622 //
1623 double prePulseSig = -m_samplesDeriv2nd[isample]/(1e-6 + m_samplesDeriv2ndErr[isample]);
1624 //
1625 // apply a cut on the significance (as above) but without using division
1626 //
1627 if ((prePulseSig > 6 && m_samplesDeriv2nd[isample] < 0.05 * m_minDeriv2nd) ||
1628 m_samplesDeriv2nd[isample] < 0.5*m_minDeriv2nd)
1629 {
1630 m_prePulse = true;
1631 if (prePulseSig > maxPrepulseSig) {
1632 maxPrepulseSig = prePulseSig;
1633 maxPrepulseSample = isample;
1634 }
1635 }
1636 }
1637
1638 if (m_prePulse) {
1639 m_prePulseSig = maxPrepulseSig;
1640
1641 if (m_preExpTail) {
1642 //
1643 // We have a prepulse. If we already indicated an negative exponential,
1644 // if the prepulse has greater significance, we override the negative exponential
1645 //
1646 if (m_prePulseSig > m_preExpSig) {
1647 m_preExpTail = false;
1648 }
1649 else {
1650 m_prePulse = false;
1651 }
1652 }
1653
1654 m_initialPrePulseAmp = m_samplesSub[maxPrepulseSample];
1655 m_initialPrePulseT0 = m_deltaTSample * (maxPrepulseSample);
1656 }
1657 }
1658
1659 // -----------------------------------------------------
1660 // Post pulse detection
1661 //
1662 if (m_doPostPulseCheck) {
1663 for (int isample = m_minDeriv2ndIndex + m_postPulseDelta; isample < (int) nSamples - 1; isample++) {
1664 if (!useSample[isample] || !useSample[isample +1]) continue;
1665
1666 float deriv = m_samplesSub[isample + 1] - m_samplesSub[isample];
1667 float derivErr = std::sqrt(Sqr(m_samplesNoise[isample + 1]) + Sqr(m_samplesNoise[isample]));
1668
1669 float deriv2nd = m_samplesDeriv2nd[isample];
1670 float deriv2ndErr = m_samplesDeriv2ndErr[isample];
1671
1672 if (deriv > m_postPulseDerivMinSig*derivErr && std::abs(deriv2nd) > m_postPulseAbsDer2ndMinSig*deriv2ndErr) {
1673 m_postPulse = true;
1674
1675 // The place to apply the cut on samples depends on whether we have found a "minimum" or a "maximum"
1676 // The -m_2ndDerivStep for the minimum accounts for the shift between 2nd derivative and the samples
1677 // if we find a maximum we cut one sample lower
1678 //
1679 unsigned int delta = deriv2nd < 0 ? m_2ndDerivStep : m_2ndDerivStep - 1;
1680 m_maxSampleEvt = std::min<int>(isample - delta, m_maxSampleEvt);
1681
1682 std::ostringstream msg;
1683 msg << "ZDCPulseAnalyzer for " << m_tag << " Found a post pulse at sample " << isample
1684 << " deriv = " << deriv << ", derivErr = " << derivErr
1685 << " deriv2nd = " << deriv2nd << ", deriv2ndErr = " << deriv2nd;
1686 (*m_msgFunc_p)(ZDCMsg::Debug, msg.str());
1687 m_adjTimeRangeEvent = true;
1688
1689 break;
1690 }
1691 }
1692 }
1693 }
1694
1695
1696 // -----------------------------------------------------
1697
1698 // Stop now if we have no pulse or we've detected a failure
1699 //
1700 if (m_fail || !m_havePulse) return false;
1701
1702 if (!m_useDelayed) DoFit();
1703 else DoFitCombined();
1704
1705 if (fitFailed()) {
1706 m_fail = true;
1707 }
1708 else {
1709 std::ostringstream ostrm;
1710 // ostrm << "Pulse fit successful with chisquare = " << m_fitChisq;
1711 // (*m_msgFunc_p)(ZDCMsg::Debug, ostrm.str());
1712
1714
1716 //
1717 // We correct relative to the m_timingCorrRefADC using m_timingCorrScale to scale
1718 //
1719 double t0CorrFact = (m_fitAmplitude - m_timingCorrRefADC) / m_timingCorrScale;
1720 if (m_timingCorrMode == TimingCorrLog) t0CorrFact = std::log(t0CorrFact);
1721
1722 // Calculate the correction using a polynomial of power determined by the size of the vector.
1723 // For historical reasons we include here a constant term, though it is degenerate with
1724 // the nominal t0 and/or timing calibrations.
1725 //
1726 float correction = 0;
1727
1728 for (unsigned int ipow = 0; ipow < t0CorrParams.size(); ipow++) {
1729 correction += t0CorrParams[ipow]*std::pow(t0CorrFact, double(ipow));
1730 }
1731
1732 // The correction represents the offset of the timing value from zero so we subtract the result
1733 //
1735 }
1736
1737 bool failFixedCut = m_fitTimeCorr < minT0Corr || m_fitTimeCorr > maxT0Corr;
1738
1739 // Calculate the timing significance. Note this implementation breaks the model for
1740 // how DoAnalysis is currently used by explicitly testing m_useLowGain, but that model
1741 // needs adjustment anyway ... (one step at a time)
1742 //
1743 // Note that to avoid coupling non-linear corrections to the amplitude and the
1744 // timing significance we evaluate the time resolution using the fit amplitude
1745 //
1746 if (m_timeCutMode != 0) {
1747 double timeResolution = 0;
1748 if (m_useLowGain) timeResolution = m_timeResFuncLG_p->Eval(m_fitAmplitude);
1749 else timeResolution = m_timeResFuncHG_p->Eval(m_fitAmplitude);
1750
1751 m_timeSig = m_fitTimeCorr/timeResolution;
1752 if (std::abs(m_timeSig) > m_t0CutSig) {
1753 //
1754 // We've failed the significance cut. In OR mode (1) we mark the time
1755 // as bad if we've lso failed the fixed cut. In AND mode, we mark it
1756 // as bad regardless of the fixed cut.
1757 //
1758 if (m_timeCutMode == 1) {
1759 if (failFixedCut) m_badT0 = true;
1760 }
1761 else m_badT0 = true;
1762 }
1763 else if (m_timeCutMode == 2 && failFixedCut) m_badT0 = failFixedCut;
1764 }
1765 else {
1766 m_timeSig = -1;
1767 m_badT0 = failFixedCut;
1768 }
1769
1770 // Now check for valid chisq using lambda function
1771 //
1772 // if (m_fitChisq/m_fitNDoF > 2 && m_fitChisq / (m_fitAmplitude + 1.0e-6) > maxChisqDivAmp) m_badChisq = true;
1773 if (!chisqCutLambda(m_fitChisq, m_fitAmplitude, m_fitNDoF, m_chisqRatio)) m_badChisq = true; }
1774
1775 return !m_fitFailed;
1776}
T Sqr(T in)
std::unique_ptr< const TF1 > m_timeResFuncHG_p
unsigned int m_timeCutMode
size_t m_peak2ndDerivMinTolerance
std::unique_ptr< const TF1 > m_timeResFuncLG_p
static std::vector< float > calculate2ndDerivative(const std::vector< float > &inputData, unsigned int step)
std::vector< float > m_samplesNoise
unsigned int m_prePulseDelta
unsigned int m_timingCorrMode
unsigned int m_maxSampleEvt
bool fitFailed() const
std::vector< float > m_ADCSamplesLG
static float obtainDelayedBaselineCorr(const std::vector< float > &samples)
void DoFit(bool refitLG=false)
std::vector< float > m_samplesSub
unsigned int m_postPulseDelta
std::vector< float > m_ADCSamplesHG
unsigned int m_minSampleEvt
std::vector< float > m_samplesDeriv2ndErr
std::vector< float >::const_iterator SampleCIter
std::vector< float > m_samplesDeriv2nd
void DoFitCombined(bool refitLG=false)
@ Verbose
Definition ZDCMsg.h:18
correction(mu, runmode, campaign, run=None)
Definition zlumi_mc_cf.py:4
MsgStream & msg
Definition testRead.cxx:32

◆ armSumInclude()

bool ZDCPulseAnalyzer::armSumInclude ( ) const
inline

Definition at line 697 of file ZDCPulseAnalyzer.h.

697{return havePulse() && !(failed() || fitFailed() || badChisq() || badT0() || fitMinimumAmplitude() || LGOverflow() || LGUnderflow() || failSigCut());}
bool LGOverflow() const
bool fitMinimumAmplitude() const
bool havePulse() const
bool failSigCut() const
bool badChisq() const
bool LGUnderflow() const

◆ badChisq()

bool ZDCPulseAnalyzer::badChisq ( ) const
inline

Definition at line 689 of file ZDCPulseAnalyzer.h.

689{return m_badChisq;}

◆ badT0()

bool ZDCPulseAnalyzer::badT0 ( ) const
inline

Definition at line 691 of file ZDCPulseAnalyzer.h.

691{return m_badT0;}

◆ calculate2ndDerivative() [1/2]

std::pair< std::vector< float >, std::vector< float > > ZDCPulseAnalyzer::calculate2ndDerivative ( const std::vector< float > & inputData,
const std::vector< float > & inputNoise,
unsigned int step )
staticprivate

Definition at line 2658 of file ZDCPulseAnalyzer.cxx.

2659{
2660 unsigned int nSamples = inputData.size();
2661
2662 // We start with two zero entries for which we can't calculate the double-step derivative
2663 // and would pad with two zero entries at the end. Start by initializing
2664 //
2665 unsigned int vecSize = 2*step + nSamples - step - 1;
2666 std::vector<float> results(vecSize, 0);
2667 std::vector<float> resultsErr(vecSize, 0);
2668
2669 unsigned int fillIndex = step;
2670 for (unsigned int sample = step; sample < nSamples - step; sample++) {
2671 float deriv2nd = inputData[sample + step] + inputData[sample - step] - 2*inputData[sample];
2672 float deriv2ndErr = std::sqrt(Sqr(inputNoise[sample + step]) + Sqr(inputNoise[sample - step]) + 2*Sqr(inputNoise[sample]));
2673
2674 results[fillIndex] = deriv2nd;
2675 resultsErr[fillIndex++] = deriv2ndErr;
2676 }
2677
2678 return {results, resultsErr};
2679}

◆ calculate2ndDerivative() [2/2]

std::vector< float > ZDCPulseAnalyzer::calculate2ndDerivative ( const std::vector< float > & inputData,
unsigned int step )
staticprivate

Definition at line 2638 of file ZDCPulseAnalyzer.cxx.

2639{
2640 unsigned int nSamples = inputData.size();
2641
2642 // We start with two zero entries for which we can't calculate the double-step derivative
2643 // and would pad with two zero entries at the end. Start by initializing
2644 //
2645 unsigned int vecSize = 2*step + nSamples - step - 1;
2646 std::vector<float> results(vecSize, 0);
2647
2648 unsigned int fillIndex = step;
2649 for (unsigned int sample = step; sample < nSamples - step; sample++) {
2650 auto deriv2nd = inputData[sample + step] + inputData[sample - step] - 2*inputData[sample];
2651 results.at(fillIndex++) = deriv2nd;
2652 }
2653
2654 return results;
2655}

◆ calculateDerivative()

std::vector< float > ZDCPulseAnalyzer::calculateDerivative ( const std::vector< float > & inputData,
unsigned int step )
staticprivate

Definition at line 2617 of file ZDCPulseAnalyzer.cxx.

2618{
2619 unsigned int nSamples = inputData.size();
2620
2621 // So we pad at the beginning and end based on step (i.e. with step - 1 zeros). Fill out the fill vector with zeros initially
2622 //
2623 unsigned int vecSize = 2*(step - 1) + nSamples - step - 1;
2624 std::vector<float> results(vecSize, 0);
2625
2626 // Now fill out the values
2627 //
2628 unsigned int fillIdx = step - 1;
2629
2630 for (unsigned int sample = 0; sample < nSamples - step; sample++) {
2631 int deriv = inputData[sample + step] - inputData[sample];
2632 results.at(fillIdx++) = deriv;
2633 }
2634
2635 return results;
2636}

◆ checkTF1Limits()

void ZDCPulseAnalyzer::checkTF1Limits ( TF1 * func)
private

Definition at line 2280 of file ZDCPulseAnalyzer.cxx.

2281{
2282 for (int ipar = 0; ipar < func->GetNpar(); ipar++) {
2283 double parLimitLow, parLimitHigh;
2284
2285 func->GetParLimits(ipar, parLimitLow, parLimitHigh);
2286
2287 (*m_msgFunc_p)(ZDCMsg::Debug, (
2288 "ZDCPulseAnalyzer name=" + std::string(func->GetName())
2289 + " ipar=" + std::to_string(ipar)
2290 + " parLimitLow=" + std::to_string(parLimitLow)
2291 + " parLimitHigh="+ std::to_string(parLimitHigh)
2292 )
2293 );
2294
2295 if (std::abs(parLimitHigh - parLimitLow) > (1e-6)*std::abs(parLimitLow)) {
2296 double value = func->GetParameter(ipar);
2297 if (value >= parLimitHigh) {
2298 value = parLimitHigh * 0.9;
2299 }
2300 else if (value <= parLimitLow) {
2301 value = parLimitLow + 0.1*std::abs(parLimitLow);
2302 }
2303 func->SetParameter(ipar, value);
2304 }
2305 }
2306}

◆ CombinedPulsesFCN()

void ZDCPulseAnalyzer::CombinedPulsesFCN ( int & numParam,
double * ,
double & f,
double * par,
int flag )
staticprivate

Definition at line 122 of file ZDCPulseAnalyzer.cxx.

123{
124 // The first parameter is a correction factor to account for decrease in beam intensity between x
125 // and y scan. It is applied here and not passed to the actual fit function
126 //
127 int nSamples = s_undelayedFitHist->GetNbinsX();
128
129 if (flag == 3) {
130 s_pullValues.assign(nSamples * 2, 0);
131 }
132
133 double chiSquare = 0;
134
135 float delayBaselineAdjust = par[0];
136
137 // undelayed
138 //
139 for (int isample = 0; isample < nSamples; isample++) {
140 double histValue = s_undelayedFitHist->GetBinContent(isample + 1);
141 double histError = std::max(s_undelayedFitHist->GetBinError(isample + 1), 1.0);
142 double t = s_undelayedFitHist->GetBinCenter(isample + 1);
143
144 if (t > s_combinedFitTMax) break;
145 if (t < s_combinedFitTMin) continue;
146
147 double funcVal = s_combinedFitFunc->EvalPar(&t, &par[1]);
148
149 double pull = (histValue - funcVal) / histError;
150
151 if (flag == 3) s_pullValues[2 * isample] = pull;
152 chiSquare += pull * pull;
153 }
154
155 // delayed
156 //
157 for (int isample = 0; isample < nSamples; isample++) {
158 double histValue = s_delayedFitHist->GetBinContent(isample + 1);
159 double histError = std::max(s_delayedFitHist->GetBinError(isample + 1), 1.0);
160 double t = s_delayedFitHist->GetBinCenter(isample + 1);
161
162 if (t > s_combinedFitTMax) break;
163 if (t < s_combinedFitTMin) continue;
164
165 double funcVal = s_combinedFitFunc->EvalPar(&t, &par[1]) + delayBaselineAdjust;
166 double pull = (histValue - funcVal) / histError;
167
168 if (flag == 3) s_pullValues[2 * isample + 1] = pull;
169 chiSquare += pull * pull;
170 }
171
172 f = chiSquare;
173}
static TF1 * s_combinedFitFunc
static std::vector< float > s_pullValues
static TH1 * s_undelayedFitHist
static float s_combinedFitTMin
static float s_combinedFitTMax
static TH1 * s_delayedFitHist

◆ ConfigFromJSON()

std::pair< bool, std::string > ZDCPulseAnalyzer::ConfigFromJSON ( const JSON & config)
private

Definition at line 2810 of file ZDCPulseAnalyzer.cxx.

2811{
2812 bool result = true;
2813 std::string resultString = "success";
2814
2815 for (auto [key, value] : config.items()) {
2816 //
2817 // Big if statement to process configuration parameters
2818 //
2819 if (key == "Nsample") m_Nsample = value;
2820 else if (key == "tag") m_tag = value;
2821 else if (key == "LGMode") m_LGMode = value;
2822 else if (key == "Nsample") m_Nsample = value;
2823 else if (key == "useDelayed") m_useDelayed = value;
2824 else if (key == "preSampleIdx") m_preSampleIdx = value;
2825 else if (key == "FADCFreqMHz") m_freqMHz = value;
2826 else if (key == "nominalPedestal") m_pedestal = value;
2827 else if (key == "fitFunction") m_fitFunction = value;
2828 else if (key == "fitParameterSet") {
2831 }
2832 else if (key == "fitParameterSetHG") {
2834 }
2835 else if (key == "fitParameterSetLG") {
2837 }
2838 else if (key == "peakSample") m_peak2ndDerivMinSample = value;
2839 else if (key == "peakTolerance") m_peak2ndDerivMinTolerance = value;
2840 else if (key == "2ndDerivThreshHG") m_peak2ndDerivMinThreshHG = value;
2841 else if (key == "2ndDerivThreshLG") m_peak2ndDerivMinThreshLG = value;
2842 else if (key == "2ndDerivStep") m_2ndDerivStep = value;
2843 else if (key == "HGOverflowADC") m_HGOverflowADC = value;
2844 else if (key == "HGUnderflowADC") m_HGUnderflowADC = value;
2845 else if (key == "LGOverflowADC") m_LGOverflowADC = value;
2846 else if (key == "nominalT0HG") m_nominalT0HG = value;
2847 else if (key == "nominalT0LG") m_nominalT0LG = value;
2848 else if (key == "nominalTau1") {
2851 }
2852 else if (key == "nominalTau2") {
2855 }
2856 else if (key == "fixTau1") {
2859 }
2860 else if (key == "fixTau2") {
2863 }
2864 else if (key == "nominalTau1HG") m_nominalTau1HG = value;
2865 else if (key == "nominalTau2HG") m_nominalTau2HG = value;
2866 else if (key == "nominalTau1LG") m_nominalTau1LG = value;
2867 else if (key == "nominalTau2LG") m_nominalTau2LG = value;
2868 else if (key == "fixTau1HG") m_fixTau1HG = value;
2869 else if (key == "fixTau2HG") m_fixTau2HG = value;
2870 else if (key == "fixTau1LG") m_fixTau1LG = value;
2871 else if (key == "fixTau2LG") m_fixTau2LG = value;
2872 else if (key == "T0CutsHG") {
2873 m_T0CutLowHG = value[0];
2874 m_T0CutHighHG = value[1];
2875 }
2876 else if (key == "T0CutsLG") {
2877 m_T0CutLowLG = value[0];
2878 m_T0CutHighLG = value[1];
2879 m_initializedFits = false;
2880 }
2881 else if (key == "InductbIHG") m_inductbIHG = value;
2882 else if (key == "InductbILG") m_inductbILG = value;
2883 else if (key == "InductPeriodHG") m_inductPeriodHG = value;
2884 else if (key == "InductPeriodLG") m_inductPeriodLG = value;
2885 else if (key == "chisqDivAmpCutHG") m_chisqDivAmpCutHG = value;
2886 else if (key == "chisqDivAmpCutLG") m_chisqDivAmpCutLG = value;
2887 else if (key == "chisqDivAmpOffsetHG") m_chisqDivAmpOffsetHG = value;
2888 else if (key == "chisqDivAmpScaleLG") m_chisqDivAmpScaleLG = value;
2889 else if (key == "chisqDivAmpScaleHG") m_chisqDivAmpScaleHG = value;
2890 else if (key == "chisqDivAmpOffsetLG") m_chisqDivAmpOffsetLG = value;
2891 else if (key == "chisqDivAmpPowerHG") m_chisqDivAmpPowerHG = value;
2892 else if (key == "chisqDivAmpPowerLG") m_chisqDivAmpPowerLG = value;
2893 else if (key == "gainFactorHG") m_gainFactorHG = value;
2894 else if (key == "gainFactorLG") m_gainFactorLG = value;
2895 else if (key == "noiseSigmaHG") m_noiseSigHG = value;
2896 else if (key == "noiseSigmaLG") m_noiseSigLG = value;
2897 else if (key == "perSampleNoiseSigmaHG") {
2900 }
2901 else if (key == "perSampleNoiseSigmaLG") {
2904 // m_setPerSampleNoiseLG.clear();
2905
2906 // for (auto elem : value) {
2907 // m_setPerSampleNoiseLG.push_back(elem);
2908 // }
2909 }
2910 else if (key == "fitTimeMax") {
2911 SetFitTimeMax(static_cast<float>(value));
2912 }
2913 else if (key == "enableRepass") m_enableRepass = value;
2914 else if (key == "Repass2ndDerivThreshHG") m_peak2ndDerivMinRepassHG = value;
2915 else if (key == "Repass2ndDerivThreshLG") m_peak2ndDerivMinRepassLG = value;
2916 else if (key == "fitAmpMinMaxHG") {
2917 m_fitAmpMinHG = value[0];
2918 m_fitAmpMaxHG = value[1];
2919 }
2920 else if (key == "fitAmpMinMaxLG") {
2921 m_fitAmpMinLG = value[0];
2922 m_fitAmpMaxLG = value[1];
2923 }
2924 else if (key == "quietFits") {
2926 }
2927 else if (key == "enablePreExclusion") {
2928 m_enablePreExcl = true;
2932 }
2933 else if (key == "enablePostExclusion") {
2934 m_enablePostExcl = true;
2938 }
2939 else if (key == "enableUnderflowExclusionHG") {
2943 }
2944 else if (key == "enableUnderflowExclusionLG") {
2948 }
2949 else if (key == "enablePrePulseDetection") {
2951 }
2952 else if (key == "enablePostPulseDetection") {
2954 }
2955 else if (key == "ampMinSignifHGLG") {
2956 m_haveSignifCuts = true;
2957 m_sigMinHG = value[0];
2958 m_sigMinLG = value[1];
2959 }
2960 else if (key == "enableFADCCorrections") {
2961 auto fileNameJson = value["filename"];
2962 auto doPerSampleCorrJson = value["doPerSampleCorr"];
2963
2964 if (fileNameJson.is_null() || doPerSampleCorrJson.is_null()) {
2965 result = false;
2966 resultString = "failure processing enableFADCCorrections object";
2967 break;
2968 }
2969
2970 m_haveFADCCorrections = true;
2971 m_FADCCorrPerSample = doPerSampleCorrJson;
2972 m_fadcCorrFileName = fileNameJson;
2973 }
2974 else if(key =="useDelayed"){
2975 if(value){
2976 m_useDelayed = true;
2977 }
2978 }
2979 else if (key == "delayDeltaT") m_delayedDeltaT = value;
2980 else if (key == "delayDefaultPedestalShift") m_delayedPedestalDiff = value;
2981 else if (key == "enableTimingCorrection") {
2985 }
2986 else if(key == "timeCorrCoeffHG"){
2987 for(int i = 0;auto coeff:value){
2988 m_HGT0CorrParams.at(i) = coeff;
2989 i++;
2990 }
2991 }
2992 else if(key == "timeCorrCoeffLG"){
2993 for(int i = 0;auto coeff:value){
2994 m_LGT0CorrParams.at(i) = coeff;
2995 i++;
2996 }
2997 }
2998 else if(key == "enableNLCorrection"){
2999 m_haveNonlinCorr = true;
3002 (*m_msgFunc_p)(
3003 ZDCMsg::Debug, ("Setting non-linear parameters"
3004 ", reference ADC = " + std::to_string(m_nonLinCorrRefADC) +
3005 ", reference scale = " + std::to_string(m_nonLinCorrRefScale)));
3006 }
3007 else if(key == "HGNLCorrCoeffs"){
3008 std::string HGParamsStr = "HG coefficients = ";
3009 for (auto coeff : value) {
3010 m_nonLinCorrParamsHG.push_back(coeff);
3011 HGParamsStr += std::to_string(m_nonLinCorrParamsHG.back()) + " ";
3012 }
3013 (*m_msgFunc_p)(ZDCMsg::Debug, std::move(HGParamsStr));
3014 }
3015 else if(key == "LGNLCorrCoeffs"){
3016 std::string LGParamsStr = "LG coefficients = ";
3017 for(auto coeff:value){
3018 m_nonLinCorrParamsLG.push_back(coeff);
3019 LGParamsStr += std::to_string(m_nonLinCorrParamsLG.back()) + " ";
3020 }
3021 (*m_msgFunc_p)(ZDCMsg::Debug, std::move(LGParamsStr));
3022 }
3023 else {
3024 result = false;
3025 resultString = "unprocessed parameter";
3026 break;
3027 }
3028 }
3029
3030 return {result, resultString};
3031}
std::vector< float > m_setPerSampleNoiseHG
std::vector< float > m_nonLinCorrParamsLG
std::vector< float > m_LGT0CorrParams
unsigned int m_preExclLGADCThresh
unsigned int m_postExclLGADCThresh
unsigned int m_maxSamplesPreExcl
std::vector< float > m_setPerSampleNoiseLG
unsigned int m_underFlowExclSamplesPreLG
std::vector< float > m_nonLinCorrParamsHG
unsigned int m_underFlowExclSamplesPostHG
unsigned int m_maxSamplesPostExcl
unsigned int m_underFlowExclSamplesPreHG
void SetFitTimeMax(float tmax)
unsigned int m_underFlowExclSamplesPostLG
std::vector< float > m_HGT0CorrParams
unsigned int m_preExclHGADCThresh
std::string m_fitParameterSetHG
unsigned int m_postExclHGADCThresh
std::string m_fadcCorrFileName
std::string m_fitParameterSetLG
unsigned int m_LGMode

◆ disableFADCCorrections()

void ZDCPulseAnalyzer::disableFADCCorrections ( )
inline

Definition at line 662 of file ZDCPulseAnalyzer.h.

662{m_haveFADCCorrections = false;}

◆ disablePostPulseCheck()

void ZDCPulseAnalyzer::disablePostPulseCheck ( )
inline

Definition at line 619 of file ZDCPulseAnalyzer.h.

619{m_doPostPulseCheck = false;}

◆ DoAnalysis()

bool ZDCPulseAnalyzer::DoAnalysis ( bool repass)
private

Definition at line 1255 of file ZDCPulseAnalyzer.cxx.

1256{
1257 float deriv2ndThreshHG = 0;
1258 float deriv2ndThreshLG = 0;
1259
1260 if (!repass) {
1262
1263 deriv2ndThreshHG = m_peak2ndDerivMinThreshHG;
1264 deriv2ndThreshLG = m_peak2ndDerivMinThreshLG;
1265 }
1266 else {
1267 deriv2ndThreshHG = m_peak2ndDerivMinRepassHG;
1268 deriv2ndThreshLG = m_peak2ndDerivMinRepassLG;
1269 }
1270
1272 if (m_useLowGain) {
1273 // (*m_msgFunc_p)(ZDCMsg::Verbose, "ZDCPulseAnalyzer:: " + m_tag + " using low gain data ");
1274
1275 auto chisqCutLambda = [cut = m_chisqDivAmpCutLG,
1278 power = m_chisqDivAmpPowerLG]
1279 (float chisq, float amp, unsigned int fitNDoF, float& ratio)->bool
1280 {
1281 // Avoid a spurious FPE from clang.
1283 if (amp < 1e-6) return true;
1284 ratio = chisq /(offset + scale* (std::pow(amp/1000, power)));
1285 if (chisq/fitNDoF > 2 && ratio > cut) return false;
1286 else return true;
1287 };
1288
1290 deriv2ndThreshLG, m_LGT0CorrParams, chisqCutLambda, m_T0CutLowLG, m_T0CutHighLG);
1291 if (result) {
1292 //
1293 // +++BAC
1294 //
1295 // I have removed some code that attempted a refit in case of failure of the chi-square cut
1296 // Instead, we should implement an analysis of the failure with possible re-fit afterwards
1297 // with possible change of the pre- or post-pulse condition
1298 //
1299 // --BAC
1300 //
1301
1302 double amplCorrFactor = getAmplitudeCorrection(false);
1303
1304 //
1305 // Multiply amplitude by gain factor
1306 //
1308 m_amplitude = m_fitAmplitude * amplCorrFactor * m_gainFactorLG;
1309 m_ampError = m_fitAmpError * amplCorrFactor * m_gainFactorLG;
1314
1315 // BAC: also scale up the 2nd derivative by the gain factor so low and high gain can be treated on the same footing
1316 //
1318 }
1319
1320 return result;
1321 }
1322 else {
1323 // (*m_msgFunc_p)(ZDCMsg::Verbose, "ZDCPulseAnalyzer:: " + m_tag + " using high gain data ");
1324 auto chisqCutLambda = [cut = m_chisqDivAmpCutHG,
1327 power = m_chisqDivAmpPowerHG, tag = m_tag]
1328 (float chisq, float amp, unsigned int fitNDoF, float& ratio)->bool
1329 {
1330 // Avoid a spurious FPE from clang.
1332 if (amp < 1e-6) return true;
1333 ratio = chisq /(offset + scale*(std::pow(amp/1000, power)));
1334 if (chisq/float(fitNDoF) > 2 && ratio > cut) return false;
1335 else return true;
1336 };
1337
1339 deriv2ndThreshHG, m_HGT0CorrParams, chisqCutLambda, m_T0CutLowHG, m_T0CutHighHG);
1340 if (result) {
1341 // +++BAC
1342 //
1343 // I have removed some code that attempted a refit in case of failure of the chi-square cut
1344 // Instead, we should implement an analysis of the failure with possible re-fit afterwards
1345 // with possible change of the pre- or post-pulse condition
1346 //
1347 // --BAC
1348
1356
1358
1359 // If we have a non-linear correction, apply it here
1360 //
1361 // We apply it as an inverse correction - i.e. we divide by a correction
1362 // term tha is a sum of coefficients times the ADC minus a reference
1363 // to a power. The lowest power is 1, the highest is deteremined by
1364 // the number of provided coefficients
1365 //
1366 double amplCorrFactor = getAmplitudeCorrection(true);
1367
1368 m_amplitude *= amplCorrFactor;
1369 m_ampError *= amplCorrFactor;
1370 }
1371
1372 // If LG refit has been requested, do it now
1373 //
1376 DoFit(true);
1377
1378 double amplCorrFactor = getAmplitudeCorrection(false);
1379 m_refitLGAmplCorr = m_refitLGAmpl*amplCorrFactor;
1380 }
1381
1382 return result;
1383 }
1384}
std::vector< bool > m_useSampleHG
unsigned int m_NSamplesAna
std::vector< float > m_sampleNoiseLG
std::vector< float > m_ADCSamplesHGSub
void prepareLGRefit(const std::vector< float > &samplesLG, const std::vector< float > &samplesNoise, const std::vector< bool > &useSamples)
double getAmplitudeCorrection(bool highGain)
std::vector< float > m_ADCSamplesLGSub
std::vector< bool > m_useSampleLG
bool AnalyzeData(size_t nSamples, size_t preSample, const std::vector< float > &samples, const std::vector< float > &samplesNoise, const std::vector< bool > &useSamples, float peak2ndDerivMinThresh, const std::vector< float > &toCorrParams, ChisqCutLambdatype chisqCutLambda, float minT0Corr, float maxT0Corr)
std::vector< float > m_sampleNoiseHG
#define CXXUTILS_TRAPPING_FP
Definition trapping_fp.h:24

◆ DoFit()

void ZDCPulseAnalyzer::DoFit ( bool refitLG = false)
private

Definition at line 1801 of file ZDCPulseAnalyzer.cxx.

1802{
1803 bool fitLG = m_useLowGain || refitLG;
1804
1805 TH1* hist_p = nullptr;
1806 FillHistogram(refitLG);
1807
1808 // Set the initial values
1809 //
1810 float ampInitial, fitAmpMin, fitAmpMax, t0Initial;
1811
1812 if (fitLG) {
1813 fitAmpMin = m_fitAmpMinLG;
1814 fitAmpMax = m_fitAmpMaxLG;
1815 t0Initial = m_nominalT0LG;
1816 ampInitial = m_ADCPeakLG;
1817 }
1818 else {
1819 ampInitial = m_ADCPeakHG;
1820 fitAmpMin = m_fitAmpMinHG;
1821 fitAmpMax = m_fitAmpMaxHG;
1822 t0Initial = m_nominalT0HG;
1823 }
1824
1825 if (refitLG) {
1826 hist_p = m_fitHistLGRefit.get();
1827 }
1828 else {
1829 hist_p = m_fitHist.get();
1830 }
1831 if (ampInitial < fitAmpMin) ampInitial = fitAmpMin * 1.5;
1832
1833
1834 ZDCFitWrapper* fitWrapper = nullptr;
1835 if (preExpTail()) {
1836 auto preExpfitWrapper = static_cast<ZDCPreExpFitWrapper*>(fitLG ? m_preExpFitWrapperLG.get() : m_preExpFitWrapperHG.get());
1837 preExpfitWrapper->SetInitialExpPulse(m_initialExpAmp);
1838 fitWrapper = preExpfitWrapper;
1839 }
1840 else if (prePulse()) {
1841 auto preFitWrapper = static_cast<ZDCPrePulseFitWrapper*>(fitLG ? m_prePulseFitWrapperLG.get() : m_prePulseFitWrapperHG.get());
1842 preFitWrapper->SetInitialPrePulse(m_initialPrePulseAmp, m_initialPrePulseT0,0,25);
1843 fitWrapper = preFitWrapper;
1844 }
1845 else {
1846 fitWrapper = fitLG ? m_defaultFitWrapperLG.get() : m_defaultFitWrapperHG.get();
1847 }
1848
1849 if (m_adjTimeRangeEvent) {
1852
1853 float fitTReference = m_deltaTSample * m_usedPresampIdx;
1854
1855 fitWrapper->Initialize(ampInitial, t0Initial, fitAmpMin, fitAmpMax, m_fitTMin, m_fitTMax, fitTReference);
1856 }
1857 else {
1858 fitWrapper->Initialize(ampInitial, t0Initial, fitAmpMin, fitAmpMax);
1859 }
1860
1861 // Now perform the fit
1862 //
1863 std::string options = m_fitOptions + "Ns";
1864 if (m_quietFits) {
1865 options += "Q";
1866 }
1867
1868 bool fitFailed = false;
1869
1870 // dumpTF1(fitWrapper->GetWrapperTF1RawPtr());
1871 checkTF1Limits(fitWrapper->GetWrapperTF1RawPtr());
1872
1873 //
1874 // Fit the data with the function provided by the fit wrapper
1875 //
1876 TFitResultPtr result_ptr = hist_p->Fit(fitWrapper->GetWrapperTF1RawPtr(), options.c_str(), "", m_fitTMin, m_fitTMax);
1877 int fitStatus = result_ptr;
1878
1879 //
1880 // If the first fit failed, also check the EDM. If sufficiently small, the failure is almost surely due
1881 // to parameter limits and we just accept the result
1882 //
1883 if (fitStatus != 0 && result_ptr->Edm() > 0.01)
1884 {
1885 //
1886 // We contstrain the fit and try again
1887 //
1888 fitWrapper->ConstrainFit();
1889
1890 TFitResultPtr constrFitResult_ptr = hist_p->Fit(fitWrapper->GetWrapperTF1RawPtr(), options.c_str(), "", m_fitTMin, m_fitTMax);
1891 fitWrapper->UnconstrainFit();
1892
1893 if ((int) constrFitResult_ptr != 0 && constrFitResult_ptr->Edm() > 0.1) {
1894 //
1895 // Even the constrained fit failed. Check the edm
1896 //
1897 }
1898 else {
1899 // Now we try the fit again with the constraint removed
1900 //
1901 TFitResultPtr unconstrFitResult_ptr = hist_p->Fit(fitWrapper->GetWrapperTF1RawPtr(), options.c_str(), "", m_fitTMin, m_fitTMax);
1902 if ((int) unconstrFitResult_ptr != 0) {
1903 //
1904 // The unconstrained fit failed again, so we redo the constrained fit
1905 //
1906 fitWrapper->ConstrainFit();
1907
1908 TFitResultPtr constrFit2Result_ptr = hist_p->Fit(fitWrapper->GetWrapperTF1RawPtr(), options.c_str(), "", m_fitTMin, m_fitTMax);
1909 if ((int) constrFit2Result_ptr != 0) {
1910 //
1911 // Even the constrained fit failed the second time, so we quit.
1912 //
1913 fitFailed = true;
1914 }
1915
1916 result_ptr = constrFit2Result_ptr;
1917 fitWrapper->UnconstrainFit();
1918 }
1919 else {
1920 result_ptr = unconstrFitResult_ptr;
1921 }
1922 }
1923 }
1924
1925 // At this point we're don varying function parameters
1926 //
1927 fitWrapper->Finalize();
1928
1929 if (!m_fitFailed && m_saveFitFunc) {
1930 hist_p->GetListOfFunctions()->Clear();
1931
1932 TF1* func = fitWrapper->GetWrapperTF1RawPtr();
1933 std::string name = func->GetName();
1934
1935 TF1* copyFunc = static_cast<TF1*>(func->Clone((name + "_copy").c_str()));
1936 hist_p->GetListOfFunctions()->Add(copyFunc);
1937 }
1938
1939 if (!refitLG) {
1941 m_bkgdMaxFraction = fitWrapper->GetBkgdMaxFraction();
1942 m_fitAmplitude = fitWrapper->GetAmplitude();
1943 m_fitAmpError = fitWrapper->GetAmpError();
1944
1945 if (preExpTail()) {
1946 const ZDCPreExpFitWrapper* preExpWrapper = static_cast<ZDCPreExpFitWrapper*>(fitLG ? m_preExpFitWrapperLG.get() : m_preExpFitWrapperHG.get());
1947 m_fitExpAmp = preExpWrapper->GetExpAmp();
1948 }
1949 else {
1950 m_fitExpAmp = 0;
1951 }
1952
1953 m_fitTime = fitWrapper->GetTime();
1954 m_fitTimeSub = m_fitTime - t0Initial;
1955
1956 m_fitChisq = result_ptr->Chi2();
1957 m_fitNDoF = result_ptr->Ndf();
1958
1959 m_fitTau1 = fitWrapper->GetTau1();
1960 m_fitTau2 = fitWrapper->GetTau2();
1961
1962 // Here we need to check if the fit amplitude is small (close) enough to fitAmpMin.
1963 // with "< 1+epsilon" where epsilon ~ 1%
1964 if (m_fitAmplitude < fitAmpMin * 1.01) {
1965 m_fitMinAmp = true;
1966 }
1967
1968 if (m_haveSignifCuts) {
1969 float sigMinCut = fitLG ? m_sigMinLG : m_sigMinHG;
1970
1971 if (m_fitAmpError > 1e-6) {
1972 if (m_fitAmplitude/m_fitAmpError < sigMinCut) m_failSigCut = true;
1973 }
1974 }
1975
1976 if (!m_fitFailed) {
1977 unsigned int numPars = fitWrapper->GetNumShapeParameters();
1978 m_shapeParameters.assign(numPars, 0);
1979
1980 for (size_t ipar = 0; ipar < numPars; ipar++) {
1981 m_shapeParameters[ipar] = fitWrapper->GetShapeParameter(ipar);
1982 }
1983 }
1984 }
1985 else {
1986 m_evtLGRefit = true;
1987 m_refitLGFitAmpl = fitWrapper->GetAmplitude();
1988 m_refitLGAmpl = fitWrapper->GetAmplitude() * m_gainFactorLG;
1990 m_refitLGChisq = result_ptr->Chi2();
1991 m_refitLGTime = fitWrapper->GetTime();
1992 m_refitLGTimeSub = m_refitLGTime - t0Initial;
1993 }
1994}
virtual float GetTau1() const =0
void Initialize(float initialAmp, float initialT0, float ampMin, float ampMax)
virtual float GetBkgdMaxFraction() const =0
virtual TF1 * GetWrapperTF1RawPtr() const
virtual float GetAmpError() const =0
virtual float GetTime() const =0
virtual float GetShapeParameter(size_t index) const =0
virtual float GetTau2() const =0
virtual void Finalize()
virtual float GetAmplitude() const =0
virtual unsigned int GetNumShapeParameters() const =0
virtual float GetExpAmp() const =0
std::unique_ptr< ZDCFitWrapper > m_defaultFitWrapperLG
bool prePulse() const
std::unique_ptr< ZDCFitWrapper > m_defaultFitWrapperHG
std::vector< float > m_shapeParameters
std::string m_fitOptions
std::unique_ptr< ZDCPreExpFitWrapper > m_preExpFitWrapperHG
std::unique_ptr< ZDCPreExpFitWrapper > m_preExpFitWrapperLG
std::unique_ptr< ZDCPrePulseFitWrapper > m_prePulseFitWrapperLG
void checkTF1Limits(TF1 *func)
bool preExpTail() const
std::unique_ptr< ZDCPrePulseFitWrapper > m_prePulseFitWrapperHG
void FillHistogram(bool refitLG)

◆ DoFitCombined()

void ZDCPulseAnalyzer::DoFitCombined ( bool refitLG = false)
private

Definition at line 1996 of file ZDCPulseAnalyzer.cxx.

1997{
1998 bool fitLG = refitLG || m_useLowGain;
1999 TH1* hist_p = nullptr, *delayedHist_p = nullptr;
2000
2001 FillHistogram(refitLG);
2002 if (refitLG) {
2003 hist_p = m_fitHistLGRefit.get();
2004 delayedHist_p = m_delayedHistLGRefit.get();
2005 }
2006 else {
2007 hist_p = m_fitHist.get();
2008 delayedHist_p = m_delayedHist.get();
2009 }
2010
2011 float fitAmpMin, fitAmpMax, t0Initial, ampInitial;
2012 if (fitLG) {
2013 ampInitial = m_ADCPeakLG;
2014 fitAmpMin = m_fitAmpMinLG;
2015 fitAmpMax = m_fitAmpMaxLG;
2016 t0Initial = m_nominalT0LG;
2017 }
2018 else {
2019 ampInitial = m_ADCPeakHG;
2020 fitAmpMin = m_fitAmpMinHG;
2021 fitAmpMax = m_fitAmpMaxHG;
2022 t0Initial = m_nominalT0HG;
2023 }
2024
2025 // Set the initial values
2026 //
2027 if (ampInitial < fitAmpMin) ampInitial = fitAmpMin * 1.5;
2028
2029 ZDCFitWrapper* fitWrapper = fitLG ? m_defaultFitWrapperLG.get() : m_defaultFitWrapperHG.get();
2030
2031 if (preExpTail()) {
2032 fitWrapper = fitLG ? m_preExpFitWrapperLG.get() : m_preExpFitWrapperHG.get();;
2033 (static_cast<ZDCPreExpFitWrapper*>(fitWrapper))->SetInitialExpPulse(m_initialExpAmp);
2034 }
2035 else if (prePulse()) {
2036 fitWrapper = fitLG ? m_prePulseFitWrapperLG.get() : m_prePulseFitWrapperHG.get();
2037 (static_cast<ZDCPrePulseFitWrapper*>(fitWrapper))->SetInitialPrePulse(m_initialPrePulseAmp, m_initialPrePulseT0,0,25);
2038 }
2039
2040 // Initialize the fit wrapper for this event, specifying a
2041 // per-event fit range if necessary
2042 //
2043 if (m_adjTimeRangeEvent) {
2046
2047 float fitTReference = m_deltaTSample * m_usedPresampIdx;
2048
2049 fitWrapper->Initialize(ampInitial, t0Initial, fitAmpMin, fitAmpMax, m_fitTMin, m_fitTMax, fitTReference);
2050 }
2051 else {
2052 fitWrapper->Initialize(ampInitial, t0Initial, fitAmpMin, fitAmpMax);
2053 }
2054
2055 // Set up the virtual fitter
2056 //
2057 TFitter* theFitter = nullptr;
2058
2059 if (prePulse()) {
2061
2062 theFitter = m_prePulseCombinedFitter.get();
2063 }
2064 else {
2066
2067 theFitter = m_defaultCombinedFitter.get();
2068 }
2069
2070 // dumpTF1(fitWrapper->GetWrapperTF1RawPtr());
2071
2072 // Set the static pointers to histograms and function for use in FCN
2073 //
2074 s_undelayedFitHist = hist_p;
2075 s_delayedFitHist = delayedHist_p;
2076 s_combinedFitFunc = fitWrapper->GetWrapperTF1RawPtr();
2079
2080
2081 size_t numFitPar = theFitter->GetNumberTotalParameters();
2082
2083 theFitter->GetMinuit()->fISW[4] = -1;
2084
2085 // Now perform the fit
2086 //
2087 if (m_quietFits) {
2088 theFitter->GetMinuit()->fISW[4] = -1;
2089
2090 int ierr= 0;
2091 theFitter->GetMinuit()->mnexcm("SET NOWarnings",nullptr,0,ierr);
2092 }
2093 else theFitter->GetMinuit()->fISW[4] = 0;
2094
2095 // Only include baseline shift in fit for pre-pulses. Otherwise baseline matching should work
2096 //
2097 if (prePulse()) {
2098 theFitter->SetParameter(0, "delayBaselineAdjust", 0, 0.01, -100, 100);
2099 theFitter->ReleaseParameter(0);
2100 }
2101 else {
2102 theFitter->SetParameter(0, "delayBaselineAdjust", 0, 0.01, -100, 100);
2103 theFitter->FixParameter(0);
2104 }
2105
2106
2107 double arglist[100];
2108 arglist[0] = 5000; // number of function calls
2109 arglist[1] = 0.01; // tolerance
2110 int status = theFitter->ExecuteCommand("MIGRAD", arglist, 2);
2111
2112 double fitAmp = theFitter->GetParameter(1);
2113
2114 // Capture the chi-square etc.
2115 //
2116 double chi2, edm, errdef;
2117 int nvpar, nparx;
2118
2119 theFitter->GetStats(chi2, edm, errdef, nvpar, nparx);
2120
2121 // Here we need to check if fitAmp is small (close) enough to fitAmpMin.
2122 // with "< 1+epsilon" where epsilon ~ 1%
2123 //
2124 if (status || fitAmp < fitAmpMin * 1.01 || edm > 0.01){
2125
2126 //
2127 // We first retry the fit with no baseline adjust
2128 //
2129 theFitter->SetParameter(0, "delayBaselineAdjust", 0, 0.01, -100, 100);
2130 theFitter->FixParameter(0);
2131
2132 // Here we need to check if fitAmp is small (close) enough to fitAmpMin.
2133 // with "< 1+epsilon" where epsilon ~ 1%
2134 if (fitAmp < fitAmpMin * 1.01) {
2135 if (m_adjTimeRangeEvent) {
2136 float fitTReference = m_deltaTSample * m_usedPresampIdx;
2137 fitWrapper->Initialize(ampInitial, t0Initial, fitAmpMin, fitAmpMax, m_fitTMin, m_fitTMax, fitTReference);
2138 }
2139 else {
2140 fitWrapper->Initialize(ampInitial, t0Initial, fitAmpMin, fitAmpMax);
2141 }
2142 }
2143
2144 status = theFitter->ExecuteCommand("MIGRAD", arglist, 2);
2145 if (status != 0) {
2146 //
2147 // Fit failed event with no baseline adust, so be it
2148 //
2149 theFitter->ReleaseParameter(0);
2150 m_fitFailed = true;
2151 }
2152 else {
2153 //
2154 // The fit succeeded with no baseline adjust, re-fit allowing for baseline adjust using
2155 // the parameters from previous fit as the starting point
2156 //
2157 theFitter->ReleaseParameter(0);
2158 status = theFitter->ExecuteCommand("MIGRAD", arglist, 2);
2159
2160 if (status) {
2161 // Since we know the fit can succeed without the baseline adjust, go back to it
2162 //
2163 theFitter->SetParameter(0, "delayBaselineAdjust", 0, 0.01, -100, 100);
2164 theFitter->FixParameter(0);
2165 status = theFitter->ExecuteCommand("MIGRAD", arglist, 2);
2166 }
2167 }
2168 }
2169 else m_fitFailed = false;
2170
2171 // Check to see if the fit forced the amplitude to the minimum, if so set the corresponding status bit
2172 //
2173 fitAmp = theFitter->GetParameter(1);
2174
2175 // Here we need to check if fitAmp is small (close) enough to fitAmpMin.
2176 // with "< 1+epsilon" where epsilon ~ 1%
2177 if (fitAmp < fitAmpMin * 1.01) {
2178 m_fitMinAmp = true;
2179 }
2180
2181 // Check that the amplitude passes minimum significance requirement
2182 //
2183 float sigMinCut = fitLG ? m_sigMinLG : m_sigMinHG;
2184 if (m_fitAmpError > 1e-6) {
2185 if (m_fitAmplitude/m_fitAmpError < sigMinCut) m_failSigCut = true;
2186 }
2187
2188 if (!m_quietFits) theFitter->GetMinuit()->fISW[4] = -1;
2189
2190 std::vector<double> funcParams(numFitPar - 1);
2191 std::vector<double> funcParamErrs(numFitPar - 1);
2192
2193 // Save the baseline shift between delayed and undelayed samples
2194 //
2195 m_delayedBaselineShift = theFitter->GetParameter(0);
2196
2197 // Capture and store the fit function parameteds and errors
2198 //
2199 for (size_t ipar = 1; ipar < numFitPar; ipar++) {
2200 funcParams[ipar - 1] = theFitter->GetParameter(ipar);
2201 funcParamErrs[ipar - 1] = theFitter->GetParError(ipar);
2202 }
2203
2204 s_combinedFitFunc->SetParameters(&funcParams[0]);
2205 s_combinedFitFunc->SetParErrors(&funcParamErrs[0]);
2206
2207 // Capture the chi-square etc.
2208 //
2209 theFitter->GetStats(chi2, edm, errdef, nvpar, nparx);
2210
2211 int ndf = 2 * m_Nsample - nvpar;
2212
2213 s_combinedFitFunc->SetChisquare(chi2);
2214 s_combinedFitFunc->SetNDF(ndf);
2215
2216 // add to list of functions
2217 if (m_saveFitFunc) {
2218 s_undelayedFitHist->GetListOfFunctions()->Clear();
2219 s_undelayedFitHist->GetListOfFunctions()->Add(s_combinedFitFunc);
2220
2221 s_delayedFitHist->GetListOfFunctions()->Clear();
2222 s_delayedFitHist->GetListOfFunctions()->Add(s_combinedFitFunc);
2223 }
2224
2225 if (!refitLG) {
2226 // Save the pull values from the last call to FCN
2227 //
2228 arglist[0] = 3; // number of function calls
2229 theFitter->ExecuteCommand("Cal1fcn", arglist, 1);
2231
2232 m_fitAmplitude = fitWrapper->GetAmplitude();
2233 m_fitTime = fitWrapper->GetTime();
2234 if (prePulse()) {
2235 const ZDCPrePulseFitWrapper* wrapPtr = static_cast<ZDCPrePulseFitWrapper*>(fitLG ? m_prePulseFitWrapperLG.get() : m_prePulseFitWrapperHG.get());
2236 m_fitPreT0 = wrapPtr->GetPreT0();
2237 m_fitPreAmp = wrapPtr->GetPreAmp();
2238 m_fitPostT0 = wrapPtr->GetPostT0();
2239 m_fitPostAmp = wrapPtr->GetPostAmp();
2240 }
2241
2242 if (preExpTail()) {
2243 const ZDCPreExpFitWrapper* wrapPtr = static_cast<ZDCPreExpFitWrapper*>(fitLG ? m_preExpFitWrapperLG.get() : m_preExpFitWrapperHG.get());
2244 m_fitExpAmp = wrapPtr->GetExpAmp();
2245 }
2246 else {
2247 m_fitExpAmp = 0;
2248 }
2249
2250 m_fitTimeSub = m_fitTime - t0Initial;
2251 m_fitChisq = chi2;
2252 m_fitNDoF = ndf;
2253
2254 m_fitTau1 = fitWrapper->GetTau1();
2255 m_fitTau2 = fitWrapper->GetTau2();
2256
2257 m_fitAmpError = fitWrapper->GetAmpError();
2258 m_bkgdMaxFraction = fitWrapper->GetBkgdMaxFraction();
2259
2260 if (!m_fitFailed) {
2261 unsigned int numPars = fitWrapper->GetNumShapeParameters();
2262 m_shapeParameters.assign(numPars, 0);
2263
2264 for (size_t ipar = 0; ipar < numPars; ipar++) {
2265 m_shapeParameters[ipar] = fitWrapper->GetShapeParameter(ipar);
2266 }
2267 }
2268 }
2269 else {
2270 m_evtLGRefit = true;
2271 m_refitLGFitAmpl = fitWrapper->GetAmplitude();
2272 m_refitLGAmpl = fitWrapper->GetAmplitude() * m_gainFactorLG;
2275 m_refitLGTime = fitWrapper->GetTime();
2276 m_refitLGTimeSub = m_refitLGTime - t0Initial;
2277 }
2278}
virtual float GetPreAmp() const =0
virtual float GetPreT0() const =0
virtual float GetPostT0() const =0
virtual float GetPostAmp() const =0
std::unique_ptr< TFitter > m_prePulseCombinedFitter
std::vector< float > m_fitPulls
static std::unique_ptr< TFitter > MakeCombinedFitter(TF1 *func)
std::unique_ptr< TH1 > m_delayedHistLGRefit
std::unique_ptr< TH1 > m_delayedHist
std::unique_ptr< TFitter > m_defaultCombinedFitter
double chi2(TH1 *h0, TH1 *h1)
status
Definition merge.py:16

◆ dump()

void ZDCPulseAnalyzer::dump ( ) const

Definition at line 2363 of file ZDCPulseAnalyzer.cxx.

2364{
2365 (*m_msgFunc_p)(ZDCMsg::Info, ("ZDCPulseAnalyzer dump for tag = " + m_tag));
2366
2367 (*m_msgFunc_p)(ZDCMsg::Info, ("Presample index, value = " + std::to_string(m_preSampleIdx) + ", " + std::to_string(m_preSample)));
2368
2369 if (m_useDelayed) {
2370 (*m_msgFunc_p)(ZDCMsg::Info, ("using delayed samples with delta T = " + std::to_string(m_delayedDeltaT) + ", and pedestalDiff == " +
2371 std::to_string(m_delayedPedestalDiff)));
2372 }
2373
2374 std::ostringstream message1;
2375 message1 << "samplesSub ";
2376 for (size_t sample = 0; sample < m_samplesSub.size(); sample++) {
2377 message1 << ", [" << sample << "] = " << m_samplesSub[sample];
2378 }
2379 (*m_msgFunc_p)(ZDCMsg::Info, message1.str());
2380
2381 std::ostringstream message3;
2382 message3 << "samplesDeriv2nd ";
2383 for (size_t sample = 0; sample < m_samplesDeriv2nd.size(); sample++) {
2384 message3 << ", [" << sample << "] = " << m_samplesDeriv2nd[sample];
2385 }
2386 (*m_msgFunc_p)(ZDCMsg::Info, message3.str());
2387
2388 (*m_msgFunc_p)(ZDCMsg::Info, ("minimum 2nd deriv sample, value = " + std::to_string(m_minDeriv2ndIndex) + ", " + std::to_string(m_minDeriv2nd)));
2389}
@ Info
Definition ZDCMsg.h:20

◆ dumpConfiguration()

void ZDCPulseAnalyzer::dumpConfiguration ( ) const

Definition at line 2410 of file ZDCPulseAnalyzer.cxx.

2411{
2412 std::ostringstream ostrStream;
2413 (*m_msgFunc_p)(ZDCMsg::Info, ("\n ZDCPulserAnalyzer:: ======================================================================="));
2414 (*m_msgFunc_p)(ZDCMsg::Info, ("ZDCPulserAnalyzer:: settings for instance: " + m_tag));
2415
2416 ostrStream << "Nsample = " << m_Nsample << " at frequency " << m_freqMHz << " MHz, preSample index = "
2417 << m_preSampleIdx << ", nominal pedestal = " << m_pedestal;
2418
2419 (*m_msgFunc_p)(ZDCMsg::Info, ostrStream.str()); ostrStream.str(""); ostrStream.clear();
2420
2421 ostrStream << "LG mode = " << m_LGMode << ", gainFactor HG = " << m_gainFactorHG << ", gainFactor LG = " << m_gainFactorLG << ", noise sigma HG = " << m_noiseSigHG << ", noiseSigLG = " << m_noiseSigLG;
2422 (*m_msgFunc_p)(ZDCMsg::Info, ostrStream.str()); ostrStream.str(""); ostrStream.clear();
2423
2425 ostrStream << "Using per-sample noise sigmas for high gain, values = ";
2426 for (auto sig : m_setPerSampleNoiseHG) {ostrStream << sig << ", ";}
2427 ostrStream << "end";
2428 (*m_msgFunc_p)(ZDCMsg::Info, ostrStream.str()); ostrStream.str(""); ostrStream.clear();
2429 }
2430
2432 ostrStream << "Using per-sample noise sigmas for low gain, values = ";
2433 for (auto sig : m_setPerSampleNoiseLG) {ostrStream << sig << ", ";}
2434 ostrStream << "end";
2435 (*m_msgFunc_p)(ZDCMsg::Info, ostrStream.str()); ostrStream.str(""); ostrStream.clear();
2436 }
2437
2438 ostrStream << "peak sample = " << m_peak2ndDerivMinSample << ", tolerance = " << m_peak2ndDerivMinTolerance
2439 << ", 2ndDerivThresh HG, LG = " << m_peak2ndDerivMinThreshHG << ", " << m_peak2ndDerivMinThreshLG
2440 << ", 2nd deriv step = " << m_2ndDerivStep;
2441 (*m_msgFunc_p)(ZDCMsg::Info, ostrStream.str()); ostrStream.str(""); ostrStream.clear();
2442
2443 if (m_useDelayed) {
2444 ostrStream << "using delayed samples with delta T = " << m_delayedDeltaT << ", and default pedestalDiff == "
2446 (*m_msgFunc_p)(ZDCMsg::Info, ostrStream.str()); ostrStream.str(""); ostrStream.clear();
2447 }
2448
2449 ostrStream <<"Fit function = " << m_fitFunction;
2450 if (m_fitParameterSetHG != "") ostrStream << " with parameter sets, HG: " << m_fitParameterSetHG << ", " << ", LG: " << m_fitParameterSetLG << "\n";
2451 ostrStream << " fixTau1HG = " << m_fixTau1HG << ", fixTau2HG = " << m_fixTau2HG
2452 << ", nominalTau1HG = " << m_nominalTau1HG << ", nominalTau2HG = " << m_nominalTau2HG << "\n"
2453 << " fixTau1LG = " << m_fixTau1LG << ", fixTau2LG = " << m_fixTau2LG
2454 << ", nominalTau1LG = " << m_nominalTau1LG << ", nominalTau2LG = " << m_nominalTau2LG << "\n"
2455 << ", nominalT0HG = " << m_nominalT0HG << ", nominalT0LG = " << m_nominalT0LG
2456 << ", t0Cuts HG = [" << m_T0CutLowHG << ", " << m_T0CutHighHG << "], t0Cuts LG = ["
2457 << m_T0CutLowLG << ", " << m_T0CutHighLG << "]";
2458 (*m_msgFunc_p)(ZDCMsg::Info, ostrStream.str()); ostrStream.str(""); ostrStream.clear();
2459
2460 ostrStream <<"Induct parameters: period HG, LG = " << m_inductPeriodHG << ", " << m_inductPeriodLG
2461 << ", bI HG, LG = " << m_inductbIHG << ", " << m_inductbILG << std::endl;
2462 (*m_msgFunc_p)(ZDCMsg::Info, ostrStream.str()); ostrStream.str(""); ostrStream.clear();
2463
2464
2465 ostrStream << "HGOverflowADC = " << m_HGOverflowADC << ", HGUnderflowADC = " << m_HGUnderflowADC
2466 << ", LGOverflowADC = "<< m_LGOverflowADC;
2467 (*m_msgFunc_p)(ZDCMsg::Info, ostrStream.str()); ostrStream.str(""); ostrStream.clear();
2468
2469 ostrStream << "chisqDivAmpCutHG = " << m_chisqDivAmpCutHG << ", chisqDivAmpCutLG=" << m_chisqDivAmpCutLG
2470 << ", chisqDivAmpOffsetHG = " << m_chisqDivAmpOffsetHG << ", chisqDivAmpOffsetLG = " << m_chisqDivAmpOffsetLG
2471 << ", chisqDivAmpPowerHG = " << m_chisqDivAmpPowerHG << ", chisqDivAmpPowerLG = " << m_chisqDivAmpPowerLG;
2472 (*m_msgFunc_p)(ZDCMsg::Info, ostrStream.str()); ostrStream.str(""); ostrStream.clear();
2473
2474 if ( m_enableRepass) {
2475 ostrStream << "Repass enabled with peak2ndDerivMinRepassHG = " << m_peak2ndDerivMinRepassHG << ", peak2ndDerivMinRepassLG = " << m_peak2ndDerivMinRepassLG;
2476 (*m_msgFunc_p)(ZDCMsg::Info, ostrStream.str()); ostrStream.str(""); ostrStream.clear();
2477 }
2478
2479 if (!m_doPrePulseCheck) {
2480 (*m_msgFunc_p)(ZDCMsg::Info, "Pre-pulse and negative exponential pulse checking disabled");
2481 }
2482 if (!m_doPostPulseCheck) {
2483 (*m_msgFunc_p)(ZDCMsg::Info, "Post-pulse checking disabled");
2484 }
2485
2486 if (m_enablePreExcl) {
2487 ostrStream << "Pre-exclusion enabled for up to " << m_maxSamplesPreExcl << ", samples with ADC threshold HG = "
2488 << m_preExclHGADCThresh << ", LG = " << m_preExclLGADCThresh;
2489 (*m_msgFunc_p)(ZDCMsg::Info, ostrStream.str()); ostrStream.str(""); ostrStream.clear();
2490 }
2491 if (m_enablePostExcl) {
2492 ostrStream << "Post-exclusion enabled for up to " << m_maxSamplesPostExcl << ", samples with ADC threshold HG = "
2494 (*m_msgFunc_p)(ZDCMsg::Info, ostrStream.str()); ostrStream.str(""); ostrStream.clear();
2495 }
2496
2498 ostrStream << "High gain Underflow pre- and post-exclusion enabled for up to " << m_underFlowExclSamplesPreHG
2499 << ", and " << m_underFlowExclSamplesPostHG << " samples, respectively";
2500 (*m_msgFunc_p)(ZDCMsg::Info, ostrStream.str()); ostrStream.str(""); ostrStream.clear();
2501 }
2503 ostrStream << "Low gain Underflow pre- and post-exclusion enabled for up to " << m_underFlowExclSamplesPreLG
2504 << ", and " << m_underFlowExclSamplesPostLG << " samples, respectively";
2505 (*m_msgFunc_p)(ZDCMsg::Info, ostrStream.str()); ostrStream.str(""); ostrStream.clear();
2506 }
2507 if (m_haveSignifCuts) {
2508 ostrStream << "Minimum significance cuts applied: HG min. sig. = " << m_sigMinHG << ", LG min. sig. " << m_sigMinLG;
2509 (*m_msgFunc_p)(ZDCMsg::Info, ostrStream.str()); ostrStream.str(""); ostrStream.clear();
2510 }
2511
2512}

◆ dumpTF1()

void ZDCPulseAnalyzer::dumpTF1 ( const TF1 * func) const

Definition at line 2391 of file ZDCPulseAnalyzer.cxx.

2392{
2393 std::string message = "Dump of TF1: " + std::string(func->GetName());
2394 bool continueDump = (*m_msgFunc_p)(ZDCMsg::Verbose, std::move(message));
2395 if (!continueDump) return;
2396
2397 unsigned int npar = func->GetNpar();
2398 for (unsigned int ipar = 0; ipar < npar; ipar++) {
2399 std::ostringstream msgstr;
2400
2401 double parMin = 0, parMax = 0;
2402 func->GetParLimits(ipar, parMin, parMax);
2403
2404 msgstr << "Parameter " << ipar << ", value = " << func->GetParameter(ipar) << ", error = "
2405 << func->GetParError(ipar) << ", min = " << parMin << ", max = " << parMax;
2406 (*m_msgFunc_p)(ZDCMsg::Verbose, msgstr.str());
2407 }
2408}

◆ enableDelayed()

void ZDCPulseAnalyzer::enableDelayed ( float deltaT,
float pedestalShift,
bool fixedBaseline = false )

Definition at line 245 of file ZDCPulseAnalyzer.cxx.

246{
247 m_useDelayed = true;
248 m_useFixedBaseline = fixedBaseline;
249
250 m_delayedDeltaT = deltaT;
251 m_delayedPedestalDiff = pedestalShift;
252
253 m_deltaTSample /= 2.;
254
255 std::string delayedHGName = std::string(m_fitHist->GetName()) + "delayed";
256 std::string delayedLGName = std::string(m_fitHistLGRefit->GetName()) + "delayed";
257
258 m_delayedHist = std::make_unique<TH1F>(delayedHGName.c_str(), "", m_Nsample, m_tmin + m_delayedDeltaT, m_tmax + m_delayedDeltaT);
259 m_delayedHist->SetDirectory(0);
260
261 m_delayedHistLGRefit = std::make_unique<TH1F>(delayedLGName.c_str(), "", m_Nsample, m_tmin + m_delayedDeltaT, m_tmax + m_delayedDeltaT);
262 m_delayedHistLGRefit->SetDirectory(0);
263}

◆ enableFADCCorrections()

void ZDCPulseAnalyzer::enableFADCCorrections ( bool correctPerSample,
std::unique_ptr< const TH1 > & correHistHG,
std::unique_ptr< const TH1 > & correHistLG )

Definition at line 685 of file ZDCPulseAnalyzer.cxx.

686{
688 m_FADCCorrPerSample = correctPerSample;
689
690 // check for appropriate limits
691 //
692 auto getXmin=[](const TH1 * pH){
693 return pH->GetXaxis()->GetXmin();
694 };
695 auto getXmax=[](const TH1 * pH){
696 return pH->GetXaxis()->GetXmax();
697 };
698 auto xmin= getXmin(correHistHG.get());
699 auto xmax= getXmax(correHistHG.get());
700 if (std::abs(xmin+0.5) > 1e-3 || std::abs(xmax - 4095.5) > 1e-3) {
701 (*m_msgFunc_p)(ZDCMsg::Error, "ZDCPulseAnalyzer::enableFADCCorrections:: invalid high gain correction histogram range: xmin, xmax = " +
702 std::to_string(xmin ) + ", " + std::to_string(xmax) );
703 }
704 else {
705 m_FADCCorrHG = std::move(correHistHG);
706 }
707 xmin= getXmin(correHistLG.get());
708 xmax= getXmax(correHistLG.get());
709 if (std::abs(xmin+0.5) > 1e-3 ||
710 std::abs(xmax - 4095.5) > 1e-3) {
711 (*m_msgFunc_p)(ZDCMsg::Error, "ZDCPulseAnalyzer::enableFADCCorrections:: invalid low gain correction histogram range: xmin, xmax = " +
712 std::to_string(xmin) + ", " + std::to_string(xmax) );
713 }
714 else {
715 m_FADCCorrLG = std::move(correHistLG);
716 }
717}
std::unique_ptr< const TH1 > m_FADCCorrLG
std::unique_ptr< const TH1 > m_FADCCorrHG
double xmax
Definition listroot.cxx:61
double xmin
Definition listroot.cxx:60
@ Error
Definition ZDCMsg.h:22

◆ enablePostExclusion()

void ZDCPulseAnalyzer::enablePostExclusion ( unsigned int maxSamplesExcl,
unsigned int HGADCThresh,
unsigned int LGADCThresh )
inline

Definition at line 568 of file ZDCPulseAnalyzer.h.

569 {
570 m_enablePostExcl = true;
571 m_maxSamplesPostExcl = maxSamplesExcl;
572 m_postExclHGADCThresh = HGADCThresh;
573 m_postExclLGADCThresh = LGADCThresh;
574 }

◆ enablePostPulseCheck()

void ZDCPulseAnalyzer::enablePostPulseCheck ( unsigned int postPulseSampleDelta,
float postPulseDerivMinSig,
float postPulseAbsDer2ndMinSig,
float minMainDer2ndRatio )

Definition at line 272 of file ZDCPulseAnalyzer.cxx.

273{
274 m_doPostPulseCheck = true;
275 m_postPulseDelta = postPulseSampleDelta;
276 m_postPulseDerivMinSig = postPulseDerivMinSig;
277 m_postPulseAbsDer2ndMinSig = postPulseAbsDer2ndMinSig;
278 m_postPulseMainMinDer2ndRatio = minMainDer2ndRatio;
279}
float m_postPulseMainMinDer2ndRatio

◆ enablePreExclusion()

void ZDCPulseAnalyzer::enablePreExclusion ( unsigned int maxSamplesExcl,
unsigned int HGADCThresh,
unsigned int LGADCThresh )
inline

Definition at line 560 of file ZDCPulseAnalyzer.h.

561 {
562 m_enablePreExcl = true;
563 m_maxSamplesPreExcl = maxSamplesExcl;
564 m_preExclHGADCThresh = HGADCThresh;
565 m_preExclLGADCThresh = LGADCThresh;
566 }

◆ enableRepass()

void ZDCPulseAnalyzer::enableRepass ( float peak2ndDerivMinRepassHG,
float peak2ndDerivMinRepassLG )

Definition at line 265 of file ZDCPulseAnalyzer.cxx.

266{
267 m_enableRepass = true;
268 m_peak2ndDerivMinRepassHG = peak2ndDerivMinRepassHG;
269 m_peak2ndDerivMinRepassLG = peak2ndDerivMinRepassLG;
270}

◆ enableTimeSigCut()

void ZDCPulseAnalyzer::enableTimeSigCut ( bool AND,
float sigCut,
const std::string & TF1String,
const std::vector< double > & parsHG,
const std::vector< double > & parsLG )

Definition at line 656 of file ZDCPulseAnalyzer.cxx.

659{
660 m_timeCutMode = AND ? 2 : 1;
661 m_t0CutSig = sigCut;
662
663 // Make the TF1's that provide the resolution
664 //
665 std::string timeResHGName = "TimeResFuncHG_" + m_tag;
666 std::string timeResLGName = "TimeResFuncLG_" + m_tag;
667
668 TF1* funcHG_p = new TF1(timeResHGName.c_str(), TF1String.c_str(), 0, m_HGOverflowADC);
669 TF1* funcLG_p = new TF1(timeResLGName.c_str(), TF1String.c_str(), 0, m_LGOverflowADC);
670
671 if (parsHG.size() != static_cast<unsigned int>(funcHG_p->GetNpar()) ||
672 parsLG.size() != static_cast<unsigned int>(funcLG_p->GetNpar())) {
673 //
674 // generate an error message
675 }
676
677 funcHG_p->SetParameters(&parsHG[0]);
678 funcLG_p->SetParameters(&parsLG[0]);
679
680 m_timeResFuncHG_p.reset(funcHG_p);
681 m_timeResFuncLG_p.reset(funcLG_p);
682
683}

◆ excludeEarlyLG()

bool ZDCPulseAnalyzer::excludeEarlyLG ( ) const
inline

Definition at line 692 of file ZDCPulseAnalyzer.h.

692{return m_ExcludeEarly;}

◆ excludeLateLG()

bool ZDCPulseAnalyzer::excludeLateLG ( ) const
inline

Definition at line 693 of file ZDCPulseAnalyzer.h.

693{return m_ExcludeLate;}

◆ failed()

bool ZDCPulseAnalyzer::failed ( ) const
inline

Definition at line 678 of file ZDCPulseAnalyzer.h.

678{return m_fail;}

◆ failSigCut()

bool ZDCPulseAnalyzer::failSigCut ( ) const
inline

Definition at line 698 of file ZDCPulseAnalyzer.h.

698{return m_failSigCut;}

◆ FillHistogram()

void ZDCPulseAnalyzer::FillHistogram ( bool refitLG)
inlineprivate

Definition at line 473 of file ZDCPulseAnalyzer.h.

474 {
475
476 if (!m_useDelayed) {
477 if (!refitLG) {
478 const std::vector<bool>& useSample_ref = useLowGain() ? m_useSampleLG : m_useSampleHG;
479
480 // Set the data and errors in the histogram object
481 //
482 for (size_t isample = 0; isample < m_NSamplesAna; isample++) {
483 m_fitHist->SetBinContent(isample + 1, m_samplesSub[isample]);
484 if (useSample_ref[isample]) m_fitHist->SetBinError(isample + 1, m_samplesNoise[isample]);
485 else m_fitHist->SetBinError(isample + 1, 0);
486 }
487 }
488 else {
489 for (size_t isample = 0; isample < m_NSamplesAna; isample++) {
490 m_fitHistLGRefit->SetBinContent(isample + 1, m_samplesLGRefit[isample]);
491 if (m_useSampleLG[isample]) m_fitHistLGRefit->SetBinError(isample + 1, m_samplesNoise[isample]);
492 else m_fitHistLGRefit->SetBinError(isample + 1, 0);
493 }
494 }
495 }
496 else {
497 if (!refitLG) {
498 // Set the data and errors in the histogram object
499 //
500 for (size_t isample = 0; isample < m_Nsample; isample++) {
501 m_fitHist->SetBinContent(isample + 1, m_samplesSub[isample * 2]);
502 m_delayedHist->SetBinContent(isample + 1, m_samplesSub[isample * 2 + 1]);
503
504 m_fitHist->SetBinError(isample + 1, m_samplesNoise[isample]);
505 m_delayedHist->SetBinError(isample + 1, m_samplesNoise[isample]);
506 }
507 }
508 else {
509 // Set the data and errors in the histogram object
510 //
511 for (size_t isample = 0; isample < m_Nsample; isample++) {
512 m_fitHistLGRefit->SetBinContent(isample + 1, m_samplesLGRefit[isample * 2]);
513 m_delayedHistLGRefit->SetBinContent(isample + 1, m_samplesLGRefit[isample * 2 + 1]);
514
515 m_fitHistLGRefit->SetBinError(isample + 1, m_samplesNoiseLGRefit[isample]);
516 m_delayedHistLGRefit->SetBinError(isample + 1, m_samplesNoiseLGRefit[isample]);
517 }
518 }
519 }
520 }
std::vector< float > m_samplesNoiseLGRefit
std::vector< float > m_samplesLGRefit
bool useLowGain() const

◆ fitFailed()

bool ZDCPulseAnalyzer::fitFailed ( ) const
inline

Definition at line 688 of file ZDCPulseAnalyzer.h.

688{return m_fitFailed;}

◆ fitMinimumAmplitude()

bool ZDCPulseAnalyzer::fitMinimumAmplitude ( ) const
inline

Definition at line 695 of file ZDCPulseAnalyzer.h.

695{return m_fitMinAmp;}

◆ getADCPeakHG()

float ZDCPulseAnalyzer::getADCPeakHG ( ) const
inline

Definition at line 794 of file ZDCPulseAnalyzer.h.

794{return m_ADCPeakHG;}

◆ getADCPeakLG()

float ZDCPulseAnalyzer::getADCPeakLG ( ) const
inline

Definition at line 795 of file ZDCPulseAnalyzer.h.

795{return m_ADCPeakLG;}

◆ GetAmpError()

float ZDCPulseAnalyzer::GetAmpError ( ) const
inline

Definition at line 725 of file ZDCPulseAnalyzer.h.

725{return m_ampError;}

◆ GetAmplitude()

float ZDCPulseAnalyzer::GetAmplitude ( ) const
inline

Definition at line 724 of file ZDCPulseAnalyzer.h.

724{return m_amplitude;}

◆ getAmplitudeCorrection()

double ZDCPulseAnalyzer::getAmplitudeCorrection ( bool highGain)
private

Definition at line 756 of file ZDCPulseAnalyzer.cxx.

757{
758 double amplCorrFactor = 1;
759
760 // If we have FADC correction and we aren't applying it per-sample, do so here
761 //
763 double fadcCorr = highGain ? m_FADCCorrHG->Interpolate(m_fitAmplitude) : m_FADCCorrLG->Interpolate(m_fitAmplitude);
764 amplCorrFactor *= fadcCorr;
765 }
766
767 double amplCorr = m_fitAmplitude * amplCorrFactor;
768
769 // If we have a non-linear correction, apply it here
770 // We apply it as an inverse correction - i.e. we divide by a correction
771 // term tha is a sum of coefficients times the ADC minus a reference
772 // to a power. The lowest power is 1, the highest is deteremined by
773 // the number of provided coefficients
774
775 if (m_haveNonlinCorr) {
776 float invNLCorr = 1.0;
777 float nlPolyArg = (amplCorr - m_nonLinCorrRefADC) / m_nonLinCorrRefScale;
778
779 if (highGain) {
780 for (size_t power = 1; power <= m_nonLinCorrParamsHG.size(); power++) {
781 invNLCorr += m_nonLinCorrParamsHG[power - 1]*pow(nlPolyArg, power);
782 }
783 }
784 else {
785 for (size_t power = 1; power <= m_nonLinCorrParamsLG.size(); power++) {
786 invNLCorr += m_nonLinCorrParamsLG[power - 1]*pow(nlPolyArg, power);
787 }
788 }
789
790 amplCorrFactor /= invNLCorr;
791 }
792
793 return amplCorrFactor;
794}
constexpr int pow(int x)
Definition conifer.h:27

◆ GetAmpNoNonLin()

float ZDCPulseAnalyzer::GetAmpNoNonLin ( ) const
inline

Definition at line 723 of file ZDCPulseAnalyzer.h.

723{return m_ampNoNonLin;}

◆ GetBkgdMaxFraction()

float ZDCPulseAnalyzer::GetBkgdMaxFraction ( ) const
inline

Definition at line 811 of file ZDCPulseAnalyzer.h.

811{return m_bkgdMaxFraction;}

◆ GetChisq()

float ZDCPulseAnalyzer::GetChisq ( ) const
inline

Definition at line 712 of file ZDCPulseAnalyzer.h.

712{return m_fitChisq;}

◆ GetChisqRatio()

float ZDCPulseAnalyzer::GetChisqRatio ( ) const
inline

Definition at line 713 of file ZDCPulseAnalyzer.h.

713{return m_chisqRatio;}

◆ GetCombinedGraph()

std::shared_ptr< TGraphErrors > ZDCPulseAnalyzer::GetCombinedGraph ( bool forceLG = false)

Definition at line 2546 of file ZDCPulseAnalyzer.cxx.

2547{
2548 //
2549 // We defer filling the histogram if we don't have a pulse until the histogram is requested
2550 //
2551 GetHistogramPtr(LGRefit);
2552
2553 TH1* hist_p = nullptr, *delayedHist_p = nullptr;
2554 if (LGRefit) {
2555 hist_p = m_fitHistLGRefit.get();
2556 delayedHist_p = m_delayedHistLGRefit.get();
2557 }
2558 else {
2559 hist_p = m_fitHist.get();
2560 delayedHist_p = m_delayedHist.get();
2561 }
2562
2563 std::shared_ptr<TGraphErrors> theGraph = std::make_shared<TGraphErrors>(TGraphErrors(2 * m_Nsample));
2564 size_t npts = 0;
2565
2566 for (int ipt = 0; ipt < hist_p->GetNbinsX(); ipt++) {
2567 theGraph->SetPoint(npts, hist_p->GetBinCenter(ipt + 1), hist_p->GetBinContent(ipt + 1));
2568 theGraph->SetPointError(npts++, 0, hist_p->GetBinError(ipt + 1));
2569 }
2570
2571 for (int iDelayPt = 0; iDelayPt < delayedHist_p->GetNbinsX(); iDelayPt++) {
2572 theGraph->SetPoint(npts, delayedHist_p->GetBinCenter(iDelayPt + 1), delayedHist_p->GetBinContent(iDelayPt + 1) - m_delayedBaselineShift);
2573 theGraph->SetPointError(npts++, 0, delayedHist_p->GetBinError(iDelayPt + 1));
2574 }
2575 if (m_havePulse) {
2576 TF1* func_p = static_cast<TF1*>(hist_p->GetListOfFunctions()->Last());
2577 if (func_p) {
2578 theGraph->GetListOfFunctions()->Add(new TF1(*func_p));
2579 hist_p->GetListOfFunctions()->SetOwner (false);
2580 }
2581 }
2582 theGraph->SetName(( std::string(hist_p->GetName()) + "combinaed").c_str());
2583
2584 theGraph->SetMarkerStyle(20);
2585 theGraph->SetMarkerColor(1);
2586
2587 return theGraph;
2588}
const TH1 * GetHistogramPtr(bool refitLG=false)

◆ GetdelayBS()

float ZDCPulseAnalyzer::GetdelayBS ( ) const
inline

Definition at line 803 of file ZDCPulseAnalyzer.h.

◆ GetDelayedBaselineCorr()

float ZDCPulseAnalyzer::GetDelayedBaselineCorr ( ) const
inline

Definition at line 814 of file ZDCPulseAnalyzer.h.

814{return m_baselineCorr;}

◆ GetDelayedBaselineShiftFit()

float ZDCPulseAnalyzer::GetDelayedBaselineShiftFit ( ) const
inline

Definition at line 813 of file ZDCPulseAnalyzer.h.

◆ GetFitAmplitude()

float ZDCPulseAnalyzer::GetFitAmplitude ( ) const
inline

Definition at line 707 of file ZDCPulseAnalyzer.h.

707{return m_fitAmplitude;}

◆ GetFitExpAmp()

float ZDCPulseAnalyzer::GetFitExpAmp ( ) const
inline

Definition at line 720 of file ZDCPulseAnalyzer.h.

720{return m_fitExpAmp;}

◆ GetFitPostAmp()

float ZDCPulseAnalyzer::GetFitPostAmp ( ) const
inline

Definition at line 719 of file ZDCPulseAnalyzer.h.

719{return m_postAmplitude;}

◆ GetFitPostT0()

float ZDCPulseAnalyzer::GetFitPostT0 ( ) const
inline

Definition at line 718 of file ZDCPulseAnalyzer.h.

718{return m_fitPostT0;}

◆ GetFitPreAmp()

float ZDCPulseAnalyzer::GetFitPreAmp ( ) const
inline

Definition at line 717 of file ZDCPulseAnalyzer.h.

717{return m_preAmplitude;}

◆ GetFitPreT0()

float ZDCPulseAnalyzer::GetFitPreT0 ( ) const
inline

Definition at line 716 of file ZDCPulseAnalyzer.h.

716{return m_fitPreT0;}

◆ GetFitPulls()

std::vector< float > ZDCPulseAnalyzer::GetFitPulls ( bool forceLG = false) const

Definition at line 719 of file ZDCPulseAnalyzer.cxx.

720{
721 //
722 // If there was no pulse for this event, return an empty vector (see reset() method)
723 //
724 if (!m_havePulse) {
725 return m_fitPulls;
726 }
727
728 //
729 // The combined (delayed+undelayed) pulse fitting fills out m_fitPulls directly
730 //
731 if (m_useDelayed) {
732 return m_fitPulls;
733 }
734 else {
735 //
736 // When not using combined fitting, We don't have the pre-calculated pulls. Calculate them on the fly.
737 //
738 std::vector<float> pulls(m_Nsample, -100);
739
740 const TH1* dataHist_p = refitLG ? m_fitHistLGRefit.get() : m_fitHist.get();
741 const TF1* fit_p = static_cast<const TF1*>(dataHist_p->GetListOfFunctions()->Last());
742
743 for (size_t ibin = 0; ibin < m_Nsample ; ibin++) {
744 float t = dataHist_p->GetBinCenter(ibin + 1);
745 float fitVal = fit_p->Eval(t);
746 float histVal = dataHist_p->GetBinContent(ibin + 1);
747 float histErr = dataHist_p->GetBinError(ibin + 1);
748 float pull = (histVal - fitVal)/histErr;
749 pulls[ibin] = pull;
750 }
751
752 return pulls;
753 }
754}

◆ GetFitT0()

float ZDCPulseAnalyzer::GetFitT0 ( ) const
inline

Definition at line 708 of file ZDCPulseAnalyzer.h.

708{return m_fitTime;}

◆ GetFitTau1()

float ZDCPulseAnalyzer::GetFitTau1 ( ) const
inline

Definition at line 714 of file ZDCPulseAnalyzer.h.

714{return m_fitTau1;}

◆ GetFitTau2()

float ZDCPulseAnalyzer::GetFitTau2 ( ) const
inline

Definition at line 715 of file ZDCPulseAnalyzer.h.

715{return m_fitTau2;}

◆ GetFitTMax()

float ZDCPulseAnalyzer::GetFitTMax ( ) const
inline

Definition at line 800 of file ZDCPulseAnalyzer.h.

800{return m_fitTMax;}

◆ GetFitTMin()

float ZDCPulseAnalyzer::GetFitTMin ( ) const
inline

Definition at line 801 of file ZDCPulseAnalyzer.h.

801{return m_fitTMin;}

◆ GetGraph()

std::shared_ptr< TGraphErrors > ZDCPulseAnalyzer::GetGraph ( bool forceLG = false)

Definition at line 2591 of file ZDCPulseAnalyzer.cxx.

2592{
2593 //
2594 // We defer filling the histogram if we don't have a pulse until the histogram is requested
2595 //
2596 const TH1* hist_p = GetHistogramPtr(forceLG);
2597
2598 std::shared_ptr<TGraphErrors> theGraph = std::make_shared<TGraphErrors>(TGraphErrors(m_Nsample));
2599 size_t npts = 0;
2600
2601 for (int ipt = 0; ipt < hist_p->GetNbinsX(); ipt++) {
2602 theGraph->SetPoint(npts, hist_p->GetBinCenter(ipt + 1), hist_p->GetBinContent(ipt + 1));
2603 theGraph->SetPointError(npts++, 0, hist_p->GetBinError(ipt + 1));
2604 }
2605
2606 TF1* func_p = static_cast<TF1*>(hist_p->GetListOfFunctions()->Last());
2607 theGraph->GetListOfFunctions()->Add(func_p);
2608 theGraph->SetName(( std::string(hist_p->GetName()) + "not_combinaed").c_str());
2609
2610 theGraph->SetMarkerStyle(20);
2611 theGraph->SetMarkerColor(1);
2612
2613 return theGraph;
2614}

◆ GetHistogramPtr()

const TH1 * ZDCPulseAnalyzer::GetHistogramPtr ( bool refitLG = false)
inline

Definition at line 816 of file ZDCPulseAnalyzer.h.

817 {
818 //
819 // We defer filling the histogram if we don't have a pulse until the histogram is requested
820 //
821 if (!m_havePulse) {
822 FillHistogram(refitLG);
823 }
824
825 return refitLG ? m_fitHistLGRefit.get() : m_fitHist.get();
826 }

◆ getLGMode()

unsigned int ZDCPulseAnalyzer::getLGMode ( ) const
inline

Definition at line 590 of file ZDCPulseAnalyzer.h.

590{return m_LGMode;}

◆ getMaxADCHG()

float ZDCPulseAnalyzer::getMaxADCHG ( ) const
inline

Definition at line 773 of file ZDCPulseAnalyzer.h.

773{return m_maxADCHG;}

◆ getMaxADCLG()

float ZDCPulseAnalyzer::getMaxADCLG ( ) const
inline

Definition at line 774 of file ZDCPulseAnalyzer.h.

774{return m_maxADCLG;}

◆ getMaxADCSampleHG()

int ZDCPulseAnalyzer::getMaxADCSampleHG ( ) const
inline

Definition at line 788 of file ZDCPulseAnalyzer.h.

◆ getMaxADCSampleLG()

int ZDCPulseAnalyzer::getMaxADCSampleLG ( ) const
inline

Definition at line 791 of file ZDCPulseAnalyzer.h.

◆ getMaxADCSub()

float ZDCPulseAnalyzer::getMaxADCSub ( ) const
inline

Definition at line 778 of file ZDCPulseAnalyzer.h.

778 {
779 float maxADCNosub = m_useLowGain ? m_maxADCLG : m_maxADCHG;
780 return maxADCNosub - m_pedestal - m_preSample;
781 }

◆ GetMaxDelta()

float ZDCPulseAnalyzer::GetMaxDelta ( ) const
inline

Definition at line 797 of file ZDCPulseAnalyzer.h.

797{return m_maxDelta;}

◆ getMinADCHG()

float ZDCPulseAnalyzer::getMinADCHG ( ) const
inline

Definition at line 775 of file ZDCPulseAnalyzer.h.

775{return m_minADCHG;}

◆ getMinADCLG()

float ZDCPulseAnalyzer::getMinADCLG ( ) const
inline

Definition at line 776 of file ZDCPulseAnalyzer.h.

776{return m_minADCLG;}

◆ getMinADCSampleHG()

int ZDCPulseAnalyzer::getMinADCSampleHG ( ) const
inline

Definition at line 789 of file ZDCPulseAnalyzer.h.

◆ getMinADCSampleLG()

int ZDCPulseAnalyzer::getMinADCSampleLG ( ) const
inline

Definition at line 792 of file ZDCPulseAnalyzer.h.

◆ getMinADCSub()

float ZDCPulseAnalyzer::getMinADCSub ( ) const
inline

Definition at line 783 of file ZDCPulseAnalyzer.h.

783 {
784 float minADCNosub = m_useLowGain ? m_minADCLG : m_minADCHG;
785 return minADCNosub - m_pedestal - m_preSample;
786 }

◆ GetMinDelta()

float ZDCPulseAnalyzer::GetMinDelta ( ) const
inline

Definition at line 798 of file ZDCPulseAnalyzer.h.

798{return m_minDelta;}

◆ GetMinDeriv2nd()

float ZDCPulseAnalyzer::GetMinDeriv2nd ( ) const
inline

Definition at line 805 of file ZDCPulseAnalyzer.h.

805{return m_minDeriv2nd;}

◆ GetMinDeriv2ndIndex()

float ZDCPulseAnalyzer::GetMinDeriv2ndIndex ( ) const
inline

Definition at line 806 of file ZDCPulseAnalyzer.h.

806{return m_minDeriv2ndIndex;}

◆ GetPreExpAmp()

float ZDCPulseAnalyzer::GetPreExpAmp ( ) const
inline

Definition at line 726 of file ZDCPulseAnalyzer.h.

726{return m_expAmplitude;}

◆ getPresample()

float ZDCPulseAnalyzer::getPresample ( ) const
inline

Definition at line 772 of file ZDCPulseAnalyzer.h.

772{return m_preSample;}

◆ GetPreSampleAmp()

float ZDCPulseAnalyzer::GetPreSampleAmp ( ) const
inline

Definition at line 810 of file ZDCPulseAnalyzer.h.

810{return m_preSampleAmp;}

◆ getRefitLGAmp()

float ZDCPulseAnalyzer::getRefitLGAmp ( ) const
inline

Definition at line 730 of file ZDCPulseAnalyzer.h.

731 {
732 if (m_evtLGRefit) return m_refitLGAmpl;
733 else return 0;
734 }

◆ getRefitLGAmpCorr()

float ZDCPulseAnalyzer::getRefitLGAmpCorr ( ) const
inline

Definition at line 742 of file ZDCPulseAnalyzer.h.

743 {
745 else return 0;
746 }

◆ getRefitLGChisq()

float ZDCPulseAnalyzer::getRefitLGChisq ( ) const
inline

Definition at line 748 of file ZDCPulseAnalyzer.h.

749 {
750 if (m_evtLGRefit) return m_refitLGChisq;
751 else return 0;
752 }

◆ getRefitLGChisqRatio()

float ZDCPulseAnalyzer::getRefitLGChisqRatio ( ) const
inline

Definition at line 754 of file ZDCPulseAnalyzer.h.

755 {
757 else return 0;
758 }

◆ getRefitLGFitAmp()

float ZDCPulseAnalyzer::getRefitLGFitAmp ( ) const
inline

Definition at line 736 of file ZDCPulseAnalyzer.h.

737 {
738 if (m_evtLGRefit) return m_refitLGFitAmpl;
739 else return 0;
740 }

◆ getRefitLGTime()

float ZDCPulseAnalyzer::getRefitLGTime ( ) const
inline

Definition at line 760 of file ZDCPulseAnalyzer.h.

761 {
762 if (m_evtLGRefit) return m_refitLGTime;
763 else return 0;
764 }

◆ getRefitLGTimeSub()

float ZDCPulseAnalyzer::getRefitLGTimeSub ( ) const
inline

Definition at line 766 of file ZDCPulseAnalyzer.h.

767 {
768 if (m_evtLGRefit) return m_refitLGTimeSub;
769 else return 0;
770 }

◆ GetSamplesDeriv2nd()

const std::vector< float > & ZDCPulseAnalyzer::GetSamplesDeriv2nd ( ) const
inline

Definition at line 838 of file ZDCPulseAnalyzer.h.

838{return m_samplesDeriv2nd;}

◆ GetSamplesSub()

const std::vector< float > & ZDCPulseAnalyzer::GetSamplesSub ( ) const
inline

Definition at line 837 of file ZDCPulseAnalyzer.h.

837{return m_samplesSub;}

◆ GetShapeParameters()

const std::vector< float > & ZDCPulseAnalyzer::GetShapeParameters ( ) const
inline

Definition at line 728 of file ZDCPulseAnalyzer.h.

728{return m_shapeParameters;}

◆ GetStatusMask()

unsigned int ZDCPulseAnalyzer::GetStatusMask ( ) const

Definition at line 2514 of file ZDCPulseAnalyzer.cxx.

2515{
2516 unsigned int statusMask = 0;
2517
2518 if (havePulse()) statusMask |= 1 << PulseBit;
2519 if (useLowGain()) statusMask |= 1 << LowGainBit;
2520 if (failed()) statusMask |= 1 << FailBit;
2521 if (HGOverflow()) statusMask |= 1 << HGOverflowBit;
2522
2523 if (HGUnderflow()) statusMask |= 1 << HGUnderflowBit;
2524 if (PSHGOverUnderflow()) statusMask |= 1 << PSHGOverUnderflowBit;
2525 if (LGOverflow()) statusMask |= 1 << LGOverflowBit;
2526 if (LGUnderflow()) statusMask |= 1 << LGUnderflowBit;
2527
2528 if (prePulse()) statusMask |= 1 << PrePulseBit;
2529 if (postPulse()) statusMask |= 1 << PostPulseBit;
2530 if (fitFailed()) statusMask |= 1 << FitFailedBit;
2531 if (badChisq()) statusMask |= 1 << BadChisqBit;
2532
2533 if (badT0()) statusMask |= 1 << BadT0Bit;
2534 if (excludeEarlyLG()) statusMask |= 1 << ExcludeEarlyLGBit;
2535 if (excludeLateLG()) statusMask |= 1 << ExcludeLateLGBit;
2536 if (preExpTail()) statusMask |= 1 << preExpTailBit;
2537 if (fitMinimumAmplitude()) statusMask |= 1 << FitMinAmpBit;
2538 if (repassPulse()) statusMask |= 1 << RepassPulseBit;
2539 if (armSumInclude()) statusMask |= 1 << ArmSumIncludeBit;
2540 if (failSigCut()) statusMask |= 1 << FailSigCutBit;
2541 if (underflowExclusion()) statusMask |= 1<<UnderFlowExclusionBit;
2542
2543 return statusMask;
2544}
bool HGOverflow() const
bool underflowExclusion() const
bool excludeEarlyLG() const
bool HGUnderflow() const
bool armSumInclude() const
bool PSHGOverUnderflow() const
bool postPulse() const
bool repassPulse() const
bool excludeLateLG() const

◆ GetT0Corr()

float ZDCPulseAnalyzer::GetT0Corr ( ) const
inline

Definition at line 710 of file ZDCPulseAnalyzer.h.

710{return m_fitTimeCorr;}

◆ GetT0Sub()

float ZDCPulseAnalyzer::GetT0Sub ( ) const
inline

Definition at line 709 of file ZDCPulseAnalyzer.h.

709{return m_fitTimeSub;}

◆ getTimeSig()

float ZDCPulseAnalyzer::getTimeSig ( ) const
inline

Definition at line 711 of file ZDCPulseAnalyzer.h.

711{return m_timeSig;}

◆ HaveData()

bool ZDCPulseAnalyzer::HaveData ( ) const
inline

Definition at line 671 of file ZDCPulseAnalyzer.h.

671{return m_haveData;}

◆ havePulse()

bool ZDCPulseAnalyzer::havePulse ( ) const
inline

Definition at line 676 of file ZDCPulseAnalyzer.h.

676{return m_havePulse;}

◆ HGOverflow()

bool ZDCPulseAnalyzer::HGOverflow ( ) const
inline

Definition at line 679 of file ZDCPulseAnalyzer.h.

679{return m_HGOverflow;}

◆ HGUnderflow()

bool ZDCPulseAnalyzer::HGUnderflow ( ) const
inline

Definition at line 681 of file ZDCPulseAnalyzer.h.

681{return m_HGUnderflow;}

◆ initialize()

void ZDCPulseAnalyzer::initialize ( )
private

Definition at line 375 of file ZDCPulseAnalyzer.cxx.

376{
378
385
386 m_initialized = true;
387}
std::vector< float > m_ADCSSampNoiseLG
std::vector< float > m_ADCSSampNoiseHG

◆ LGOverflow()

bool ZDCPulseAnalyzer::LGOverflow ( ) const
inline

Definition at line 683 of file ZDCPulseAnalyzer.h.

683{return m_LGOverflow;}

◆ LGUnderflow()

bool ZDCPulseAnalyzer::LGUnderflow ( ) const
inline

Definition at line 684 of file ZDCPulseAnalyzer.h.

684{return m_LGUnderflow;}

◆ LoadAndAnalyzeData() [1/2]

bool ZDCPulseAnalyzer::LoadAndAnalyzeData ( const std::vector< float > & ADCSamplesHG,
const std::vector< float > & ADCSamplesLG )

Definition at line 947 of file ZDCPulseAnalyzer.cxx.

948{
949 if (m_useDelayed) {
950 (*m_msgFunc_p)(ZDCMsg::Fatal, "ZDCPulseAnalyzer::LoadAndAnalyzeData:: Wrong LoadAndAnalyzeData called -- expecting both delayed and undelayed samples");
951 }
952
955
956 // Clear any transient data
957 //
958 reset(false);
959
960 // Make sure we have the right number of samples. Should never fail. necessry?
961 //
962 if (ADCSamplesHG.size() != m_Nsample || ADCSamplesLG.size() != m_Nsample) {
963 m_fail = true;
964 return false;
965 }
966
967 m_ADCSamplesHG = ADCSamplesHG;
968 m_ADCSamplesLG = ADCSamplesLG;
969
970 return DoAnalysis(false);
971}
bool DoAnalysis(bool repass)
@ Fatal
Definition ZDCMsg.h:23

◆ LoadAndAnalyzeData() [2/2]

bool ZDCPulseAnalyzer::LoadAndAnalyzeData ( const std::vector< float > & ADCSamplesHG,
const std::vector< float > & ADCSamplesLG,
const std::vector< float > & ADCSamplesHGDelayed,
const std::vector< float > & ADCSamplesLGDelayed )

Definition at line 973 of file ZDCPulseAnalyzer.cxx.

975{
976 if (!m_useDelayed) {
977 (*m_msgFunc_p)(ZDCMsg::Fatal, "ZDCPulseAnalyzer::LoadAndAnalyzeData:: Wrong LoadAndAnalyzeData called -- expecting only undelayed samples");
978 }
979
982
983 // Clear any transient data
984 //
985 reset();
986
987 // Make sure we have the right number of samples. Should never fail. necessry?
988 //
989 if (ADCSamplesHG.size() != m_Nsample || ADCSamplesLG.size() != m_Nsample ||
990 ADCSamplesHGDelayed.size() != m_Nsample || ADCSamplesLGDelayed.size() != m_Nsample) {
991 m_fail = true;
992 return false;
993 }
994
995 // +++ BAC Mar 22, 2026
996 // Trying to rationalize the initialization/handling of transient data. These line should not be necessary. Thus commented
997 // ---
998 //
999 // m_ADCSamplesHG.reserve(m_Nsample*2);
1000 // m_ADCSamplesLG.reserve(m_Nsample*2);
1001
1002 // Now do pedestal subtraction and check for overflows
1003 //
1004 for (size_t isample = 0; isample < m_Nsample; isample++) {
1005 float ADCHG = ADCSamplesHG[isample];
1006 float ADCLG = ADCSamplesLG[isample];
1007
1008 float ADCHGDelay = ADCSamplesHGDelayed[isample] - m_delayedPedestalDiff;
1009 float ADCLGDelay = ADCSamplesLGDelayed[isample] - m_delayedPedestalDiff;
1010
1011 if (m_delayedDeltaT > 0) {
1012 m_ADCSamplesHG.push_back(ADCHG);
1013 m_ADCSamplesHG.push_back(ADCHGDelay);
1014
1015 m_ADCSamplesLG.push_back(ADCLG);
1016 m_ADCSamplesLG.push_back(ADCLGDelay);
1017 }
1018 else {
1019 m_ADCSamplesHG.push_back(ADCHGDelay);
1020 m_ADCSamplesHG.push_back(ADCHG);
1021
1022 m_ADCSamplesLG.push_back(ADCLGDelay);
1023 m_ADCSamplesLG.push_back(ADCLG);
1024 }
1025 }
1026
1027 return DoAnalysis(false);
1028}

◆ MakeCombinedFitter()

std::unique_ptr< TFitter > ZDCPulseAnalyzer::MakeCombinedFitter ( TF1 * func)
staticprivate

Definition at line 2308 of file ZDCPulseAnalyzer.cxx.

2309{
2310 TVirtualFitter::SetDefaultFitter("Minuit");
2311
2312 size_t nFitParams = func->GetNpar() + 1;
2313 std::unique_ptr<TFitter> fitter = std::make_unique<TFitter>(nFitParams);
2314
2315 fitter->GetMinuit()->fISW[4] = -1;
2316 fitter->SetParameter(0, "delayBaselineAdjust", 0, 0.01, -100, 100);
2317
2318 for (size_t ipar = 0; ipar < nFitParams - 1; ipar++) {
2319 double parLimitLow, parLimitHigh;
2320
2321 func->GetParLimits(ipar, parLimitLow, parLimitHigh);
2322 if (std::abs(parLimitHigh - parLimitLow) < (1e-6)*std::abs(parLimitLow)) {
2323 double value = func->GetParameter(ipar);
2324 double lowLim = std::min(value * 0.99, value * 1.01);
2325 double highLim = std::max(value * 0.99, value * 1.01);
2326
2327 fitter->SetParameter(ipar + 1, func->GetParName(ipar), func->GetParameter(ipar), 0.01, lowLim, highLim);
2328 fitter->FixParameter(ipar + 1);
2329 }
2330 else {
2331 double value = func->GetParameter(ipar);
2332 if (value >= parLimitHigh) value = parLimitHigh * 0.99;
2333 else if (value <= parLimitLow) value = parLimitLow * 1.01;
2334
2335 double step = std::min((parLimitHigh - parLimitLow)/100., (value - parLimitLow)/100.);
2336
2337 fitter->SetParameter(ipar + 1, func->GetParName(ipar), value, step, parLimitLow, parLimitHigh);
2338 }
2339 }
2340
2342
2343 return fitter;
2344}
static void CombinedPulsesFCN(int &numParam, double *, double &f, double *par, int flag)
const ShapeFitter * fitter

◆ obtainDelayedBaselineCorr()

float ZDCPulseAnalyzer::obtainDelayedBaselineCorr ( const std::vector< float > & samples)
staticprivate

Definition at line 2694 of file ZDCPulseAnalyzer.cxx.

2695{
2696 const unsigned int nsamples = samples.size();
2697
2698 std::vector<float> derivVec = calculateDerivative(samples, 2);
2699 std::vector<float> deriv2ndVec = calculate2ndDerivative(samples, 2);
2700
2701 // Now step through and check even and odd samples values for 2nd derivative and derivative
2702 // we start with index 2 since the 2nd derivative calculation has 2 initial zeros with nstep = 2
2703 //
2704 float minScore = 1.0e9;
2705 unsigned int minIndex = 0;
2706
2707 for (unsigned int idx = 2; idx < nsamples - 1; idx++) {
2708 float deriv = derivVec[idx];
2709 float prevDeriv = derivVec[idx - 1];
2710
2711 float derivDiff = deriv - prevDeriv;
2712
2713 float deriv2nd = deriv2ndVec[idx];
2714 if (idx > nsamples - 2) deriv2nd = deriv2ndVec[idx - 1];
2715
2716 // Calculate a score based on the actual derivatives (squared) and 2nd derivatives (squared)
2717 // and the slope differences (squared). The relative weights are not adjustable for now
2718 //
2719 float score = (deriv*deriv + 2*derivDiff*derivDiff +
2720 0.5*deriv2nd*deriv2nd);
2721
2722 if (score < minScore) {
2723 minScore = score;
2724 minIndex = idx;
2725 }
2726 }
2727
2728 // We use four samples, two each of "even" and "odd".
2729 // Because of the way the above analysis is done, we can always
2730 // Go back one even and one odd sample and forward one odd sample.
2731 //
2732 //if minIndex is < 2 or >samples.size() the result is undefined; prevent this:
2733 if (minIndex<2 or (minIndex+1) >=nsamples){
2734 throw std::out_of_range("minIndex out of range in ZDCPulseAnalyzer::obtainDelayedBaselineCorr");
2735 }
2736 float sample0 = samples[minIndex - 2];
2737 float sample1 = samples[minIndex - 1];
2738 float sample2 = samples[minIndex];
2739 float sample3 = samples[minIndex + 1];
2740
2741 // Possibility -- implement logarithmic interpolation for large 2nd derivative?
2742 //
2743 float baselineCorr = (0.5 * (sample1 - sample0 + sample3 - sample2) -
2744 0.25 * (sample3 - sample1 + sample2 - sample0));
2745
2746 if (minIndex % 2 != 0) baselineCorr =-baselineCorr;
2747
2748 return baselineCorr;
2749}
static std::vector< float > calculateDerivative(const std::vector< float > &inputData, unsigned int step)

◆ postPulse()

bool ZDCPulseAnalyzer::postPulse ( ) const
inline

Definition at line 687 of file ZDCPulseAnalyzer.h.

687{return m_postPulse;}

◆ preExpTail()

bool ZDCPulseAnalyzer::preExpTail ( ) const
inline

Definition at line 694 of file ZDCPulseAnalyzer.h.

694{return m_preExpTail;}

◆ prepareLGRefit()

void ZDCPulseAnalyzer::prepareLGRefit ( const std::vector< float > & samplesLG,
const std::vector< float > & samplesNoise,
const std::vector< bool > & useSamples )
private

Definition at line 1778 of file ZDCPulseAnalyzer.cxx.

1780{
1781 m_samplesLGRefit.clear();
1782 m_samplesNoiseLGRefit.clear();
1783
1784 float presampleLG = m_ADCSamplesLGSub[m_usedPresampIdx];
1785
1786 // Do the presample subtraction
1787 //
1788 for (unsigned int idx = 0; idx < samplesLG.size(); idx++) {
1789 m_samplesLGRefit.push_back(samplesLG[idx] - presampleLG);
1790
1791 if (useSamples[idx]) {
1792 m_samplesNoiseLGRefit.push_back(samplesNoise[idx]);
1793 }
1794 else {
1795 m_samplesNoiseLGRefit.push_back(0);
1796 }
1797 }
1798}

◆ prePulse()

bool ZDCPulseAnalyzer::prePulse ( ) const
inline

Definition at line 686 of file ZDCPulseAnalyzer.h.

686{return m_prePulse;}

◆ PSHGOverUnderflow()

bool ZDCPulseAnalyzer::PSHGOverUnderflow ( ) const
inline

Definition at line 682 of file ZDCPulseAnalyzer.h.

◆ quietFits()

bool ZDCPulseAnalyzer::quietFits ( ) const
inline

Definition at line 548 of file ZDCPulseAnalyzer.h.

548{return m_quietFits;}

◆ ReanalyzeData()

bool ZDCPulseAnalyzer::ReanalyzeData ( )

Definition at line 1030 of file ZDCPulseAnalyzer.cxx.

1031{
1032 reset(true);
1033
1034 bool result = DoAnalysis(true);
1035 if (result && havePulse()) {
1036 m_repassPulse = true;
1037 }
1038
1039 return result;
1040}

◆ repassPulse()

bool ZDCPulseAnalyzer::repassPulse ( ) const
inline

Definition at line 696 of file ZDCPulseAnalyzer.h.

696{return m_repassPulse;}

◆ reset()

void ZDCPulseAnalyzer::reset ( bool reanalyze = false)
private

Definition at line 389 of file ZDCPulseAnalyzer.cxx.

390{
391 if (!repass) {
392 m_haveData = false;
393
394 m_useLowGain = false;
395 m_fail = false;
396 m_HGOverflow = false;
397
398 m_HGUnderflow = false;
399 m_PSHGOverUnderflow = false;
400 m_LGOverflow = false;
401 m_LGUnderflow = false;
402
403 m_ExcludeEarly = false;
404 m_ExcludeLate = false;
405
406 m_adjTimeRangeEvent = false;
407 m_backToHG_pre = false;
408 m_fixPrePulse = false;
409 m_underflowExclusion = false;
410
411 m_minADCLG = -1;
412 m_maxADCLG = -1;
413 m_minADCHG = -1;
414 m_maxADCHG = -1;
415
416 m_minADCSampleHG = -1;
417 m_maxADCSampleHG = -1;
418 m_minADCSampleLG = -1;
419 m_maxADCSampleLG = -1;
420
421 m_ADCPeakHG = -1;
422 m_ADCPeakLG = -1;
423
426
427 m_useSampleHG.assign(m_NSamplesAna, true);
428 m_useSampleLG.assign(m_NSamplesAna, true);
429
432 }
433 else {
435 }
436
439 }
440 else {
442 }
443
444 m_minSampleEvt = 0;
446
448
451
454
455 m_fitPulls.assign(m_NSamplesAna, 0);
456 }
457
458
461
462 if (m_initializedFits) {
465
466 if (m_doPrePulseCheck) {
471 }
472 }
473
474 // -----------------------
475 // Statuses
476 //
477 m_havePulse = false;
478
479 m_prePulse = false;
480 m_postPulse = false;
481 m_fitFailed = false;
482 m_badChisq = false;
483
484 m_badT0 = false;
485 m_preExpTail = false;
486 m_repassPulse = false;
487
488 m_fitMinAmp = false;
489 m_evtLGRefit = false;
490 m_failSigCut = false;
491
492 // -----------------------
493
495
496 m_fitAmplitude = 0;
497 m_ampNoNonLin = 0;
498 m_fitTime = -100;
499 m_fitTimeSub = -100;
500 m_fitTimeCorr = -100;
501 m_fitTCorr2nd = -100;
502
503 m_fitPreT0 = -100;
504 m_fitPreAmp = -100;
505 m_fitPostT0 = -100;
506 m_fitPostAmp = -100;
507 m_fitExpAmp = -100;
508
509 m_minDeriv2ndSig = -10;
510 m_preExpSig = -10;
511 m_prePulseSig = -10;
512
513 m_fitChisq = 0;
514 m_chisqRatio = 0;
515
516 m_amplitude = 0;
517 m_ampError = 0;
518 m_preSampleAmp = 0;
519 m_preAmplitude = 0;
520 m_postAmplitude = 0;
521 m_expAmplitude = 0;
523
524 m_refitLGAmpl = 0;
526 m_refitLGChisq = 0;
527 m_refitLGTime = -100;
528 m_refitLGTimeSub = -100;
529
532
534
535 m_initialExpAmp = 0;
536 m_fitPostT0lo = 0;
537
538 m_fitPulls.clear();
539
540 m_samplesSub.clear();
541 m_samplesDeriv2nd.clear();
542}

◆ saveFitFunc()

void ZDCPulseAnalyzer::saveFitFunc ( bool save)
inline

Definition at line 546 of file ZDCPulseAnalyzer.h.

save(self, fileName="./columbo.out")
Definition checkTP.py:176

◆ ScanAndSubtractSamples()

bool ZDCPulseAnalyzer::ScanAndSubtractSamples ( )
private

Definition at line 1042 of file ZDCPulseAnalyzer.cxx.

1043{
1044 //
1045 // Dump samples to verbose output
1046 //
1047 bool doDump = (*m_msgFunc_p)(ZDCMsg::Verbose, "Dumping all samples before subtraction: ");
1048 if (doDump) {
1049 std::ostringstream dumpStringHG;
1050 dumpStringHG << "HG: ";
1051 for (auto val : m_ADCSamplesHG) {
1052 dumpStringHG << std::setw(4) << val << " ";
1053 }
1054
1055 (*m_msgFunc_p)(ZDCMsg::Verbose, dumpStringHG.str().c_str());
1056
1057
1058 // Now low gain
1059 //
1060 std::ostringstream dumpStringLG;
1061 dumpStringLG << "LG: " << std::setw(4) << std::setfill(' ');
1062 for (auto val : m_ADCSamplesLG) {
1063 dumpStringLG << std::setw(4) << val << " ";
1064 }
1065
1066 (*m_msgFunc_p)(ZDCMsg::Verbose, dumpStringLG.str().c_str());
1067 }
1068
1069 // Now do pedestal subtraction and check for overflows
1070 //
1073
1074 m_maxADCHG = 0;
1075 m_maxADCLG = 0;
1076
1077 for (size_t isample = 0; isample < m_NSamplesAna; isample++) {
1078 float ADCHG = m_ADCSamplesHG[isample];
1079 float ADCLG = m_ADCSamplesLG[isample];
1080
1081 //
1082 // We always pedestal subtract even if the sample isn't going to be used in analysis
1083 // basically for diagnostics
1084 //
1085 m_ADCSamplesHGSub[isample] = ADCHG - m_pedestal;
1086 m_ADCSamplesLGSub[isample] = ADCLG - m_pedestal;
1087
1088
1089 // If we have the per-sample FADC correction, we apply it after pedestal correction
1090 // since we analyze the FADC response after baseline (~ same as pedestal) subtraction
1091 //
1093 double fadcCorrHG = m_FADCCorrHG->Interpolate(m_ADCSamplesHGSub[isample]);
1094 double fadcCorrLG = m_FADCCorrLG->Interpolate(m_ADCSamplesLGSub[isample]);
1095
1096 m_ADCSamplesHGSub[isample] *= fadcCorrHG;
1097 m_ADCSamplesLGSub[isample] *= fadcCorrLG;
1098
1099 // if (doDump) {
1100 // std::ostringstream dumpString;
1101 // dumpString << "After FADC correction, sample " << isample << ", HG ADC = " << m_ADCSamplesHGSub[isample]
1102 // << ", LG ADC = " << m_ADCSamplesLGSub[isample] << std::endl;
1103 // (*m_msgFunc_p)(ZDCMsg::Verbose, dumpString.str().c_str());
1104 // }
1105 }
1106
1107 if (ADCHG > m_maxADCHG) {
1108 m_maxADCHG = ADCHG;
1109 m_maxADCSampleHG = isample;
1110 }
1111 else if (ADCHG < m_minADCHG) {
1112 m_minADCHG = ADCHG;
1113 m_minADCSampleHG = isample;
1114 }
1115
1116 if (ADCLG > m_maxADCLG) {
1117 m_maxADCLG = ADCLG;
1118 m_maxADCSampleLG = isample;
1119 }
1120 else if (ADCLG < m_minADCLG) {
1121 m_minADCLG = ADCLG;
1122 m_minADCSampleLG = isample;
1123 }
1124
1125 if (m_useSampleHG[isample]) {
1126 bool skipOverflowCheck = false;
1127
1128 if (m_enablePreExcl) {
1129 if (ADCHG > m_preExclHGADCThresh && isample < m_maxSamplesPreExcl) {
1130 m_useSampleHG[isample] = false;
1131 m_ExcludeEarly = true;
1132 skipOverflowCheck = true;
1133 }
1134 }
1135
1136 if (m_enablePostExcl) {
1137 if (ADCHG > m_postExclHGADCThresh && isample >= m_NSamplesAna - m_maxSamplesPostExcl) {
1138 m_useSampleHG[isample] = false;
1139 m_ExcludeLate = true;
1140 skipOverflowCheck = true;
1141 }
1142 }
1143
1144 // If we get here, we've passed the above filters on the sample
1145 //
1146 if (!skipOverflowCheck && ADCHG > m_HGOverflowADC) {
1147 m_HGOverflow = true;
1148
1149 if (isample == m_preSampleIdx) m_PSHGOverUnderflow = true;
1150
1151 // Note: the implementation of the explicit pre- and post- sample exclusion should make this
1152 // code obselete but before removing it we first need to validate the pre- and post-exclusion
1153 //
1154 if ((int) isample > m_lastHGOverFlowSample) m_lastHGOverFlowSample = isample;
1155 if ((int) isample < m_firstHGOverFlowSample) m_firstHGOverFlowSample = isample;
1156 }
1157 else if (ADCHG < m_HGUnderflowADC) {
1160 m_useSampleHG[isample] = false;
1161 m_underflowExclusion = true;
1162 }
1163 else {
1164 m_HGUnderflow = true;
1165
1166 if (isample == m_preSampleIdx) m_PSHGOverUnderflow = true;
1167 }
1168 }
1169 }
1170
1171 // Now the low gain sample
1172 //
1173 if (m_useSampleLG[isample]) {
1174 bool skipOverflowCheck = false;
1175
1176 if (m_enablePreExcl) {
1177 if (ADCLG > m_preExclLGADCThresh && isample <= m_maxSamplesPreExcl) {
1178 m_useSampleLG[isample] = false;
1179 skipOverflowCheck = true;
1180 }
1181 }
1182
1183 if (m_enablePostExcl) {
1184 if (ADCLG > m_postExclLGADCThresh && isample >= m_NSamplesAna - m_maxSamplesPostExcl) {
1185 m_useSampleLG[isample] = false;
1186 skipOverflowCheck = true;
1187 }
1188 }
1189
1190 if (!skipOverflowCheck && ADCLG > m_LGOverflowADC) {
1191 m_LGOverflow = true;
1192 m_fail = true;
1193 m_amplitude = m_LGOverflowADC * m_gainFactorLG; // Give a vale here even though we know it's wrong because
1194 // the user may not check the return value and we know that
1195 // amplitude is bigger than this
1196 }
1197
1198 if (ADCLG == 0) {
1201 m_underflowExclusion = true;
1202 m_useSampleLG[isample] = false;
1203 }
1204 else {
1205 m_LGUnderflow = true;
1206 m_fail = true;
1207 }
1208 }
1209 }
1210 }
1211
1212 // if (doDump) {
1213 // (*m_msgFunc_p)(ZDCMsg::Verbose, "Dump of useSamples: ");
1214
1215 // std::ostringstream dumpStringUseHG;
1216 // dumpStringUseHG << "HG: ";
1217 // for (auto val : m_useSampleHG) {
1218 // dumpStringUseHG << val << " ";
1219 // }
1220 // (*m_msgFunc_p)(ZDCMsg::Verbose, dumpStringUseHG.str().c_str());
1221
1222 // std::ostringstream dumpStringUseLG;
1223 // dumpStringUseLG << "LG: ";
1224 // for (auto val : m_useSampleLG) {
1225 // dumpStringUseLG << val << " ";
1226 // }
1227 // (*m_msgFunc_p)(ZDCMsg::Verbose, dumpStringUseLG.str().c_str());
1228 // }
1229
1230 // This ugly code should be obseleted by the introduction of the better, pre- and post-sample exclusion but
1231 // that code still has to be fully validated.
1232 //
1233 // See if we can still use high gain even in the case of HG overflow if the overflow results from
1234 // the first few samples or the last few samples
1235 //
1236 // if (m_HGOverflow && !m_HGUnderflow) {
1237 // if (m_lastHGOverFlowSample < 2 && m_lastHGOverFlowSample > -1) {
1238 // m_HGOverflow = false;
1239 // m_minSampleEvt = m_lastHGOverFlowSample + 1;
1240 // m_adjTimeRangeEvent = true;
1241 // m_backToHG_pre = true;
1242 // m_ExcludeEarly = true;
1243 // }
1244 // else if (m_firstHGOverFlowSample < static_cast<int>(m_NSamplesAna) && m_firstHGOverFlowSample >= static_cast<int>(m_NSamplesAna - 2) ) {
1245 // m_maxSampleEvt = m_firstHGOverFlowSample - 1;
1246 // m_HGOverflow = false;
1247 // m_adjTimeRangeEvent = true;
1248 // m_ExcludeLate = true;
1249 // }
1250 // }
1251
1252 return true;
1253}

◆ set2ndDerivStep()

void ZDCPulseAnalyzer::set2ndDerivStep ( size_t step)
inline

Definition at line 592 of file ZDCPulseAnalyzer.h.

◆ SetADCOverUnderflowValues()

void ZDCPulseAnalyzer::SetADCOverUnderflowValues ( int HGOverflowADC,
int HGUnderflowADC,
int LGOverflowADC )

Definition at line 602 of file ZDCPulseAnalyzer.cxx.

603{
604 m_HGOverflowADC = HGOverflowADC;
605 m_LGOverflowADC = LGOverflowADC;
606 m_HGUnderflowADC = HGUnderflowADC;
607}

◆ SetChisqCuts()

void ZDCPulseAnalyzer::SetChisqCuts ( float chisqDivAmpCutHG,
float chisqDivAmpScaleHG,
float chisqDivAmpOffsetHG,
float chisqDivAmpPowerHG,
float chisqDivAmpCutLG,
float chisqDivAmpScaleLG,
float chisqDivAmpOffsetLG,
float chisqDivAmpPowerLG )

Definition at line 642 of file ZDCPulseAnalyzer.cxx.

644{
645 m_chisqDivAmpCutHG = chisqDivAmpCutHG;
646 m_chisqDivAmpScaleHG = chisqDivAmpScaleHG;
647 m_chisqDivAmpOffsetHG = chisqDivAmpOffsetHG;
648 m_chisqDivAmpPowerHG = chisqDivAmpPowerHG;
649
650 m_chisqDivAmpCutLG = chisqDivAmpCutLG;
651 m_chisqDivAmpScaleLG = chisqDivAmpScaleLG;
652 m_chisqDivAmpOffsetLG = chisqDivAmpOffsetLG;
653 m_chisqDivAmpPowerLG = chisqDivAmpPowerLG;
654}

◆ SetCutValues()

void ZDCPulseAnalyzer::SetCutValues ( float chisqDivAmpCutHG,
float chisqDivAmpCutLG,
float deltaT0MinHG,
float deltaT0MaxHG,
float deltaT0MinLG,
float deltaT0MaxLG )

Definition at line 609 of file ZDCPulseAnalyzer.cxx.

612{
613 m_chisqDivAmpCutHG = chisqDivAmpCutHG;
614 m_chisqDivAmpCutLG = chisqDivAmpCutLG;
615
618
621
624
625 m_T0CutLowHG = deltaT0MinHG;
626 m_T0CutLowLG = deltaT0MinLG;
627
628 m_T0CutHighHG = deltaT0MaxHG;
629 m_T0CutHighLG = deltaT0MaxLG;
630}

◆ setDefaults()

void ZDCPulseAnalyzer::setDefaults ( )
private

Definition at line 281 of file ZDCPulseAnalyzer.cxx.

282{
284
285 m_nominalTau1HG = 1.5;
286 m_nominalTau1LG = 1.5;
287 m_nominalTau2HG = 5;
288 m_nominalTau2LG = 5;
289
290 m_fixTau1HG = false;
291 m_fixTau2HG = false;
292
293 m_fixTau1LG = false;
294 m_fixTau2LG = false;
295
298 m_inductbILG = -1;
299 m_inductbIHG = -1;
300
301 m_HGOverflowADC = 3500;
303 m_LGOverflowADC = 3900;
304
305 // Default values for the gain factors uswed to match low and high gain
306 //
307 m_gainFactorLG = 10;
308 m_gainFactorHG = 1;
309
310 m_2ndDerivStep = 1;
311
312 m_noiseSigHG = 1;
313 m_noiseSigLG = 1;
314
315 m_sigMinLG = 0;
316 m_sigMinHG = 0;
317
318 m_timeCutMode = 0;
319 m_chisqDivAmpCutLG = 100;
320 m_chisqDivAmpCutHG = 100;
321
324
327
330
331 m_LGT0CorrParams.assign(6, 0);
332 m_HGT0CorrParams.assign(6, 0);
333
334 // m_defaultFitTMax = m_tmax;
335 // m_defaultFitTMin = m_tmin;
336
337 m_fitAmpMinHG = 1;
338 m_fitAmpMinLG = 1;
339
340 m_fitAmpMaxHG = 1500;
341 m_fitAmpMaxLG = 1500;
342
343 m_haveSignifCuts = false;
344
346
347 m_doPostPulseCheck = true;
352
353 m_doPrePulseCheck = true;
354 m_prePulseDelta = 2;
355
358
360
361 m_initialExpAmp = 0;
362 m_fitPostT0lo = 0;
363
364 m_useDelayed = false;
365 m_enablePreExcl = false;
366 m_enablePostExcl = false;
367
369 m_haveNonlinCorr = false;
370 m_quietFits = true;
371 m_saveFitFunc = false;
372 m_fitOptions = "s";
373}

◆ SetFitMinMaxAmp()

void ZDCPulseAnalyzer::SetFitMinMaxAmp ( float minAmpHG,
float minAmpLG,
float maxAmpHG,
float maxAmpLG )

Definition at line 558 of file ZDCPulseAnalyzer.cxx.

559{
560 m_fitAmpMinHG = minAmpHG;
561 m_fitAmpMinLG = minAmpLG;
562
563 m_fitAmpMaxHG = maxAmpHG;
564 m_fitAmpMaxLG = maxAmpLG;
565}

◆ setFitOPtions()

void ZDCPulseAnalyzer::setFitOPtions ( const std::string & fitOptions)
inline

Definition at line 545 of file ZDCPulseAnalyzer.h.

545{ m_fitOptions = fitOptions;}

◆ SetFitTimeMax()

void ZDCPulseAnalyzer::SetFitTimeMax ( float tmax)

Definition at line 590 of file ZDCPulseAnalyzer.cxx.

591{
592 if (tmax < m_tmin) {
593 (*m_msgFunc_p)(ZDCMsg::Error, ("ZDCPulseAnalyzer::SetFitTimeMax:: invalid FitTimeMax: " + std::to_string(tmax)));
594 return;
595 }
596
597 m_defaultFitTMax = std::min(tmax, m_defaultFitTMax);
598
600}

◆ SetGainFactorsHGLG()

void ZDCPulseAnalyzer::SetGainFactorsHGLG ( float gainFactorHG,
float gainFactorLG )

Definition at line 552 of file ZDCPulseAnalyzer.cxx.

553{
554 m_gainFactorHG = gainFactorHG;
555 m_gainFactorLG = gainFactorLG;
556}

◆ setLGMode()

void ZDCPulseAnalyzer::setLGMode ( unsigned int mode)
inline

Definition at line 589 of file ZDCPulseAnalyzer.h.

◆ setMinimumSignificance()

void ZDCPulseAnalyzer::setMinimumSignificance ( float sigMinHG,
float sigMinLG )

Definition at line 545 of file ZDCPulseAnalyzer.cxx.

546{
547 m_haveSignifCuts = true;
548 m_sigMinHG = sigMinHG;
549 m_sigMinLG = sigMinLG;
550}

◆ SetNoiseSigmas()

void ZDCPulseAnalyzer::SetNoiseSigmas ( float noiseSigHG,
float noiseSigLG )
inline

Definition at line 604 of file ZDCPulseAnalyzer.h.

605 {
606 m_noiseSigHG = noiseSigHG;
607 m_noiseSigLG = noiseSigLG;
608 }

◆ SetNonlinCorrParams()

void ZDCPulseAnalyzer::SetNonlinCorrParams ( float refADC,
float refScale,
const std::vector< float > & paramsHG,
const std::vector< float > & paramsLG )
inline

Definition at line 638 of file ZDCPulseAnalyzer.h.

639 {
640 std::string HGParamsStr = "HG coefficients = ", LGParamsStr = "LG coefficients = ";
641
642 for (auto val : paramsHG) {HGParamsStr += std::to_string(val) + " ";}
643 for (auto val : paramsLG) {LGParamsStr += std::to_string(val) + " ";}
644
645 (*m_msgFunc_p)(ZDCMsg::Info, ("Setting non-linear parameters for module: " + m_tag + ", reference ADC = " +
646 std::to_string(refADC) + ", reference scale = " + std::to_string(refScale)));
647
648 (*m_msgFunc_p)(ZDCMsg::Info, std::move(HGParamsStr));
649 (*m_msgFunc_p)(ZDCMsg::Info, std::move(LGParamsStr));
650
651 m_nonLinCorrRefADC = refADC;
652 m_nonLinCorrRefScale = refScale;
653 m_nonLinCorrParamsHG = paramsHG;
654 m_nonLinCorrParamsLG = paramsLG;
655 m_haveNonlinCorr = true;
656 }

◆ SetPeak2ndDerivMinTolerance()

void ZDCPulseAnalyzer::SetPeak2ndDerivMinTolerance ( size_t tolerance)
inline

Definition at line 576 of file ZDCPulseAnalyzer.h.

576 {
578 m_initializedFits = false;
579 }
constexpr double tolerance

◆ setPerSampleNoiseSigmas()

void ZDCPulseAnalyzer::setPerSampleNoiseSigmas ( const std::vector< float > & sigmaHG,
const std::vector< float > & sigmaLG )
inline

Definition at line 581 of file ZDCPulseAnalyzer.h.

582 {
583 m_setPerSampleNoiseHG = sigmaHG;
584 m_setPerSampleNoiseLG = sigmaLG;
587 }

◆ setQuietFits()

void ZDCPulseAnalyzer::setQuietFits ( )
inline

Definition at line 549 of file ZDCPulseAnalyzer.h.

549{m_quietFits = true;}

◆ SetTauT0Values()

void ZDCPulseAnalyzer::SetTauT0Values ( bool fixTau1,
bool fixTau2,
float tau1,
float tau2,
float t0HG,
float t0LG )

Definition at line 567 of file ZDCPulseAnalyzer.cxx.

568{
569 m_fixTau1HG = fixTau1;
570 m_fixTau1LG = fixTau1;
571 m_fixTau2HG = fixTau2;
572 m_fixTau2LG = fixTau2;
573 m_nominalTau1HG = tau1;
574 m_nominalTau2HG = tau2;
575 m_nominalTau1LG = tau1;
576 m_nominalTau2LG = tau2;
577
578 m_nominalT0HG = t0HG;
579 m_nominalT0LG = t0LG;
580
581 std::ostringstream ostrm;
582 ostrm << "ZDCPulseAnalyzer::SetTauT0Values:: fixTau1 = " << fixTau1 << ", fixTau2 = " << fixTau2 << ", nominalTau1 = "
583 << tau1 << ", nominalTau2=" << tau2 << ", m_nominalT0HG=" << m_nominalT0HG << " m_nominalT0LG=" << m_nominalT0LG;
584
585 (*m_msgFunc_p)(ZDCMsg::Info, ostrm.str());
586
587 m_initializedFits = false;
588}

◆ SetTimeCuts()

void ZDCPulseAnalyzer::SetTimeCuts ( float deltaT0MinHG,
float deltaT0MaxHG,
float deltaT0MinLG,
float deltaT0MaxLG )

Definition at line 632 of file ZDCPulseAnalyzer.cxx.

634{
635 m_T0CutLowHG = deltaT0MinHG;
636 m_T0CutLowLG = deltaT0MinLG;
637
638 m_T0CutHighHG = deltaT0MaxHG;
639 m_T0CutHighLG = deltaT0MaxLG;
640}

◆ SetTimingCorrParams()

void ZDCPulseAnalyzer::SetTimingCorrParams ( TimingCorrMode mode,
float refADC,
float refScale,
const std::vector< float > & HGT0CorrParams,
const std::vector< float > & LGT0CorrParams )
inline

Definition at line 623 of file ZDCPulseAnalyzer.h.

625 {
627 if (mode != NoTimingCorr) {
628 m_timingCorrRefADC = refADC;
629 m_timingCorrScale = refScale;
630
631 m_HGT0CorrParams = HGT0CorrParams;
632 m_LGT0CorrParams = LGT0CorrParams;
633 }
634 }

◆ setUnquietFits()

void ZDCPulseAnalyzer::setUnquietFits ( )
inline

Definition at line 550 of file ZDCPulseAnalyzer.h.

550{m_quietFits = false;}

◆ SetupFitFunctions()

void ZDCPulseAnalyzer::SetupFitFunctions ( )
private

Definition at line 796 of file ZDCPulseAnalyzer.cxx.

797{
798 float prePulseTMin = 0;
799 float prePulseTMax = prePulseTMin + m_deltaTSample * (m_peak2ndDerivMinSample - m_peak2ndDerivMinTolerance);
800
801 std::string tagHG = m_tag + "HG";
802 std::string tagLG = m_tag + "LG";
803
804 if (m_fitFunction == "FermiExp") {
805 if (!m_fixTau1HG || !m_fixTau2HG) {
806 //
807 // Use the variable tau version of the expFermiFit
808 //
809 m_defaultFitWrapperHG = std::unique_ptr<ZDCFitWrapper>(new ZDCFitExpFermiVariableTaus(tagHG, m_tmin, m_tmax, m_fixTau1HG, m_fixTau2HG, m_nominalTau1HG, m_nominalTau2HG));
810 }
811 else {
812 m_defaultFitWrapperHG = std::unique_ptr<ZDCFitWrapper>(new ZDCFitExpFermiFixedTaus(tagHG, m_tmin, m_tmax, m_nominalTau1HG, m_nominalTau2HG));
813 }
814
815 if (!m_fixTau1LG || !m_fixTau2LG) {
816 m_defaultFitWrapperLG = std::unique_ptr<ZDCFitWrapper>(new ZDCFitExpFermiVariableTaus(tagLG, m_tmin, m_tmax, m_fixTau1LG, m_fixTau2LG, m_nominalTau1LG, m_nominalTau2LG));
817 }
818 else {
819 m_defaultFitWrapperLG = std::unique_ptr<ZDCFitWrapper>(new ZDCFitExpFermiFixedTaus(tagLG, m_tmin, m_tmax, m_nominalTau1LG, m_nominalTau2LG));
820 }
821
822 if (m_doPrePulseCheck) {
823 m_preExpFitWrapperHG = std::unique_ptr<ZDCFitExpFermiPreExp>(new ZDCFitExpFermiPreExp(tagHG, m_tmin, m_tmax, m_nominalTau1HG, m_nominalTau2HG, m_nominalTau2HG, false));
824 m_preExpFitWrapperLG = std::unique_ptr<ZDCFitExpFermiPreExp>(new ZDCFitExpFermiPreExp(tagLG, m_tmin, m_tmax, m_nominalTau1LG, m_nominalTau2LG, m_nominalTau2LG, false));
825
826 m_prePulseFitWrapperHG = std::unique_ptr<ZDCPrePulseFitWrapper>(new ZDCFitExpFermiPrePulse(tagHG, m_tmin, m_tmax, m_nominalTau1HG, m_nominalTau2HG));
827 m_prePulseFitWrapperLG = std::unique_ptr<ZDCPrePulseFitWrapper>(new ZDCFitExpFermiPrePulse(tagLG, m_tmin, m_tmax, m_nominalTau1LG, m_nominalTau2LG));
828 }
829 }
830 else if (m_fitFunction == "FermiExpRun3") {
831 if (!m_fixTau1HG || !m_fixTau2HG) {
832 //
833 // Use the variable tau version of the expFermiFit
834 //
835 m_defaultFitWrapperHG = std::unique_ptr<ZDCFitWrapper>(new ZDCFitExpFermiVariableTausRun3(tagHG, m_tmin, m_tmax, m_fixTau1HG, m_fixTau2HG, m_nominalTau1HG, m_nominalTau2HG));
836 }
837 else {
838 m_defaultFitWrapperHG = std::unique_ptr<ZDCFitWrapper>(new ZDCFitExpFermiFixedTaus(tagHG, m_tmin, m_tmax, m_nominalTau1HG, m_nominalTau2HG));
839 }
840
841 if (!m_fixTau1LG || !m_fixTau2LG) {
842 m_defaultFitWrapperLG = std::unique_ptr<ZDCFitWrapper>(new ZDCFitExpFermiVariableTausRun3(tagLG, m_tmin, m_tmax, m_fixTau1LG, m_fixTau2LG, m_nominalTau1LG, m_nominalTau2LG));
843 }
844 else {
845 m_defaultFitWrapperLG = std::unique_ptr<ZDCFitWrapper>(new ZDCFitExpFermiFixedTaus(tagLG, m_tmin, m_tmax, m_nominalTau1LG, m_nominalTau2LG));
846 }
847
848 if (m_doPrePulseCheck) {
849 m_preExpFitWrapperHG = std::unique_ptr<ZDCFitExpFermiPreExp>(new ZDCFitExpFermiPreExp(tagHG, m_tmin, m_tmax, m_nominalTau1HG, m_nominalTau2HG, m_nominalTau2HG, false));
850 m_preExpFitWrapperLG = std::unique_ptr<ZDCFitExpFermiPreExp>(new ZDCFitExpFermiPreExp(tagLG, m_tmin, m_tmax, m_nominalTau1LG, m_nominalTau2LG, m_nominalTau2LG, false));
851
852 m_prePulseFitWrapperHG = std::unique_ptr<ZDCPrePulseFitWrapper>(new ZDCFitExpFermiPrePulse(tagHG, m_tmin, m_tmax, m_nominalTau1HG, m_nominalTau2HG));
853 m_prePulseFitWrapperLG = std::unique_ptr<ZDCPrePulseFitWrapper>(new ZDCFitExpFermiPrePulse(tagLG, m_tmin, m_tmax, m_nominalTau1LG, m_nominalTau2LG));
854 }
855 }
856 else if (m_fitFunction == "FermiExpLHCf") {
857 //
858 // Use the variable tau version of the expFermiFit
859 //
860 m_defaultFitWrapperHG = std::unique_ptr<ZDCFitWrapper>(new ZDCFitExpFermiVariableTausLHCf(tagHG, m_tmin, m_tmax, m_fixTau1HG, m_fixTau2HG,
862 m_defaultFitWrapperLG = std::unique_ptr<ZDCFitWrapper>(new ZDCFitExpFermiVariableTausLHCf(tagLG, m_tmin, m_tmax, m_fixTau1LG, m_fixTau2LG,
864
865 if (m_doPrePulseCheck) {
866 m_preExpFitWrapperHG = std::unique_ptr<ZDCFitExpFermiLHCfPreExp>(new ZDCFitExpFermiLHCfPreExp(tagHG, m_tmin, m_tmax, m_nominalTau1HG, m_nominalTau2HG, m_nominalTau2HG, false));
867 m_preExpFitWrapperLG = std::unique_ptr<ZDCFitExpFermiLHCfPreExp>(new ZDCFitExpFermiLHCfPreExp(tagLG, m_tmin, m_tmax, m_nominalTau1LG, m_nominalTau2LG, m_nominalTau2LG, false));
868
869 m_prePulseFitWrapperHG = std::unique_ptr<ZDCPrePulseFitWrapper>(new ZDCFitExpFermiLHCfPrePulse(tagHG, m_tmin, m_tmax, m_nominalTau1HG, m_nominalTau2HG));
870 m_prePulseFitWrapperLG = std::unique_ptr<ZDCPrePulseFitWrapper>(new ZDCFitExpFermiLHCfPrePulse(tagLG, m_tmin, m_tmax, m_nominalTau1LG, m_nominalTau2LG));
871 }
872 }
873 else if (m_fitFunction == "FermiExpInduct") {
874 if (m_fitParameterSetHG == "") {
875 //
876 // Use the variable tau version of the expFermiFit
877 //
878 m_defaultFitWrapperHG = std::unique_ptr<ZDCFitWrapper>(new ZDCFitExpFermiVariableTausInduct(tagHG, m_tmin, m_tmax, m_fixTau1HG, m_fixTau2HG,
880 m_defaultFitWrapperLG = std::unique_ptr<ZDCFitWrapper>(new ZDCFitExpFermiVariableTausInduct(tagLG, m_tmin, m_tmax, m_fixTau1LG, m_fixTau2LG,
882 if (m_doPrePulseCheck) {
883 m_preExpFitWrapperHG = std::unique_ptr<ZDCFitExpFermiInductPreExp>(new ZDCFitExpFermiInductPreExp(tagHG, m_tmin, m_tmax, m_nominalTau1HG, m_nominalTau2HG, m_nominalTau2HG, false));
884 m_preExpFitWrapperLG = std::unique_ptr<ZDCFitExpFermiInductPreExp>(new ZDCFitExpFermiInductPreExp(tagLG, m_tmin, m_tmax, m_nominalTau1LG, m_nominalTau2LG, m_nominalTau2LG, false));
885
886 m_prePulseFitWrapperHG = std::unique_ptr<ZDCPrePulseFitWrapper>(new ZDCFitExpFermiInductPrePulse(tagHG, m_tmin, m_tmax, m_nominalTau1HG, m_nominalTau2HG));
887 m_prePulseFitWrapperLG = std::unique_ptr<ZDCPrePulseFitWrapper>(new ZDCFitExpFermiInductPrePulse(tagLG, m_tmin, m_tmax, m_nominalTau1LG, m_nominalTau2LG));
888 }
889 }
890 else {
891 //
892 // We have parameter set, use in constructing the fit wrapper
893 //
895 std::unique_ptr<ZDCFitWrapper>(new ZDCFitExpFermiVariableTausInduct(tagHG, m_fitParameterSetHG, m_tmin, m_tmax, m_fixTau1HG, m_fixTau2HG,
898 std::unique_ptr<ZDCFitWrapper>(new ZDCFitExpFermiVariableTausInduct(tagLG, m_fitParameterSetLG, m_tmin, m_tmax, m_fixTau1LG, m_fixTau2LG,
900 if (m_doPrePulseCheck) {
901 m_preExpFitWrapperHG = std::unique_ptr<ZDCFitExpFermiInductPreExp>(new ZDCFitExpFermiInductPreExp(tagHG, m_fitParameterSetHG, m_tmin, m_tmax, m_nominalTau1HG, m_nominalTau2HG));
902 m_preExpFitWrapperLG = std::unique_ptr<ZDCFitExpFermiInductPreExp>(new ZDCFitExpFermiInductPreExp(tagLG, m_fitParameterSetLG, m_tmin, m_tmax, m_nominalTau1LG, m_nominalTau2HG));
903
904 m_prePulseFitWrapperHG = std::unique_ptr<ZDCPrePulseFitWrapper>(new ZDCFitExpFermiInductPrePulse(tagHG, m_fitParameterSetHG, m_tmin, m_tmax, m_nominalTau1HG, m_nominalTau2HG));
905 m_prePulseFitWrapperLG = std::unique_ptr<ZDCPrePulseFitWrapper>(new ZDCFitExpFermiInductPrePulse(tagLG, m_fitParameterSetLG, m_tmin, m_tmax, m_nominalTau1LG, m_nominalTau2LG));
906 }
907 }
908 }
909 else if (m_fitFunction == "FermiExpLinear") {
910 if (!m_fixTau1HG || !m_fixTau2HG) {
911 //
912 // Use the variable tau version of the expFermiFit
913 //
914 m_defaultFitWrapperHG = std::unique_ptr<ZDCFitWrapper>(new ZDCFitExpFermiVariableTaus(tagHG, m_tmin, m_tmax, m_fixTau1HG, m_fixTau2HG, m_nominalTau1HG, m_nominalTau2HG));
915 }
916 else {
917 m_defaultFitWrapperHG = std::unique_ptr<ZDCFitWrapper>(new ZDCFitExpFermiLinearFixedTaus(tagHG, m_tmin, m_tmax, m_nominalTau1HG, m_nominalTau2HG));
918 }
919
920 if (!m_fixTau1LG || !m_fixTau2LG) {
921 m_defaultFitWrapperLG = std::unique_ptr<ZDCFitWrapper>(new ZDCFitExpFermiVariableTaus(tagLG, m_tmin, m_tmax, m_fixTau1LG, m_fixTau2LG, m_nominalTau1LG, m_nominalTau2LG));
922 }
923 else {
924 m_defaultFitWrapperLG = std::unique_ptr<ZDCFitWrapper>(new ZDCFitExpFermiLinearFixedTaus(tagLG, m_tmin, m_tmax, m_nominalTau1LG, m_nominalTau2LG));
925 }
926
927 if (m_doPrePulseCheck) {
928 m_preExpFitWrapperHG = std::unique_ptr<ZDCFitExpFermiPreExp>(new ZDCFitExpFermiPreExp(tagHG, m_tmin, m_tmax, m_nominalTau1HG, m_nominalTau2HG, m_nominalTau2HG, false));
929 m_preExpFitWrapperLG = std::unique_ptr<ZDCFitExpFermiPreExp>(new ZDCFitExpFermiPreExp(tagLG, m_tmin, m_tmax, m_nominalTau1LG, m_nominalTau2LG, m_nominalTau2LG, false));
930
931 m_prePulseFitWrapperHG = std::unique_ptr<ZDCPrePulseFitWrapper>(new ZDCFitExpFermiLinearPrePulse(tagHG, m_tmin, m_tmax, m_nominalTau1HG, m_nominalTau2HG));
932 m_prePulseFitWrapperLG = std::unique_ptr<ZDCPrePulseFitWrapper>(new ZDCFitExpFermiLinearPrePulse(tagLG, m_tmin, m_tmax, m_nominalTau1LG, m_nominalTau2LG));
933 }
934 }
935 else {
936 (*m_msgFunc_p)(ZDCMsg::Fatal, "Wrong fit function type: " + m_fitFunction);
937 }
938
939 if (m_doPrePulseCheck) {
940 m_prePulseFitWrapperHG->SetPrePulseT0Range(prePulseTMin, prePulseTMax);
941 m_prePulseFitWrapperLG->SetPrePulseT0Range(prePulseTMin, prePulseTMax);
942 }
943
944 m_initializedFits = true;
945}

◆ underflowExclusion()

bool ZDCPulseAnalyzer::underflowExclusion ( ) const
inline

Definition at line 699 of file ZDCPulseAnalyzer.h.

699{return m_underflowExclusion;}

◆ UpdateFitterTimeLimits()

void ZDCPulseAnalyzer::UpdateFitterTimeLimits ( TFitter * fitter,
ZDCFitWrapper * wrapper,
bool prePulse )
private

Definition at line 2346 of file ZDCPulseAnalyzer.cxx.

2347{
2348 double parLimitLow, parLimitHigh;
2349
2350 auto func_p = wrapper->GetWrapperTF1();
2351 func_p->GetParLimits(1, parLimitLow, parLimitHigh);
2352
2353 fitter->SetParameter(2, func_p->GetParName(1), func_p->GetParameter(1), 0.01, parLimitLow, parLimitHigh);
2354
2355 if (prePulse) {
2356 unsigned int parIndex = static_cast<ZDCPrePulseFitWrapper*>(wrapper)->GetPreT0ParIndex();
2357
2358 func_p->GetParLimits(parIndex, parLimitLow, parLimitHigh);
2359 fitter->SetParameter(parIndex + 1, func_p->GetParName(parIndex), func_p->GetParameter(parIndex), 0.01, parLimitLow, parLimitHigh);
2360 }
2361}
virtual std::shared_ptr< TF1 > GetWrapperTF1()

◆ useLowGain()

bool ZDCPulseAnalyzer::useLowGain ( ) const
inline

Definition at line 677 of file ZDCPulseAnalyzer.h.

677{return m_useLowGain;}

◆ ValidateJSONConfig()

std::pair< bool, std::string > ZDCPulseAnalyzer::ValidateJSONConfig ( const JSON & config)
private

Definition at line 2751 of file ZDCPulseAnalyzer.cxx.

2752{
2753 bool result = true;
2754 std::string resultString = "success";
2755
2756 for (auto [key, descr] : JSONConfigParams) {
2757 auto iter = config.find(key);
2758 if (iter != config.end()) {
2759 //
2760 // Check type consistency
2761 //
2762 auto jsonType = iter.value().type();
2763 auto paramType = std::get<0>(descr);
2764 if (jsonType != paramType) {
2765 result = false;
2766 resultString = "Bad type for parameter " + key + ", type in JSON = " + std::to_string((unsigned int) jsonType) ;
2767 break;
2768 }
2769
2770 size_t paramSize = std::get<1>(descr);
2771 size_t jsonSize = iter.value().size();
2772 if (jsonSize != paramSize) {
2773 result = false;
2774 resultString = "Bad length for parameter " + key + ", length in JSON = " + std::to_string(jsonSize) ;
2775 break;
2776 }
2777 }
2778 else {
2779 bool required = std::get<2>(descr);
2780 if (required) {
2781 result = false;
2782 resultString = "Missing required parameter " + key;
2783 break;
2784 }
2785 }
2786 }
2787
2788 if (result) {
2789 //
2790 // Now check that the parameters in the JSON object are in the master list of parameters
2791 //
2792 for (auto [key, value] : config.items()) {
2793 //
2794 // Look for this key in the list of allowed parameters. Yes, it's a slow
2795 // search but we only do it once at configuration time.
2796 //
2797 // bool found = false;
2798 auto iter = JSONConfigParams.find(key);
2799 if (iter == JSONConfigParams.end()) {
2800 result = false;
2801 resultString = "Unknown parameter, key = " + key;
2802 break;
2803 }
2804 }
2805 }
2806
2807 return {result, resultString};
2808}
static const ZDCJSONConfig::JSONParamList JSONConfigParams

Member Data Documentation

◆ JSONConfigParams

const ZDCJSONConfig::JSONParamList ZDCPulseAnalyzer::JSONConfigParams
static

Definition at line 34 of file ZDCPulseAnalyzer.h.

56 {
57 LGModeNormal = 0,
60 };
61
63
64 //
65 // List of allowed JSON configuration parameters
66 //
67 // For each parameter we have name, JSON value type, whether it can be set per channel, and whether it is required
68 //
69 // if the type is -1, then there's no value, the presence of the parameter itself is a boolean -- i.e. enabling
70 //
71
73private:
74 typedef std::vector<float>::const_iterator SampleCIter;
75
76 // Static data
77 //
78
79 static TH1* s_undelayedFitHist;
80 static TH1* s_delayedFitHist;
81 static TF1* s_combinedFitFunc;
82 static float s_combinedFitTMax;
83 static float s_combinedFitTMin;
84 static std::vector<float> s_pullValues;
85
86 // Quantities provided/set in the constructor
87 //
89 std::string m_tag{};
90 unsigned int m_Nsample{};
91 unsigned int m_preSampleIdx{};
92 float m_freqMHz{};
93 float m_deltaTSample{};
94 int m_pedestal{};
95 unsigned int m_LGMode{LGModeNormal};
96 float m_tmin{};
97 float m_tmax{};
98
99 bool m_quietFits{true};
100 bool m_saveFitFunc{false};
101
102 std::string m_fitFunction;
103 std::string m_fitParameterSetHG;
104 std::string m_fitParameterSetLG;
105 size_t m_2ndDerivStep{1};
110
111 bool m_useDelayed{false};
112
113 bool m_enableRepass{false};
std::map< std::string, JSONParamDescr > JSONParamList
std::shared_ptr< MessageFunction > MessageFunctionPtr
Definition ZDCMsg.h:14

◆ m_2ndDerivStep

size_t ZDCPulseAnalyzer::m_2ndDerivStep {1}
private

Definition at line 105 of file ZDCPulseAnalyzer.h.

105{1};

◆ m_ADCPeakHG

float ZDCPulseAnalyzer::m_ADCPeakHG {}
private

Definition at line 336 of file ZDCPulseAnalyzer.h.

336{};

◆ m_ADCPeakLG

float ZDCPulseAnalyzer::m_ADCPeakLG {}
private

Definition at line 337 of file ZDCPulseAnalyzer.h.

337{};

◆ m_ADCSamplesHG

std::vector<float> ZDCPulseAnalyzer::m_ADCSamplesHG
private

Definition at line 403 of file ZDCPulseAnalyzer.h.

◆ m_ADCSamplesHGSub

std::vector<float> ZDCPulseAnalyzer::m_ADCSamplesHGSub
private

Definition at line 405 of file ZDCPulseAnalyzer.h.

◆ m_ADCSamplesLG

std::vector<float> ZDCPulseAnalyzer::m_ADCSamplesLG
private

Definition at line 404 of file ZDCPulseAnalyzer.h.

◆ m_ADCSamplesLGSub

std::vector<float> ZDCPulseAnalyzer::m_ADCSamplesLGSub
private

Definition at line 406 of file ZDCPulseAnalyzer.h.

◆ m_ADCSSampNoiseHG

std::vector<float> ZDCPulseAnalyzer::m_ADCSSampNoiseHG
private

Definition at line 413 of file ZDCPulseAnalyzer.h.

◆ m_ADCSSampNoiseLG

std::vector<float> ZDCPulseAnalyzer::m_ADCSSampNoiseLG
private

Definition at line 414 of file ZDCPulseAnalyzer.h.

◆ m_adjTimeRangeEvent

bool ZDCPulseAnalyzer::m_adjTimeRangeEvent {false}
private

Definition at line 266 of file ZDCPulseAnalyzer.h.

266{false}; // indicates whether we adjust the time range for this specific event

◆ m_ampError

float ZDCPulseAnalyzer::m_ampError {}
private

Definition at line 379 of file ZDCPulseAnalyzer.h.

379{};

◆ m_amplitude

float ZDCPulseAnalyzer::m_amplitude {}
private

Definition at line 377 of file ZDCPulseAnalyzer.h.

377{};

◆ m_ampNoNonLin

float ZDCPulseAnalyzer::m_ampNoNonLin {}
private

Definition at line 378 of file ZDCPulseAnalyzer.h.

378{};

◆ m_backToHG_pre

bool ZDCPulseAnalyzer::m_backToHG_pre {false}
private

Definition at line 318 of file ZDCPulseAnalyzer.h.

318{false};

◆ m_badChisq

bool ZDCPulseAnalyzer::m_badChisq {false}
private

Definition at line 303 of file ZDCPulseAnalyzer.h.

303{false};

◆ m_badT0

bool ZDCPulseAnalyzer::m_badT0 {false}
private

Definition at line 305 of file ZDCPulseAnalyzer.h.

305{false};

◆ m_baselineCorr

float ZDCPulseAnalyzer::m_baselineCorr {}
private

Definition at line 319 of file ZDCPulseAnalyzer.h.

319{};

◆ m_bkgdMaxFraction

float ZDCPulseAnalyzer::m_bkgdMaxFraction {}
private

Definition at line 384 of file ZDCPulseAnalyzer.h.

384{};

◆ m_chisqDivAmpCutHG

float ZDCPulseAnalyzer::m_chisqDivAmpCutHG {}
private

Definition at line 165 of file ZDCPulseAnalyzer.h.

165{}; // maximum good HG chisq / amplitude

◆ m_chisqDivAmpCutLG

float ZDCPulseAnalyzer::m_chisqDivAmpCutLG {}
private

Definition at line 164 of file ZDCPulseAnalyzer.h.

164{}; // maximum good LG chisq / amplitude

◆ m_chisqDivAmpOffsetHG

float ZDCPulseAnalyzer::m_chisqDivAmpOffsetHG {}
private

Definition at line 169 of file ZDCPulseAnalyzer.h.

169{}; // maximum good HG chisq / amplitude

◆ m_chisqDivAmpOffsetLG

float ZDCPulseAnalyzer::m_chisqDivAmpOffsetLG {}
private

Definition at line 168 of file ZDCPulseAnalyzer.h.

168{}; // maximum good LG chisq / amplitude

◆ m_chisqDivAmpPowerHG

float ZDCPulseAnalyzer::m_chisqDivAmpPowerHG {}
private

Definition at line 171 of file ZDCPulseAnalyzer.h.

171{}; // maximum good HG chisq / amplitude

◆ m_chisqDivAmpPowerLG

float ZDCPulseAnalyzer::m_chisqDivAmpPowerLG {}
private

Definition at line 170 of file ZDCPulseAnalyzer.h.

170{}; // maximum good LG chisq / amplitude

◆ m_chisqDivAmpScaleHG

float ZDCPulseAnalyzer::m_chisqDivAmpScaleHG {}
private

Definition at line 167 of file ZDCPulseAnalyzer.h.

167{}; // maximum good HG chisq / amplitude

◆ m_chisqDivAmpScaleLG

float ZDCPulseAnalyzer::m_chisqDivAmpScaleLG {}
private

Definition at line 166 of file ZDCPulseAnalyzer.h.

166{}; // maximum good LG chisq / amplitude

◆ m_chisqRatio

float ZDCPulseAnalyzer::m_chisqRatio {}
private

Definition at line 370 of file ZDCPulseAnalyzer.h.

370{};

◆ m_defaultCombinedFitter

std::unique_ptr<TFitter> ZDCPulseAnalyzer::m_defaultCombinedFitter {}
private

Definition at line 280 of file ZDCPulseAnalyzer.h.

280{};

◆ m_defaultFitTMax

float ZDCPulseAnalyzer::m_defaultFitTMax {}
private

Definition at line 161 of file ZDCPulseAnalyzer.h.

161{}; // user-provided upper limit on samples to be included in fit

◆ m_defaultFitTMin

float ZDCPulseAnalyzer::m_defaultFitTMin {}
private

Definition at line 162 of file ZDCPulseAnalyzer.h.

162{}; // user-provided upper limit on samples to be included in fit

◆ m_defaultFitWrapperHG

std::unique_ptr<ZDCFitWrapper> ZDCPulseAnalyzer::m_defaultFitWrapperHG {}
private

Definition at line 257 of file ZDCPulseAnalyzer.h.

257{};

◆ m_defaultFitWrapperLG

std::unique_ptr<ZDCFitWrapper> ZDCPulseAnalyzer::m_defaultFitWrapperLG {}
private

Definition at line 258 of file ZDCPulseAnalyzer.h.

258{};

◆ m_defaultT0Max

float ZDCPulseAnalyzer::m_defaultT0Max {}
private

Definition at line 184 of file ZDCPulseAnalyzer.h.

184{}; // Upper limit on pulse t0

◆ m_defaultT0Min

float ZDCPulseAnalyzer::m_defaultT0Min {}
private

Definition at line 185 of file ZDCPulseAnalyzer.h.

185{}; // Lower limit on pulse t0

◆ m_delayedBaselineShift

float ZDCPulseAnalyzer::m_delayedBaselineShift {}
private

Definition at line 385 of file ZDCPulseAnalyzer.h.

385{};

◆ m_delayedDeltaT

float ZDCPulseAnalyzer::m_delayedDeltaT {}
private

Definition at line 274 of file ZDCPulseAnalyzer.h.

274{};

◆ m_delayedHist

std::unique_ptr<TH1> ZDCPulseAnalyzer::m_delayedHist {}
private

Definition at line 276 of file ZDCPulseAnalyzer.h.

276{};

◆ m_delayedHistLGRefit

std::unique_ptr<TH1> ZDCPulseAnalyzer::m_delayedHistLGRefit {}
private

Definition at line 277 of file ZDCPulseAnalyzer.h.

277{};

◆ m_delayedPedestalDiff

float ZDCPulseAnalyzer::m_delayedPedestalDiff {}
private

Definition at line 275 of file ZDCPulseAnalyzer.h.

275{};

◆ m_deltaTSample

float ZDCPulseAnalyzer::m_deltaTSample {}
private

Definition at line 93 of file ZDCPulseAnalyzer.h.

93{};

◆ m_doPostPulseCheck

bool ZDCPulseAnalyzer::m_doPostPulseCheck {false}
private

Definition at line 203 of file ZDCPulseAnalyzer.h.

203{false};

◆ m_doPrePulseCheck

bool ZDCPulseAnalyzer::m_doPrePulseCheck {false}
private

Definition at line 199 of file ZDCPulseAnalyzer.h.

199{false};

◆ m_enablePostExcl

bool ZDCPulseAnalyzer::m_enablePostExcl {false}
private

Definition at line 218 of file ZDCPulseAnalyzer.h.

218{false};

◆ m_enablePreExcl

bool ZDCPulseAnalyzer::m_enablePreExcl {false}
private

Definition at line 213 of file ZDCPulseAnalyzer.h.

213{false};

◆ m_enableRepass

bool ZDCPulseAnalyzer::m_enableRepass {false}
private

Definition at line 113 of file ZDCPulseAnalyzer.h.

113{false};

◆ m_enableUnderflowExclHG

bool ZDCPulseAnalyzer::m_enableUnderflowExclHG {false}
private

Definition at line 223 of file ZDCPulseAnalyzer.h.

223{false};

◆ m_enableUnderflowExclLG

bool ZDCPulseAnalyzer::m_enableUnderflowExclLG {false}
private

Definition at line 224 of file ZDCPulseAnalyzer.h.

224{false};

◆ m_evtLGRefit

bool ZDCPulseAnalyzer::m_evtLGRefit {false}
private

Definition at line 389 of file ZDCPulseAnalyzer.h.

389{false};

◆ m_ExcludeEarly

bool ZDCPulseAnalyzer::m_ExcludeEarly {false}
private

Definition at line 306 of file ZDCPulseAnalyzer.h.

306{false};

◆ m_ExcludeLate

bool ZDCPulseAnalyzer::m_ExcludeLate {false}
private

Definition at line 307 of file ZDCPulseAnalyzer.h.

307{false};

◆ m_expAmplitude

float ZDCPulseAnalyzer::m_expAmplitude {}
private

Definition at line 383 of file ZDCPulseAnalyzer.h.

383{};

◆ m_fadcCorrFileName

std::string ZDCPulseAnalyzer::m_fadcCorrFileName
private

Definition at line 244 of file ZDCPulseAnalyzer.h.

◆ m_FADCCorrHG

std::unique_ptr<const TH1> ZDCPulseAnalyzer::m_FADCCorrHG {}
private

Definition at line 246 of file ZDCPulseAnalyzer.h.

246{};

◆ m_FADCCorrLG

std::unique_ptr<const TH1> ZDCPulseAnalyzer::m_FADCCorrLG {}
private

Definition at line 247 of file ZDCPulseAnalyzer.h.

247{};

◆ m_FADCCorrPerSample

bool ZDCPulseAnalyzer::m_FADCCorrPerSample {false}
private

Definition at line 245 of file ZDCPulseAnalyzer.h.

245{false};

◆ m_fail

bool ZDCPulseAnalyzer::m_fail {false}
private

Definition at line 292 of file ZDCPulseAnalyzer.h.

292{false};

◆ m_failSigCut

bool ZDCPulseAnalyzer::m_failSigCut {false}
private

Definition at line 313 of file ZDCPulseAnalyzer.h.

313{false};

◆ m_firstHGOverFlowSample

int ZDCPulseAnalyzer::m_firstHGOverFlowSample {-1}
private

Definition at line 400 of file ZDCPulseAnalyzer.h.

400{-1};

◆ m_fitAmpError

float ZDCPulseAnalyzer::m_fitAmpError {}
private

Definition at line 361 of file ZDCPulseAnalyzer.h.

361{};

◆ m_fitAmplitude

float ZDCPulseAnalyzer::m_fitAmplitude {}
private

Definition at line 360 of file ZDCPulseAnalyzer.h.

360{};

◆ m_fitAmpMaxHG

float ZDCPulseAnalyzer::m_fitAmpMaxHG {}
private

Definition at line 190 of file ZDCPulseAnalyzer.h.

190{}; // Minimum am`plitude in the fit

◆ m_fitAmpMaxLG

float ZDCPulseAnalyzer::m_fitAmpMaxLG {}
private

Definition at line 191 of file ZDCPulseAnalyzer.h.

191{}; // Minimum amplitude in the fit

◆ m_fitAmpMinHG

float ZDCPulseAnalyzer::m_fitAmpMinHG {}
private

Definition at line 187 of file ZDCPulseAnalyzer.h.

187{}; // Minimum amplitude in the fit

◆ m_fitAmpMinLG

float ZDCPulseAnalyzer::m_fitAmpMinLG {}
private

Definition at line 188 of file ZDCPulseAnalyzer.h.

188{}; // Minimum amplitude in the fit

◆ m_fitChisq

float ZDCPulseAnalyzer::m_fitChisq {}
private

Definition at line 369 of file ZDCPulseAnalyzer.h.

369{};

◆ m_fitExpAmp

float ZDCPulseAnalyzer::m_fitExpAmp {}
private

Definition at line 376 of file ZDCPulseAnalyzer.h.

376{};

◆ m_fitFailed

bool ZDCPulseAnalyzer::m_fitFailed {false}
private

Definition at line 302 of file ZDCPulseAnalyzer.h.

302{false};

◆ m_fitFunction

std::string ZDCPulseAnalyzer::m_fitFunction
private

Definition at line 102 of file ZDCPulseAnalyzer.h.

◆ m_fitHist

std::unique_ptr<TH1> ZDCPulseAnalyzer::m_fitHist {}
private

Definition at line 251 of file ZDCPulseAnalyzer.h.

251{};

◆ m_fitHistLGRefit

std::unique_ptr<TH1> ZDCPulseAnalyzer::m_fitHistLGRefit {}
private

Definition at line 252 of file ZDCPulseAnalyzer.h.

252{};

◆ m_fitMinAmp

bool ZDCPulseAnalyzer::m_fitMinAmp {false}
private

Definition at line 311 of file ZDCPulseAnalyzer.h.

311{false};

◆ m_fitNDoF

float ZDCPulseAnalyzer::m_fitNDoF {}
private

Definition at line 371 of file ZDCPulseAnalyzer.h.

371{};

◆ m_fitOptions

std::string ZDCPulseAnalyzer::m_fitOptions {}
private

Definition at line 134 of file ZDCPulseAnalyzer.h.

134{};

◆ m_fitParameterSetHG

std::string ZDCPulseAnalyzer::m_fitParameterSetHG
private

Definition at line 103 of file ZDCPulseAnalyzer.h.

◆ m_fitParameterSetLG

std::string ZDCPulseAnalyzer::m_fitParameterSetLG
private

Definition at line 104 of file ZDCPulseAnalyzer.h.

◆ m_fitPostAmp

float ZDCPulseAnalyzer::m_fitPostAmp {}
private

Definition at line 375 of file ZDCPulseAnalyzer.h.

375{};

◆ m_fitPostT0

float ZDCPulseAnalyzer::m_fitPostT0 {}
private

Definition at line 374 of file ZDCPulseAnalyzer.h.

374{};

◆ m_fitPostT0lo

float ZDCPulseAnalyzer::m_fitPostT0lo {}
private

Definition at line 349 of file ZDCPulseAnalyzer.h.

349{}; // use to assign lower bound of post pulse T0

◆ m_fitPreAmp

float ZDCPulseAnalyzer::m_fitPreAmp {}
private

Definition at line 373 of file ZDCPulseAnalyzer.h.

373{};

◆ m_fitPreT0

float ZDCPulseAnalyzer::m_fitPreT0 {}
private

Definition at line 372 of file ZDCPulseAnalyzer.h.

372{};

◆ m_fitPulls

std::vector<float> ZDCPulseAnalyzer::m_fitPulls
private

Definition at line 430 of file ZDCPulseAnalyzer.h.

◆ m_fitTau1

float ZDCPulseAnalyzer::m_fitTau1 {}
private

Definition at line 367 of file ZDCPulseAnalyzer.h.

367{};

◆ m_fitTau2

float ZDCPulseAnalyzer::m_fitTau2 {}
private

Definition at line 368 of file ZDCPulseAnalyzer.h.

368{};

◆ m_fitTCorr2nd

float ZDCPulseAnalyzer::m_fitTCorr2nd {}
private

Definition at line 366 of file ZDCPulseAnalyzer.h.

366{};

◆ m_fitTime

float ZDCPulseAnalyzer::m_fitTime {}
private

Definition at line 362 of file ZDCPulseAnalyzer.h.

362{};

◆ m_fitTimeCorr

float ZDCPulseAnalyzer::m_fitTimeCorr {}
private

Definition at line 364 of file ZDCPulseAnalyzer.h.

364{};

◆ m_fitTimeSub

float ZDCPulseAnalyzer::m_fitTimeSub {}
private

Definition at line 363 of file ZDCPulseAnalyzer.h.

363{};

◆ m_fitTMax

float ZDCPulseAnalyzer::m_fitTMax {}
private

Definition at line 346 of file ZDCPulseAnalyzer.h.

346{}; // event-by-event specified fit tmax

◆ m_fitTMin

float ZDCPulseAnalyzer::m_fitTMin {}
private

Definition at line 347 of file ZDCPulseAnalyzer.h.

347{}; // event-by-event specified fit tmin

◆ m_fixPrePulse

bool ZDCPulseAnalyzer::m_fixPrePulse {false}
private

Definition at line 310 of file ZDCPulseAnalyzer.h.

310{false};

◆ m_fixTau1HG

bool ZDCPulseAnalyzer::m_fixTau1HG {}
private

Definition at line 147 of file ZDCPulseAnalyzer.h.

147{};

◆ m_fixTau1LG

bool ZDCPulseAnalyzer::m_fixTau1LG {}
private

Definition at line 149 of file ZDCPulseAnalyzer.h.

149{};

◆ m_fixTau2HG

bool ZDCPulseAnalyzer::m_fixTau2HG {}
private

Definition at line 148 of file ZDCPulseAnalyzer.h.

148{};

◆ m_fixTau2LG

bool ZDCPulseAnalyzer::m_fixTau2LG {}
private

Definition at line 150 of file ZDCPulseAnalyzer.h.

150{};

◆ m_freqMHz

float ZDCPulseAnalyzer::m_freqMHz {}
private

Definition at line 92 of file ZDCPulseAnalyzer.h.

92{};

◆ m_gainFactorHG

float ZDCPulseAnalyzer::m_gainFactorHG {}
private

Definition at line 119 of file ZDCPulseAnalyzer.h.

119{};

◆ m_gainFactorLG

float ZDCPulseAnalyzer::m_gainFactorLG {}
private

Definition at line 120 of file ZDCPulseAnalyzer.h.

120{};

◆ m_haveData

bool ZDCPulseAnalyzer::m_haveData {false}
private

Definition at line 288 of file ZDCPulseAnalyzer.h.

288{false};

◆ m_haveFADCCorrections

bool ZDCPulseAnalyzer::m_haveFADCCorrections {false}
private

Definition at line 243 of file ZDCPulseAnalyzer.h.

243{false};

◆ m_haveNonlinCorr

bool ZDCPulseAnalyzer::m_haveNonlinCorr {false}
private

Definition at line 237 of file ZDCPulseAnalyzer.h.

237{false};

◆ m_havePerSampleNoiseHG

bool ZDCPulseAnalyzer::m_havePerSampleNoiseHG {false}
private

Definition at line 127 of file ZDCPulseAnalyzer.h.

127{false};

◆ m_havePerSampleNoiseLG

bool ZDCPulseAnalyzer::m_havePerSampleNoiseLG {false}
private

Definition at line 128 of file ZDCPulseAnalyzer.h.

128{false};

◆ m_havePulse

bool ZDCPulseAnalyzer::m_havePulse {false}
private

Definition at line 290 of file ZDCPulseAnalyzer.h.

290{false};

◆ m_haveSignifCuts

bool ZDCPulseAnalyzer::m_haveSignifCuts {false}
private

Definition at line 193 of file ZDCPulseAnalyzer.h.

193{false};

◆ m_HGOverflow

bool ZDCPulseAnalyzer::m_HGOverflow {false}
private

Definition at line 293 of file ZDCPulseAnalyzer.h.

293{false};

◆ m_HGOverflowADC

int ZDCPulseAnalyzer::m_HGOverflowADC {}
private

Definition at line 135 of file ZDCPulseAnalyzer.h.

135{};

◆ m_HGT0CorrParams

std::vector<float> ZDCPulseAnalyzer::m_HGT0CorrParams {}
private

Definition at line 235 of file ZDCPulseAnalyzer.h.

235{}; // Parameters used to correct the fit HG times

◆ m_HGUnderflow

bool ZDCPulseAnalyzer::m_HGUnderflow {false}
private

Definition at line 295 of file ZDCPulseAnalyzer.h.

295{false};

◆ m_HGUnderflowADC

int ZDCPulseAnalyzer::m_HGUnderflowADC {}
private

Definition at line 136 of file ZDCPulseAnalyzer.h.

136{};

◆ m_inductbIHG

float ZDCPulseAnalyzer::m_inductbIHG {-1}
private

Definition at line 158 of file ZDCPulseAnalyzer.h.

158{-1};

◆ m_inductbILG

float ZDCPulseAnalyzer::m_inductbILG {-1}
private

Definition at line 159 of file ZDCPulseAnalyzer.h.

159{-1};

◆ m_inductPeriodHG

float ZDCPulseAnalyzer::m_inductPeriodHG {0}
private

Definition at line 156 of file ZDCPulseAnalyzer.h.

156{0};

◆ m_inductPeriodLG

float ZDCPulseAnalyzer::m_inductPeriodLG {0}
private

Definition at line 157 of file ZDCPulseAnalyzer.h.

157{0};

◆ m_initialExpAmp

float ZDCPulseAnalyzer::m_initialExpAmp {}
private

Definition at line 342 of file ZDCPulseAnalyzer.h.

342{};

◆ m_initialized

bool ZDCPulseAnalyzer::m_initialized {false}
private

Definition at line 254 of file ZDCPulseAnalyzer.h.

254{false};

◆ m_initializedFits

bool ZDCPulseAnalyzer::m_initializedFits {false}
private

Definition at line 255 of file ZDCPulseAnalyzer.h.

255{false};

◆ m_initialPostPulseT0

float ZDCPulseAnalyzer::m_initialPostPulseT0 {}
private

Definition at line 358 of file ZDCPulseAnalyzer.h.

358{};

◆ m_initialPrePulseAmp

float ZDCPulseAnalyzer::m_initialPrePulseAmp {}
private

Definition at line 356 of file ZDCPulseAnalyzer.h.

356{};

◆ m_initialPrePulseT0

float ZDCPulseAnalyzer::m_initialPrePulseT0 {}
private

Definition at line 355 of file ZDCPulseAnalyzer.h.

355{};

◆ m_lastHGOverFlowSample

int ZDCPulseAnalyzer::m_lastHGOverFlowSample {-1}
private

Definition at line 399 of file ZDCPulseAnalyzer.h.

399{-1};

◆ m_LGMode

unsigned int ZDCPulseAnalyzer::m_LGMode {LGModeNormal}
private

Definition at line 95 of file ZDCPulseAnalyzer.h.

◆ m_LGOverflow

bool ZDCPulseAnalyzer::m_LGOverflow {false}
private

Definition at line 297 of file ZDCPulseAnalyzer.h.

297{false};

◆ m_LGOverflowADC

int ZDCPulseAnalyzer::m_LGOverflowADC {}
private

Definition at line 137 of file ZDCPulseAnalyzer.h.

137{};

◆ m_LGT0CorrParams

std::vector<float> ZDCPulseAnalyzer::m_LGT0CorrParams {}
private

Definition at line 234 of file ZDCPulseAnalyzer.h.

234{}; // Parameters used to correct the fit LG times

◆ m_LGUnderflow

bool ZDCPulseAnalyzer::m_LGUnderflow {false}
private

Definition at line 298 of file ZDCPulseAnalyzer.h.

298{false};

◆ m_maxADCHG

float ZDCPulseAnalyzer::m_maxADCHG {}
private

Definition at line 327 of file ZDCPulseAnalyzer.h.

327{};

◆ m_maxADCLG

float ZDCPulseAnalyzer::m_maxADCLG {}
private

Definition at line 331 of file ZDCPulseAnalyzer.h.

331{};

◆ m_maxADCSampleHG

int ZDCPulseAnalyzer::m_maxADCSampleHG
private

Definition at line 329 of file ZDCPulseAnalyzer.h.

◆ m_maxADCSampleLG

int ZDCPulseAnalyzer::m_maxADCSampleLG
private

Definition at line 334 of file ZDCPulseAnalyzer.h.

◆ m_maxDelta

float ZDCPulseAnalyzer::m_maxDelta {}
private

Definition at line 339 of file ZDCPulseAnalyzer.h.

339{};

◆ m_maxSampleEvt

unsigned int ZDCPulseAnalyzer::m_maxSampleEvt {}
private

Definition at line 269 of file ZDCPulseAnalyzer.h.

269{};

◆ m_maxSamplesPostExcl

unsigned int ZDCPulseAnalyzer::m_maxSamplesPostExcl {0}
private

Definition at line 221 of file ZDCPulseAnalyzer.h.

221{0};

◆ m_maxSamplesPreExcl

unsigned int ZDCPulseAnalyzer::m_maxSamplesPreExcl {0}
private

Definition at line 214 of file ZDCPulseAnalyzer.h.

214{0};

◆ m_minADCHG

float ZDCPulseAnalyzer::m_minADCHG {}
private

Definition at line 326 of file ZDCPulseAnalyzer.h.

326{};

◆ m_minADCLG

float ZDCPulseAnalyzer::m_minADCLG {}
private

Definition at line 332 of file ZDCPulseAnalyzer.h.

332{};

◆ m_minADCSampleHG

int ZDCPulseAnalyzer::m_minADCSampleHG
private

Definition at line 328 of file ZDCPulseAnalyzer.h.

◆ m_minADCSampleLG

int ZDCPulseAnalyzer::m_minADCSampleLG
private

Definition at line 333 of file ZDCPulseAnalyzer.h.

◆ m_minDelta

float ZDCPulseAnalyzer::m_minDelta {}
private

Definition at line 340 of file ZDCPulseAnalyzer.h.

340{};

◆ m_minDeriv2nd

float ZDCPulseAnalyzer::m_minDeriv2nd {}
private

Definition at line 343 of file ZDCPulseAnalyzer.h.

343{};

◆ m_minDeriv2ndIndex

int ZDCPulseAnalyzer::m_minDeriv2ndIndex {}
private

Definition at line 344 of file ZDCPulseAnalyzer.h.

344{};

◆ m_minDeriv2ndSig

float ZDCPulseAnalyzer::m_minDeriv2ndSig
private

Definition at line 351 of file ZDCPulseAnalyzer.h.

◆ m_minSampleEvt

unsigned int ZDCPulseAnalyzer::m_minSampleEvt {}
private

Definition at line 268 of file ZDCPulseAnalyzer.h.

268{};

◆ m_msgFunc_p

ZDCMsg::MessageFunctionPtr ZDCPulseAnalyzer::m_msgFunc_p {}
private

Definition at line 88 of file ZDCPulseAnalyzer.h.

88{};

◆ m_noiseSigHG

float ZDCPulseAnalyzer::m_noiseSigHG {}
private

Definition at line 124 of file ZDCPulseAnalyzer.h.

124{};

◆ m_noiseSigLG

float ZDCPulseAnalyzer::m_noiseSigLG {}
private

Definition at line 125 of file ZDCPulseAnalyzer.h.

125{};

◆ m_nominalT0HG

float ZDCPulseAnalyzer::m_nominalT0HG {}
private

Definition at line 139 of file ZDCPulseAnalyzer.h.

139{};

◆ m_nominalT0LG

float ZDCPulseAnalyzer::m_nominalT0LG {}
private

Definition at line 140 of file ZDCPulseAnalyzer.h.

140{};

◆ m_nominalTau1HG

float ZDCPulseAnalyzer::m_nominalTau1HG {}
private

Definition at line 142 of file ZDCPulseAnalyzer.h.

142{};

◆ m_nominalTau1LG

float ZDCPulseAnalyzer::m_nominalTau1LG {}
private

Definition at line 144 of file ZDCPulseAnalyzer.h.

144{};

◆ m_nominalTau2HG

float ZDCPulseAnalyzer::m_nominalTau2HG {}
private

Definition at line 143 of file ZDCPulseAnalyzer.h.

143{};

◆ m_nominalTau2LG

float ZDCPulseAnalyzer::m_nominalTau2LG {}
private

Definition at line 145 of file ZDCPulseAnalyzer.h.

145{};

◆ m_nonLinCorrParamsHG

std::vector<float> ZDCPulseAnalyzer::m_nonLinCorrParamsHG {}
private

Definition at line 240 of file ZDCPulseAnalyzer.h.

240{};

◆ m_nonLinCorrParamsLG

std::vector<float> ZDCPulseAnalyzer::m_nonLinCorrParamsLG {}
private

Definition at line 241 of file ZDCPulseAnalyzer.h.

241{};

◆ m_nonLinCorrRefADC

float ZDCPulseAnalyzer::m_nonLinCorrRefADC {500}
private

Definition at line 238 of file ZDCPulseAnalyzer.h.

238{500};

◆ m_nonLinCorrRefScale

float ZDCPulseAnalyzer::m_nonLinCorrRefScale {100}
private

Definition at line 239 of file ZDCPulseAnalyzer.h.

239{100};

◆ m_Nsample

unsigned int ZDCPulseAnalyzer::m_Nsample {}
private

Definition at line 90 of file ZDCPulseAnalyzer.h.

90{};

◆ m_NSamplesAna

unsigned int ZDCPulseAnalyzer::m_NSamplesAna {0}
private

Definition at line 402 of file ZDCPulseAnalyzer.h.

402{0};

◆ m_peak2ndDerivMinRepassHG

float ZDCPulseAnalyzer::m_peak2ndDerivMinRepassHG {}
private

Definition at line 115 of file ZDCPulseAnalyzer.h.

115{};

◆ m_peak2ndDerivMinRepassLG

float ZDCPulseAnalyzer::m_peak2ndDerivMinRepassLG {}
private

Definition at line 114 of file ZDCPulseAnalyzer.h.

114{};

◆ m_peak2ndDerivMinSample

size_t ZDCPulseAnalyzer::m_peak2ndDerivMinSample {}
private

Definition at line 106 of file ZDCPulseAnalyzer.h.

106{};

◆ m_peak2ndDerivMinThreshHG

float ZDCPulseAnalyzer::m_peak2ndDerivMinThreshHG {}
private

Definition at line 109 of file ZDCPulseAnalyzer.h.

109{};

◆ m_peak2ndDerivMinThreshLG

float ZDCPulseAnalyzer::m_peak2ndDerivMinThreshLG {}
private

Definition at line 108 of file ZDCPulseAnalyzer.h.

108{};

◆ m_peak2ndDerivMinTolerance

size_t ZDCPulseAnalyzer::m_peak2ndDerivMinTolerance {1}
private

Definition at line 107 of file ZDCPulseAnalyzer.h.

107{1};

◆ m_pedestal

int ZDCPulseAnalyzer::m_pedestal {}
private

Definition at line 94 of file ZDCPulseAnalyzer.h.

94{};

◆ m_postAmplitude

float ZDCPulseAnalyzer::m_postAmplitude {}
private

Definition at line 382 of file ZDCPulseAnalyzer.h.

382{};

◆ m_postExclHGADCThresh

unsigned int ZDCPulseAnalyzer::m_postExclHGADCThresh {0}
private

Definition at line 219 of file ZDCPulseAnalyzer.h.

219{0};

◆ m_postExclLGADCThresh

unsigned int ZDCPulseAnalyzer::m_postExclLGADCThresh {0}
private

Definition at line 220 of file ZDCPulseAnalyzer.h.

220{0};

◆ m_postPulse

bool ZDCPulseAnalyzer::m_postPulse {false}
private

Definition at line 301 of file ZDCPulseAnalyzer.h.

301{false};

◆ m_postPulseAbsDer2ndMinSig

float ZDCPulseAnalyzer::m_postPulseAbsDer2ndMinSig {}
private

Definition at line 206 of file ZDCPulseAnalyzer.h.

206{};

◆ m_postPulseDelta

unsigned int ZDCPulseAnalyzer::m_postPulseDelta {0}
private

Definition at line 204 of file ZDCPulseAnalyzer.h.

204{0};

◆ m_postPulseDerivMinSig

float ZDCPulseAnalyzer::m_postPulseDerivMinSig {}
private

Definition at line 205 of file ZDCPulseAnalyzer.h.

205{};

◆ m_postPulseMainMinDer2ndRatio

float ZDCPulseAnalyzer::m_postPulseMainMinDer2ndRatio {}
private

Definition at line 207 of file ZDCPulseAnalyzer.h.

207{};

◆ m_preAmplitude

float ZDCPulseAnalyzer::m_preAmplitude {}
private

Definition at line 381 of file ZDCPulseAnalyzer.h.

381{};

◆ m_preExclHGADCThresh

unsigned int ZDCPulseAnalyzer::m_preExclHGADCThresh {0}
private

Definition at line 215 of file ZDCPulseAnalyzer.h.

215{0};

◆ m_preExclLGADCThresh

unsigned int ZDCPulseAnalyzer::m_preExclLGADCThresh {0}
private

Definition at line 216 of file ZDCPulseAnalyzer.h.

216{0};

◆ m_preExpFitWrapperHG

std::unique_ptr<ZDCPreExpFitWrapper> ZDCPulseAnalyzer::m_preExpFitWrapperHG {}
private

Definition at line 261 of file ZDCPulseAnalyzer.h.

261{};

◆ m_preExpFitWrapperLG

std::unique_ptr<ZDCPreExpFitWrapper> ZDCPulseAnalyzer::m_preExpFitWrapperLG {}
private

Definition at line 262 of file ZDCPulseAnalyzer.h.

262{};

◆ m_preExpSig

float ZDCPulseAnalyzer::m_preExpSig
private

Definition at line 352 of file ZDCPulseAnalyzer.h.

◆ m_preExpTail

bool ZDCPulseAnalyzer::m_preExpTail {false}
private

Definition at line 308 of file ZDCPulseAnalyzer.h.

308{false};

◆ m_prePulse

bool ZDCPulseAnalyzer::m_prePulse {false}
private

Definition at line 300 of file ZDCPulseAnalyzer.h.

300{false};

◆ m_prePulseCombinedFitter

std::unique_ptr<TFitter> ZDCPulseAnalyzer::m_prePulseCombinedFitter {}
private

Definition at line 279 of file ZDCPulseAnalyzer.h.

279{};

◆ m_prePulseDelta

unsigned int ZDCPulseAnalyzer::m_prePulseDelta {0}
private

Definition at line 209 of file ZDCPulseAnalyzer.h.

209{0};

◆ m_prePulseFitWrapperHG

std::unique_ptr<ZDCPrePulseFitWrapper> ZDCPulseAnalyzer::m_prePulseFitWrapperHG {}
private

Definition at line 259 of file ZDCPulseAnalyzer.h.

259{};

◆ m_prePulseFitWrapperLG

std::unique_ptr<ZDCPrePulseFitWrapper> ZDCPulseAnalyzer::m_prePulseFitWrapperLG {}
private

Definition at line 260 of file ZDCPulseAnalyzer.h.

260{};

◆ m_prePulseSig

float ZDCPulseAnalyzer::m_prePulseSig
private

Definition at line 353 of file ZDCPulseAnalyzer.h.

◆ m_preSample

float ZDCPulseAnalyzer::m_preSample {}
private

Definition at line 324 of file ZDCPulseAnalyzer.h.

324{};

◆ m_preSampleAmp

float ZDCPulseAnalyzer::m_preSampleAmp {}
private

Definition at line 380 of file ZDCPulseAnalyzer.h.

380{};

◆ m_preSampleIdx

unsigned int ZDCPulseAnalyzer::m_preSampleIdx {}
private

Definition at line 91 of file ZDCPulseAnalyzer.h.

91{};

◆ m_PSHGOverUnderflow

bool ZDCPulseAnalyzer::m_PSHGOverUnderflow {false}
private

Definition at line 296 of file ZDCPulseAnalyzer.h.

296{false};

◆ m_quietFits

bool ZDCPulseAnalyzer::m_quietFits {true}
private

Definition at line 99 of file ZDCPulseAnalyzer.h.

99{true};

◆ m_refitLGAmpError

float ZDCPulseAnalyzer::m_refitLGAmpError {0}
private

Definition at line 393 of file ZDCPulseAnalyzer.h.

393{0};

◆ m_refitLGAmpl

float ZDCPulseAnalyzer::m_refitLGAmpl {0}
private

Definition at line 390 of file ZDCPulseAnalyzer.h.

390{0};

◆ m_refitLGAmplCorr

float ZDCPulseAnalyzer::m_refitLGAmplCorr {0}
private

Definition at line 392 of file ZDCPulseAnalyzer.h.

392{0};

◆ m_refitLGChisq

float ZDCPulseAnalyzer::m_refitLGChisq {0}
private

Definition at line 394 of file ZDCPulseAnalyzer.h.

394{0};

◆ m_refitLGChisqRatio

float ZDCPulseAnalyzer::m_refitLGChisqRatio {0}
private

Definition at line 395 of file ZDCPulseAnalyzer.h.

395{0};

◆ m_refitLGFitAmpl

float ZDCPulseAnalyzer::m_refitLGFitAmpl {0}
private

Definition at line 391 of file ZDCPulseAnalyzer.h.

391{0};

◆ m_refitLGTime

float ZDCPulseAnalyzer::m_refitLGTime {0}
private

Definition at line 396 of file ZDCPulseAnalyzer.h.

396{0};

◆ m_refitLGTimeSub

float ZDCPulseAnalyzer::m_refitLGTimeSub {0}
private

Definition at line 397 of file ZDCPulseAnalyzer.h.

397{0};

◆ m_repassPulse

bool ZDCPulseAnalyzer::m_repassPulse {false}
private

Definition at line 312 of file ZDCPulseAnalyzer.h.

312{false};

◆ m_sampleNoiseHG

std::vector<float> ZDCPulseAnalyzer::m_sampleNoiseHG
private

Definition at line 407 of file ZDCPulseAnalyzer.h.

◆ m_sampleNoiseLG

std::vector<float> ZDCPulseAnalyzer::m_sampleNoiseLG
private

Definition at line 408 of file ZDCPulseAnalyzer.h.

◆ m_samplesDeriv2nd

std::vector<float> ZDCPulseAnalyzer::m_samplesDeriv2nd
private

Definition at line 422 of file ZDCPulseAnalyzer.h.

◆ m_samplesDeriv2ndErr

std::vector<float> ZDCPulseAnalyzer::m_samplesDeriv2ndErr
private

Definition at line 423 of file ZDCPulseAnalyzer.h.

◆ m_samplesLGRefit

std::vector<float> ZDCPulseAnalyzer::m_samplesLGRefit
private

Definition at line 419 of file ZDCPulseAnalyzer.h.

◆ m_samplesNoise

std::vector<float> ZDCPulseAnalyzer::m_samplesNoise
private

Definition at line 417 of file ZDCPulseAnalyzer.h.

◆ m_samplesNoiseLGRefit

std::vector<float> ZDCPulseAnalyzer::m_samplesNoiseLGRefit
private

Definition at line 420 of file ZDCPulseAnalyzer.h.

◆ m_samplesSub

std::vector<float> ZDCPulseAnalyzer::m_samplesSub
private

Definition at line 416 of file ZDCPulseAnalyzer.h.

◆ m_saveFitFunc

bool ZDCPulseAnalyzer::m_saveFitFunc {false}
private

Definition at line 100 of file ZDCPulseAnalyzer.h.

100{false};

◆ m_setPerSampleNoiseHG

std::vector<float> ZDCPulseAnalyzer::m_setPerSampleNoiseHG
private

Definition at line 129 of file ZDCPulseAnalyzer.h.

◆ m_setPerSampleNoiseLG

std::vector<float> ZDCPulseAnalyzer::m_setPerSampleNoiseLG
private

Definition at line 130 of file ZDCPulseAnalyzer.h.

◆ m_shapeParameters

std::vector<float> ZDCPulseAnalyzer::m_shapeParameters
private

Definition at line 387 of file ZDCPulseAnalyzer.h.

◆ m_sigMinHG

float ZDCPulseAnalyzer::m_sigMinHG {}
private

Definition at line 194 of file ZDCPulseAnalyzer.h.

194{}; // Minimum amplitude significance to be considered valid pulse

◆ m_sigMinLG

float ZDCPulseAnalyzer::m_sigMinLG {}
private

Definition at line 195 of file ZDCPulseAnalyzer.h.

195{}; // Minimum amplitude significance to be considered valid pulse

◆ m_T0CutHighHG

float ZDCPulseAnalyzer::m_T0CutHighHG {}
private

Definition at line 177 of file ZDCPulseAnalyzer.h.

177{}; // maximum good corrected time for HG fits

◆ m_T0CutHighLG

float ZDCPulseAnalyzer::m_T0CutHighLG {}
private

Definition at line 174 of file ZDCPulseAnalyzer.h.

174{}; // maximum good corrected time for LG fits

◆ m_T0CutLowHG

float ZDCPulseAnalyzer::m_T0CutLowHG {}
private

Definition at line 176 of file ZDCPulseAnalyzer.h.

176{}; // minimum good corrected time for HG fits

◆ m_T0CutLowLG

float ZDCPulseAnalyzer::m_T0CutLowLG {}
private

Definition at line 173 of file ZDCPulseAnalyzer.h.

173{}; // minimum good corrected time for LG fits

◆ m_t0CutSig

float ZDCPulseAnalyzer::m_t0CutSig {}
private

Definition at line 181 of file ZDCPulseAnalyzer.h.

181{};

◆ m_tag

std::string ZDCPulseAnalyzer::m_tag {}
private

Definition at line 89 of file ZDCPulseAnalyzer.h.

89{};

◆ m_timeCutMode

unsigned int ZDCPulseAnalyzer::m_timeCutMode {0}
private

Definition at line 182 of file ZDCPulseAnalyzer.h.

182{0}; // 0 - no significance cut, 1 - cut ORed with fixed cut, 2 - cut ANDed with fixed cut

◆ m_timeResFuncHG_p

std::unique_ptr<const TF1> ZDCPulseAnalyzer::m_timeResFuncHG_p {}
private

Definition at line 179 of file ZDCPulseAnalyzer.h.

179{};

◆ m_timeResFuncLG_p

std::unique_ptr<const TF1> ZDCPulseAnalyzer::m_timeResFuncLG_p {}
private

Definition at line 180 of file ZDCPulseAnalyzer.h.

180{};

◆ m_timeSig

float ZDCPulseAnalyzer::m_timeSig {}
private

Definition at line 365 of file ZDCPulseAnalyzer.h.

365{};

◆ m_timingCorrMode

unsigned int ZDCPulseAnalyzer::m_timingCorrMode {NoTimingCorr}
private

Definition at line 231 of file ZDCPulseAnalyzer.h.

◆ m_timingCorrRefADC

float ZDCPulseAnalyzer::m_timingCorrRefADC {500}
private

Definition at line 232 of file ZDCPulseAnalyzer.h.

232{500};

◆ m_timingCorrScale

float ZDCPulseAnalyzer::m_timingCorrScale {100}
private

Definition at line 233 of file ZDCPulseAnalyzer.h.

233{100};

◆ m_tmax

float ZDCPulseAnalyzer::m_tmax {}
private

Definition at line 97 of file ZDCPulseAnalyzer.h.

97{};

◆ m_tmin

float ZDCPulseAnalyzer::m_tmin {}
private

Definition at line 96 of file ZDCPulseAnalyzer.h.

96{};

◆ m_underFlowExclSamplesPostHG

unsigned int ZDCPulseAnalyzer::m_underFlowExclSamplesPostHG {0}
private

Definition at line 226 of file ZDCPulseAnalyzer.h.

226{0};

◆ m_underFlowExclSamplesPostLG

unsigned int ZDCPulseAnalyzer::m_underFlowExclSamplesPostLG {0}
private

Definition at line 228 of file ZDCPulseAnalyzer.h.

228{0};

◆ m_underFlowExclSamplesPreHG

unsigned int ZDCPulseAnalyzer::m_underFlowExclSamplesPreHG {0}
private

Definition at line 225 of file ZDCPulseAnalyzer.h.

225{0};

◆ m_underFlowExclSamplesPreLG

unsigned int ZDCPulseAnalyzer::m_underFlowExclSamplesPreLG {0}
private

Definition at line 227 of file ZDCPulseAnalyzer.h.

227{0};

◆ m_underflowExclusion

bool ZDCPulseAnalyzer::m_underflowExclusion {false}
private

Definition at line 314 of file ZDCPulseAnalyzer.h.

314{false};

◆ m_useDelayed

bool ZDCPulseAnalyzer::m_useDelayed {false}
private

Definition at line 111 of file ZDCPulseAnalyzer.h.

111{false};

◆ m_usedPresampIdx

int ZDCPulseAnalyzer::m_usedPresampIdx {}
private

Definition at line 323 of file ZDCPulseAnalyzer.h.

323{};

◆ m_useFixedBaseline

bool ZDCPulseAnalyzer::m_useFixedBaseline {}
private

Definition at line 273 of file ZDCPulseAnalyzer.h.

273{};

◆ m_useLowGain

bool ZDCPulseAnalyzer::m_useLowGain {false}
private

Definition at line 291 of file ZDCPulseAnalyzer.h.

291{false};

◆ m_useSampleHG

std::vector<bool> ZDCPulseAnalyzer::m_useSampleHG
private

Definition at line 411 of file ZDCPulseAnalyzer.h.

◆ m_useSampleLG

std::vector<bool> ZDCPulseAnalyzer::m_useSampleLG
private

Definition at line 410 of file ZDCPulseAnalyzer.h.

◆ s_combinedFitFunc

TF1 * ZDCPulseAnalyzer::s_combinedFitFunc = nullptr
staticprivate

Definition at line 81 of file ZDCPulseAnalyzer.h.

◆ s_combinedFitTMax

float ZDCPulseAnalyzer::s_combinedFitTMax = 1000
staticprivate

Definition at line 82 of file ZDCPulseAnalyzer.h.

◆ s_combinedFitTMin

float ZDCPulseAnalyzer::s_combinedFitTMin = -0.5
staticprivate

Definition at line 83 of file ZDCPulseAnalyzer.h.

◆ s_delayedFitHist

TH1 * ZDCPulseAnalyzer::s_delayedFitHist = nullptr
staticprivate

Definition at line 80 of file ZDCPulseAnalyzer.h.

◆ s_pullValues

std::vector< float > ZDCPulseAnalyzer::s_pullValues
staticprivate

Definition at line 84 of file ZDCPulseAnalyzer.h.

◆ s_undelayedFitHist

TH1 * ZDCPulseAnalyzer::s_undelayedFitHist = nullptr
staticprivate

Definition at line 79 of file ZDCPulseAnalyzer.h.


The documentation for this class was generated from the following files: