SKZPWeightCalculator Class Reference

#include <SKZPWeightCalculator.h>

Inheritance diagram for SKZPWeightCalculator:
WeightCalculator

List of all members.

Public Types

enum  ESKZPConfig {
  kUnknown = 0, kPRL = 1, kBoston = 2, kPiMinus = 3,
  kDetXs = 4, kDogwood1_Daikon07 = 5, kDogwood1_Daikon07_v2 = 6, kDogwood5_Daikon07_2012 = 7,
  kDogwood5_Daikon07_2012_v2 = 8, kMINOSplus_2014 = 9, kMINOSplus_2014_v2 = 10, kMINOSplus_2018 = 11
}
enum  EFluxErrEffect {
  kHadProdAfterTune = 8, kTotalErrorPreTune = 10, kTotalErrorAfterTune = 11, kTotalFocusing = 12,
  kTarget = 15
}
enum  ESampleSelection { kNotSpecified = 0, kNuMuCC = 1, kAntiNuMu = 2, kNue = 3 }
enum  ERunPeriod {
  kNone = 0, kRunI = 1, kRunII = 2, kRunIII = 3,
  kRunIV = 4, kRunV = 5, kRunVI = 6, kRunVII = 7,
  kRunVIII = 8, kRunIX = 9, kRunX = 10, kRunXI = 11,
  kRunXII = 12, kRunXIII = 13, kEndOfList = 14
}
typedef enum
SKZPWeightCalculator::ESKZPConfig 
SKZPConfig_t
typedef enum
SKZPWeightCalculator::EFluxErrEffect 
FluxErrEffect_t
typedef enum
SKZPWeightCalculator::ESampleSelection 
SampleSelection_t
typedef enum
SKZPWeightCalculator::ERunPeriod 
RunPeriod_t

Public Member Functions

RunPeriod_t RunPeriodFromInt (int rpit)
int IntFromRunPeriod (RunPeriod_t rp)
int RunPeriodIntFromValidity (VldContext vc)
 SKZPWeightCalculator (Registry *stdconfig=0)
 SKZPWeightCalculator (std::string cn, bool readfromdb, bool beamonly=false)
virtual ~SKZPWeightCalculator ()
void SetReweightConfigName (std::string cn)
void SetSampleSelection (std::string ss)
virtual void Config ()
void ChangeParameters (std::vector< double > *bs, std::vector< double > *hp, std::vector< double > *det)
void GetParameters (std::vector< double > &bs, std::vector< double > &hp, std::vector< double > &det)
virtual double GetWeight (Registry *eventinfo)
virtual double GetWeight (MCEventInfo *, NuParent *)
double GetWeight (const NtpMCTruth *mc, int det, int Ibeam, double reco_emu, double reco_eshw, double &new_reco_emu, double &new_reco_eshw, double &beamweight, double &detweight, RunPeriod_t rp=kRunI, double true_eshw=-1, MCEventInfo *ei=0)
double GetWeight (const NtpMCFluxInfo *fi, int det, int Ibeam, int ccnc, double true_enu, int inu, double reco_emu, double reco_eshw, double &new_reco_emu, double &new_reco_eshw, double &beamweight, double &detweight, RunPeriod_t rp=kRunI, double true_eshw=-1, MCEventInfo *ei=0)
double GetWeight (int det, int Ibeam, int tptype, double pt, double pz, int ccnc, double true_enu, int inu, double reco_emu, double reco_eshw, double &new_reco_emu, double &new_reco_eshw, double &beamweight, double &detweight, RunPeriod_t rp=kRunI, double true_eshw=-1, MCEventInfo *ei=0)
double GetWeight (const NtpMCTruth *mc, int det, int Ibeam, double reco_emu, double reco_eshw, double &new_reco_emu, double &new_reco_eshw, double &beamweight, double &detweight, VldContext vc, double true_eshw=-1, MCEventInfo *ei=0)
double GetWeight (const NtpMCFluxInfo *fi, int det, int Ibeam, int ccnc, double true_enu, int inu, double reco_emu, double reco_eshw, double &new_reco_emu, double &new_reco_eshw, double &beamweight, double &detweight, VldContext vc, double true_eshw=-1, MCEventInfo *ei=0)
double GetWeight (int det, int Ibeam, int tptype, double pt, double pz, int ccnc, double true_enu, int inu, double reco_emu, double reco_eshw, double &new_reco_emu, double &new_reco_eshw, double &beamweight, double &detweight, VldContext vc, double true_eshw=-1, MCEventInfo *ei=0)
double GetBeamWeight (int det, int Ibeam, int tptype, double pt, double pz, double true_enu, int inu, RunPeriod_t rp=kRunI)
double GetBeamWeight (int det, int Ibeam, int tptype, double pt, double pz, double true_enu, int inu, VldContext vc)
double GetDetWeight (int ccnc, double true_enu, int inu, double reco_emu, double reco_eshw, double &new_reco_emu, double &new_reco_eshw, double true_eshw=-1, MCEventInfo *ei=0)
double GetFluxError (int det, int Ibeam, int inu, double true_enu, FluxErrEffect_t neffect=kTotalErrorAfterTune, double nsigma=1.)
double GetFluxError (int det, int Ibeam, int inu, double true_enu, RunPeriod_t rp, double nsigma=1., FluxErrEffect_t neffect=kTotalErrorAfterTune, const char *beamSysFileDir="")
double GetFluxError (int det, int Ibeam, int inu, double true_enu, VldContext vc, double nsigma=1., FluxErrEffect_t neffect=kTotalErrorAfterTune, const char *beamSysFileDir="")
void SetRunFrac (int Ibeam, RunPeriod_t rp, double pot)
double GetRFWWeight (const NtpMCTruth *mc, int det, int Ibeam, double reco_emu, double reco_eshw, double &new_reco_emu, double &new_reco_eshw, double &beamweight, double &detweight)
double GetRFWWeight (const NtpMCFluxInfo *fi, int det, int Ibeam, int ccnc, double true_enu, int inu, double reco_emu, double reco_eshw, double &new_reco_emu, double &new_reco_eshw, double &beamweight, double &detweight)
double GetRFWWeight (int det, int Ibeam, int tptype, double pt, double pz, int ccnc, double true_enu, int inu, double reco_emu, double reco_eshw, double &new_reco_emu, double &new_reco_eshw, double &beamweight, double &detweight)
double GetHeliumWeight (int det, int Ibeam, int Ntype, double true_enu)
double GetTargetDecayWeight (int det, int Ibeam, int Ntype, double true_enu, double fin78fraction)
double GetAPSweight (int det, int Ibeam, double true_enu, int inu, RunPeriod_t rp=kNone, const char *dir="")
double GetHGweight (int det, int Ibeam, double true_enu, int inu, const char *dir="")
virtual void PrintReweightConfig (ostream &)
ZbeamGetZbeam ()
ZflukGetZfluk ()
double GetHadProdError (int det, int Ibeam, int inu, double true_enu, RunPeriod_t rp=kRunI, double nsigma=1., const char *dir="")
double GetHadProdError (int det, int Ibeam, int inu, double true_enu, VldContext vc, double nsigma=1., const char *dir="")
double GetHadProdError2012 (int det, int Ibeam, int inu, double true_enu, RunPeriod_t rp=kRunI, double nsigma=1., const char *dir="")
double GetHadProdError2012 (int det, int Ibeam, int inu, double true_enu, VldContext vc, double nsigma=1., const char *dir="")
double GetOpticsError (int det, int Ibeam, int inu, double true_enu, RunPeriod_t rp=kRunI, double nsigma=1., const char *dir="")
double GetOpticsError (int det, int Ibeam, int inu, double true_enu, VldContext vc, double nsigma=1., const char *dir="")
double GetTargetZError (int det, int Ibeam, int inu, double true_enu, RunPeriod_t rp=kRunI, double nsigma=1., const char *dir="")
double GetTargetZError (int det, int Ibeam, int inu, double true_enu, VldContext vc, double nsigma=1., const char *dir="")
double GetMaterialError (int det, int Ibeam, int inu, double true_enu, RunPeriod_t rp=kRunI, double nsigma=1., const char *dir="")
double GetMaterialError (int det, int Ibeam, int inu, double true_enu, VldContext vc, double nsigma=1., const char *dir="")
double GetDecayError (int det, int Ibeam, int inu, double true_enu, RunPeriod_t rp=kRunI, double nsigma=1., const char *dir="")
double GetDecayError (int det, int Ibeam, int inu, double true_enu, VldContext vc, double nsigma=1., const char *dir="")
double GetDecayModelError (int det, int Ibeam, int inu, double true_enu, RunPeriod_t rp=kRunI, double nsigma=1., const char *dir="")
double GetDecayModelError (int det, int Ibeam, int inu, double true_enu, VldContext vc, double nsigma=1., const char *dir="")

Public Attributes

VldTimeStampvtsRunIEnd
VldTimeStampvtsRunIIEnd
VldTimeStampvtsRunIIIEnd
VldTimeStampvtsRunIVEnd
VldTimeStampvtsRunVEnd
VldTimeStampvtsRunVIEnd
VldTimeStampvtsRunVIIEnd
VldTimeStampvtsRunVIIIEnd
VldTimeStampvtsRunIXEnd
VldTimeStampvtsRunXEnd
VldTimeStampvtsRunXIEnd
VldTimeStampvtsRunXIIEnd

Private Member Functions

void SetConfigNum (std::string c)
double GetRunPeriodWeight (RunPeriod_t rp, int det, int Ibeam, int ntype, double Enu)
double GetRunPeriodWeight (VldContext vc, int det, int Ibeam, int ntype, double Enu)
TFile * GetBeamSysFile (const char *dir="", RunPeriod_t rp=kNone)
void LoadHadProdErrors (const char *dir="", RunPeriod_t rp=kNone)
void LoadHadProdErrors2012 (const char *dir="", RunPeriod_t rp=kNone)
void LoadOpticsErrors (const char *dir="", RunPeriod_t rp=kNone)
void LoadTargetZErrors (const char *dir="", RunPeriod_t rp=kNone)
void LoadMaterialErrors (const char *dir="", RunPeriod_t rp=kNone)
void LoadDecayErrors (const char *dir="", RunPeriod_t rp=kNone)
void LoadDecayModelErrors (const char *dir="", RunPeriod_t rp=kNone)
TFile * GetAPSweightsFile (const char *dir="")
TFile * GetAPSweightsFile2018 (const char *dir="")
void LoadAPSweights (const char *dir="", RunPeriod_t rp=kNone)
TFile * GetHGweightsFile (const char *dir="")
void LoadHGweights (const char *dir="")
double GetHeliumWeight_L010z185i_ND_Numu (double enu)
double GetHeliumWeight_L010z185i_ND_Numubar (double enu)
double GetHeliumWeight_L010z185i_ND_Nue (double enu)
double GetHeliumWeight_L010z185i_ND_Nuebar (double enu)
double GetHeliumWeight_L010z185i_FD_Numu (double enu)
double GetHeliumWeight_L010z185i_FD_Numubar (double enu)
double GetHeliumWeight_L010z185i_FD_Nue (double enu)
double GetHeliumWeight_L010z185i_FD_Nuebar (double enu)
double GetHeliumWeight_L010z000i_ND_Numu (double enu)
double GetHeliumWeight_L010z000i_ND_Numubar (double enu)
double GetHeliumWeight_L010z000i_ND_Nue (double enu)
double GetHeliumWeight_L010z000i_ND_Nuebar (double enu)
double GetHeliumWeight_L010z000i_FD_Numu (double enu)
double GetHeliumWeight_L010z000i_FD_Numubar (double enu)
double GetHeliumWeight_L010z000i_FD_Nue (double enu)
double GetHeliumWeight_L010z000i_FD_Nuebar (double enu)
double GetMissingFin78Weight_L010z185i_ND_Numu (double enu)
double GetMissingFin78Weight_L010z185i_ND_Numubar (double enu)
double GetMissingFin78Weight_L010z185i_ND_Nue (double enu)
double GetMissingFin78Weight_L010z185i_ND_Nuebar (double enu)
double GetMissingFin78Weight_L010z185i_FD_Numu (double enu)
double GetMissingFin78Weight_L010z185i_FD_Numubar (double enu)
double GetMissingFin78Weight_L010z185i_FD_Nue (double enu)
double GetMissingFin78Weight_L010z185i_FD_Nuebar (double enu)
double GetMissingFin78Weight_L010z000i_ND_Numu (double enu)
double GetMissingFin78Weight_L010z000i_ND_Numubar (double enu)
double GetMissingFin78Weight_L010z000i_ND_Nue (double enu)
double GetMissingFin78Weight_L010z000i_ND_Nuebar (double enu)
double GetMissingFin78Weight_L010z000i_FD_Numu (double enu)
double GetMissingFin78Weight_L010z000i_FD_Numubar (double enu)
double GetMissingFin78Weight_L010z000i_FD_Nue (double enu)
double GetMissingFin78Weight_L010z000i_FD_Nuebar (double enu)

Private Attributes

int MAXBSPARS
int MAXHPPARS
int MAXDETPARS
bool read_pars_from_db
std::string cfgname
SKZPConfig_t cfgnum
SampleSelection_t sampsel
Zbeamzbeam
Zflukzfluk
MCReweightmcr
NeugenWeightCalculatornwc
std::vector< double > bs_pars
std::vector< double > hp_pars
std::vector< double > det_pars
std::map< int, std::map
< RunPeriod_t, double > > 
runfrac
bool fBeamOnly
std::string fTopDir
bool hadProdErrorsLoaded
TH1D * NuMu_HadProdError [12][3][3]
TH1D * NuMuBar_HadProdError [12][3][3]
TH1D * NuE_HadProdError [12][3][3]
TH1D * NuEBar_HadProdError [12][3][3]
bool hadProdErrors2012Loaded
TH1D * NuMu_HadProdError2012 [12][4][3]
TH1D * NuMuBar_HadProdError2012 [12][4][3]
TH1D * NuE_HadProdError2012 [12][4][3]
TH1D * NuEBar_HadProdError2012 [12][4][3]
bool opticsErrorsLoaded
TH1D * NuMu_OpticsError [12][3][3]
TH1D * NuMuBar_OpticsError [12][3][3]
TH1D * NuE_OpticsError [12][3][3]
TH1D * NuEBar_OpticsError [12][3][3]
bool targetZErrorsLoaded
TH1D * NuMu_TargetZError [12][3][3]
bool materialErrorsLoaded
TH1D * NuMu_MaterialError [12][3][3]
TH1D * NuMuBar_MaterialError [12][3][3]
TH1D * NuE_MaterialError [12][3][3]
TH1D * NuEBar_MaterialError [12][3][3]
bool decayErrorsLoaded
TH1D * NuMu_DecayError [12][3][3]
TH1D * NuMuBar_DecayError [12][3][3]
TH1D * NuE_DecayError [12][3][3]
TH1D * NuEBar_DecayError [12][3][3]
bool decayModelErrorsLoaded
TH1D * NuMu_DecayModelError [12][3][3]
TH1D * NuMuBar_DecayModelError [12][3][3]
TH1D * NuE_DecayModelError [12][3][3]
TH1D * NuEBar_DecayModelError [12][3][3]
bool APSweightsLoaded
TH1D * Nu_ND_APSW_M00V4
TH1D * Nu_FD_APSW_M00V4
TH1D * Nu_FN_APSW_M00V4
TH1D * AntiNu_ND_APSW_M00V4
TH1D * AntiNu_FD_APSW_M00V4
TH1D * AntiNu_FN_APSW_M00V4
TH1D * Nu_ND_APSW_M02V4
TH1D * Nu_FD_APSW_M02V4
TH1D * Nu_FN_APSW_M02V4
TH1D * AntiNu_ND_APSW_M02V4
TH1D * AntiNu_FD_APSW_M02V4
TH1D * AntiNu_FN_APSW_M02V4
TH1D * Nu_ND_APSW_M02V5
TH1D * Nu_FD_APSW_M02V5
TH1D * Nu_FN_APSW_M02V5
TH1D * AntiNu_ND_APSW_M02V5
TH1D * AntiNu_FD_APSW_M02V5
TH1D * AntiNu_FN_APSW_M02V5
TH1D * Nu_ND_APSW_M02V6
TH1D * Nu_FD_APSW_M02V6
TH1D * Nu_FN_APSW_M02V6
TH1D * AntiNu_ND_APSW_M02V6
TH1D * AntiNu_FD_APSW_M02V6
TH1D * AntiNu_FN_APSW_M02V6
bool HGweightsLoaded
TH1D * Nu_ND_HGW_M02V1
TH1D * Nu_FD_HGW_M02V1
TH1D * Nu_FN_HGW_M02V1
TH1D * AntiNu_ND_HGW_M02V1
TH1D * AntiNu_FD_HGW_M02V1
TH1D * AntiNu_FN_HGW_M02V1

Static Private Attributes

static const double XP = 25.

Detailed Description

Definition at line 20 of file SKZPWeightCalculator.h.


Member Typedef Documentation


Member Enumeration Documentation

Enumerator:
kHadProdAfterTune 
kTotalErrorPreTune 
kTotalErrorAfterTune 
kTotalFocusing 
kTarget 

Definition at line 39 of file SKZPWeightCalculator.h.

00039                               {
00040     kHadProdAfterTune=8,
00041     kTotalErrorPreTune=10,
00042     kTotalErrorAfterTune=11,
00043     kTotalFocusing=12,
00044     kTarget=15    
00045   } FluxErrEffect_t;

Enumerator:
kNone 
kRunI 
kRunII 
kRunIII 
kRunIV 
kRunV 
kRunVI 
kRunVII 
kRunVIII 
kRunIX 
kRunX 
kRunXI 
kRunXII 
kRunXIII 
kEndOfList 

Definition at line 54 of file SKZPWeightCalculator.h.

00054                           {
00055     kNone=0,
00056     kRunI=1,
00057     kRunII=2,
00058     kRunIII=3,
00059     kRunIV=4,
00060     kRunV=5,
00061     kRunVI=6,
00062     kRunVII=7,
00063     kRunVIII=8,
00064     kRunIX=9,
00065     kRunX=10,
00066     kRunXI=11,
00067     kRunXII=12,
00068     kRunXIII=13,
00069     kEndOfList=14
00070   } RunPeriod_t;

Enumerator:
kNotSpecified 
kNuMuCC 
kAntiNuMu 
kNue 

Definition at line 47 of file SKZPWeightCalculator.h.

00047                                 {
00048     kNotSpecified=0,
00049     kNuMuCC=1,
00050     kAntiNuMu=2,
00051     kNue=3
00052   } SampleSelection_t;

Enumerator:
kUnknown 
kPRL 
kBoston 
kPiMinus 
kDetXs 
kDogwood1_Daikon07 
kDogwood1_Daikon07_v2 
kDogwood5_Daikon07_2012 
kDogwood5_Daikon07_2012_v2 
kMINOSplus_2014 
kMINOSplus_2014_v2 
kMINOSplus_2018 

Definition at line 23 of file SKZPWeightCalculator.h.

00023                            {
00024     kUnknown = 0,
00025     kPRL = 1,
00026     kBoston = 2,
00027     kPiMinus = 3,
00028     kDetXs = 4,
00029     kDogwood1_Daikon07 = 5,
00030     kDogwood1_Daikon07_v2 = 6,
00031     kDogwood5_Daikon07_2012 = 7,
00032     kDogwood5_Daikon07_2012_v2 = 8,
00033     kMINOSplus_2014 = 9,
00034     kMINOSplus_2014_v2 = 10,
00035     kMINOSplus_2018 = 11
00036   } SKZPConfig_t;


Constructor & Destructor Documentation

SKZPWeightCalculator::SKZPWeightCalculator ( Registry stdconfig = 0  ) 

Definition at line 25 of file SKZPWeightCalculator.cxx.

References AntiNu_FD_APSW_M00V4, AntiNu_FD_APSW_M02V4, AntiNu_FD_APSW_M02V5, AntiNu_FN_APSW_M00V4, AntiNu_FN_APSW_M02V4, AntiNu_FN_APSW_M02V5, AntiNu_ND_APSW_M00V4, AntiNu_ND_APSW_M02V4, AntiNu_ND_APSW_M02V5, Config(), MCReweight::Instance(), mcr, Nu_FD_APSW_M00V4, Nu_FD_APSW_M02V4, Nu_FD_APSW_M02V5, Nu_FN_APSW_M00V4, Nu_FN_APSW_M02V4, Nu_FN_APSW_M02V5, Nu_ND_APSW_M00V4, Nu_ND_APSW_M02V4, Nu_ND_APSW_M02V5, NuE_DecayError, NuE_DecayModelError, NuE_HadProdError, NuE_HadProdError2012, NuE_MaterialError, NuE_OpticsError, NuEBar_DecayError, NuEBar_DecayModelError, NuEBar_HadProdError, NuEBar_HadProdError2012, NuEBar_MaterialError, NuEBar_OpticsError, NuMu_DecayError, NuMu_DecayModelError, NuMu_HadProdError, NuMu_HadProdError2012, NuMu_MaterialError, NuMu_OpticsError, NuMu_TargetZError, NuMuBar_DecayError, NuMuBar_DecayModelError, NuMuBar_HadProdError, NuMuBar_HadProdError2012, NuMuBar_MaterialError, NuMuBar_OpticsError, nwc, vtsRunIEnd, vtsRunIIEnd, vtsRunIIIEnd, vtsRunIVEnd, vtsRunIXEnd, vtsRunVEnd, vtsRunVIEnd, vtsRunVIIEnd, vtsRunVIIIEnd, vtsRunXEnd, vtsRunXIEnd, vtsRunXIIEnd, zbeam, and zfluk.

00025                                                              :
00026   WeightCalculator(stdconfig),
00027   MAXBSPARS(20),
00028   MAXHPPARS(20),
00029   MAXDETPARS(20),
00030   read_pars_from_db(false),
00031   cfgname(""),
00032   cfgnum(kUnknown),
00033   sampsel(kNotSpecified),
00034   runfrac(),
00035   fTopDir(""),
00036   hadProdErrorsLoaded(false),
00037   hadProdErrors2012Loaded(false),
00038   opticsErrorsLoaded(false),
00039   targetZErrorsLoaded(false),
00040   materialErrorsLoaded(false),
00041   decayErrorsLoaded(false),
00042   decayModelErrorsLoaded(false),
00043   APSweightsLoaded(false)
00044 {
00045   vtsRunIEnd = new VldTimeStamp(2006,3,1,0,0,0);
00046   vtsRunIIEnd = new VldTimeStamp(2007,8,1,0,0,0);
00047   vtsRunIIIEnd = new VldTimeStamp(2009,8,1,0,0,0);
00048   vtsRunIVEnd = new VldTimeStamp(2010,3,23,0,0,0);
00049   vtsRunVEnd = new VldTimeStamp(2010,5,6,0,0,0);
00050   vtsRunVIEnd = new VldTimeStamp(2010,7,13,0,0,0);
00051   vtsRunVIIEnd = new VldTimeStamp(2011,3,19,0,0,0);
00052   vtsRunVIIIEnd = new VldTimeStamp(2011,7,12,0,0,0);
00053   vtsRunIXEnd = new VldTimeStamp(2011,9,16,0,0,0);
00054   vtsRunXEnd = new VldTimeStamp(2013,9,1,0,0,0);
00055   vtsRunXIEnd = new VldTimeStamp(2014,10,1,0,0,0);
00056   vtsRunXIIEnd = new VldTimeStamp(2015,10,1,0,0,0);
00057   zbeam = new Zbeam();
00058   zfluk = new Zfluk();
00059   nwc = 0; // hold off until needed // new NeugenWeightCalculator();
00060   mcr = &MCReweight::Instance();
00061   Config();
00062   for(int i=0;i<12;++i){
00063     for(int j=0;j<3;++j){
00064       for(int k=0;k<3;++k){
00065         NuMu_HadProdError[i][j][k] = 0;
00066         NuMuBar_HadProdError[i][j][k] = 0;
00067         NuE_HadProdError[i][j][k] = 0;
00068         NuEBar_HadProdError[i][j][k] = 0;
00069         NuMu_OpticsError[i][j][k] = 0;
00070         NuMuBar_OpticsError[i][j][k] = 0;
00071         NuE_OpticsError[i][j][k] = 0;
00072         NuEBar_OpticsError[i][j][k] = 0;
00073         NuMu_TargetZError[i][j][k] = 0;
00074         NuMu_MaterialError[i][j][k] = 0;
00075         NuMuBar_MaterialError[i][j][k] = 0;
00076         NuE_MaterialError[i][j][k] = 0;
00077         NuEBar_MaterialError[i][j][k] = 0;
00078         NuMu_DecayError[i][j][k] = 0;
00079         NuMuBar_DecayError[i][j][k] = 0;
00080         NuE_DecayError[i][j][k] = 0;
00081         NuEBar_DecayError[i][j][k] = 0;
00082         NuMu_DecayModelError[i][j][k] = 0;
00083         NuMuBar_DecayModelError[i][j][k] = 0;
00084         NuE_DecayModelError[i][j][k] = 0;
00085         NuEBar_DecayModelError[i][j][k] = 0;
00086       }
00087     }
00088   }
00089   for(int i=0;i<12;++i){                    // IMPORTANT - the 2014 MINOS+ hadron production errors have (unfortunately)
00090     for(int j=0;j<4;++j){                        //the same naming as before as xxxx_HadProdError2012[i][j][k] for convenience
00091       for(int k=0;k<3;++k){                         //as they were just added as new beam configurations (i=10 and 11)
00092         NuMu_HadProdError2012[i][j][k] = 0;
00093         NuMuBar_HadProdError2012[i][j][k] = 0;
00094         NuE_HadProdError2012[i][j][k] = 0;
00095         NuEBar_HadProdError2012[i][j][k] = 0;
00096       }
00097     }
00098   }
00099   //APS hists - Anna
00100   Nu_ND_APSW_M00V4 = 0;
00101   Nu_FD_APSW_M00V4 = 0;
00102   Nu_FN_APSW_M00V4 = 0;
00103   AntiNu_ND_APSW_M00V4 = 0;
00104   AntiNu_FD_APSW_M00V4 = 0;
00105   AntiNu_FN_APSW_M00V4 = 0;
00106   Nu_ND_APSW_M02V4 = 0;
00107   Nu_FD_APSW_M02V4 = 0;
00108   Nu_FN_APSW_M02V4 = 0;
00109   AntiNu_ND_APSW_M02V4 = 0;
00110   AntiNu_FD_APSW_M02V4 = 0;
00111   AntiNu_FN_APSW_M02V4 = 0;
00112   Nu_ND_APSW_M02V5 = 0;
00113   Nu_FD_APSW_M02V5 = 0;
00114   Nu_FN_APSW_M02V5 = 0;
00115   AntiNu_ND_APSW_M02V5 = 0;
00116   AntiNu_FD_APSW_M02V5 = 0;
00117   AntiNu_FN_APSW_M02V5 = 0;
00118 }

SKZPWeightCalculator::SKZPWeightCalculator ( std::string  cn,
bool  readfromdb,
bool  beamonly = false 
)
SKZPWeightCalculator::~SKZPWeightCalculator (  )  [virtual]

Definition at line 234 of file SKZPWeightCalculator.cxx.

References AntiNu_FD_APSW_M00V4, AntiNu_FD_APSW_M02V4, AntiNu_FD_APSW_M02V5, AntiNu_FD_APSW_M02V6, AntiNu_FD_HGW_M02V1, AntiNu_FN_APSW_M00V4, AntiNu_FN_APSW_M02V4, AntiNu_FN_APSW_M02V5, AntiNu_FN_APSW_M02V6, AntiNu_FN_HGW_M02V1, AntiNu_ND_APSW_M00V4, AntiNu_ND_APSW_M02V4, AntiNu_ND_APSW_M02V5, AntiNu_ND_APSW_M02V6, AntiNu_ND_HGW_M02V1, APSweightsLoaded, decayErrorsLoaded, decayModelErrorsLoaded, hadProdErrors2012Loaded, hadProdErrorsLoaded, HGweightsLoaded, materialErrorsLoaded, Nu_FD_APSW_M00V4, Nu_FD_APSW_M02V4, Nu_FD_APSW_M02V5, Nu_FD_APSW_M02V6, Nu_FD_HGW_M02V1, Nu_FN_APSW_M00V4, Nu_FN_APSW_M02V4, Nu_FN_APSW_M02V5, Nu_FN_APSW_M02V6, Nu_FN_HGW_M02V1, Nu_ND_APSW_M00V4, Nu_ND_APSW_M02V4, Nu_ND_APSW_M02V5, Nu_ND_APSW_M02V6, Nu_ND_HGW_M02V1, NuE_DecayError, NuE_DecayModelError, NuE_HadProdError, NuE_HadProdError2012, NuE_MaterialError, NuE_OpticsError, NuEBar_DecayError, NuEBar_DecayModelError, NuEBar_HadProdError, NuEBar_HadProdError2012, NuEBar_MaterialError, NuEBar_OpticsError, NuMu_DecayError, NuMu_DecayModelError, NuMu_HadProdError, NuMu_HadProdError2012, NuMu_MaterialError, NuMu_OpticsError, NuMu_TargetZError, NuMuBar_DecayError, NuMuBar_DecayModelError, NuMuBar_HadProdError, NuMuBar_HadProdError2012, NuMuBar_MaterialError, NuMuBar_OpticsError, nwc, opticsErrorsLoaded, targetZErrorsLoaded, vtsRunIEnd, vtsRunIIEnd, vtsRunIIIEnd, vtsRunIVEnd, vtsRunIXEnd, vtsRunVEnd, vtsRunVIEnd, vtsRunVIIEnd, vtsRunVIIIEnd, vtsRunXEnd, vtsRunXIEnd, vtsRunXIIEnd, zbeam, and zfluk.

00235 {
00236 
00237   for(int i=0;i<12;++i){
00238     for(int j=0;j<3;++j){
00239       for(int k=0;k<3;++k){
00240         delete NuMu_HadProdError[i][j][k];
00241         delete NuMuBar_HadProdError[i][j][k];
00242         delete NuE_HadProdError[i][j][k];
00243         delete NuEBar_HadProdError[i][j][k];
00244         delete NuMu_OpticsError[i][j][k];
00245         delete NuMuBar_OpticsError[i][j][k];
00246         delete NuE_OpticsError[i][j][k];
00247         delete NuEBar_OpticsError[i][j][k];
00248         delete NuMu_TargetZError[i][j][k];
00249         delete NuMu_MaterialError[i][j][k];
00250         delete NuMuBar_MaterialError[i][j][k];
00251         delete NuE_MaterialError[i][j][k];
00252         delete NuEBar_MaterialError[i][j][k];
00253         delete NuMu_DecayError[i][j][k];
00254         delete NuMuBar_DecayError[i][j][k];
00255         delete NuE_DecayError[i][j][k];
00256         delete NuEBar_DecayError[i][j][k];
00257         delete NuMu_DecayModelError[i][j][k];
00258         delete NuMuBar_DecayModelError[i][j][k];
00259         delete NuE_DecayModelError[i][j][k];
00260         delete NuEBar_DecayModelError[i][j][k];
00261 
00262         NuMu_HadProdError[i][j][k] = 0;
00263         NuMuBar_HadProdError[i][j][k] = 0;
00264         NuE_HadProdError[i][j][k] = 0;
00265         NuEBar_HadProdError[i][j][k] = 0;
00266         NuMu_OpticsError[i][j][k] = 0;
00267         NuMuBar_OpticsError[i][j][k] = 0;
00268         NuE_OpticsError[i][j][k] = 0;
00269         NuEBar_OpticsError[i][j][k] = 0;
00270         NuMu_TargetZError[i][j][k] = 0;
00271         NuMu_MaterialError[i][j][k] = 0;
00272         NuMuBar_MaterialError[i][j][k] = 0;
00273         NuE_MaterialError[i][j][k] = 0;
00274         NuEBar_MaterialError[i][j][k] = 0;
00275         NuMu_DecayError[i][j][k] = 0;
00276         NuMuBar_DecayError[i][j][k] = 0;
00277         NuE_DecayError[i][j][k] = 0;
00278         NuEBar_DecayError[i][j][k] = 0;
00279         NuMu_DecayModelError[i][j][k] = 0;
00280         NuMuBar_DecayModelError[i][j][k] = 0;
00281         NuE_DecayModelError[i][j][k] = 0;
00282         NuEBar_DecayModelError[i][j][k] = 0;
00283       }
00284     }
00285   }
00286 
00287 
00288   for(int i=0;i<12;++i){
00289     for(int j=0;j<4;++j){
00290       for(int k=0;k<3;++k){
00291         delete NuMu_HadProdError2012[i][j][k];
00292         delete NuMuBar_HadProdError2012[i][j][k];
00293         delete NuE_HadProdError2012[i][j][k];
00294         delete NuEBar_HadProdError2012[i][j][k];
00295 
00296         NuMu_HadProdError2012[i][j][k] = 0;
00297         NuMuBar_HadProdError2012[i][j][k] = 0;
00298         NuE_HadProdError2012[i][j][k] = 0;
00299         NuEBar_HadProdError2012[i][j][k] = 0;
00300       }
00301     }
00302   }
00303 
00304   //APS hists - Anna
00305  delete Nu_ND_APSW_M00V4;
00306  delete Nu_FD_APSW_M00V4;
00307  delete Nu_FN_APSW_M00V4;
00308  delete AntiNu_ND_APSW_M00V4;
00309  delete AntiNu_FD_APSW_M00V4;
00310  delete AntiNu_FN_APSW_M00V4;
00311  delete Nu_ND_APSW_M02V4;
00312  delete Nu_FD_APSW_M02V4;
00313  delete Nu_FN_APSW_M02V4;
00314  delete AntiNu_ND_APSW_M02V4;
00315  delete AntiNu_FD_APSW_M02V4;
00316  delete AntiNu_FN_APSW_M02V4;
00317  delete Nu_ND_APSW_M02V5;
00318  delete Nu_FD_APSW_M02V5;
00319  delete Nu_FN_APSW_M02V5;
00320  delete AntiNu_ND_APSW_M02V5;
00321  delete AntiNu_FD_APSW_M02V5;
00322  delete AntiNu_FN_APSW_M02V5;
00323  delete Nu_ND_APSW_M02V6;
00324  delete Nu_FD_APSW_M02V6;
00325  delete Nu_FN_APSW_M02V6;
00326  delete AntiNu_ND_APSW_M02V6;
00327  delete AntiNu_FD_APSW_M02V6;
00328  delete AntiNu_FN_APSW_M02V6;
00329  delete Nu_ND_HGW_M02V1;
00330  delete Nu_FD_HGW_M02V1;
00331  delete Nu_FN_HGW_M02V1;
00332  delete AntiNu_ND_HGW_M02V1;
00333  delete AntiNu_FD_HGW_M02V1;
00334  delete AntiNu_FN_HGW_M02V1;
00335 
00336   Nu_ND_APSW_M00V4 = 0;
00337   Nu_FD_APSW_M00V4 = 0;
00338   Nu_FN_APSW_M00V4 = 0;
00339   AntiNu_ND_APSW_M00V4 = 0;
00340   AntiNu_FD_APSW_M00V4 = 0;
00341   AntiNu_FN_APSW_M00V4 = 0;
00342   Nu_ND_APSW_M02V4 = 0;
00343   Nu_FD_APSW_M02V4 = 0;
00344   Nu_FN_APSW_M02V4 = 0;
00345   AntiNu_ND_APSW_M02V4 = 0;
00346   AntiNu_FD_APSW_M02V4 = 0;
00347   AntiNu_FN_APSW_M02V4 = 0;
00348   Nu_ND_APSW_M02V5 = 0;
00349   Nu_FD_APSW_M02V5 = 0;
00350   Nu_FN_APSW_M02V5 = 0;
00351   AntiNu_ND_APSW_M02V5 = 0;
00352   AntiNu_FD_APSW_M02V5 = 0;
00353   AntiNu_FN_APSW_M02V5 = 0;
00354   Nu_ND_APSW_M02V6 = 0;
00355   Nu_FD_APSW_M02V6 = 0;
00356   Nu_FN_APSW_M02V6 = 0;
00357   AntiNu_ND_APSW_M02V6 = 0;
00358   AntiNu_FD_APSW_M02V6 = 0;
00359   AntiNu_FN_APSW_M02V6 = 0;
00360   Nu_ND_HGW_M02V1 = 0;
00361   Nu_FD_HGW_M02V1 = 0;
00362   Nu_FN_HGW_M02V1 = 0;
00363   AntiNu_ND_HGW_M02V1 = 0;
00364   AntiNu_FD_HGW_M02V1 = 0;
00365   AntiNu_FN_HGW_M02V1 = 0;
00366 
00367   hadProdErrorsLoaded = false;
00368   hadProdErrors2012Loaded = false;
00369   opticsErrorsLoaded = false;
00370   targetZErrorsLoaded = false;
00371   materialErrorsLoaded = false;
00372   decayErrorsLoaded = false;
00373   decayModelErrorsLoaded = false;
00374   APSweightsLoaded = false;
00375   HGweightsLoaded = false;
00376 
00377   delete vtsRunIEnd;
00378   vtsRunIEnd=0;
00379   delete vtsRunIIEnd;
00380   vtsRunIIEnd=0;
00381   delete vtsRunIIIEnd;
00382   vtsRunIIIEnd=0;
00383   delete vtsRunIVEnd;
00384   vtsRunIVEnd=0;
00385   delete vtsRunVEnd;
00386   vtsRunVEnd=0;
00387   delete vtsRunVIEnd;
00388   vtsRunVIEnd=0;
00389   delete vtsRunVIIEnd;
00390   vtsRunVIIEnd=0;
00391   delete vtsRunVIIIEnd;
00392   vtsRunVIIIEnd=0;
00393   delete vtsRunIXEnd;
00394   vtsRunIXEnd=0;
00395   delete vtsRunXEnd;
00396   vtsRunXEnd=0;
00397   delete vtsRunXIEnd;
00398   vtsRunXIEnd=0;
00399   delete vtsRunXIIEnd;
00400   vtsRunXIIEnd=0;
00401   delete zbeam;
00402   zbeam=0;
00403   delete zfluk;
00404   zfluk=0;
00405   delete nwc;
00406   nwc=0;
00407 
00408 }


Member Function Documentation

void SKZPWeightCalculator::ChangeParameters ( std::vector< double > *  bs,
std::vector< double > *  hp,
std::vector< double > *  det 
)
void SKZPWeightCalculator::Config ( void   )  [virtual]

Reimplemented from WeightCalculator.

Definition at line 410 of file SKZPWeightCalculator.cxx.

References MCReweight::AddWeightCalculator(), bs_pars, cfgname, cfgnum, Registry::Clear(), det_pars, fBeamOnly, Form(), hp_pars, kDetXs, kDogwood1_Daikon07, kDogwood1_Daikon07_v2, kDogwood5_Daikon07_2012, Msg::kFatal, Msg::kInfo, kMINOSplus_2014, kMINOSplus_2014_v2, kPiMinus, kPRL, Msg::kWarning, Registry::LockKeys(), Registry::LockValues(), MAXBSPARS, MAXDETPARS, MAXHPPARS, mcr, MSG, nwc, read_pars_from_db, reg, Registry::Set(), SetConfigNum(), NeugenWeightCalculator::SetOptimization(), Zfluk::SetParameters(), Zbeam::SetReweightConfig(), WeightCalculator::SetReweightConfig(), Registry::UnLockKeys(), Registry::UnLockValues(), zbeam, and zfluk.

Referenced by SKZPWeightCalculator().

00411 {
00412   if(cfgname==""){
00413     cfgname="PRL";
00414     MSG("SKZPWeightCalculator",Msg::kInfo)<<"You did not specify a "
00415                                           <<"SKZPWeight configuration."
00416                                           <<" Setting ConfigName to :"
00417                                           <<cfgname<<endl;
00418     cfgnum=kPRL;
00419   }
00420   SetConfigNum(cfgname);
00421 
00422 
00423   if(!read_pars_from_db){
00424     MSG("SKZPWeightCalculator",Msg::kInfo)<<"You did not select to read in "
00425                                           <<"SKZP Fit parameters from the DB."
00426                                           <<" You must specify your "
00427                                           <<"own parameters"<<endl;
00428     return;
00429   }
00430 
00431   //retrieve appropriate constants from DB
00432   Registry reg;
00433   
00434   //  cout<<"Trying to get parameters from DB"<<endl;
00435   DbiConfigStream stream("SKZPWeights",cfgname.c_str());
00436   if(stream.IsEmpty()){
00437     MSG("SKZPWeightCalculator",Msg::kWarning)
00438       << "Could not find SKZP configuration: "
00439       << cfgname
00440       << " in database.  " << endl
00441       << "If you want to run without database access"
00442       << " construct the weight calculator"
00443       << " with false as second arg." << endl;
00444     MSG("SKZPWeightCalculator",Msg::kFatal) << "Now assert()" << endl;
00445     assert(false);
00446   }
00447   //  cout<<"made dbiconfigstream"<<endl;
00448   stream >> &reg;
00449 
00450   //  cout<<"Read registry from db, and it contains:"<<endl;
00451   //  reg.PrettyPrint(cout);
00452 
00453 
00454 
00455   //load information from registry to private data members
00456   double tmpd;
00457   for(int i=0;i<MAXBSPARS;i++){
00458     if(reg.Get(Form("bs_par_%d",i),tmpd)){
00459       bs_pars.push_back(tmpd);
00460     }
00461   }
00462 
00463   for(int i=0;i<MAXHPPARS;i++){
00464     if(reg.Get(Form("hp_par_%d",i),tmpd)){
00465       hp_pars.push_back(tmpd);
00466     }
00467   }
00468 
00469   for(int i=0;i<MAXDETPARS;i++){
00470     if(reg.Get(Form("det_par_%d",i),tmpd)){
00471       det_pars.push_back(tmpd);
00472     }
00473   }
00474 
00475   if(cfgnum==kPiMinus){
00476     zfluk->SetParameters(hp_pars);
00477   }
00478   if(cfgnum==kDetXs || cfgnum==kDogwood1_Daikon07 || cfgnum==kDogwood1_Daikon07_v2 || cfgnum==kDogwood5_Daikon07_2012 || cfgnum==kMINOSplus_2014 || cfgnum==kMINOSplus_2014_v2){
00479     zfluk->SetParameters(hp_pars);
00480 
00481     if(!fBeamOnly) {
00482       nwc = new NeugenWeightCalculator();
00483       nwc->SetOptimization(true);
00484       Registry *nwc_reg=new Registry;
00485       nwc_reg->UnLockValues();
00486       nwc_reg->UnLockKeys();
00487       nwc_reg->Clear();
00488       
00489       nwc_reg->Set("neugen:config_name","MODBYRS");
00490       nwc_reg->Set("neugen:config_no",4);
00491       nwc_reg->Set("neugen:use_scale_factors",1);
00492       nwc_reg->Set("neugen:ma_qe",1.1);
00493       nwc_reg->Set("neugen:ma_res",1.1); 
00494       
00495       // This is specific to MODBYRS v4 where we weight them 
00496       // by their 1 sigma error as given in docdb-2989
00497       
00498       double kno1_val=0.1; //for ri12 and ri42
00499       double kno2_val=0.3; //for ri22 and ri32
00500       double kno3_val=1.0; //for rij3 
00501     
00502       double kno1_err=0.1; //for rij2 
00503       double kno2_err=0.2; //for rij3
00504       
00505       double kno_shift=1;
00506       
00507       nwc_reg->Set("neugen:kno_r112",
00508                  (kno1_val+kno_shift*kno1_err)/(kno1_val));
00509       nwc_reg->Set("neugen:kno_r142",
00510                    (kno1_val+kno_shift*kno1_err)/(kno1_val));
00511       nwc_reg->Set("neugen:kno_r122",
00512                    (kno2_val+kno_shift*kno1_err)/(kno2_val));
00513       nwc_reg->Set("neugen:kno_r132",
00514                    (kno2_val+kno_shift*kno1_err)/(kno2_val));
00515       nwc_reg->Set("neugen:kno_r113",
00516                    (kno3_val+kno_shift*kno2_err)/(kno3_val));
00517       nwc_reg->Set("neugen:kno_r123",
00518                    (kno3_val+kno_shift*kno2_err)/(kno3_val));
00519       nwc_reg->Set("neugen:kno_r133",
00520                    (kno3_val+kno_shift*kno2_err)/(kno3_val));
00521       nwc_reg->Set("neugen:kno_r143",
00522                    (kno3_val+kno_shift*kno2_err)/(kno3_val));
00523       
00524       nwc_reg->LockValues();
00525       nwc_reg->LockKeys();
00526       nwc->SetReweightConfig(nwc_reg);
00527       mcr->AddWeightCalculator(nwc);
00528     }
00529   }
00530   string tmpcfgname=cfgname;
00531   if(tmpcfgname.find("PRL_Syst")!=string::npos){
00532     tmpcfgname="PRL";
00533   }
00534   zbeam->SetReweightConfig(tmpcfgname);
00535 }

double SKZPWeightCalculator::GetAPSweight ( int  det,
int  Ibeam,
double  true_enu,
int  inu,
RunPeriod_t  rp = kNone,
const char *  dir = "" 
)

Definition at line 3539 of file SKZPWeightCalculator.cxx.

References AntiNu_FD_APSW_M00V4, AntiNu_FD_APSW_M02V5, AntiNu_FD_APSW_M02V6, AntiNu_ND_APSW_M00V4, AntiNu_ND_APSW_M02V5, AntiNu_ND_APSW_M02V6, APSweightsLoaded, cfgnum, IntFromRunPeriod(), kMINOSplus_2014, kMINOSplus_2014_v2, kMINOSplus_2018, LoadAPSweights(), Nu_FD_APSW_M00V4, Nu_FD_APSW_M02V5, Nu_FD_APSW_M02V6, Nu_ND_APSW_M00V4, Nu_ND_APSW_M02V5, and Nu_ND_APSW_M02V6.

Referenced by GetBeamWeight().

03540 {
03541 
03542   if(!APSweightsLoaded) LoadAPSweights(dir,rp);
03543 
03544   double weight=1.0;
03545 
03546   int i=Ibeam-2;
03547 
03548 
03549   if(i!=10&&i!=11) weight*=1.0;
03550   if(det!=1&&det!=2) weight*=1.0;
03551   if(inu!=14&&inu!=12&&inu!=-14&&inu!=-12) weight*=1.0;
03552 
03553 
03554   if(i==10||i==11){
03555 
03556     if(true_enu>=30.0) weight*=1.0;
03557     else if(true_enu<30.0) {
03558 
03559       if(cfgnum==kMINOSplus_2014 || cfgnum==kMINOSplus_2014_v2 || (cfgnum==kMINOSplus_2018 && (IntFromRunPeriod(rp)==11||IntFromRunPeriod(rp)==12))){
03560         if(det==1){    //Near Detector
03561           if(inu==14||inu==12){
03562             if(i==10) weight=Nu_ND_APSW_M02V5->GetBinContent(Nu_ND_APSW_M02V5->FindBin(true_enu));    //M000z200
03563             if(i==11) weight=Nu_ND_APSW_M00V4->GetBinContent(Nu_ND_APSW_M00V4->FindBin(true_enu));    //M000z000
03564           }
03565           if(inu==-14||inu==-12){
03566             if(i==10) weight=AntiNu_ND_APSW_M02V5->GetBinContent(AntiNu_ND_APSW_M02V5->FindBin(true_enu));    //M000z200
03567             if(i==11) weight=AntiNu_ND_APSW_M00V4->GetBinContent(AntiNu_ND_APSW_M00V4->FindBin(true_enu));    //M000z000
03568           }
03569         }
03570         if(det==2){    //Far Detector
03571           if(inu==14||inu==12){
03572             if(i==10) weight=Nu_FD_APSW_M02V5->GetBinContent(Nu_FD_APSW_M02V5->FindBin(true_enu));    //M000z200
03573             if(i==11) weight=Nu_FD_APSW_M00V4->GetBinContent(Nu_FD_APSW_M00V4->FindBin(true_enu));    //M000z000
03574           }
03575           if(inu==-14||inu==-12){
03576             if(i==10) weight=AntiNu_FD_APSW_M02V5->GetBinContent(AntiNu_FD_APSW_M02V5->FindBin(true_enu));    //M000z200
03577             if(i==11) weight=AntiNu_FD_APSW_M00V4->GetBinContent(AntiNu_FD_APSW_M00V4->FindBin(true_enu));    //M000z000
03578           }
03579         }
03580       }
03581 
03582       else if(cfgnum==kMINOSplus_2018 && IntFromRunPeriod(rp)==13){
03583         if(det==1){    //Near Detector
03584           if(inu==14||inu==12){
03585             if(i==10) weight=Nu_ND_APSW_M02V6->GetBinContent(Nu_ND_APSW_M02V6->FindBin(true_enu));    //M000z200
03586           }
03587           if(inu==-14||inu==-12){
03588             if(i==10) weight=AntiNu_ND_APSW_M02V6->GetBinContent(AntiNu_ND_APSW_M02V6->FindBin(true_enu));    //M000z200
03589           }
03590         }
03591         if(det==2){    //Far Detector
03592           if(inu==14||inu==12){
03593             if(i==10) weight=Nu_FD_APSW_M02V6->GetBinContent(Nu_FD_APSW_M02V6->FindBin(true_enu));    //M000z200
03594           }
03595           if(inu==-14||inu==-12){
03596             if(i==10) weight=AntiNu_FD_APSW_M02V6->GetBinContent(AntiNu_FD_APSW_M02V6->FindBin(true_enu));    //M000z200
03597           }
03598         }
03599       }
03600     }
03601   }
03602 
03603 
03604   return weight;
03605 
03606 }

TFile * SKZPWeightCalculator::GetAPSweightsFile ( const char *  dir = ""  )  [private]

Definition at line 2213 of file SKZPWeightCalculator.cxx.

References base, Form(), fTopDir, gSystem(), Msg::kDebug, Msg::kFatal, Msg::kInfo, and MSG.

Referenced by LoadAPSweights().

02214 {
02215   // fTopDir is where the APS_weights2014.root file is located.
02216   fTopDir=dir; // user may set location of input data
02217   if(fTopDir=="") { // by default, this code looks in a standard place
02218     fTopDir="MCReweight/data";
02219     std::string base="";
02220     base=getenv("SRT_PRIVATE_CONTEXT");
02221     if (base!="" && base!=".")
02222       {
02223         // check if directory exists in SRT_PRIVATE_CONTEXT
02224         std::string path = base + "/" + fTopDir;
02225         void *dir_ptr = gSystem->OpenDirectory(path.c_str());
02226         if(!dir_ptr) base=getenv("SRT_PUBLIC_CONTEXT"); // if it doesn't exist then use SRT_PUBLIC_CONTEXT
02227       }
02228     else base=getenv("SRT_PUBLIC_CONTEXT");
02229 
02230     if(base=="") {
02231       MSG("SKZPWeightCalculator",Msg::kFatal)<<"No SRT_PUBLIC_CONTEXT set."<<std::endl;
02232       assert(false);
02233     }
02234     fTopDir = base+ "/" + fTopDir;
02235   }
02236   MSG("SKZPWeightCalculator",Msg::kDebug) << "Zbeam getting APS_weights2014.root hists from: "
02237                                           << fTopDir << " directory." << endl;
02238 
02239   TFile* f = new TFile(Form("%s/APS_weights2014.root",fTopDir.c_str()));
02240   if(f->IsZombie()) {
02241     MSG("SKZPWeightCalculator",Msg::kFatal)<<"Can't load APS Weights 2014 file. "
02242                                             << endl;
02243     return 0;
02244   }
02245 
02246     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Got APS Weights 2014 file. "
02247                                             << endl;
02248   return f;
02249 
02250 }

TFile * SKZPWeightCalculator::GetAPSweightsFile2018 ( const char *  dir = ""  )  [private]

Definition at line 2254 of file SKZPWeightCalculator.cxx.

References base, Form(), fTopDir, gSystem(), Msg::kDebug, Msg::kFatal, Msg::kInfo, and MSG.

Referenced by LoadAPSweights().

02255 {
02256   // fTopDir is where the APS_weights2014.root file is located.
02257   fTopDir=dir; // user may set location of input data
02258   if(fTopDir=="") { // by default, this code looks in a standard place
02259     fTopDir="MCReweight/data";
02260     std::string base="";
02261     base=getenv("SRT_PRIVATE_CONTEXT");
02262     if (base!="" && base!=".")
02263       {
02264         // check if directory exists in SRT_PRIVATE_CONTEXT
02265         std::string path = base + "/" + fTopDir;
02266         void *dir_ptr = gSystem->OpenDirectory(path.c_str());
02267         if(!dir_ptr) base=getenv("SRT_PUBLIC_CONTEXT"); // if it doesn't exist then use SRT_PUBLIC_CONTEXT
02268       }
02269     else base=getenv("SRT_PUBLIC_CONTEXT");
02270 
02271     if(base=="") {
02272       MSG("SKZPWeightCalculator",Msg::kFatal)<<"No SRT_PUBLIC_CONTEXT set."<<std::endl;
02273       assert(false);
02274     }
02275     fTopDir = base+ "/" + fTopDir;
02276   }
02277   MSG("SKZPWeightCalculator",Msg::kDebug) << "Zbeam getting APS_weights2018.root hists from: "
02278                                           << fTopDir << " directory." << endl;
02279 
02280   TFile* f = new TFile(Form("%s/APS_weights2018.root",fTopDir.c_str()));
02281   if(f->IsZombie()) {
02282     MSG("SKZPWeightCalculator",Msg::kFatal)<<"Can't load APS Weights 2018 file. "
02283                                             << endl;
02284     return 0;
02285   }
02286 
02287     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Got APS Weights 2018 file. "
02288                                             << endl;
02289   return f;
02290 
02291 }

TFile * SKZPWeightCalculator::GetBeamSysFile ( const char *  dir = "",
RunPeriod_t  rp = kNone 
) [private]

Definition at line 2168 of file SKZPWeightCalculator.cxx.

References base, cfgname, cfgnum, Form(), fTopDir, gSystem(), IntFromRunPeriod(), Msg::kDebug, Msg::kFatal, kMINOSplus_2018, and MSG.

Referenced by LoadDecayErrors(), LoadDecayModelErrors(), LoadHadProdErrors(), LoadHadProdErrors2012(), LoadMaterialErrors(), LoadOpticsErrors(), and LoadTargetZErrors().

02169 {
02170 
02171   // fTopDir is where the beamsys_XYZ.root file is located.
02172   fTopDir=dir; // user may set location of input data
02173   if(fTopDir=="") { // by default, this code looks in a standard place
02174     fTopDir="MCReweight/data";
02175     std::string base="";
02176     base=getenv("SRT_PRIVATE_CONTEXT");
02177     if (base!="" && base!=".")
02178       {
02179         // check if directory exists in SRT_PRIVATE_CONTEXT
02180         std::string path = base + "/" + fTopDir;
02181         void *dir_ptr = gSystem->OpenDirectory(path.c_str());
02182         if(!dir_ptr) base=getenv("SRT_PUBLIC_CONTEXT"); // if it doesn't exist then use SRT_PUBLIC_CONTEXT
02183       }
02184     else base=getenv("SRT_PUBLIC_CONTEXT");
02185 
02186     if(base=="") {
02187       MSG("SKZPWeightCalculator",Msg::kFatal)<<"No SRT_PUBLIC_CONTEXT set."<<std::endl;
02188       assert(false);
02189     }
02190     fTopDir = base+ "/" + fTopDir;
02191   }
02192   MSG("SKZPWeightCalculator",Msg::kDebug) << "Zbeam getting beamsys_XYZ.root hists from: "
02193                                           << fTopDir << " directory." << endl;
02194 
02195   TFile* f;
02196   if( cfgnum==kMINOSplus_2018 && (IntFromRunPeriod(rp)==11||IntFromRunPeriod(rp)==12) ){
02197     f = new TFile(Form("%s/beamsys_%s.root",fTopDir.c_str(),"MINOSplus_2014_v2"));
02198   }
02199   else{
02200     f = new TFile(Form("%s/beamsys_%s.root",fTopDir.c_str(),cfgname.c_str()));
02201   }
02202   if(f->IsZombie()) {
02203     MSG("SKZPWeightCalculator",Msg::kFatal)<<"Can't load beamsys_XYZ file "
02204                                            <<Form("data/beamsys_%s.root",cfgname.c_str())
02205                                            <<"." << endl;
02206     return 0;
02207   }
02208   return f;
02209 
02210 }

