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
}
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, 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="")
void LoadHadProdErrors (const char *dir="")
void LoadHadProdErrors2012 (const char *dir="")
void LoadOpticsErrors (const char *dir="")
void LoadTargetZErrors (const char *dir="")
void LoadMaterialErrors (const char *dir="")
void LoadDecayErrors (const char *dir="")
void LoadDecayModelErrors (const char *dir="")
TFile * GetAPSweightsFile (const char *dir="")
void LoadAPSweights (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

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 38 of file SKZPWeightCalculator.h.

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

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

Definition at line 53 of file SKZPWeightCalculator.h.

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

Enumerator:
kNotSpecified 
kNuMuCC 
kAntiNuMu 
kNue 

Definition at line 46 of file SKZPWeightCalculator.h.

00046                                 {
00047     kNotSpecified=0,
00048     kNuMuCC=1,
00049     kAntiNuMu=2,
00050     kNue=3
00051   } 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 

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   } 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 220 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, APSweightsLoaded, decayErrorsLoaded, decayModelErrorsLoaded, hadProdErrors2012Loaded, hadProdErrorsLoaded, materialErrorsLoaded, 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, opticsErrorsLoaded, targetZErrorsLoaded, vtsRunIEnd, vtsRunIIEnd, vtsRunIIIEnd, vtsRunIVEnd, vtsRunIXEnd, vtsRunVEnd, vtsRunVIEnd, vtsRunVIIEnd, vtsRunVIIIEnd, vtsRunXEnd, vtsRunXIEnd, vtsRunXIIEnd, zbeam, and zfluk.

00221 {
00222 
00223   for(int i=0;i<12;++i){
00224     for(int j=0;j<3;++j){
00225       for(int k=0;k<3;++k){
00226         delete NuMu_HadProdError[i][j][k];
00227         delete NuMuBar_HadProdError[i][j][k];
00228         delete NuE_HadProdError[i][j][k];
00229         delete NuEBar_HadProdError[i][j][k];
00230         delete NuMu_OpticsError[i][j][k];
00231         delete NuMuBar_OpticsError[i][j][k];
00232         delete NuE_OpticsError[i][j][k];
00233         delete NuEBar_OpticsError[i][j][k];
00234         delete NuMu_TargetZError[i][j][k];
00235         delete NuMu_MaterialError[i][j][k];
00236         delete NuMuBar_MaterialError[i][j][k];
00237         delete NuE_MaterialError[i][j][k];
00238         delete NuEBar_MaterialError[i][j][k];
00239         delete NuMu_DecayError[i][j][k];
00240         delete NuMuBar_DecayError[i][j][k];
00241         delete NuE_DecayError[i][j][k];
00242         delete NuEBar_DecayError[i][j][k];
00243         delete NuMu_DecayModelError[i][j][k];
00244         delete NuMuBar_DecayModelError[i][j][k];
00245         delete NuE_DecayModelError[i][j][k];
00246         delete NuEBar_DecayModelError[i][j][k];
00247 
00248         NuMu_HadProdError[i][j][k] = 0;
00249         NuMuBar_HadProdError[i][j][k] = 0;
00250         NuE_HadProdError[i][j][k] = 0;
00251         NuEBar_HadProdError[i][j][k] = 0;
00252         NuMu_OpticsError[i][j][k] = 0;
00253         NuMuBar_OpticsError[i][j][k] = 0;
00254         NuE_OpticsError[i][j][k] = 0;
00255         NuEBar_OpticsError[i][j][k] = 0;
00256         NuMu_TargetZError[i][j][k] = 0;
00257         NuMu_MaterialError[i][j][k] = 0;
00258         NuMuBar_MaterialError[i][j][k] = 0;
00259         NuE_MaterialError[i][j][k] = 0;
00260         NuEBar_MaterialError[i][j][k] = 0;
00261         NuMu_DecayError[i][j][k] = 0;
00262         NuMuBar_DecayError[i][j][k] = 0;
00263         NuE_DecayError[i][j][k] = 0;
00264         NuEBar_DecayError[i][j][k] = 0;
00265         NuMu_DecayModelError[i][j][k] = 0;
00266         NuMuBar_DecayModelError[i][j][k] = 0;
00267         NuE_DecayModelError[i][j][k] = 0;
00268         NuEBar_DecayModelError[i][j][k] = 0;
00269       }
00270     }
00271   }
00272 
00273 
00274   for(int i=0;i<12;++i){
00275     for(int j=0;j<4;++j){
00276       for(int k=0;k<3;++k){
00277         delete NuMu_HadProdError2012[i][j][k];
00278         delete NuMuBar_HadProdError2012[i][j][k];
00279         delete NuE_HadProdError2012[i][j][k];
00280         delete NuEBar_HadProdError2012[i][j][k];
00281 
00282         NuMu_HadProdError2012[i][j][k] = 0;
00283         NuMuBar_HadProdError2012[i][j][k] = 0;
00284         NuE_HadProdError2012[i][j][k] = 0;
00285         NuEBar_HadProdError2012[i][j][k] = 0;
00286       }
00287     }
00288   }
00289 
00290   //APS hists - Anna
00291  delete Nu_ND_APSW_M00V4;
00292  delete Nu_FD_APSW_M00V4;
00293  delete Nu_FN_APSW_M00V4;
00294  delete AntiNu_ND_APSW_M00V4;
00295  delete AntiNu_FD_APSW_M00V4;
00296  delete AntiNu_FN_APSW_M00V4;
00297  delete Nu_ND_APSW_M02V4;
00298  delete Nu_FD_APSW_M02V4;
00299  delete Nu_FN_APSW_M02V4;
00300  delete AntiNu_ND_APSW_M02V4;
00301  delete AntiNu_FD_APSW_M02V4;
00302  delete AntiNu_FN_APSW_M02V4;
00303  delete Nu_ND_APSW_M02V5;
00304  delete Nu_FD_APSW_M02V5;
00305  delete Nu_FN_APSW_M02V5;
00306  delete AntiNu_ND_APSW_M02V5;
00307  delete AntiNu_FD_APSW_M02V5;
00308  delete AntiNu_FN_APSW_M02V5;
00309 
00310   Nu_ND_APSW_M00V4 = 0;
00311   Nu_FD_APSW_M00V4 = 0;
00312   Nu_FN_APSW_M00V4 = 0;
00313   AntiNu_ND_APSW_M00V4 = 0;
00314   AntiNu_FD_APSW_M00V4 = 0;
00315   AntiNu_FN_APSW_M00V4 = 0;
00316   Nu_ND_APSW_M02V4 = 0;
00317   Nu_FD_APSW_M02V4 = 0;
00318   Nu_FN_APSW_M02V4 = 0;
00319   AntiNu_ND_APSW_M02V4 = 0;
00320   AntiNu_FD_APSW_M02V4 = 0;
00321   AntiNu_FN_APSW_M02V4 = 0;
00322   Nu_ND_APSW_M02V5 = 0;
00323   Nu_FD_APSW_M02V5 = 0;
00324   Nu_FN_APSW_M02V5 = 0;
00325   AntiNu_ND_APSW_M02V5 = 0;
00326   AntiNu_FD_APSW_M02V5 = 0;
00327   AntiNu_FN_APSW_M02V5 = 0;
00328 
00329 
00330   hadProdErrorsLoaded = false;
00331   hadProdErrors2012Loaded = false;
00332   opticsErrorsLoaded = false;
00333   targetZErrorsLoaded = false;
00334   materialErrorsLoaded = false;
00335   decayErrorsLoaded = false;
00336   decayModelErrorsLoaded = false;
00337   APSweightsLoaded = false;
00338 
00339   delete vtsRunIEnd;
00340   vtsRunIEnd=0;
00341   delete vtsRunIIEnd;
00342   vtsRunIIEnd=0;
00343   delete vtsRunIIIEnd;
00344   vtsRunIIIEnd=0;
00345   delete vtsRunIVEnd;
00346   vtsRunIVEnd=0;
00347   delete vtsRunVEnd;
00348   vtsRunVEnd=0;
00349   delete vtsRunVIEnd;
00350   vtsRunVIEnd=0;
00351   delete vtsRunVIIEnd;
00352   vtsRunVIIEnd=0;
00353   delete vtsRunVIIIEnd;
00354   vtsRunVIIIEnd=0;
00355   delete vtsRunIXEnd;
00356   vtsRunIXEnd=0;
00357   delete vtsRunXEnd;
00358   vtsRunXEnd=0;
00359   delete vtsRunXIEnd;
00360   vtsRunXIEnd=0;
00361   delete vtsRunXIIEnd;
00362   vtsRunXIIEnd=0;
00363   delete zbeam;
00364   zbeam=0;
00365   delete zfluk;
00366   zfluk=0;
00367   delete nwc;
00368   nwc=0;
00369 
00370 }


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 372 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().

00373 {
00374   if(cfgname==""){
00375     cfgname="PRL";
00376     MSG("SKZPWeightCalculator",Msg::kInfo)<<"You did not specify a "
00377                                           <<"SKZPWeight configuration."
00378                                           <<" Setting ConfigName to :"
00379                                           <<cfgname<<endl;
00380     cfgnum=kPRL;
00381   }
00382   SetConfigNum(cfgname);
00383 
00384 
00385   if(!read_pars_from_db){
00386     MSG("SKZPWeightCalculator",Msg::kInfo)<<"You did not select to read in "
00387                                           <<"SKZP Fit parameters from the DB."
00388                                           <<" You must specify your "
00389                                           <<"own parameters"<<endl;
00390     return;
00391   }
00392 
00393   //retrieve appropriate constants from DB
00394   Registry reg;
00395   
00396   //  cout<<"Trying to get parameters from DB"<<endl;
00397   DbiConfigStream stream("SKZPWeights",cfgname.c_str());
00398   if(stream.IsEmpty()){
00399     MSG("SKZPWeightCalculator",Msg::kWarning)
00400       << "Could not find SKZP configuration: "
00401       << cfgname
00402       << " in database.  " << endl
00403       << "If you want to run without database access"
00404       << " construct the weight calculator"
00405       << " with false as second arg." << endl;
00406     MSG("SKZPWeightCalculator",Msg::kFatal) << "Now assert()" << endl;
00407     assert(false);
00408   }
00409   //  cout<<"made dbiconfigstream"<<endl;
00410   stream >> &reg;
00411 
00412   //  cout<<"Read registry from db, and it contains:"<<endl;
00413   //  reg.PrettyPrint(cout);
00414 
00415 
00416 
00417   //load information from registry to private data members
00418   double tmpd;
00419   for(int i=0;i<MAXBSPARS;i++){
00420     if(reg.Get(Form("bs_par_%d",i),tmpd)){
00421       bs_pars.push_back(tmpd);
00422     }
00423   }
00424 
00425   for(int i=0;i<MAXHPPARS;i++){
00426     if(reg.Get(Form("hp_par_%d",i),tmpd)){
00427       hp_pars.push_back(tmpd);
00428     }
00429   }
00430 
00431   for(int i=0;i<MAXDETPARS;i++){
00432     if(reg.Get(Form("det_par_%d",i),tmpd)){
00433       det_pars.push_back(tmpd);
00434     }
00435   }
00436 
00437   if(cfgnum==kPiMinus){
00438     zfluk->SetParameters(hp_pars);
00439   }
00440   if(cfgnum==kDetXs || cfgnum==kDogwood1_Daikon07 || cfgnum==kDogwood1_Daikon07_v2 || cfgnum==kDogwood5_Daikon07_2012 || cfgnum==kMINOSplus_2014 || cfgnum==kMINOSplus_2014_v2){
00441     zfluk->SetParameters(hp_pars);
00442 
00443     if(!fBeamOnly) {
00444       nwc = new NeugenWeightCalculator();
00445       nwc->SetOptimization(true);
00446       Registry *nwc_reg=new Registry;
00447       nwc_reg->UnLockValues();
00448       nwc_reg->UnLockKeys();
00449       nwc_reg->Clear();
00450       
00451       nwc_reg->Set("neugen:config_name","MODBYRS");
00452       nwc_reg->Set("neugen:config_no",4);
00453       nwc_reg->Set("neugen:use_scale_factors",1);
00454       nwc_reg->Set("neugen:ma_qe",1.1);
00455       nwc_reg->Set("neugen:ma_res",1.1); 
00456       
00457       // This is specific to MODBYRS v4 where we weight them 
00458       // by their 1 sigma error as given in docdb-2989
00459       
00460       double kno1_val=0.1; //for ri12 and ri42
00461       double kno2_val=0.3; //for ri22 and ri32
00462       double kno3_val=1.0; //for rij3 
00463     
00464       double kno1_err=0.1; //for rij2 
00465       double kno2_err=0.2; //for rij3
00466       
00467       double kno_shift=1;
00468       
00469       nwc_reg->Set("neugen:kno_r112",
00470                  (kno1_val+kno_shift*kno1_err)/(kno1_val));
00471       nwc_reg->Set("neugen:kno_r142",
00472                    (kno1_val+kno_shift*kno1_err)/(kno1_val));
00473       nwc_reg->Set("neugen:kno_r122",
00474                    (kno2_val+kno_shift*kno1_err)/(kno2_val));
00475       nwc_reg->Set("neugen:kno_r132",
00476                    (kno2_val+kno_shift*kno1_err)/(kno2_val));
00477       nwc_reg->Set("neugen:kno_r113",
00478                    (kno3_val+kno_shift*kno2_err)/(kno3_val));
00479       nwc_reg->Set("neugen:kno_r123",
00480                    (kno3_val+kno_shift*kno2_err)/(kno3_val));
00481       nwc_reg->Set("neugen:kno_r133",
00482                    (kno3_val+kno_shift*kno2_err)/(kno3_val));
00483       nwc_reg->Set("neugen:kno_r143",
00484                    (kno3_val+kno_shift*kno2_err)/(kno3_val));
00485       
00486       nwc_reg->LockValues();
00487       nwc_reg->LockKeys();
00488       nwc->SetReweightConfig(nwc_reg);
00489       mcr->AddWeightCalculator(nwc);
00490     }
00491   }
00492   string tmpcfgname=cfgname;
00493   if(tmpcfgname.find("PRL_Syst")!=string::npos){
00494     tmpcfgname="PRL";
00495   }
00496   zbeam->SetReweightConfig(tmpcfgname);
00497 }

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

Definition at line 3306 of file SKZPWeightCalculator.cxx.

References AntiNu_FD_APSW_M00V4, AntiNu_FD_APSW_M02V5, AntiNu_ND_APSW_M00V4, AntiNu_ND_APSW_M02V5, APSweightsLoaded, LoadAPSweights(), Nu_FD_APSW_M00V4, Nu_FD_APSW_M02V5, Nu_ND_APSW_M00V4, and Nu_ND_APSW_M02V5.

Referenced by GetBeamWeight().

03307 {
03308 
03309   if(!APSweightsLoaded) LoadAPSweights(dir);
03310 
03311   double weight=1.0;
03312 
03313   int i=Ibeam-2;
03314 
03315 
03316   if(i!=10&&i!=11) weight*=1.0;
03317   if(det!=1&&det!=2) weight*=1.0;
03318   if(inu!=14&&inu!=12&&inu!=-14&&inu!=-12) weight*=1.0;
03319 
03320 
03321   if(i==10||i==11){
03322 
03323     if(true_enu>=30.0) weight*=1.0;
03324     else if(true_enu<30.0) {
03325       if(det==1){    //Near Detector
03326         if(inu==14||inu==12){
03327           if(i==10) weight=Nu_ND_APSW_M02V5->GetBinContent(Nu_ND_APSW_M02V5->FindBin(true_enu));    //M000z200
03328           if(i==11) weight=Nu_ND_APSW_M00V4->GetBinContent(Nu_ND_APSW_M00V4->FindBin(true_enu));    //M000z000
03329         }
03330         if(inu==-14||inu==-12){
03331           if(i==10) weight=AntiNu_ND_APSW_M02V5->GetBinContent(AntiNu_ND_APSW_M02V5->FindBin(true_enu));    //M000z200
03332           if(i==11) weight=AntiNu_ND_APSW_M00V4->GetBinContent(AntiNu_ND_APSW_M00V4->FindBin(true_enu));    //M000z000
03333         }
03334       }
03335       if(det==2){    //Far Detector
03336         if(inu==14||inu==12){
03337           if(i==10) weight=Nu_FD_APSW_M02V5->GetBinContent(Nu_FD_APSW_M02V5->FindBin(true_enu));    //M000z200
03338           if(i==11) weight=Nu_FD_APSW_M00V4->GetBinContent(Nu_FD_APSW_M00V4->FindBin(true_enu));    //M000z000
03339         }
03340         if(inu==-14||inu==-12){
03341           if(i==10) weight=AntiNu_FD_APSW_M02V5->GetBinContent(AntiNu_FD_APSW_M02V5->FindBin(true_enu));    //M000z200
03342           if(i==11) weight=AntiNu_FD_APSW_M00V4->GetBinContent(AntiNu_FD_APSW_M00V4->FindBin(true_enu));    //M000z000
03343         }
03344       }
03345     }
03346   }
03347 
03348 
03349   return weight;
03350 
03351 }

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

