Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions sbndcode/OpDetReco/OpHit/SBNDOpHitFinder_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ namespace opdet {
std::vector<std::string> _pd_to_use; ///< PDS to use (ex: "pmt", "barepmt")
std::string fElectronics; ///< PDS readouts to use (ex: "CAEN", "Daphne")
std::vector<int> _opch_to_use; ///< List of of opch (will be infered from _pd_to_use)

std::vector<double> fADCThresholdVector;
bool fUseIndividualHitThreshold;
pmtana::PulseRecoManager fPulseRecoMgr;
pmtana::PMTPulseRecoBase* fThreshAlg;
pmtana::PMTPedestalBase* fPedAlg;
Expand Down Expand Up @@ -131,6 +132,9 @@ namespace opdet {
fElectronics = pset.get< std::string >("Electronics");
_opch_to_use = this->PDNamesToList(_pd_to_use);


fADCThresholdVector = pset.get< std::vector<double>>("ADCThresholdVector", {0});
fUseIndividualHitThreshold = pset.get< bool>("UseIndividualHitThreshold", false);
fDaphne_Freq = pset.get< float >("DaphneFreq");
fHitThreshold = pset.get< float >("HitThreshold");
bool useCalibrator = pset.get< bool > ("UseCalibrator", false);
Expand Down Expand Up @@ -164,7 +168,9 @@ namespace opdet {
auto const rise_alg_pset = pset.get_if_present<fhicl::ParameterSet>("RiseTimeCalculator");

// Initialize the hit finder algorithm
auto const hit_alg_pset = pset.get<fhicl::ParameterSet>("HitAlgoPset");
// If we need to apply and individual threshold for each channel, set the algorithm threhsold to the lowest value
auto hit_alg_pset = pset.get<fhicl::ParameterSet>("HitAlgoPset");
if(fUseIndividualHitThreshold) hit_alg_pset.put_or_replace<double>("ADCThreshold", *min_element(fADCThresholdVector.begin(), fADCThresholdVector.end()));
std::string threshAlgName = hit_alg_pset.get<std::string>("Name");
if (threshAlgName == "Threshold")
fThreshAlg = thresholdAlgorithm<pmtana::AlgoThreshold>(hit_alg_pset, rise_alg_pset);
Expand Down Expand Up @@ -318,6 +324,12 @@ namespace opdet {
// Now correct the time. Unfortunately, there are no setter methods for OpHits,
// so we have to make a new OpHit vector.
for (auto h : *HitPtr) {

// Apply individual threshold
int channelNumber = h.OpChannel();
int PeakAmplitude = h.Amplitude();
if(fUseIndividualHitThreshold && (PeakAmplitude < fADCThresholdVector[channelNumber]) ) continue;

(*HitPtrFinal).emplace_back(h.OpChannel(),
h.PeakTime() + clockData.TriggerTime(),
h.PeakTimeAbs(),
Expand Down