EnergySysts2019.cxx
Go to the documentation of this file.
2 
4 
5 namespace ana
6 {
7  // Error fully correlated between FD, main (non-MuCat) ND, MuCat
8  const CorrMuEScaleSyst2019 kCorrMuEScaleSyst2019(0.0074, 0.0074, 0.0012);
9 
10  // Error for FD uncorrelated with main ND or muon catcher
11  const UnCorrFDMuEScaleSyst2019 kUnCorrFDMuEScaleSyst2019(0.0015);
12 
13  // Error for main ND uncorrelated with FD or muon catcher
14  const UnCorrNDMuEScaleSyst2019 kUnCorrNDMuEScaleSyst2019(0.0015);
15 
16  // Error for muon catcher uncorrelated with FD or main ND
17  const UnCorrMuCatMuESyst2019 kUnCorrMuCatMuESyst2019(0.010);
18 
19  // One-sided error for neutron pile-up in the main ND and the muon catcher
20  const PileupMuESyst2019 kPileupMuESyst2019(0.46, 1.3); // in cm
21 
22  // One-sided error for Bodek and Coulomb corrections
23  const BolombMuESyst2019 kBolombMuESyst2019(-9.); // In MeV
24 
25 
26  //----------------------------------------------------------------------
28  Shift(double sigma, caf::SRProxy* sr, double& weight) const
29  {
30  if(sr->trk.kalman.tracks.empty()) return;
31 
32  if(sr->hdr.det == caf::kNEARDET){
35  }
36  else if(sr->hdr.det == caf::kFARDET){
37  sr->trk.kalman.tracks[0].len *= 1+fScaleFD*sigma;
38  }
39  }
40 
41  //----------------------------------------------------------------------
43  Shift(double sigma, caf::SRProxy* sr, double& weight) const
44  {
45  if(sr->trk.kalman.tracks.empty()) return;
46 
47  if(sr->hdr.det == caf::kFARDET)
48  sr->trk.kalman.tracks[0].len *= 1+fScale*sigma;
49  }
50 
51  //----------------------------------------------------------------------
53  Shift(double sigma, caf::SRProxy* sr, double& weight) const
54  {
55  if(sr->trk.kalman.tracks.empty()) return;
56 
57  if(sr->hdr.det == caf::kNEARDET)
58  // act, not cat!
59  sr->energy.numu.ndtrklenact *= 1+fScale*sigma;
60  }
61 
62  //----------------------------------------------------------------------
64  Shift(double sigma, caf::SRProxy* sr, double& weight) const
65  {
66  if(sr->trk.kalman.tracks.empty()) return;
67 
68  if(sr->hdr.det == caf::kNEARDET && sr->energy.numu.ndtrklencat > 0){
69  // cat, not act!
70  sr->energy.numu.ndtrklencat *= 1+fScale*sigma;
71  }
72  }
73 
74  //----------------------------------------------------------------------
76  Shift(double sigma, caf::SRProxy* sr, double& weight) const
77  {
78  if(sr->trk.kalman.tracks.empty()) return;
79 
80  // This is a one-sided systematic, it can never *shorten* a track.
81  // Implementing a one-sided error like this works fine, as it leaves
82  // the objective function smooth and continuous.
83  if(sigma < 0) return;
84 
85  if(sr->hdr.det == caf::kNEARDET){
86  // Note subtle difference between "ndtrklenact" and "ndtrklencat"...
87  if(sr->energy.numu.ndtrklenact > 0 && sr->energy.numu.ndtrklencat == 0){
88  // Add for both ends of the track in the main ND
89  sr->energy.numu.ndtrklenact += 2*fShiftND*sigma;
90  }
91  else if(sr->energy.numu.ndtrklenact == 0 && sr->energy.numu.ndtrklencat > 0){
92  // Add for both ends of the track in the Muon Catcher
93  sr->energy.numu.ndtrklencat += 2*fShiftMuCat*sigma;
94  }
95  else if(sr->energy.numu.ndtrklenact > 0 && sr->energy.numu.ndtrklencat > 0){
96  // Add for one end in the main detector and one in the Muon Catcher
97  sr->energy.numu.ndtrklenact += fShiftND *sigma;
98  sr->energy.numu.ndtrklencat += fShiftMuCat*sigma;
99  }
100  // and of couse if both are zero because there's no track, do nothing
101  }
102  }
103 
104  //----------------------------------------------------------------------
106  Shift(double sigma, caf::SRProxy* sr, double& weight) const
107  {
108  if(sr->trk.kalman.tracks.empty()) return;
109 
110  // This is a one-sided systematic, it can never *lengthen* a track.
111  if(sigma < 0) return;
112 
113  // The systematic has to be applied as a length, not as an energy, so
114  // here's the conversion constant, which is precise enough for these
115  // purposes. It is as per plots in doc-26649, discarding subtlety. This
116  // is the full physical length in the detector, averaged over air and
117  // whatnot. Since this correction pertains to the interaction vertex, we
118  // don't need to worry about the Muon Catcher.
119  const double cm_per_mev = 0.44;
120 
121  const double cmshift = fShift * cm_per_mev;
122 
123  // In principle, this error applies equally to nu_e and nu_tau, but no
124  // attempt is made here to adjust anything but the muon.
125  if(sr->hdr.det == caf::kNEARDET){
126  sr->energy.numu.ndtrklenact =
127  std::max(sr->energy.numu.ndtrklenact + cmshift*sigma, 0.);
128  }
129  else if(sr->hdr.det == caf::kFARDET){
130  sr->trk.kalman.tracks[0].len =
131  std::max(sr->trk.kalman.tracks[0].len + cmshift*sigma, 0.);
132  }
133  }
134 }
Near Detector underground.
Definition: SREnums.h:10
T max(const caf::Proxy< T > &a, T b)
Far Detector at Ash River.
Definition: SREnums.h:11
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Var weight
caf::Proxy< caf::SRHeader > hdr
Definition: SRProxy.h:2137
caf::Proxy< caf::SRNumuEnergy > numu
Definition: SRProxy.h:214
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
caf::Proxy< caf::SREnergyBranch > energy
Definition: SRProxy.h:2136
void Shift(double sigma, caf::SRProxy *sr, double &weight) const override
Perform the systematic shift.
caf::Proxy< caf::SRTrackBranch > trk
Definition: SRProxy.h:2145
const UnCorrFDMuEScaleSyst2019 kUnCorrFDMuEScaleSyst2019(0.0015)
const CorrMuEScaleSyst2019 kCorrMuEScaleSyst2019(0.0074, 0.0074, 0.0012)
void Shift(double sigma, caf::SRProxy *sr, double &weight) const override
Perform the systematic shift.
const BolombMuESyst2019 kBolombMuESyst2019(-9.)
void Shift(double sigma, caf::SRProxy *sr, double &weight) const override
Perform the systematic shift.
const UnCorrMuCatMuESyst2019 kUnCorrMuCatMuESyst2019(0.010)
caf::StandardRecord * sr
double sigma(TH1F *hist, double percentile)
caf::Proxy< caf::SRKalman > kalman
Definition: SRProxy.h:1797
caf::Proxy< float > ndtrklenact
Definition: SRProxy.h:186
void Shift(double sigma, caf::SRProxy *sr, double &weight) const override
Perform the systematic shift.
const UnCorrNDMuEScaleSyst2019 kUnCorrNDMuEScaleSyst2019(0.0015)
caf::Proxy< std::vector< caf::SRKalmanTrack > > tracks
Definition: SRProxy.h:1780
void Shift(double sigma, caf::SRProxy *sr, double &weight) const override
Perform the systematic shift.
void Shift(double sigma, caf::SRProxy *sr, double &weight) const override
Perform the systematic shift.
caf::Proxy< float > ndtrklencat
Definition: SRProxy.h:187
caf::Proxy< caf::Det_t > det
Definition: SRProxy.h:232
const PileupMuESyst2019 kPileupMuESyst2019(0.46, 1.3)