Definition at line 2108 of file SKZPWeightCalculator.cxx.

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

Referenced by LoadAPSweights().

02109 {
02110   // fTopDir is where the APS_weights2014.root file is located.
02111   fTopDir=dir; // user may set location of input data
02112   if(fTopDir=="") { // by default, this code looks in a standard place
02113     fTopDir="MCReweight/data";
02114     std::string base="";
02115     base=getenv("SRT_PRIVATE_CONTEXT");
02116     if (base!="" && base!=".")
02117       {
02118         // check if directory exists in SRT_PRIVATE_CONTEXT
02119         std::string path = base + "/" + fTopDir;
02120         void *dir_ptr = gSystem->OpenDirectory(path.c_str());
02121         if(!dir_ptr) base=getenv("SRT_PUBLIC_CONTEXT"); // if it doesn't exist then use SRT_PUBLIC_CONTEXT
02122       }
02123     else base=getenv("SRT_PUBLIC_CONTEXT");
02124 
02125     if(base=="") {
02126       MSG("SKZPWeightCalculator",Msg::kFatal)<<"No SRT_PUBLIC_CONTEXT set."<<std::endl;
02127       assert(false);
02128     }
02129     fTopDir = base+ "/" + fTopDir;
02130   }
02131   MSG("SKZPWeightCalculator",Msg::kDebug) << "Zbeam getting APS_weights2014.root hists from: "
02132                                           << fTopDir << " directory." << endl;
02133 
02134   TFile* f = new TFile(Form("%s/APS_weights2014.root",fTopDir.c_str()));
02135   if(f->IsZombie()) {
02136     MSG("SKZPWeightCalculator",Msg::kFatal)<<"Can't load APS Weights 2014 file. "
02137                                             << endl;
02138     return 0;
02139   }
02140 
02141     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Got APS Weights 2014 file. "
02142                                             << endl;
02143   return f;
02144 
02145 }

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

Definition at line 2069 of file SKZPWeightCalculator.cxx.

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

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

02070 {
02071 
02072   // fTopDir is where the beamsys_XYZ.root file is located.
02073   fTopDir=dir; // user may set location of input data
02074   if(fTopDir=="") { // by default, this code looks in a standard place
02075     fTopDir="MCReweight/data";
02076     std::string base="";
02077     base=getenv("SRT_PRIVATE_CONTEXT");
02078     if (base!="" && base!=".")
02079       {
02080         // check if directory exists in SRT_PRIVATE_CONTEXT
02081         std::string path = base + "/" + fTopDir;
02082         void *dir_ptr = gSystem->OpenDirectory(path.c_str());
02083         if(!dir_ptr) base=getenv("SRT_PUBLIC_CONTEXT"); // if it doesn't exist then use SRT_PUBLIC_CONTEXT
02084       }
02085     else base=getenv("SRT_PUBLIC_CONTEXT");
02086 
02087     if(base=="") {
02088       MSG("SKZPWeightCalculator",Msg::kFatal)<<"No SRT_PUBLIC_CONTEXT set."<<std::endl;
02089       assert(false);
02090     }
02091     fTopDir = base+ "/" + fTopDir;
02092   }
02093   MSG("SKZPWeightCalculator",Msg::kDebug) << "Zbeam getting beamsys_XYZ.root hists from: "
02094                                           << fTopDir << " directory." << endl;
02095 
02096   TFile* f = new TFile(Form("%s/beamsys_%s.root",fTopDir.c_str(),cfgname.c_str()));
02097   if(f->IsZombie()) {
02098     MSG("SKZPWeightCalculator",Msg::kFatal)<<"Can't load beamsys_XYZ file "
02099                                            <<Form("data/beamsys_%s.root",cfgname.c_str())
02100                                            <<"." << endl;
02101     return 0;
02102   }
02103   return f;
02104 
02105 }

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

Definition at line 253 of file SKZPWeightCalculator.h.

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

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

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 657 of file SKZPWeightCalculator.cxx.

References Zbeam::ZbeamData::beam, bs_pars, cfgnum, Zbeam::ZbeamData::detector, BeamType::FromZarko(), GetAPSweight(), GetRunPeriodWeight(), Zfluk::GetWeight(), Zbeam::GetWeight(), Zfluk::GetWeightBoston(), Zfluk::GetWeightMINOSplus(), Zfluk::GetWeightMINOSplus2(), Zfluk::GetWeightPRL(), hp_pars, IntFromRunPeriod(), BeamSys::kBaffleScraping, kBoston, kDetXs, kDogwood1_Daikon07, kDogwood1_Daikon07_v2, kDogwood5_Daikon07_2012, Detector::kFar, BeamSys::kHorn1Offset, BeamSys::kHornIDist, BeamSys::kHornIMiscal, Msg::kInfo, kMINOSplus_2014, kMINOSplus_2014_v2, 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().

00661 {
00662   //do the flux reweighting
00663 
00664 
00665   double beamsysw=1.;
00666   double hadpw=1.;
00667   double apsw=1.;
00668   if(cfgnum==kPRL){
00669     //to let zbeam know I want the PRL version of 
00670     //of it's weights, I'm passing the beam systematic
00671     //parameters parameters one by one
00672 
00673     //reweight for spot size in me and he
00674     //now done in RunPeriodWeight
00675     //    beamsysw*=zbeam->GetWeight(det,Ibeam,6,0,true_enu);   
00676     //horn 1 offset
00677     beamsysw*=zbeam->GetWeight(det,Ibeam,1,bs_pars[0],true_enu);
00678     //baffle scraping
00679     beamsysw*=zbeam->GetWeight(det,Ibeam,2,bs_pars[1],true_enu);
00680     //pot
00681     beamsysw*=zbeam->GetWeight(det,Ibeam,3,bs_pars[2],true_enu);
00682     //horn current miscalibration
00683     beamsysw*=zbeam->GetWeight(det,Ibeam,4,bs_pars[3],true_enu);
00684     //horn current distribution
00685     beamsysw*=zbeam->GetWeight(det,Ibeam,5,bs_pars[4],true_enu);
00686 
00687     //now change pt and pz
00688     double hp[7]={hp_pars[0],hp_pars[1],hp_pars[2],hp_pars[3],
00689                   hp_pars[4],hp_pars[5],hp_pars[6]};
00690     //to let zfluk know I want the PRL version of it's weights
00691     //I'm passing the hadron production parameters as an array
00692     hadpw = zfluk->GetWeightPRL(tptype,pt,pz,hp);
00693   }  
00694   else if(cfgnum==kBoston){ 
00695     //Boston version of zbeam takes a vector of beam systematic parameters
00696      //first 5 are for numu's
00697      //second 5 are for antinumu's
00698      vector<double> tmp_bs_pars;
00699      if(inu>0){
00700         for(int i=0;i<5;i++){
00701            tmp_bs_pars.push_back(bs_pars[i]);
00702         }
00703      }
00704      else{
00705         for(int i=0;i<5;i++){
00706            tmp_bs_pars.push_back(bs_pars[i+5]);
00707         }
00708      }
00709      beamsysw=zbeam->GetWeight(det,Ibeam,tmp_bs_pars,inu,true_enu);     
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      
00715      //updated version of zbeam takes a vector of hadron production parameters
00716      hadpw=zfluk->GetWeightBoston(tptype,pt,pz,hp_pars);
00717   }
00718   else if(cfgnum==kPiMinus){
00719     //updated version of zbeam takes a vector of beam systematic parameters
00720     beamsysw=zbeam->GetWeight(det,Ibeam,bs_pars,inu,true_enu);
00721     //reweight for spot size in me and he
00722     //now done in RunPeriodWeight
00723     //    beamsysw*=zbeam->GetWeight(det,Ibeam,6,0,true_enu);   
00724 
00725     //pi minus version of fit has parameters set one time at the beginning,
00726     //the parameters are not reset each time in getweight
00727     hadpw = zfluk->GetWeight(tptype,pt,pz);
00728   }
00729   else if(cfgnum==kDetXs || cfgnum==kDogwood1_Daikon07){
00730 
00731     // Hadron Production weight
00732     hadpw = zfluk->GetWeight(tptype,pt,pz);
00733  
00734   }
00735 
00736   else if(cfgnum==kDogwood1_Daikon07_v2 || cfgnum==kDogwood5_Daikon07_2012){
00737 
00738     Detector::Detector_t detector = Detector::kUnknown;
00739     if     (det==1) detector=Detector::kNear;
00740     else if(det==2) detector=Detector::kFar;
00741     else if(det==3) detector=Detector::kUnknown;
00742     
00743     if(rp==kRunIV||rp==kRunVII||rp==kRunIX){
00744 
00745       Zbeam::ZbeamData_t zdata;
00746       zdata.ntype    = -inu; // change to negative as appropriate for RHC running
00747       zdata.true_enu = true_enu;
00748       zdata.detector = detector;
00749       zdata.beam     =  BeamType::FromZarko(Ibeam);
00750       
00751       // Focusing alignment effects
00752       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHorn1Offset   ,bs_pars[0]);
00753       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kBaffleScraping,bs_pars[1]);
00754       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kPOT           ,bs_pars[2]);
00755       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHornIMiscal   ,bs_pars[3]);
00756       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHornIDist     ,bs_pars[4]);
00757 
00758     }
00759 
00760     else {
00761 
00762       Zbeam::ZbeamData_t zdata;
00763       zdata.ntype    = inu;
00764       zdata.true_enu = true_enu;
00765       zdata.detector = detector;
00766       zdata.beam     =  BeamType::FromZarko(Ibeam);
00767       
00768       // Focusing alignment effects
00769       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHorn1Offset   ,bs_pars[0]);
00770       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kBaffleScraping,bs_pars[1]);
00771       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kPOT           ,bs_pars[2]);
00772       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHornIMiscal   ,bs_pars[3]);
00773       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHornIDist     ,bs_pars[4]);
00774     
00775     }
00776 
00777     // Hadron production weight
00778     hadpw = zfluk->GetWeight(tptype,pt,pz);
00779 
00780   }
00781 
00782   else if(cfgnum==kMINOSplus_2014){
00783 
00784     Detector::Detector_t detector = Detector::kUnknown;
00785     if     (det==1) detector=Detector::kNear;
00786     else if(det==2) detector=Detector::kFar;
00787     else if(det==3) detector=Detector::kUnknown;
00788     
00789     if(IntFromRunPeriod(rp)<11){
00790       MSG("SKZPWeightCalculator",Msg::kInfo)<<"You can't apply MINOS+ weights "
00791                                             <<" to MINOS runs - load older config "
00792                                             <<" beam systematic weight set to 1.0 "<<endl;
00793       beamsysw*=1.;
00794     }
00795     else {
00796       Zbeam::ZbeamData_t zdata;
00797       zdata.ntype    = inu;
00798       zdata.true_enu = true_enu;
00799       zdata.detector = detector;
00800       zdata.beam     =  BeamType::FromZarko(Ibeam);
00801       
00802       // Focusing alignment effects
00803       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHorn1Offset   ,bs_pars[0]);
00804       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kBaffleScraping,bs_pars[1]);
00805       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kPOT           ,bs_pars[2]);
00806       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHornIMiscal   ,bs_pars[3]);
00807       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHornIDist     ,bs_pars[4]);
00808     }
00809 
00810     // Hadron production weight
00811     if(IntFromRunPeriod(rp)<11){
00812       MSG("SKZPWeightCalculator",Msg::kInfo)<<"You can't apply MINOS+ weights "
00813                                             <<" to MINOS runs - load older config "
00814                                             <<" hadron production (SKZP) weight set to 1.0 "<<endl;
00815       hadpw*=1.;
00816     }
00817     else{
00818     hadpw = zfluk->GetWeightMINOSplus(tptype,pt,pz);
00819     }
00820 
00821 
00822   }
00823 
00824 
00825   else if(cfgnum==kMINOSplus_2014_v2){
00826 
00827     Detector::Detector_t detector = Detector::kUnknown;
00828     if     (det==1) detector=Detector::kNear;
00829     else if(det==2) detector=Detector::kFar;
00830     else if(det==3) detector=Detector::kUnknown;
00831     
00832     if(IntFromRunPeriod(rp)<11){
00833       MSG("SKZPWeightCalculator",Msg::kInfo)<<"You can't apply MINOS+ v2 weights "
00834                                             <<" to MINOS runs - load older config "
00835                                             <<" beam systematic weight set to 1.0 "<<endl;
00836       beamsysw*=1.;
00837     }
00838     else if(BeamType::FromZarko(Ibeam)==45){
00839       //      MSG("SKZPWeightCalculator",Msg::kInfo)<<"You are running RHC ME beam, beamsys weight set to 1.0 "<<endl;
00840       beamsysw*=1.;
00841     }
00842     else {
00843       Zbeam::ZbeamData_t zdata;
00844       zdata.ntype    = inu;
00845       zdata.true_enu = true_enu;
00846       zdata.detector = detector;
00847       zdata.beam     =  BeamType::FromZarko(Ibeam);
00848       
00849       // Focusing alignment effects
00850       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHorn1Offset   ,bs_pars[0]);
00851       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kBaffleScraping,bs_pars[1]);
00852       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kPOT           ,bs_pars[2]);
00853       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHornIMiscal   ,bs_pars[3]);
00854       beamsysw *= zbeam->GetWeight(zdata,BeamSys::kHornIDist     ,bs_pars[4]);
00855 
00856     }
00857 
00858 
00859     //      MSG("SKZPWeightCalculator",Msg::kInfo)<<"BeamType is "<<BeamType::FromZarko(Ibeam)<<endl;  
00860 
00861     // Hadron production weight
00862     if(IntFromRunPeriod(rp)<11){
00863       MSG("SKZPWeightCalculator",Msg::kInfo)<<"You can't apply MINOS+ weights "
00864                                             <<" to MINOS runs - load older config "
00865                                             <<" hadron production (SKZP) weight set to 1.0 "<<endl;
00866       hadpw*=1.;
00867     }
00868     else if(BeamType::FromZarko(Ibeam)==45){
00869       //      MSG("SKZPWeightCalculator",Msg::kInfo)<<"You are running RHC ME beam, hadron production (SKZP) weight set to 1.0 "<<endl;
00870       hadpw*=1.;
00871       apsw=1.0;
00872     }
00873     else{
00874     hadpw = zfluk->GetWeightMINOSplus2(tptype,pt,pz);
00875     apsw = GetAPSweight(detector, Ibeam, true_enu, inu);
00876     }
00877 
00878   }//end MINOSplus2
00879 
00880 
00881   else{ 
00882     //updated version of zbeam takes a vector of beam systematic parameters
00883     beamsysw=zbeam->GetWeight(det,Ibeam,bs_pars,inu,true_enu);
00884     //updated version of zbeam takes a vector of hadron production parameters
00885     hadpw=zfluk->GetWeight(tptype,pt,pz);
00886   }
00887 
00888   double rpw; 
00889       rpw = GetRunPeriodWeight(rp,det,Ibeam,inu,true_enu);
00890 
00891       //    cout<<"run period "<<rp<<" weight "<<rpw<<endl;
00892   //return the product of beam systematic weights and had. prod. weights
00893       //   cout<<"inu "<<inu<<"hadpw "<<hadpw<<" beamsysw "<<beamsysw<<endl;
00894       //  cout<<"apsw = "<<apsw<<endl;
00895   return hadpw*beamsysw*rpw*apsw;
00896 }

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

Definition at line 377 of file SKZPWeightCalculator.h.

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

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

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 2021 of file SKZPWeightCalculator.cxx.

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

Referenced by GetDecayError(), and GetFluxError().

02023 {
02024   if(!decayErrorsLoaded) LoadDecayErrors(dir);
02025 
02026   int i = Ibeam-2;
02027   int j = IntFromRunPeriod(rp)-1;
02028   int k = det-1;
02029 
02030   if(i!=0 && i!=6) return 0.;
02031   else {
02032     switch(inu){
02033     case 14: return nsigma*(NuMu_DecayError[i][j][k]->GetBinContent(NuMu_DecayError[i][j][k]->FindBin(true_enu)));
02034     case -14: return nsigma*(NuMuBar_DecayError[i][j][k]->GetBinContent(NuMuBar_DecayError[i][j][k]->FindBin(true_enu)));
02035     case 12: return nsigma*(NuE_DecayError[i][j][k]->GetBinContent(NuE_DecayError[i][j][k]->FindBin(true_enu)));
02036     case -12: return nsigma*(NuEBar_DecayError[i][j][k]->GetBinContent(NuEBar_DecayError[i][j][k]->FindBin(true_enu)));
02037     default: return 0.;
02038     }  
02039   }
02040 
02041   return 0.;
02042 }

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

Definition at line 385 of file SKZPWeightCalculator.h.

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

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

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 2045 of file SKZPWeightCalculator.cxx.

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

Referenced by GetDecayModelError(), and GetFluxError().

