Skip to content

Commit 82c781c

Browse files
mastbaumJack Smedley
authored andcommitted
g4reweight bugfix and temporary parameter storage
* Placeholder for sampled parameter storage, for CAF compatibility. * Renamed fcl for consistency
1 parent c30d8d1 commit 82c781c

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

fcl/caf/cafmaker_common_defs.fcl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include "eventweight_geant4_sbn.fcl"
12
#include "eventweight_genie_sbn.fcl"
23
#include "eventweight_flux_sbn.fcl"
34

@@ -15,6 +16,7 @@ cafmaker_common_producers: {
1516
rns: { module_type: "RandomNumberSaver" }
1617
genieweight: @local::sbn_eventweight_genie
1718
fluxweight: @local::sbn_eventweight_flux
19+
geant4weight: @local::sbn_eventweight_geant4
1820
}
1921

2022
END_PROLOG

sbncode/SBNEventWeight/Calculators/Geant4/Geant4WeightCalc.cxx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ void Geant4WeightCalc::Configure(fhicl::ParameterSet const& p,
165165
std::vector<double> FitParSigmas;
166166
std::map<std::string, double> theNominals;
167167

168+
fParameterSet.Configure(GetFullName(), mode, fNsims);
169+
168170
for (size_t i_parset=0; i_parset<n_parsets; ++i_parset){
169171
fhicl::ParameterSet theSet = FitParSets.at(i_parset);
170172
std::string theName = theSet.get<std::string>("Name");
@@ -176,6 +178,8 @@ void Geant4WeightCalc::Configure(fhicl::ParameterSet const& p,
176178
FitParSigmas.push_back(theSigma);
177179

178180
theNominals[theName] = theNominal;
181+
182+
fParameterSet.AddParameter(theName, theSigma);
179183
}
180184

181185
if (mode=="pm1sigma"){
@@ -240,7 +244,7 @@ std::vector<float> Geant4WeightCalc::GetWeight(art::Event& e, size_t itruth ) {
240244

241245
// Initialize weight vector for this MCTruth
242246
weight.clear();
243-
weight.resize(1.0);
247+
weight.resize(fNsims, 1.0);
244248

245249
// Loop over MCParticles in the event
246250
auto const& mcparticles = truthParticles.at(itruth);
@@ -431,7 +435,6 @@ std::vector<float> Geant4WeightCalc::GetWeight(art::Event& e, size_t itruth ) {
431435
ParMaker->SetNewVals(UniverseVals.at(j));
432436
theReweighter->SetNewHists(ParMaker->GetFSHists());
433437
theReweighter->SetNewElasticHists(ParMaker->GetElasticHist());
434-
435438
//Get the weight from the G4ReweightTraj
436439
w = theReweighter->GetWeight( &theTraj );
437440
// Total weight is the product of track weights in the event

sbncode/SBNEventWeight/jobs/geant4/eventweight_g4rwt_reint.fcl renamed to sbncode/SBNEventWeight/jobs/geant4/eventweight_geant4_sbn.fcl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
#include "piminus_reweight_parameters.fcl"
1616
#include "proton_reweight_parameters.fcl"
1717

18-
geant4weight_sbn: {
18+
BEGIN_PROLOG
19+
20+
sbn_eventweight_geant4: {
1921
module_type: "SBNEventWeight"
2022
AllowMissingTruth: true
2123
min_weight: 0.0
@@ -97,3 +99,5 @@ geant4weight_sbn: {
9799
# variation)
98100
###
99101

102+
END_PROLOG
103+

0 commit comments

Comments
 (0)