ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
top::NeutrinoWeighting Class Reference

Not complete. More...

#include <NeutrinoWeighting.h>

Inheritance diagram for top::NeutrinoWeighting:
Collaboration diagram for top::NeutrinoWeighting:

Public Member Functions

 NeutrinoWeighting ()
 
virtual ~NeutrinoWeighting ()
 
bool apply (const top::Event &) const override
 This does stuff based on the information in an event. More...
 
std::string name () const override
 A human readable name. More...
 
virtual bool applyParticleLevel (const top::ParticleLevelEvent &) const
 This does stuff based on the information in a particle level event. More...
 

Private Member Functions

NWSolution solveForNeutrinoEta (const TLorentzVector &lepton, const TLorentzVector &bJet, double topMass, int index) const
 
double neutrino_weight (const TLorentzVector &, const TLorentzVector &, double, double) const
 Calculate the weight for this combination of particles by comparing with Met. More...
 

Private Attributes

double neutrinos [2000][3]
 Sampling points. More...
 
int etaSize
 Delta eta sampling size. For the mass we don't need to sample so many points. More...
 
double m_bmass
 B jet mass constraint. More...
 
double m_wmass
 W jet mass constraint. More...
 
double sigmax
 
double sigmay
 

Detailed Description

Not complete.

Work in progress

Definition at line 57 of file NeutrinoWeighting.h.

Constructor & Destructor Documentation

◆ NeutrinoWeighting()

top::NeutrinoWeighting::NeutrinoWeighting ( )

Definition at line 12 of file NeutrinoWeighting.cxx.

12  : sigmax(10), sigmay(10) {
13  double etaStep = 0.2;
14 
15  //construct the array of eta values to use (cosh and sinh them)
16  int index = 0;
17 
18  for (double eta = -5.0; eta < 5.0001; eta += etaStep) {
19  neutrinos[index][0] = eta;
20  neutrinos[index][1] = std::sinh(eta);
21  neutrinos[index][2] = std::cosh(eta);
22  ++index;
23  }
24 
25  etaSize = index;
26 
27  if (etaSize > 2000) {
28  std::cout << "ERROR TOO MANY SAMPLING POINT FOR neutrinos ARRAY" << std::endl;
29  exit(1);
30  }
31  }

◆ ~NeutrinoWeighting()

top::NeutrinoWeighting::~NeutrinoWeighting ( )
virtual

Definition at line 33 of file NeutrinoWeighting.cxx.

33  {
34  }

Member Function Documentation

◆ apply()

bool top::NeutrinoWeighting::apply ( const top::Event ) const
overridevirtual

This does stuff based on the information in an event.

The idea is that you implement this to return either true or false based on the information held within top::Event. If this returns true then the event is kept. If it returns false then the event is removed.

Parameters
top::EventThe current event.
Returns
true if the event should be kept, false otherwise.

Implements top::EventSelectorBase.

Definition at line 36 of file NeutrinoWeighting.cxx.

36  {
37  TLorentzVector l1;
38  TLorentzVector l2;
39  TLorentzVector b1;
40  TLorentzVector b2;
41  double topMass = 172500.;
42 
43  const double met_ex = event.m_met->mpx();
44  const double met_ey = event.m_met->mpy();
45 
46  for (int i = 0; i < etaSize; ++i) {
47  for (int j = 0; j < etaSize; ++j) {
48  NWSolution ans1 = solveForNeutrinoEta(l1, b1, topMass, i);
49  NWSolution ans2 = solveForNeutrinoEta(l2, b2, topMass, j);
50 
51  if (ans1.getNumSolutions() > 0 && ans2.getNumSolutions() > 0) {
52  const double sol1 = neutrino_weight(ans1.getv1(), ans2.getv1(), met_ex, met_ey);
53  const double sol2 = neutrino_weight(ans1.getv1(), ans2.getv2(), met_ex, met_ey);
54  const double sol3 = neutrino_weight(ans1.getv2(), ans2.getv1(), met_ex, met_ey);
55  const double sol4 = neutrino_weight(ans1.getv2(), ans2.getv2(), met_ex, met_ey);
56 
57  if (std::isnan(sol1) || std::isnan(sol2) || std::isnan(sol3) ||
58  std::isnan(sol4)) std::cout << "One of the quadratic ans is NaN!" << std::endl;
59  }
60 
61  ans1 = solveForNeutrinoEta(l1, b2, topMass, i);
62  ans2 = solveForNeutrinoEta(l2, b1, topMass, j);
63 
64  if (ans1.getNumSolutions() > 0 && ans2.getNumSolutions() > 0) {
65  const double sol1 = neutrino_weight(ans1.getv1(), ans2.getv1(), met_ex, met_ey);
66  const double sol2 = neutrino_weight(ans1.getv1(), ans2.getv2(), met_ex, met_ey);
67  const double sol3 = neutrino_weight(ans1.getv2(), ans2.getv1(), met_ex, met_ey);
68  const double sol4 = neutrino_weight(ans1.getv2(), ans2.getv2(), met_ex, met_ey);
69 
70  if (std::isnan(sol1) || std::isnan(sol2) || std::isnan(sol3) ||
71  std::isnan(sol4)) std::cout << "One of the quadratic ans is NaN!" << std::endl;
72  }
73  }
74  }
75 
76  //normalise?
77 
78  return true;
79  }

