Skip to content

Commit

Permalink
Merge pull request #43 from rest-for-physics/lobis-threshold-tpc
Browse files Browse the repository at this point in the history
add threshold energy tpc parameter
  • Loading branch information
lobis authored Mar 7, 2024
2 parents fbb5bfa + 39f46e1 commit 9d46a0a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion inc/TRestDetectorSignalToRawSignalProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class TRestDetectorSignalToRawSignalProcess : public TRestEventProcess {

/// This parameter is used by integralWindow trigger mode to define the acquisition window.
Double_t fIntegralThreshold = 1229.0;
Double_t fIntegralThresholdTPCkeV = 0.1;

/// two distinct energy values used for calibration
TVector2 fCalibrationEnergy = TVector2(0.0, 0.0);
Expand Down Expand Up @@ -148,7 +149,7 @@ class TRestDetectorSignalToRawSignalProcess : public TRestEventProcess {
std::map<std::string, Parameters> fParametersMap;
std::set<std::string> fReadoutTypes;

ClassDefOverride(TRestDetectorSignalToRawSignalProcess, 6);
ClassDefOverride(TRestDetectorSignalToRawSignalProcess, 7);
};

#endif
14 changes: 11 additions & 3 deletions src/TRestDetectorSignalToRawSignalProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,11 @@ TRestEvent* TRestDetectorSignalToRawSignalProcess::ProcessEvent(TRestEvent* inpu
RESTDebug << "TRestDetectorSignalToRawSignalProcess::ProcessEvent: "
<< "Trigger mode integralThresholdTPC" << RESTendl;

const double signalIntegralThreshold = 0.5; // keV
double totalEnergy = 0;
for (const auto& signal : tpcSignals) {
totalEnergy += signal->GetIntegral();
}
if (totalEnergy < signalIntegralThreshold) {
if (totalEnergy < fIntegralThresholdTPCkeV) {
return nullptr;
}

Expand Down Expand Up @@ -340,7 +339,7 @@ TRestEvent* TRestDetectorSignalToRawSignalProcess::ProcessEvent(TRestEvent* inpu
if (energy > maxEnergy) {
maxEnergy = energy;
}
if (maxEnergy > signalIntegralThreshold) {
if (maxEnergy >= fIntegralThresholdTPCkeV) {
thresholdReached = true;
break;
}
Expand Down Expand Up @@ -577,6 +576,15 @@ void TRestDetectorSignalToRawSignalProcess::InitFromConfigFile() {

fTriggerDelay = StringToInteger(GetParameter("triggerDelay", fTriggerDelay));
fIntegralThreshold = StringToDouble(GetParameter("integralThreshold", fIntegralThreshold));
fIntegralThresholdTPCkeV =
StringToDouble(GetParameter("integralThresholdTPCkeV", fIntegralThresholdTPCkeV));
if (fIntegralThresholdTPCkeV <= 0) {
RESTWarning << "integralThresholdTPCkeV must be greater than 0: " << fIntegralThresholdTPCkeV
<< RESTendl;
// This should always be an error but breaks the CI...
// exit(1);
}

fTriggerFixedStartTime = GetDblParameterWithUnits("triggerFixedStartTime", fTriggerFixedStartTime);

// load default parameters (for backward compatibility)
Expand Down

0 comments on commit 9d46a0a

Please sign in to comment.