02047 {
02048   if(!decayModelErrorsLoaded) LoadDecayModelErrors(dir);
02049 
02050   int i = Ibeam-2;
02051   int j = IntFromRunPeriod(rp)-1;
02052   int k = det-1;
02053 
02054   if(i!=0) return 0.;
02055   else {
02056     switch(inu){
02057     case 14: return nsigma*(NuMu_DecayModelError[i][j][k]->GetBinContent(NuMu_DecayModelError[i][j][k]->FindBin(true_enu)));
02058     case -14: return nsigma*(NuMuBar_DecayModelError[i][j][k]->GetBinContent(NuMuBar_DecayModelError[i][j][k]->FindBin(true_enu)));
02059     case 12: return nsigma*(NuE_DecayModelError[i][j][k]->GetBinContent(NuE_DecayModelError[i][j][k]->FindBin(true_enu)));
02060     case -12: return nsigma*(NuEBar_DecayModelError[i][j][k]->GetBinContent(NuEBar_DecayModelError[i][j][k]->FindBin(true_enu)));
02061     default: return 0.;
02062     }  
02063   }
02064 
02065   return 0.;
02066 }

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 898 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().

00902 {
00903 
00904   //computes the effect of the changing the detector parameters in the skzp fit
00905   //this function changes the reconstructed values of muon and shower energy,
00906   //so the new values are passed back to the calling function by reference as
00907   //part of the function parameter list
00908   double dw = 1.;
00909   new_reco_emu=reco_emu;
00910   new_reco_eshw=reco_eshw;
00911 
00912 
00913   if(cfgnum==kPRL){
00914     //right now this is the only version of detector weighting,
00915     //but this may evolve in the future
00916 
00917     //prl version of weights weights the NC component up or down by 1-fitparam
00918     if(ccnc==0){
00919       dw = 1.-det_pars[2];
00920     }
00921     
00922     //prl version of skzp changes the shower energy by an offset,
00923     //then changes the total neutrino energy (eshw+emu) by 
00924     //a multiplicative constant that is 1-fit parameter
00925     if(reco_eshw>0){
00926       new_reco_eshw = reco_eshw+det_pars[1];
00927     }
00928     if(new_reco_eshw<0){
00929       new_reco_eshw=0.;
00930     }
00931     
00932     new_reco_eshw*=(1-det_pars[0]);
00933     new_reco_emu=reco_emu*(1-det_pars[0]);
00934   }
00935   else if(cfgnum==kBoston){
00936     //boston version of weights weights the numu's and anumus separately
00937     if(ccnc==0){
00938        if(inu>0){
00939           dw = 1.-det_pars[2];
00940        }
00941        else{
00942           dw = 1.-det_pars[5];
00943        }
00944     }
00945     
00946     //boston version of skzp changes the shower energy by an offset,
00947     //then changes the total neutrino energy (eshw+emu) by 
00948     //a multiplicative constant that is 1-fit parameter
00949     if(reco_eshw>0){
00950        if(inu>0){
00951           new_reco_eshw = reco_eshw+det_pars[1];
00952        }
00953        else{
00954           new_reco_eshw = reco_eshw+det_pars[4];
00955        }
00956     }
00957     if(new_reco_eshw<0){
00958        new_reco_eshw=0.;
00959     }
00960     
00961     if(inu>0){
00962        new_reco_eshw*=(1-det_pars[0]);
00963        new_reco_emu=reco_emu*(1-det_pars[0]);
00964     }
00965     else{
00966        new_reco_eshw*=(1-det_pars[3]);
00967        new_reco_emu=reco_emu*(1-det_pars[3]);
00968     }
00969   }
00970   else if(cfgnum==kPiMinus){
00971     //Piminus version of weights weights the numu's and anumus separately
00972     if(ccnc==0){
00973       if(sampsel==kNuMuCC){
00974         //      cout<<"Found an NC, and I'm using the CC parameter"<<endl;
00975         dw = 1-det_pars[2];
00976       }
00977       else if(sampsel==kAntiNuMu){
00978         //      cout<<"Found an NC, and I'm using the Anti parameter"<<endl;
00979         dw = 1-det_pars[3];
00980       }
00981       else{//if a sample isn't specified, 
00982            //do it like I think you should.
00983        if(inu>0){
00984          dw = 1.-det_pars[2];
00985        }
00986        else{
00987          dw = 1.-det_pars[3];
00988        }
00989       }
00990     }
00991     
00992     //Piminus version of skzp changes the shower energy by an offset,
00993     //then changes the total neutrino energy (eshw+emu) by 
00994     //a multiplicative constant that is 1-fit parameter
00995     //it also treats nu's and anu's in the same way
00996     new_reco_eshw=reco_eshw;
00997     if(reco_eshw>0){
00998       new_reco_eshw = reco_eshw+det_pars[1];
00999     }
01000     if(new_reco_eshw<0){
01001       new_reco_eshw=0.;
01002     }
01003     
01004     if(inu==14||inu==-14){
01005       new_reco_eshw*=(1-det_pars[0]);
01006       new_reco_emu=reco_emu*(1-det_pars[0]);
01007     }
01008     else if(inu==12||inu==-12){
01009       new_reco_eshw*=(1-0.);
01010       new_reco_emu=reco_emu*(1-0.);
01011     }
01012     else{
01013       new_reco_eshw*=(1-0.);
01014       new_reco_emu=reco_emu*(1-0.);
01015     }
01016 
01017     //Piminus version of the fit has a scale for numubar xsec
01018     if(inu==-14){
01019       double xsw=1.;
01020       if(true_enu<XP){
01021         xsw = det_pars[4]+2.*(1.-det_pars[4])*true_enu/XP
01022           +(det_pars[4]-1.)*true_enu*true_enu/(XP*XP);
01023       }
01024       dw*=xsw;
01025     }
01026   }
01027   else if(cfgnum==kDetXs || cfgnum==kDogwood1_Daikon07){
01028 
01029     // You must give an MCEventInfo object to get the
01030     // correct detector weight
01031     if(fBeamOnly||ei==0) return dw;
01032 
01033     // Shower offset
01034     if(reco_eshw>0.) {
01035       new_reco_eshw = reco_eshw+det_pars[0];
01036     }
01037     if(new_reco_eshw<0){
01038       new_reco_eshw=0.;
01039     }
01040 
01041     // Shower energy scale from functional form
01042     double x0=10;
01043     double x = TMath::Min((double)true_eshw,x0);
01044     double err_a = 1.04/1.0 - 1.0;
01045     double err_b = (1.1+2.*(1-1.1)*(x/x0)+(1.1-1)*(x/x0)*(x/x0))/(1.0) - 1.0;
01046     double err_c = 0.057;
01047     double shw_scale=sqrt(pow(err_a,2)+pow(err_b,2)+pow(err_c,2));
01048     
01049     new_reco_eshw*=(1-det_pars[4]*shw_scale);
01050 
01051     // Scale muon energy 
01052     new_reco_emu=reco_emu*(1.-det_pars[5]);
01053     
01054     // NC parameters
01055     if(ei->iaction==0){
01056       if(sampsel==kNuMuCC)         dw*=(1-det_pars[1]);
01057       else if(sampsel==kAntiNuMu)  dw*=(1-det_pars[2]);
01058       else{
01059         if(inu==14)  dw = 1.-det_pars[1];
01060         if(inu==-14) dw = 1.-det_pars[2];
01061       }
01062     }
01063     else {
01064       // Cross Section Parameters
01065       if(ei!=0) {
01066         double gw=1;
01067         if(ei->iresonance!=1005) gw=mcr->ComputeWeight(ei)-1.0;
01068         
01069         if(ei->iresonance==1001) dw*=(1+det_pars[6]*gw);
01070         if(ei->iresonance==1002) dw*=(1+det_pars[7]*gw);
01071         //if(ei->iresonance==1003) dw*=(1+det_pars[8]*gw);
01072       }
01073     }
01074         
01075     //numubar xsec
01076     if(inu==-14){
01077       double xsw=1.;
01078       if(true_enu<XP){
01079         xsw = det_pars[3]+2.*(1.-det_pars[3])*true_enu/XP
01080           +(det_pars[3]-1.)*true_enu*true_enu/(XP*XP);
01081       }
01082       dw*=xsw;
01083     }
01084    
01085   }
01086   else if(cfgnum==kDogwood1_Daikon07_v2 || cfgnum==kDogwood5_Daikon07_2012 || cfgnum==kMINOSplus_2014 || cfgnum==kMINOSplus_2014_v2){
01087 
01088     // Similar to kDetXs but with parameters incremented
01089     // by 1 as new parameter 0 is the overall neutrino 
01090     // energy scale.
01091 
01092     // You must give an MCEventInfo object to get the
01093     // correct detector weight
01094     if(fBeamOnly||ei==0) return dw;
01095 
01096     // Shower offset
01097     if(reco_eshw>0.) {
01098       new_reco_eshw = reco_eshw+det_pars[1];
01099     }
01100     if(new_reco_eshw<0){
01101       new_reco_eshw=0.;
01102     }
01103 
01104     // Shower energy scale from functional form
01105     double x0=10;
01106     double x = TMath::Min((double)true_eshw,x0);
01107     double err_a = 1.04/1.0 - 1.0;
01108     double err_b = (1.1+2.*(1-1.1)*(x/x0)+(1.1-1)*(x/x0)*(x/x0))/(1.0) - 1.0;
01109     double err_c = 0.057;
01110     double shw_scale=sqrt(pow(err_a,2)+pow(err_b,2)+pow(err_c,2));
01111     
01112     new_reco_eshw*=(1-det_pars[5]*shw_scale);
01113 
01114     // Scale muon energy 
01115     new_reco_emu=reco_emu*(1.-det_pars[6]);
01116     
01117     // Now need to scale the overall neutrino energy BUT the current
01118     // weighting functions don't allow me to pass back a new value 
01119     // for the neutrino energy, just the muon and shower separately.
01120     // So I'm going to assume everyone will just add these two to
01121     // get the new neutrino energy and hence implement the neutrino
01122     // energy scale parameter by applying it to both the muon and
01123     // shower energy seperately:
01124 
01125     new_reco_eshw*=(1.-det_pars[0]);
01126     new_reco_emu*=(1.-det_pars[0]);
01127 
01128     // NC parameters
01129     if(ei->iaction==0){
01130       if(sampsel==kNuMuCC)         dw*=(1-det_pars[2]);
01131       else if(sampsel==kAntiNuMu)  dw*=(1-det_pars[3]);
01132       else{
01133         if(inu==14)  dw = 1.-det_pars[2];
01134         if(inu==-14) dw = 1.-det_pars[3];
01135       }
01136     }
01137     else {
01138       // Cross Section Parameters
01139       if(ei!=0) {
01140         double gw=1;
01141         if(ei->iresonance!=1005) gw=mcr->ComputeWeight(ei)-1.0;
01142         
01143         if(ei->iresonance==1001) dw*=(1+det_pars[7]*gw);
01144         if(ei->iresonance==1002) dw*=(1+det_pars[8]*gw);
01145       }
01146     }
01147         
01148     //numubar xsec
01149     if(inu==-14){
01150       double xsw=1.;
01151       if(true_enu<XP){
01152         xsw = det_pars[4]+2.*(1.-det_pars[4])*true_enu/XP
01153           +(det_pars[4]-1.)*true_enu*true_enu/(XP*XP);
01154       }
01155       dw*=xsw;
01156     }
01157 
01158   }
01159   else{
01160     //this does nothing for now, and 
01161     //should never be called,
01162     //but I want the structure
01163     MSG("SKZPWeightCalculator",Msg::kError)<<"You are in the else of DetWeighting!"
01164                                            <<"this should never happen!"
01165                                            <<"How did you get here?"<<endl;
01166   }
01167 
01168   /*
01169   if(new_reco_eshw+new_reco_emu<1.5){
01170     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;
01171   }
01172   */
01173   return dw;
01174 
01175 }

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 279 of file SKZPWeightCalculator.h.

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

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

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 1268 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, kNone, kRunIV, kRunIX, kRunV, kRunVI, kRunVII, kRunVIII, kRunX, and RunPeriodFromInt().

01271 {
01272 
01273   if(cfgnum!=kDogwood1_Daikon07_v2 && cfgnum!=kDogwood5_Daikon07_2012 && cfgnum!=kMINOSplus_2014 && cfgnum!=kMINOSplus_2014_v2){
01274     return GetFluxError(det,Ibeam,inu,true_enu,neffect,nsigma);
01275   }
01276 
01277   else{
01278 
01279     double err = 0.;
01280 
01281     if(BeamType::FromZarko(Ibeam)==45){
01282       //      cout<<"setting fluxerr to 0 since RHC beam"<<endl;
01283       return err = 0;
01284     }
01285     else if(BeamType::FromZarko(Ibeam)!=45){
01286    if(rp!=kRunIV && rp!=kRunV && rp!=kRunVI && rp!=kRunVII && rp!=kRunVIII && rp!=kRunIX && rp!=kRunX && rp!=kNone){
01287       if(cfgnum==kDogwood1_Daikon07_v2){
01288       err+=TMath::Power((GetHadProdError(det,Ibeam,inu,true_enu,rp,nsigma,beamSysFileDir)),2);
01289       }
01290       if(cfgnum==kDogwood5_Daikon07_2012 || cfgnum==kMINOSplus_2014 || cfgnum==kMINOSplus_2014_v2){  //FOR MINOS+ kept old naming scheme so this will call the correct histograms by default
01291         //              MSG("SKZPWeightCalculator",Msg::kInfo)<<"AM IN NEW "<<endl;
01292       err+=TMath::Power((GetHadProdError2012(det,Ibeam,inu,true_enu,rp,nsigma,beamSysFileDir)),2);
01293       }   
01294 
01295       err+=TMath::Power((GetOpticsError(det,Ibeam,inu,true_enu,rp,nsigma,beamSysFileDir)),2);
01296       err+=TMath::Power((GetTargetZError(det,Ibeam,inu,true_enu,rp,nsigma,beamSysFileDir)),2);
01297       err+=TMath::Power((GetMaterialError(det,Ibeam,inu,true_enu,rp,nsigma,beamSysFileDir)),2);
01298       err+=TMath::Power((GetDecayError(det,Ibeam,inu,true_enu,rp,nsigma,beamSysFileDir)),2);
01299       err+=TMath::Power((GetDecayModelError(det,Ibeam,inu,true_enu,rp,nsigma,beamSysFileDir)),2);
01300   }
01301     else if(rp==kRunIV||rp==kRunVII||rp==kRunIX){
01302 
01303       // For Run IV:
01304 
01305       // Use Run I error bands but:
01306       //  - use hadron production errors for this neutrino type
01307       //  - use other errors for anti- this neutrino type
01308 
01309       // Eg: for numubar events you'll get the numubar hadron production
01310       //     errors with other errors corresponding to the numus, as is
01311       //     appropriate for RHC running.
01312       if(cfgnum==kDogwood1_Daikon07_v2){
01313       err+=TMath::Power((GetHadProdError(det,Ibeam,inu,true_enu,RunPeriodFromInt(1),nsigma,beamSysFileDir)),2);
01314       }
01315       if(cfgnum==kDogwood5_Daikon07_2012){
01316         err+=TMath::Power((GetHadProdError2012(det,Ibeam,inu,true_enu,RunPeriodFromInt(4),nsigma,beamSysFileDir)),2);
01317       }
01318       err+=TMath::Power((GetOpticsError(det,Ibeam,-inu,true_enu,RunPeriodFromInt(1),nsigma,beamSysFileDir)),2);
01319       err+=TMath::Power((GetTargetZError(det,Ibeam,-inu,true_enu,RunPeriodFromInt(1),nsigma,beamSysFileDir)),2);
01320       err+=TMath::Power((GetMaterialError(det,Ibeam,-inu,true_enu,RunPeriodFromInt(1),nsigma,beamSysFileDir)),2);
01321       err+=TMath::Power((GetDecayError(det,Ibeam,-inu,true_enu,RunPeriodFromInt(1),nsigma,beamSysFileDir)),2);
01322       err+=TMath::Power((GetDecayModelError(det,Ibeam,-inu,true_enu,RunPeriodFromInt(1),nsigma,beamSysFileDir)),2);
01323 
01324     }
01325 
01326     else if(rp==kRunV||rp==kRunVI||rp==kRunVIII||rp==kRunX){
01327 
01328       // For newer runs want to apply the older runIII errors for now
01329 
01330       if(cfgnum==kDogwood1_Daikon07_v2){
01331       err+=TMath::Power((GetHadProdError(det,Ibeam,inu,true_enu,RunPeriodFromInt(3),nsigma,beamSysFileDir)),2);
01332       }
01333       if(cfgnum==kDogwood5_Daikon07_2012){
01334         err+=TMath::Power((GetHadProdError2012(det,Ibeam,inu,true_enu,RunPeriodFromInt(3),nsigma,beamSysFileDir)),2);
01335       }
01336       err+=TMath::Power((GetOpticsError(det,Ibeam,-inu,true_enu,RunPeriodFromInt(3),nsigma,beamSysFileDir)),2);
01337       err+=TMath::Power((GetTargetZError(det,Ibeam,-inu,true_enu,RunPeriodFromInt(3),nsigma,beamSysFileDir)),2);
01338       err+=TMath::Power((GetMaterialError(det,Ibeam,-inu,true_enu,RunPeriodFromInt(3),nsigma,beamSysFileDir)),2);
01339       err+=TMath::Power((GetDecayError(det,Ibeam,-inu,true_enu,RunPeriodFromInt(3),nsigma,beamSysFileDir)),2);
01340       err+=TMath::Power((GetDecayModelError(det,Ibeam,-inu,true_enu,RunPeriodFromInt(3),nsigma,beamSysFileDir)),2);
01341 
01342     }
01343     }
01344 
01345     else return 0.;
01346 
01347     if(err<0.) err = 0.;
01348     return (1.+(nsigma*TMath::Sqrt(err)));
01349 
01350   }
01351 
01352 }

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

