AngleSysts.cxx
Go to the documentation of this file.
2 
4 
5 #include "TVector3.h"
6 
7 namespace ana
8 {
9 
10  const LeptonAngleSyst kLeptonAngleSystNDXZ2020( "LeptonAngleSystNDXZ2020", "Lepton Angle Syst ND XZ", caf::kNEARDET, kAngleShiftXZ, 0.010 ); // 10 mrad
11  const LeptonAngleSyst kLeptonAngleSystNDYZ2020( "LeptonAngleSystNDYZ2020", "Lepton Angle Syst ND YZ", caf::kNEARDET, kAngleShiftYZ, 0.010 ); // 10 mrad
12  const LeptonAngleSyst kLeptonAngleSystFDXZ2020( "LeptonAngleSystFDXZ2020", "Lepton Angle Syst FD XZ", caf::kFARDET , kAngleShiftXZ, 0.010 ); // 10 mrad
13  const LeptonAngleSyst kLeptonAngleSystFDYZ2020( "LeptonAngleSystFDYZ2020", "Lepton Angle Syst FD YZ", caf::kFARDET , kAngleShiftYZ, 0.010 ); // 10 mrad
14 
15  //----------------------------------------------------------------------
16  void LeptonAngleSyst::Shift( double sigma, caf::SRProxy* sr, double& weight ) const
17  {
18  // Shift muon and electron reco direction vectors in the XZ or YZ plane to account for plane mis-aignment
19  // These shifts will affect muon and electron reco quantities such as Theta, Pt, Q2, q3
20  // The shifts are correlated between muons and electrons and uncorrelated between the ND and FD
21 
22  if ( sr->hdr.det != fDet ) return;
23 
24  if ( sr->trk.kalman.ntracks > 0 && sr->trk.kalman.idxremid != 999 )
25  {
26  TVector3 muonDir = sr->trk.kalman.tracks[0].dir;
27 
28  if ( fShiftPlane == kAngleShiftXZ ) muonDir.RotateY( fAngUnc * sigma );
29  else if ( fShiftPlane == kAngleShiftYZ ) muonDir.RotateX( fAngUnc * sigma );
30 
31  sr->trk.kalman.tracks[0].dir.x = muonDir.X();
32  sr->trk.kalman.tracks[0].dir.y = muonDir.Y();
33  sr->trk.kalman.tracks[0].dir.z = muonDir.Z();
34  }
35 
36  if ( sr->vtx.elastic.IsValid && sr->vtx.elastic.fuzzyk.npng >= 1 )
37  {
38  TVector3 elecDir = sr->vtx.elastic.fuzzyk.png[0].dir;
39 
40  if ( fShiftPlane == kAngleShiftXZ ) elecDir.RotateY( fAngUnc * sigma );
41  else if ( fShiftPlane == kAngleShiftYZ ) elecDir.RotateX( fAngUnc * sigma );
42 
43  sr->vtx.elastic.fuzzyk.png[0].dir.x = elecDir.X();
44  sr->vtx.elastic.fuzzyk.png[0].dir.y = elecDir.Y();
45  sr->vtx.elastic.fuzzyk.png[0].dir.z = elecDir.Z();
46  }
47  }
48 
49 } // namespace
caf::Proxy< size_t > npng
Definition: SRProxy.h:2038
Near Detector underground.
Definition: SREnums.h:10
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:2059
Far Detector at Ash River.
Definition: SREnums.h:11
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
caf::Proxy< unsigned int > idxremid
Definition: SRProxy.h:1777
const Var weight
const caf::Det_t fDet
Definition: AngleSysts.h:29
caf::Proxy< size_t > ntracks
Definition: SRProxy.h:1778
caf::Proxy< caf::SRHeader > hdr
Definition: SRProxy.h:2137
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
const LeptonAngleSyst kLeptonAngleSystNDYZ2020("LeptonAngleSystNDYZ2020","Lepton Angle Syst ND YZ", caf::kNEARDET, kAngleShiftYZ, 0.010)
Definition: AngleSysts.h:35
const LeptonAngleSyst kLeptonAngleSystNDXZ2020("LeptonAngleSystNDXZ2020","Lepton Angle Syst ND XZ", caf::kNEARDET, kAngleShiftXZ, 0.010)
Definition: AngleSysts.h:34
caf::Proxy< caf::SRElastic > elastic
Definition: SRProxy.h:2118
caf::Proxy< std::vector< caf::SRFuzzyKProng > > png
Definition: SRProxy.h:2043
const LeptonAngleSyst kLeptonAngleSystFDXZ2020("LeptonAngleSystFDXZ2020","Lepton Angle Syst FD XZ", caf::kFARDET, kAngleShiftXZ, 0.010)
Definition: AngleSysts.h:36
caf::Proxy< caf::SRTrackBranch > trk
Definition: SRProxy.h:2145
caf::StandardRecord * sr
double sigma(TH1F *hist, double percentile)
const double fAngUnc
Definition: AngleSysts.h:31
void Shift(double sigma, caf::SRProxy *sr, double &weight) const override
Perform the systematic shift.
Definition: AngleSysts.cxx:16
caf::Proxy< caf::SRKalman > kalman
Definition: SRProxy.h:1797
caf::Proxy< bool > IsValid
Definition: SRProxy.h:2058
caf::Proxy< std::vector< caf::SRKalmanTrack > > tracks
Definition: SRProxy.h:1780
caf::Proxy< caf::SRVertexBranch > vtx
Definition: SRProxy.h:2146
const LeptonAngleSyst kLeptonAngleSystFDYZ2020("LeptonAngleSystFDYZ2020","Lepton Angle Syst FD YZ", caf::kFARDET, kAngleShiftYZ, 0.010)
Definition: AngleSysts.h:37
const AngleShiftPlane fShiftPlane
Definition: AngleSysts.h:30
caf::Proxy< caf::Det_t > det
Definition: SRProxy.h:232