BeamSysts.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "CAFAna/Core/ISyst.h"
5 #include "CAFAna/Core/Var.h"
6 
7 #include <iostream>
8 class TH1D;
9 
10 namespace ana
11 {
12  //----------------------------------------------------------------------
13 
15  {
16  public:
18  const std::string& shortName);
20 
21  protected:
23  enum{kND, kFD, kNumDets};
26 
27  void InitializeHistograms() const;
28 
29  double GetWeight(const caf::SRNeutrinoProxy *nu, ESign sign) const;
30 
33 
35  };
36 
37  /// Beam systematics:
39  {
40  public:
41  BeamSyst(const std::string& fname,
42  const std::string& shortname,
43  const std::string& latexname);
44 
45  BeamSyst(const std::string& fname,
46  const std::string& histname,
47  const std::string& shortname,
48  const std::string& latexname);
49 
50  void TruthShift(double sigma,
51  caf::SRNeutrinoProxy* sr, double& weight) const override;
52  };
53 
54  /// Incorporate into a weight Var like Var wei(BeamWeight(...
56  {
57  public:
58  BeamWeightFunc(const std::string& fname, const std::string& histname)
59  : BeamSystOrWeightBase(fname, histname)
60  {
61  }
62 
63  double operator()(const caf::SRNeutrinoProxy* sr) const;
64  };
65 
66  //////////////////////////////////////////////////////////////////////
68 
69  BeamSyst* GetPPFXUnivSyst(int UnivIdx);
70  extern const BeamSyst kPPFXCVSyst;
71 
72  const NuTruthVar kPPFXFluxCVWgtSmooth_NT(BeamWeightFunc(FindCAFAnaDir()+"/data/beam/ppfx_smooth_multiverse_weights_2020.root", "ppfx_cv"));
73 
74  //////////////////////////////////////////////////////////////////////
75 
76  //Some predefined beam systematics
77  // 2017 Analysis
78  BeamSyst* GetPPFXPrincipals(int PCIdx);
79 
80  // 2018 RHC+FHC Analysis, this returns the PCA systs on the hadron production and beam focussing.
81  BeamSyst* GetFluxPrincipals2018(int PCIdx);
82 
83  // 2020 RHC+FHC Analysis, this returns the PCA systs on the hadron production and beam focussing.
84  // Doing the PCA on the nuTree this time even though the flux model didn't change
85  BeamSyst* GetFluxPrincipals2020(int PCIdx);
86 
87  // 2017 ND Short Baseline Analysis hadron production systs. PCA on ND only covariance matrix for FHC flux
88  BeamSyst* GetPPFXPrincipalsSBAna(int PCIdx);
89 
90  // 2018 FHC+RHC ND only! This returns the PCA systs on the hadron production and beam focussing using an ND only covariance matrix
91  // Might be useful for ND analyses
93 
94  // 2020 FHC+RHC ND only! This returns the PCA systs on the hadron production and beam focussing using an ND only covariance matrix. Suggest using 8 PCs to cover the total flux error. PCA on the nuTree this time. More info in docdb : 48647
95  // Might be useful for ND analyses
97  //Beam transport; see e.g. docdb:12916 for SA
98  //DocDB 17608
99 
100  /// Horn Current +/-2kA
102 
103  ///Beam Spot Size 1.3 +/- 0.2 mm both XY
104  extern const BeamSyst kBeamSpotSize;
105 
106  ///Beam position on target +-1 mm, X/Y separately
107  extern const BeamSyst kBeamPosX;
108  extern const BeamSyst kBeamPosY;
109 
110  ///Horn 1 and 2 position +-3mm in X and Y separately
111  extern const BeamSyst kBeamH1PosX;
112  extern const BeamSyst kBeamH1PosY;
113  extern const BeamSyst kBeamH2PosX;
114  extern const BeamSyst kBeamH2PosY;
115 
116  ///Target z position shift +/-7mm
117  extern const BeamSyst kBeamTarget;
118 
119  ///Constant magnetic field in decay pipe
120  extern const BeamSyst kBeamMagField;
121 
122  ///New vs Old NuMI target
123  extern const BeamSyst kBeamNewTarget;
124 
125  ///New NuMI target at 160 kA vs 200 kA
127 
128  ///New NuMI target at 180 kA vs 200 kA
130 
131  ///Water layer on horn 1: +/- 1mm
132  extern const BeamSyst kBeamGeomWater;
133 
134  ///All Beam Transport systematics combined in quadratures
136 
138 
139 } // namespace
BeamSyst * GetPPFXPrincipals(int PCIdx)
Definition: BeamSysts.cxx:72
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
Incorporate into a weight Var like Var wei(BeamWeight(...
Definition: BeamSysts.h:55
const BeamSyst kBeamNewTarget((FindCAFAnaDir()+"/data/beam/ratioNewToOldTgt.root"),"NewTarget","New vs Old NuMI Target")
New vs old NuMI target.
Definition: BeamSysts.h:123
const BeamSyst kBeamTarget((FindCAFAnaDir()+"/data/beam/TABeamSyst_2018Dec11.root"),"7mmTargetZ","+/- 7mm Target z Position")
Target z position shift +/-7mm.
Definition: BeamSysts.h:117
Beam systematics:
Definition: BeamSysts.h:38
const Var weight
Proxy for caf::SRNeutrino.
Definition: SRProxy.h:510
const BeamSyst kBeamHornCurrent((FindCAFAnaDir()+"/data/beam/TABeamSyst_2018Dec11.root"),"2kA","2kAHornCurrent","+/- 2kA Horn Current")
Horn Current +/-2kA.
Definition: BeamSysts.h:101
NuTruthVar & GetPPFXFluxUnivWgtSmooth_NT(int UnivIdx)
Definition: BeamSysts.cxx:32
BeamSyst * GetFluxPrincipalsND2020(int PCIdx)
Definition: BeamSysts.cxx:170
BeamSyst * GetPPFXPrincipalsSBAna(int PCIdx)
Definition: BeamSysts.cxx:136
std::string FindCAFAnaDir()
Definition: Utilities.cxx:204
Encapsulate code to systematically shift a caf::SRProxy.
Definition: ISyst.h:14
BeamSyst * GetFluxPrincipals2018(int PCIdx)
Definition: BeamSysts.cxx:89
const BeamSyst kBeamGeomWater((FindCAFAnaDir()+"/data/beam/TABeamSyst_2018Dec11.root"),"1mmHornWater","+/- 1mm water on Horn 1")
Water layer on horn 1: +/- 1mm.
Definition: BeamSysts.h:132
const BeamSyst kBeamNewTgt160to200kA((FindCAFAnaDir()+"/data/beam/ratioNewTgt160to200kA.root"),"NewTgt160to200kA","New target 160 kA/200 kA")
New target at 160 kA to new target at 200 kA.
Definition: BeamSysts.h:126
const BeamSyst kBeamH1PosX((FindCAFAnaDir()+"/data/beam/TABeamSyst_2018Dec11.root"),"3mmHorn1X","+/- 3mm Horn 1 X Position")
Horn 1 and 2 position +-3mm in X and Y separately.
Definition: BeamSysts.h:111
BeamSystOrWeightBase(const std::string &fname, const std::string &shortName)
Definition: BeamSysts.cxx:259
BeamSyst * GetPPFXUnivSyst(int UnivIdx)
Definition: BeamSysts.cxx:48
const BeamSyst kBeamAllTransport((FindCAFAnaDir()+"/data/beam/TABeamSyst_2018Dec11.root"),"totErr","beamTransportComb","Combined Beam Transport Systematics")
All Beam Transport systematics combined in quadratures.
Definition: BeamSysts.h:135
static const BeamSyst & kBeamAll
Definition: BeamSysts.h:137
caf::StandardRecord * sr
BeamSyst * GetFluxPrincipals2020(int PCIdx)
Definition: BeamSysts.cxx:106
double sigma(TH1F *hist, double percentile)
const NuTruthVar kPPFXFluxCVWgtSmooth_NT(BeamWeightFunc(FindCAFAnaDir()+"/data/beam/ppfx_smooth_multiverse_weights_2020.root","ppfx_cv"))
const BeamSyst kBeamPosY((FindCAFAnaDir()+"/data/beam/TABeamSyst_2018Dec11.root"),"1mmBeamShiftY","Beam Position Y")
Definition: BeamSysts.h:108
const BeamSyst kBeamNewTgt180to200kA((FindCAFAnaDir()+"/data/beam/ratioNewTgt180to200kA.root"),"NewTgt180to200kA","New target 180 kA/200 kA")
New target at 180 kA to new target at 200 kA.
Definition: BeamSysts.h:129
const BeamSyst kPPFXCVSyst((FindCAFAnaDir()+"/data/beam/ppfx_smooth_multiverse_weights_2020.root"),"ppfx_cv","PPFX CV")
Definition: BeamSysts.h:70
BeamSyst * GetFluxPrincipalsND2018(int PCIdx)
Definition: BeamSysts.cxx:154
const BeamSyst kBeamH1PosY((FindCAFAnaDir()+"/data/beam/TABeamSyst_2018Dec11.root"),"3mmHorn1Y","+/- 3mm Horn 1 Y Position")
Definition: BeamSysts.h:112
BeamWeightFunc(const std::string &fname, const std::string &histname)
Definition: BeamSysts.h:58
double GetWeight(const caf::SRNeutrinoProxy *nu, ESign sign) const
Definition: BeamSysts.cxx:350
const BeamSyst kBeamSpotSize((FindCAFAnaDir()+"/data/beam/TABeamSyst_2018Dec11.root"),"0.2mmBeamSpotSize","0p2mmBeamSpotSize"," 1.3 +/- 0.2 mm Spot Size")
Beam Spot Size 1.3 +/- 0.2 mm both XY.
Definition: BeamSysts.h:104
const BeamSyst kBeamH2PosX((FindCAFAnaDir()+"/data/beam/TABeamSyst_2018Dec11.root"),"3mmHorn2X","+/- 3mm Horn 2 X Position")
Definition: BeamSysts.h:113
string shortName
THUMBNAIL BLOCK: We need to make a thumbnail for each.
const BeamSyst kBeamPosX((FindCAFAnaDir()+"/data/beam/TABeamSyst_2018Dec11.root"),"1mmBeamShiftX","Beam Position X")
Beam position on target +-1 mm, X/Y separately.
Definition: BeamSysts.h:107
void InitializeHistograms() const
Definition: BeamSysts.cxx:281
const BeamSyst kBeamH2PosY((FindCAFAnaDir()+"/data/beam/TABeamSyst_2018Dec11.root"),"3mmHorn2Y","+/- 3mm Horn 2 Y Position")
Definition: BeamSysts.h:114
const BeamSyst kBeamMagField((FindCAFAnaDir()+"/data/beam/TABeamSyst_2018Dec11.root"),"Magnetic Field in Decay Pipe","MagnFieldDecayPipe","Magnetic Field in Decay Pipe")
Constant magnetic field in decay pipe.
Definition: BeamSysts.h:120
Template for Var and SpillVar.
TH1D * fHistos[kNumFluxType][kNumDets][kNumSigns][kNumFlavors]
Definition: BeamSysts.h:34
def sign(x)
Definition: canMan.py:197
enum BeamMode string