Definition at line 1354 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().

01357 {
01358  zbeam->SetReweightConfig(cfgname);
01359   
01360   // Add target z with different than nsigma weight
01361   if(cfgname=="DetXs" && neffect==kTotalErrorAfterTune) {
01362   
01363     double e=0;
01364  
01365     double weight=zbeam->GetWeight(det,Ibeam,BeamSys::kHorn1Offset,nsigma,inu,true_enu)-1;
01366     e+=weight*weight;
01367     weight=zbeam->GetWeight(det,Ibeam,BeamSys::kBaffleScraping,nsigma,inu,true_enu)-1;
01368     e+=weight*weight;
01369     weight=zbeam->GetWeight(det,Ibeam,BeamSys::kPOT,nsigma,inu,true_enu)-1;
01370     e+=weight*weight;
01371     weight=zbeam->GetWeight(det,Ibeam,BeamSys::kHornIMiscal,nsigma,inu,true_enu)-1;
01372     e+=weight*weight;
01373     weight=zbeam->GetWeight(det,Ibeam,BeamSys::kHornIDist,nsigma,inu,true_enu)-1;
01374     e+=weight*weight;
01375     weight=zbeam->GetWeight(det,Ibeam,BeamSys::kBeamWidth,nsigma,inu,true_enu)-1;
01376     e+=weight*weight;
01377     weight=zbeam->GetWeight(det,Ibeam,BeamSys::kHadProdAfter,nsigma,inu,true_enu)-1;
01378     e+=weight*weight;
01379         
01380     // add error from best fit for target z
01381 
01382     // le010 configurations
01383     if(Ibeam==2 || Ibeam==6 || Ibeam==7) {
01384       double targetz=TMath::Max(TMath::Abs(bs_pars[0]),TMath::Abs(bs_pars[4]));
01385       weight=zbeam->GetWeight(det,Ibeam,BeamSys::kTargetZ,targetz*nsigma,inu,true_enu)-1;
01386       e+=weight*weight;
01387     }
01388     // le100
01389     else if(Ibeam==3) {
01390       double targetz=TMath::Abs(bs_pars[1]);
01391       weight=zbeam->GetWeight(det,Ibeam,BeamSys::kTargetZ,targetz*nsigma,inu,true_enu)-1;
01392       e+=weight*weight;
01393     }
01394     // le250
01395     else if(Ibeam==4) {
01396       double targetz=TMath::Max(TMath::Abs(bs_pars[3]),TMath::Abs(bs_pars[5]));
01397       weight=zbeam->GetWeight(det,Ibeam,BeamSys::kTargetZ,targetz*nsigma,inu,true_enu)-1;
01398       e+=weight*weight;
01399     }
01400     // le150
01401     else if(Ibeam==9) {
01402       double targetz=TMath::Abs(bs_pars[2]);
01403       weight=zbeam->GetWeight(det,Ibeam,BeamSys::kTargetZ,targetz*nsigma,inu,true_enu)-1;
01404       e+=weight*weight;
01405     }
01406 
01407     return 1+sqrt(e);
01408   }
01409   else return zbeam->GetWeight(det,Ibeam,neffect,nsigma,inu,true_enu);
01410 
01411 }

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

Definition at line 332 of file SKZPWeightCalculator.h.

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

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

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 1862 of file SKZPWeightCalculator.cxx.

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

Referenced by GetFluxError(), and GetHadProdError().

01864 {
01865   if(!hadProdErrorsLoaded) LoadHadProdErrors(dir);
01866 
01867   int i = Ibeam-2;
01868   int j = IntFromRunPeriod(rp)-1;
01869   if(IntFromRunPeriod(rp)==11) j=0;  
01870   int k = det-1;
01871 
01872   if(i==3) return 0.; // No low intensity L010z185i in beam fit
01873   // Remove various beam configuration / run period combinations
01874   else if(i==1 && j>0) return 0.;
01875   else if(i==2 && j>1) return 0.;
01876   else if(i==4 && j>0) return 0.;
01877   else if(i==5 && j>0) return 0.;
01878   else if(i==7 && j!=1) return 0.;
01879   else {
01880     switch(inu){
01881     case 14: return nsigma*(NuMu_HadProdError[i][j][k]->GetBinContent(NuMu_HadProdError[i][j][k]->FindBin(true_enu)));
01882     case -14: return nsigma*(NuMuBar_HadProdError[i][j][k]->GetBinContent(NuMuBar_HadProdError[i][j][k]->FindBin(true_enu)));
01883     case 12: return nsigma*(NuE_HadProdError[i][j][k]->GetBinContent(NuE_HadProdError[i][j][k]->FindBin(true_enu)));
01884     case -12: return nsigma*(NuEBar_HadProdError[i][j][k]->GetBinContent(NuEBar_HadProdError[i][j][k]->FindBin(true_enu)));
01885     default: return 0.;
01886     }  
01887   }
01888   
01889   return 0.;
01890 }

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

Definition at line 345 of file SKZPWeightCalculator.h.

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

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

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 1893 of file SKZPWeightCalculator.cxx.

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

Referenced by GetFluxError(), and GetHadProdError2012().

01895 {
01896   if(!hadProdErrors2012Loaded) LoadHadProdErrors2012(dir);
01897 
01898   int i = Ibeam-2;
01899   int j = IntFromRunPeriod(rp)-1;
01900   if(IntFromRunPeriod(rp)==11||IntFromRunPeriod(rp)==12) j=0;    //IMPORTANT - IF EDITING IN FUTURE WITH MORE MINOS+ RUNS, TAKE CARE TO GET J RIGHT
01901   int k = det-1;
01902 
01903   if(i==3||i==8||i==9) return 0.; // No low intensity L010z185i or medium intensity L010z185 in beam fit
01904   // Remove various beam configuration / run period combinations
01905   else if(i==1 && j>0) return 0.;
01906   else if(i==2 && j>1) return 0.;
01907   else if(i==4 && j>0) return 0.;
01908   else if(i==5 && j>0) return 0.;
01909   else if(i==7 && j!=1) return 0.;
01910   else if(i==10 && j>0) return 0.;  //only one MINOS+ M000z200 run for now
01911   else if(i==11 && j>0) return 0.;  //only one MINOS+ M000z000 run for now
01912   else {
01913     switch(inu){
01914     case 14: return nsigma*(NuMu_HadProdError2012[i][j][k]->GetBinContent(NuMu_HadProdError2012[i][j][k]->FindBin(true_enu)));
01915     case -14: return nsigma*(NuMuBar_HadProdError2012[i][j][k]->GetBinContent(NuMuBar_HadProdError2012[i][j][k]->FindBin(true_enu)));
01916     case 12: return nsigma*(NuE_HadProdError2012[i][j][k]->GetBinContent(NuE_HadProdError2012[i][j][k]->FindBin(true_enu)));
01917     case -12: return nsigma*(NuEBar_HadProdError2012[i][j][k]->GetBinContent(NuEBar_HadProdError2012[i][j][k]->FindBin(true_enu)));
01918     default: return 0.;
01919     }  
01920   }
01921   
01922   return 0.;
01923 }

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

Definition at line 2505 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().

02506 {
02507   if(det==1){ // ND
02508     if(Ibeam==2){ // L010z185i
02509       if(Ntype==56 || Ntype==14) return GetHeliumWeight_L010z185i_ND_Numu(true_enu);
02510       else if(Ntype==55 || Ntype==-14) return GetHeliumWeight_L010z185i_ND_Numubar(true_enu);
02511       else if(Ntype==53 || Ntype==12) return GetHeliumWeight_L010z185i_ND_Nue(true_enu);
02512       else if(Ntype==52 || Ntype==-12) return GetHeliumWeight_L010z185i_ND_Nuebar(true_enu);
02513       else return 1.0;
02514     }
02515     else if(Ibeam==8){ // L010z000i
02516       if(Ntype==56 || Ntype==14) return GetHeliumWeight_L010z000i_ND_Numu(true_enu);
02517       else if(Ntype==55 || Ntype==-14) return GetHeliumWeight_L010z000i_ND_Numubar(true_enu);
02518       else if(Ntype==53 || Ntype==12) return GetHeliumWeight_L010z000i_ND_Nue(true_enu);
02519       else if(Ntype==52 || Ntype==-12) return GetHeliumWeight_L010z000i_ND_Nuebar(true_enu);
02520       else return 1.0;
02521     }
02522     else return 1.0;
02523   }
02524   else if(det==2){ // FD
02525     if(Ibeam==2){ // L010z185i
02526       if(Ntype==56 || Ntype==14) return GetHeliumWeight_L010z185i_FD_Numu(true_enu);
02527       else if(Ntype==55 || Ntype==-14) return GetHeliumWeight_L010z185i_FD_Numubar(true_enu);
02528       else if(Ntype==53 || Ntype==12) return GetHeliumWeight_L010z185i_FD_Nue(true_enu);
02529       else if(Ntype==52 || Ntype==-12) return GetHeliumWeight_L010z185i_FD_Nuebar(true_enu);
02530       else return 1.0;
02531     }
02532     else if(Ibeam==8){ // L010z000i
02533       if(Ntype==56 || Ntype==14) return GetHeliumWeight_L010z000i_FD_Numu(true_enu);
02534       else if(Ntype==55 || Ntype==-14) return GetHeliumWeight_L010z000i_FD_Numubar(true_enu);
02535       else if(Ntype==53 || Ntype==12) return GetHeliumWeight_L010z000i_FD_Nue(true_enu);
02536       else if(Ntype==52 || Ntype==-12) return GetHeliumWeight_L010z000i_FD_Nuebar(true_enu);
02537       else return 1.0;
02538     }
02539     else return 1.0;
02540   }
02541   else return 1.0;
02542 }

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

Definition at line 2807 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02808 {
02809   double weight = 1.;
02810   double par[7] = {
02811     1.02653,-0.00287051,0.000666625,-4.19876e-05,7.69875e-07,0.99805,10
02812   };
02813   if(enu<20.0){
02814     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
02815   }
02816   else{
02817     weight = par[5]+(par[6]/(enu*enu));
02818   }
02819   return weight;
02820 }

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

Definition at line 2822 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02823 {
02824   double weight = 1.;
02825   double par[7] = {
02826     1.02206,0.00932646,-0.00100526,2.37525e-05,-4.71822e-08,1.2,-180
02827   };
02828   if(enu<33.45){
02829     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
02830   }
02831   else{
02832     weight = par[5]+(par[6]/(enu*enu));
02833   }
02834   return weight;
02835 }

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

Definition at line 2769 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02770 {
02771   double weight = 1.;
02772   double par[10] = {
02773     1.04313,-0.00624758,0.000104616,0.00872899,1.12567,
02774     -0.0171559,0.000639488,-6.72704e-06,1.0197,1500
02775   };
02776   if(enu<10.0){
02777     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*TMath::Log(enu);
02778   }
02779   else if(enu<46.0){
02780     weight = par[4]+par[5]*enu+par[6]*enu*enu+par[7]*enu*enu*enu;
02781   }
02782   else{
02783     weight = par[8]+(par[9]/(enu*enu*enu));
02784   }
02785   return weight;
02786 }

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

Definition at line 2788 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02789 {
02790   double weight = 1.;
02791   double par[11] = {
02792     1.0378,-0.000996055,-0.000280837,0.00197533,1.25837,-0.0519768,
02793     0.00349608,-9.25331e-05,8.19759e-07,1,-1.5e+07
02794   };
02795   if(enu<9.5){
02796     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*TMath::Log(enu);
02797   }
02798   else if(enu<49.3){
02799     weight = par[4]+par[5]*enu+par[6]*enu*enu+par[7]*enu*enu*enu+par[8]*enu*enu*enu*enu;
02800   }
02801   else{
02802     weight = par[9]+(par[10]/(enu*enu*enu*enu*enu));
02803   }
02804   return weight;
02805 }

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

Definition at line 2739 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02740 {
02741   double weight = 1.;
02742   double par[7] = {
02743     1.02614,0.0135056,-0.00151707,5.53927e-05,-6.55825e-07,0.978,1.
02744   };
02745   if(enu<20.45){
02746     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
02747   }
02748   else{
02749     weight = par[5]+(par[6]/(enu));
02750   }
02751   return weight;
02752 }

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

Definition at line 2754 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02755 {
02756   double weight = 1.;
02757   double par[7] = {
02758     1.02609,0.0255862,-0.00296928,9.18715e-05,-7.22365e-07,1.101,-2500
02759   };
02760   if(enu<28.0){
02761     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
02762   }
02763   else{
02764     weight = par[5]+(par[6]/(enu*enu*enu));
02765   }
02766   return weight;
02767 }

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

Definition at line 2698 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02699 {
02700   double weight = 1.;
02701   double par[10] = {
02702     1.08341,-0.00598166,-0.000644125,0.0153799,1.16251,
02703     -0.0259465,0.00130708,-1.8318e-05,1.03,1500
02704   };
02705   if(enu<7.4){
02706     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*TMath::Log(enu);
02707   }
02708   else if(enu<38.4){
02709     weight = par[4]+par[5]*enu+par[6]*enu*enu+par[7]*enu*enu*enu;
02710   }
02711   else{
02712     weight = par[8]+(par[9]/(enu*enu*enu));
02713   }
02714   return weight;
02715 }

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

Definition at line 2717 of file SKZPWeightCalculator.cxx.

References MuELoss::e.

Referenced by GetHeliumWeight().

02718 {
02719   double weight = 1.;
02720   double par[15] = {
02721     1.06489,0.0137669,-0.00415539,0.000218168,0.923382,0.0108634,-0.000376271,
02722     3.86015e-06,0.8,0.01,-0.0005,1e-06,1.03,0.00883329,0.000347229
02723   };
02724   if(enu<11.0){
02725     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu;
02726   }
02727   else if(enu<21.4){
02728     weight = par[4]+par[5]*enu+par[6]*enu*enu+par[7]*enu*enu*enu+0.0014;
02729   }
02730   else if(enu<37.){
02731     weight = par[8]+par[9]*enu+par[10]*(enu-20.)*(enu-20.)+par[11]*(enu-20.)*(enu-20.)*(enu-20.)+0.0097;
02732   }
02733   else{
02734     weight = par[12]-par[13]*(enu-37.)+par[14]*(enu-37.)*(enu-37.)+0.0097;
02735   }
02736   return weight;
02737 }

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

Definition at line 2668 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02669 {
02670   double weight = 1.;
02671   double par[8] = {
02672     1.00099,0.022962,-0.0106913,0.00153978,-6.74999e-05,1.021,-0.0018,1.5e-05
02673   };
02674   if(enu<11.0){
02675     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
02676   }
02677   else{
02678     weight = par[5]+(par[6]*(enu-11.))+(par[7]*(enu-11.)*(enu-11.));
02679   }
02680   return weight;
02681 }

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

Definition at line 2683 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02684 {
02685   double weight = 1.;
02686   double par[7] = {
02687     1.02439,-0.000679498,0.000218119,-6.49776e-06,4.58303e-08,0.997,3300
02688   };
02689   if(enu<43.1){
02690     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
02691   }
02692   else{
02693     weight = par[5]+(par[6]/(enu*enu*enu));
02694   }
02695   return weight;
02696 }

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

Definition at line 2627 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02628 {
02629   double weight = 1.;
02630   double par[14] = {
02631     1.04327,-0.0352661,0.0047907,0.00388763,0.88061,0.0321005,-0.00164144,
02632     -4.5869e-05,1.05352,-0.00869623,0.000390208,-4.45885e-06,0.997,5000
02633   };
02634   if(enu<4.4){
02635     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*TMath::Log(enu);
02636   }
02637   else if(enu<8.9){
02638     weight = par[4]+par[5]*enu+par[6]*enu*enu+par[7]*enu*enu*enu;
02639   }
02640   else if(enu<48.0){
02641     weight = par[8]+par[9]*enu+par[10]*enu*enu+par[11]*enu*enu*enu;
02642   }
02643   else{
02644     weight = par[12]+(par[13]/(enu*enu*enu));
02645   }
02646   return weight;
02647 }

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

