Skip to content
Snippets Groups Projects
Commit 13ac3c02 authored by Whitney Armstrong's avatar Whitney Armstrong
Browse files

THcRawAdcHit: added loggin/removed throws

- Added better logging
- Removed throws
	modified:   THcRawAdcHit.cxx
parent 4bcc8096
No related branches found
No related tags found
No related merge requests found
...@@ -260,7 +260,8 @@ void THcRawAdcHit::SetRefTime(Int_t refTime) { ...@@ -260,7 +260,8 @@ void THcRawAdcHit::SetRefTime(Int_t refTime) {
void THcRawAdcHit::SetSample(Int_t data) { void THcRawAdcHit::SetSample(Int_t data) {
if (fNSamples >= fMaxNSamples) { if (fNSamples >= fMaxNSamples) {
throw std::out_of_range("`THcRawAdcHit::SetSample`: too many samples!"); //throw std::out_of_range("`THcRawAdcHit::SetSample`: too many samples!");
_hit_logger->error("THcRawAdcHit::SetSample: too many samples! Ignoring sample {}",fNSamples);
} }
fSample[fNSamples] = data; fSample[fNSamples] = data;
++fNSamples; ++fNSamples;
...@@ -282,10 +283,12 @@ void THcRawAdcHit::SetDataTimePedestalPeak(Int_t data, Int_t time, Int_t pedesta ...@@ -282,10 +283,12 @@ void THcRawAdcHit::SetDataTimePedestalPeak(Int_t data, Int_t time, Int_t pedesta
Int_t THcRawAdcHit::GetRawData(UInt_t iPulse) const { Int_t THcRawAdcHit::GetRawData(UInt_t iPulse) const {
if (iPulse >= fNPulses && iPulse != 0) { if (iPulse >= fNPulses && iPulse != 0) {
TString msg = TString::Format( //TString msg = TString::Format(
"`THcRawAdcHit::GetRawData`: requested pulse %d where only %d pulses available!", iPulse, // "`THcRawAdcHit::GetRawData`: requested pulse %d where only %d pulses available!", iPulse,
fNPulses); // fNPulses);
throw std::out_of_range(msg.Data()); //throw std::out_of_range(msg.Data());
_hit_logger->error("THcRawAdcHit::GetRawData: requested pulse {} where only {} pulses available!", iPulse, fNPulses);
return 0;
} else if (iPulse >= fNPulses && iPulse == 0) { } else if (iPulse >= fNPulses && iPulse == 0) {
return 0; return 0;
} else { } else {
...@@ -308,8 +311,10 @@ Double_t THcRawAdcHit::GetAverage(UInt_t iSampleLow, UInt_t iSampleHigh) const { ...@@ -308,8 +311,10 @@ Double_t THcRawAdcHit::GetAverage(UInt_t iSampleLow, UInt_t iSampleHigh) const {
Int_t THcRawAdcHit::GetIntegral(UInt_t iSampleLow, UInt_t iSampleHigh) const { Int_t THcRawAdcHit::GetIntegral(UInt_t iSampleLow, UInt_t iSampleHigh) const {
if (iSampleHigh >= fNSamples || iSampleLow >= fNSamples) { if (iSampleHigh >= fNSamples || iSampleLow >= fNSamples) {
TString msg = TString::Format("`THcRawAdcHit::GetAverage`: not this many samples available!"); //TString msg = TString::Format("`THcRawAdcHit::GetAverage`: not this many samples available!");
throw std::out_of_range(msg.Data()); //throw std::out_of_range(msg.Data());
_hit_logger->error("THcRawAdcHit::GetRawData: not this many samples available!");
return 0;
} else { } else {
Int_t integral = 0; Int_t integral = 0;
for (UInt_t i = iSampleLow; i <= iSampleHigh; ++i) { for (UInt_t i = iSampleLow; i <= iSampleHigh; ++i) {
...@@ -338,10 +343,12 @@ Int_t THcRawAdcHit::GetPulseIntRaw(UInt_t iPulse) const { ...@@ -338,10 +343,12 @@ Int_t THcRawAdcHit::GetPulseIntRaw(UInt_t iPulse) const {
} else if (iPulse == 0) { } else if (iPulse == 0) {
return 0; return 0;
} else { } else {
TString msg = TString::Format( //TString msg = TString::Format(
"`THcRawAdcHit::GetPulseIntRaw`: Trying to get pulse %d where only %d pulses available!", // "`THcRawAdcHit::GetPulseIntRaw`: Trying to get pulse %d where only %d pulses available!",
iPulse, fNPulses); // iPulse, fNPulses);
throw std::out_of_range(msg.Data()); //throw std::out_of_range(msg.Data());
_hit_logger->error("THcRawAdcHit::GetPulseIntRaw: Trying to get pulse {} where only {} pulses available!", iPulse, fNPulses);
return 0;
} }
} }
...@@ -351,10 +358,12 @@ Int_t THcRawAdcHit::GetPulseAmpRaw(UInt_t iPulse) const { ...@@ -351,10 +358,12 @@ Int_t THcRawAdcHit::GetPulseAmpRaw(UInt_t iPulse) const {
} else if (iPulse == 0) { } else if (iPulse == 0) {
return 0; return 0;
} else { } else {
TString msg = TString::Format( //TString msg = TString::Format(
"`THcRawAdcHit::GetPulseAmpRaw`: Trying to get pulse %d where only %d pulses available!", // "`THcRawAdcHit::GetPulseAmpRaw`: Trying to get pulse %d where only %d pulses available!",
iPulse, fNPulses); // iPulse, fNPulses);
throw std::out_of_range(msg.Data()); //throw std::out_of_range(msg.Data());
_hit_logger->error("THcRawAdcHit::GetPulseIntRaw: Trying to get pulse {} where only {} pulses available!", iPulse, fNPulses);
return 0;
} }
} }
...@@ -364,10 +373,12 @@ Int_t THcRawAdcHit::GetPulseTimeRaw(UInt_t iPulse) const { ...@@ -364,10 +373,12 @@ Int_t THcRawAdcHit::GetPulseTimeRaw(UInt_t iPulse) const {
} else if (iPulse == 0) { } else if (iPulse == 0) {
return 0; return 0;
} else { } else {
TString msg = TString::Format( //TString msg = TString::Format(
"`THcRawAdcHit::GetPulseTimeRaw`: Trying to get pulse %d where only %d pulses available!", // "`THcRawAdcHit::GetPulseTimeRaw`: Trying to get pulse %d where only %d pulses available!",
iPulse, fNPulses); // iPulse, fNPulses);
throw std::out_of_range(msg.Data()); //throw std::out_of_range(msg.Data());
_hit_logger->error("THcRawAdcHit::GetPulseIntRaw: Trying to get pulse {} where only {} pulses available!", iPulse, fNPulses);
return 0;
} }
} }
...@@ -375,10 +386,13 @@ Int_t THcRawAdcHit::GetSampleRaw(UInt_t iSample) const { ...@@ -375,10 +386,13 @@ Int_t THcRawAdcHit::GetSampleRaw(UInt_t iSample) const {
if (iSample < fNSamples) { if (iSample < fNSamples) {
return fSample[iSample]; return fSample[iSample];
} else { } else {
TString msg = TString::Format( //TString msg = TString::Format(
"`THcRawAdcHit::GetSampleRaw`: Trying to get sample %d where only %d samples available!", // "`THcRawAdcHit::GetSampleRaw`: Trying to get sample %d where only %d samples available!",
// iSample, fNSamples);
//throw std::out_of_range(msg.Data());
_hit_logger->error("THcRawAdcHit::GetSampleRaw: Trying to get sample {} where only {} samples available!",
iSample, fNSamples); iSample, fNSamples);
throw std::out_of_range(msg.Data()); return 0;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment