From db8a79c6329688d824077027c0e6c0cccf7b0d26 Mon Sep 17 00:00:00 2001 From: Justin Stevens Date: Mon, 1 Jun 2020 11:09:40 -0400 Subject: [PATCH] add option to do accidental subtraction weighting in AnalyzeCutActions --- libraries/DSelector/DHistogramActions.cc | 16 +++++++++++----- libraries/DSelector/DHistogramActions.h | 5 +++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/libraries/DSelector/DHistogramActions.cc b/libraries/DSelector/DHistogramActions.cc index 42eb01b..d9056dc 100644 --- a/libraries/DSelector/DHistogramActions.cc +++ b/libraries/DSelector/DHistogramActions.cc @@ -41,7 +41,13 @@ void DHistogramAction_AnalyzeCutActions::Initialize(void) } -bool DHistogramAction_AnalyzeCutActions::Perform_Action(void) +bool DHistogramAction_AnalyzeCutActions::Perform_Action() +{ + double weight = 1.0; + return Perform_ActionWeight(weight); +} + +bool DHistogramAction_AnalyzeCutActions::Perform_ActionWeight(double weight = 1.0) { bool locComboCut = false; //double locMass = 0.0; @@ -72,16 +78,16 @@ bool DHistogramAction_AnalyzeCutActions::Perform_Action(void) } if (locFill) - Fill_Hists(cut_iter.second, locIndexCombos); + Fill_Hists(cut_iter.second, locIndexCombos, weight); } if (!locComboCut) - Fill_Hists(dHist_InvariantMass_allcuts, locIndexCombos); + Fill_Hists(dHist_InvariantMass_allcuts, locIndexCombos, weight); return true; } -bool DHistogramAction_AnalyzeCutActions::Fill_Hists(TH1I* locHist, set > locIndexCombos) +bool DHistogramAction_AnalyzeCutActions::Fill_Hists(TH1I* locHist, set > locIndexCombos, double weight) { dPreviouslyHistogrammed.clear(); double locMass = 0.0; @@ -94,7 +100,7 @@ bool DHistogramAction_AnalyzeCutActions::Fill_Hists(TH1I* locHist, setFill(locMass); + locHist->Fill(locMass, weight); } } return true; diff --git a/libraries/DSelector/DHistogramActions.h b/libraries/DSelector/DHistogramActions.h index 3dc0074..67054b0 100644 --- a/libraries/DSelector/DHistogramActions.h +++ b/libraries/DSelector/DHistogramActions.h @@ -38,10 +38,11 @@ class DHistogramAction_AnalyzeCutActions : public DAnalysisAction void Reset_NewEvent(void){dPreviouslyHistogrammed.clear();}; //reset uniqueness tracking void Initialize(void); - bool Perform_Action(void); + bool Perform_Action(); + bool Perform_ActionWeight(double weight); private: - bool Fill_Hists(TH1I* locHist, set> locIndexCombos); + bool Fill_Hists(TH1I* locHist, set> locIndexCombos, double weight); vector dAllAnalysisActions; Particle_t dInitialPID; int dStepIndex;