Definition at line 2649 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02650 {
02651   double weight = 1.;
02652   double par[10] = {
02653     1.04689,0.00226136,-0.000790701,2.61669e-05,-0.0744887,
02654     0.0847917,-0.00190558,1.21492e-05,0.99,4000
02655   };
02656   if(enu<21.9){
02657     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu;
02658   }
02659   else if(enu<38.0){
02660     weight = par[4]+par[5]*enu+par[6]*enu*enu+par[7]*enu*enu*enu;
02661   }
02662   else{
02663     weight = par[8]+(par[9]/(enu*enu*enu));
02664   }
02665   return weight;
02666 }

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

Definition at line 2592 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02593 {
02594   double weight = 1.;
02595   double par[11] = {
02596     0.97709,0.0939192,-0.0536218,0.00805987,1.03,-0.0163451,0.00263497,
02597     -0.000118506,1.57655e-06,0.998,600
02598   };
02599   if(enu<2.43){
02600     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu;
02601   }
02602   else if(enu<23.0){
02603     weight = par[4]+par[5]*enu+par[6]*enu*enu+par[7]*enu*enu*enu+par[8]*enu*enu*enu*enu;
02604   }
02605   else{
02606     weight = par[9]+(par[10]/(enu*enu*enu));
02607   }
02608   return weight;
02609 
02610 }

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

Definition at line 2612 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02613 {
02614   double weight = 1.;
02615   double par[7] = {
02616     1.02113,0.0140663,-0.000791038,1.37577e-05,-7.48181e-08,0.9995,1150
02617   };
02618   if(enu<30.0){
02619     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
02620   }
02621   else{
02622     weight = par[5]+(par[6]/(enu*enu*enu));
02623   }
02624   return weight;
02625 }

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

Definition at line 2544 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

02545 {
02546   double weight = 1.;
02547   double par[19] = {
02548     1.10472,-0.0861419,0.0116673,0.0193203,0.230526,0.323048,-0.0434165,0.00189932,1.1483,
02549     -0.0322421,0.00224179,-4.51111e-05,0.818716,0.0177147,-0.000366594,2.1493e-06,1.20406,
02550     -0.00411679,2.18602e-05
02551   };
02552   if(enu<5.15){
02553     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*TMath::Log(enu);
02554   }
02555   else if(enu<7.25){
02556     weight = par[4]+par[5]*enu+par[6]*enu*enu+par[7]*enu*enu*enu;
02557   }
02558   else if(enu<18.0){
02559     weight = par[8]+par[9]*enu+par[10]*enu*enu+par[11]*enu*enu*enu;
02560   }
02561   else if(enu<53.5){
02562     weight = par[12]+par[13]*enu+par[14]*enu*enu+par[15]*enu*enu*enu;
02563   }
02564   else{
02565     weight = par[16]+par[17]*enu+par[18]*enu*enu;
02566   }
02567   return weight;
02568 }

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

Definition at line 2570 of file SKZPWeightCalculator.cxx.

References MuELoss::e.

Referenced by GetHeliumWeight().

02571 {
02572   double weight = 1.;
02573   double par[15] = {
02574     1.06239,0.0342807,-0.00879299,0.000479629,-0.346922,0.267095,-0.016762,0.00033883,
02575     0.8,0.01,-0.0005,1e-06,1.03,0.0042195,0.000108851
02576   };
02577   if(enu<11.0){
02578     weight = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu;
02579   }
02580   else if(enu<21.4){
02581     weight = par[4]+par[5]*enu+par[6]*enu*enu+par[7]*enu*enu*enu;
02582   }
02583   else if(enu<37.){
02584     weight = par[8]+par[9]*enu+par[10]*(enu-20.)*(enu-20.)+par[11]*(enu-20.)*(enu-20.)*(enu-20.);
02585   }
02586   else{
02587     weight = par[12]-par[13]*(enu-37.)+par[14]*(enu-37.)*(enu-37.);
02588   }
02589   return weight;
02590 }

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

Definition at line 369 of file SKZPWeightCalculator.h.

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

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

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 1993 of file SKZPWeightCalculator.cxx.

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

Referenced by GetFluxError(), and GetMaterialError().

01995 {
01996   if(!materialErrorsLoaded) LoadMaterialErrors(dir);
01997 
01998   int i = Ibeam-2;
01999   int j = IntFromRunPeriod(rp)-1;
02000   if(IntFromRunPeriod(rp)==11||IntFromRunPeriod(rp)==12) j=0;
02001   int k = det-1;
02002 
02003   if(i==1 || i==3 || i==4 || i==5 || i==7 || i==8 || i==9) return 0.;
02004   else if(i==2 && j==2) return 0.;
02005   else if(i==10 && j>0) return 0.;  //only one MINOS+ M000z200 run for now
02006   else if(i==11 && j>0) return 0.;  //only one MINOS+ M000z000 run for now
02007   else {
02008     switch(inu){
02009     case 14: return nsigma*(NuMu_MaterialError[i][j][k]->GetBinContent(NuMu_MaterialError[i][j][k]->FindBin(true_enu)));
02010     case -14: return nsigma*(NuMuBar_MaterialError[i][j][k]->GetBinContent(NuMuBar_MaterialError[i][j][k]->FindBin(true_enu)));
02011     case 12: return nsigma*(NuE_MaterialError[i][j][k]->GetBinContent(NuE_MaterialError[i][j][k]->FindBin(true_enu)));
02012     case -12: return nsigma*(NuEBar_MaterialError[i][j][k]->GetBinContent(NuEBar_MaterialError[i][j][k]->FindBin(true_enu)));
02013     default: return 0.;
02014     }  
02015   }
02016 
02017   return 0.;
02018 }

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

Definition at line 3249 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03250 {
03251   double y;
03252 
03253   double par[8];
03254 
03255   par[0] = 1.05046;
03256   par[1] = -0.0197051;
03257   par[2] = -0.000709986;
03258   par[3] = 0.000580179;
03259   par[4] = -0.0000443486;
03260   par[5] = 0.000000962613;
03261   par[6] = 0.92;
03262   par[7] = 0.6;
03263 
03264   if(enu<19.5){
03265     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;
03266   }
03267   else {
03268     y = par[6]+par[7]*(1./(enu-12.));
03269   }
03270 
03271   return y;
03272 }

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

Definition at line 3274 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03275 {
03276   double y;
03277 
03278   double par[8];
03279 
03280   par[0] = 1.03867;
03281   par[1] = 0.0130506;
03282   par[2] = -0.00751797;
03283   par[3] = 0.00109883;
03284   par[4] = -0.0000639034;
03285   par[5] = 0.00000130481;
03286   par[6] = 1.04;
03287   par[7] = -0.2;
03288 
03289   if(enu<18.9){
03290     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;
03291   }
03292   else {
03293     y = par[6]+par[7]*(1./(enu-12.));
03294   }
03295 
03296   return y;
03297 }

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

Definition at line 3041 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03042 {
03043   double y;
03044 
03045   double par[7];
03046 
03047   par[0] = 0.991629;
03048   par[1] = 0.0150514;
03049   par[2] = -0.00358913;
03050   par[3] = 0.000384422;
03051   par[4] = -0.0000136394;
03052   par[5] = 1.008;
03053   par[6] = 0.35;
03054 
03055   if(enu<13.38){
03056     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
03057   }
03058   else {
03059     y = par[5]+par[6]*(1./enu);
03060   }
03061 
03062   return y;
03063 }

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

Definition at line 3065 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03066 {
03067   double y;
03068 
03069   double par[7];
03070 
03071   par[0] = 0.991063;
03072   par[1] = 0.0114890;
03073   par[2] = -0.00123288;
03074   par[3] = 0.0000558658;
03075   par[4] = -0.000000834802;
03076   par[5] = 1.056;
03077   par[6] = -0.35;
03078 
03079   if(enu<17.925){
03080     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
03081   }
03082   else {
03083     y = par[5]+par[6]*(1./enu);
03084   }
03085 
03086   return y;
03087 }

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

Definition at line 3148 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03149 {
03150   double y;
03151 
03152   double par[8];
03153 
03154   par[0] = 1.09927;
03155   par[1] = -0.0580560;
03156   par[2] = 0.00847919;
03157   par[3] = -0.000341542;
03158   par[4] = -0.00000545052;
03159   par[5] = 0.000000394652;
03160   par[6] = 1.15;
03161   par[7] = -1.0;
03162 
03163   if(enu<20.8){
03164     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;
03165   }
03166   else {
03167     y = par[6]+par[7]*(1./(enu-14.));
03168   }
03169 
03170   return y;
03171 }

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

Definition at line 3173 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03174 {
03175   double y;
03176 
03177   double par[8];
03178 
03179   par[0] = 0.960938;
03180   par[1] = 0.169592;
03181   par[2] = -0.0611788;
03182   par[3] = 0.00782170;
03183   par[4] = -0.000416337;
03184   par[5] = 0.00000785160;
03185   par[6] = 1.12;
03186   par[7] = -1.0;
03187 
03188   if(enu<19.775){
03189     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;
03190   }
03191   else {
03192     y = par[6]+par[7]*(1./(enu-13.8));
03193   }
03194 
03195   return y;
03196 }

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

Definition at line 2916 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

02917 {
02918   double y;
02919 
02920   double par[7];
02921 
02922   par[0] = 1.01052;
02923   par[1] = 0.00135492;
02924   par[2] = 0.000352042;
02925   par[3] = -0.0000281668;
02926   par[4] = 0.000000465827;
02927   par[5] = 1.018;
02928   par[6] = 0.3;
02929 
02930   if(enu<17.2){
02931     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
02932   }
02933   else {
02934     y = par[5]+par[6]*(1./enu);
02935   }
02936 
02937   return y;
02938 }

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

Definition at line 2940 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

02941 {
02942   double y;
02943 
02944   double par[7];
02945 
02946   par[0] = 1.00806;
02947   par[1] = 0.00509031;
02948   par[2] = -0.000422559;
02949   par[3] = 0.0000180352;
02950   par[4] = -0.000000272726;
02951   par[5] = 1.018;
02952   par[6] = 0.85;
02953 
02954   if(enu<30.5){
02955     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
02956   }
02957   else {
02958     y = par[5]+par[6]*(1./enu);
02959   }
02960 
02961   return y;
02962 }

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

Definition at line 3198 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03199 {
03200   double y;
03201 
03202   double par[8];
03203 
03204   par[0] = 0.976334;
03205   par[1] = 0.0146822;
03206   par[2] = -0.00805149;
03207   par[3] = 0.00132456;
03208   par[4] = -0.0000810696;
03209   par[5] = 0.00000166323;
03210   par[6] = 1.0851;
03211   par[7] = -1.0;
03212 
03213   if(enu<19.45){
03214     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;
03215   }
03216   else{
03217     y = par[6]+par[7]*(1./(enu-9.));
03218   }
03219 
03220   return y;
03221 }

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

Definition at line 3223 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03224 {
03225   double y;
03226 
03227   double par[9];
03228 
03229   par[0] = 0.912223;
03230   par[1] = 0.106252;
03231   par[2] = -0.0341165;
03232   par[3] = 0.00490576;
03233   par[4] = -0.000344942;
03234   par[5] = 0.0000114327;
03235   par[6] = -0.000000142208;
03236   par[7] = 0.9;
03237   par[8] = 1.0;
03238 
03239   if(enu<27.55){
03240     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;
03241   }
03242   else {
03243     y = par[7]+par[8]*(1./(enu-22.));
03244   }
03245 
03246   return y;
03247 }

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

Definition at line 2964 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

02965 {
02966   double y;
02967 
02968   double par[20];
02969 
02970   par[0] =   9.79176e-01;
02971   par[1] =   5.94877e-02;
02972   par[2] =  -6.33591e-02;
02973   par[3] =   1.24537e-02;
02974   par[4] =   6.85855e-03;
02975   par[5] =  -2.08938e-03;
02976   par[6] =   2.56824e+00;
02977   par[7] =  -5.16706e-01;
02978   par[8] =   5.21584e-02;
02979   par[9] =  -1.52990e+00;
02980   par[10] =   7.10491e-01;
02981   par[11] =   7.95342e-02;
02982   par[12] =  -5.11905e-03;
02983   par[13] =  -4.11699e+00;
02984   par[14] =  -1.27508e-01;
02985   par[15] =   1.08948e-03;
02986   par[16] =   2.22361e+00;
02987   par[17] =   1.17195e+01;
02988   par[18] = 1.018;
02989   par[19] = 0.005;
02990 
02991   if(enu<2.83){
02992     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;
02993   }
02994   else if(enu<4.925){
02995     y = par[6]+par[7]*enu+par[8]*enu*enu+par[9]*(1./enu);
02996   }
02997   else if(enu<9.0){
02998     y = par[10]+par[11]*enu+par[12]*enu*enu;
02999   }
03000   else if(enu<17.6){
03001     y = par[13]+par[14]*enu+par[15]*enu*enu+par[16]*TMath::Log(enu)+par[17]*(1./enu);
03002   }
03003   else{
03004     y = par[18]+par[19]*(1./(enu-13.8));
03005   }
03006 
03007   return y;
03008 }

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

Definition at line 3010 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03011 {
03012   double y;
03013 
03014   double par[11];
03015 
03016   par[0] = 0.992562;
03017   par[1] = 0.0301506;
03018   par[2] = -0.0129656;
03019   par[3] = 0.00215436;
03020   par[4] = -0.000115552;
03021   par[5] = 0.958894;
03022   par[6] = 0.00228454;
03023   par[7] = -0.0000164352;
03024   par[8] = 0.468619;
03025   par[9] = 1.04;
03026   par[10] = -0.2;
03027 
03028   if(enu<8.35){
03029     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
03030   }
03031   else if(enu<38.75){
03032     y = par[5]+par[6]*enu+par[7]*enu*enu+par[8]*(1./enu);
03033   }
03034   else {
03035     y = par[9]+par[10]*(1./enu);
03036   }
03037 
03038   return y;
03039 }

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

Definition at line 3091 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03092 {
03093   double y;
03094 
03095   double par[12];
03096 
03097   par[0] = 0.964536;
03098   par[1] = 0.0341348;
03099   par[2] = -0.0167779;
03100   par[3] = 0.00275733;
03101   par[4] = -0.000173092;
03102   par[5] = 0.00000364374;
03103   par[6] = 65.6200;
03104   par[7] = 1.55324;
03105   par[8] = -0.0132149;
03106   par[9] = -27.7156;
03107   par[10] = -147.925;
03108   par[11] = 1.11675;
03109 
03110   if(enu<15.70){
03111     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;
03112   }
03113   else if(enu<29.8){
03114     y = -0.012+par[6]+par[7]*enu+par[8]*enu*enu+par[9]*TMath::Log(enu)+par[10]*(1./enu);
03115   }
03116   else{
03117     y = par[11];
03118   }
03119 
03120   return y;
03121 }

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

Definition at line 3123 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

03124 {
03125   double y;
03126 
03127   double par[8];
03128 
03129   par[0] = 1.01535;
03130   par[1] = -0.0167946;
03131   par[2] = 0.00921187;
03132   par[3] = -0.00133391;
03133   par[4] = 0.0000684085;
03134   par[5] = -0.00000113447;
03135   par[6] = 0.9;
03136   par[7] = 1.0;
03137 
03138   if(enu<26.95){
03139     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;
03140   }
03141   else {
03142     y = par[6]+par[7]*(1./(enu-22.));
03143   }
03144 
03145   return y;
03146 }

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

Definition at line 2839 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

02840 {
02841   double y;
02842 
02843   double par[20];
02844 
02845   par[0] =  9.91823e-01;
02846   par[1] =  8.14956e-02;
02847   par[2] = -1.44191e-01;
02848   par[3] =  7.80651e-02;
02849   par[4] = -1.29277e-02;
02850   par[5] = -1.41734e-04;
02851   par[6] =  3.62036e+00;
02852   par[7] = -8.98865e-01;
02853   par[8] =  9.61367e-02;
02854   par[9] = -2.44885e+00;
02855   par[10] =  6.81085e-01;
02856   par[11] =  9.40087e-02;
02857   par[12] = -6.50227e-03;
02858   par[13] = -2.86720e+00;
02859   par[14] = -1.14010e-01;
02860   par[15] =  1.06866e-03;
02861   par[16] =  1.77433e+00;
02862   par[17] =  8.30457e+00;
02863   par[18] =  1.018;
02864   par[19] =  0.005;
02865 
02866   if(enu<2.875){
02867     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;
02868   }
02869   else if(enu<4.375){
02870     y = par[6]+par[7]*enu+par[8]*enu*enu+par[9]*(1./enu);
02871   }
02872   else if(enu<7.460){
02873     y = par[10]+par[11]*enu+par[12]*enu*enu;
02874   }
02875   else if(enu<15.15){
02876     y = par[13]+par[14]*enu+par[15]*enu*enu+par[16]*TMath::Log(enu)+par[17]*(1./enu);
02877   }
02878   else{
02879     y = par[18]+par[19]*(1./(enu-13.8));
02880   }
02881 
02882   return y;
02883 }

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

Definition at line 2885 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

