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

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

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

Definition at line 2110 of file SKZPWeightCalculator.cxx.

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

Referenced by LoadAPSweights().

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

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

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

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

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

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

Referenced by GetDecayError(), and GetFluxError().

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

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

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

Referenced by GetDecayModelError(), and GetFluxError().

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

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

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

Referenced by GetFluxError(), and GetHadProdError().

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

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

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

Referenced by GetFluxError(), and GetHadProdError2012().

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

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

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

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

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

Definition at line 2809 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

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

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

Definition at line 2824 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

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

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

Definition at line 2771 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

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

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

Definition at line 2790 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

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

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

Definition at line 2741 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

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

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

Definition at line 2756 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

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

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

Definition at line 2700 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

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

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

Definition at line 2719 of file SKZPWeightCalculator.cxx.

References MuELoss::e.

Referenced by GetHeliumWeight().

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

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

Definition at line 2670 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

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

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

Definition at line 2685 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

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

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

Definition at line 2629 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

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

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

Definition at line 2651 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

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

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

Definition at line 2594 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

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

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

Definition at line 2614 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

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

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

Definition at line 2546 of file SKZPWeightCalculator.cxx.

Referenced by GetHeliumWeight().

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

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

Definition at line 2572 of file SKZPWeightCalculator.cxx.

References MuELoss::e.

Referenced by GetHeliumWeight().

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

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

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

Referenced by GetFluxError(), and GetMaterialError().

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

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

Definition at line 3251 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

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

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

Definition at line 3276 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

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

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

Definition at line 3043 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

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

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

Definition at line 3067 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

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

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

Definition at line 3150 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

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

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

Definition at line 3175 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

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

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

Definition at line 2918 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

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

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

Definition at line 2942 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

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

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

Definition at line 3200 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

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

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

Definition at line 3225 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

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

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

Definition at line 2966 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

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

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

Definition at line 3012 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

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

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

Definition at line 3093 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

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

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

Definition at line 3125 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

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

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

Definition at line 2841 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

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

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

Definition at line 2887 of file SKZPWeightCalculator.cxx.

Referenced by GetTargetDecayWeight().

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

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

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

Referenced by GetFluxError(), and GetOpticsError().

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

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

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

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

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

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

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

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

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

Referenced by GetRFWWeight().

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

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

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

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

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

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

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

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

Referenced by GetFluxError(), and GetTargetZError().

01964 {
01965   if(!targetZErrorsLoaded) LoadTargetZErrors(dir);
01966 
01967   int i = Ibeam-2;
01968   int j = IntFromRunPeriod(rp)-1;
01969   if(IntFromRunPeriod(rp)==11||IntFromRunPeriod(rp)==12) j=0;
01970   int k = det-1;
01971 
01972   if(i==3||i==8||i==9) return 0.; // No low intensity L010z185i in beam fit
01973   // Remove various beam configuration / run period combinations
01974   else if(i==1 && j>0) return 0.;
01975   else if(i==2 && j>1) return 0.;
01976   else if(i==4 && j>0) return 0.;
01977   else if(i==5 && j>0) return 0.;
01978   else if(i==7 && j!=1) return 0.;
01979   else if(i==10 && j>0) return 0.;  //only one MINOS+ M000z200 run for now
01980   else if(i==11 && j>0) return 0.;  //only one MINOS+ M000z000 run for now
01981   else {
01982     switch(inu){
01983     case 14: return nsigma*(NuMu_TargetZError[i][j][k]->GetBinContent(NuMu_TargetZError[i][j][k]->FindBin(true_enu)));
01984     case -14: return 0.; // Target z error only computed for muon neutrinos
01985     case 12: return 0.;
01986     case -12: return 0.;
01987     default: return 0.;
01988     }  
01989   }
01990 
01991   return 0.;
01992 }

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

References zbeam.

01853 {
01854    return zbeam;
01855 }

Zfluk * SKZPWeightCalculator::GetZfluk (  ) 

Definition at line 1858 of file SKZPWeightCalculator.cxx.

References zfluk.

01859 {
01860    return zfluk;
01861 }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 if(ts.GetDate()<(*vtsRunXIEnd).GetDate()) rp = 11;
01428   else if(ts.GetDate()<(*vtsRunXIIEnd).GetDate()) rp = 11;   //we don't want the calculator to know about run 12
01429   else rp = 13;
01430   return rp;
01431 }

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

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

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

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

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 22 Jul 2018 for loon by  doxygen 1.6.1