◆ applyParticleLevel()

virtual bool top::EventSelectorBase::applyParticleLevel ( const top::ParticleLevelEvent ) const
inlinevirtualinherited

This does stuff based on the information in a particle level event.

The idea is that you implement this to return either true or false, based on the information held within the top::ParticleLevelEvent. If this function returns true, then the event is kept, otherwise it is removed. The function has a default implementation (which returns true) because it is expected that many EventSelector objects do not operate on ParticleLevelEvent objects.

Parameters
top::ParticleLevelEventthe current particle level event.
trueif the event should be kept (i.e. it passed the selector criteria), false otherwise.

Reimplemented in top::JetNGhostSelector, top::PrintEventSelector, top::PseudoTopRecoRun, top::NElectronNMuonTightSelector, top::NElectronNMuonSelector, top::NFwdElectronSelector, top::HTSelector, top::OSLeptonTightSelector, top::MLLSelector, top::MWTSelector, top::NElectronTightSelector, top::NFwdElectronTightSelector, top::NMuonTightSelector, top::OSLeptonSelector, top::METMWTSelector, top::METSelector, top::MLLWindow, top::NElectronSelector, top::NJetSelector, top::NMuonSelector, top::NPhotonSelector, top::NSoftMuonSelector, top::NTauSelector, top::SSLeptonTightSelector, top::SSLeptonSelector, top::ParticleLevelSelector, top::RecoLevelSelector, top::NVarRCJetSelector, top::NLargeJetSelector, and top::NRCJetSelector.

Definition at line 73 of file EventSelectorBase.h.

73 {return true;}

◆ name()

std::string top::NeutrinoWeighting::name ( ) const
inlineoverridevirtual

A human readable name.

Mostly used for printing the cut and value to the screen. Must be implemented for each tool.

Implements top::EventSelectorBase.

Definition at line 64 of file NeutrinoWeighting.h.

64 {return "RECO:NEUTRINOWEIGHTING";}

◆ neutrino_weight()

double top::NeutrinoWeighting::neutrino_weight ( const TLorentzVector &  neutrino1,
const TLorentzVector &  neutrino2,
double  met_ex,
double  met_ey 
) const
private

Calculate the weight for this combination of particles by comparing with Met.

Weight a solution based on the agreement with missing Et.