double SKZPWeightCalculator::GetBeamWeight ( int  det,
int  Ibeam,
int  tptype,
double  pt,
double  pz,
double  true_enu,
int  inu,
VldContext  vc 
) [inline]

Definition at line 254 of file SKZPWeightCalculator.h.

References GetBeamWeight(), RunPeriodFromInt(), and RunPeriodIntFromValidity().

00256                                      {
00257     return GetBeamWeight(det,Ibeam,
00258                          tptype,pt,pz,true_enu,inu,
00259                          RunPeriodFromInt(RunPeriodIntFromValidity(vc)));
00260   }

double SKZPWeightCalculator::GetBeamWeight ( int  det,
int  Ibeam,
int  tptype,
double  pt,
double  pz,
double  true_enu,
int  inu,
RunPeriod_t  rp = kRunI 
)

Definition at line 695 of file SKZPWeightCalculator.cxx.

References Zbeam::ZbeamData::beam, bs_pars, cfgnum, Zbeam::ZbeamData::detector, BeamType::FromZarko(), GetAPSweight(), GetHGweight(), GetRunPeriodWeight(), Zfluk::GetWeight(), Zbeam::GetWeight(), Zfluk::GetWeightBoston(), Zfluk::GetWeightMINOSplus(), Zfluk::GetWeightMINOSplus2(), Zfluk::GetWeightMINOSplusN1J(), Zfluk::GetWeightPRL(), hp_pars, IntFromRunPeriod(), BeamSys::kBaffleScraping, kBoston, kDetXs, kDogwood1_Daikon07, kDogwood1_Daikon07_v2, kDogwood5_Daikon07_2012, Detector::kFar, BeamSys::kHorn1Offset, BeamSys::kHorn1Tilt, BeamSys::kHornIDist, BeamSys::kHornIMiscal, Msg::kInfo, BeamSys::kMaterialError, kMINOSplus_2014, kMINOSplus_2014_v2, kMINOSplus_2018, Detector::kNear, kPiMinus, BeamSys::kPOT, kPRL, kRunIV, kRunIX, kRunVII, Detector::kUnknown, MSG, Zbeam::ZbeamData::ntype, Zbeam::ZbeamData::true_enu, zbeam, and zfluk.

Referenced by MCTrueAna::ana(), NueFluxWeightsAna::Analyze(), GetBeamWeight(), GetRFWWeight(), NueStandard::GetSKZPBeamWeight(), GetWeight(), NuZBeamReweight::GetWeights(), and ParticleFinder::Reco().

00699 {
00700   //do the flux reweighting
00701 
00702 
00703   double beamsysw=1.;
00704   double hadpw=1.;
00705   double apsw=1.;
00706   if(cfgnum==kPRL){
00707     //to let zbeam know I want the PRL version of 
00708     //of it's weights, I'm passing the beam systematic
00709     //parameters parameters one by one
00710 
00711     //reweight for spot size in me and he
00712     //now done in RunPeriodWeight
00713     //    beamsysw*=zbeam->GetWeight(det,Ibeam,6,0,true_enu);   
00714     //horn 1 offset
00715     beamsysw*=zbeam->GetWeight(det,Ibeam,1,bs_pars[0],true_enu);
00716     //baffle scraping
00717     beamsysw*=zbeam->GetWeight(det,Ibeam,2,bs_pars[1],true_enu);
00718     //pot
00719     beamsysw*=zbeam->GetWeight(det,Ibeam,3,bs_pars[2],true_enu);
00720     //horn current miscalibration
00721     beamsysw*=zbeam->GetWeight(det,Ibeam,4,bs_pars[3],true_enu);
00722     //horn current distribution
00723     beamsysw*=zbeam->GetWeight(det,Ibeam,5,bs_pars[4],true_enu);
00724 
00725     //now change pt and pz
00726     double hp[7]={hp_pars[0],hp_pars[1],hp_pars[2],hp_pars[3],
00727                   hp_pars[4],hp_pars[5],hp_pars[6]};
00728     //to let zfluk know I want the PRL version of it's weights
00729     //I'm passing the hadron production parameters as an array
00730     hadpw = zfluk->GetWeightPRL(tptype,pt,pz,hp);
00731   }  
00732   else if(cfgnum==kBoston){ 
00733     //Boston version of zbeam takes a vector of beam systematic parameters
00734      //first 5 are for numu's
00735      //second 5 are for antinumu's
00736      vector<double> tmp_bs_pars;
00737      if(inu>0){
00738         for(int i=0;i<5;i++){
00739            tmp_bs_pars.push_back(bs_pars[i]);
00740         }
00741      }
00742      else{
00743         for(int i=0;i<5;i++){
00744            tmp_bs_pars.push_back(bs_pars[i+5]);
00745         }
00746      }
00747      beamsysw=zbeam->GetWeight(det,Ibeam,tmp_bs_pars,inu,true_enu);     
00748 
00749      //reweight for spot size in me and he
00750      //now done in RunPeriodWeight
00751      //     beamsysw*=zbeam->GetWeight(det,Ibeam,6,0,true_enu);   
00752      
00753      //updated version of zbeam takes a vector of hadron production parameters
00754      hadpw=zfluk->GetWeightBoston(tptype,pt,pz,hp_pars);
00755   }
00756   else if(cfgnum==kPiMinus){
00757     //updated version of zbeam takes a vector of beam systematic parameters
00758     beamsysw=zbeam->GetWeight(det,Ibeam,bs_pars,inu,true_enu);
00759     //reweight for spot size in me and he
00760     //now done in RunPeriodWeight
00761     //    beamsysw*=zbeam->GetWeight(det,Ibeam,6,0,true_enu);   
00762 
00763     //pi minus version of fit has parameters set one time at the beginning,
00764     //the parameters are not reset each time in getweight
00765     hadpw = zfluk->GetWeight(tptype,pt,pz);
00766   }
00767   else if(cfgnum==kDetXs || cfgnum==kDogwood1_Daikon07){
00768 
00769     // Hadron Production weight
00770     hadpw = zfluk->GetWeight(tptype,pt,pz);
00771  
00772   }
00773 
00774   else if(cfgnum==kDogwood1_Daikon07_v2 || cfgnum==kDogwood5_Daikon07_2012){
00775 
00776     Detector::Detector_t detector = Detector::kUnknown;
00777     if     (det==1) detector=Detector::kNear;
00778     else if(det==2) detector=Detector::kFar;
00779     else if(det==3) detector=Detector::kUnknown;
00780     
00781     if(rp==kRunIV||rp==kRunVII||rp==kRunIX){
00782 
00783       Zbeam::ZbeamData_t zdata;
00784       zdata.ntype    = -inu; // change to negative as appropriate for RHC running
00785       zdata.true_enu = true_enu;
00786       zdata.detector = detector;
00787       zdata.beam     =  BeamType::FromZarko(Ibeam);
00788       
00789       // Focusing alignment effects
00790       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHorn1Offset   ,bs_pars[0]);
00791       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kBaffleScraping,bs_pars[1]);
00792       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kPOT           ,bs_pars[2]);
00793       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHornIMiscal   ,bs_pars[3]);
00794       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHornIDist     ,bs_pars[4]);
00795 
00796     }
00797 
00798     else {
00799 
00800       Zbeam::ZbeamData_t zdata;
00801       zdata.ntype    = inu;
00802       zdata.true_enu = true_enu;
00803       zdata.detector = detector;
00804       zdata.beam     =  BeamType::FromZarko(Ibeam);
00805       
00806       // Focusing alignment effects
00807       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHorn1Offset   ,bs_pars[0]);
00808       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kBaffleScraping,bs_pars[1]);
00809       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kPOT           ,bs_pars[2]);
00810       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHornIMiscal   ,bs_pars[3]);
00811       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHornIDist     ,bs_pars[4]);
00812     
00813     }
00814 
00815     // Hadron production weight
00816     hadpw = zfluk->GetWeight(tptype,pt,pz);
00817 
00818   }
00819 
00820   else if(cfgnum==kMINOSplus_2014){
00821 
00822     Detector::Detector_t detector = Detector::kUnknown;
00823     if     (det==1) detector=Detector::kNear;
00824     else if(det==2) detector=Detector::kFar;
00825     else if(det==3) detector=Detector::kUnknown;
00826     
00827     if(IntFromRunPeriod(rp)<11){
00828       MSG("SKZPWeightCalculator",Msg::kInfo)<<"You can't apply MINOS+ weights "
00829                                             <<" to MINOS runs - load older config "
00830                                             <<" beam systematic weight set to 1.0 "<<endl;
00831       beamsysw*=1.;
00832     }
00833     else {
00834       Zbeam::ZbeamData_t zdata;
00835       zdata.ntype    = inu;
00836       zdata.true_enu = true_enu;
00837       zdata.detector = detector;
00838       zdata.beam     =  BeamType::FromZarko(Ibeam);
00839       
00840       // Focusing alignment effects
00841       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHorn1Offset   ,bs_pars[0]);
00842       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kBaffleScraping,bs_pars[1]);
00843       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kPOT           ,bs_pars[2]);
00844       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHornIMiscal   ,bs_pars[3]);
00845       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHornIDist     ,bs_pars[4]);
00846     }
00847 
00848     // Hadron production weight
00849     if(IntFromRunPeriod(rp)<11){
00850       MSG("SKZPWeightCalculator",Msg::kInfo)<<"You can't apply MINOS+ weights "
00851                                             <<" to MINOS runs - load older config "
00852                                             <<" hadron production (SKZP) weight set to 1.0 "<<endl;
00853       hadpw*=1.;
00854     }
00855     else{
00856     hadpw = zfluk->GetWeightMINOSplus(tptype,pt,pz);
00857     }
00858 
00859 
00860   }
00861 
00862 
00863   else if(cfgnum==kMINOSplus_2014_v2){
00864 
00865     Detector::Detector_t detector = Detector::kUnknown;
00866     if     (det==1) detector=Detector::kNear;
00867     else if(det==2) detector=Detector::kFar;
00868     else if(det==3) detector=Detector::kUnknown;
00869     
00870     if(IntFromRunPeriod(rp)<11){
00871       MSG("SKZPWeightCalculator",Msg::kInfo)<<"You can't apply MINOS+ v2 weights "
00872                                             <<" to MINOS runs - load older config "
00873                                             <<" beam systematic weight set to 1.0 "<<endl;
00874       beamsysw*=1.;
00875     }
00876     else if(BeamType::FromZarko(Ibeam)==45){
00877       //      MSG("SKZPWeightCalculator",Msg::kInfo)<<"You are running RHC ME beam, beamsys weight set to 1.0 "<<endl;
00878       beamsysw*=1.;
00879     }
00880     else {
00881       Zbeam::ZbeamData_t zdata;
00882       zdata.ntype    = inu;
00883       zdata.true_enu = true_enu;
00884       zdata.detector = detector;
00885       zdata.beam     =  BeamType::FromZarko(Ibeam);
00886       
00887       // Focusing alignment effects
00888       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHorn1Offset   ,bs_pars[0]);
00889       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kBaffleScraping,bs_pars[1]);
00890       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kPOT           ,bs_pars[2]);
00891       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHornIMiscal   ,bs_pars[3]);
00892       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHornIDist     ,bs_pars[4]);
00893 
00894     }
00895 
00896 
00897     //      MSG("SKZPWeightCalculator",Msg::kInfo)<<"BeamType is "<<BeamType::FromZarko(Ibeam)<<endl;  
00898 
00899     // Hadron production weight
00900     if(IntFromRunPeriod(rp)<11){
00901       MSG("SKZPWeightCalculator",Msg::kInfo)<<"You can't apply MINOS+ weights "
00902                                             <<" to MINOS runs - load older config "
00903                                             <<" hadron production (SKZP) weight set to 1.0 "<<endl;
00904       hadpw*=1.;
00905     }
00906     else if(BeamType::FromZarko(Ibeam)==45){
00907       //      MSG("SKZPWeightCalculator",Msg::kInfo)<<"You are running RHC ME beam, hadron production (SKZP) weight set to 1.0 "<<endl;
00908       hadpw*=1.;
00909       apsw=1.0;
00910     }
00911     else{
00912     hadpw = zfluk->GetWeightMINOSplus2(tptype,pt,pz);
00913     apsw = GetAPSweight(detector, Ibeam, true_enu, inu);
00914     }
00915 
00916   }//end MINOSplus2
00917 
00918   else if(cfgnum==kMINOSplus_2018){
00919 
00920     Detector::Detector_t detector = Detector::kUnknown;
00921     if     (det==1) detector=Detector::kNear;
00922     else if(det==2) detector=Detector::kFar;
00923     else if(det==3) detector=Detector::kUnknown;
00924     
00925     if(IntFromRunPeriod(rp)<11){
00926       MSG("SKZPWeightCalculator",Msg::kInfo)<<"You can't apply MINOS+ 2018 weights "
00927                                             <<" to MINOS runs - load older config "
00928                                             <<" beam systematic weight set to 1.0 "<<endl;
00929       beamsysw*=1.;
00930     }
00931     else if(BeamType::FromZarko(Ibeam)==45){
00932       //      MSG("SKZPWeightCalculator",Msg::kInfo)<<"You are running RHC ME beam, beamsys weight set to 1.0 "<<endl;
00933       beamsysw*=1.;
00934     }
00935     else {
00936       Zbeam::ZbeamData_t zdata;
00937       zdata.ntype    = inu;
00938       zdata.true_enu = true_enu;
00939       zdata.detector = detector;
00940       zdata.beam     =  BeamType::FromZarko(Ibeam);
00941       
00942       // Focusing alignment effects
00943       bool is120GeVband=false;
00944       if(IntFromRunPeriod(rp)==13){
00945         is120GeVband=true;
00946       }
00947       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHornIMiscal   ,bs_pars[0],is120GeVband);
00948       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kMaterialError ,bs_pars[1],is120GeVband);
00949       if(IntFromRunPeriod(rp)==13){
00950         beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHorn1Tilt     ,bs_pars[2],is120GeVband);
00951       }
00952       
00953     }
00954 
00955 
00956     //      MSG("SKZPWeightCalculator",Msg::kInfo)<<"BeamType is "<<BeamType::FromZarko(Ibeam)<<endl;  
00957 
00958     // Hadron production weight
00959     if(IntFromRunPeriod(rp)<11){
00960       MSG("SKZPWeightCalculator",Msg::kInfo)<<"You can't apply MINOS+ weights "
00961                                             <<" to MINOS runs - load older config "
00962                                             <<" hadron production (SKZP) weight set to 1.0 "<<endl;
00963       hadpw*=1.;
00964     }
00965     else if(BeamType::FromZarko(Ibeam)==45){
00966       //      MSG("SKZPWeightCalculator",Msg::kInfo)<<"You are running RHC ME beam, hadron production (SKZP) weight set to 1.0 "<<endl;
00967       hadpw*=1.;
00968       apsw=1.0;
00969     }
00970     else{
00971       hadpw = zfluk->GetWeightMINOSplusN1J(tptype,pt,pz);
00972       apsw = GetAPSweight(detector, Ibeam, true_enu, inu,rp);
00973       apsw *= (1+GetHGweight(detector, Ibeam, true_enu, inu));
00974     }
00975 
00976   }//end MINOSplus2018
00977 
00978   else{ 
00979     //updated version of zbeam takes a vector of beam systematic parameters
00980     beamsysw=zbeam->GetWeight(det,Ibeam,bs_pars,inu,true_enu);
00981     //updated version of zbeam takes a vector of hadron production parameters
00982     hadpw=zfluk->GetWeight(tptype,pt,pz);
00983   }
00984 
00985   double rpw; 
00986       rpw = GetRunPeriodWeight(rp,det,Ibeam,inu,true_enu);
00987 
00988       //    cout<<"run period "<<rp<<" weight "<<rpw<<endl;
00989   //return the product of beam systematic weights and had. prod. weights
00990       //   cout<<"inu "<<inu<<"hadpw "<<hadpw<<" beamsysw "<<beamsysw<<endl;
00991       //  cout<<"apsw = "<<apsw<<endl;
00992   return hadpw*beamsysw*rpw*apsw;
00993 }

double SKZPWeightCalculator::GetDecayError ( int  det,
int  Ibeam,
int  inu,
double  true_enu,
VldContext  vc,
double  nsigma = 1.,
const char *  dir = "" 
) [inline]

Definition at line 378 of file SKZPWeightCalculator.h.

References GetDecayError(), RunPeriodFromInt(), and RunPeriodIntFromValidity().

00379                                                                            {
00380     return GetDecayError(det,Ibeam,inu,true_enu,
00381                          RunPeriodFromInt(RunPeriodIntFromValidity(vc)),nsigma,dir);
00382   }

double SKZPWeightCalculator::GetDecayError ( int  det,
int  Ibeam,
int  inu,
double  true_enu,
RunPeriod_t  rp = kRunI,
double  nsigma = 1.,
const char *  dir = "" 
)

Definition at line 2120 of file SKZPWeightCalculator.cxx.

References decayErrorsLoaded, IntFromRunPeriod(), LoadDecayErrors(), NuE_DecayError, NuEBar_DecayError, NuMu_DecayError, and NuMuBar_DecayError.

Referenced by GetDecayError(), and GetFluxError().

02122 {
02123   if(!decayErrorsLoaded) LoadDecayErrors(dir,rp);
02124 
02125   int i = Ibeam-2;
02126   int j = IntFromRunPeriod(rp)-1;
02127   int k = det-1;
02128 
02129   if(i!=0 && i!=6) return 0.;
02130   else {
02131     switch(inu){
02132     case 14: return nsigma*(NuMu_DecayError[i][j][k]->GetBinContent(NuMu_DecayError[i][j][k]->FindBin(true_enu)));
02133     case -14: return nsigma*(NuMuBar_DecayError[i][j][k]->GetBinContent(NuMuBar_DecayError[i][j][k]->FindBin(true_enu)));
02134     case 12: return nsigma*(NuE_DecayError[i][j][k]->GetBinContent(NuE_DecayError[i][j][k]->FindBin(true_enu)));
02135     case -12: return nsigma*(NuEBar_DecayError[i][j][k]->GetBinContent(NuEBar_DecayError[i][j][k]->FindBin(true_enu)));
02136     default: return 0.;
02137     }  
02138   }
02139 
02140   return 0.;
02141 }

double SKZPWeightCalculator::GetDecayModelError ( int  det,
int  Ibeam,
int  inu,
double  true_enu,
VldContext  vc,
double  nsigma = 1.,
const char *  dir = "" 
) [inline]

Definition at line 386 of file SKZPWeightCalculator.h.

References GetDecayModelError(), RunPeriodFromInt(), and RunPeriodIntFromValidity().

00387                                                                                 {
00388     return GetDecayModelError(det,Ibeam,inu,true_enu,
00389                               RunPeriodFromInt(RunPeriodIntFromValidity(vc)),nsigma,dir);
00390   }

double SKZPWeightCalculator::GetDecayModelError ( int  det,
int  Ibeam,
int  inu,
double  true_enu,
RunPeriod_t  rp = kRunI,
double  nsigma = 1.,
const char *  dir = "" 
)

Definition at line 2144 of file SKZPWeightCalculator.cxx.

References decayModelErrorsLoaded, IntFromRunPeriod(), LoadDecayModelErrors(), NuE_DecayModelError, NuEBar_DecayModelError, NuMu_DecayModelError, and NuMuBar_DecayModelError.

Referenced by GetDecayModelError(), and GetFluxError().

02146 {
02147   if(!decayModelErrorsLoaded) LoadDecayModelErrors(dir,rp);
02148 
02149   int i = Ibeam-2;
02150   int j = IntFromRunPeriod(rp)-1;
02151   int k = det-1;
02152 
02153   if(i!=0) return 0.;
02154   else {
02155     switch(inu){
02156     case 14: return nsigma*(NuMu_DecayModelError[i][j][k]->GetBinContent(NuMu_DecayModelError[i][j][k]->FindBin(true_enu)));
02157     case -14: return nsigma*(NuMuBar_DecayModelError[i][j][k]->GetBinContent(NuMuBar_DecayModelError[i][j][k]->FindBin(true_enu)));
02158     case 12: return nsigma*(NuE_DecayModelError[i][j][k]->GetBinContent(NuE_DecayModelError[i][j][k]->FindBin(true_enu)));
02159     case -12: return nsigma*(NuEBar_DecayModelError[i][j][k]->GetBinContent(NuEBar_DecayModelError[i][j][k]->FindBin(true_enu)));
02160     default: return 0.;
02161     }  
02162   }
02163 
02164   return 0.;
02165 }

double SKZPWeightCalculator::GetDetWeight ( int  ccnc,
double  true_enu,
int  inu,
double  reco_emu,
double  reco_eshw,
double &  new_reco_emu,
double &  new_reco_eshw,
double  true_eshw = -1,
MCEventInfo ei = 0 
)

Definition at line 995 of file SKZPWeightCalculator.cxx.

References cfgnum, MCReweight::ComputeWeight(), det_pars, fBeamOnly, MCEventInfo::iaction, MCEventInfo::iresonance, kAntiNuMu, kBoston, kDetXs, kDogwood1_Daikon07, kDogwood1_Daikon07_v2, kDogwood5_Daikon07_2012, Msg::kError, kMINOSplus_2014, kMINOSplus_2014_v2, kNuMuCC, kPiMinus, kPRL, mcr, MSG, sampsel, and XP.

Referenced by NueFluxWeightsAna::Analyze(), GetRFWWeight(), and GetWeight().

00999 {
01000 
01001   //computes the effect of the changing the detector parameters in the skzp fit
01002   //this function changes the reconstructed values of muon and shower energy,
01003   //so the new values are passed back to the calling function by reference as
01004   //part of the function parameter list
01005   double dw = 1.;
01006   new_reco_emu=reco_emu;
01007   new_reco_eshw=reco_eshw;
01008 
01009 
01010   if(cfgnum==kPRL){
01011     //right now this is the only version of detector weighting,
01012     //but this may evolve in the future
01013 
01014     //prl version of weights weights the NC component up or down by 1-fitparam
01015     if(ccnc==0){
01016       dw = 1.-det_pars[2];
01017     }
01018     
01019     //prl version of skzp changes the shower energy by an offset,
01020     //then changes the total neutrino energy (eshw+emu) by 
01021     //a multiplicative constant that is 1-fit parameter
01022     if(reco_eshw>0){
01023       new_reco_eshw = reco_eshw+det_pars[1];
01024     }
01025     if(new_reco_eshw<0){
01026       new_reco_eshw=0.;
01027     }
01028     
01029     new_reco_eshw*=(1-det_pars[0]);
01030     new_reco_emu=reco_emu*(1-det_pars[0]);
01031   }
01032   else if(cfgnum==kBoston){
01033     //boston version of weights weights the numu's and anumus separately
01034     if(ccnc==0){
01035        if(inu>0){
01036           dw = 1.-det_pars[2];
01037        }
01038        else{
01039           dw = 1.-det_pars[5];
01040        }
01041     }
01042     
01043     //boston version of skzp changes the shower energy by an offset,
01044     //then changes the total neutrino energy (eshw+emu) by 
01045     //a multiplicative constant that is 1-fit parameter
01046     if(reco_eshw>0){
01047        if(inu>0){
01048           new_reco_eshw = reco_eshw+det_pars[1];
01049        }
01050        else{
01051           new_reco_eshw = reco_eshw+det_pars[4];
01052        }
01053     }
01054     if(new_reco_eshw<0){
01055        new_reco_eshw=0.;
01056     }
01057     
01058     if(inu>0){
01059        new_reco_eshw*=(1-det_pars[0]);
01060        new_reco_emu=reco_emu*(1-det_pars[0]);
01061     }
01062     else{
01063        new_reco_eshw*=(1-det_pars[3]);
01064        new_reco_emu=reco_emu*(1-det_pars[3]);
01065     }
01066   }
01067   else if(cfgnum==kPiMinus){
01068     //Piminus version of weights weights the numu's and anumus separately
01069     if(ccnc==0){
01070       if(sampsel==kNuMuCC){
01071         //      cout<<"Found an NC, and I'm using the CC parameter"<<endl;
01072         dw = 1-det_pars[2];
01073       }
01074       else if(sampsel==kAntiNuMu){
01075         //      cout<<"Found an NC, and I'm using the Anti parameter"<<endl;
01076         dw = 1-det_pars[3];
01077       }
01078       else{//if a sample isn't specified, 
01079            //do it like I think you should.
01080        if(inu>0){
01081          dw = 1.-det_pars[2];
01082        }
01083        else{
01084          dw = 1.-det_pars[3];
01085        }
01086       }
01087     }
01088     
01089     //Piminus version of skzp changes the shower energy by an offset,
01090     //then changes the total neutrino energy (eshw+emu) by 
01091     //a multiplicative constant that is 1-fit parameter
01092     //it also treats nu's and anu's in the same way
01093     new_reco_eshw=reco_eshw;
01094     if(reco_eshw>0){
01095       new_reco_eshw = reco_eshw+det_pars[1];
01096     }
01097     if(new_reco_eshw<0){
01098       new_reco_eshw=0.;
01099     }
01100     
01101     if(inu==14||inu==-14){
01102       new_reco_eshw*=(1-det_pars[0]);
01103       new_reco_emu=reco_emu*(1-det_pars[0]);
01104     }
01105     else if(inu==12||inu==-12){
01106       new_reco_eshw*=(1-0.);
01107       new_reco_emu=reco_emu*(1-0.);
01108     }
01109     else{
01110       new_reco_eshw*=(1-0.);
01111       new_reco_emu=reco_emu*(1-0.);
01112     }
01113 
01114     //Piminus version of the fit has a scale for numubar xsec
01115     if(inu==-14){
01116       double xsw=1.;
01117       if(true_enu<XP){
01118         xsw = det_pars[4]+2.*(1.-det_pars[4])*true_enu/XP
01119           +(det_pars[4]-1.)*true_enu*true_enu/(XP*XP);
01120       }
01121       dw*=xsw;
01122     }
01123   }
01124   else if(cfgnum==kDetXs || cfgnum==kDogwood1_Daikon07){
01125 
01126     // You must give an MCEventInfo object to get the
01127     // correct detector weight
01128     if(fBeamOnly||ei==0) return dw;
01129 
01130     // Shower offset
01131     if(reco_eshw>0.) {
01132       new_reco_eshw = reco_eshw+det_pars[0];
01133     }
01134     if(new_reco_eshw<0){
01135       new_reco_eshw=0.;
01136     }
01137 
01138     // Shower energy scale from functional form
01139     double x0=10;
01140     double x = TMath::Min((double)true_eshw,x0);
01141     double err_a = 1.04/1.0 - 1.0;
01142     double err_b = (1.1+2.*(1-1.1)*(x/x0)+(1.1-1)*(x/x0)*(x/x0))/(1.0) - 1.0;
01143     double err_c = 0.057;
01144     double shw_scale=sqrt(pow(err_a,2)+pow(err_b,2)+pow(err_c,2));
01145     
01146     new_reco_eshw*=(1-det_pars[4]*shw_scale);
01147 
01148     // Scale muon energy 
01149     new_reco_emu=reco_emu*(1.-det_pars[5]);
01150     
01151     // NC parameters
01152     if(ei->iaction==0){
01153       if(sampsel==kNuMuCC)         dw*=(1-det_pars[1]);
01154       else if(sampsel==kAntiNuMu)  dw*=(1-det_pars[2]);
01155       else{
01156         if(inu==14)  dw = 1.-det_pars[1];
01157         if(inu==-14) dw = 1.-det_pars[2];
01158       }
01159     }
01160     else {
01161       // Cross Section Parameters
01162       if(ei!=0) {
01163         double gw=1;
01164         if(ei->iresonance!=1005) gw=mcr->ComputeWeight(ei)-1.0;
01165         
01166         if(ei->iresonance==1001) dw*=(1+det_pars[6]*gw);
01167         if(ei->iresonance==1002) dw*=(1+det_pars[7]*gw);
01168         //if(ei->iresonance==1003) dw*=(1+det_pars[8]*gw);
01169       }
01170     }
01171         
01172     //numubar xsec
01173     if(inu==-14){
01174       double xsw=1.;
01175       if(true_enu<XP){
01176         xsw = det_pars[3]+2.*(1.-det_pars[3])*true_enu/XP
01177           +(det_pars[3]-1.)*true_enu*true_enu/(XP*XP);
01178       }
01179       dw*=xsw;
01180     }
01181    
01182   }
01183   else if(cfgnum==kDogwood1_Daikon07_v2 || cfgnum==kDogwood5_Daikon07_2012 || cfgnum==kMINOSplus_2014 || cfgnum==kMINOSplus_2014_v2){
01184 
01185     // Similar to kDetXs but with parameters incremented
01186     // by 1 as new parameter 0 is the overall neutrino 
01187     // energy scale.
01188 
01189     // You must give an MCEventInfo object to get the
01190     // correct detector weight
01191     if(fBeamOnly||ei==0) return dw;
01192 
01193     // Shower offset
01194     if(reco_eshw>0.) {
01195       new_reco_eshw = reco_eshw+det_pars[1];
01196     }
01197     if(new_reco_eshw<0){
01198       new_reco_eshw=0.;
01199     }
01200 
01201     // Shower energy scale from functional form
01202     double x0=10;
01203     double x = TMath::Min((double)true_eshw,x0);
01204     double err_a = 1.04/1.0 - 1.0;
01205     double err_b = (1.1+2.*(1-1.1)*(x/x0)+(1.1-1)*(x/x0)*(x/x0))/(1.0) - 1.0;
01206     double err_c = 0.057;
01207     double shw_scale=sqrt(pow(err_a,2)+pow(err_b,2)+pow(err_c,2));
01208     
01209     new_reco_eshw*=(1-det_pars[5]*shw_scale);
01210 
01211     // Scale muon energy 
01212     new_reco_emu=reco_emu*(1.-det_pars[6]);
01213     
01214     // Now need to scale the overall neutrino energy BUT the current
01215     // weighting functions don't allow me to pass back a new value 
01216     // for the neutrino energy, just the muon and shower separately.
01217     // So I'm going to assume everyone will just add these two to
01218     // get the new neutrino energy and hence implement the neutrino
01219     // energy scale parameter by applying it to both the muon and
01220     // shower energy seperately:
01221 
01222     new_reco_eshw*=(1.-det_pars[0]);
01223     new_reco_emu*=(1.-det_pars[0]);
01224 
01225     // NC parameters
01226     if(ei->iaction==0){
01227       if(sampsel==kNuMuCC)         dw*=(1-det_pars[2]);
01228       else if(sampsel==kAntiNuMu)  dw*=(1-det_pars[3]);
01229       else{
01230         if(inu==14)  dw = 1.-det_pars[2];
01231         if(inu==-14) dw = 1.-det_pars[3];
01232       }
01233     }
01234     else {
01235       // Cross Section Parameters
01236       if(ei!=0) {
01237         double gw=1;
01238         if(ei->iresonance!=1005) gw=mcr->ComputeWeight(ei)-1.0;
01239         
01240         if(ei->iresonance==1001) dw*=(1+det_pars[7]*gw);
01241         if(ei->iresonance==1002) dw*=(1+det_pars[8]*gw);
01242       }
01243     }
01244         
01245     //numubar xsec
01246     if(inu==-14){
01247       double xsw=1.;
01248       if(true_enu<XP){
01249         xsw = det_pars[4]+2.*(1.-det_pars[4])*true_enu/XP
01250           +(det_pars[4]-1.)*true_enu*true_enu/(XP*XP);
01251       }
01252       dw*=xsw;
01253     }
01254 
01255   }
01256   else{
01257     //this does nothing for now, and 
01258     //should never be called,
01259     //but I want the structure
01260     MSG("SKZPWeightCalculator",Msg::kError)<<"You are in the else of DetWeighting!"
01261                                            <<"this should never happen!"
01262                                            <<"How did you get here?"<<endl;
01263   }
01264 
01265   /*
01266   if(new_reco_eshw+new_reco_emu<1.5){
01267     cout<<"Detetor weight "<<inu<<" ccnc "<<ccnc<<"true enu "<<true_enu<<" reco emu "<<reco_emu<<" new_reco_emu "<<new_reco_emu<<" reco eshw "<<reco_eshw<<" new_reco_eshw "<<new_reco_eshw<<" weight "<<dw<<endl;
01268   }
01269   */
01270   return dw;
01271 
01272 }

