From 5d6b2b95ec5b72baf4e59c2d152591bb88ffec0d Mon Sep 17 00:00:00 2001 From: "Stephen A. Wood" <saw@jlab.org> Date: Mon, 27 Nov 2017 14:29:38 -0500 Subject: [PATCH] Add a time ofset to shower FADC pulse times so that it stays positive --- src/THcShower.cxx | 2 ++ src/THcShower.h | 4 ++++ src/THcShowerArray.cxx | 2 ++ src/THcShowerArray.h | 1 + src/THcShowerPlane.cxx | 6 ++++-- src/THcShowerPlane.h | 1 + 6 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/THcShower.cxx b/src/THcShower.cxx index e1dbf46..622473f 100644 --- a/src/THcShower.cxx +++ b/src/THcShower.cxx @@ -215,6 +215,7 @@ Int_t THcShower::ReadDatabase( const TDatime& date ) {"cal_ADCMode", &fADCMode, kInt, 0, 1}, {"cal_AdcTimeWindowMin", &fAdcTimeWindowMin, kDouble, 0, 1}, {"cal_AdcTimeWindowMax", &fAdcTimeWindowMax, kDouble, 0, 1}, + {"cal_adc_tdc_offset", &fAdcTdcOffset, kDouble, 0, 1}, {"dbg_raw_cal", &fdbg_raw_cal, kInt, 0, 1}, {"dbg_decoded_cal", &fdbg_decoded_cal, kInt, 0, 1}, {"dbg_sparsified_cal", &fdbg_sparsified_cal, kInt, 0, 1}, @@ -232,6 +233,7 @@ Int_t THcShower::ReadDatabase( const TDatime& date ) fdbg_init_cal = 0; fAdcTimeWindowMin=0; fAdcTimeWindowMax=10000; + fAdcTdcOffset=0.0; fADCMode=kADCDynamicPedestal; gHcParms->LoadParmValues((DBRequest*)&list, prefix); } diff --git a/src/THcShower.h b/src/THcShower.h index b727503..d78e265 100644 --- a/src/THcShower.h +++ b/src/THcShower.h @@ -80,6 +80,9 @@ public: Double_t GetAdcTimeWindowMax() { return fAdcTimeWindowMax; } + Double_t GetAdcTdcOffset() { + return fAdcTdcOffset; + } Int_t GetMinPeds() { return fShMinPeds; } @@ -131,6 +134,7 @@ protected: static const Int_t kADCSampIntDynPed=3; Double_t fAdcTimeWindowMin; Double_t fAdcTimeWindowMax; + Double_t fAdcTdcOffset; Int_t fAnalyzePedestals; // Flag for pedestal analysis. diff --git a/src/THcShowerArray.cxx b/src/THcShowerArray.cxx index 1684af9..401976d 100644 --- a/src/THcShowerArray.cxx +++ b/src/THcShowerArray.cxx @@ -149,6 +149,7 @@ Int_t THcShowerArray::ReadDatabase( const TDatime& date ) {"cal_arr_ADCMode", &fADCMode, kInt, 0, 1}, {"cal_arr_AdcTimeWindowMin", &fAdcTimeWindowMin, kDouble, 0, 1}, {"cal_arr_AdcTimeWindowMax", &fAdcTimeWindowMax, kDouble, 0, 1}, + {"cal_arr_adc_tdc_offset", &fAdcTdcOffset, kDouble, 0, 1}, {"cal_arr_AdcThreshold", &fAdcThreshold, kDouble, 0, 1}, {"cal_ped_sample_low", &fPedSampLow, kInt, 0, 1}, {"cal_ped_sample_high", &fPedSampHigh, kInt, 0, 1}, @@ -167,6 +168,7 @@ Int_t THcShowerArray::ReadDatabase( const TDatime& date ) fADCMode=kADCDynamicPedestal; fAdcTimeWindowMin=0; fAdcTimeWindowMax=10000; + fAdcTdcOffset=0.0; fAdcThreshold=0.; fNelem = fNRows*fNColumns; diff --git a/src/THcShowerArray.h b/src/THcShowerArray.h index acd12ae..8c7033d 100644 --- a/src/THcShowerArray.h +++ b/src/THcShowerArray.h @@ -146,6 +146,7 @@ protected: Double_t fAdcTimeWindowMin ; Double_t fAdcTimeWindowMax ; Double_t fAdcThreshold ; + Double_t fAdcTdcOffset; Int_t fDebugAdc; Int_t fPedSampLow; // Sample range for diff --git a/src/THcShowerPlane.cxx b/src/THcShowerPlane.cxx index 160b3a9..38903f5 100644 --- a/src/THcShowerPlane.cxx +++ b/src/THcShowerPlane.cxx @@ -224,6 +224,8 @@ Int_t THcShowerPlane::ReadDatabase( const TDatime& date ) fOrigin.SetXYZ(xOrig, yOrig, zOrig); + fAdcTdcOffset=parent->GetAdcTdcOffset(); + // Create arrays to hold results here // @@ -584,7 +586,7 @@ Int_t THcShowerPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) ((THcSignalHit*) frPosAdcPulseAmp->ConstructedAt(nrPosAdcHits))->Set(padnum, rawPosAdcHit.GetPulseAmp(thit)); ((THcSignalHit*) frPosAdcPulseTimeRaw->ConstructedAt(nrPosAdcHits))->Set(padnum, rawPosAdcHit.GetPulseTimeRaw(thit)); - ((THcSignalHit*) frPosAdcPulseTime->ConstructedAt(nrPosAdcHits))->Set(padnum, rawPosAdcHit.GetPulseTime(thit)); + ((THcSignalHit*) frPosAdcPulseTime->ConstructedAt(nrPosAdcHits))->Set(padnum, rawPosAdcHit.GetPulseTime(thit)+fAdcTdcOffset); if (rawPosAdcHit.GetPulseAmp(thit)>0&&rawPosAdcHit.GetPulseIntRaw(thit)>0) { ((THcSignalHit*) frPosAdcErrorFlag->ConstructedAt(nrPosAdcHits))->Set(padnum,0); @@ -609,7 +611,7 @@ Int_t THcShowerPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) ((THcSignalHit*) frNegAdcPulseAmp->ConstructedAt(nrNegAdcHits))->Set(padnum, rawNegAdcHit.GetPulseAmp(thit)); ((THcSignalHit*) frNegAdcPulseTimeRaw->ConstructedAt(nrNegAdcHits))->Set(padnum, rawNegAdcHit.GetPulseTimeRaw(thit)); - ((THcSignalHit*) frNegAdcPulseTime->ConstructedAt(nrNegAdcHits))->Set(padnum, rawNegAdcHit.GetPulseTime(thit)); + ((THcSignalHit*) frNegAdcPulseTime->ConstructedAt(nrNegAdcHits))->Set(padnum, rawNegAdcHit.GetPulseTime(thit)+fAdcTdcOffset); if (rawNegAdcHit.GetPulseAmp(thit)>0&&rawNegAdcHit.GetPulseIntRaw(thit)>0) { ((THcSignalHit*) frNegAdcErrorFlag->ConstructedAt(nrNegAdcHits))->Set(padnum,0); diff --git a/src/THcShowerPlane.h b/src/THcShowerPlane.h index 19a43c5..ef68eca 100644 --- a/src/THcShowerPlane.h +++ b/src/THcShowerPlane.h @@ -134,6 +134,7 @@ protected: Int_t fDataSampHigh; // sample integration Double_t fAdcNegThreshold; // Double_t fAdcPosThreshold; // + Double_t fAdcTdcOffset; //counting variables Int_t fTotNumPosAdcHits; -- GitLab