Parameters
neutrino1The first neutrino (actually the order doesn't matter).
neutrino2The second neutrino.
met_exThe x component of missing Et.
met_eyThe y component of missing Et.
Returns
The weight of this solution based on the input neutrinos.

Definition at line 124 of file NeutrinoWeighting.cxx.

125  {
126  const double dx = met_ex - neutrino1.Px() - neutrino2.Px();
127  const double dy = met_ey - neutrino1.Py() - neutrino2.Py();
128 
129  return exp(-dx * dx / (2. * sigmax * sigmax) - dy * dy / (2. * sigmay * sigmay));
130  }

◆ solveForNeutrinoEta()

NWSolution top::NeutrinoWeighting::solveForNeutrinoEta ( const TLorentzVector &  lepton,
const TLorentzVector &  bJet,
double  topMass,
int  index 
) const
private
Parameters
leptonThe lepton 4 vector.
bJetThe b jet 4 vector.
topMassThe top mass is a constraint in the spin correlation calculation.
indexGives the position in the neutrino eta array of this neutrino.

Definition at line 81 of file NeutrinoWeighting.cxx.

82  {
83  double Wmass2 = m_wmass * m_wmass;
84  double bmass = m_bmass;
85 
86  double Elprime = lepton.E() * neutrinos[index][2] - lepton.Pz() * neutrinos[index][1];
87  double Ebprime = bJet.E() * neutrinos[index][2] - bJet.Pz() * neutrinos[index][1];
88 
89  double A = (lepton.Py() * Ebprime - bJet.Py() * Elprime) / (bJet.Px() * Elprime - lepton.Px() * Ebprime);
90  double B = (Elprime * (topMass * topMass - Wmass2 - bmass * bmass - 2. * lepton * bJet) - Ebprime * Wmass2) /
91  (2. * (lepton.Px() * Ebprime - bJet.Px() * Elprime));
92 
93  double par1 = (lepton.Px() * A + lepton.Py()) / Elprime;
94  double C = A * A + 1. - par1 * par1;
95  double par2 = (Wmass2 / 2. + lepton.Px() * B) / Elprime;
96  double D = 2. * (A * B - par2 * par1);
97  double F = B * B - par2 * par2;
98  double det = D * D - 4. * C * F;
99 
100  NWSolution sol;
101 
102  sol.setSolutions(0);
103 
104  if (det > 0.) {
105  double tmp = std::sqrt(det) / (2. * C);
106  double py1 = -D / (2. * C) + tmp;
107  double py2 = -D / (2. * C) - tmp;
108  double px1 = A * py1 + B;
109  double px2 = A * py2 + B;
110  double pT2_1 = px1 * px1 + py1 * py1;
111  double pT2_2 = px2 * px2 + py2 * py2;
112  double pz1 = std::sqrt(pT2_1) * neutrinos[index][1];
113  double pz2 = std::sqrt(pT2_2) * neutrinos[index][1];
114 
115  TLorentzVector a1(px1, py1, pz1, sqrt(pT2_1 + pz1* pz1));
116  TLorentzVector a2(px2, py2, pz2, sqrt(pT2_2 + pz2* pz2));
117 
118  sol.setSolutions(2, a1, a2);
119  }
120 
121  return sol;
122  }

Member Data Documentation

◆ etaSize

int top::NeutrinoWeighting::etaSize
private

Delta eta sampling size. For the mass we don't need to sample so many points.

Definition at line 93 of file NeutrinoWeighting.h.

◆ m_bmass

double top::NeutrinoWeighting::m_bmass
private

B jet mass constraint.

Definition at line 100 of file NeutrinoWeighting.h.

◆ m_wmass

double top::NeutrinoWeighting::m_wmass
private

W jet mass constraint.

Definition at line 103 of file NeutrinoWeighting.h.

◆ neutrinos

double top::NeutrinoWeighting::neutrinos[2000][3]
private

Sampling points.

Definition at line 90 of file NeutrinoWeighting.h.

◆ sigmax

double top::NeutrinoWeighting::sigmax
private

Definition at line 106 of file NeutrinoWeighting.h.

◆ sigmay

double top::NeutrinoWeighting::sigmay
private

Definition at line 109 of file NeutrinoWeighting.h.


The documentation for this class was generated from the following files:
top::NeutrinoWeighting::m_bmass
double m_bmass
B jet mass constraint.
Definition: NeutrinoWeighting.h:100
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
index
Definition: index.py:1
top::NeutrinoWeighting::neutrinos
double neutrinos[2000][3]
Sampling points.
Definition: NeutrinoWeighting.h:90
DMTest::C
C_v1 C
Definition: C.h:26
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
dqt_zlumi_alleff_HIST.A
A
Definition: dqt_zlumi_alleff_HIST.py:110
skel.l2
l2
Definition: skel.GENtoEVGEN.py:426
lumiFormat.i
int i
Definition: lumiFormat.py:92
top::NeutrinoWeighting::neutrino_weight
double neutrino_weight(const TLorentzVector &, const TLorentzVector &, double, double) const
Calculate the weight for this combination of particles by comparing with Met.
Definition: NeutrinoWeighting.cxx:124
WritePulseShapeToCool.det
det
Definition: WritePulseShapeToCool.py:204
top::NeutrinoWeighting::sigmay
double sigmay
Definition: NeutrinoWeighting.h:109
top::NeutrinoWeighting::m_wmass
double m_wmass
W jet mass constraint.
Definition: NeutrinoWeighting.h:103
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
top::NeutrinoWeighting::sigmax
double sigmax
Definition: NeutrinoWeighting.h:106
calibdata.exit
exit
Definition: calibdata.py:236
top::NeutrinoWeighting::etaSize
int etaSize
Delta eta sampling size. For the mass we don't need to sample so many points.
Definition: NeutrinoWeighting.h:93
dqt_zlumi_alleff_HIST.B
B
Definition: dqt_zlumi_alleff_HIST.py:110
top::NeutrinoWeighting::solveForNeutrinoEta
NWSolution solveForNeutrinoEta(const TLorentzVector &lepton, const TLorentzVector &bJet, double topMass, int index) const
Definition: NeutrinoWeighting.cxx:81
makeTRTBarrelCans.dy
tuple dy
Definition: makeTRTBarrelCans.py:21
DeMoScan.index
string index
Definition: DeMoScan.py:362
F
#define F(x, y, z)
Definition: MD5.cxx:112
makeTRTBarrelCans.dx
tuple dx
Definition: makeTRTBarrelCans.py:20
skel.l1
l1
Definition: skel.GENtoEVGEN.py:425