double SKZPWeightCalculator::GetFluxError ( int  det,
int  Ibeam,
int  inu,
double  true_enu,
VldContext  vc,
double  nsigma = 1.,
FluxErrEffect_t  neffect = kTotalErrorAfterTune,
const char *  beamSysFileDir = "" 
) [inline]

Definition at line 280 of file SKZPWeightCalculator.h.

References GetFluxError(), RunPeriodFromInt(), and RunPeriodIntFromValidity().

00283                                                     {
00284     return GetFluxError(det,Ibeam,inu,true_enu,RunPeriodFromInt(RunPeriodIntFromValidity(vc)),
00285                         nsigma,neffect,beamSysFileDir);
00286   }

double SKZPWeightCalculator::GetFluxError ( int  det,
int  Ibeam,
int  inu,
double  true_enu,
RunPeriod_t  rp,
double  nsigma = 1.,
FluxErrEffect_t  neffect = kTotalErrorAfterTune,
const char *  beamSysFileDir = "" 
)

Definition at line 1366 of file SKZPWeightCalculator.cxx.

References cfgnum, err(), BeamType::FromZarko(), GetDecayError(), GetDecayModelError(), GetFluxError(), GetHadProdError(), GetHadProdError2012(), GetMaterialError(), GetOpticsError(), GetTargetZError(), kDogwood1_Daikon07_v2, kDogwood5_Daikon07_2012, kMINOSplus_2014, kMINOSplus_2014_v2, kMINOSplus_2018, kNone, kRunIV, kRunIX, kRunV, kRunVI, kRunVII, kRunVIII, kRunX, and RunPeriodFromInt().

01369 {
01370 
01371   if(cfgnum!=kDogwood1_Daikon07_v2 && cfgnum!=kDogwood5_Daikon07_2012 && cfgnum!=kMINOSplus_2014 && cfgnum!=kMINOSplus_2014_v2 && cfgnum!=kMINOSplus_2018){
01372     return GetFluxError(det,Ibeam,inu,true_enu,neffect,nsigma);
01373   }
01374 
01375   else{
01376 
01377     double err = 0.;
01378 
01379     if(BeamType::FromZarko(Ibeam)==45){
01380       //      cout<<"setting fluxerr to 0 since RHC beam"<<endl;
01381       return err = 0;
01382     }
01383     else if(BeamType::FromZarko(Ibeam)!=45){
01384    if(rp!=kRunIV && rp!=kRunV && rp!=kRunVI && rp!=kRunVII && rp!=kRunVIII && rp!=kRunIX && rp!=kRunX && rp!=kNone){
01385       if(cfgnum==kDogwood1_Daikon07_v2){
01386       err+=TMath::Power((GetHadProdError(det,Ibeam,inu,true_enu,rp,nsigma,beamSysFileDir)),2);
01387       }
01388       if(cfgnum==kDogwood5_Daikon07_2012 || cfgnum==kMINOSplus_2014 || cfgnum==kMINOSplus_2014_v2|| cfgnum==kMINOSplus_2018){  //FOR MINOS+ kept old naming scheme so this will call the correct histograms by default
01389         //              MSG("SKZPWeightCalculator",Msg::kInfo)<<"AM IN NEW "<<endl;
01390       err+=TMath::Power((GetHadProdError2012(det,Ibeam,inu,true_enu,rp,nsigma,beamSysFileDir)),2);
01391       }   
01392 
01393       err+=TMath::Power((GetOpticsError(det,Ibeam,inu,true_enu,rp,nsigma,beamSysFileDir)),2);
01394       err+=TMath::Power((GetTargetZError(det,Ibeam,inu,true_enu,rp,nsigma,beamSysFileDir)),2);
01395       err+=TMath::Power((GetMaterialError(det,Ibeam,inu,true_enu,rp,nsigma,beamSysFileDir)),2);
01396       err+=TMath::Power((GetDecayError(det,Ibeam,inu,true_enu,rp,nsigma,beamSysFileDir)),2);
01397       err+=TMath::Power((GetDecayModelError(det,Ibeam,inu,true_enu,rp,nsigma,beamSysFileDir)),2);
01398   }
01399     else if(rp==kRunIV||rp==kRunVII||rp==kRunIX){
01400 
01401       // For Run IV:
01402 
01403       // Use Run I error bands but:
01404       //  - use hadron production errors for this neutrino type
01405       //  - use other errors for anti- this neutrino type
01406 
01407       // Eg: for numubar events you'll get the numubar hadron production
01408       //     errors with other errors corresponding to the numus, as is
01409       //     appropriate for RHC running.
01410       if(cfgnum==kDogwood1_Daikon07_v2){
01411       err+=TMath::Power((GetHadProdError(det,Ibeam,inu,true_enu,RunPeriodFromInt(1),nsigma,beamSysFileDir)),2);
01412       }
01413       if(cfgnum==kDogwood5_Daikon07_2012){
01414         err+=TMath::Power((GetHadProdError2012(det,Ibeam,inu,true_enu,RunPeriodFromInt(4),nsigma,beamSysFileDir)),2);
01415       }
01416       err+=TMath::Power((GetOpticsError(det,Ibeam,-inu,true_enu,RunPeriodFromInt(1),nsigma,beamSysFileDir)),2);
01417       err+=TMath::Power((GetTargetZError(det,Ibeam,-inu,true_enu,RunPeriodFromInt(1),nsigma,beamSysFileDir)),2);
01418       err+=TMath::Power((GetMaterialError(det,Ibeam,-inu,true_enu,RunPeriodFromInt(1),nsigma,beamSysFileDir)),2);
01419       err+=TMath::Power((GetDecayError(det,Ibeam,-inu,true_enu,RunPeriodFromInt(1),nsigma,beamSysFileDir)),2);
01420       err+=TMath::Power((GetDecayModelError(det,Ibeam,-inu,true_enu,RunPeriodFromInt(1),nsigma,beamSysFileDir)),2);
01421 
01422     }
01423 
01424     else if(rp==kRunV||rp==kRunVI||rp==kRunVIII||rp==kRunX){
01425 
01426       // For newer runs want to apply the older runIII errors for now
01427 
01428       if(cfgnum==kDogwood1_Daikon07_v2){
01429       err+=TMath::Power((GetHadProdError(det,Ibeam,inu,true_enu,RunPeriodFromInt(3),nsigma,beamSysFileDir)),2);
01430       }
01431       if(cfgnum==kDogwood5_Daikon07_2012){
01432         err+=TMath::Power((GetHadProdError2012(det,Ibeam,inu,true_enu,RunPeriodFromInt(3),nsigma,beamSysFileDir)),2);
01433       }
01434       err+=TMath::Power((GetOpticsError(det,Ibeam,-inu,true_enu,RunPeriodFromInt(3),nsigma,beamSysFileDir)),2);
01435       err+=TMath::Power((GetTargetZError(det,Ibeam,-inu,true_enu,RunPeriodFromInt(3),nsigma,beamSysFileDir)),2);
01436       err+=TMath::Power((GetMaterialError(det,Ibeam,-inu,true_enu,RunPeriodFromInt(3),nsigma,beamSysFileDir)),2);
01437       err+=TMath::Power((GetDecayError(det,Ibeam,-inu,true_enu,RunPeriodFromInt(3),nsigma,beamSysFileDir)),2);
01438       err+=TMath::Power((GetDecayModelError(det,Ibeam,-inu,true_enu,RunPeriodFromInt(3),nsigma,beamSysFileDir)),2);
01439 
01440     }
01441     }
01442 
01443     else return 0.;
01444 
01445     if(err<0.) err = 0.;
01446     return (1.+(nsigma*TMath::Sqrt(err)));
01447 
01448   }
01449 
01450 }

double SKZPWeightCalculator::GetFluxError ( int  det,
int  Ibeam,
int  inu,
double  true_enu,
FluxErrEffect_t  neffect = kTotalErrorAfterTune,
double  nsigma = 1. 
)

Definition at line 1452 of file SKZPWeightCalculator.cxx.

References bs_pars, cfgname, MuELoss::e, Zbeam::GetWeight(), BeamSys::kBaffleScraping, BeamSys::kBeamWidth, BeamSys::kHadProdAfter, BeamSys::kHorn1Offset, BeamSys::kHornIDist, BeamSys::kHornIMiscal, BeamSys::kPOT, BeamSys::kTargetZ, kTotalErrorAfterTune, Zbeam::SetReweightConfig(), and zbeam.

Referenced by MiniPlotMaker::ApplySystematic(), NueSystematic::DoSKZPCalc(), NCEventInfo::FindMEGAFitWeightUncertainty(), GetFluxError(), and NuZBeamReweight::GetWeights().

01455 {
01456  zbeam->SetReweightConfig(cfgname);
01457   
01458   // Add target z with different than nsigma weight
01459   if(cfgname=="DetXs" && neffect==kTotalErrorAfterTune) {
01460   
01461     double e=0;
01462  
01463     double weight=zbeam->GetWeight(det,Ibeam,BeamSys::kHorn1Offset,nsigma,inu,true_enu)-1;
01464     e+=weight*weight;
01465     weight=zbeam->GetWeight(det,Ibeam,BeamSys::kBaffleScraping,nsigma,inu,true_enu)-1;
01466     e+=weight*weight;
01467     weight=zbeam->GetWeight(det,Ibeam,BeamSys::kPOT,nsigma,inu,true_enu)-1;
01468     e+=weight*weight;
01469     weight=zbeam->GetWeight(det,Ibeam,BeamSys::kHornIMiscal,nsigma,inu,true_enu)-1;
01470     e+=weight*weight;
01471     weight=zbeam->GetWeight(det,Ibeam,BeamSys::kHornIDist,nsigma,inu,true_enu)-1;
01472     e+=weight*weight;
01473     weight=zbeam->GetWeight(det,Ibeam,BeamSys::kBeamWidth,nsigma,inu,true_enu)-1;
01474     e+=weight*weight;
01475     weight=zbeam->GetWeight(det,Ibeam,BeamSys::kHadProdAfter,nsigma,inu,true_enu)-1;
01476     e+=weight*weight;
01477         
01478     // add error from best fit for target z
01479 
01480     // le010 configurations
01481     if(Ibeam==2 || Ibeam==6 || Ibeam==7) {
01482       double targetz=TMath::Max(TMath::Abs(bs_pars[0]),TMath::Abs(bs_pars[4]));
01483       weight=zbeam->GetWeight(det,Ibeam,BeamSys::kTargetZ,targetz*nsigma,inu,true_enu)-1;
01484       e+=weight*weight;
01485     }
01486     // le100
01487     else if(Ibeam==3) {
01488       double targetz=TMath::Abs(bs_pars[1]);
01489       weight=zbeam->GetWeight(det,Ibeam,BeamSys::kTargetZ,targetz*nsigma,inu,true_enu)-1;
01490       e+=weight*weight;
01491     }
01492     // le250
01493     else if(Ibeam==4) {
01494       double targetz=TMath::Max(TMath::Abs(bs_pars[3]),TMath::Abs(bs_pars[5]));
01495       weight=zbeam->GetWeight(det,Ibeam,BeamSys::kTargetZ,targetz*nsigma,inu,true_enu)-1;
01496       e+=weight*weight;
01497     }
01498     // le150
01499     else if(Ibeam==9) {
01500       double targetz=TMath::Abs(bs_pars[2]);
01501       weight=zbeam->GetWeight(det,Ibeam,BeamSys::kTargetZ,targetz*nsigma,inu,true_enu)-1;
01502       e+=weight*weight;
01503     }
01504 
01505     return 1+sqrt(e);
01506   }
01507   else return zbeam->GetWeight(det,Ibeam,neffect,nsigma,inu,true_enu);
01508 
01509 }

double SKZPWeightCalculator::GetHadProdError ( int  det,
int  Ibeam,
int  inu,
double  true_enu,
VldContext  vc,
double  nsigma = 1.,
const char *  dir = "" 
) [inline]

Definition at line 333 of file SKZPWeightCalculator.h.

References GetHadProdError(), RunPeriodFromInt(), and RunPeriodIntFromValidity().

00334                                                                              {
00335     return GetHadProdError(det,Ibeam,inu,true_enu,
00336                            RunPeriodFromInt(RunPeriodIntFromValidity(vc)),nsigma,dir);
00337   }

double SKZPWeightCalculator::GetHadProdError ( int  det,
int  Ibeam,
int  inu,
double  true_enu,
RunPeriod_t  rp = kRunI,
double  nsigma = 1.,
const char *  dir = "" 
)

Definition at line 1960 of file SKZPWeightCalculator.cxx.

References hadProdErrorsLoaded, IntFromRunPeriod(), LoadHadProdErrors(), NuE_HadProdError, NuEBar_HadProdError, NuMu_HadProdError, and NuMuBar_HadProdError.

Referenced by GetFluxError(), and GetHadProdError().

01962 {
01963   if(!hadProdErrorsLoaded) LoadHadProdErrors(dir,rp);
01964 
01965   int i = Ibeam-2;
01966   int j = IntFromRunPeriod(rp)-1;
01967   if(IntFromRunPeriod(rp)==11) j=0;  
01968   int k = det-1;
01969 
01970   if(i==3) return 0.; // No low intensity L010z185i in beam fit
01971   // Remove various beam configuration / run period combinations
01972   else if(i==1 && j>0) return 0.;
01973   else if(i==2 && j>1) return 0.;
01974   else if(i==4 && j>0) return 0.;
01975   else if(i==5 && j>0) return 0.;
01976   else if(i==7 && j!=1) return 0.;
01977   else {
01978     switch(inu){
01979     case 14: return nsigma*(NuMu_HadProdError[i][j][k]->GetBinContent(NuMu_HadProdError[i][j][k]->FindBin(true_enu)));
01980     case -14: return nsigma*(NuMuBar_HadProdError[i][j][k]->GetBinContent(NuMuBar_HadProdError[i][j][k]->FindBin(true_enu)));
01981     case 12: return nsigma*(NuE_HadProdError[i][j][k]->GetBinContent(NuE_HadProdError[i][j][k]->FindBin(true_enu)));
01982     case -12: return nsigma*(NuEBar_HadProdError[i][j][k]->GetBinContent(NuEBar_HadProdError[i][j][k]->FindBin(true_enu)));
01983     default: return 0.;
01984     }  
01985   }
01986   
01987   return 0.;
01988 }

double SKZPWeightCalculator::GetHadProdError2012 ( int  det,
int  Ibeam,
int  inu,
double  true_enu,
VldContext  vc,
double  nsigma = 1.,
const char *  dir = "" 
) [inline]

Definition at line 346 of file SKZPWeightCalculator.h.

References GetHadProdError2012(), RunPeriodFromInt(), and RunPeriodIntFromValidity().

00347                                                                              {
00348     return GetHadProdError2012(det,Ibeam,inu,true_enu,
00349                            RunPeriodFromInt(RunPeriodIntFromValidity(vc)),nsigma,dir);
00350   }

double SKZPWeightCalculator::GetHadProdError2012 ( int  det,
int  Ibeam,
int  inu,
double  true_enu,
RunPeriod_t  rp = kRunI,
double  nsigma = 1.,
const char *  dir = "" 
)

Definition at line 1991 of file SKZPWeightCalculator.cxx.

References hadProdErrors2012Loaded, IntFromRunPeriod(), LoadHadProdErrors2012(), NuE_HadProdError2012, NuEBar_HadProdError2012, NuMu_HadProdError2012, and NuMuBar_HadProdError2012.

Referenced by GetFluxError(), and GetHadProdError2012().

01993 {
01994   if(!hadProdErrors2012Loaded) LoadHadProdErrors2012(dir,rp);
01995 
01996   int i = Ibeam-2;
01997   int j = IntFromRunPeriod(rp)-1;
01998   if(IntFromRunPeriod(rp)==11||IntFromRunPeriod(rp)==12||IntFromRunPeriod(rp)==13) j=0;    //IMPORTANT - IF EDITING IN FUTURE WITH MORE MINOS+ RUNS, TAKE CARE TO GET J RIGHT
01999   int k = det-1;
02000 
02001   if(i==3||i==8||i==9) return 0.; // No low intensity L010z185i or medium intensity L010z185 in beam fit
02002   // Remove various beam configuration / run period combinations
02003   else if(i==1 && j>0) return 0.;
02004   else if(i==2 && j>1) return 0.;
02005   else if(i==4 && j>0) return 0.;
02006   else if(i==5 && j>0) return 0.;
02007   else if(i==7 && j!=1) return 0.;
02008   else if(i==10 && j>0) return 0.;  //only one MINOS+ M000z200 run for now
02009   else if(i==11 && j>0) return 0.;  //only one MINOS+ M000z000 run for now
02010   else {
02011     switch(inu){
02012     case 14: return nsigma*(NuMu_HadProdError2012[i][j][k]->GetBinContent(NuMu_HadProdError2012[i][j][k]->FindBin(true_enu)));
02013     case -14: return nsigma*(NuMuBar_HadProdError2012[i][j][k]->GetBinContent(NuMuBar_HadProdError2012[i][j][k]->FindBin(true_enu)));
02014     case 12: return nsigma*(NuE_HadProdError2012[i][j][k]->GetBinContent(NuE_HadProdError2012[i][j][k]->FindBin(true_enu)));
02015     case -12: return nsigma*(NuEBar_HadProdError2012[i][j][k]->GetBinContent(NuEBar_HadProdError2012[i][j][k]->FindBin(true_enu)));
02016     default: return 0.;
02017     }  
02018   }
02019   
02020   return 0.;
02021 }

double SKZPWeightCalculator::GetHeliumWeight ( int  det,
int  Ibeam,
int  Ntype,
double  true_enu 
)

Definition at line 2738 of file SKZPWeightCalculator.cxx.

References GetHeliumWeight_L010z000i_FD_Nue(), GetHeliumWeight_L010z000i_FD_Nuebar(), GetHeliumWeight_L010z000i_FD_Numu(), GetHeliumWeight_L010z000i_FD_Numubar(), GetHeliumWeight_L010z000i_ND_Nue(), GetHeliumWeight_L010z000i_ND_Nuebar(), GetHeliumWeight_L010z000i_ND_Numu(), GetHeliumWeight_L010z000i_ND_Numubar(), GetHeliumWeight_L010z185i_FD_Nue(), GetHeliumWeight_L010z185i_FD_Nuebar(), GetHeliumWeight_L010z185i_FD_Numu(), GetHeliumWeight_L010z185i_FD_Numubar(), GetHeliumWeight_L010z185i_ND_Nue(), GetHeliumWeight_L010z185i_ND_Nuebar(), GetHeliumWeight_L010z185i_ND_Numu(), and GetHeliumWeight_L010z185i_ND_Numubar().

Referenced by GetRunPeriodWeight(), and NuZBeamReweight::GetWeightHelium().

02739 {
02740   if(det==1){ // ND
02741     if(Ibeam==2){ // L010z185i
02742       if(Ntype==56 || Ntype==14) return GetHeliumWeight_L010z185i_ND_Numu(true_enu);
02743       else if(Ntype==55 || Ntype==-14) return GetHeliumWeight_L010z185i_ND_Numubar(true_enu);
02744       else if(Ntype==53 || Ntype==12) return GetHeliumWeight_L010z185i_ND_Nue(true_enu);
02745       else if(Ntype==52 || Ntype==-12) return GetHeliumWeight_L010z185i_ND_Nuebar(true_enu);
02746       else return 1.0;
02747     }
02748     else if(Ibeam==8){ // L010z000i
02749       if(Ntype==56 || Ntype==14) return GetHeliumWeight_L010z000i_ND_Numu(true_enu);
02750       else if(Ntype==55 || Ntype==-14) return GetHeliumWeight_L010z000i_ND_Numubar(true_enu);
02751       else if(Ntype==53 || Ntype==12) return GetHeliumWeight_L010z000i_ND_Nue(true_enu);
02752       else if(Ntype==52 || Ntype==-12) return GetHeliumWeight_L010z000i_ND_Nuebar(true_enu);
02753       else return 1.0;
02754     }
02755     else return 1.0;
02756   }
02757   else if(det==2){ // FD
02758     if(Ibeam==2){ // L010z185i
02759       if(Ntype==56 || Ntype==14) return GetHeliumWeight_L010z185i_FD_Numu(true_enu);
02760       else if(Ntype==55 || Ntype==-14) return GetHeliumWeight_L010z185i_FD_Numubar(true_enu);
02761       else if(Ntype==53 || Ntype==12) return GetHeliumWeight_L010z185i_FD_Nue(true_enu);
02762       else if(Ntype==52 || Ntype==-12) return GetHeliumWeight_L010z185i_FD_Nuebar(true_enu);
02763       else return 1.0;
02764     }
02765     else if(Ibeam==8){ // L010z000i
02766       if(Ntype==56 || Ntype==14) return GetHeliumWeight_L010z000i_FD_Numu(true_enu);
02767       else if(Ntype==55 || Ntype==-14) return GetHeliumWeight_L010z000i_FD_Numubar(true_enu);
02768       else if(Ntype==53 || Ntype==12) return GetHeliumWeight_L010z000i_FD_Nue(true_enu);
02769       else if(Ntype==52 || Ntype==-12) return GetHeliumWeight_L010z000i_FD_Nuebar(true_enu);
02770       else return 1.0;
02771     }
02772     else return 1.0;
02773   }
02774   else return 1.0;
02775 }

double SKZPWeightCalculator::GetHeliumWeight_L010z000i_FD_Nue ( double  enu  )  [private]

Definition at line 3040 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

03041 {
03042   double weight = 1.;
03043   double par[7] = {
03044     1.02653,-0.00287051,0.000666625,-4.19876e-05,7.69875e-07,0.99805,10
03045   };
03046   if(enu<20.0){
03047     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
03048   }
03049   else{
03050     weight = par[5]+(par[6]/(enu*enu));
03051   }
03052   return weight;
03053 }

double SKZPWeightCalculator::GetHeliumWeight_L010z000i_FD_Nuebar ( double  enu  )  [private]

Definition at line 3055 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

03056 {
03057   double weight = 1.;
03058   double par[7] = {
03059     1.02206,0.00932646,-0.00100526,2.37525e-05,-4.71822e-08,1.2,-180
03060   };
03061   if(enu<33.45){
03062     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
03063   }
03064   else{
03065     weight = par[5]+(par[6]/(enu*enu));
03066   }
03067   return weight;
03068 }

double SKZPWeightCalculator::GetHeliumWeight_L010z000i_FD_Numu ( double  enu  )  [private]

Definition at line 3002 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

03003 {
03004   double weight = 1.;
03005   double par[10] = {
03006     1.04313,-0.00624758,0.000104616,0.00872899,1.12567,
03007     -0.0171559,0.000639488,-6.72704e-06,1.0197,1500
03008   };
03009   if(enu<10.0){
03010     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*TMath::Log(enu);
03011   }
03012   else if(enu<46.0){
03013     weight = par[4]+par[5]*enu+par[6]*enu*enu+par[7]*enu*enu*enu;
03014   }
03015   else{
03016     weight = par[8]+(par[9]/(enu*enu*enu));
03017   }
03018   return weight;
03019 }

double SKZPWeightCalculator::GetHeliumWeight_L010z000i_FD_Numubar ( double  enu  )  [private]

Definition at line 3021 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

