Skip to content

Commit 5977b29

Browse files
author
Michael Carrigan
committed
Updates from Mattia to allow only one definition of MaxMultiHitPerPlane and Chi2PerPlane
1 parent 805020e commit 5977b29

2 files changed

Lines changed: 21 additions & 10 deletions

File tree

sbncode/HitFinder/GaussHitFinderSBN_module.cc

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,33 @@ namespace hit {
6969
void beginJob(art::ProcessingFrame const&) override;
7070

7171
std::vector<double> FillOutHitParameterVector(const std::vector<double>& input);
72+
73+
template<class T>
74+
inline std::vector<T> getValueOrListOf(fhicl::ParameterSet const& pset, std::string const& key) {
75+
76+
auto const& wireReadoutGeom = art::ServiceHandle<geo::WireReadout const>()->Get();
77+
const unsigned int N_PLANES = wireReadoutGeom.Nplanes();
78+
79+
if (pset.is_key_to_sequence(key))
80+
return pset.get<std::vector<T>>(key);
81+
else
82+
return std::vector<T>(N_PLANES, pset.get<T>(key));
83+
} // getValueOrListOf()
7284

7385
const bool fFilterHits;
7486
const bool fFillHists;
7587

7688
const std::string fCalDataModuleLabel;
7789
const std::string fAllHitsInstanceName;
7890

79-
const std::vector<int> fLongMaxHitsVec; ///<Maximum number hits on a really long pulse train
80-
const std::vector<int> fLongPulseWidthVec; ///<Sets width of hits used to describe long pulses
91+
const std::vector<int> fLongMaxHitsVec; ///< Maximum number hits on a really long pulse train
92+
const std::vector<int> fLongPulseWidthVec; ///< Sets width of hits used to describe long pulses
8193

82-
const std::vector<size_t> fMaxMultiHit; ///<maximum hits for multi fit
83-
const int fAreaMethod; ///<Type of area calculation
94+
const std::vector<size_t> fMaxMultiHit; ///< Maximum hits for multi fit
95+
const int fAreaMethod; ///< Type of area calculation
8496
const std::vector<double>
85-
fAreaNormsVec; ///<factors for converting area to same units as peak height
86-
const std::vector<double> fChi2NDF; ///maximum Chisquared / NDF allowed for a hit to be saved
97+
fAreaNormsVec; ///< Factors for converting area to same units as peak height
98+
const std::vector<double> fChi2NDF; ///< Maximum Chisquared / NDF allowed for a hit to be saved
8799

88100
const std::vector<float> fPulseHeightCuts;
89101
const std::vector<float> fPulseWidthCuts;
@@ -116,17 +128,18 @@ namespace hit {
116128
, fLongMaxHitsVec(pset.get<std::vector<int>>("LongMaxHits", std::vector<int>() = {25, 25, 25}))
117129
, fLongPulseWidthVec(
118130
pset.get<std::vector<int>>("LongPulseWidth", std::vector<int>() = {16, 16, 16}))
119-
, fMaxMultiHit(pset.get<std::vector<size_t>>("MaxMultiHitPerPlane", std::vector<size_t>() = {5, 5, 5}))
131+
, fMaxMultiHit(getValueOrListOf<size_t>(pset, "MaxMultiHit"))
120132
, fAreaMethod(pset.get<int>("AreaMethod"))
121133
, fAreaNormsVec(FillOutHitParameterVector(pset.get<std::vector<double>>("AreaNorms")))
122-
, fChi2NDF(pset.get<std::vector<double>>("Chi2NDFPerPlane", std::vector<double>() = {500.0, 500.0, 500.0}))
134+
, fChi2NDF(getValueOrListOf<double>(pset, "Chi2NDF"))
123135
, fPulseHeightCuts(
124136
pset.get<std::vector<float>>("PulseHeightCuts", std::vector<float>() = {3.0, 3.0, 3.0}))
125137
, fPulseWidthCuts(
126138
pset.get<std::vector<float>>("PulseWidthCuts", std::vector<float>() = {2.0, 1.5, 1.0}))
127139
, fPulseRatioCuts(
128140
pset.get<std::vector<float>>("PulseRatioCuts", std::vector<float>() = {0.35, 0.40, 0.20}))
129141
{
142+
130143
if (fFillHists && art::Globals::instance()->nthreads() > 1u) {
131144
throw art::Exception(art::errors::Configuration)
132145
<< "Cannot fill histograms when multiple threads configured, please set fFillHists to "

sbncode/HitFinder/hitfindermodules_sbn.fcl

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

0 commit comments

Comments
 (0)