Skip to content

Commit 805020e

Browse files
Michael CarriganMichael Carrigan
authored andcommitted
update GaussHitFinderSBN_module to take per plane hit finding parameters
1 parent 71e303b commit 805020e

File tree

3 files changed

+24
-20
lines changed

3 files changed

+24
-20
lines changed

sbncode/CAFMaker/RecoUtils/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ art_make_library( LIBRARY_NAME caf_RecoUtils
1111
larsim::MCCheater_BackTrackerService_service
1212
larsim::MCCheater_ParticleInventoryService_service
1313
larcorealg::Geometry
14+
sbnanaobj::StandardRecord
15+
sbnanaobj::StandardRecordFlat
1416
)

sbncode/HitFinder/GaussHitFinderSBN_module.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ namespace hit {
7979
const std::vector<int> fLongMaxHitsVec; ///<Maximum number hits on a really long pulse train
8080
const std::vector<int> fLongPulseWidthVec; ///<Sets width of hits used to describe long pulses
8181

82-
const size_t fMaxMultiHit; ///<maximum hits for multi fit
82+
const std::vector<size_t> fMaxMultiHit; ///<maximum hits for multi fit
8383
const int fAreaMethod; ///<Type of area calculation
8484
const std::vector<double>
8585
fAreaNormsVec; ///<factors for converting area to same units as peak height
86-
const double fChi2NDF; ///maximum Chisquared / NDF allowed for a hit to be saved
86+
const std::vector<double> fChi2NDF; ///maximum Chisquared / NDF allowed for a hit to be saved
8787

8888
const std::vector<float> fPulseHeightCuts;
8989
const std::vector<float> fPulseWidthCuts;
@@ -116,10 +116,10 @@ namespace hit {
116116
, fLongMaxHitsVec(pset.get<std::vector<int>>("LongMaxHits", std::vector<int>() = {25, 25, 25}))
117117
, fLongPulseWidthVec(
118118
pset.get<std::vector<int>>("LongPulseWidth", std::vector<int>() = {16, 16, 16}))
119-
, fMaxMultiHit(pset.get<int>("MaxMultiHit"))
119+
, fMaxMultiHit(pset.get<std::vector<size_t>>("MaxMultiHitPerPlane", std::vector<size_t>() = {5, 5, 5}))
120120
, fAreaMethod(pset.get<int>("AreaMethod"))
121121
, fAreaNormsVec(FillOutHitParameterVector(pset.get<std::vector<double>>("AreaNorms")))
122-
, fChi2NDF(pset.get<double>("Chi2NDF"))
122+
, fChi2NDF(pset.get<std::vector<double>>("Chi2NDFPerPlane", std::vector<double>() = {500.0, 500.0, 500.0}))
123123
, fPulseHeightCuts(
124124
pset.get<std::vector<float>>("PulseHeightCuts", std::vector<float>() = {3.0, 3.0, 3.0}))
125125
, fPulseWidthCuts(
@@ -365,13 +365,13 @@ namespace hit {
365365
// #######################################################
366366
// ### If # requested Gaussians is too large then punt ###
367367
// #######################################################
368-
if (mergedCands.size() <= fMaxMultiHit) {
368+
if (mergedCands.size() <= fMaxMultiHit.at(plane)) {
369369
fPeakFitterTool->findPeakParameters(
370370
range.data(), mergedCands, peakParamsVec, chi2PerNDF, NDF);
371371

372372
// If the chi2 is infinite then there is a real problem so we bail
373373
if (!(chi2PerNDF < std::numeric_limits<double>::infinity())) {
374-
chi2PerNDF = 2. * fChi2NDF;
374+
chi2PerNDF = 2. * fChi2NDF.at(plane);
375375
NDF = 2;
376376
}
377377

@@ -384,7 +384,7 @@ namespace hit {
384384
// ### depend on the fhicl parameter fLongPulseWidth ###
385385
// ### Also do this if chi^2 is too large ###
386386
// #######################################################
387-
if (mergedCands.size() > fMaxMultiHit || nGausForFit * chi2PerNDF > fChi2NDF) {
387+
if (mergedCands.size() > fMaxMultiHit.at(plane) || nGausForFit * chi2PerNDF > fChi2NDF.at(plane)) {
388388
int longPulseWidth = fLongPulseWidthVec.at(plane);
389389
int nHitsThisPulse = (endT - startT) / longPulseWidth;
390390

@@ -401,7 +401,7 @@ namespace hit {
401401
peakParamsVec.clear();
402402
nGausForFit = nHitsThisPulse;
403403
NDF = 1.;
404-
chi2PerNDF = chi2PerNDF > fChi2NDF ? chi2PerNDF : -1.;
404+
chi2PerNDF = chi2PerNDF > fChi2NDF.at(plane) ? chi2PerNDF : -1.;
405405

406406
for (int hitIdx = 0; hitIdx < nHitsThisPulse; hitIdx++) {
407407
// This hit parameters

sbncode/HitFinder/hitfindermodules_sbn.fcl

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@ gauss_hitfinder:
1111
{
1212
module_type: "GaussHitFinderSBN"
1313
CalDataModuleLabel: "caldata"
14-
MaxMultiHit: 5 # maximum hits for multi gaussia fit attempt
15-
AreaMethod: 0 # 0 = area by integral, 1 = area by gaussian area formula
16-
AreaNorms: [ 1.0, 1.0, 1.0 ] # normalizations that put signal area in
17-
# same scale as peak height.
18-
TryNplus1Fits: false # Don't try to refit with extra peak if bad chisq
19-
LongMaxHits: [ 25, 25, 25] # max number hits in long pulse trains
20-
LongPulseWidth: [ 10, 10, 10] # max widths for hits in long pulse trains
21-
Chi2NDF: 500. # maximum Chisquared / NDF allowed to store fit, if fail
22-
# will use "long" pulse method to return hit
23-
AllHitsInstanceName: "" # If non-null then this will be the instance name of all hits output to event
24-
# in this case there will be two hit collections, one filtered and one containing all hits
14+
MaxMultiHit: 5 # maximum hits for multi gaussian fit attempt
15+
MaxMultiHitPerPlane: [ 10, 10, 8 ] # maximum hits per plane for multi gaussia fit attempt
16+
AreaMethod: 0 # 0 = area by integral, 1 = area by gaussian area formula
17+
AreaNorms: [ 1.0, 1.0, 1.0 ] # normalizations that put signal area in
18+
# same scale as peak height.
19+
TryNplus1Fits: false # Don't try to refit with extra peak if bad chisq
20+
LongMaxHits: [ 25, 25, 25] # max number hits in long pulse trains
21+
LongPulseWidth: [ 5, 5, 5] # max widths for hits in long pulse trains
22+
Chi2NDF: 500. # maximum Chisquared / NDF allowed to store fit
23+
Chi2NDFPerPlane: [ 2500., 1750., 2500.] # maximum Chisquared / NDF allowed per plane to store, if fail
24+
# will use "long" pulse method to return hit
25+
AllHitsInstanceName: "" # If non-null then this will be the instance name of all hits output to event
26+
# in this case there will be two hit collections, one filtered and one containing all hits
2527

2628
# Candididate peak finding done by tool, one tool instantiated per plane (but could be other divisions too)
2729
HitFinderToolVec:
@@ -39,7 +41,7 @@ gauss_hitfinder:
3941
HitFilterAlg:
4042
{
4143
AlgName: "HitFilterAlg"
42-
MinPulseHeight: [5.0, 5.0, 5.0] #minimum hit peak amplitude per plane
44+
MinPulseHeight: [2.0, 2.0, 2.0] #minimum hit peak amplitude per plane
4345
MinPulseSigma: [1.0, 1.0, 1.0] #minimum hit rms per plane
4446
}
4547
# In addition to the filter alg we can also filter hits on the same pulse train

0 commit comments

Comments
 (0)