03022 {
03023   double weight = 1.;
03024   double par[11] = {
03025     1.0378,-0.000996055,-0.000280837,0.00197533,1.25837,-0.0519768,
03026     0.00349608,-9.25331e-05,8.19759e-07,1,-1.5e+07
03027   };
03028   if(enu<9.5){
03029     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*TMath::Log(enu);
03030   }
03031   else if(enu<49.3){
03032     weight = par[4]+par[5]*enu+par[6]*enu*enu+par[7]*enu*enu*enu+par[8]*enu*enu*enu*enu;
03033   }
03034   else{
03035     weight = par[9]+(par[10]/(enu*enu*enu*enu*enu));
03036   }
03037   return weight;
03038 }

double SKZPWeightCalculator::GetHeliumWeight_L010z000i_ND_Nue ( double  enu  )  [private]

Definition at line 2972 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02973 {
02974   double weight = 1.;
02975   double par[7] = {
02976     1.02614,0.0135056,-0.00151707,5.53927e-05,-6.55825e-07,0.978,1.
02977   };
02978   if(enu<20.45){
02979     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
02980   }
02981   else{
02982     weight = par[5]+(par[6]/(enu));
02983   }
02984   return weight;
02985 }

double SKZPWeightCalculator::GetHeliumWeight_L010z000i_ND_Nuebar ( double  enu  )  [private]

Definition at line 2987 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02988 {
02989   double weight = 1.;
02990   double par[7] = {
02991     1.02609,0.0255862,-0.00296928,9.18715e-05,-7.22365e-07,1.101,-2500
02992   };
02993   if(enu<28.0){
02994     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
02995   }
02996   else{
02997     weight = par[5]+(par[6]/(enu*enu*enu));
02998   }
02999   return weight;
03000 }

double SKZPWeightCalculator::GetHeliumWeight_L010z000i_ND_Numu ( double  enu  )  [private]

Definition at line 2931 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02932 {
02933   double weight = 1.;
02934   double par[10] = {
02935     1.08341,-0.00598166,-0.000644125,0.0153799,1.16251,
02936     -0.0259465,0.00130708,-1.8318e-05,1.03,1500
02937   };
02938   if(enu<7.4){
02939     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*TMath::Log(enu);
02940   }
02941   else if(enu<38.4){
02942     weight = par[4]+par[5]*enu+par[6]*enu*enu+par[7]*enu*enu*enu;
02943   }
02944   else{
02945     weight = par[8]+(par[9]/(enu*enu*enu));
02946   }
02947   return weight;
02948 }

double SKZPWeightCalculator::GetHeliumWeight_L010z000i_ND_Numubar ( double  enu  )  [private]

Definition at line 2950 of file SKZPWeightCalculator.cxx.

References MuELoss::e.

Referenced by GetHeliumWeight().

02951 {
02952   double weight = 1.;
02953   double par[15] = {
02954     1.06489,0.0137669,-0.00415539,0.000218168,0.923382,0.0108634,-0.000376271,
02955     3.86015e-06,0.8,0.01,-0.0005,1e-06,1.03,0.00883329,0.000347229
02956   };
02957   if(enu<11.0){
02958     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu;
02959   }
02960   else if(enu<21.4){
02961     weight = par[4]+par[5]*enu+par[6]*enu*enu+par[7]*enu*enu*enu+0.0014;
02962   }
02963   else if(enu<37.){
02964     weight = par[8]+par[9]*enu+par[10]*(enu-20.)*(enu-20.)+par[11]*(enu-20.)*(enu-20.)*(enu-20.)+0.0097;
02965   }
02966   else{
02967     weight = par[12]-par[13]*(enu-37.)+par[14]*(enu-37.)*(enu-37.)+0.0097;
02968   }
02969   return weight;
02970 }

double SKZPWeightCalculator::GetHeliumWeight_L010z185i_FD_Nue ( double  enu  )  [private]

Definition at line 2901 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02902 {
02903   double weight = 1.;
02904   double par[8] = {
02905     1.00099,0.022962,-0.0106913,0.00153978,-6.74999e-05,1.021,-0.0018,1.5e-05
02906   };
02907   if(enu<11.0){
02908     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
02909   }
02910   else{
02911     weight = par[5]+(par[6]*(enu-11.))+(par[7]*(enu-11.)*(enu-11.));
02912   }
02913   return weight;
02914 }

double SKZPWeightCalculator::GetHeliumWeight_L010z185i_FD_Nuebar ( double  enu  )  [private]

Definition at line 2916 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02917 {
02918   double weight = 1.;
02919   double par[7] = {
02920     1.02439,-0.000679498,0.000218119,-6.49776e-06,4.58303e-08,0.997,3300
02921   };
02922   if(enu<43.1){
02923     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
02924   }
02925   else{
02926     weight = par[5]+(par[6]/(enu*enu*enu));
02927   }
02928   return weight;
02929 }

double SKZPWeightCalculator::GetHeliumWeight_L010z185i_FD_Numu ( double  enu  )  [private]

Definition at line 2860 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02861 {
02862   double weight = 1.;
02863   double par[14] = {
02864     1.04327,-0.0352661,0.0047907,0.00388763,0.88061,0.0321005,-0.00164144,
02865     -4.5869e-05,1.05352,-0.00869623,0.000390208,-4.45885e-06,0.997,5000
02866   };
02867   if(enu<4.4){
02868     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*TMath::Log(enu);
02869   }
02870   else if(enu<8.9){
02871     weight = par[4]+par[5]*enu+par[6]*enu*enu+par[7]*enu*enu*enu;
02872   }
02873   else if(enu<48.0){
02874     weight = par[8]+par[9]*enu+par[10]*enu*enu+par[11]*enu*enu*enu;
02875   }
02876   else{
02877     weight = par[12]+(par[13]/(enu*enu*enu));
02878   }
02879   return weight;
02880 }

double SKZPWeightCalculator::GetHeliumWeight_L010z185i_FD_Numubar ( double  enu  )  [private]

Definition at line 2882 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02883 {
02884   double weight = 1.;
02885   double par[10] = {
02886     1.04689,0.00226136,-0.000790701,2.61669e-05,-0.0744887,
02887     0.0847917,-0.00190558,1.21492e-05,0.99,4000
02888   };
02889   if(enu<21.9){
02890     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu;
02891   }
02892   else if(enu<38.0){
02893     weight = par[4]+par[5]*enu+par[6]*enu*enu+par[7]*enu*enu*enu;
02894   }
02895   else{
02896     weight = par[8]+(par[9]/(enu*enu*enu));
02897   }
02898   return weight;
02899 }

double SKZPWeightCalculator::GetHeliumWeight_L010z185i_ND_Nue ( double  enu  )  [private]

Definition at line 2825 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02826 {
02827   double weight = 1.;
02828   double par[11] = {
02829     0.97709,0.0939192,-0.0536218,0.00805987,1.03,-0.0163451,0.00263497,
02830     -0.000118506,1.57655e-06,0.998,600
02831   };
02832   if(enu<2.43){
02833     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu;
02834   }
02835   else if(enu<23.0){
02836     weight = par[4]+par[5]*enu+par[6]*enu*enu+par[7]*enu*enu*enu+par[8]*enu*enu*enu*enu;
02837   }
02838   else{
02839     weight = par[9]+(par[10]/(enu*enu*enu));
02840   }
02841   return weight;
02842 
02843 }

double SKZPWeightCalculator::GetHeliumWeight_L010z185i_ND_Nuebar ( double  enu  )  [private]

Definition at line 2845 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02846 {
02847   double weight = 1.;
02848   double par[7] = {
02849     1.02113,0.0140663,-0.000791038,1.37577e-05,-7.48181e-08,0.9995,1150
02850   };
02851   if(enu<30.0){
02852     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
02853   }
02854   else{
02855     weight = par[5]+(par[6]/(enu*enu*enu));
02856   }
02857   return weight;
02858 }

double SKZPWeightCalculator::GetHeliumWeight_L010z185i_ND_Numu ( double  enu  )  [private]

Definition at line 2777 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02778 {
02779   double weight = 1.;
02780   double par[19] = {
02781     1.10472,-0.0861419,0.0116673,0.0193203,0.230526,0.323048,-0.0434165,0.00189932,1.1483,
02782     -0.0322421,0.00224179,-4.51111e-05,0.818716,0.0177147,-0.000366594,2.1493e-06,1.20406,
02783     -0.00411679,2.18602e-05
02784   };
02785   if(enu<5.15){
02786     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*TMath::Log(enu);
02787   }
02788   else if(enu<7.25){
02789     weight = par[4]+par[5]*enu+par[6]*enu*enu+par[7]*enu*enu*enu;
02790   }
02791   else if(enu<18.0){
02792     weight = par[8]+par[9]*enu+par[10]*enu*enu+par[11]*enu*enu*enu;
02793   }
02794   else if(enu<53.5){
02795     weight = par[12]+par[13]*enu+par[14]*enu*enu+par[15]*enu*enu*enu;
02796   }
02797   else{
02798     weight = par[16]+par[17]*enu+par[18]*enu*enu;
02799   }
02800   return weight;
02801 }

double SKZPWeightCalculator::GetHeliumWeight_L010z185i_ND_Numubar ( double  enu  )  [private]

Definition at line 2803 of file SKZPWeightCalculator.cxx.

References MuELoss::e.

Referenced by GetHeliumWeight().

02804 {
02805   double weight = 1.;
02806   double par[15] = {
02807     1.06239,0.0342807,-0.00879299,0.000479629,-0.346922,0.267095,-0.016762,0.00033883,
02808     0.8,0.01,-0.0005,1e-06,1.03,0.0042195,0.000108851
02809   };
02810   if(enu<11.0){
02811     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu;
02812   }
02813   else if(enu<21.4){
02814     weight = par[4]+par[5]*enu+par[6]*enu*enu+par[7]*enu*enu*enu;
02815   }
02816   else if(enu<37.){
02817     weight = par[8]+par[9]*enu+par[10]*(enu-20.)*(enu-20.)+par[11]*(enu-20.)*(enu-20.)*(enu-20.);
02818   }
02819   else{
02820     weight = par[12]-par[13]*(enu-37.)+par[14]*(enu-37.)*(enu-37.);
02821   }
02822   return weight;
02823 }

double SKZPWeightCalculator::GetHGweight ( int  det,
int  Ibeam,
double  true_enu,
int  inu,
const char *  dir = "" 
)

Definition at line 3609 of file SKZPWeightCalculator.cxx.

References AntiNu_FD_HGW_M02V1, AntiNu_ND_HGW_M02V1, HGweightsLoaded, LoadHGweights(), Nu_FD_HGW_M02V1, and Nu_ND_HGW_M02V1.

Referenced by GetBeamWeight().

03610 {
03611 
03612   if(!HGweightsLoaded) LoadHGweights(dir);
03613 
03614   double weight=1.0;
03615 
03616   int i=Ibeam-2;
03617 
03618 
03619   if(i!=10&&i!=11) weight*=1.0;
03620   if(det!=1&&det!=2) weight*=1.0;
03621   if(inu!=14&&inu!=12&&inu!=-14&&inu!=-12) weight*=1.0;
03622 
03623 
03624   if(i==10||i==11){
03625 
03626     if(true_enu>=90.0) weight*=1.0;
03627     else if(true_enu<90.0) { //going up to 90 GeV seems strange
03628       if(det==1){    //Near Detector
03629         if(inu==14||inu==12){
03630           if(i==10) weight=Nu_ND_HGW_M02V1->GetBinContent(Nu_ND_HGW_M02V1->FindBin(true_enu));    //M000z200
03631         }
03632         if(inu==-14||inu==-12){
03633           if(i==10) weight=AntiNu_ND_HGW_M02V1->GetBinContent(AntiNu_ND_HGW_M02V1->FindBin(true_enu));    //M000z200
03634         }
03635       }
03636       if(det==2){    //Far Detector
03637         if(inu==14||inu==12){
03638           if(i==10) weight=Nu_FD_HGW_M02V1->GetBinContent(Nu_FD_HGW_M02V1->FindBin(true_enu));    //M000z200
03639         }
03640         if(inu==-14||inu==-12){
03641           if(i==10) weight=AntiNu_FD_HGW_M02V1->GetBinContent(AntiNu_FD_HGW_M02V1->FindBin(true_enu));    //M000z200
03642         }
03643       }
03644     }
03645   }
03646 
03647 
03648   return weight;
03649 
03650 }

TFile * SKZPWeightCalculator::GetHGweightsFile ( const char *  dir = ""  )  [private]

Definition at line 2296 of file SKZPWeightCalculator.cxx.

References base, Form(), fTopDir, gSystem(), Msg::kDebug, Msg::kFatal, Msg::kInfo, and MSG.

Referenced by LoadHGweights().

02297 {
02298   // fTopDir is where the APS_weights2014.root file is located.
02299   fTopDir=dir; // user may set location of input data
02300   if(fTopDir=="") { // by default, this code looks in a standard place
02301     fTopDir="MCReweight/data";
02302     std::string base="";
02303     base=getenv("SRT_PRIVATE_CONTEXT");
02304     if (base!="" && base!=".")
02305       {
02306         // check if directory exists in SRT_PRIVATE_CONTEXT
02307         std::string path = base + "/" + fTopDir;
02308         void *dir_ptr = gSystem->OpenDirectory(path.c_str());
02309         if(!dir_ptr) base=getenv("SRT_PUBLIC_CONTEXT"); // if it doesn't exist then use SRT_PUBLIC_CONTEXT
02310       }
02311     else base=getenv("SRT_PUBLIC_CONTEXT");
02312 
02313     if(base=="") {
02314       MSG("SKZPWeightCalculator",Msg::kFatal)<<"No SRT_PUBLIC_CONTEXT set."<<std::endl;
02315       assert(false);
02316     }
02317     fTopDir = base+ "/" + fTopDir;
02318   }
02319   MSG("SKZPWeightCalculator",Msg::kDebug) << "Zbeam getting HG_weights2018.root hists from: "
02320                                           << fTopDir << " directory." << endl;
02321 
02322   TFile* f = new TFile(Form("%s/HG_weights2018.root",fTopDir.c_str()));
02323   if(f->IsZombie()) {
02324     MSG("SKZPWeightCalculator",Msg::kFatal)<<"Can't load HG Weights 2018 file. "
02325                                             << endl;
02326     return 0;
02327   }
02328 
02329     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Got HG Weights 2018 file. "
02330                                             << endl;
02331   return f;
02332 
02333 }

double SKZPWeightCalculator::GetMaterialError ( int  det,
int  Ibeam,
int  inu,
double  true_enu,
VldContext  vc,
double  nsigma = 1.,
const char *  dir = "" 
) [inline]

Definition at line 370 of file SKZPWeightCalculator.h.

References GetMaterialError(), RunPeriodFromInt(), and RunPeriodIntFromValidity().

00371                                                                               {
00372     return GetMaterialError(det,Ibeam,inu,true_enu,
00373                             RunPeriodFromInt(RunPeriodIntFromValidity(vc)),nsigma,dir);
00374   }

double SKZPWeightCalculator::GetMaterialError ( int  det,
int  Ibeam,
int  inu,
double  true_enu,
RunPeriod_t  rp = kRunI,
double  nsigma = 1.,
const char *  dir = "" 
)

Definition at line 2092 of file SKZPWeightCalculator.cxx.

References IntFromRunPeriod(), LoadMaterialErrors(), materialErrorsLoaded, NuE_MaterialError, NuEBar_MaterialError, NuMu_MaterialError, and NuMuBar_MaterialError.

Referenced by GetFluxError(), and GetMaterialError().

02094 {
02095   if(!materialErrorsLoaded) LoadMaterialErrors(dir,rp);
02096 
02097   int i = Ibeam-2;
02098   int j = IntFromRunPeriod(rp)-1;
02099   if(IntFromRunPeriod(rp)==11||IntFromRunPeriod(rp)==12||IntFromRunPeriod(rp)==13) j=0;
02100   int k = det-1;
02101 
02102   if(i==1 || i==3 || i==4 || i==5 || i==7 || i==8 || i==9) return 0.;
02103   else if(i==2 && j==2) return 0.;
02104   else if(i==10 && j>0) return 0.;  //only one MINOS+ M000z200 run for now
02105   else if(i==11 && j>0) return 0.;  //only one MINOS+ M000z000 run for now
02106   else {
02107     switch(inu){
02108     case 14: return nsigma*(NuMu_MaterialError[i][j][k]->GetBinContent(NuMu_MaterialError[i][j][k]->FindBin(true_enu)));
02109     case -14: return nsigma*(NuMuBar_MaterialError[i][j][k]->GetBinContent(NuMuBar_MaterialError[i][j][k]->FindBin(true_enu)));
02110     case 12: return nsigma*(NuE_MaterialError[i][j][k]->GetBinContent(NuE_MaterialError[i][j][k]->FindBin(true_enu)));
02111     case -12: return nsigma*(NuEBar_MaterialError[i][j][k]->GetBinContent(NuEBar_MaterialError[i][j][k]->FindBin(true_enu)));
02112     default: return 0.;
02113     }  
02114   }
02115 
02116   return 0.;
02117 }

double SKZPWeightCalculator::GetMissingFin78Weight_L010z000i_FD_Nue ( double  enu  )  [private]

Definition at line 3482 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03483 {
03484   double y;
03485 
03486   double par[8];
03487 
03488   par[0] = 1.05046;
03489   par[1] = -0.0197051;
03490   par[2] = -0.000709986;
03491   par[3] = 0.000580179;
03492   par[4] = -0.0000443486;
03493   par[5] = 0.000000962613;
03494   par[6] = 0.92;
03495   par[7] = 0.6;
03496 
03497   if(enu<19.5){
03498     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu+par[5]*enu*enu*enu*enu*enu;
03499   }
03500   else {
03501     y = par[6]+par[7]*(1./(enu-12.));
03502   }
03503 
03504   return y;
03505 }

double SKZPWeightCalculator::GetMissingFin78Weight_L010z000i_FD_Nuebar ( double  enu  )  [private]

Definition at line 3507 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03508 {
03509   double y;
03510 
03511   double par[8];
03512 
03513   par[0] = 1.03867;
03514   par[1] = 0.0130506;
03515   par[2] = -0.00751797;
03516   par[3] = 0.00109883;
03517   par[4] = -0.0000639034;
03518   par[5] = 0.00000130481;
03519   par[6] = 1.04;
03520   par[7] = -0.2;
03521 
03522   if(enu<18.9){
03523     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu+par[5]*enu*enu*enu*enu*enu;
03524   }
03525   else {
03526     y = par[6]+par[7]*(1./(enu-12.));
03527   }
03528 
03529   return y;
03530 }

double SKZPWeightCalculator::GetMissingFin78Weight_L010z000i_FD_Numu ( double  enu  )  [private]

Definition at line 3274 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03275 {
03276   double y;
03277 
03278   double par[7];
03279 
03280   par[0] = 0.991629;
03281   par[1] = 0.0150514;
03282   par[2] = -0.00358913;
03283   par[3] = 0.000384422;
03284   par[4] = -0.0000136394;
03285   par[5] = 1.008;
03286   par[6] = 0.35;
03287 
03288   if(enu<13.38){
03289     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
03290   }
03291   else {
03292     y = par[5]+par[6]*(1./enu);
03293   }
03294 
03295   return y;
03296 }

double SKZPWeightCalculator::GetMissingFin78Weight_L010z000i_FD_Numubar ( double  enu  )  [private]

Definition at line 3298 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03299 {
03300   double y;
03301 
03302   double par[7];
03303 
03304   par[0] = 0.991063;
03305   par[1] = 0.0114890;
03306   par[2] = -0.00123288;
03307   par[3] = 0.0000558658;
03308   par[4] = -0.000000834802;
03309   par[5] = 1.056;
03310   par[6] = -0.35;
03311 
03312   if(enu<17.925){
03313     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
03314   }
03315   else {
03316     y = par[5]+par[6]*(1./enu);
03317   }
03318 
03319   return y;
03320 }

double SKZPWeightCalculator::GetMissingFin78Weight_L010z000i_ND_Nue ( double  enu  )  [private]

Definition at line 3381 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03382 {
03383   double y;
03384 
03385   double par[8];
03386 
03387   par[0] = 1.09927;
03388   par[1] = -0.0580560;
03389   par[2] = 0.00847919;
03390   par[3] = -0.000341542;
03391   par[4] = -0.00000545052;
03392   par[5] = 0.000000394652;
03393   par[6] = 1.15;
03394   par[7] = -1.0;
03395 
03396   if(enu<20.8){
03397     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu+par[5]*enu*enu*enu*enu*enu;
03398   }
03399   else {
03400     y = par[6]+par[7]*(1./(enu-14.));
03401   }
03402 
03403   return y;
03404 }

double SKZPWeightCalculator::GetMissingFin78Weight_L010z000i_ND_Nuebar ( double  enu  )  [private]

Definition at line 3406 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03407 {
03408   double y;
03409 
03410   double par[8];
03411 
03412   par[0] = 0.960938;
03413   par[1] = 0.169592;
03414   par[2] = -0.0611788;
03415   par[3] = 0.00782170;
03416   par[4] = -0.000416337;
03417   par[5] = 0.00000785160;
03418   par[6] = 1.12;
03419   par[7] = -1.0;
03420 
03421   if(enu<19.775){
03422     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu+par[5]*enu*enu*enu*enu*enu;
03423   }
03424   else {
03425     y = par[6]+par[7]*(1./(enu-13.8));
03426   }
03427 
03428   return y;
03429 }

double SKZPWeightCalculator::GetMissingFin78Weight_L010z000i_ND_Numu ( double  enu  )  [private]

Definition at line 3149 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03150 {
03151   double y;
03152 
03153   double par[7];
03154 
03155   par[0] = 1.01052;
03156   par[1] = 0.00135492;
03157   par[2] = 0.000352042;
03158   par[3] = -0.0000281668;
03159   par[4] = 0.000000465827;
03160   par[5] = 1.018;
03161   par[6] = 0.3;
03162 
03163   if(enu<17.2){
03164     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
03165   }
03166   else {
03167     y = par[5]+par[6]*(1./enu);
03168   }
03169 
03170   return y;
03171 }

double SKZPWeightCalculator::GetMissingFin78Weight_L010z000i_ND_Numubar ( double  enu  )  [private]

Definition at line 3173 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03174 {
03175   double y;
03176 
03177   double par[7];
03178 
03179   par[0] = 1.00806;
03180   par[1] = 0.00509031;
03181   par[2] = -0.000422559;
03182   par[3] = 0.0000180352;
03183   par[4] = -0.000000272726;
03184   par[5] = 1.018;
03185   par[6] = 0.85;
03186 
03187   if(enu<30.5){
03188     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
03189   }
03190   else {
03191     y = par[5]+par[6]*(1./enu);
03192   }
03193 
03194   return y;
03195 }

double SKZPWeightCalculator::GetMissingFin78Weight_L010z185i_FD_Nue ( double  enu  )  [private]

Definition at line 3431 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03432 {
03433   double y;
03434 
03435   double par[8];
03436 
03437   par[0] = 0.976334;
03438   par[1] = 0.0146822;
03439   par[2] = -0.00805149;
03440   par[3] = 0.00132456;
03441   par[4] = -0.0000810696;
03442   par[5] = 0.00000166323;
03443   par[6] = 1.0851;
03444   par[7] = -1.0;
03445 
03446   if(enu<19.45){
03447     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu+par[5]*enu*enu*enu*enu*enu;
03448   }
03449   else{
03450     y = par[6]+par[7]*(1./(enu-9.));
03451   }
03452 
03453   return y;
03454 }

double SKZPWeightCalculator::GetMissingFin78Weight_L010z185i_FD_Nuebar ( double  enu  )  [private]

Definition at line 3456 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03457 {
03458   double y;
03459 
03460   double par[9];
03461 
03462   par[0] = 0.912223;
03463   par[1] = 0.106252;
03464   par[2] = -0.0341165;
03465   par[3] = 0.00490576;
03466   par[4] = -0.000344942;
03467   par[5] = 0.0000114327;
03468   par[6] = -0.000000142208;
03469   par[7] = 0.9;
03470   par[8] = 1.0;
03471 
03472   if(enu<27.55){
03473     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu+par[5]*enu*enu*enu*enu*enu+par[6]*enu*enu*enu*enu*enu*enu;
03474   }
03475   else {
03476     y = par[7]+par[8]*(1./(enu-22.));
03477   }
03478 
03479   return y;
03480 }

double SKZPWeightCalculator::GetMissingFin78Weight_L010z185i_FD_Numu ( double  enu  )  [private]

Definition at line 3197 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03198 {
03199   double y;
03200 
03201   double par[20];
03202 
03203   par[0] =   9.79176e-01;
03204   par[1] =   5.94877e-02;
03205   par[2] =  -6.33591e-02;
03206   par[3] =   1.24537e-02;
03207   par[4] =   6.85855e-03;
03208   par[5] =  -2.08938e-03;
03209   par[6] =   2.56824e+00;
03210   par[7] =  -5.16706e-01;
03211   par[8] =   5.21584e-02;
03212   par[9] =  -1.52990e+00;
03213   par[10] =   7.10491e-01;
03214   par[11] =   7.95342e-02;
03215   par[12] =  -5.11905e-03;
03216   par[13] =  -4.11699e+00;
03217   par[14] =  -1.27508e-01;
03218   par[15] =   1.08948e-03;
03219   par[16] =   2.22361e+00;
03220   par[17] =   1.17195e+01;
03221   par[18] = 1.018;
03222   par[19] = 0.005;
03223 
03224   if(enu<2.83){
03225     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu+par[5]*enu*enu*enu*enu*enu;
03226   }
03227   else if(enu<4.925){
03228     y = par[6]+par[7]*enu+par[8]*enu*enu+par[9]*(1./enu);
03229   }
03230   else if(enu<9.0){
03231     y = par[10]+par[11]*enu+par[12]*enu*enu;
03232   }
03233   else if(enu<17.6){
03234     y = par[13]+par[14]*enu+par[15]*enu*enu+par[16]*TMath::Log(enu)+par[17]*(1./enu);
03235   }
03236   else{
03237     y = par[18]+par[19]*(1./(enu-13.8));
03238   }
03239 
03240   return y;
03241 }

double SKZPWeightCalculator::GetMissingFin78Weight_L010z185i_FD_Numubar ( double  enu  )  [private]

Definition at line 3243 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03244 {
03245   double y;
03246 
03247   double par[11];
03248 
03249   par[0] = 0.992562;
03250   par[1] = 0.0301506;
03251   par[2] = -0.0129656;
03252   par[3] = 0.00215436;
03253   par[4] = -0.000115552;
03254   par[5] = 0.958894;
03255   par[6] = 0.00228454;
03256   par[7] = -0.0000164352;
03257   par[8] = 0.468619;
03258   par[9] = 1.04;
03259   par[10] = -0.2;
03260 
03261   if(enu<8.35){
03262     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
03263   }
03264   else if(enu<38.75){
03265     y = par[5]+par[6]*enu+par[7]*enu*enu+par[8]*(1./enu);
03266   }
03267   else {
03268     y = par[9]+par[10]*(1./enu);
03269   }
03270 
03271   return y;
03272 }

double SKZPWeightCalculator::GetMissingFin78Weight_L010z185i_ND_Nue ( double  enu  )  [private]

Definition at line 3324 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03325 {
03326   double y;
03327 
03328   double par[12];
03329 
03330   par[0] = 0.964536;
03331   par[1] = 0.0341348;
03332   par[2] = -0.0167779;
03333   par[3] = 0.00275733;
03334   par[4] = -0.000173092;
03335   par[5] = 0.00000364374;
03336   par[6] = 65.6200;
03337   par[7] = 1.55324;
03338   par[8] = -0.0132149;
03339   par[9] = -27.7156;
03340   par[10] = -147.925;
03341   par[11] = 1.11675;
03342 
03343   if(enu<15.70){
03344     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu+par[5]*enu*enu*enu*enu*enu;
03345   }
03346   else if(enu<29.8){
03347     y = -0.012+par[6]+par[7]*enu+par[8]*enu*enu+par[9]*TMath::Log(enu)+par[10]*(1./enu);
03348   }
03349   else{
03350     y = par[11];
03351   }
03352 
03353   return y;
03354 }