02886 {
02887   double y;
02888 
02889   double par[11];
02890 
02891   par[0] = 1.01079;
02892   par[1] = 0.0163014;
02893   par[2] = -0.00951575;
02894   par[3] = 0.00189497;
02895   par[4] = -0.000114420;
02896   par[5] = 0.745891;
02897   par[6] = 0.0198691;
02898   par[7] = -0.000440386;
02899   par[8] = 1.22518;
02900   par[9] = 1.04;
02901   par[10] = -0.2;
02902 
02903   if(enu<8.6){
02904     y = par[0]+par[1]*enu+par[2]*enu*enu+par[3]*enu*enu*enu+par[4]*enu*enu*enu*enu;
02905   }
02906   else if(enu<15.5){
02907     y = par[5]+par[6]*enu+par[7]*enu*enu+par[8]*(1./enu);
02908   }
02909   else {
02910     y = par[9]+par[10]*(1./enu);
02911   }
02912 
02913   return y;
02914 }

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

Definition at line 353 of file SKZPWeightCalculator.h.

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

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

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 1926 of file SKZPWeightCalculator.cxx.

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

Referenced by GetFluxError(), and GetOpticsError().

01928 {
01929   if(!opticsErrorsLoaded) LoadOpticsErrors(dir);
01930 
01931   int i = Ibeam-2;
01932   int j = IntFromRunPeriod(rp)-1;
01933   if(IntFromRunPeriod(rp)==11||IntFromRunPeriod(rp)==12) j=0;
01934   int k = det-1;
01935 
01936 
01937   if(i==3||i==8||i==9) return 0.; // No low intensity L010z185i in beam fit
01938   // Remove various beam configuration / run period combinations
01939   else if(i==1 && j>0) return 0.;
01940   else if(i==2 && j>1) return 0.;
01941   else if(i==4 && j>0) return 0.;
01942   else if(i==5 && j>0) return 0.;
01943   else if(i==7 && j!=1) return 0.;
01944   else if(i==10 && j>0) return 0.;  //only one MINOS+ M000z200 run for now
01945   else if(i==11 && j>0) return 0.;  //only one MINOS+ M000z000 run for now
01946   else {
01947     switch(inu){
01948     case 14: return nsigma*(NuMu_OpticsError[i][j][k]->GetBinContent(NuMu_OpticsError[i][j][k]->FindBin(true_enu)));
01949     case -14: return nsigma*(NuMuBar_OpticsError[i][j][k]->GetBinContent(NuMuBar_OpticsError[i][j][k]->FindBin(true_enu)));
01950     case 12: return nsigma*(NuE_OpticsError[i][j][k]->GetBinContent(NuE_OpticsError[i][j][k]->FindBin(true_enu)));
01951     case -12: return nsigma*(NuEBar_OpticsError[i][j][k]->GetBinContent(NuEBar_OpticsError[i][j][k]->FindBin(true_enu)));
01952     default: return 0.;
01953     }  
01954   }
01955 
01956   return 0.;
01957 }

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 1768 of file SKZPWeightCalculator.cxx.

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

01774 {
01775 
01776   //do the detector weighting
01777   detweight=GetDetWeight(ccnc,true_enu,inu,
01778                          reco_emu,reco_eshw,new_reco_emu,new_reco_eshw);
01779   beamweight=1.;
01780   if(runfrac.size()==0){
01781     MSG("SKZPWeightCalculator",Msg::kError)<<"You did not set the "
01782                                            <<"Run Period exposures."<<endl
01783                                            <<"I can not compute a "
01784                                            <<" fractional weight without "
01785                                            <<"knowing the relative exposures"<<endl;
01786     return 1.;
01787   }
01788     
01789 
01790   map<RunPeriod_t,double> beamc(runfrac.find(Ibeam)->second);
01791   map<RunPeriod_t,double>::iterator bcit(beamc.begin());
01792   double num=0.;
01793   double denom=0.;
01794   int i=0;
01795   while(bcit!=beamc.end()){
01796     RunPeriod_t rp = bcit->first;
01797     double pot = bcit->second;
01798     double w=GetBeamWeight(det,Ibeam,tptype,pt,pz,true_enu,inu,rp);
01799     num+=w*pot;
01800     denom+=pot;
01801     bcit++;
01802     //        cout<<"bcit->first "<<bcit->first<<endl;
01803     //    cout<<"bcit->second "<<bcit->second<<endl;
01804 
01805     //    cout<<"i "<<i<<" w "<<w<<" pot "<<pot<<" w*pot "<<w*pot<<" num "<<num<<" denom "<<denom<<endl;
01806     i++;
01807   }
01808     
01809     
01810   if(denom!=0){
01811     beamweight*=num/denom;
01812   }
01813 
01814 
01815   //return just the beam weight, as this is what 
01816   //most people will want
01817   //the value of the detweight is passed by reference
01818   //do not use the new values of new_reco_emu and new_reco_eshw
01819   //in the case of beam weighting only!!!!!
01820   return beamweight;
01821 }

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 1743 of file SKZPWeightCalculator.cxx.

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

01748 {
01749   int parenttype=-1;
01750   double parentpz=0.;
01751   double parentpx=0.;
01752   double parentpy=0.;
01753 
01754   parenttype = fi->tptype;
01755   parentpz = 1.*fi->tpz;
01756   parentpy = 1.*fi->tpy;
01757   parentpx = 1.*fi->tpx;
01758 
01759   double pt = sqrt(parentpy*parentpy+parentpx*parentpx);
01760 
01761   //pass the variables on to the next version of GetWeight
01762   return GetRFWWeight(det,Ibeam,parenttype,pt,parentpz,ccnc,true_enu,inu,
01763                       reco_emu,reco_eshw,new_reco_emu,
01764                       new_reco_eshw,beamweight,detweight);
01765 
01766 }

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 1722 of file SKZPWeightCalculator.cxx.

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

Referenced by GetRFWWeight().

01726 {
01727   //retrieve truth information on the neutrino interaction from
01728   //the NtpMCTruth object
01729   int ccnc = mc->iaction;
01730   double true_enu = 1.*mc->p4neu[3];
01731   int inu = mc->inu;
01732 
01733   //pass the truth info and the fluxinfo object to the next
01734   //form of GetWeight
01735   return GetRFWWeight(&(mc->flux),det,Ibeam,
01736                       ccnc,true_enu,inu,
01737                       reco_emu,reco_eshw,
01738                       new_reco_emu,new_reco_eshw,
01739                       beamweight, detweight);
01740   
01741 }

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

Definition at line 399 of file SKZPWeightCalculator.h.

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

00399                                                                                      {
00400     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 1431 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, 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().

01436 {
01437   double weight=1.;
01438 
01439   if(cfgnum==kDetXs || cfgnum==kDogwood1_Daikon07){
01440 
01441     // Target z weighting comes from the fit parameters
01442     Detector::Detector_t detector = Detector::kUnknown;
01443     if      (det==1) detector=Detector::kNear;
01444     else if (det==2) detector=Detector::kFar;
01445     
01446     Zbeam::ZbeamData_t zdata;
01447     zdata.ntype    = ntype;
01448     zdata.true_enu = Enu;
01449     zdata.detector = detector;
01450     zdata.beam     = BeamType::FromZarko(Ibeam);
01451     
01452 
01453     if(rp==kRunI){ // both weighting schemes have same parameters
01454       
01455       // target z effects
01456       if ( zdata.beam == BeamType::kL010z170i || 
01457            zdata.beam == BeamType::kL010z185i || 
01458            zdata.beam == BeamType::kL010z200i) {
01459         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[0]);
01460       } else if (zdata.beam == BeamType::kL100z200i) {
01461         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[1]);
01462       } else if (zdata.beam == BeamType::kL150z200i) {
01463         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[2]);
01464       } else if (zdata.beam == BeamType::kL250z200i) {
01465         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[3]);
01466       }
01467       
01468       // spot size
01469       if (zdata.beam == BeamType::kL250z200i ||
01470           zdata.beam == BeamType::kL100z200i) {
01471         weight *= zbeam->GetWeight(zdata,BeamSys::kBeamWidth,0.);
01472       }
01473     }
01474     else if(rp==kRunII) {
01475       
01476       if (zdata.beam == BeamType::kL010z185i) {
01477         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[4]);
01478       }
01479       else if (zdata.beam == BeamType::kL250z200i) {
01480         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[5]);
01481       }
01482 
01483       if(cfgnum==kDogwood1_Daikon07){ // apply target decay weight
01484         weight *= GetTargetDecayWeight(det,Ibeam,ntype,Enu,bs_pars[7]);
01485       }
01486 
01487     }
01488 
01489     else if(rp==kRunIII && cfgnum==kDetXs) { // use Run II beam position and Helium weight
01490 
01491       if (zdata.beam == BeamType::kL010z185i) {
01492         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[4]);
01493       }
01494       weight *= GetHeliumWeight(det,Ibeam,ntype,Enu);
01495 
01496       // DetXs target decay weight to be added when finalised
01497 
01498     }
01499 
01500     else if(rp==kRunIII && cfgnum==kDogwood1_Daikon07){
01501 
01502       if (zdata.beam == BeamType::kL010z185i) {
01503         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[6]);
01504       }
01505       weight *= GetTargetDecayWeight(det,Ibeam,ntype,Enu,bs_pars[8]);
01506       // Don't need Helium weight for Daikon07
01507 
01508     }
01509 
01510   } // end if(DetXs or Dogwood1_Daikon07)
01511   if(cfgnum==kDogwood1_Daikon07_v2 || cfgnum==kDogwood5_Daikon07_2012){
01512 
01513     // Target z weighting comes from the fit parameters
01514     Detector::Detector_t detector = Detector::kUnknown;
01515     if      (det==1) detector=Detector::kNear;
01516     else if (det==2) detector=Detector::kFar;
01517 
01518     Zbeam::ZbeamData_t zdata;
01519     zdata.ntype    = ntype;
01520     zdata.true_enu = Enu;
01521     zdata.detector = detector;
01522     zdata.beam     = BeamType::FromZarko(Ibeam);
01523     
01524     if(rp==kRunI){
01525       
01526       // target z effects
01527       if ( zdata.beam == BeamType::kL010z170i || 
01528            zdata.beam == BeamType::kL010z185i || 
01529            zdata.beam == BeamType::kL010z200i) {
01530         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[5]);
01531       } else if (zdata.beam == BeamType::kL100z200i) {
01532         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[6]);
01533       } else if (zdata.beam == BeamType::kL150z200i) {
01534         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[7]);
01535       } else if (zdata.beam == BeamType::kL250z200i) {
01536         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[8]);
01537       }
01538       
01539       // spot size
01540       if (zdata.beam == BeamType::kL250z200i ||
01541           zdata.beam == BeamType::kL100z200i) {
01542         weight *= zbeam->GetWeight(zdata,BeamSys::kBeamWidth,0.);
01543       }
01544     }
01545     else if(rp==kRunII) {
01546       
01547       if (zdata.beam == BeamType::kL010z185i) {
01548         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[9]);
01549       }
01550       else if (zdata.beam == BeamType::kL250z200i) {
01551         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[10]);
01552       }
01553 
01554       // apply target decay weight
01555       weight *= GetTargetDecayWeight(det,Ibeam,ntype,Enu,bs_pars[12]);
01556 
01557     }
01558 
01559     else if(rp==kRunIII){
01560 
01561       if (zdata.beam == BeamType::kL010z185i) {
01562         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,bs_pars[11]);
01563       }
01564 
01565       // apply target decay weight
01566       weight *= GetTargetDecayWeight(det,Ibeam,ntype,Enu,bs_pars[13]);
01567 
01568       // Don't need Helium weight for Daikon07
01569 
01570     }
01571 
01572     else if(rp==kRunIV){
01573 
01574       zdata.ntype    = -ntype; // change sign as appropriate for RHC
01575 
01576       // Run IV survey = -9.4cm, generated at -10cm => +0.6cm correction
01577       // target z effects
01578       if (zdata.beam == BeamType::kL010z185i) {
01579         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,0.6);
01580       } 
01581 
01582     }
01583 
01584 
01585     else if(rp==kRunV){
01586       // Run IV survey = -9.4cm, generated at -10cm => +0.6cm correction
01587       // target z effects
01588       if (zdata.beam == BeamType::kL010z185i) {
01589         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,0.6);
01590       } 
01591 
01592     }
01593 
01594     else if(rp==kRunVI){
01595       // Run IV survey = -9.4cm, generated at -10cm => +0.6cm correction
01596       // target z effects
01597       if (zdata.beam == BeamType::kL010z185i) {
01598         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,0.6);
01599       } 
01600 
01601     }
01602 
01603     else if(rp==kRunVII){
01604 
01605       zdata.ntype    = -ntype; // change sign as appropriate for RHC
01606 
01607       // Target 5 (Run VII) survey = -8.85cm, generated at -10cm => +1.15cm correction
01608       // target z effects
01609       if (zdata.beam == BeamType::kL010z185i) {
01610         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,1.15);
01611       } 
01612 
01613     }
01614 
01615     else if(rp==kRunVIII){
01616       // Target 1prime (Run VIII) survey = -10.4cm, generated at -10cm => -0.4cm correction
01617       // target z effects
01618       if (zdata.beam == BeamType::kL010z185i) {
01619         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,-0.4);
01620       } 
01621       //Not sure if want to apply target decay weights for runVIII. 
01622       //RunVIII is not used for the analysis at present anyway so it doesn't matter. 
01623       //May want to revisit this question in the future.
01624     }
01625 
01626     else if(rp==kRunIX){
01627 
01628       zdata.ntype    = -ntype; // change sign as appropriate for RHC
01629 
01630       // Target 2 prime (Run IX) survey = -9.18cm, generated at -10cm => +0.82cm correction
01631       // target z effects
01632       if (zdata.beam == BeamType::kL010z185i) {
01633         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,0.82);
01634       } 
01635 
01636       // apply target decay weight
01637       weight *= GetTargetDecayWeight(det,Ibeam,ntype,Enu,bs_pars[13]);
01638 
01639     }
01640 
01641     else if(rp==kRunX){
01642       // Target 7 (Run X) survey = -9.17cm, generated at -10cm => +0.83cm correction
01643       // target z effects
01644       if (zdata.beam == BeamType::kL010z185i) {
01645         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,0.83);
01646       } 
01647 
01648     }
01649 
01650     //who put this condition in? Does not make sense at all! There is no run XI for MINOS, only MINOS+
01651     //and this is taken care of in kMINOSplus_2014
01652     else if(rp==kRunXI){
01653       
01654       // target z effects
01655       if ( zdata.beam == BeamType::kL010z170i || 
01656            zdata.beam == BeamType::kL010z185i || 
01657            zdata.beam == BeamType::kL010z200i) {
01658         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,0);
01659       } else if (zdata.beam == BeamType::kL100z200i) {
01660         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,0);
01661       } else if (zdata.beam == BeamType::kL150z200i) {
01662         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,0);
01663       } else if (zdata.beam == BeamType::kL250z200i) {
01664         weight *= zbeam->GetWeight(zdata,BeamSys::kTargetZ ,0);
01665       }
01666     }
01667     //end of senseless condition
01668   
01669   }//end of kDogwood5_Daikon07_v2 and kDogwood5_Daikon07_2012
01670 
01671   else if(cfgnum==kMINOSplus_2014 || cfgnum==kMINOSplus_2014_v2){
01672     if(IntFromRunPeriod(rp)<11){
01673       MSG("SKZPWeightCalculator",Msg::kInfo)<<"You are running MINOS+ weights "
01674                                             <<" For MINOS runs - load older config "
01675                                             <<" run period weight weight set to 1.0 (no tgtZ and decay effects)"<<endl;
01676     weight*=1.0;
01677     }
01678     else{
01679     weight*=1.0;
01680     }
01681   }
01682 
01683     else {
01684     if(rp==kRunI){
01685       // cout<<"on run I"<<endl;
01686       //RUN I
01687       //ME and HE runs were lower intensity, smaller spot size,  
01688       if(BeamType::FromZarko(Ibeam)==BeamType::kL100z200i||
01689          BeamType::FromZarko(Ibeam)==BeamType::kL250z200i){
01690         //GetWeight with effect 6 already takes care of the beam type "if's"
01691         //but I thought I should just make them explicit here too
01692         weight=zbeam->GetWeight(det,Ibeam,6,0,ntype,Enu);
01693         //      cout<<"in run I weight"<<endl;
01694       }
01695     }
01696     else if(rp==kRunII || rp==kRunIII){
01697       //RUN II
01698       //reweight le10 beam to le09 beam
01699       //    cout<<"in run II weight "<<endl;
01700       if(BeamType::FromZarko(Ibeam)==BeamType::kL010z185i||
01701          BeamType::FromZarko(Ibeam)==BeamType::kL010z000i){
01702         weight=zbeam->GetWeight(det,Ibeam,15,-1.,ntype,Enu);
01703         //      cout<<"in run II weight "<<endl;
01704       }
01705 
01706       if(rp==kRunII){
01707         // target decay weight to be added when finalised, 0.6 should give ~average effect
01708         weight *= GetTargetDecayWeight(det,Ibeam,ntype,Enu,0.6);
01709       }
01710       if(rp==kRunIII){
01711         weight *= GetHeliumWeight(det,Ibeam,ntype,Enu);
01712         // target decay weight to be added when finalised, 1.25 should give ~average effect
01713         weight *= GetTargetDecayWeight(det,Ibeam,ntype,Enu,1.25);
01714       }
01715 
01716     }
01717     //  cout<<"run perioud weight "<<weight<<endl;
01718   }
01719   return weight;
01720 }

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

