diff --git a/src/THcRawAdcHit.cxx b/src/THcRawAdcHit.cxx index 03e12f9097c7e20f6162e6d5439017f7eddcebe6..0eea62f1ad764bf985c9ec1d1e7256612fd0733e 100644 --- a/src/THcRawAdcHit.cxx +++ b/src/THcRawAdcHit.cxx @@ -18,6 +18,7 @@ THcRawAdcHit::THcRawAdcHit() : TObject(), fNPedestalSamples(4), fNPeakSamples(9), fPeakPedestalRatio(1.0*fNPeakSamples/fNPedestalSamples), + fChannelToTimeFactor(0.0625), fAdc(), fAdcTime(), fAdcPedestal(), fAdcPulse(), fAdcSample(), fHasMulti(kFALSE), fNPulses(0), fNSamples(0) {} @@ -105,7 +106,7 @@ void THcRawAdcHit::SetDataTimePedestalPeak( } -Int_t THcRawAdcHit::GetRawData(UInt_t iPulse) { +Int_t THcRawAdcHit::GetRawData(UInt_t iPulse) const { if (iPulse >= fNPulses && iPulse != 0) { TString msg = TString::Format( "`THcRawAdcHit::GetRawData`: requested pulse %d where only %d pulses available!", @@ -122,7 +123,7 @@ Int_t THcRawAdcHit::GetRawData(UInt_t iPulse) { } -Int_t THcRawAdcHit::GetAdcTime(UInt_t iPulse) { +Int_t THcRawAdcHit::GetAdcTime(UInt_t iPulse) const { if (iPulse >= fNPulses && iPulse != 0) { TString msg = TString::Format( "`THcRawAdcHit::GetAdcTime`: requested pulse %d where only %d pulses available!", @@ -139,7 +140,7 @@ Int_t THcRawAdcHit::GetAdcTime(UInt_t iPulse) { } -Int_t THcRawAdcHit::GetAdcPedestal(UInt_t iPulse) { +Int_t THcRawAdcHit::GetAdcPedestal(UInt_t iPulse) const { if (iPulse >= fNPulses && iPulse != 0) { TString msg = TString::Format( "`THcRawAdcHit::GetAdcPedestal`: requested pulse %d where only %d pulses available!", @@ -156,7 +157,7 @@ Int_t THcRawAdcHit::GetAdcPedestal(UInt_t iPulse) { } -Int_t THcRawAdcHit::GetAdcPulse(UInt_t iPulse) { +Int_t THcRawAdcHit::GetAdcPulse(UInt_t iPulse) const { if (iPulse >= fNPulses && iPulse != 0) { TString msg = TString::Format( "`THcRawAdcHit::GetAdcPulse`: requested pulse %d where only %d pulses available!", @@ -173,7 +174,7 @@ Int_t THcRawAdcHit::GetAdcPulse(UInt_t iPulse) { } -Int_t THcRawAdcHit::GetSample(UInt_t iSample) { +Int_t THcRawAdcHit::GetSample(UInt_t iSample) const { if (iSample >= fNSamples && iSample != 0) { TString msg = TString::Format( "`THcRawAdcHit::GetSample`: requested sample %d where only %d sample available!", @@ -190,7 +191,7 @@ Int_t THcRawAdcHit::GetSample(UInt_t iSample) { } -Double_t THcRawAdcHit::GetAverage(UInt_t iSampleLow, UInt_t iSampleHigh) { +Double_t THcRawAdcHit::GetAverage(UInt_t iSampleLow, UInt_t iSampleHigh) const { if (iSampleHigh >= fNSamples || iSampleLow >= fNSamples) { TString msg = TString::Format( "`THcRawAdcHit::GetAverage`: not this many samples available!" @@ -207,7 +208,7 @@ Double_t THcRawAdcHit::GetAverage(UInt_t iSampleLow, UInt_t iSampleHigh) { } -Int_t THcRawAdcHit::GetIntegral(UInt_t iSampleLow, UInt_t iSampleHigh) { +Int_t THcRawAdcHit::GetIntegral(UInt_t iSampleLow, UInt_t iSampleHigh) const { if (iSampleHigh >= fNSamples || iSampleLow >= fNSamples) { TString msg = TString::Format( "`THcRawAdcHit::GetAverage`: not this many samples available!" @@ -226,64 +227,69 @@ Int_t THcRawAdcHit::GetIntegral(UInt_t iSampleLow, UInt_t iSampleHigh) { Double_t THcRawAdcHit::GetData( UInt_t iPedLow, UInt_t iPedHigh, UInt_t iIntLow, UInt_t iIntHigh -) { +) const { return GetIntegral(iIntLow, iIntHigh) - GetAverage(iPedHigh, iPedLow) * (iIntHigh - iIntLow + 1); } -UInt_t THcRawAdcHit::GetNPulses() { +UInt_t THcRawAdcHit::GetNPulses() const { return fNPulses; } -UInt_t THcRawAdcHit::GetNSamples() { +UInt_t THcRawAdcHit::GetNSamples() const { return fNSamples; } -Bool_t THcRawAdcHit::HasMulti() { +Bool_t THcRawAdcHit::HasMulti() const { return fHasMulti; } -Int_t THcRawAdcHit::GetPedRaw() { +Int_t THcRawAdcHit::GetPedRaw() const { return fAdcPedestal[0]; } -Int_t THcRawAdcHit::GetPulseIntRaw(UInt_t iPulse) { +Int_t THcRawAdcHit::GetPulseIntRaw(UInt_t iPulse) const { return fAdc[iPulse]; } -Int_t THcRawAdcHit::GetPulseAmpRaw(UInt_t iPulse) { +Int_t THcRawAdcHit::GetPulseAmpRaw(UInt_t iPulse) const { return fAdcPulse[iPulse]; } -Int_t THcRawAdcHit::GetPulseTimeRaw(UInt_t iPulse) { +Int_t THcRawAdcHit::GetPulseTimeRaw(UInt_t iPulse) const { return fAdcTime[iPulse]; } -Double_t THcRawAdcHit::GetPed() { +Double_t THcRawAdcHit::GetPed() const { return static_cast<Double_t>(fAdcPedestal[0])/static_cast<Double_t>(fNPedestalSamples); } -Double_t THcRawAdcHit::GetPulseInt(UInt_t iPulse) { +Double_t THcRawAdcHit::GetPulseInt(UInt_t iPulse) const { return static_cast<Double_t>(fAdc[iPulse]) - static_cast<Double_t>(fAdcPedestal[0])*fPeakPedestalRatio; } -Double_t THcRawAdcHit::GetPulseAmp(UInt_t iPulse) { +Double_t THcRawAdcHit::GetPulseAmp(UInt_t iPulse) const { return static_cast<Double_t>(fAdcPulse[iPulse]) - static_cast<Double_t>(fAdcPedestal[0])/static_cast<Double_t>(fNPedestalSamples); } -Int_t THcRawAdcHit::GetSampleIntRaw() { +//Int_t THcRawAdcHit::GetPulseTime(UInt_t iPulse) const { +// return static_cast<Double_t>(fAdcTime[iPulse]); +//} + + +Int_t THcRawAdcHit::GetSampleIntRaw() const { Int_t integral = 0; for (UInt_t iSample=0; iSample<fNSamples; ++iSample) { @@ -294,7 +300,7 @@ Int_t THcRawAdcHit::GetSampleIntRaw() { } -Double_t THcRawAdcHit::GetSampleInt() { +Double_t THcRawAdcHit::GetSampleInt() const { return static_cast<Double_t>(GetSampleIntRaw()) - GetPed()*static_cast<Double_t>(fNSamples); } diff --git a/src/THcRawAdcHit.h b/src/THcRawAdcHit.h index 42c812d269bafdd2759ca8e34a2b1c7e0be4bc13..e824dd566f615ff9ba77d445e67732e746652d48 100644 --- a/src/THcRawAdcHit.h +++ b/src/THcRawAdcHit.h @@ -18,35 +18,35 @@ class THcRawAdcHit : public TObject { Int_t data, Int_t time, Int_t pedestal, Int_t peak ); - Int_t GetRawData(UInt_t iPulse=0); - Int_t GetAdcTime(UInt_t iPulse=0); - Int_t GetAdcPedestal(UInt_t iPulse=0); - Int_t GetAdcPulse(UInt_t iPulse=0); - Int_t GetSample(UInt_t iSample); - - Double_t GetAverage(UInt_t iSampleLow, UInt_t iSampleHigh); - Int_t GetIntegral(UInt_t iSampleLow, UInt_t iSampleHigh); + Int_t GetRawData(UInt_t iPulse=0) const; + Int_t GetAdcTime(UInt_t iPulse=0) const; + Int_t GetAdcPedestal(UInt_t iPulse=0) const; + Int_t GetAdcPulse(UInt_t iPulse=0) const; + Int_t GetSample(UInt_t iSample) const; + + Double_t GetAverage(UInt_t iSampleLow, UInt_t iSampleHigh) const; + Int_t GetIntegral(UInt_t iSampleLow, UInt_t iSampleHigh) const; Double_t GetData( UInt_t iPedLow, UInt_t iPedHigh, UInt_t iIntLow, UInt_t iIntHigh - ); + ) const; - UInt_t GetNPulses(); - UInt_t GetNSamples(); + UInt_t GetNPulses() const; + UInt_t GetNSamples() const; - Bool_t HasMulti(); + Bool_t HasMulti() const; - Int_t GetPedRaw(); - Int_t GetPulseIntRaw(UInt_t iPulse=0); - Int_t GetPulseAmpRaw(UInt_t iPulse=0); - Int_t GetPulseTimeRaw(UInt_t iPulse=0); + Int_t GetPedRaw() const; + Int_t GetPulseIntRaw(UInt_t iPulse=0) const; + Int_t GetPulseAmpRaw(UInt_t iPulse=0) const; + Int_t GetPulseTimeRaw(UInt_t iPulse=0) const; - Double_t GetPed(); - Double_t GetPulseInt(UInt_t iPulse=0); - Double_t GetPulseAmp(UInt_t iPulse=0); - //Double_t GetPulseTime(UInt_t iPulse=0); // TODO: Figure out what to do with time. + Double_t GetPed() const; + Double_t GetPulseInt(UInt_t iPulse=0) const; + Double_t GetPulseAmp(UInt_t iPulse=0) const; + //Int_t GetPulseTime(UInt_t iPulse=0) const; - Int_t GetSampleIntRaw(); - Double_t GetSampleInt(); + Int_t GetSampleIntRaw() const; + Double_t GetSampleInt() const; protected: static const UInt_t fMaxNPulses = 4; @@ -55,6 +55,7 @@ class THcRawAdcHit : public TObject { Int_t fNPedestalSamples; // TODO: Get this from prestart event... Int_t fNPeakSamples; Double_t fPeakPedestalRatio; + Double_t fChannelToTimeFactor; Int_t fAdc[fMaxNPulses]; // TODO: Rename these... Int_t fAdcTime[fMaxNPulses]; diff --git a/src/THcRawTdcHit.cxx b/src/THcRawTdcHit.cxx index 8fa19378ffb14165fda1364da8c7e9420f447f44..6850206bf9f43aa7405f75191a0bd029260b66a5 100644 --- a/src/THcRawTdcHit.cxx +++ b/src/THcRawTdcHit.cxx @@ -14,6 +14,7 @@ THcRawTdcHit::THcRawTdcHit() : TObject(), + fChannelToTimeFactor(0.1), fTime(), fRefTime(0), fHasRefTime(kFALSE), fNHits(0) {} diff --git a/src/THcRawTdcHit.h b/src/THcRawTdcHit.h index e04dad374ca3d8817f6b9eec4fdad95b508977b6..daa7e960c1278b0dda856963980372559879699e 100644 --- a/src/THcRawTdcHit.h +++ b/src/THcRawTdcHit.h @@ -26,6 +26,8 @@ class THcRawTdcHit : public TObject { protected: static const UInt_t fMaxNHits = 16; + Double_t fChannelToTimeFactor; + Int_t fTime[fMaxNHits]; Int_t fRefTime;