double SKZPWeightCalculator::GetMissingFin78Weight_L010z185i_ND_Nuebar ( double  enu  )  [private]

Definition at line 3356 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03357 {
03358   double y;
03359 
03360   double par[8];
03361 
03362   par[0] = 1.01535;
03363   par[1] = -0.0167946;
03364   par[2] = 0.00921187;
03365   par[3] = -0.00133391;
03366   par[4] = 0.0000684085;
03367   par[5] = -0.00000113447;
03368   par[6] = 0.9;
03369   par[7] = 1.0;
03370 
03371   if(enu<26.95){
03372     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu+par[5]*enu*enu*enu*enu*enu;
03373   }
03374   else {
03375     y = par[6]+par[7]*(1./(enu-22.));
03376   }
03377 
03378   return y;
03379 }

double SKZPWeightCalculator::GetMissingFin78Weight_L010z185i_ND_Numu ( double  enu  )  [private]

Definition at line 3072 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03073 {
03074   double y;
03075 
03076   double par[20];
03077 
03078   par[0] =  9.91823e-01;
03079   par[1] =  8.14956e-02;
03080   par[2] = -1.44191e-01;
03081   par[3] =  7.80651e-02;
03082   par[4] = -1.29277e-02;
03083   par[5] = -1.41734e-04;
03084   par[6] =  3.62036e+00;
03085   par[7] = -8.98865e-01;
03086   par[8] =  9.61367e-02;
03087   par[9] = -2.44885e+00;
03088   par[10] =  6.81085e-01;
03089   par[11] =  9.40087e-02;
03090   par[12] = -6.50227e-03;
03091   par[13] = -2.86720e+00;
03092   par[14] = -1.14010e-01;
03093   par[15] =  1.06866e-03;
03094   par[16] =  1.77433e+00;
03095   par[17] =  8.30457e+00;
03096   par[18] =  1.018;
03097   par[19] =  0.005;
03098 
03099   if(enu<2.875){
03100     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu+par[5]*enu*enu*enu*enu*enu;
03101   }
03102   else if(enu<4.375){
03103     y = par[6]+par[7]*enu+par[8]*enu*enu+par[9]*(1./enu);
03104   }
03105   else if(enu<7.460){
03106     y = par[10]+par[11]*enu+par[12]*enu*enu;
03107   }
03108   else if(enu<15.15){
03109     y = par[13]+par[14]*enu+par[15]*enu*enu+par[16]*TMath::Log(enu)+par[17]*(1./enu);
03110   }
03111   else{
03112     y = par[18]+par[19]*(1./(enu-13.8));
03113   }
03114 
03115   return y;
03116 }

double SKZPWeightCalculator::GetMissingFin78Weight_L010z185i_ND_Numubar ( double  enu  )  [private]

Definition at line 3118 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03119 {
03120   double y;
03121 
03122   double par[11];
03123 
03124   par[0] = 1.01079;
03125   par[1] = 0.0163014;
03126   par[2] = -0.00951575;
03127   par[3] = 0.00189497;
03128   par[4] = -0.000114420;
03129   par[5] = 0.745891;
03130   par[6] = 0.0198691;
03131   par[7] = -0.000440386;
03132   par[8] = 1.22518;
03133   par[9] = 1.04;
03134   par[10] = -0.2;
03135 
03136   if(enu<8.6){
03137     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
03138   }
03139   else if(enu<15.5){
03140     y = par[5]+par[6]*enu+par[7]*enu*enu+par[8]*(1./enu);
03141   }
03142   else {
03143     y = par[9]+par[10]*(1./enu);
03144   }
03145 
03146   return y;
03147 }

double SKZPWeightCalculator::GetOpticsError ( int  det,
int  Ibeam,
int  inu,
double  true_enu,
VldContext  vc,
double  nsigma = 1.,
const char *  dir = "" 
) [inline]

Definition at line 354 of file SKZPWeightCalculator.h.

References GetOpticsError(), RunPeriodFromInt(), and RunPeriodIntFromValidity().

00355                                                                             {
00356     return GetOpticsError(det,Ibeam,inu,true_enu,
00357                           RunPeriodFromInt(RunPeriodIntFromValidity(vc)),nsigma,dir);
00358   }

double SKZPWeightCalculator::GetOpticsError ( int  det,
int  Ibeam,
int  inu,
double  true_enu,
RunPeriod_t  rp = kRunI,
double  nsigma = 1.,
const char *  dir = "" 
)

Definition at line 2024 of file SKZPWeightCalculator.cxx.

References IntFromRunPeriod(), LoadOpticsErrors(), NuE_OpticsError, NuEBar_OpticsError, NuMu_OpticsError, NuMuBar_OpticsError, and opticsErrorsLoaded.

Referenced by GetFluxError(), and GetOpticsError().

02026 {
02027   if(!opticsErrorsLoaded) LoadOpticsErrors(dir,rp);
02028 
02029   int i = Ibeam-2;
02030   int j = IntFromRunPeriod(rp)-1;
02031   if(IntFromRunPeriod(rp)==11||IntFromRunPeriod(rp)==12||IntFromRunPeriod(rp)==13) j=0;
02032   int k = det-1;
02033 
02034 
02035   if(i==3||i==8||i==9) return 0.; // No low intensity L010z185i in beam fit
02036   // Remove various beam configuration / run period combinations
02037   else if(i==1 && j>0) return 0.;
02038   else if(i==2 && j>1) return 0.;
02039   else if(i==4 && j>0) return 0.;
02040   else if(i==5 && j>0) return 0.;
02041   else if(i==7 && j!=1) return 0.;
02042   else if(i==10 && j>0) return 0.;  //only one MINOS+ M000z200 run for now
02043   else if(i==11 && j>0) return 0.;  //only one MINOS+ M000z000 run for now
02044   else {
02045     switch(inu){
02046     case 14: return nsigma*(NuMu_OpticsError[i][j][k]->GetBinContent(NuMu_OpticsError[i][j][k]->FindBin(true_enu)));
02047     case -14: return nsigma*(NuMuBar_OpticsError[i][j][k]->GetBinContent(NuMuBar_OpticsError[i][j][k]->FindBin(true_enu)));
02048     case 12: return nsigma*(NuE_OpticsError[i][j][k]->GetBinContent(NuE_OpticsError[i][j][k]->FindBin(true_enu)));
02049     case -12: return nsigma*(NuEBar_OpticsError[i][j][k]->GetBinContent(NuEBar_OpticsError[i][j][k]->FindBin(true_enu)));
02050     default: return 0.;
02051     }  
02052   }
02053 
02054   return 0.;
02055 }

void SKZPWeightCalculator::GetParameters ( std::vector< double > &  bs,
std::vector< double > &  hp,
std::vector< double > &  det 
)
double SKZPWeightCalculator::GetRFWWeight ( int  det,
int  Ibeam,
int  tptype,
double  pt,
double  pz,
int  ccnc,
double  true_enu,
int  inu,
double  reco_emu,
double  reco_eshw,
double &  new_reco_emu,
double &  new_reco_eshw,
double &  beamweight,
double &  detweight 
)

Definition at line 1866 of file SKZPWeightCalculator.cxx.

References GetBeamWeight(), GetDetWeight(), Msg::kError, MSG, and runfrac.

01872 {
01873 
01874   //do the detector weighting
01875   detweight=GetDetWeight(ccnc,true_enu,inu,
01876                          reco_emu,reco_eshw,new_reco_emu,new_reco_eshw);
01877   beamweight=1.;
01878   if(runfrac.size()==0){
01879     MSG("SKZPWeightCalculator",Msg::kError)<<"You did not set the "
01880                                            <<"Run Period exposures."<<endl
01881                                            <<"I can not compute a "
01882                                            <<" fractional weight without "
01883                                            <<"knowing the relative exposures"<<endl;
01884     return 1.;
01885   }
01886     
01887 
01888   map<RunPeriod_t,double> beamc(runfrac.find(Ibeam)->second);
01889   map<RunPeriod_t,double>::iterator bcit(beamc.begin());
01890   double num=0.;
01891   double denom=0.;
01892   int i=0;
01893   while(bcit!=beamc.end()){
01894     RunPeriod_t rp = bcit->first;
01895     double pot = bcit->second;
01896     double w=GetBeamWeight(det,Ibeam,tptype,pt,pz,true_enu,inu,rp);
01897     num+=w*pot;
01898     denom+=pot;
01899     bcit++;
01900     //        cout<<"bcit->first "<<bcit->first<<endl;
01901     //    cout<<"bcit->second "<<bcit->second<<endl;
01902 
01903     //    cout<<"i "<<i<<" w "<<w<<" pot "<<pot<<" w*pot "<<w*pot<<" num "<<num<<" denom "<<denom<<endl;
01904     i++;
01905   }
01906     
01907     
01908   if(denom!=0){
01909     beamweight*=num/denom;
01910   }
01911 
01912 
01913   //return just the beam weight, as this is what 
01914   //most people will want
01915   //the value of the detweight is passed by reference
01916   //do not use the new values of new_reco_emu and new_reco_eshw
01917   //in the case of beam weighting only!!!!!
01918   return beamweight;
01919 }

double SKZPWeightCalculator::GetRFWWeight ( const NtpMCFluxInfo fi,
int  det,
int  Ibeam,
int  ccnc,
double  true_enu,
int  inu,
double  reco_emu,
double  reco_eshw,
double &  new_reco_emu,
double &  new_reco_eshw,
double &  beamweight,
double &  detweight 
)

Definition at line 1841 of file SKZPWeightCalculator.cxx.

References GetRFWWeight(), NtpMCFluxInfo::tptype, NtpMCFluxInfo::tpx, NtpMCFluxInfo::tpy, and NtpMCFluxInfo::tpz.

01846 {
01847   int parenttype=-1;
01848   double parentpz=0.;
01849   double parentpx=0.;
01850   double parentpy=0.;
01851 
01852   parenttype = fi->tptype;
01853   parentpz = 1.*fi->tpz;
01854   parentpy = 1.*fi->tpy;
01855   parentpx = 1.*fi->tpx;
01856 
01857   double pt = sqrt(parentpy*parentpy+parentpx*parentpx);
01858 
01859   //pass the variables on to the next version of GetWeight
01860   return GetRFWWeight(det,Ibeam,parenttype,pt,parentpz,ccnc,true_enu,inu,
01861                       reco_emu,reco_eshw,new_reco_emu,
01862                       new_reco_eshw,beamweight,detweight);
01863 
01864 }

double SKZPWeightCalculator::GetRFWWeight ( const NtpMCTruth mc,
int  det,
int  Ibeam,
double  reco_emu,
double  reco_eshw,
double &  new_reco_emu,
double &  new_reco_eshw,
double &  beamweight,
double &  detweight 
)

Definition at line 1820 of file SKZPWeightCalculator.cxx.

References NtpMCTruth::flux, NtpMCTruth::iaction, NtpMCTruth::inu, and NtpMCTruth::p4neu.

Referenced by GetRFWWeight().

01824 {
01825   //retrieve truth information on the neutrino interaction from
01826   //the NtpMCTruth object
01827   int ccnc = mc->iaction;
01828   double true_enu = 1.*mc->p4neu[3];
01829   int inu = mc->inu;
01830 
01831   //pass the truth info and the fluxinfo object to the next
01832   //form of GetWeight
01833   return GetRFWWeight(&(mc->flux),det,Ibeam,
01834                       ccnc,true_enu,inu,
01835                       reco_emu,reco_eshw,
01836                       new_reco_emu,new_reco_eshw,
01837                       beamweight, detweight);
01838   
01839 }

double SKZPWeightCalculator::GetRunPeriodWeight ( VldContext  vc,
int  det,
int  Ibeam,
int  ntype,
double  Enu 
) [inline, private]

Definition at line 400 of file SKZPWeightCalculator.h.

References GetRunPeriodWeight(), RunPeriodFromInt(), and RunPeriodIntFromValidity().

00400                                                                                      {
00401     return GetRunPeriodWeight((RunPeriodFromInt(RunPeriodIntFromValidity(vc))),det,Ibeam,ntype,Enu);}

double SKZPWeightCalculator::GetRunPeriodWeight ( RunPeriod_t  rp,
int  det,
int  Ibeam,
int  ntype,
double  Enu 
) [private]

Definition at line 1529 of file SKZPWeightCalculator.cxx.

References Zbeam::ZbeamData::beam, bs_pars, cfgnum, Zbeam::ZbeamData::detector, BeamType::FromZarko(), GetHeliumWeight(), GetTargetDecayWeight(), Zbeam::GetWeight(), IntFromRunPeriod(), BeamSys::kBeamWidth, kDetXs, kDogwood1_Daikon07, kDogwood1_Daikon07_v2, kDogwood5_Daikon07_2012, Detector::kFar, Msg::kInfo, BeamType::kL010z000i, BeamType::kL010z170i, BeamType::kL010z185i, BeamType::kL010z200i, BeamType::kL100z200i, BeamType::kL150z200i, BeamType::kL250z200i, kMINOSplus_2014, kMINOSplus_2014_v2, kMINOSplus_2018, Detector::kNear, kRunI, kRunII, kRunIII, kRunIV, kRunIX, kRunV, kRunVI, kRunVII, kRunVIII, kRunX, kRunXI, BeamSys::kTargetZ, Detector::kUnknown, MSG, Zbeam::ZbeamData::ntype, Zbeam::ZbeamData::true_enu, and zbeam.

Referenced by GetBeamWeight(), and GetRunPeriodWeight().

01534 {
01535   double weight=1.;
01536 
01537   if(cfgnum==kDetXs || cfgnum==kDogwood1_Daikon07){
01538 
01539     // Target z weighting comes from the fit parameters
01540     Detector::Detector_t detector = Detector::kUnknown;
01541     if      (det==1) detector=Detector::kNear;
01542     else if (det==2) detector=Detector::kFar;
01543     
01544     Zbeam::ZbeamData_t zdata;
01545     zdata.ntype    = ntype;
01546     zdata.true_enu = Enu;
01547     zdata.detector = detector;
01548     zdata.beam     = BeamType::FromZarko(Ibeam);
01549     
01550 
01551     if(rp==kRunI){ // both weighting schemes have same parameters
01552       
01553       // target z effects
01554       if ( zdata.beam == BeamType::kL010z170i || 
01555            zdata.beam == BeamType::kL010z185i || 
01556            zdata.beam == BeamType::kL010z200i) {
01557         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[0]);
01558       } else if (zdata.beam == BeamType::kL100z200i) {
01559         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[1]);
01560       } else if (zdata.beam == BeamType::kL150z200i) {
01561         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[2]);
01562       } else if (zdata.beam == BeamType::kL250z200i) {
01563         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[3]);
01564       }
01565       
01566       // spot size
01567       if (zdata.beam == BeamType::kL250z200i ||
01568           zdata.beam == BeamType::kL100z200i) {
01569         weight *= zbeam->GetWeight(zdata,BeamSys::kBeamWidth,0.);
01570       }
01571     }
01572     else if(rp==kRunII) {
01573       
01574       if (zdata.beam == BeamType::kL010z185i) {
01575         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[4]);
01576       }
01577       else if (zdata.beam == BeamType::kL250z200i) {
01578         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[5]);
01579       }
01580 
01581       if(cfgnum==kDogwood1_Daikon07){ // apply target decay weight
01582         weight *= GetTargetDecayWeight(det,Ibeam,ntype,Enu,bs_pars[7]);
01583       }
01584 
01585     }
01586 
01587     else if(rp==kRunIII && cfgnum==kDetXs) { // use Run II beam position and Helium weight
01588 
01589       if (zdata.beam == BeamType::kL010z185i) {
01590         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[4]);
01591       }
01592       weight *= GetHeliumWeight(det,Ibeam,ntype,Enu);
01593 
01594       // DetXs target decay weight to be added when finalised
01595 
01596     }
01597 
01598     else if(rp==kRunIII && cfgnum==kDogwood1_Daikon07){
01599 
01600       if (zdata.beam == BeamType::kL010z185i) {
01601         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[6]);
01602       }
01603       weight *= GetTargetDecayWeight(det,Ibeam,ntype,Enu,bs_pars[8]);
01604       // Don't need Helium weight for Daikon07
01605 
01606     }
01607 
01608   } // end if(DetXs or Dogwood1_Daikon07)
01609   if(cfgnum==kDogwood1_Daikon07_v2 || cfgnum==kDogwood5_Daikon07_2012){
01610 
01611     // Target z weighting comes from the fit parameters
01612     Detector::Detector_t detector = Detector::kUnknown;
01613     if      (det==1) detector=Detector::kNear;
01614     else if (det==2) detector=Detector::kFar;
01615 
01616     Zbeam::ZbeamData_t zdata;
01617     zdata.ntype    = ntype;
01618     zdata.true_enu = Enu;
01619     zdata.detector = detector;
01620     zdata.beam     = BeamType::FromZarko(Ibeam);
01621     
01622     if(rp==kRunI){
01623       
01624       // target z effects
01625       if ( zdata.beam == BeamType::kL010z170i || 
01626            zdata.beam == BeamType::kL010z185i || 
01627            zdata.beam == BeamType::kL010z200i) {
01628         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[5]);
01629       } else if (zdata.beam == BeamType::kL100z200i) {
01630         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[6]);
01631       } else if (zdata.beam == BeamType::kL150z200i) {
01632         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[7]);
01633       } else if (zdata.beam == BeamType::kL250z200i) {
01634         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[8]);
01635       }
01636       
01637       // spot size
01638       if (zdata.beam == BeamType::kL250z200i ||
01639           zdata.beam == BeamType::kL100z200i) {
01640         weight *= zbeam->GetWeight(zdata,BeamSys::kBeamWidth,0.);
01641       }
01642     }
01643     else if(rp==kRunII) {
01644       
01645       if (zdata.beam == BeamType::kL010z185i) {
01646         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[9]);
01647       }
01648       else if (zdata.beam == BeamType::kL250z200i) {
01649         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[10]);
01650       }
01651 
01652       // apply target decay weight
01653       weight *= GetTargetDecayWeight(det,Ibeam,ntype,Enu,bs_pars[12]);
01654 
01655     }
01656 
01657     else if(rp==kRunIII){
01658 
01659       if (zdata.beam == BeamType::kL010z185i) {
01660         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[11]);
01661       }
01662 
01663       // apply target decay weight
01664       weight *= GetTargetDecayWeight(det,Ibeam,ntype,Enu,bs_pars[13]);
01665 
01666       // Don't need Helium weight for Daikon07
01667 
01668     }
01669 
01670     else if(rp==kRunIV){
01671 
01672       zdata.ntype    = -ntype; // change sign as appropriate for RHC
01673 
01674       // Run IV survey = -9.4cm, generated at -10cm => +0.6cm correction
01675       // target z effects
01676       if (zdata.beam == BeamType::kL010z185i) {
01677         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,0.6);
01678       } 
01679 
01680     }
01681 
01682 
01683     else if(rp==kRunV){
01684       // Run IV survey = -9.4cm, generated at -10cm => +0.6cm correction
01685       // target z effects
01686       if (zdata.beam == BeamType::kL010z185i) {
01687         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,0.6);
01688       } 
01689 
01690     }
01691 
01692     else if(rp==kRunVI){
01693       // Run IV survey = -9.4cm, generated at -10cm => +0.6cm correction
01694       // target z effects
01695       if (zdata.beam == BeamType::kL010z185i) {
01696         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,0.6);
01697       } 
01698 
01699     }
01700 
01701     else if(rp==kRunVII){
01702 
01703       zdata.ntype    = -ntype; // change sign as appropriate for RHC
01704 
01705       // Target 5 (Run VII) survey = -8.85cm, generated at -10cm => +1.15cm correction
01706       // target z effects
01707       if (zdata.beam == BeamType::kL010z185i) {
01708         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,1.15);
01709       } 
01710 
01711     }
01712 
01713     else if(rp==kRunVIII){
01714       // Target 1prime (Run VIII) survey = -10.4cm, generated at -10cm => -0.4cm correction
01715       // target z effects
01716       if (zdata.beam == BeamType::kL010z185i) {
01717         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,-0.4);
01718       } 
01719       //Not sure if want to apply target decay weights for runVIII. 
01720       //RunVIII is not used for the analysis at present anyway so it doesn't matter. 
01721       //May want to revisit this question in the future.
01722     }
01723 
01724     else if(rp==kRunIX){
01725 
01726       zdata.ntype    = -ntype; // change sign as appropriate for RHC
01727 
01728       // Target 2 prime (Run IX) survey = -9.18cm, generated at -10cm => +0.82cm correction
01729       // target z effects
01730       if (zdata.beam == BeamType::kL010z185i) {
01731         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,0.82);
01732       } 
01733 
01734       // apply target decay weight
01735       weight *= GetTargetDecayWeight(det,Ibeam,ntype,Enu,bs_pars[13]);
01736 
01737     }
01738 
01739     else if(rp==kRunX){
01740       // Target 7 (Run X) survey = -9.17cm, generated at -10cm => +0.83cm correction
01741       // target z effects
01742       if (zdata.beam == BeamType::kL010z185i) {
01743         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,0.83);
01744       } 
01745 
01746     }
01747 
01748     //who put this condition in? Does not make sense at all! There is no run XI for MINOS, only MINOS+
01749     //and this is taken care of in kMINOSplus_2014
01750     else if(rp==kRunXI){
01751       
01752       // target z effects
01753       if ( zdata.beam == BeamType::kL010z170i || 
01754            zdata.beam == BeamType::kL010z185i || 
01755            zdata.beam == BeamType::kL010z200i) {
01756         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,0);
01757       } else if (zdata.beam == BeamType::kL100z200i) {
01758         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,0);
01759       } else if (zdata.beam == BeamType::kL150z200i) {
01760         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,0);
01761       } else if (zdata.beam == BeamType::kL250z200i) {
01762         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,0);
01763       }
01764     }
01765     //end of senseless condition
01766   
01767   }//end of kDogwood5_Daikon07_v2 and kDogwood5_Daikon07_2012
01768 
01769   else if(cfgnum==kMINOSplus_2014 || cfgnum==kMINOSplus_2014_v2 || cfgnum==kMINOSplus_2018){
01770     if(IntFromRunPeriod(rp)<11){
01771       MSG("SKZPWeightCalculator",Msg::kInfo)<<"You are running MINOS+ weights "
01772                                             <<" For MINOS runs - load older config "
01773                                             <<" run period weight weight set to 1.0 (no tgtZ and decay effects)"<<endl;
01774     weight*=1.0;
01775     }
01776     else{
01777     weight*=1.0;
01778     }
01779   }
01780 
01781     else {
01782     if(rp==kRunI){
01783       // cout<<"on run I"<<endl;
01784       //RUN I
01785       //ME and HE runs were lower intensity, smaller spot size,  
01786       if(BeamType::FromZarko(Ibeam)==BeamType::kL100z200i||
01787          BeamType::FromZarko(Ibeam)==BeamType::kL250z200i){
01788         //GetWeight with effect 6 already takes care of the beam type "if's"
01789         //but I thought I should just make them explicit here too
01790         weight=zbeam->GetWeight(det,Ibeam,6,0,ntype,Enu);
01791         //      cout<<"in run I weight"<<endl;
01792       }
01793     }
01794     else if(rp==kRunII || rp==kRunIII){
01795       //RUN II
01796       //reweight le10 beam to le09 beam
01797       //    cout<<"in run II weight "<<endl;
01798       if(BeamType::FromZarko(Ibeam)==BeamType::kL010z185i||
01799          BeamType::FromZarko(Ibeam)==BeamType::kL010z000i){
01800         weight=zbeam->GetWeight(det,Ibeam,15,-1.,ntype,Enu);
01801         //      cout<<"in run II weight "<<endl;
01802       }
01803 
01804       if(rp==kRunII){
01805         // target decay weight to be added when finalised, 0.6 should give ~average effect
01806         weight *= GetTargetDecayWeight(det,Ibeam,ntype,Enu,0.6);
01807       }
01808       if(rp==kRunIII){
01809         weight *= GetHeliumWeight(det,Ibeam,ntype,Enu);
01810         // target decay weight to be added when finalised, 1.25 should give ~average effect
01811         weight *= GetTargetDecayWeight(det,Ibeam,ntype,Enu,1.25);
01812       }
01813 
01814     }
01815     //  cout<<"run perioud weight "<<weight<<endl;
01816   }
01817   return weight;
01818 }

double SKZPWeightCalculator::GetTargetDecayWeight ( int  det,
int  Ibeam,
int  Ntype,
double  true_enu,
double  fin78fraction 
)

Definition at line 2677 of file SKZPWeightCalculator.cxx.

References GetMissingFin78Weight_L010z000i_FD_Nue(), GetMissingFin78Weight_L010z000i_FD_Nuebar(), GetMissingFin78Weight_L010z000i_FD_Numu(), GetMissingFin78Weight_L010z000i_FD_Numubar(), GetMissingFin78Weight_L010z000i_ND_Nue(), GetMissingFin78Weight_L010z000i_ND_Nuebar(), GetMissingFin78Weight_L010z000i_ND_Numu(), GetMissingFin78Weight_L010z000i_ND_Numubar(), GetMissingFin78Weight_L010z185i_FD_Nue(), GetMissingFin78Weight_L010z185i_FD_Nuebar(), GetMissingFin78Weight_L010z185i_FD_Numu(), GetMissingFin78Weight_L010z185i_FD_Numubar(), GetMissingFin78Weight_L010z185i_ND_Nue(), GetMissingFin78Weight_L010z185i_ND_Nuebar(), GetMissingFin78Weight_L010z185i_ND_Numu(), and GetMissingFin78Weight_L010z185i_ND_Numubar().

Referenced by GetRunPeriodWeight().

02678 {
02679 
02680   double weight78 = 1.0;
02681 
02682   if(det==1){ // ND
02683     if(Ibeam==2){ // L010z185i
02684       if(Ntype==56 || Ntype==14) weight78 = GetMissingFin78Weight_L010z185i_ND_Numu(true_enu);
02685       else if(Ntype==55 || Ntype==-14) weight78 = GetMissingFin78Weight_L010z185i_ND_Numubar(true_enu);
02686       else if(Ntype==53 || Ntype==12) weight78 = GetMissingFin78Weight_L010z185i_ND_Nue(true_enu);
02687       else if(Ntype==52 || Ntype==-12) weight78 = GetMissingFin78Weight_L010z185i_ND_Nuebar(true_enu);
02688       else weight78 = 1.0;
02689     }
02690     else if(Ibeam==8){ // L010z000i
02691       if(Ntype==56 || Ntype==14) weight78 = GetMissingFin78Weight_L010z000i_ND_Numu(true_enu);
02692       else if(Ntype==55 || Ntype==-14) weight78 = GetMissingFin78Weight_L010z000i_ND_Numubar(true_enu);
02693       else if(Ntype==53 || Ntype==12) weight78 = GetMissingFin78Weight_L010z000i_ND_Nue(true_enu);
02694       else if(Ntype==52 || Ntype==-12) weight78 = GetMissingFin78Weight_L010z000i_ND_Nuebar(true_enu);
02695       else weight78 = 1.0;
02696     }
02697     else weight78 = 1.0;
02698   }
02699   else if(det==2){ // FD
02700     if(Ibeam==2){ // L010z185i
02701       if(Ntype==56 || Ntype==14) weight78 = GetMissingFin78Weight_L010z185i_FD_Numu(true_enu);
02702       else if(Ntype==55 || Ntype==-14) weight78 = GetMissingFin78Weight_L010z185i_FD_Numubar(true_enu);
02703       else if(Ntype==53 || Ntype==12) weight78 = GetMissingFin78Weight_L010z185i_FD_Nue(true_enu);
02704       else if(Ntype==52 || Ntype==-12) weight78 = GetMissingFin78Weight_L010z185i_FD_Nuebar(true_enu);
02705       else weight78 = 1.0;
02706     }
02707     else if(Ibeam==8){ // L010z000i
02708       if(Ntype==56 || Ntype==14) weight78 = GetMissingFin78Weight_L010z000i_FD_Numu(true_enu);
02709       else if(Ntype==55 || Ntype==-14) weight78 = GetMissingFin78Weight_L010z000i_FD_Numubar(true_enu);
02710       else if(Ntype==53 || Ntype==12) weight78 = GetMissingFin78Weight_L010z000i_FD_Nue(true_enu);
02711       else if(Ntype==52 || Ntype==-12) weight78 = GetMissingFin78Weight_L010z000i_FD_Nuebar(true_enu);
02712       else weight78 = 1.0;
02713     }
02714     else weight78 = 1.0;
02715   }
02716   else weight78 = 1.0;
02717 
02718   // Now convert to fractional weight
02719   // eg: if want to remove 4 fins then double the distance from unity for the weight
02720 
02721   double weight = 1.;
02722 
02723   if(weight78<0.){
02724     weight = 1.0-(fin78fraction*(1.0-weight78));
02725   }
02726   else if(weight78>0.){
02727     weight = 1.0+(fin78fraction*(weight78-1.0));
02728   }
02729 
02730   return weight;
02731 
02732 }