Definition at line 2444 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().

02445 {
02446 
02447   double weight78 = 1.0;
02448 
02449   if(det==1){ // ND
02450     if(Ibeam==2){ // L010z185i
02451       if(Ntype==56 || Ntype==14) weight78 = GetMissingFin78Weight_L010z185i_ND_Numu(true_enu);
02452       else if(Ntype==55 || Ntype==-14) weight78 = GetMissingFin78Weight_L010z185i_ND_Numubar(true_enu);
02453       else if(Ntype==53 || Ntype==12) weight78 = GetMissingFin78Weight_L010z185i_ND_Nue(true_enu);
02454       else if(Ntype==52 || Ntype==-12) weight78 = GetMissingFin78Weight_L010z185i_ND_Nuebar(true_enu);
02455       else weight78 = 1.0;
02456     }
02457     else if(Ibeam==8){ // L010z000i
02458       if(Ntype==56 || Ntype==14) weight78 = GetMissingFin78Weight_L010z000i_ND_Numu(true_enu);
02459       else if(Ntype==55 || Ntype==-14) weight78 = GetMissingFin78Weight_L010z000i_ND_Numubar(true_enu);
02460       else if(Ntype==53 || Ntype==12) weight78 = GetMissingFin78Weight_L010z000i_ND_Nue(true_enu);
02461       else if(Ntype==52 || Ntype==-12) weight78 = GetMissingFin78Weight_L010z000i_ND_Nuebar(true_enu);
02462       else weight78 = 1.0;
02463     }
02464     else weight78 = 1.0;
02465   }
02466   else if(det==2){ // FD
02467     if(Ibeam==2){ // L010z185i
02468       if(Ntype==56 || Ntype==14) weight78 = GetMissingFin78Weight_L010z185i_FD_Numu(true_enu);
02469       else if(Ntype==55 || Ntype==-14) weight78 = GetMissingFin78Weight_L010z185i_FD_Numubar(true_enu);
02470       else if(Ntype==53 || Ntype==12) weight78 = GetMissingFin78Weight_L010z185i_FD_Nue(true_enu);
02471       else if(Ntype==52 || Ntype==-12) weight78 = GetMissingFin78Weight_L010z185i_FD_Nuebar(true_enu);
02472       else weight78 = 1.0;
02473     }
02474     else if(Ibeam==8){ // L010z000i
02475       if(Ntype==56 || Ntype==14) weight78 = GetMissingFin78Weight_L010z000i_FD_Numu(true_enu);
02476       else if(Ntype==55 || Ntype==-14) weight78 = GetMissingFin78Weight_L010z000i_FD_Numubar(true_enu);
02477       else if(Ntype==53 || Ntype==12) weight78 = GetMissingFin78Weight_L010z000i_FD_Nue(true_enu);
02478       else if(Ntype==52 || Ntype==-12) weight78 = GetMissingFin78Weight_L010z000i_FD_Nuebar(true_enu);
02479       else weight78 = 1.0;
02480     }
02481     else weight78 = 1.0;
02482   }
02483   else weight78 = 1.0;
02484 
02485   // Now convert to fractional weight
02486   // eg: if want to remove 4 fins then double the distance from unity for the weight
02487 
02488   double weight = 1.;
02489 
02490   if(weight78<0.){
02491     weight = 1.0-(fin78fraction*(1.0-weight78));
02492   }
02493   else if(weight78>0.){
02494     weight = 1.0+(fin78fraction*(weight78-1.0));
02495   }
02496 
02497   return weight;
02498 
02499 }

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

Definition at line 361 of file SKZPWeightCalculator.h.

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

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

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 1960 of file SKZPWeightCalculator.cxx.

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

Referenced by GetFluxError(), and GetTargetZError().

01962 {
01963   if(!targetZErrorsLoaded) LoadTargetZErrors(dir);
01964 
01965   int i = Ibeam-2;
01966   int j = IntFromRunPeriod(rp)-1;
01967   if(IntFromRunPeriod(rp)==11||IntFromRunPeriod(rp)==12) j=0;
01968   int k = det-1;
01969 
01970   if(i==3||i==8||i==9) 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 if(i==10 && j>0) return 0.;  //only one MINOS+ M000z200 run for now
01978   else if(i==11 && j>0) return 0.;  //only one MINOS+ M000z000 run for now
01979   else {
01980     switch(inu){
01981     case 14: return nsigma*(NuMu_TargetZError[i][j][k]->GetBinContent(NuMu_TargetZError[i][j][k]->FindBin(true_enu)));
01982     case -14: return 0.; // Target z error only computed for muon neutrinos
01983     case 12: return 0.;
01984     case -12: return 0.;
01985     default: return 0.;
01986     }  
01987   }
01988 
01989   return 0.;
01990 }

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 230 of file SKZPWeightCalculator.h.

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

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

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 215 of file SKZPWeightCalculator.h.

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

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

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 202 of file SKZPWeightCalculator.h.

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

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

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 632 of file SKZPWeightCalculator.cxx.

References GetBeamWeight(), and GetDetWeight().

00640 {
00641   
00642   //do the beam weighting
00643   beamweight=GetBeamWeight(det,Ibeam,tptype,pt,pz,true_enu,inu,rp);
00644   //do the detector weighting
00645   detweight=GetDetWeight(ccnc,true_enu,inu,
00646                          reco_emu,reco_eshw,new_reco_emu,new_reco_eshw,true_eshw,ei);
00647 
00648   //return just the beam weight, as this is what 
00649   //most people will want
00650   //the value of the detweight is passed by reference
00651   //do not use the new values of new_reco_emu and new_reco_eshw
00652   //in the case of beam weighting only!!!!!
00653   return beamweight;
00654 
00655 }

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 587 of file SKZPWeightCalculator.cxx.

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

00594 {
00595   int parenttype=-1;
00596   double parentpz=0.;
00597   double parentpx=0.;
00598   double parentpy=0.;
00599 
00600   //extract the flux weighting variables from the fluxinfo object
00601   //due to bug in v18 flux files, the tp* variables
00602   //(i.e. info pertaining to the particle created in the target)
00603   //are the same as the pp* variables
00604   //(i.e. the info pertaining to the particle leaving the target)
00605   //in v19 flux and beyond, this has been fixed.
00606   //In the future, we will probably want to weight based on the tp variables,
00607   //but to compare with what was done before, I want the option to 
00608   //use the pp* variables, which is why this if statement is here.
00609 
00610   if(cfgname=="v19fit"){  //this isn't a real config yet
00611     parenttype = fi->ptype;
00612     parentpz = 1.*fi->pppz;
00613     parentpy = 1.*fi->ppdydz*parentpz;
00614     parentpx = 1.*fi->ppdxdz*parentpz;
00615   }
00616   else{
00617     parenttype = fi->tptype;
00618     parentpz = 1.*fi->tpz;
00619     parentpy = 1.*fi->tpy;
00620     parentpx = 1.*fi->tpx;
00621   }
00622 
00623   double pt = sqrt(parentpy*parentpy+parentpx*parentpx);
00624 
00625   //pass the variables on to the next version of GetWeight
00626   return GetWeight(det,Ibeam,parenttype,pt,parentpz,ccnc,true_enu,inu,
00627                    reco_emu,reco_eshw,new_reco_emu,new_reco_eshw,beamweight,detweight,
00628                    rp,true_eshw,ei);
00629 
00630 }

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 561 of file SKZPWeightCalculator.cxx.

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

00567 {
00568 
00569 
00570   //retrieve truth information on the neutrino interaction from
00571   //the NtpMCTruth object
00572   int ccnc = mc->iaction;
00573   double true_enu = 1.*mc->p4neu[3];
00574   int inu = mc->inu;
00575 
00576 
00577   //pass the truth info and the fluxinfo object to the next
00578   //form of GetWeight
00579   return GetWeight(&(mc->flux),det,Ibeam,
00580                    ccnc,true_enu,inu,
00581                    reco_emu,reco_eshw,
00582                    new_reco_emu,new_reco_eshw,
00583                    beamweight, detweight,rp,true_eshw,ei);
00584 
00585 }

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

Reimplemented from WeightCalculator.

Definition at line 177 of file SKZPWeightCalculator.h.

00177 {return 1.;}

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

Reimplemented from WeightCalculator.

Definition at line 513 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().

00514 {
00515   //don't use me I'm slow.
00516   //the GetWeight function this version calls has been tested,
00517   //but reading the event info from the registry has not 
00518   //been tested (it should work, I just haven't tried it yet)
00519   bool gotallinfo=true;
00520   int det,ibeam,tptype,ccnc,inu;
00521   double pt, pz, true_enu, reco_emu, reco_eshw;
00522   double new_reco_emu, new_reco_eshw, beamweight, detweight;
00523   
00524   if(!eventinfo->Get("evt:det",det)) gotallinfo=false;
00525   if(!eventinfo->Get("evt:ibeam",ibeam)) gotallinfo=false;
00526   if(!eventinfo->Get("evt:tptype",tptype)) gotallinfo=false;
00527   if(!eventinfo->Get("evt:ccnc",ccnc)) gotallinfo=false;
00528   if(!eventinfo->Get("evt:inu",inu)) gotallinfo=false;
00529   if(!eventinfo->Get("evt:pt",pt)) gotallinfo=false;
00530   if(!eventinfo->Get("evt:pz",pz)) gotallinfo=false; 
00531   if(!eventinfo->Get("evt:true_enu",true_enu)) gotallinfo=false;  
00532   if(!eventinfo->Get("evt:reco_emu",reco_emu)) gotallinfo=false;  
00533   if(!eventinfo->Get("evt:reco_eshw",reco_eshw)) gotallinfo=false;
00534 
00535   if(!gotallinfo){
00536     MSG("SKZPWeightCalculator",Msg::kError)<<"Could not retrieve all necessary"
00537                                            <<" event information from "
00538                                            <<"eventinfo registry, returning 1."
00539                                            <<endl;
00540     return 1.;
00541   }
00542 
00543   GetWeight(det,ibeam,tptype,pt,pz,ccnc,
00544             true_enu,inu,reco_emu,reco_eshw,
00545             new_reco_emu,new_reco_eshw,beamweight,detweight);
00546 
00547   //put new reco energies and weights into registry;
00548   eventinfo->UnLockKeys();
00549   eventinfo->Set("evt:new_reco_emu",new_reco_emu);
00550   eventinfo->Set("evt:new_reco_eshw",new_reco_eshw);
00551   eventinfo->Set("evt:beamweight",beamweight);
00552   eventinfo->Set("evt:detweight",detweight);
00553   eventinfo->LockKeys();
00554 
00555   // this function returns only the beam weight, as that is 
00556   //what most people are encouraged to use, the detweight is
00557   //returned through the registry
00558   return beamweight;
00559 }

Zbeam * SKZPWeightCalculator::GetZbeam (  ) 

Definition at line 1850 of file SKZPWeightCalculator.cxx.

References zbeam.

01851 {
01852    return zbeam;
01853 }

Zfluk * SKZPWeightCalculator::GetZfluk (  ) 

Definition at line 1856 of file SKZPWeightCalculator.cxx.

References zfluk.

01857 {
01858    return zfluk;
01859 }

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

Definition at line 104 of file SKZPWeightCalculator.h.

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

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

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

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

Definition at line 2400 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, APSweightsLoaded, cfgnum, GetAPSweightsFile(), Msg::kInfo, kMINOSplus_2014, kMINOSplus_2014_v2, MSG, 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, and Nu_ND_APSW_M02V5.

Referenced by GetAPSweight().

02401 {
02402   if(cfgnum!=kMINOSplus_2014 && cfgnum!=kMINOSplus_2014_v2){
02403     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Should not be loading APS weights "
02404                                           <<"with this configuration, you need"
02405                                           <<" MINOSplus_2014 or later"
02406                                           <<" (unless you are running beam fits"
02407                                           <<" and need them right now)."
02408                                           << endl;
02409     return;
02410   }
02411 
02412   TFile* f = GetAPSweightsFile(dir);
02413     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Got APS Weights 2014 file. "
02414                                           <<endl;
02415 
02416   Nu_ND_APSW_M00V4 = (TH1D*)f->Get("Nu_ND_APSW_M00V4");
02417   Nu_FD_APSW_M00V4 = (TH1D*)f->Get("Nu_FD_APSW_M00V4");
02418   Nu_FN_APSW_M00V4 = (TH1D*)f->Get("Nu_FN_APSW_M00V4");
02419   AntiNu_ND_APSW_M00V4 = (TH1D*)f->Get("AntiNu_ND_APSW_M00V4");
02420   AntiNu_FD_APSW_M00V4 = (TH1D*)f->Get("AntiNu_FD_APSW_M00V4");
02421   AntiNu_FN_APSW_M00V4 = (TH1D*)f->Get("AntiNu_FN_APSW_M00V4");
02422   Nu_ND_APSW_M02V4 = (TH1D*)f->Get("Nu_ND_APSW_M02V4");
02423   Nu_FD_APSW_M02V4 = (TH1D*)f->Get("Nu_FD_APSW_M02V4");
02424   Nu_FN_APSW_M02V4 = (TH1D*)f->Get("Nu_FN_APSW_M02V4");
02425   AntiNu_ND_APSW_M02V4 = (TH1D*)f->Get("AntiNu_ND_APSW_M02V4");
02426   AntiNu_FD_APSW_M02V4 = (TH1D*)f->Get("AntiNu_FD_APSW_M02V4");
02427   AntiNu_FN_APSW_M02V4 = (TH1D*)f->Get("AntiNu_FN_APSW_M02V4");
02428   Nu_ND_APSW_M02V5 = (TH1D*)f->Get("Nu_ND_APSW_M02V5");
02429   Nu_FD_APSW_M02V5 = (TH1D*)f->Get("Nu_FD_APSW_M02V5");
02430   Nu_FN_APSW_M02V5 = (TH1D*)f->Get("Nu_FN_APSW_M02V5");
02431   AntiNu_ND_APSW_M02V5 = (TH1D*)f->Get("AntiNu_ND_APSW_M02V5");
02432   AntiNu_FD_APSW_M02V5 = (TH1D*)f->Get("AntiNu_FD_APSW_M02V5");
02433   AntiNu_FN_APSW_M02V5 = (TH1D*)f->Get("AntiNu_FN_APSW_M02V5");
02434 
02435   APSweightsLoaded = true;
02436 
02437   MSG("SKZPWeightCalculator",Msg::kInfo)<<"APSweightLoaded =  "<<APSweightsLoaded<<endl;
02438 
02439 }

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

Definition at line 2337 of file SKZPWeightCalculator.cxx.

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

Referenced by GetDecayError().

02338 {
02339   if(cfgnum!=kDogwood1_Daikon07_v2&&cfgnum!=kDogwood5_Daikon07_2012 && cfgnum!=kMINOSplus_2014  && cfgnum!=kMINOSplus_2014_v2){
02340     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Should not be loading errors "
02341                                           <<"with this configuration, you "
02342                                           <<"need Dogwood1Daikon07_v2 Dogwood5Daikon07_2012 or MINOSplus_2014(_v2)" << endl;
02343     return;
02344   }
02345   TFile* f = GetBeamSysFile(dir);
02346   char name[200];
02347   // i==beam configuration
02348   // j==run period
02349   // k==detector
02350   for(int i=0;i<12;++i){
02351     if(i!=0 && i!=6) continue;
02352     for(int j=0;j<3;++j){
02353       for(int k=0;k<3;++k){
02354         sprintf(name,"NuMu_DecayError[%d][%d][%d]",i,j,k);
02355         NuMu_DecayError[i][j][k] = (TH1D*)f->Get(name);
02356         sprintf(name,"NuMuBar_DecayError[%d][%d][%d]",i,j,k);
02357         NuMuBar_DecayError[i][j][k] = (TH1D*)f->Get(name);
02358         sprintf(name,"NuE_DecayError[%d][%d][%d]",i,j,k);
02359         NuE_DecayError[i][j][k] = (TH1D*)f->Get(name);
02360         sprintf(name,"NuEBar_DecayError[%d][%d][%d]",i,j,k);
02361         NuEBar_DecayError[i][j][k] = (TH1D*)f->Get(name);
02362       }
02363     }
02364   }
02365   decayErrorsLoaded = true;
02366 }

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

Definition at line 2369 of file SKZPWeightCalculator.cxx.

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

Referenced by GetDecayModelError().

