From 338322b99441b81a7c7bdc05963eabbff10ac366 Mon Sep 17 00:00:00 2001
From: Andrei Gaponenko <gandr@fnal.gov>
Date: Tue, 17 Sep 2019 16:08:23 -0500
Subject: [PATCH 1/2] Implement configuration validation for
 CollectionSizeAnalyzer.

---
 Analyses/src/CollectionSizeAnalyzer_module.cc | 24 ++++++++++++++-----
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/Analyses/src/CollectionSizeAnalyzer_module.cc b/Analyses/src/CollectionSizeAnalyzer_module.cc
index 00b4def19b..5160d4a871 100644
--- a/Analyses/src/CollectionSizeAnalyzer_module.cc
+++ b/Analyses/src/CollectionSizeAnalyzer_module.cc
@@ -62,17 +62,29 @@ namespace mu2e {
     void doSimParticles(const art::Event& event);
 
   public:
-    explicit CollectionSizeAnalyzer(const fhicl::ParameterSet& pset);
+
+    struct Config {
+      using Name=fhicl::Name;
+      using Comment=fhicl::Comment;
+      //using Atom=fhicl::Atom;
+      fhicl::Atom<bool> useModuleLabel{Name("useModuleLabel"), Comment("Include input module label into collection name in the plots") };
+      fhicl::Atom<bool> useInstanceName{Name("useInstanceName"), Comment("Include input instance name into collection name in the plots")};
+      fhicl::Atom<bool> useProcessName{Name("useProcessName"), Comment("Include input process name into collection name in the plots")};
+    };
+
+    using Parameters = art::EDAnalyzer::Table<Config>;
+    explicit CollectionSizeAnalyzer(const Parameters& conf);
+
     virtual void analyze(const art::Event& event);
   };
 
   //================================================================
-  CollectionSizeAnalyzer::CollectionSizeAnalyzer(const fhicl::ParameterSet& pset)
-    : art::EDAnalyzer(pset)
+  CollectionSizeAnalyzer::CollectionSizeAnalyzer(const Parameters& conf)
+    : art::EDAnalyzer(conf)
     , hStepPointSize_(0)
-    , useModuleLabel_(pset.get<bool>("useModuleLabel"))
-    , useInstanceName_(pset.get<bool>("useInstanceName"))
-    , useProcessName_(pset.get<bool>("useProcessName"))
+    , useModuleLabel_(conf().useModuleLabel())
+    , useInstanceName_(conf().useInstanceName())
+    , useProcessName_(conf().useProcessName())
   {
     art::ServiceHandle<art::TFileService> tfs;
     hStepPointSize_ = tfs->make<TProfile>("avgStepPointsSize", "Average step point collection size", 1, 0., 0.);

From 97c302585578b492a0c386d2a2e9c19fca7a0520 Mon Sep 17 00:00:00 2001
From: Andrei Gaponenko <gandr@fnal.gov>
Date: Thu, 19 Sep 2019 14:07:46 -0500
Subject: [PATCH 2/2] Remove an obsolete setting for CollectionSizeAnalyzer,
 caught by configuration validation.

---
 JobConfig/beam/PS.fcl             | 1 -
 JobConfig/beam/beam_defs_g4s1.fcl | 1 -
 JobConfig/beam/beam_g4s1MT.fcl    | 1 -
 JobConfig/pions/pions_g4s1.fcl    | 1 -
 4 files changed, 4 deletions(-)

diff --git a/JobConfig/beam/PS.fcl b/JobConfig/beam/PS.fcl
index 2ac66e56fd..c6895c9379 100644
--- a/JobConfig/beam/PS.fcl
+++ b/JobConfig/beam/PS.fcl
@@ -103,7 +103,6 @@ physics : {
       collectionSizes: {
 	 module_type: CollectionSizeAnalyzer
          useModuleLabel: true useInstanceName: true useProcessName: false
-	 maxStepPointMultiplicity: 500
       }
    }
 
diff --git a/JobConfig/beam/beam_defs_g4s1.fcl b/JobConfig/beam/beam_defs_g4s1.fcl
index a83ffbc350..4a45268574 100644
--- a/JobConfig/beam/beam_defs_g4s1.fcl
+++ b/JobConfig/beam/beam_defs_g4s1.fcl
@@ -117,7 +117,6 @@ physics : {
       collectionSizes: {
 	 module_type: CollectionSizeAnalyzer
          useModuleLabel: true useInstanceName: true useProcessName: false
-	 maxStepPointMultiplicity: 500
       }
    }
 
diff --git a/JobConfig/beam/beam_g4s1MT.fcl b/JobConfig/beam/beam_g4s1MT.fcl
index 6a626eb46b..e0eee1f408 100644
--- a/JobConfig/beam/beam_g4s1MT.fcl
+++ b/JobConfig/beam/beam_g4s1MT.fcl
@@ -119,7 +119,6 @@ physics : {
       collectionSizes: {
 	 module_type: CollectionSizeAnalyzer
          useModuleLabel: true useInstanceName: true useProcessName: false
-	 maxStepPointMultiplicity: 500
       }
    }
 
diff --git a/JobConfig/pions/pions_g4s1.fcl b/JobConfig/pions/pions_g4s1.fcl
index 03a278def5..8230765a6c 100644
--- a/JobConfig/pions/pions_g4s1.fcl
+++ b/JobConfig/pions/pions_g4s1.fcl
@@ -100,7 +100,6 @@ physics : {
             userModuleLabel          : true
             useInstanceName          : true
             useProcessName           : false
-            maxStepPointMultiplicity : 500
         }
     } // analyzers
 