double SKZPWeightCalculator::GetTargetZError ( int  det,
int  Ibeam,
int  inu,
double  true_enu,
VldContext  vc,
double  nsigma = 1.,
const char *  dir = "" 
) [inline]

Definition at line 362 of file SKZPWeightCalculator.h.

References GetTargetZError(), RunPeriodFromInt(), and RunPeriodIntFromValidity().

00363                                                                              {
00364     return GetTargetZError(det,Ibeam,inu,true_enu,
00365                            RunPeriodFromInt(RunPeriodIntFromValidity(vc)),nsigma,dir);
00366   }

double SKZPWeightCalculator::GetTargetZError ( int  det,
int  Ibeam,
int  inu,
double  true_enu,
RunPeriod_t  rp = kRunI,
double  nsigma = 1.,
const char *  dir = "" 
)

Definition at line 2058 of file SKZPWeightCalculator.cxx.

References IntFromRunPeriod(), LoadTargetZErrors(), NuMu_TargetZError, and targetZErrorsLoaded.

Referenced by GetFluxError(), and GetTargetZError().

02060 {
02061   if(!targetZErrorsLoaded) LoadTargetZErrors(dir,rp);
02062 
02063   int i = Ibeam-2;
02064   int j = IntFromRunPeriod(rp)-1;
02065   if(IntFromRunPeriod(rp)==11||IntFromRunPeriod(rp)==12) j=0;
02066   int k = det-1;
02067 
02068   if(i==3||i==8||i==9) return 0.; // No low intensity L010z185i in beam fit
02069   // Remove various beam configuration / run period combinations
02070   else if(IntFromRunPeriod(rp)==13) return 0.;
02071   else if(i==1 && j>0) return 0.;
02072   else if(i==2 && j>1) return 0.;
02073   else if(i==4 && j>0) return 0.;
02074   else if(i==5 && j>0) return 0.;
02075   else if(i==7 && j!=1) return 0.;
02076   else if(i==10 && j>0) return 0.;  //only one MINOS+ M000z200 run for now
02077   else if(i==11 && j>0) return 0.;  //only one MINOS+ M000z000 run for now
02078   else {
02079     switch(inu){
02080     case 14: return nsigma*(NuMu_TargetZError[i][j][k]->GetBinContent(NuMu_TargetZError[i][j][k]->FindBin(true_enu)));
02081     case -14: return 0.; // Target z error only computed for muon neutrinos
02082     case 12: return 0.;
02083     case -12: return 0.;
02084     default: return 0.;
02085     }  
02086   }
02087 
02088   return 0.;
02089 }

double SKZPWeightCalculator::GetWeight ( int  det,
int  Ibeam,
int  tptype,
double  pt,
double  pz,
int  ccnc,
double  true_enu,
int  inu,
double  reco_emu,
double  reco_eshw,
double &  new_reco_emu,
double &  new_reco_eshw,
double &  beamweight,
double &  detweight,
VldContext  vc,
double  true_eshw = -1,
MCEventInfo ei = 0 
) [inline]

Definition at line 231 of file SKZPWeightCalculator.h.

References GetWeight(), RunPeriodFromInt(), and RunPeriodIntFromValidity().

00237                                                                        {
00238     return GetWeight(det,Ibeam,
00239                      tptype,pt,pz,
00240                      ccnc,true_enu,inu,
00241                      reco_emu,reco_eshw,
00242                      new_reco_emu,new_reco_eshw,
00243                      beamweight,detweight,
00244                      RunPeriodFromInt(RunPeriodIntFromValidity(vc)),
00245                      true_eshw,ei);
00246   }

double SKZPWeightCalculator::GetWeight ( const NtpMCFluxInfo fi,
int  det,
int  Ibeam,
int  ccnc,
double  true_enu,
int  inu,
double  reco_emu,
double  reco_eshw,
double &  new_reco_emu,
double &  new_reco_eshw,
double &  beamweight,
double &  detweight,
VldContext  vc,
double  true_eshw = -1,
MCEventInfo ei = 0 
) [inline]

Definition at line 216 of file SKZPWeightCalculator.h.

References GetWeight(), RunPeriodFromInt(), and RunPeriodIntFromValidity().

00221                                                                        {
00222     return GetWeight(fi,det,Ibeam,
00223                      ccnc,true_enu,inu,
00224                      reco_emu,reco_eshw,
00225                      new_reco_emu,new_reco_eshw,
00226                      beamweight,detweight,
00227                      RunPeriodFromInt(RunPeriodIntFromValidity(vc)),
00228                      true_eshw,ei);
00229   }

double SKZPWeightCalculator::GetWeight ( const NtpMCTruth mc,
int  det,
int  Ibeam,
double  reco_emu,
double  reco_eshw,
double &  new_reco_emu,
double &  new_reco_eshw,
double &  beamweight,
double &  detweight,
VldContext  vc,
double  true_eshw = -1,
MCEventInfo ei = 0 
) [inline]

Definition at line 203 of file SKZPWeightCalculator.h.

References GetWeight(), RunPeriodFromInt(), and RunPeriodIntFromValidity().

00207                                                                        {
00208     return GetWeight(mc,det,Ibeam,
00209                      reco_emu,reco_eshw,
00210                      new_reco_emu,new_reco_eshw,
00211                      beamweight,detweight,
00212                      RunPeriodFromInt(RunPeriodIntFromValidity(vc)),
00213                      true_eshw,ei);
00214   }

double SKZPWeightCalculator::GetWeight ( int  det,
int  Ibeam,
int  tptype,
double  pt,
double  pz,
int  ccnc,
double  true_enu,
int  inu,
double  reco_emu,
double  reco_eshw,
double &  new_reco_emu,
double &  new_reco_eshw,
double &  beamweight,
double &  detweight,
RunPeriod_t  rp = kRunI,
double  true_eshw = -1,
MCEventInfo ei = 0 
)

Definition at line 670 of file SKZPWeightCalculator.cxx.

References GetBeamWeight(), and GetDetWeight().

00678 {
00679   
00680   //do the beam weighting
00681   beamweight=GetBeamWeight(det,Ibeam,tptype,pt,pz,true_enu,inu,rp);
00682   //do the detector weighting
00683   detweight=GetDetWeight(ccnc,true_enu,inu,
00684                          reco_emu,reco_eshw,new_reco_emu,new_reco_eshw,true_eshw,ei);
00685 
00686   //return just the beam weight, as this is what 
00687   //most people will want
00688   //the value of the detweight is passed by reference
00689   //do not use the new values of new_reco_emu and new_reco_eshw
00690   //in the case of beam weighting only!!!!!
00691   return beamweight;
00692 
00693 }

double SKZPWeightCalculator::GetWeight ( const NtpMCFluxInfo fi,
int  det,
int  Ibeam,
int  ccnc,
double  true_enu,
int  inu,
double  reco_emu,
double  reco_eshw,
double &  new_reco_emu,
double &  new_reco_eshw,
double &  beamweight,
double &  detweight,
RunPeriod_t  rp = kRunI,
double  true_eshw = -1,
MCEventInfo ei = 0 
)

Definition at line 625 of file SKZPWeightCalculator.cxx.

References cfgname, GetWeight(), NtpMCFluxInfo::ppdxdz, NtpMCFluxInfo::ppdydz, NtpMCFluxInfo::pppz, NtpMCFluxInfo::ptype, NtpMCFluxInfo::tptype, NtpMCFluxInfo::tpx, NtpMCFluxInfo::tpy, and NtpMCFluxInfo::tpz.

00632 {
00633   int parenttype=-1;
00634   double parentpz=0.;
00635   double parentpx=0.;
00636   double parentpy=0.;
00637 
00638   //extract the flux weighting variables from the fluxinfo object
00639   //due to bug in v18 flux files, the tp* variables
00640   //(i.e. info pertaining to the particle created in the target)
00641   //are the same as the pp* variables
00642   //(i.e. the info pertaining to the particle leaving the target)
00643   //in v19 flux and beyond, this has been fixed.
00644   //In the future, we will probably want to weight based on the tp variables,
00645   //but to compare with what was done before, I want the option to 
00646   //use the pp* variables, which is why this if statement is here.
00647 
00648   if(cfgname=="v19fit"){  //this isn't a real config yet
00649     parenttype = fi->ptype;
00650     parentpz = 1.*fi->pppz;
00651     parentpy = 1.*fi->ppdydz*parentpz;
00652     parentpx = 1.*fi->ppdxdz*parentpz;
00653   }
00654   else{
00655     parenttype = fi->tptype;
00656     parentpz = 1.*fi->tpz;
00657     parentpy = 1.*fi->tpy;
00658     parentpx = 1.*fi->tpx;
00659   }
00660 
00661   double pt = sqrt(parentpy*parentpy+parentpx*parentpx);
00662 
00663   //pass the variables on to the next version of GetWeight
00664   return GetWeight(det,Ibeam,parenttype,pt,parentpz,ccnc,true_enu,inu,
00665                    reco_emu,reco_eshw,new_reco_emu,new_reco_eshw,beamweight,detweight,
00666                    rp,true_eshw,ei);
00667 
00668 }

double SKZPWeightCalculator::GetWeight ( const NtpMCTruth mc,
int  det,
int  Ibeam,
double  reco_emu,
double  reco_eshw,
double &  new_reco_emu,
double &  new_reco_eshw,
double &  beamweight,
double &  detweight,
RunPeriod_t  rp = kRunI,
double  true_eshw = -1,
MCEventInfo ei = 0 
)

Definition at line 599 of file SKZPWeightCalculator.cxx.

References NtpMCTruth::flux, GetWeight(), NtpMCTruth::iaction, NtpMCTruth::inu, and NtpMCTruth::p4neu.

00605 {
00606 
00607 
00608   //retrieve truth information on the neutrino interaction from
00609   //the NtpMCTruth object
00610   int ccnc = mc->iaction;
00611   double true_enu = 1.*mc->p4neu[3];
00612   int inu = mc->inu;
00613 
00614 
00615   //pass the truth info and the fluxinfo object to the next
00616   //form of GetWeight
00617   return GetWeight(&(mc->flux),det,Ibeam,
00618                    ccnc,true_enu,inu,
00619                    reco_emu,reco_eshw,
00620                    new_reco_emu,new_reco_eshw,
00621                    beamweight, detweight,rp,true_eshw,ei);
00622 
00623 }

virtual double SKZPWeightCalculator::GetWeight ( MCEventInfo ,
NuParent  
) [inline, virtual]

Reimplemented from WeightCalculator.

Definition at line 178 of file SKZPWeightCalculator.h.

00178 {return 1.;}

double SKZPWeightCalculator::GetWeight ( Registry eventinfo  )  [virtual]

Reimplemented from WeightCalculator.

Definition at line 551 of file SKZPWeightCalculator.cxx.

References det, Registry::Get(), Msg::kError, Registry::LockKeys(), MSG, Registry::Set(), and Registry::UnLockKeys().

Referenced by NCEventInfo::FindMEGAFitWeight(), GetWeight(), and NuZBeamReweight::GetWeights().

00552 {
00553   //don't use me I'm slow.
00554   //the GetWeight function this version calls has been tested,
00555   //but reading the event info from the registry has not 
00556   //been tested (it should work, I just haven't tried it yet)
00557   bool gotallinfo=true;
00558   int det,ibeam,tptype,ccnc,inu;
00559   double pt, pz, true_enu, reco_emu, reco_eshw;
00560   double new_reco_emu, new_reco_eshw, beamweight, detweight;
00561   
00562   if(!eventinfo->Get("evt:det",det)) gotallinfo=false;
00563   if(!eventinfo->Get("evt:ibeam",ibeam)) gotallinfo=false;
00564   if(!eventinfo->Get("evt:tptype",tptype)) gotallinfo=false;
00565   if(!eventinfo->Get("evt:ccnc",ccnc)) gotallinfo=false;
00566   if(!eventinfo->Get("evt:inu",inu)) gotallinfo=false;
00567   if(!eventinfo->Get("evt:pt",pt)) gotallinfo=false;
00568   if(!eventinfo->Get("evt:pz",pz)) gotallinfo=false; 
00569   if(!eventinfo->Get("evt:true_enu",true_enu)) gotallinfo=false;  
00570   if(!eventinfo->Get("evt:reco_emu",reco_emu)) gotallinfo=false;  
00571   if(!eventinfo->Get("evt:reco_eshw",reco_eshw)) gotallinfo=false;
00572 
00573   if(!gotallinfo){
00574     MSG("SKZPWeightCalculator",Msg::kError)<<"Could not retrieve all necessary"
00575                                            <<" event information from "
00576                                            <<"eventinfo registry, returning 1."
00577                                            <<endl;
00578     return 1.;
00579   }
00580 
00581   GetWeight(det,ibeam,tptype,pt,pz,ccnc,
00582             true_enu,inu,reco_emu,reco_eshw,
00583             new_reco_emu,new_reco_eshw,beamweight,detweight);
00584 
00585   //put new reco energies and weights into registry;
00586   eventinfo->UnLockKeys();
00587   eventinfo->Set("evt:new_reco_emu",new_reco_emu);
00588   eventinfo->Set("evt:new_reco_eshw",new_reco_eshw);
00589   eventinfo->Set("evt:beamweight",beamweight);
00590   eventinfo->Set("evt:detweight",detweight);
00591   eventinfo->LockKeys();
00592 
00593   // this function returns only the beam weight, as that is 
00594   //what most people are encouraged to use, the detweight is
00595   //returned through the registry
00596   return beamweight;
00597 }

Zbeam * SKZPWeightCalculator::GetZbeam (  ) 

Definition at line 1948 of file SKZPWeightCalculator.cxx.

References zbeam.

Referenced by NuZBeamReweight::GetSKZPWeightCalculator2018().

01949 {
01950    return zbeam;
01951 }

Zfluk * SKZPWeightCalculator::GetZfluk (  ) 

Definition at line 1954 of file SKZPWeightCalculator.cxx.

References zfluk.

01955 {
01956    return zfluk;
01957 }

int SKZPWeightCalculator::IntFromRunPeriod ( RunPeriod_t  rp  )  [inline]

Definition at line 105 of file SKZPWeightCalculator.h.

References kRunI, kRunII, kRunIII, kRunIV, kRunIX, kRunV, kRunVI, kRunVII, kRunVIII, kRunX, kRunXI, kRunXII, and kRunXIII.

Referenced by GetAPSweight(), GetBeamSysFile(), GetBeamWeight(), GetDecayError(), GetDecayModelError(), GetHadProdError(), GetHadProdError2012(), GetMaterialError(), GetOpticsError(), GetRunPeriodWeight(), GetTargetZError(), and LoadAPSweights().

00105                                       {
00106     switch(rp){
00107     case kRunI:
00108       return 1;
00109     case kRunII:
00110       return 2;
00111     case kRunIII:
00112       return 3;
00113     case kRunIV:
00114       return 4;
00115     case kRunV:
00116       return 5;
00117     case kRunVI:
00118       return 6;
00119     case kRunVII:
00120       return 7;
00121     case kRunVIII:
00122       return 8;
00123     case kRunIX:
00124       return 9;
00125     case kRunX:
00126       return 10;
00127     case kRunXI:
00128       return 11;
00129     case kRunXII:
00130       return 12;
00131     case kRunXIII:
00132       return 13;
00133     default:
00134       return 0;
00135     }
00136   }

void SKZPWeightCalculator::LoadAPSweights ( const char *  dir = "",
RunPeriod_t  rp = kNone 
) [private]

Definition at line 2588 of file SKZPWeightCalculator.cxx.

References AntiNu_FD_APSW_M00V4, AntiNu_FD_APSW_M02V4, AntiNu_FD_APSW_M02V5, AntiNu_FD_APSW_M02V6, AntiNu_FN_APSW_M00V4, AntiNu_FN_APSW_M02V4, AntiNu_FN_APSW_M02V5, AntiNu_FN_APSW_M02V6, AntiNu_ND_APSW_M00V4, AntiNu_ND_APSW_M02V4, AntiNu_ND_APSW_M02V5, AntiNu_ND_APSW_M02V6, APSweightsLoaded, cfgnum, GetAPSweightsFile(), GetAPSweightsFile2018(), IntFromRunPeriod(), Msg::kInfo, kMINOSplus_2014, kMINOSplus_2014_v2, kMINOSplus_2018, MSG, Nu_FD_APSW_M00V4, Nu_FD_APSW_M02V4, Nu_FD_APSW_M02V5, Nu_FD_APSW_M02V6, Nu_FN_APSW_M00V4, Nu_FN_APSW_M02V4, Nu_FN_APSW_M02V5, Nu_FN_APSW_M02V6, Nu_ND_APSW_M00V4, Nu_ND_APSW_M02V4, Nu_ND_APSW_M02V5, and Nu_ND_APSW_M02V6.

Referenced by GetAPSweight().

02589 {
02590   if(cfgnum!=kMINOSplus_2014 && cfgnum!=kMINOSplus_2014_v2 && cfgnum!=kMINOSplus_2018){
02591     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Should not be loading APS weights "
02592                                           <<"with this configuration, you need"
02593                                           <<" MINOSplus_2014 or later"
02594                                           <<" (unless you are running beam fits"
02595                                           <<" and need them right now)."
02596                                           << endl;
02597     return;
02598   }
02599 
02600   TFile* f=0;
02601 
02602   if (cfgnum==kMINOSplus_2014 || cfgnum==kMINOSplus_2014_v2 || (cfgnum==kMINOSplus_2018 && (IntFromRunPeriod(rp)==11||IntFromRunPeriod(rp)==12))){
02603     f=GetAPSweightsFile(dir);
02604     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Got APS Weights 2014 file. "
02605                                           <<endl;
02606   }
02607   else if(cfgnum==kMINOSplus_2018){
02608     f=GetAPSweightsFile2018(dir);
02609     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Got APS Weights 2018 file. "
02610                                           <<endl;
02611   }
02612 
02613   Nu_ND_APSW_M00V4 = (TH1D*)f->Get("Nu_ND_APSW_M00V4");
02614   Nu_FD_APSW_M00V4 = (TH1D*)f->Get("Nu_FD_APSW_M00V4");
02615   Nu_FN_APSW_M00V4 = (TH1D*)f->Get("Nu_FN_APSW_M00V4");
02616   AntiNu_ND_APSW_M00V4 = (TH1D*)f->Get("AntiNu_ND_APSW_M00V4");
02617   AntiNu_FD_APSW_M00V4 = (TH1D*)f->Get("AntiNu_FD_APSW_M00V4");
02618   AntiNu_FN_APSW_M00V4 = (TH1D*)f->Get("AntiNu_FN_APSW_M00V4");
02619   Nu_ND_APSW_M02V4 = (TH1D*)f->Get("Nu_ND_APSW_M02V4");
02620   Nu_FD_APSW_M02V4 = (TH1D*)f->Get("Nu_FD_APSW_M02V4");
02621   Nu_FN_APSW_M02V4 = (TH1D*)f->Get("Nu_FN_APSW_M02V4");
02622   AntiNu_ND_APSW_M02V4 = (TH1D*)f->Get("AntiNu_ND_APSW_M02V4");
02623   AntiNu_FD_APSW_M02V4 = (TH1D*)f->Get("AntiNu_FD_APSW_M02V4");
02624   AntiNu_FN_APSW_M02V4 = (TH1D*)f->Get("AntiNu_FN_APSW_M02V4");
02625   Nu_ND_APSW_M02V5 = (TH1D*)f->Get("Nu_ND_APSW_M02V5");
02626   Nu_FD_APSW_M02V5 = (TH1D*)f->Get("Nu_FD_APSW_M02V5");
02627   Nu_FN_APSW_M02V5 = (TH1D*)f->Get("Nu_FN_APSW_M02V5");
02628   AntiNu_ND_APSW_M02V5 = (TH1D*)f->Get("AntiNu_ND_APSW_M02V5");
02629   AntiNu_FD_APSW_M02V5 = (TH1D*)f->Get("AntiNu_FD_APSW_M02V5");
02630   AntiNu_FN_APSW_M02V5 = (TH1D*)f->Get("AntiNu_FN_APSW_M02V5");
02631   Nu_ND_APSW_M02V6 = (TH1D*)f->Get("Nu_ND_APSW_M02V6");
02632   Nu_FD_APSW_M02V6 = (TH1D*)f->Get("Nu_FD_APSW_M02V6");
02633   Nu_FN_APSW_M02V6 = (TH1D*)f->Get("Nu_FN_APSW_M02V6");
02634   AntiNu_ND_APSW_M02V6 = (TH1D*)f->Get("AntiNu_ND_APSW_M02V6");
02635   AntiNu_FD_APSW_M02V6 = (TH1D*)f->Get("AntiNu_FD_APSW_M02V6");
02636   AntiNu_FN_APSW_M02V6 = (TH1D*)f->Get("AntiNu_FN_APSW_M02V6");
02637 
02638   APSweightsLoaded = true;
02639 
02640   MSG("SKZPWeightCalculator",Msg::kInfo)<<"APSweightLoaded =  "<<APSweightsLoaded<<endl;
02641 
02642 }

void SKZPWeightCalculator::LoadDecayErrors ( const char *  dir = "",
RunPeriod_t  rp = kNone 
) [private]

Definition at line 2525 of file SKZPWeightCalculator.cxx.

References cfgnum, decayErrorsLoaded, GetBeamSysFile(), kDogwood1_Daikon07_v2, kDogwood5_Daikon07_2012, Msg::kInfo, kMINOSplus_2014, kMINOSplus_2014_v2, kMINOSplus_2018, MSG, NuE_DecayError, NuEBar_DecayError, NuMu_DecayError, and NuMuBar_DecayError.

Referenced by GetDecayError().

02526 {
02527   if(cfgnum!=kDogwood1_Daikon07_v2&&cfgnum!=kDogwood5_Daikon07_2012 && cfgnum!=kMINOSplus_2014  && cfgnum!=kMINOSplus_2014_v2 && cfgnum!=kMINOSplus_2018){
02528     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Should not be loading errors "
02529                                           <<"with this configuration, you "
02530                                           <<"need Dogwood1Daikon07_v2 Dogwood5Daikon07_2012 or MINOSplus_2014(_v2)" << endl;
02531     return;
02532   }
02533   TFile* f = GetBeamSysFile(dir,rp);
02534   char name[200];
02535   // i==beam configuration
02536   // j==run period
02537   // k==detector
02538   for(int i=0;i<12;++i){
02539     if(i!=0 && i!=6) continue;
02540     for(int j=0;j<3;++j){
02541       for(int k=0;k<3;++k){
02542         sprintf(name,"NuMu_DecayError[%d][%d][%d]",i,j,k);
02543         NuMu_DecayError[i][j][k] = (TH1D*)f->Get(name);
02544         sprintf(name,"NuMuBar_DecayError[%d][%d][%d]",i,j,k);
02545         NuMuBar_DecayError[i][j][k] = (TH1D*)f->Get(name);
02546         sprintf(name,"NuE_DecayError[%d][%d][%d]",i,j,k);
02547         NuE_DecayError[i][j][k] = (TH1D*)f->Get(name);
02548         sprintf(name,"NuEBar_DecayError[%d][%d][%d]",i,j,k);
02549         NuEBar_DecayError[i][j][k] = (TH1D*)f->Get(name);
02550       }
02551     }
02552   }
02553   decayErrorsLoaded = true;
02554 }

void SKZPWeightCalculator::LoadDecayModelErrors ( const char *  dir = "",
RunPeriod_t  rp = kNone 
) [private]

Definition at line 2557 of file SKZPWeightCalculator.cxx.

References cfgnum, decayModelErrorsLoaded, GetBeamSysFile(), kDogwood1_Daikon07_v2, kDogwood5_Daikon07_2012, Msg::kInfo, kMINOSplus_2014, kMINOSplus_2014_v2, kMINOSplus_2018, MSG, NuE_DecayModelError, NuEBar_DecayModelError, NuMu_DecayModelError, and NuMuBar_DecayModelError.

Referenced by GetDecayModelError().

02558 {
02559   if(cfgnum!=kDogwood1_Daikon07_v2&&cfgnum!=kDogwood5_Daikon07_2012 && cfgnum!=kMINOSplus_2014 && cfgnum!=kMINOSplus_2014_v2 && cfgnum!=kMINOSplus_2018){
02560     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Should not be loading errors "
02561                                           <<"with this configuration, you "
02562                                           <<"need Dogwood1Daikon07_v2 or Dogwood5Daikon07_2012 or MINOSplus_2014(_v2)" << endl;
02563     return;
02564   }
02565   TFile* f = GetBeamSysFile(dir,rp);
02566   char name[200];
02567   // i==beam configuration
02568   // j==run period
02569   // k==detector
02570   for(int i=0;i<12;++i){
02571     if(i!=0) continue;
02572     for(int j=0;j<3;++j){
02573       for(int k=0;k<3;++k){
02574         sprintf(name,"NuMu_DecayModelError[%d][%d][%d]",i,j,k);
02575         NuMu_DecayModelError[i][j][k] = (TH1D*)f->Get(name);
02576         sprintf(name,"NuMuBar_DecayModelError[%d][%d][%d]",i,j,k);
02577         NuMuBar_DecayModelError[i][j][k] = (TH1D*)f->Get(name);
02578         sprintf(name,"NuE_DecayModelError[%d][%d][%d]",i,j,k);
02579         NuE_DecayModelError[i][j][k] = (TH1D*)f->Get(name);
02580         sprintf(name,"NuEBar_DecayModelError[%d][%d][%d]",i,j,k);
02581         NuEBar_DecayModelError[i][j][k] = (TH1D*)f->Get(name);
02582       }
02583     }
02584   }
02585   decayModelErrorsLoaded = true;
02586 }

void SKZPWeightCalculator::LoadHadProdErrors ( const char *  dir = "",
RunPeriod_t  rp = kNone 
) [private]

Definition at line 2337 of file SKZPWeightCalculator.cxx.

References cfgnum, GetBeamSysFile(), hadProdErrorsLoaded, kDogwood1_Daikon07_v2, Msg::kInfo, MSG, NuE_HadProdError, NuEBar_HadProdError, NuMu_HadProdError, and NuMuBar_HadProdError.

Referenced by GetHadProdError().

02338 {
02339   if(cfgnum!=kDogwood1_Daikon07_v2){
02340     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Should not be loading errors "
02341                                           <<"with this configuration, you "
02342                                           <<"need Dogwood1Daikon07_v2." << endl;
02343     return;
02344   }
02345   TFile* f = GetBeamSysFile(dir,rp);
02346   char name[200];
02347   // i==beam configuration
02348   // j==run period
02349   // k==detector
02350   for(int i=0;i<8;++i){
02351     if(i==3) continue; // No low intensity L010z185i in beam fit
02352     for(int j=0;j<3;++j){
02353       // Remove various beam configuration / run period combinations
02354       if(i==1 && j>0) continue;
02355       if(i==2 && j>1) continue;
02356       if(i==4 && j>0) continue;
02357       if(i==5 && j>0) continue;
02358       if(i==7 && j!=1) continue;
02359       for(int k=0;k<3;++k){
02360         sprintf(name,"NuMu_HadProdError[%d][%d][%d]",i,j,k);
02361         NuMu_HadProdError[i][j][k] = (TH1D*)f->Get(name);
02362         sprintf(name,"NuMuBar_HadProdError[%d][%d][%d]",i,j,k);
02363         NuMuBar_HadProdError[i][j][k] = (TH1D*)f->Get(name);
02364         sprintf(name,"NuE_HadProdError[%d][%d][%d]",i,j,k);
02365         NuE_HadProdError[i][j][k] = (TH1D*)f->Get(name);
02366         sprintf(name,"NuEBar_HadProdError[%d][%d][%d]",i,j,k);
02367         NuEBar_HadProdError[i][j][k] = (TH1D*)f->Get(name);
02368       }
02369     }
02370   }
02371   hadProdErrorsLoaded = true;
02372 }