02370 {
02371   if(cfgnum!=kDogwood1_Daikon07_v2&&cfgnum!=kDogwood5_Daikon07_2012 && cfgnum!=kMINOSplus_2014 && cfgnum!=kMINOSplus_2014_v2){
02372     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Should not be loading errors "
02373                                           <<"with this configuration, you "
02374                                           <<"need Dogwood1Daikon07_v2 or Dogwood5Daikon07_2012 or MINOSplus_2014(_v2)" << endl;
02375     return;
02376   }
02377   TFile* f = GetBeamSysFile(dir);
02378   char name[200];
02379   // i==beam configuration
02380   // j==run period
02381   // k==detector
02382   for(int i=0;i<12;++i){
02383     if(i!=0) continue;
02384     for(int j=0;j<3;++j){
02385       for(int k=0;k<3;++k){
02386         sprintf(name,"NuMu_DecayModelError[%d][%d][%d]",i,j,k);
02387         NuMu_DecayModelError[i][j][k] = (TH1D*)f->Get(name);
02388         sprintf(name,"NuMuBar_DecayModelError[%d][%d][%d]",i,j,k);
02389         NuMuBar_DecayModelError[i][j][k] = (TH1D*)f->Get(name);
02390         sprintf(name,"NuE_DecayModelError[%d][%d][%d]",i,j,k);
02391         NuE_DecayModelError[i][j][k] = (TH1D*)f->Get(name);
02392         sprintf(name,"NuEBar_DecayModelError[%d][%d][%d]",i,j,k);
02393         NuEBar_DecayModelError[i][j][k] = (TH1D*)f->Get(name);
02394       }
02395     }
02396   }
02397   decayModelErrorsLoaded = true;
02398 }

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

Definition at line 2149 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().

02150 {
02151   if(cfgnum!=kDogwood1_Daikon07_v2){
02152     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Should not be loading errors "
02153                                           <<"with this configuration, you "
02154                                           <<"need Dogwood1Daikon07_v2." << endl;
02155     return;
02156   }
02157   TFile* f = GetBeamSysFile(dir);
02158   char name[200];
02159   // i==beam configuration
02160   // j==run period
02161   // k==detector
02162   for(int i=0;i<8;++i){
02163     if(i==3) continue; // No low intensity L010z185i in beam fit
02164     for(int j=0;j<3;++j){
02165       // Remove various beam configuration / run period combinations
02166       if(i==1 && j>0) continue;
02167       if(i==2 && j>1) continue;
02168       if(i==4 && j>0) continue;
02169       if(i==5 && j>0) continue;
02170       if(i==7 && j!=1) continue;
02171       for(int k=0;k<3;++k){
02172         sprintf(name,"NuMu_HadProdError[%d][%d][%d]",i,j,k);
02173         NuMu_HadProdError[i][j][k] = (TH1D*)f->Get(name);
02174         sprintf(name,"NuMuBar_HadProdError[%d][%d][%d]",i,j,k);
02175         NuMuBar_HadProdError[i][j][k] = (TH1D*)f->Get(name);
02176         sprintf(name,"NuE_HadProdError[%d][%d][%d]",i,j,k);
02177         NuE_HadProdError[i][j][k] = (TH1D*)f->Get(name);
02178         sprintf(name,"NuEBar_HadProdError[%d][%d][%d]",i,j,k);
02179         NuEBar_HadProdError[i][j][k] = (TH1D*)f->Get(name);
02180       }
02181     }
02182   }
02183   hadProdErrorsLoaded = true;
02184 }

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

Definition at line 2187 of file SKZPWeightCalculator.cxx.

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

Referenced by GetHadProdError2012().

02188 {
02189   if(cfgnum!=kDogwood5_Daikon07_2012 && cfgnum!=kMINOSplus_2014 && cfgnum!=kMINOSplus_2014_v2){
02190     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Should not be loading errors "
02191                                           <<"with this configuration, you "
02192                                           <<"need Dogwood5Daikon07_2012 or MINOSplus_2014(_v2)." << endl;
02193     return;
02194   }
02195   TFile* f = GetBeamSysFile(dir);
02196   char name[200];
02197   // i==beam configuration
02198   // j==run period
02199   // k==detector
02200   for(int i=0;i<12;++i){
02201     if(i==3||i==8||i==9) continue; // No low intensity L010z185i in beam fit
02202     for(int j=0;j<4;++j){
02203       // Remove various beam configuration / run period combinations
02204       if(i==1 && j>0) continue;
02205       if(i==2 && j>1) continue;
02206       if(i==4 && j>0) continue;
02207       if(i==5 && j>0) continue;
02208       if(i==7 && j!=1) continue;
02209       if(i==10 && j>0) continue;  //MINOS+ only has one run for M000z200 at present
02210       if(i==11 && j>0) continue;  //MINOS+ only has one run for M000z000 at present
02211       for(int k=0;k<3;++k){
02212         sprintf(name,"NuMu_HadProdError2012[%d][%d][%d]",i,j,k);
02213         NuMu_HadProdError2012[i][j][k] = (TH1D*)f->Get(name);
02214         sprintf(name,"NuMuBar_HadProdError2012[%d][%d][%d]",i,j,k);
02215         NuMuBar_HadProdError2012[i][j][k] = (TH1D*)f->Get(name);
02216         sprintf(name,"NuE_HadProdError2012[%d][%d][%d]",i,j,k);
02217         NuE_HadProdError2012[i][j][k] = (TH1D*)f->Get(name);
02218         sprintf(name,"NuEBar_HadProdError2012[%d][%d][%d]",i,j,k);
02219         NuEBar_HadProdError2012[i][j][k] = (TH1D*)f->Get(name);
02220       }
02221     }
02222   }
02223   hadProdErrors2012Loaded = true;
02224 }

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

Definition at line 2302 of file SKZPWeightCalculator.cxx.

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

Referenced by GetMaterialError().

02303 {
02304   if(cfgnum!=kDogwood1_Daikon07_v2&&cfgnum!=kDogwood5_Daikon07_2012 && cfgnum!=kMINOSplus_2014 && cfgnum!=kMINOSplus_2014_v2){
02305     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Should not be loading errors "
02306                                           <<"with this configuration, you "
02307                                           <<"need Dogwood1Daikon07_v2 or Dogwood5Daikon07_2012 or MINOSplus_2014(_v2)" << endl;
02308     return;
02309   }
02310   TFile* f = GetBeamSysFile(dir);
02311   char name[200];
02312   // i==beam configuration
02313   // j==run period
02314   // k==detector
02315   for(int i=0;i<12;++i){
02316     if(i==1 || i==3 || i==4 || i==5 || i==7 || i==8 || i==9) continue;
02317     for(int j=0;j<3;++j){
02318       if(i==2 && j==2) continue;
02319       if(i==10 && j>0) continue;  //MINOS+ only has one run for M000z200 at present
02320       if(i==11 && j>0) continue;  //MINOS+ only has one run for M000z000 at present
02321       for(int k=0;k<3;++k){
02322         sprintf(name,"NuMu_MaterialError[%d][%d][%d]",i,j,k);
02323         NuMu_MaterialError[i][j][k] = (TH1D*)f->Get(name);
02324         sprintf(name,"NuMuBar_MaterialError[%d][%d][%d]",i,j,k);
02325         NuMuBar_MaterialError[i][j][k] = (TH1D*)f->Get(name);
02326         sprintf(name,"NuE_MaterialError[%d][%d][%d]",i,j,k);
02327         NuE_MaterialError[i][j][k] = (TH1D*)f->Get(name);
02328         sprintf(name,"NuEBar_MaterialError[%d][%d][%d]",i,j,k);
02329         NuEBar_MaterialError[i][j][k] = (TH1D*)f->Get(name);
02330       }
02331     }
02332   }
02333   materialErrorsLoaded = true;
02334 }

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

Definition at line 2228 of file SKZPWeightCalculator.cxx.

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

Referenced by GetOpticsError().

02229 {
02230   if(cfgnum!=kDogwood1_Daikon07_v2&&cfgnum!=kDogwood5_Daikon07_2012 && cfgnum!=kMINOSplus_2014 && cfgnum!=kMINOSplus_2014_v2){
02231     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Should not be loading errors "
02232                                           <<"with this configuration, you "
02233                                           <<"need Dogwood1Daikon07_v2 or Dogwood5Daikon07_2012 or MINOSplus_2014(_v2)" << endl;
02234     return;
02235   }
02236   TFile* f = GetBeamSysFile(dir);
02237   char name[200];
02238   // i==beam configuration
02239   // j==run period
02240   // k==detector
02241   for(int i=0;i<12;++i){
02242     if(i==3||i==8||i==9) continue; // No low intensity L010z185i in beam fit
02243     for(int j=0;j<3;++j){
02244       // Remove various beam configuration / run period combinations
02245       if(i==1 && j>0) continue;
02246       if(i==2 && j>1) continue;
02247       if(i==4 && j>0) continue;
02248       if(i==5 && j>0) continue;
02249       if(i==7 && j!=1) continue;
02250       if(i==10 && j>0) continue;  //MINOS+ only has one run for M000z200 at present
02251       if(i==11 && j>0) continue;  //MINOS+ only has one run for M000z000 at present
02252       for(int k=0;k<3;++k){
02253         sprintf(name,"NuMu_OpticsError[%d][%d][%d]",i,j,k);
02254         NuMu_OpticsError[i][j][k] = (TH1D*)f->Get(name);
02255         sprintf(name,"NuMuBar_OpticsError[%d][%d][%d]",i,j,k);
02256         NuMuBar_OpticsError[i][j][k] = (TH1D*)f->Get(name);
02257         sprintf(name,"NuE_OpticsError[%d][%d][%d]",i,j,k);
02258         NuE_OpticsError[i][j][k] = (TH1D*)f->Get(name);
02259         sprintf(name,"NuEBar_OpticsError[%d][%d][%d]",i,j,k);
02260         NuEBar_OpticsError[i][j][k] = (TH1D*)f->Get(name);
02261       }
02262     }
02263   }
02264   opticsErrorsLoaded = true;
02265 }

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

Definition at line 2268 of file SKZPWeightCalculator.cxx.

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

Referenced by GetTargetZError().

02269 {
02270   if(cfgnum!=kDogwood1_Daikon07_v2&&cfgnum!=kDogwood5_Daikon07_2012 && cfgnum!=kMINOSplus_2014 && cfgnum!=kMINOSplus_2014_v2){
02271     MSG("SKZPWeightCalculator",Msg::kInfo)<<"Should not be loading errors "
02272                                           <<"with this configuration, you "
02273                                           <<"need Dogwood1Daikon07_v2 or Dogwood5Daikon07_2012 or MINOSplus_2014(_v2)" << endl;
02274     return;
02275   }
02276   TFile* f = GetBeamSysFile(dir);
02277   char name[200];
02278   // i==beam configuration
02279   // j==run period
02280   // k==detector
02281   for(int i=0;i<12;++i){
02282     if(i==3||i==8||i==9) continue; // No low intensity L010z185i in beam fit
02283     for(int j=0;j<3;++j){
02284       // Remove various beam configuration / run period combinations
02285       if(i==1 && j>0) continue;
02286       if(i==2 && j>1) continue;
02287       if(i==4 && j>0) continue;
02288       if(i==5 && j>0) continue;
02289       if(i==7 && j!=1) continue;
02290       if(i==10 && j>0) continue;  //MINOS+ only has one run for M000z200 at present
02291       if(i==11 && j>0) continue;  //MINOS+ only has one run for M000z000 at present
02292       for(int k=0;k<3;++k){
02293         sprintf(name,"NuMu_TargetZError[%d][%d][%d]",i,j,k);
02294         NuMu_TargetZError[i][j][k] = (TH1D*)f->Get(name);
02295       }
02296     }
02297   }
02298   targetZErrorsLoaded = true;
02299 }

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

Definition at line 1179 of file SKZPWeightCalculator.cxx.

References bs_pars, cfgname, det_pars, and hp_pars.

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

01180 {
01181   o<<"Reweighting to : "<<cfgname<<endl;
01182   for(unsigned int i=0;i<bs_pars.size();i++){
01183     o<<"Beam Sys par "<<i<<" "<<bs_pars[i]<<endl;
01184   }
01185   for(unsigned int i=0;i<hp_pars.size();i++){
01186     o<<"Had. Prod par "<<i<<" "<<hp_pars[i]<<endl;
01187   }
01188   for(unsigned int i=0;i<det_pars.size();i++){
01189     o<<"Det par "<<i<<" "<<det_pars[i]<<endl;
01190   }
01191 }

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

Definition at line 71 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().

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

int SKZPWeightCalculator::RunPeriodIntFromValidity ( VldContext  vc  ) 

Definition at line 1413 of file SKZPWeightCalculator.cxx.

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

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

01414 {
01415   int rp = 1; // default Run I
01416   VldTimeStamp ts = vc.GetTimeStamp();
01417   if(ts.GetDate()<(*vtsRunIEnd).GetDate()) rp = 1;
01418   else if(ts.GetDate()<(*vtsRunIIEnd).GetDate()) rp = 2;
01419   else if(ts.GetDate()<(*vtsRunIIIEnd).GetDate()) rp = 3;
01420   else if(ts.GetDate()<(*vtsRunIVEnd).GetDate()) rp = 4;
01421   else if(ts.GetDate()<(*vtsRunVEnd).GetDate()) rp = 5;
01422   else if(ts.GetDate()<(*vtsRunVIEnd).GetDate()) rp = 6;
01423   else if(ts.GetDate()<(*vtsRunVIIEnd).GetDate()) rp = 7;
01424   else if(ts.GetDate()<(*vtsRunVIIIEnd).GetDate()) rp = 8;
01425   else if(ts.GetDate()<(*vtsRunIXEnd).GetDate()) rp = 9;
01426   else if(ts.GetDate()<(*vtsRunXEnd).GetDate()) rp = 10;
01427   else rp = 11;
01428   return rp;
01429 }

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

Referenced by Config(), and SetReweightConfigName().

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

Definition at line 154 of file SKZPWeightCalculator.h.

References cfgname, and SetConfigNum().

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

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

Definition at line 1823 of file SKZPWeightCalculator.cxx.

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

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

01824 {
01825 
01826   map<int, map<RunPeriod_t,double> >::iterator it(runfrac.find(Ibeam));
01827   if(it!=runfrac.end()){
01828     //already have an entry for this beam type, just insert (runnum,pot)
01829     if((it->second).find(rp)==it->second.end()){
01830       (it->second)[rp]=pot;
01831     }
01832     else{
01833       MSG("SKZPWeightCalculator",Msg::kError)<<"You already specified pot for "
01834                                              <<BeamType::AsString(BeamType::FromZarko(Ibeam))
01835                                              <<" beam, with run period "<<rp<<endl
01836                                              <<"I will not overwrite!!!"<<endl;
01837     } 
01838   }
01839   else{
01840     //don't have this Ibeam yet, make a new map
01841     map<RunPeriod_t, double> m;
01842     m[rp]=pot;
01843     runfrac[Ibeam]=m;
01844   }
01845 
01846 
01847 }

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

Definition at line 499 of file SKZPWeightCalculator.cxx.

References kAntiNuMu, kNue, kNuMuCC, and sampsel.

Referenced by NuZBeamReweight::GetWeights().

00500 {
00501   if(ss=="numu"||ss=="NuMu"||ss=="CC"){
00502     sampsel=kNuMuCC;
00503   }
00504   else if(ss=="anumu"||ss=="antinumu"||ss=="numubar"||ss=="AntiNuMu"||ss=="NuMuBar"){
00505     sampsel=kAntiNuMu;
00506   }
00507   else if(ss=="nue"||ss=="Nue"){
00508     sampsel=kNue;
00509   }
00510 
00511 }


Member Data Documentation

Definition at line 513 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 494 of file SKZPWeightCalculator.h.

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

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

Definition at line 428 of file SKZPWeightCalculator.h.

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

Definition at line 453 of file SKZPWeightCalculator.h.

Referenced by Config(), and GetDetWeight().

std::string SKZPWeightCalculator::fTopDir [private]

Definition at line 460 of file SKZPWeightCalculator.h.

Referenced by GetAPSweightsFile(), and GetBeamSysFile().

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

Definition at line 427 of file SKZPWeightCalculator.h.

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

Definition at line 404 of file SKZPWeightCalculator.h.

Referenced by Config().

Definition at line 406 of file SKZPWeightCalculator.h.

Referenced by Config().

Definition at line 405 of file SKZPWeightCalculator.h.

Referenced by Config().

Definition at line 423 of file SKZPWeightCalculator.h.

Referenced by Config(), GetDetWeight(), 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 424 of file SKZPWeightCalculator.h.

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

Definition at line 476 of file SKZPWeightCalculator.h.

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

Definition at line 408 of file SKZPWeightCalculator.h.

Referenced by Config().

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

Definition at line 434 of file SKZPWeightCalculator.h.

Referenced by GetRFWWeight(), and SetRunFrac().

Definition at line 416 of file SKZPWeightCalculator.h.

Referenced by GetDetWeight(), and SetSampleSelection().

Definition at line 137 of file SKZPWeightCalculator.h.

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

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 145 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 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 146 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().

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

Definition at line 430 of file SKZPWeightCalculator.h.

Referenced by GetDetWeight().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1