1 #ifndef ABSCEXDRIVER_hh 2 #define ABSCEXDRIVER_hh 21 TTree *
tree, std::vector<ThinSliceEvent> &
events,
22 std::vector<ThinSliceEvent> & fake_data_events,
23 int & split_val,
const bool & do_split)
override;
27 int split_val = 0)
override;
30 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
31 const std::map<int, bool> & signal_sample_checks,
33 std::map<
int, std::vector<double>> & sample_scales,
34 std::vector<double> & beam_energy_bins,
35 int split_val = 0)
override;
38 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
39 const std::map<int, bool> & signal_sample_checks,
41 std::map<
int, std::vector<double>> & sample_scales,
45 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
46 const std::map<int, bool> & signal_sample_checks,
48 std::map<
int, std::vector<double>> & sample_scales,
52 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
53 const std::map<int, bool> & signal_sample_checks,
55 std::map<
int, std::vector<double>> & sample_scales,
59 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
60 const std::map<int, bool> & signal_sample_checks,
62 std::map<
int, std::vector<double>> & sample_scales,
63 std::vector<double> & beam_energy_bins,
67 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
68 const std::map<int, bool> & signal_sample_checks,
70 std::map<
int, std::vector<double>> & sample_scales,
75 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
76 const std::map<int, bool> & signal_sample_checks,
78 std::map<
int, std::vector<double>> & sample_scales,
83 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
84 const std::map<int, bool> & signal_sample_checks,
86 std::map<
int, std::vector<double>> & sample_scales,
91 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
92 const std::map<int, bool> & signal_sample_checks,
94 std::map<
int, std::vector<double>> & sample_scales,
98 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
99 const std::map<int, bool> & signal_sample_checks,
101 std::map<
int, std::vector<double>> & sample_scales,
105 const std::vector<ThinSliceEvent> & events,
106 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
107 const std::map<int, bool> & signal_sample_checks,
108 std::map<int, double> & nominal_fluxes,
109 std::map<
int,
std::vector<std::vector<double>>> & fluxes_by_sample,
110 std::vector<double> & beam_energy_bins)
override;
114 const std::vector<ThinSliceEvent> & events,
115 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
116 const std::map<int, bool> & signal_sample_checks,
117 std::vector<double> & beam_energy_bins,
118 const std::map<
int, std::vector<double>> & signal_pars,
119 const std::map<int, double> & flux_pars,
120 const std::map<std::string, ThinSliceSystematic> & syst_pars,
121 bool fit_under_over,
bool fill_incident =
false)
override;
130 const std::vector<ThinSliceEvent> & events,
131 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
132 const std::map<int, bool> & signal_sample_checks,
133 std::vector<double> & beam_energy_bins,
134 const std::map<std::string, ThinSliceSystematic> & pars,
138 const std::vector<ThinSliceEvent> & events,
139 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
140 const std::map<std::string, ThinSliceSystematic> & pars,
141 TFile & output_file);
143 const std::vector<ThinSliceEvent> & events,
144 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
145 const std::map<std::string, ThinSliceSystematic> & pars,
146 TFile & output_file);
149 const std::vector<ThinSliceEvent> & events,
150 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
151 const std::map<std::string, ThinSliceSystematic> & pars,
152 TFile & output_file);
155 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
158 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
163 bool post_fit,
int nPars,
164 TDirectory * plot_dir)
override;
167 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
169 std::map<
int, std::vector<TH1*>> & throw_hists,
170 bool plot_rebinned)
override;
173 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
174 std::map<
int, std::vector<TH1*>> &
hists,
175 std::map<
int, std::vector<TH1*>> & inc_hists,
176 std::map<
int, std::vector<TH1*>> & xsec_hists,
177 const std::vector<int> & incident_samples,
178 const std::map<
int, std::vector<double>> & signal_bins)
override;
181 ThinSliceDataSet & data_set, std::map<
int, std::vector<TH1*>> & throw_hists,
182 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
184 std::map<
int, std::vector<TH1*>> & truth_throw_hists,
185 std::map<
int, std::vector<TH1*>> & truth_inc_hists,
186 std::map<
int, std::vector<TH1*>> & truth_xsec_hists,
187 std::map<int, TH1*> & best_fit_incs,
188 std::map<int, TH1*> & best_fit_xsecs,
189 std::map<int, TH1*> & nominal_incs,
190 std::map<int, TH1*> & nominal_xsecs,
191 TFile & output_file,
bool plot_rebinned,
192 std::map<
int, std::vector<double>> * sample_scales = 0x0)
override;
195 const std::vector<ThinSliceEvent> & events,
196 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
197 const std::map<int, bool> & signal_sample_checks,
198 std::vector<double> & beam_energy_bins,
199 const std::map<std::string, ThinSliceSystematic> & pars,
200 TFile & output_file)
override;
208 const std::map<std::string, ThinSliceSystematic> & pars,
209 TFile & output_file);
211 const std::vector<ThinSliceEvent> & events,
212 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
213 const std::map<std::string, ThinSliceSystematic> & pars,
214 TFile & output_file);
219 const std::vector<ThinSliceEvent> & events,
220 std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
221 const std::map<std::string, ThinSliceSystematic> & pars,
222 TFile & output_file);
224 const std::map<std::string, ThinSliceSystematic> & pars);
226 const std::map<std::string, ThinSliceSystematic> & pars);
228 const std::map<std::string, ThinSliceSystematic> & pars);
230 const std::map<std::string, ThinSliceSystematic> & pars);
237 const std::map<std::string, ThinSliceSystematic> & pars);
243 const std::map<std::string, ThinSliceSystematic> & pars,
248 const std::map<std::string, ThinSliceSystematic> & pars);
251 const std::map<std::string, ThinSliceSystematic> & pars);
254 const std::map<std::string, ThinSliceSystematic> & pars);
257 const std::map<std::string, ThinSliceSystematic> & pars);
262 TProfile * prot_template);
316 const std::vector<double> & true_beam_traj_Z,
317 const std::vector<double> & true_beam_traj_KE,
318 const std::vector<int> & true_beam_slices,
319 const std::vector<double> & true_beam_incidentEnergies);
323 const std::vector<double> & beam_energy_bins,
324 const double & true_beam_startP);
std::pair< double, double > fSystBeamShiftLimits
double GetSystWeight_EffVar(const ThinSliceEvent &event, const std::map< std::string, ThinSliceSystematic > &pars)
void FakeDataG4RWGrid(TTree *tree, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< int, bool > &signal_sample_checks, ThinSliceDataSet &data_set, double &flux, std::map< int, std::vector< double >> &sample_scales, std::vector< double > &beam_energy_bins, int split_val=0)
TGraph * fSystBeamShiftWidths
void SetupSyst_BeamShiftSpline2(const std::vector< ThinSliceEvent > &events, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< std::string, ThinSliceSystematic > &pars, TFile &output_file)
void GetCurrentHists(std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, ThinSliceDataSet &data_set, std::map< int, std::vector< TH1 * >> &throw_hists, bool plot_rebinned) override
void SetupSysts(const std::vector< ThinSliceEvent > &events, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< int, bool > &signal_sample_checks, std::vector< double > &beam_energy_bins, const std::map< std::string, ThinSliceSystematic > &pars, TFile &output_file) override
std::map< std::string, std::map< int, std::vector< TSpline3 * > > > fFullSelectionSplines
double fSystBeamShiftWeight
double GetSystWeight_BeamEffs(const ThinSliceEvent &event, const std::map< std::string, ThinSliceSystematic > &pars)
std::vector< double > MakeTrueIncidentEnergies(const std::vector< double > &true_beam_traj_Z, const std::vector< double > &true_beam_traj_KE, const std::vector< int > &true_beam_slices, const std::vector< double > &true_beam_incidentEnergies)
void FakeDataBeamWeight(TTree *tree, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< int, bool > &signal_sample_checks, ThinSliceDataSet &data_set, double &flux, std::map< int, std::vector< double >> &sample_scales, int split_val=0)
void FakeDatadEdX(TTree *tree, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< int, bool > &signal_sample_checks, ThinSliceDataSet &data_set, double &flux, std::map< int, std::vector< double >> &sample_scales, int split_val=0)
std::map< std::string, std::map< int, std::vector< TH1D * > > > fG4RWSelectionVarsMinus
int GetBeamBin(const std::vector< double > &beam_energy_bins, const double &true_beam_startP)
std::map< int, double > fMeans
void FakeDataAngleVar(TTree *tree, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< int, bool > &signal_sample_checks, ThinSliceDataSet &data_set, double &flux, std::map< int, std::vector< double >> &sample_scales, int split_val=0)
void FakeDataSampleScales(TTree *tree, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< int, bool > &signal_sample_checks, ThinSliceDataSet &data_set, double &flux, std::map< int, std::vector< double >> &sample_scales, int split_val=0)
int RecalculateSelectionID(const ThinSliceEvent &event, double C_cal, TProfile *prot_template)
void SetupSyst_BeamEffsWeight(const std::map< std::string, ThinSliceSystematic > &pars)
double GetSystWeight_BeamShift(const ThinSliceEvent &event, const std::map< std::string, ThinSliceSystematic > &pars)
void SetupSyst_BeamShiftSpline(const std::vector< ThinSliceEvent > &events, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< std::string, ThinSliceSystematic > &pars, TFile &output_file)
double GetSystWeight_EDiv(const ThinSliceEvent &event, const std::map< std::string, ThinSliceSystematic > &pars)
void WrapUpSysts(TFile &output_file) override
double dEdX(double KE, const simb::MCParticle *part)
TH1D fBeamShiftRatioNomHist
void SetupSyst_dEdX_Cal(const std::vector< ThinSliceEvent > &events, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< std::string, ThinSliceSystematic > &pars, TFile &output_file)
void FakeDataPionAngle(TTree *tree, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< int, bool > &signal_sample_checks, ThinSliceDataSet &data_set, double &flux, std::map< int, std::vector< double >> &sample_scales, int split_val=0)
void SetupSyst_EffVarWeight(const std::map< std::string, ThinSliceSystematic > &pars)
void SetupSyst_EDivWeight(const std::map< std::string, ThinSliceSystematic > &pars)
TGraph * fSystBeamShiftMeans
std::vector< TSpline3 * > fBeamShiftRatioSplines
TTree * fSystBeamShiftTree
double fSystBeamShiftWeightCap
void BuildDataHists(TTree *tree, ThinSliceDataSet &data_set, double &flux, int split_val=0) override
void FakeDataBinnedScales(TTree *tree, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< int, bool > &signal_sample_checks, ThinSliceDataSet &data_set, double &flux, std::map< int, std::vector< double >> &sample_scales, int split_val=0)
double GetSystWeight_NoTrack(const ThinSliceEvent &event, const std::map< std::string, ThinSliceSystematic > &pars)
bool fSystBeamShiftTreeSave
virtual void GetCurrentTruthHists(std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, std::map< int, std::vector< TH1 * >> &hists, std::map< int, std::vector< TH1 * >> &inc_hists, std::map< int, std::vector< TH1 * >> &xsec_hists, const std::vector< int > &incident_samples, const std::map< int, std::vector< double >> &signal_bins) override
ProtoDUNETrackUtils fTrackUtil
void PlotThrows(ThinSliceDataSet &data_set, std::map< int, std::vector< TH1 * >> &throw_hists, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, size_t nThrows, std::map< int, std::vector< TH1 * >> &truth_throw_hists, std::map< int, std::vector< TH1 * >> &truth_inc_hists, std::map< int, std::vector< TH1 * >> &truth_xsec_hists, std::map< int, TH1 * > &best_fit_incs, std::map< int, TH1 * > &best_fit_xsecs, std::map< int, TH1 * > &nominal_incs, std::map< int, TH1 * > &nominal_xsecs, TFile &output_file, bool plot_rebinned, std::map< int, std::vector< double >> *sample_scales=0x0) override
double TruncatedMean(const std::vector< double > &dEdX)
void BuildMCSamples(const std::vector< ThinSliceEvent > &events, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< int, bool > &signal_sample_checks, std::map< int, double > &nominal_fluxes, std::map< int, std::vector< std::vector< double >>> &fluxes_by_sample, std::vector< double > &beam_energy_bins) override
double GetSystWeight_G4RW(const ThinSliceEvent &event, const std::map< std::string, ThinSliceSystematic > &pars, const ThinSliceSample &sample, int selection_ID, double val)
void SetupSyst_EffVar(const std::vector< ThinSliceEvent > &events, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< std::string, ThinSliceSystematic > &pars, TFile &output_file)
std::map< std::string, std::map< int, std::vector< TH1D * > > > fG4RWSelectionVarsPlus
std::map< std::string, std::map< int, std::vector< TH1D * > > > fFullSelectionVars
std::vector< std::string > fActiveG4RWSysts
void SetupSyst_NoTrackWeight(const std::map< std::string, ThinSliceSystematic > &pars)
void FakeDataEffVar(TTree *tree, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< int, bool > &signal_sample_checks, ThinSliceDataSet &data_set, double &flux, std::map< int, std::vector< double >> &sample_scales, int split_val=0)
void SetupSyst_BeamShiftRatio(const std::vector< ThinSliceEvent > &events, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< std::string, ThinSliceSystematic > &pars, TFile &output_file)
void FillMCEvents(TTree *tree, std::vector< ThinSliceEvent > &events, std::vector< ThinSliceEvent > &fake_data_events, int &split_val, const bool &do_split) override
void FakeDataG4RW(TTree *tree, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< int, bool > &signal_sample_checks, ThinSliceDataSet &data_set, double &flux, std::map< int, std::vector< double >> &sample_scales, int split_val=0)
void CompareSelections(std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, ThinSliceDataSet &data_set, TFile &output_file, std::vector< std::pair< int, int >> plot_style, bool plot_rebinned, bool post_fit, int nPars, TDirectory *plot_dir) override
void SetupSyst_BeamShift(const std::map< std::string, ThinSliceSystematic > &pars, TFile &output_file)
void SetupSyst_G4RW(const std::vector< ThinSliceEvent > &events, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< int, bool > &signal_sample_checks, std::vector< double > &beam_energy_bins, const std::map< std::string, ThinSliceSystematic > &pars, TFile &output_file)
std::pair< double, size_t > CalculateChi2(std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, ThinSliceDataSet &data_set) override
void BuildFakeData(TTree *tree, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< int, bool > &signal_sample_checks, ThinSliceDataSet &data_set, double &flux, std::map< int, std::vector< double >> &sample_scales, std::vector< double > &beam_energy_bins, int split_val=0) override
TGraph2D * fSystBeamShiftMap
void RefillMCSamples(const std::vector< ThinSliceEvent > &events, std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, const std::map< int, bool > &signal_sample_checks, std::vector< double > &beam_energy_bins, const std::map< int, std::vector< double >> &signal_pars, const std::map< int, double > &flux_pars, const std::map< std::string, ThinSliceSystematic > &syst_pars, bool fit_under_over, bool fill_incident=false) override
AbsCexDriver(const fhicl::ParameterSet &extra_options)
Event finding and building.