void SKZPWeightCalculator::LoadHadProdErrors2012 ( const char *  dir = "",
RunPeriod_t  rp = kNone 
) [private]

Definition at line 2375 of file SKZPWeightCalculator.cxx.

References cfgnum, GetBeamSysFile(), hadProdErrors2012Loaded, kDogwood5_Daikon07_2012, Msg::kInfo, kMINOSplus_2014, kMINOSplus_2014_v2, kMINOSplus_2018, MSG, NuE_HadProdError2012, NuEBar_HadProdError2012, NuMu_HadProdError2012, and NuMuBar_HadProdError2012.

Referenced by GetHadProdError2012().

02376 {
02377   if(cfgnum!=kDogwood5_Daikon07_2012 && cfgnum!=kMINOSplus_2014 && cfgnum!=kMINOSplus_2014_v2 && cfgnum!=kMINOSplus_2018){
02378     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Should not be loading errors "
02379                                           <<"with this configuration, you "
02380                                           <<"need Dogwood5Daikon07_2012 or MINOSplus_2014(_v2)." << endl;
02381     return;
02382   }
02383   TFile* f = GetBeamSysFile(dir,rp);
02384   char name[200];
02385   // i==beam configuration
02386   // j==run period
02387   // k==detector
02388   for(int i=0;i<12;++i){
02389     if(i==3||i==8||i==9) continue; // No low intensity L010z185i in beam fit
02390     for(int j=0;j<4;++j){
02391       // Remove various beam configuration / run period combinations
02392       if(i==1 && j>0) continue;
02393       if(i==2 && j>1) continue;
02394       if(i==4 && j>0) continue;
02395       if(i==5 && j>0) continue;
02396       if(i==7 && j!=1) continue;
02397       if(i==10 && j>0) continue;  //MINOS+ only has one run for M000z200 at present
02398       if(i==11 && j>0) continue;  //MINOS+ only has one run for M000z000 at present
02399       for(int k=0;k<3;++k){
02400         sprintf(name,"NuMu_HadProdError2012[%d][%d][%d]",i,j,k);
02401         NuMu_HadProdError2012[i][j][k] = (TH1D*)f->Get(name);
02402         sprintf(name,"NuMuBar_HadProdError2012[%d][%d][%d]",i,j,k);
02403         NuMuBar_HadProdError2012[i][j][k] = (TH1D*)f->Get(name);
02404         sprintf(name,"NuE_HadProdError2012[%d][%d][%d]",i,j,k);
02405         NuE_HadProdError2012[i][j][k] = (TH1D*)f->Get(name);
02406         sprintf(name,"NuEBar_HadProdError2012[%d][%d][%d]",i,j,k);
02407         NuEBar_HadProdError2012[i][j][k] = (TH1D*)f->Get(name);
02408       }
02409     }
02410   }
02411   hadProdErrors2012Loaded = true;
02412 }

void SKZPWeightCalculator::LoadHGweights ( const char *  dir = ""  )  [private]

Definition at line 2644 of file SKZPWeightCalculator.cxx.

References AntiNu_FD_HGW_M02V1, AntiNu_FN_HGW_M02V1, AntiNu_ND_HGW_M02V1, cfgnum, GetHGweightsFile(), HGweightsLoaded, Msg::kInfo, kMINOSplus_2014, kMINOSplus_2014_v2, kMINOSplus_2018, MSG, Nu_FD_HGW_M02V1, Nu_FN_HGW_M02V1, and Nu_ND_HGW_M02V1.

Referenced by GetHGweight().

02645 {
02646   if(cfgnum!=kMINOSplus_2014 && cfgnum!=kMINOSplus_2014_v2 && cfgnum!=kMINOSplus_2018){
02647     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Should not be loading HG weights "
02648                                           <<"with this configuration, you need"
02649                                           <<" MINOSplus_2014 or later"
02650                                           <<" (unless you are running beam fits"
02651                                           <<" and need them right now)."
02652                                           << endl;
02653     return;
02654   }
02655 
02656   TFile* f=0;
02657 
02658   f=GetHGweightsFile(dir);
02659   MSG("SKZPWeightCalculator",Msg::kInfo)<<"Got HG Weights 2018 file. "
02660                                           <<endl;
02661 
02662   Nu_ND_HGW_M02V1 = (TH1D*)f->Get("Nu_ND_HGW_M02V1");
02663   Nu_FD_HGW_M02V1 = (TH1D*)f->Get("Nu_FD_HGW_M02V1");
02664   Nu_FN_HGW_M02V1 = (TH1D*)f->Get("Nu_FN_HGW_M02V1");
02665   AntiNu_ND_HGW_M02V1 = (TH1D*)f->Get("AntiNu_ND_HGW_M02V1");
02666   AntiNu_FD_HGW_M02V1 = (TH1D*)f->Get("AntiNu_FD_HGW_M02V1");
02667   AntiNu_FN_HGW_M02V1 = (TH1D*)f->Get("AntiNu_FN_HGW_M02V1");
02668   HGweightsLoaded = true;
02669 
02670   MSG("SKZPWeightCalculator",Msg::kInfo)<<"HGweightLoaded =  "<<HGweightsLoaded<<endl;
02671 
02672 }

void SKZPWeightCalculator::LoadMaterialErrors ( const char *  dir = "",
RunPeriod_t  rp = kNone 
) [private]

Definition at line 2490 of file SKZPWeightCalculator.cxx.

References cfgnum, GetBeamSysFile(), kDogwood1_Daikon07_v2, kDogwood5_Daikon07_2012, Msg::kInfo, kMINOSplus_2014, kMINOSplus_2014_v2, kMINOSplus_2018, materialErrorsLoaded, MSG, NuE_MaterialError, NuEBar_MaterialError, NuMu_MaterialError, and NuMuBar_MaterialError.

Referenced by GetMaterialError().

02491 {
02492   if(cfgnum!=kDogwood1_Daikon07_v2&&cfgnum!=kDogwood5_Daikon07_2012 && cfgnum!=kMINOSplus_2014 && cfgnum!=kMINOSplus_2014_v2 && cfgnum!=kMINOSplus_2018){
02493     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Should not be loading errors "
02494                                           <<"with this configuration, you "
02495                                           <<"need Dogwood1Daikon07_v2 or Dogwood5Daikon07_2012 or MINOSplus_2014(_v2)" << endl;
02496     return;
02497   }
02498   TFile* f = GetBeamSysFile(dir,rp);
02499   char name[200];
02500   // i==beam configuration
02501   // j==run period
02502   // k==detector
02503   for(int i=0;i<12;++i){
02504     if(i==1 || i==3 || i==4 || i==5 || i==7 || i==8 || i==9) continue;
02505     for(int j=0;j<3;++j){
02506       if(i==2 && j==2) continue;
02507       if(i==10 && j>0) continue;  //MINOS+ only has one run for M000z200 at present
02508       if(i==11 && j>0) continue;  //MINOS+ only has one run for M000z000 at present
02509       for(int k=0;k<3;++k){
02510         sprintf(name,"NuMu_MaterialError[%d][%d][%d]",i,j,k);
02511         NuMu_MaterialError[i][j][k] = (TH1D*)f->Get(name);
02512         sprintf(name,"NuMuBar_MaterialError[%d][%d][%d]",i,j,k);
02513         NuMuBar_MaterialError[i][j][k] = (TH1D*)f->Get(name);
02514         sprintf(name,"NuE_MaterialError[%d][%d][%d]",i,j,k);
02515         NuE_MaterialError[i][j][k] = (TH1D*)f->Get(name);
02516         sprintf(name,"NuEBar_MaterialError[%d][%d][%d]",i,j,k);
02517         NuEBar_MaterialError[i][j][k] = (TH1D*)f->Get(name);
02518       }
02519     }
02520   }
02521   materialErrorsLoaded = true;
02522 }

void SKZPWeightCalculator::LoadOpticsErrors ( const char *  dir = "",
RunPeriod_t  rp = kNone 
) [private]

Definition at line 2416 of file SKZPWeightCalculator.cxx.

References cfgnum, GetBeamSysFile(), kDogwood1_Daikon07_v2, kDogwood5_Daikon07_2012, Msg::kInfo, kMINOSplus_2014, kMINOSplus_2014_v2, kMINOSplus_2018, MSG, NuE_OpticsError, NuEBar_OpticsError, NuMu_OpticsError, NuMuBar_OpticsError, and opticsErrorsLoaded.

Referenced by GetOpticsError().

02417 {
02418   if(cfgnum!=kDogwood1_Daikon07_v2&&cfgnum!=kDogwood5_Daikon07_2012 && cfgnum!=kMINOSplus_2014 && cfgnum!=kMINOSplus_2014_v2 && cfgnum!=kMINOSplus_2018){
02419     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Should not be loading errors "
02420                                           <<"with this configuration, you "
02421                                           <<"need Dogwood1Daikon07_v2 or Dogwood5Daikon07_2012 or MINOSplus_2014(_v2)" << endl;
02422     return;
02423   }
02424   TFile* f = GetBeamSysFile(dir,rp);
02425   char name[200];
02426   // i==beam configuration
02427   // j==run period
02428   // k==detector
02429   for(int i=0;i<12;++i){
02430     if(i==3||i==8||i==9) continue; // No low intensity L010z185i in beam fit
02431     for(int j=0;j<3;++j){
02432       // Remove various beam configuration / run period combinations
02433       if(i==1 && j>0) continue;
02434       if(i==2 && j>1) continue;
02435       if(i==4 && j>0) continue;
02436       if(i==5 && j>0) continue;
02437       if(i==7 && j!=1) continue;
02438       if(i==10 && j>0) continue;  //MINOS+ only has one run for M000z200 at present
02439       if(i==11 && j>0) continue;  //MINOS+ only has one run for M000z000 at present
02440       for(int k=0;k<3;++k){
02441         sprintf(name,"NuMu_OpticsError[%d][%d][%d]",i,j,k);
02442         NuMu_OpticsError[i][j][k] = (TH1D*)f->Get(name);
02443         sprintf(name,"NuMuBar_OpticsError[%d][%d][%d]",i,j,k);
02444         NuMuBar_OpticsError[i][j][k] = (TH1D*)f->Get(name);
02445         sprintf(name,"NuE_OpticsError[%d][%d][%d]",i,j,k);
02446         NuE_OpticsError[i][j][k] = (TH1D*)f->Get(name);
02447         sprintf(name,"NuEBar_OpticsError[%d][%d][%d]",i,j,k);
02448         NuEBar_OpticsError[i][j][k] = (TH1D*)f->Get(name);
02449       }
02450     }
02451   }
02452   opticsErrorsLoaded = true;
02453 }

void SKZPWeightCalculator::LoadTargetZErrors ( const char *  dir = "",
RunPeriod_t  rp = kNone 
) [private]

Definition at line 2456 of file SKZPWeightCalculator.cxx.

References cfgnum, GetBeamSysFile(), kDogwood1_Daikon07_v2, kDogwood5_Daikon07_2012, Msg::kInfo, kMINOSplus_2014, kMINOSplus_2014_v2, kMINOSplus_2018, MSG, NuMu_TargetZError, and targetZErrorsLoaded.

Referenced by GetTargetZError().

02457 {
02458   if(cfgnum!=kDogwood1_Daikon07_v2&&cfgnum!=kDogwood5_Daikon07_2012 && cfgnum!=kMINOSplus_2014 && cfgnum!=kMINOSplus_2014_v2 && cfgnum!=kMINOSplus_2018){
02459     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Should not be loading errors "
02460                                           <<"with this configuration, you "
02461                                           <<"need Dogwood1Daikon07_v2 or Dogwood5Daikon07_2012 or MINOSplus_2014(_v2)" << endl;
02462     return;
02463   }
02464   TFile* f = GetBeamSysFile(dir,rp);
02465   char name[200];
02466   // i==beam configuration
02467   // j==run period
02468   // k==detector
02469   for(int i=0;i<12;++i){
02470     if(i==3||i==8||i==9) continue; // No low intensity L010z185i in beam fit
02471     for(int j=0;j<3;++j){
02472       // Remove various beam configuration / run period combinations
02473       if(i==1 && j>0) continue;
02474       if(i==2 && j>1) continue;
02475       if(i==4 && j>0) continue;
02476       if(i==5 && j>0) continue;
02477       if(i==7 && j!=1) continue;
02478       if(i==10 && j>0) continue;  //MINOS+ only has one run for M000z200 at present
02479       if(i==11 && j>0) continue;  //MINOS+ only has one run for M000z000 at present
02480       for(int k=0;k<3;++k){
02481         sprintf(name,"NuMu_TargetZError[%d][%d][%d]",i,j,k);
02482         NuMu_TargetZError[i][j][k] = (TH1D*)f->Get(name);
02483       }
02484     }
02485   }
02486   targetZErrorsLoaded = true;
02487 }

void SKZPWeightCalculator::PrintReweightConfig ( ostream &  o  )  [virtual]

Definition at line 1276 of file SKZPWeightCalculator.cxx.

References bs_pars, cfgname, det_pars, and hp_pars.

Referenced by NueStandard::GetSKZPBeamWeight(), NuZBeamReweight::GetSKZPWeightCalculator(), NuZBeamReweight::GetSKZPWeightCalculator2018(), and NuZBeamReweight::GetSKZPWeightCalculatorCustom().

01277 {
01278   o<<"Reweighting to : "<<cfgname<<endl;
01279   for(unsigned int i=0;i<bs_pars.size();i++){
01280     o<<"Beam Sys par "<<i<<" "<<bs_pars[i]<<endl;
01281   }
01282   for(unsigned int i=0;i<hp_pars.size();i++){
01283     o<<"Had. Prod par "<<i<<" "<<hp_pars[i]<<endl;
01284   }
01285   for(unsigned int i=0;i<det_pars.size();i++){
01286     o<<"Det par "<<i<<" "<<det_pars[i]<<endl;
01287   }
01288 }

RunPeriod_t SKZPWeightCalculator::RunPeriodFromInt ( int  rpit  )  [inline]

Definition at line 72 of file SKZPWeightCalculator.h.

References kNone, kRunI, kRunII, kRunIII, kRunIV, kRunIX, kRunV, kRunVI, kRunVII, kRunVIII, kRunX, kRunXI, kRunXII, and kRunXIII.

Referenced by NueFluxWeightsAna::Analyze(), GetBeamWeight(), GetDecayError(), GetDecayModelError(), GetFluxError(), GetHadProdError(), GetHadProdError2012(), GetMaterialError(), GetOpticsError(), GetRunPeriodWeight(), GetTargetZError(), and GetWeight().

00072                                         {
00073     switch (rpit){
00074     case 1:
00075       return kRunI;
00076     case 2:
00077       return kRunII;
00078     case 3:
00079       return kRunIII;
00080     case 4:
00081       return kRunIV;
00082     case 5:
00083       return kRunV;
00084     case 6:
00085       return kRunVI;
00086     case 7:
00087       return kRunVII;
00088     case 8:
00089       return kRunVIII;
00090     case 9:
00091       return kRunIX;
00092     case 10:
00093       return kRunX;
00094     case 11:
00095       return kRunXI;
00096     case 12:
00097       return kRunXII;
00098     case 13:
00099       return kRunXIII;
00100     default:
00101       return kNone;
00102     }
00103   }

int SKZPWeightCalculator::RunPeriodIntFromValidity ( VldContext  vc  ) 

Definition at line 1511 of file SKZPWeightCalculator.cxx.

References VldTimeStamp::GetDate(), and VldContext::GetTimeStamp().

Referenced by GetBeamWeight(), GetDecayError(), GetDecayModelError(), GetFluxError(), GetHadProdError(), GetHadProdError2012(), GetMaterialError(), GetOpticsError(), GetRunPeriodWeight(), GetTargetZError(), and GetWeight().

01512 {
01513   int rp = 1; // default Run I
01514   VldTimeStamp ts = vc.GetTimeStamp();
01515   if(ts.GetDate()<(*vtsRunIEnd).GetDate()) rp = 1;
01516   else if(ts.GetDate()<(*vtsRunIIEnd).GetDate()) rp = 2;
01517   else if(ts.GetDate()<(*vtsRunIIIEnd).GetDate()) rp = 3;
01518   else if(ts.GetDate()<(*vtsRunIVEnd).GetDate()) rp = 4;
01519   else if(ts.GetDate()<(*vtsRunVEnd).GetDate()) rp = 5;
01520   else if(ts.GetDate()<(*vtsRunVIEnd).GetDate()) rp = 6;
01521   else if(ts.GetDate()<(*vtsRunVIIEnd).GetDate()) rp = 7;
01522   else if(ts.GetDate()<(*vtsRunVIIIEnd).GetDate()) rp = 8;
01523   else if(ts.GetDate()<(*vtsRunIXEnd).GetDate()) rp = 9;
01524   else if(ts.GetDate()<(*vtsRunXEnd).GetDate()) rp = 10;
01525   else rp = 11;
01526   return rp;
01527 }

void SKZPWeightCalculator::SetConfigNum ( std::string  c  )  [private]

Referenced by Config(), and SetReweightConfigName().

void SKZPWeightCalculator::SetReweightConfigName ( std::string  cn  )  [inline]

Definition at line 155 of file SKZPWeightCalculator.h.

References cfgname, and SetConfigNum().

00155 {cfgname=cn; SetConfigNum(cn);}

void SKZPWeightCalculator::SetRunFrac ( int  Ibeam,
RunPeriod_t  rp,
double  pot 
)

Definition at line 1921 of file SKZPWeightCalculator.cxx.

References bfld::AsString(), BeamType::FromZarko(), it, Msg::kError, Munits::m, MSG, and runfrac.

Referenced by NuZBeamReweight::GetSKZPWeightCalculator(), NuZBeamReweight::GetSKZPWeightCalculator2018(), and NuZBeamReweight::GetSKZPWeightCalculatorCustom().

01922 {
01923 
01924   map<int, map<RunPeriod_t,double> >::iterator it(runfrac.find(Ibeam));
01925   if(it!=runfrac.end()){
01926     //already have an entry for this beam type, just insert (runnum,pot)
01927     if((it->second).find(rp)==it->second.end()){
01928       (it->second)[rp]=pot;
01929     }
01930     else{
01931       MSG("SKZPWeightCalculator",Msg::kError)<<"You already specified pot for "
01932                                              <<BeamType::AsString(BeamType::FromZarko(Ibeam))
01933                                              <<" beam, with run period "<<rp<<endl
01934                                              <<"I will not overwrite!!!"<<endl;
01935     } 
01936   }
01937   else{
01938     //don't have this Ibeam yet, make a new map
01939     map<RunPeriod_t, double> m;
01940     m[rp]=pot;
01941     runfrac[Ibeam]=m;
01942   }
01943 
01944 
01945 }

void SKZPWeightCalculator::SetSampleSelection ( std::string  ss  ) 

Definition at line 537 of file SKZPWeightCalculator.cxx.

References kAntiNuMu, kNue, kNuMuCC, and sampsel.

Referenced by NuZBeamReweight::GetWeights().

00538 {
00539   if(ss=="numu"||ss=="NuMu"||ss=="CC"){
00540     sampsel=kNuMuCC;
00541   }
00542   else if(ss=="anumu"||ss=="antinumu"||ss=="numubar"||ss=="AntiNuMu"||ss=="NuMuBar"){
00543     sampsel=kAntiNuMu;
00544   }
00545   else if(ss=="nue"||ss=="Nue"){
00546     sampsel=kNue;
00547   }
00548 
00549 }


Member Data Documentation

Definition at line 539 of file SKZPWeightCalculator.h.

Referenced by GetAPSweight(), LoadAPSweights(), and ~SKZPWeightCalculator().

Definition at line 549 of file SKZPWeightCalculator.h.

Referenced by GetHGweight(), LoadHGweights(), and ~SKZPWeightCalculator().

Definition at line 540 of file SKZPWeightCalculator.h.

Referenced by LoadAPSweights(), and ~SKZPWeightCalculator().

Definition at line 550 of file SKZPWeightCalculator.h.

Referenced by LoadHGweights(), and ~SKZPWeightCalculator().

Definition at line 538 of file SKZPWeightCalculator.h.

Referenced by GetAPSweight(), LoadAPSweights(), and ~SKZPWeightCalculator().

Definition at line 548 of file SKZPWeightCalculator.h.

Referenced by GetHGweight(), LoadHGweights(), and ~SKZPWeightCalculator().

Definition at line 515 of file SKZPWeightCalculator.h.

Referenced by GetAPSweight(), LoadAPSweights(), and ~SKZPWeightCalculator().

std::vector<double> SKZPWeightCalculator::bs_pars [private]
std::string SKZPWeightCalculator::cfgname [private]

Definition at line 495 of file SKZPWeightCalculator.h.

Referenced by GetDecayError(), LoadDecayErrors(), and ~SKZPWeightCalculator().

std::vector<double> SKZPWeightCalculator::det_pars [private]

Definition at line 429 of file SKZPWeightCalculator.h.

Referenced by Config(), GetDetWeight(), and PrintReweightConfig().

Definition at line 454 of file SKZPWeightCalculator.h.

Referenced by Config(), and GetDetWeight().

std::string SKZPWeightCalculator::fTopDir [private]

Definition at line 543 of file SKZPWeightCalculator.h.

Referenced by GetHGweight(), LoadHGweights(), and ~SKZPWeightCalculator().

std::vector<double> SKZPWeightCalculator::hp_pars [private]

Definition at line 428 of file SKZPWeightCalculator.h.

Referenced by Config(), GetBeamWeight(), and PrintReweightConfig().

Definition at line 405 of file SKZPWeightCalculator.h.

Referenced by Config().

Definition at line 407 of file SKZPWeightCalculator.h.

Referenced by Config().

Definition at line 406 of file SKZPWeightCalculator.h.

Referenced by Config().

Definition at line 424 of file SKZPWeightCalculator.h.

Referenced by Config(), GetDetWeight(), and SKZPWeightCalculator().

Definition at line 536 of file SKZPWeightCalculator.h.

Referenced by GetAPSweight(), LoadAPSweights(), and ~SKZPWeightCalculator().

Definition at line 546 of file SKZPWeightCalculator.h.

Referenced by GetHGweight(), LoadHGweights(), and ~SKZPWeightCalculator().

Definition at line 537 of file SKZPWeightCalculator.h.

Referenced by LoadAPSweights(), and ~SKZPWeightCalculator().

Definition at line 547 of file SKZPWeightCalculator.h.

Referenced by LoadHGweights(), and ~SKZPWeightCalculator().

Definition at line 535 of file SKZPWeightCalculator.h.

Referenced by GetAPSweight(), LoadAPSweights(), and ~SKZPWeightCalculator().

Definition at line 545 of file SKZPWeightCalculator.h.

Referenced by GetHGweight(), LoadHGweights(), and ~SKZPWeightCalculator().

TH1D* SKZPWeightCalculator::NuE_DecayError[12][3][3] [private]
TH1D* SKZPWeightCalculator::NuE_DecayModelError[12][3][3] [private]
TH1D* SKZPWeightCalculator::NuE_HadProdError[12][3][3] [private]
TH1D* SKZPWeightCalculator::NuE_HadProdError2012[12][4][3] [private]
TH1D* SKZPWeightCalculator::NuE_MaterialError[12][3][3] [private]
TH1D* SKZPWeightCalculator::NuE_OpticsError[12][3][3] [private]
TH1D* SKZPWeightCalculator::NuEBar_DecayError[12][3][3] [private]
TH1D* SKZPWeightCalculator::NuEBar_HadProdError[12][3][3] [private]
TH1D* SKZPWeightCalculator::NuEBar_MaterialError[12][3][3] [private]
TH1D* SKZPWeightCalculator::NuEBar_OpticsError[12][3][3] [private]
TH1D* SKZPWeightCalculator::NuMu_DecayError[12][3][3] [private]
TH1D* SKZPWeightCalculator::NuMu_DecayModelError[12][3][3] [private]
TH1D* SKZPWeightCalculator::NuMu_HadProdError[12][3][3] [private]
TH1D* SKZPWeightCalculator::NuMu_MaterialError[12][3][3] [private]
TH1D* SKZPWeightCalculator::NuMu_OpticsError[12][3][3] [private]
TH1D* SKZPWeightCalculator::NuMu_TargetZError[12][3][3] [private]
TH1D* SKZPWeightCalculator::NuMuBar_DecayError[12][3][3] [private]
TH1D* SKZPWeightCalculator::NuMuBar_HadProdError[12][3][3] [private]
TH1D* SKZPWeightCalculator::NuMuBar_OpticsError[12][3][3] [private]

Definition at line 425 of file SKZPWeightCalculator.h.

Referenced by Config(), SKZPWeightCalculator(), and ~SKZPWeightCalculator().

Definition at line 477 of file SKZPWeightCalculator.h.

Referenced by GetOpticsError(), LoadOpticsErrors(), and ~SKZPWeightCalculator().

Definition at line 409 of file SKZPWeightCalculator.h.

Referenced by Config().

std::map<int, std::map<RunPeriod_t,double> > SKZPWeightCalculator::runfrac [private]

Definition at line 435 of file SKZPWeightCalculator.h.

Referenced by GetRFWWeight(), and SetRunFrac().

Definition at line 417 of file SKZPWeightCalculator.h.

Referenced by GetDetWeight(), and SetSampleSelection().

Definition at line 138 of file SKZPWeightCalculator.h.

Referenced by SKZPWeightCalculator(), and ~SKZPWeightCalculator().

Definition at line 139 of file SKZPWeightCalculator.h.

Referenced by SKZPWeightCalculator(), and ~SKZPWeightCalculator().

Definition at line 140 of file SKZPWeightCalculator.h.

Referenced by SKZPWeightCalculator(), and ~SKZPWeightCalculator().

Definition at line 141 of file SKZPWeightCalculator.h.

Referenced by SKZPWeightCalculator(), and ~SKZPWeightCalculator().

Definition at line 146 of file SKZPWeightCalculator.h.

Referenced by SKZPWeightCalculator(), and ~SKZPWeightCalculator().

Definition at line 142 of file SKZPWeightCalculator.h.

Referenced by SKZPWeightCalculator(), and ~SKZPWeightCalculator().

Definition at line 143 of file SKZPWeightCalculator.h.

Referenced by SKZPWeightCalculator(), and ~SKZPWeightCalculator().

Definition at line 144 of file SKZPWeightCalculator.h.

Referenced by SKZPWeightCalculator(), and ~SKZPWeightCalculator().

Definition at line 145 of file SKZPWeightCalculator.h.

Referenced by SKZPWeightCalculator(), and ~SKZPWeightCalculator().

Definition at line 147 of file SKZPWeightCalculator.h.

Referenced by SKZPWeightCalculator(), and ~SKZPWeightCalculator().

Definition at line 148 of file SKZPWeightCalculator.h.

Referenced by SKZPWeightCalculator(), and ~SKZPWeightCalculator().

Definition at line 149 of file SKZPWeightCalculator.h.

Referenced by SKZPWeightCalculator(), and ~SKZPWeightCalculator().

const double SKZPWeightCalculator::XP = 25. [static, private]

Definition at line 431 of file SKZPWeightCalculator.h.

Referenced by GetDetWeight().


The documentation for this class was generated from the following files:

Generated on 15 Nov 2018 for loon by  doxygen 1.6.1