10 #include "CAFAna/Core/HistAxis.h" 11 #include "CAFAna/Core/Binning.h" 12 #include "CAFAna/Core/Cut.h" 63 #include "TStopwatch.h" 89 #include "Utilities/func/MathUtil.h" 95 std::string ndData =
"prod_caf_R19-11-18-prod5reco.g_nd_numi_fhc_full_v1_goodruns";
96 std::string ndMC =
"prod_caf_R19-11-18-prod5reco.d_nd_genie_N1810j0211a_nonswap_fhc_nova_v08_full_v1";
122 const unsigned int nQuants = 3;
132 (sample+
"_AllBins").c_str(),
133 (sample+
"_Quant1").c_str(),
134 (sample+
"_Quant2").c_str(),
135 (sample+
"_Quant3").c_str(),
152 std::string wfile_name = (
"/nova/ana/users/zvallari/AcceptSyst2020/"+wfile).c_str();
153 TFile *weight_file = TFile::Open(wfile_name.c_str());
156 gDirectory->GetObject((
"trueQ2_weight_"+sample).c_str(),h);
159 int nbins = h->GetNbinsX();
163 bins[
i-1] = h->GetBinContent(
i);
164 binslow[
i-1] = h->GetBinLowEdge(
i);
165 binshigh[
i-1] = h->GetBinLowEdge(
i) + h->GetBinWidth(
i);
168 const Var kTrueQ2Weight([nbins, &binslow, &binshigh, &bins](
const caf::SRProxy *
sr)
171 if((
kRecoQ2(sr) > binslow[
i]) && (
kRecoQ2(sr) < binshigh[i])){
return bins[
i];}
179 gDirectory->GetObject((
"PtP_weight_"+sample).c_str(),hptp);
182 int nbins_ptp = hptp->GetNbinsX();
183 double bins_ptp[nbins_ptp], binslow_ptp[nbins_ptp], binshigh_ptp[nbins_ptp];
185 for(
int i = 1;
i <= nbins_ptp; ++
i){
186 bins_ptp[
i-1] = hptp->GetBinContent(
i);
187 binslow_ptp[
i-1] = hptp->GetBinLowEdge(
i);
188 binshigh_ptp[
i-1] = hptp->GetBinLowEdge(
i) + hptp->GetBinWidth(
i);
191 const Var kPtPWeight([nbins_ptp, &binslow_ptp, &binshigh_ptp, &bins_ptp](
const caf::SRProxy *sr)
193 for(
int i = 0;
i < nbins_ptp; ++
i){
194 if((
kPtP(sr) > binslow_ptp[
i]) && (
kPtP(sr) < binshigh_ptp[i])){
return bins_ptp[
i];}
203 gDirectory->GetObject((
"CosNumi_weight_"+sample).c_str(),hcos);
206 int nbins_cos = hptp->GetNbinsX();
207 double bins_cos[nbins_cos], binslow_cos[nbins_cos], binshigh_cos[nbins_cos];
209 for(
int i = 1;
i <= nbins_cos; ++
i){
210 bins_cos[
i-1] = hcos->GetBinContent(
i);
211 binslow_cos[
i-1] = hcos->GetBinLowEdge(
i);
212 binshigh_cos[
i-1] = hcos->GetBinLowEdge(
i) + hcos->GetBinWidth(
i);
215 const Var kCosWeight([nbins_cos, &binslow_cos, &binshigh_cos, &bins_cos](
const caf::SRProxy *sr)
217 for(
int i = 0;
i < nbins_cos; ++
i){
218 if((
kCosNumi(sr) > binslow_cos[
i]) && (
kCosNumi(sr) < binshigh_cos[i])){
return bins_cos[
i];}
224 weight_file->Close();
229 for(
int selIdx = 0; selIdx <
kNumSels; ++selIdx){
230 for(
int varIdx = 0; varIdx <
kNumVars; ++varIdx){
234 spects[selIdx][varIdx] =
new Spectrum(loaderData, axis, sels[selIdx],
kNoShift);
240 spects_trueQ2[selIdx][varIdx] =
new Spectrum(loaderData, axis, sels[selIdx], kNoShift, kTrueQ2Weight);
245 spects_PtP[selIdx][varIdx] =
new Spectrum(loaderData, axis, sels[selIdx], kNoShift, kPtPWeight);
250 spects_Cos[selIdx][varIdx] =
new Spectrum(loaderData, axis, sels[selIdx], kNoShift, kCosWeight);
261 TString
fname =
"datamc_ND_numu_kinematics_RHC_REW_pTBins.root";
262 TFile*
fout =
new TFile(fname,
"RECREATE");
263 for(
int selIdx = 0; selIdx <
kNumSels; ++selIdx){
264 TDirectory*
d = fout->mkdir(selNames[selIdx].c_str());
265 for(
int varIdx = 0; varIdx <
kNumVars; ++varIdx){
266 const char*
name = defs[varIdx].
name.c_str();
Near Detector underground.
const ana::Var kRecoQ2([](const caf::SRProxy *sr){const double M_mu_sqrd=util::sqr(0.1056);double E_mu=kMuE(sr);double p_mu=sqrt(util::sqr(E_mu)-M_mu_sqrd);return 2 *kCCE(sr)*(E_mu-p_mu *kCosNumi(sr))-M_mu_sqrd;})
Reconstructed four-momentum transfer invariant (Q^2)
Cuts and Vars for the 2020 FD DiF Study.
void datamc_ND_numu_kinematics_RHC_REW_pTBins(const std::string sample, const std::string wfile)
const std::vector< T > & GetVars() const
Proxy for caf::StandardRecord.
virtual void SaveTo(TDirectory *dir, const std::string &name) const
void SetSpillCut(const SpillCut &cut)
Representation of a spectrum in any variable, with associated POT.
const Var kPtP
Transverse momentum fraction in slice.
const HistAxis kNumuCCAxis("Reconstructed Neutrino Energy (GeV)", kNumuEnergyBinning, kCCE)
const SpillCut kStandardDQCuts([](const caf::SRSpillProxy *spill){if(spill->dcmedgematchfrac==0 &&spill->fracdcm3hits==0 &&spill->nmissingdcmslg==0) return bool(spill->isgoodspill); if(spill->det==caf::kNEARDET && (spill->fracdcm3hits > 0.45|| spill->nmissingdcms > 0)) return false; if(spill->eventincomplete) return false; if(spill->det==caf::kFARDET && spill->nmissingdcmslg > 0) return false; if(spill->det==caf::kFARDET && !spill->ismc && spill->dcmedgematchfrac<=0.2) return false;return true;})
Cut out events with a noisy detector or with parts missing.
virtual void Go() override
Load all the registered spectra.
void SaveTo(TDirectory *dir, const std::string &name) const
const HistDef defs[kNumVars]
std::vector< Cut > GetNueQuantCuts2020(const bool isRHC, const caf::Det_t det, const unsigned int nquants, const ExtrapVar var)
std::vector< float > Spectrum
const SystShifts kNoShift
const std::vector< Binning > & GetBinnings() const
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
Standard interface to all prediction techniques.
const SpillCut kStandardSpillCuts
Apply this unless you're doing something special.
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
const std::string selNames[kNumSels]
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
const Var kCosNumi([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks > 0 &&sr->trk.kalman.idxremid!=999){if(sr->hdr.det==1){return sr->trk.kalman.tracks[0].dir.Dot(beamDirND);}if(sr->hdr.det==2){return sr->trk.kalman.tracks[0].dir.Dot(beamDirFD);}}return-5.f;})
static NullLoader kNullLoader
Dummy loader that doesn't load any files.
const std::vector< std::string > & GetLabels() const