@@ -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 "
0 commit comments