CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
TtFullLepKinSolver Class Reference

#include <TtFullLepKinSolver.h>

Classes

struct  NeutrinoSolution
 

Public Member Functions

TtDilepEvtSolution addKinSolInfo (TtDilepEvtSolution *asol)
 
NeutrinoSolution getNuSolution (TLorentzVector LV_l, TLorentzVector LV_l_, TLorentzVector LV_b, TLorentzVector LV_b_)
 
void SetConstraints (double xx=0, double yy=0)
 
 TtFullLepKinSolver ()
 
 TtFullLepKinSolver (double, double, double, std::vector< double >)
 
void useWeightFromMC (bool useMC)
 
 ~TtFullLepKinSolver ()
 

Private Member Functions

int cubic (double *c_coeff, double *c_sol)
 
void FindCoeff (const TLorentzVector al, const TLorentzVector l, const TLorentzVector b_al, const TLorentzVector b_l, double mt, double mat, double pxboost, double pyboost, double *q_coeff)
 
int quartic (double *q_coeff, double *q_sol)
 
double sqr (double x)
 
void SWAP (double &realone, double &realtwo)
 
void TopRec (const TLorentzVector al, const TLorentzVector l, const TLorentzVector b_al, const TLorentzVector b_l, double sol)
 
double WeightSolfromMC ()
 
double WeightSolfromShape ()
 

Private Attributes

double C
 
double D
 
TF2 * EventShape_
 
double F
 
TLorentzVector genLV_n
 
TLorentzVector genLV_n_
 
double k16
 
double k26
 
double k36
 
double k46
 
double k51
 
double k56
 
double k61
 
TLorentzVector LV_n
 
TLorentzVector LV_n_
 
TLorentzVector LV_t
 
TLorentzVector LV_t_
 
TLorentzVector LV_tt_t
 
TLorentzVector LV_tt_t_
 
double m1
 
double m2
 
double m3
 
double mab
 
double maw
 
double mb
 
double mw
 
double n1
 
double n2
 
double n3
 
double pom
 
double pxmiss_
 
double pymiss_
 
double topmass_begin
 
double topmass_end
 
double topmass_step
 
bool useMCforBest_
 

Detailed Description

Definition at line 13 of file TtFullLepKinSolver.h.

Constructor & Destructor Documentation

TtFullLepKinSolver::TtFullLepKinSolver ( )

Definition at line 5 of file TtFullLepKinSolver.cc.

References EventShape_.

6 {
7  // That crude parametrisation has been obtained from a fit of O(1000) pythia events.
8  // It is normalized to 1.
9  EventShape_ = new TF2("landau2D","[0]*TMath::Landau(x,[1],[2],0)*TMath::Landau(y,[3],[4],0)",0,500,0,500);
10  EventShape_->SetParameters(30.7137,56.2880,23.0744,59.1015,24.9145);
11 }
TtFullLepKinSolver::TtFullLepKinSolver ( double  b,
double  e,
double  s,
std::vector< double >  nupars 
)

Definition at line 13 of file TtFullLepKinSolver.cc.

References b, EventShape_, mab, maw, mb, mw, pxmiss_, pymiss_, asciidump::s, topmass_begin, topmass_end, and topmass_step.

14 {
15  topmass_begin = b;
16  topmass_end = e;
17  topmass_step = s;
18  pxmiss_ = 0;
19  pymiss_ = 0;
20  mw = 80.22;
21  maw = 80.22;
22  mab = 4.800;
23  mb = 4.800;
24  // That crude parametrisation has been obtained from a fit of O(1000) pythia events.
25  // It is normalized to 1.
26  EventShape_ = new TF2("landau2D","[0]*TMath::Landau(x,[1],[2],0)*TMath::Landau(y,[3],[4],0)",0,500,0,500);
27  EventShape_->SetParameters(nupars[0],nupars[1],nupars[2],nupars[3],nupars[4]);
28 }
double b
Definition: hdecay.h:120
string s
Definition: asciidump.py:422
TtFullLepKinSolver::~TtFullLepKinSolver ( )

Definition at line 33 of file TtFullLepKinSolver.cc.

References EventShape_.

34 {
35  delete EventShape_;
36 }

Member Function Documentation

TtDilepEvtSolution TtFullLepKinSolver::addKinSolInfo ( TtDilepEvtSolution asol)

Definition at line 40 of file TtFullLepKinSolver.cc.

References reco::LeafCandidate::energy(), FindCoeff(), genLV_n, genLV_n_, TtDilepEvtSolution::getCalJetB(), TtDilepEvtSolution::getCalJetBbar(), TtDilepEvtSolution::getElectronm(), TtDilepEvtSolution::getElectronp(), TtDilepEvtSolution::getGenN(), TtDilepEvtSolution::getGenNbar(), TtDilepEvtSolution::getMuonm(), TtDilepEvtSolution::getMuonp(), TtDilepEvtSolution::getTaum(), TtDilepEvtSolution::getTaup(), TtDilepEvtSolution::getWmDecay(), TtDilepEvtSolution::getWpDecay(), reco::LeafCandidate::px(), pxmiss_, reco::LeafCandidate::py(), pymiss_, reco::LeafCandidate::pz(), quartic(), TtDilepEvtSolution::setRecTopMass(), TtDilepEvtSolution::setRecWeightMax(), topmass_begin, topmass_end, topmass_step, TopRec(), useMCforBest_, CommonMethods::weight(), WeightSolfromMC(), and WeightSolfromShape().

Referenced by TtDilepEvtSolutionMaker::produce().

41 {
42  TtDilepEvtSolution fitsol(*asol);
43 
44  //antilepton and lepton
45  TLorentzVector LV_e, LV_e_;
46  //b and bbar quark
47  TLorentzVector LV_b, LV_b_;
48 
49  bool hasMCinfo = true;
50  if(fitsol.getGenN()) { // protect against non-dilept genevents
51  genLV_n = TLorentzVector(fitsol.getGenN()->px(), fitsol.getGenN()->py(),
52  fitsol.getGenN()->pz(), fitsol.getGenN()->energy());
53  } else hasMCinfo = false;
54 
55  if(fitsol.getGenNbar()) { // protect against non-dilept genevents
56  genLV_n_ = TLorentzVector(fitsol.getGenNbar()->px(), fitsol.getGenNbar()->py(),
57  fitsol.getGenNbar()->pz(), fitsol.getGenNbar()->energy());
58  } else hasMCinfo = false;
59  // if MC is to be used to select the best top mass and is not available,
60  // then nothing can be done. Stop here.
61  if(useMCforBest_&&!hasMCinfo) return fitsol;
62 
63  // first lepton
64  if (fitsol.getWpDecay() == "muon") {
65  LV_e = TLorentzVector(fitsol.getMuonp().px(), fitsol.getMuonp().py(),
66  fitsol.getMuonp().pz(), fitsol.getMuonp().energy());
67  } else if (fitsol.getWpDecay() == "electron") {
68  LV_e = TLorentzVector(fitsol.getElectronp().px(), fitsol.getElectronp().py(),
69  fitsol.getElectronp().pz(), fitsol.getElectronp().energy());
70  } else if (fitsol.getWpDecay() == "tau") {
71  LV_e = TLorentzVector(fitsol.getTaup().px(), fitsol.getTaup().py(),
72  fitsol.getTaup().pz(), fitsol.getTaup().energy());
73  }
74 
75  // second lepton
76  if (fitsol.getWmDecay() == "muon") {
77  LV_e_ = TLorentzVector(fitsol.getMuonm().px(), fitsol.getMuonm().py(),
78  fitsol.getMuonm().pz(), fitsol.getMuonm().energy());
79  } else if (fitsol.getWmDecay() == "electron") {
80  LV_e_ = TLorentzVector(fitsol.getElectronm().px(), fitsol.getElectronm().py(),
81  fitsol.getElectronm().pz(), fitsol.getElectronm().energy());
82  } else if (fitsol.getWmDecay() == "tau") {
83  LV_e_ = TLorentzVector(fitsol.getTaum().px(), fitsol.getTaum().py(),
84  fitsol.getTaum().pz(), fitsol.getTaum().energy());
85  }
86 
87  // first jet
88  LV_b = TLorentzVector(fitsol.getCalJetB().px(), fitsol.getCalJetB().py(),
89  fitsol.getCalJetB().pz(), fitsol.getCalJetB().energy());
90 
91  // second jet
92  LV_b_ = TLorentzVector(fitsol.getCalJetBbar().px(), fitsol.getCalJetBbar().py(),
93  fitsol.getCalJetBbar().pz(), fitsol.getCalJetBbar().energy());
94 
95  //loop on top mass parameter
96  double weightmax = -1e30;
97  double mtmax = 0;
98  for (double mt = topmass_begin;
99  mt < topmass_end + 0.5*topmass_step;
100  mt += topmass_step) {
101  //cout << "mt = " << mt << endl;
102  double q_coeff[5], q_sol[4];
103  FindCoeff(LV_e, LV_e_, LV_b, LV_b_, mt, mt, pxmiss_, pymiss_, q_coeff);
104  int NSol = quartic(q_coeff, q_sol);
105 
106  //loop on all solutions
107  for (int isol = 0; isol < NSol; isol++) {
108  TopRec(LV_e, LV_e_, LV_b, LV_b_, q_sol[isol]);
110  if (weight > weightmax) {
111  weightmax =weight;
112  mtmax = mt;
113  }
114  }
115 
116  //for (int i=0;i<5;i++) cout << " q_coeff["<<i<< "]= " << q_coeff[i];
117  //cout << endl;
118 
119  //for (int i=0;i<4;i++) cout << " q_sol["<<i<< "]= " << q_sol[i];
120  //cout << endl;
121  //cout << "NSol_" << NSol << endl;
122  }
123 
124  fitsol.setRecTopMass(mtmax);
125  fitsol.setRecWeightMax(weightmax);
126 
127  return fitsol;
128 }
int quartic(double *q_coeff, double *q_sol)
TLorentzVector genLV_n
void TopRec(const TLorentzVector al, const TLorentzVector l, const TLorentzVector b_al, const TLorentzVector b_l, double sol)
TLorentzVector genLV_n_
void FindCoeff(const TLorentzVector al, const TLorentzVector l, const TLorentzVector b_al, const TLorentzVector b_l, double mt, double mat, double pxboost, double pyboost, double *q_coeff)
int TtFullLepKinSolver::cubic ( double *  c_coeff,
double *  c_sol 
)
private

Definition at line 378 of file TtFullLepKinSolver.cc.

References funct::cos(), h, i, L1TEmulatorMonitor_cff::p, phi, Pi, lumiQueryAPI::q, sqr(), mathSSE::sqrt(), and SWAP().

Referenced by quartic().

378  {
379  int i, nreal;
380  double w, p, q, dis, h, phi;
381 
382  if (coeffs[3]!=0.0) {
383  /* cubic problem? */
384  w = coeffs[2]/(3*coeffs[3]);
385  p = sqr(coeffs[1]/(3*coeffs[3])-sqr(w))*(coeffs[1]/(3*coeffs[3])-sqr(w));
386  q = -0.5*(2*sqr(w)*w-(coeffs[1]*w-coeffs[0])/coeffs[3]);
387  dis = sqr(q)+p;
388  /* discriminant */
389  if (dis<0.0) {
390  /* 3 real solutions */
391  h = q/sqrt(-p);
392  if (h>1.0) h = 1.0;
393  /* confine the argument of */
394  if (h<-1.0) h = -1.0;
395  /* acos to [-1;+1] */
396  phi = acos(h);
397  p = 2*TMath::Power(-p, 1.0/6.0);
398  for (i=0; i<3; i++)
399  koreny[i] = p*cos((phi+2*i*TMath::Pi())/3.0) - w;
400  if (koreny[1]<koreny[0]) SWAP(koreny[0], koreny[1]);
401  /* sort results */
402  if (koreny[2]<koreny[1]) SWAP(koreny[1], koreny[2]);
403  if (koreny[1]<koreny[0]) SWAP(koreny[0], koreny[1]);
404  nreal = 3;
405  }
406  else {
407  /* only one real solution */
408  dis = sqrt(dis);
409  h = TMath::Power(fabs(q+dis), 1.0/3.0);
410  p = TMath::Power(fabs(q-dis), 1.0/3.0);
411  koreny[0] = ((q+dis>0.0)? h : -h) + ((q-dis>0.0)? p : -p) - w;
412  nreal = 1;
413  }
414 
415  /* Perform one step of a Newton iteration in order to minimize
416  round-off errors */
417  for (i=0; i<nreal; i++) {
418  h = coeffs[1] + koreny[i] * (2 * coeffs[2] + 3 * koreny[i] * coeffs[3]);
419  if (h != 0.0)
420  koreny[i] -= (coeffs[0] + koreny[i] * (coeffs[1] + koreny[i] * (coeffs[2] + koreny[i] * coeffs[3])))/h;
421  }
422  }
423 
424  else if (coeffs[2]!=0.0) {
425  /* quadratic problem? */
426  p = 0.5*coeffs[1]/coeffs[2];
427  dis = sqr(p) - coeffs[0]/coeffs[2];
428  if (dis>=0.0) {
429  /* two real solutions */
430  dis = sqrt(dis);
431  koreny[0] = -p - dis;
432  koreny[1] = -p + dis;
433  nreal = 2;
434  }
435  else
436  /* no real solution */
437  nreal = 0;
438  }
439 
440  else if (coeffs[1]!=0.0) {
441  /* linear problem? */
442  koreny[0] = -coeffs[0]/coeffs[1];
443  nreal = 1;
444  }
445 
446  else
447  /* no equation */
448  nreal = 0;
449 
450  return nreal;
451 }
const double Pi
int i
Definition: DBlmapReader.cc:9
void SWAP(double &realone, double &realtwo)
T sqrt(T t)
Definition: SSEVec.h:28
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double sqr(double x)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
Definition: DDAxes.h:10
void TtFullLepKinSolver::FindCoeff ( const TLorentzVector  al,
const TLorentzVector  l,
const TLorentzVector  b_al,
const TLorentzVector  b_l,
double  mt,
double  mat,
double  pxboost,
double  pyboost,
double *  q_coeff 
)
private

Definition at line 171 of file TtFullLepKinSolver.cc.

References C, D, F, k16, k26, k36, k46, k51, k56, k61, m1, m2, m3, mab, maw, mb, mw, n1, n2, n3, pom, funct::pow(), and sqr().

Referenced by addKinSolInfo(), and getNuSolution().

179  {
180 
181 double E, apom1, apom2, apom3;
182 double k11, k21, k31, k41, cpom1, cpom2, cpom3, l11, l21, l31, l41, l51, l61, k1, k2, k3, k4, k5,k6;
183 double l1, l2, l3, l4, l5, l6, k15, k25, k35, k45;
184 
185  C = -al.Px()-b_al.Px()-l.Px()-b_l.Px() + px_miss;
186  D = -al.Py()-b_al.Py()-l.Py()-b_l.Py() + py_miss;
187 
188  // right side offirst two linear equations - missing pT
189 
190 
191  E = (sqr(mt)-sqr(mw)-sqr(mb))/(2*b_al.E())-sqr(mw)/(2*al.E())-al.E()+al.Px()*b_al.Px()/b_al.E()+al.Py()*b_al.Py()/b_al.E()+al.Pz()*b_al.Pz()/b_al.E();
192  F = (sqr(mat)-sqr(maw)-sqr(mab))/(2*b_l.E())-sqr(maw)/(2*l.E())-l.E()+l.Px()*b_l.Px()/b_l.E()+l.Py()*b_l.Py()/b_l.E()+l.Pz()*b_l.Pz()/b_l.E();
193 
194  m1 = al.Px()/al.E()-b_al.Px()/b_al.E();
195  m2 = al.Py()/al.E()-b_al.Py()/b_al.E();
196  m3 = al.Pz()/al.E()-b_al.Pz()/b_al.E();
197 
198  n1 = l.Px()/l.E()-b_l.Px()/b_l.E();
199  n2 = l.Py()/l.E()-b_l.Py()/b_l.E();
200  n3 = l.Pz()/l.E()-b_l.Pz()/b_l.E();
201 
202  pom = E-m1*C-m2*D;
203  apom1 = sqr(al.Px())-sqr(al.E());
204  apom2 = sqr(al.Py())-sqr(al.E());
205  apom3 = sqr(al.Pz())-sqr(al.E());
206 
207  k11 = 1/sqr(al.E())*(pow(mw,4)/4+sqr(C)*apom1+sqr(D)*apom2+apom3*sqr(pom)/sqr(m3)+sqr(mw)*(al.Px()*C+al.Py()*D+al.Pz()*pom/m3)+2*al.Px()*al.Py()*C*D+2*al.Px()*al.Pz()*C*pom/m3+2*al.Py()*al.Pz()*D*pom/m3);
208  k21 = 1/sqr(al.E())*(-2*C*m3*n3*apom1+2*apom3*n3*m1*pom/m3-sqr(mw)*m3*n3*al.Px()+sqr(mw)*m1*n3*al.Pz()-2*al.Px()*al.Py()*D*m3*n3+2*al.Px()*al.Pz()*C*m1*n3-2*al.Px()*al.Pz()*n3*pom+2*al.Py()*al.Pz()*D*m1*n3);
209  k31 = 1/sqr(al.E())*(-2*D*m3*n3*apom2+2*apom3*n3*m2*pom/m3-sqr(mw)*m3*n3*al.Py()+sqr(mw)*m2*n3*al.Pz()-2*al.Px()*al.Py()*C*m3*n3+2*al.Px()*al.Pz()*C*m2*n3-2*al.Py()*al.Pz()*n3*pom+2*al.Py()*al.Pz()*D*m2*n3);
210  k41 = 1/sqr(al.E())*(2*apom3*m1*m2*sqr(n3)+2*al.Px()*al.Py()*sqr(m3)*sqr(n3)-2*al.Px()*al.Pz()*m2*m3*sqr(n3)-2*al.Py()*al.Pz()*m1*m3*sqr(n3));
211  k51 = 1/sqr(al.E())*(apom1*sqr(m3)*sqr(n3)+apom3*sqr(m1)*sqr(n3)-2*al.Px()*al.Pz()*m1*m3*sqr(n3));
212  k61 = 1/sqr(al.E())*(apom2*sqr(m3)*sqr(n3)+apom3*sqr(m2)*sqr(n3)-2*al.Py()*al.Pz()*m2*m3*sqr(n3));
213 
214  cpom1 = sqr(l.Px())-sqr(l.E());
215  cpom2 = sqr(l.Py())-sqr(l.E());
216  cpom3 = sqr(l.Pz())-sqr(l.E());
217 
218  l11 = 1/sqr(l.E())*(pow(maw,4)/4+cpom3*sqr(F)/sqr(n3)+sqr(maw)*l.Pz()*F/n3);
219  l21 = 1/sqr(l.E())*(-2*cpom3*F*m3*n1/n3+sqr(maw)*(l.Px()*m3*n3-l.Pz()*n1*m3)+2*l.Px()*l.Pz()*F*m3);
220  l31 = 1/sqr(l.E())*(-2*cpom3*F*m3*n2/n3+sqr(maw)*(l.Py()*m3*n3-l.Pz()*n2*m3)+2*l.Py()*l.Pz()*F*m3);
221  l41 = 1/sqr(l.E())*(2*cpom3*n1*n2*sqr(m3)+2*l.Px()*l.Py()*sqr(m3)*sqr(n3)-2*l.Px()*l.Pz()*n2*n3*sqr(m3)-2*l.Py()*l.Pz()*n1*n3*sqr(m3));
222  l51 = 1/sqr(l.E())*(cpom1*sqr(m3)*sqr(n3)+cpom3*sqr(n1)*sqr(m3)-2*l.Px()*l.Pz()*n1*n3*sqr(m3));
223  l61 = 1/sqr(l.E())*(cpom2*sqr(m3)*sqr(n3)+cpom3*sqr(n2)*sqr(m3)-2*l.Py()*l.Pz()*n2*n3*sqr(m3));
224 
225  k1 = k11*k61;
226  k2 = k61*k21/k51;
227  k3 = k31;
228  k4 = k41/k51;
229  k5 = k61/k51;
230  k6 = 1;
231 
232  l1 = l11*k61;
233  l2 = l21*k61/k51;
234  l3 = l31;
235  l4 = l41/k51;
236  l5 = l51*k61/(sqr(k51));
237  l6 = l61/k61;
238 
239  k15 = k1*l5-l1*k5;
240  k25 = k2*l5-l2*k5;
241  k35 = k3*l5-l3*k5;
242  k45 = k4*l5-l4*k5;
243 
244  k16 = k1*l6-l1*k6;
245  k26 = k2*l6-l2*k6;
246  k36 = k3*l6-l3*k6;
247  k46 = k4*l6-l4*k6;
248  k56 = k5*l6-l5*k6;
249 
250 
251  koeficienty[0] = k15*sqr(k36)-k35*k36*k16-k56*sqr(k16);
252  koeficienty[1] = 2*k15*k36*k46+k25*sqr(k36)+k35*(-k46*k16-k36*k26)-k45*k36*k16-2*k56*k26*k16;
253  koeficienty[2] = k15*sqr(k46)+2*k25*k36*k46+k35*(-k46*k26-k36*k56)-k56*(sqr(k26)+2*k56*k16)-k45*(k46*k16+k36*k26);
254  koeficienty[3] = k25*sqr(k46)-k35*k46*k56-k45*(k46*k26+k36*k56)-2*sqr(k56)*k26;
255  koeficienty[4] = -k45*k46*k56-pow(k56,3);
256 
257  // normalization of coefficients
258  int moc=(int(log10(fabs(koeficienty[0])))+int(log10(fabs(koeficienty[4]))))/2;
259 
260  koeficienty[0]=koeficienty[0]/TMath::Power(10,moc);
261  koeficienty[1]=koeficienty[1]/TMath::Power(10,moc);
262  koeficienty[2]=koeficienty[2]/TMath::Power(10,moc);
263  koeficienty[3]=koeficienty[3]/TMath::Power(10,moc);
264  koeficienty[4]=koeficienty[4]/TMath::Power(10,moc);
265 }
double sqr(double x)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
TtFullLepKinSolver::NeutrinoSolution TtFullLepKinSolver::getNuSolution ( TLorentzVector  LV_l,
TLorentzVector  LV_l_,
TLorentzVector  LV_b,
TLorentzVector  LV_b_ 
)

Definition at line 136 of file TtFullLepKinSolver.cc.

References FindCoeff(), LV_n, LV_n_, TtFullLepKinSolver::NeutrinoSolution::neutrino, TtFullLepKinSolver::NeutrinoSolution::neutrinoBar, pxmiss_, pymiss_, quartic(), topmass_begin, topmass_end, topmass_step, TopRec(), TtFullLepKinSolver::NeutrinoSolution::weight, CommonMethods::weight(), and WeightSolfromShape().

Referenced by TtFullLepKinSolutionProducer::produce().

139  {
140 
143 
144  //loop on top mass parameter
145  double weightmax = -1;
146  for(double mt = topmass_begin;
147  mt < topmass_end + 0.5*topmass_step;
148  mt += topmass_step) {
149  double q_coeff[5], q_sol[4];
150  FindCoeff(LV_l, LV_l_, LV_b, LV_b_, mt, mt, pxmiss_, pymiss_, q_coeff);
151  int NSol = quartic(q_coeff, q_sol);
152 
153  //loop on all solutions
154  for (int isol = 0; isol < NSol; isol++) {
155  TopRec(LV_l, LV_l_, LV_b, LV_b_, q_sol[isol]);
156  double weight = WeightSolfromShape();
157  if (weight > weightmax) {
158  weightmax =weight;
159  maxLV_n.SetPxPyPzE(LV_n.Px(), LV_n.Py(), LV_n.Pz(), LV_n.E());
160  maxLV_n_.SetPxPyPzE(LV_n_.Px(), LV_n_.Py(), LV_n_.Pz(), LV_n_.E());
161  }
162  }
163  }
165  nuSol.neutrino = reco::LeafCandidate(0, maxLV_n );
166  nuSol.neutrinoBar = reco::LeafCandidate(0, maxLV_n_ );
167  nuSol.weight = weightmax;
168  return nuSol;
169 }
int quartic(double *q_coeff, double *q_sol)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
void TopRec(const TLorentzVector al, const TLorentzVector l, const TLorentzVector b_al, const TLorentzVector b_l, double sol)
TLorentzVector LV_n_
void FindCoeff(const TLorentzVector al, const TLorentzVector l, const TLorentzVector b_al, const TLorentzVector b_l, double mt, double mat, double pxboost, double pyboost, double *q_coeff)
int TtFullLepKinSolver::quartic ( double *  q_coeff,
double *  q_sol 
)
private

Definition at line 317 of file TtFullLepKinSolver.cc.

References trackerHits::c, cubic(), debug_cff::d0, debug_cff::d1, h, i, sqr(), mathSSE::sqrt(), matplotRender::t, and detailsBasic3DVector::z.

Referenced by addKinSolInfo(), and getNuSolution().

317  {
318  int i, nreal;
319  double w, b0, b1, b2;
320  double c[4];
321  double d0, d1, h, t, z;
322  double *px;
323 
324 
325  if (koeficienty[4]==0.0)
326  return cubic(koeficienty, koreny);
327  /* quartic problem? */
328  w = koeficienty[3]/(4*koeficienty[4]);
329  /* offset */
330  b2 = -6*sqr(w) + koeficienty[2]/koeficienty[4];
331  /* koeficienty. of shifted polynomial */
332  b1 = (8*sqr(w) - 2*koeficienty[2]/koeficienty[4])*w + koeficienty[1]/koeficienty[4];
333  b0 = ((-3*sqr(w) + koeficienty[2]/koeficienty[4])*w - koeficienty[1]/koeficienty[4])*w + koeficienty[0]/koeficienty[4];
334 
335  c[3] = 1.0;
336  /* cubic resolvent */
337  c[2] = b2;
338  c[1] = -4*b0;
339  c[0] = sqr(b1) - 4*b0*b2;
340 
341 
342  i = cubic(c, koreny);
343  z = koreny[0];
344  //double z1=1.0,z2=2.0,z3=3.0;
345  //TMath::RootsCubic(c,z1,z2,z3);
346  //if (z2 !=0) z = z2;
347  //if (z1 !=0) z = z1;
348  /* only lowermost root needed */
349 
350  nreal = 0;
351  px = koreny;
352  t = sqrt(0.25*sqr(z) - b0);
353  for (i=-1; i<=1; i+=2) {
354  d0 = -0.5*z + i*t;
355  /* coeffs. of quadratic factor */
356  d1 = (t!=0.0)? -i*0.5*b1/t : i*sqrt(-z - b2);
357  h = 0.25*sqr(d1) - d0;
358  if (h>=0.0) {
359  h = sqrt(h);
360  nreal += 2;
361  *px++ = -0.5*d1 - h - w;
362  *px++ = -0.5*d1 + h - w;
363  }
364  }
365 
366  if (nreal==4) {
367  /* sort results */
368 // if (koreny[2]<koreny[0]) SWAP(koreny[0], koreny[2]);
369 // if (koreny[3]<koreny[1]) SWAP(koreny[1], koreny[3]);
370 // if (koreny[1]<koreny[0]) SWAP(koreny[0], koreny[1]);
371 // if (koreny[3]<koreny[2]) SWAP(koreny[2], koreny[3]);
372 // if (koreny[2]<koreny[1]) SWAP(koreny[1], koreny[2]);
373  }
374  return nreal;
375 
376 }
int i
Definition: DBlmapReader.cc:9
int cubic(double *c_coeff, double *c_sol)
tuple d0
Definition: debug_cff.py:3
tuple d1
Definition: debug_cff.py:7
double double double z
T sqrt(T t)
Definition: SSEVec.h:28
double sqr(double x)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
void TtFullLepKinSolver::SetConstraints ( double  xx = 0,
double  yy = 0 
)

Definition at line 130 of file TtFullLepKinSolver.cc.

References pxmiss_, and pymiss_.

Referenced by TtDilepEvtSolutionMaker::produce(), and TtFullLepKinSolutionProducer::produce().

131 {
132  pxmiss_ = xx;
133  pymiss_ = yy;
134 }
double TtFullLepKinSolver::sqr ( double  x)
inlineprivate

Definition at line 55 of file TtFullLepKinSolver.h.

Referenced by cubic(), FindCoeff(), and quartic().

55 {return (x*x);}
Definition: DDAxes.h:10
void TtFullLepKinSolver::SWAP ( double &  realone,
double &  realtwo 
)
private

Definition at line 454 of file TtFullLepKinSolver.cc.

References printConversionInfo::aux.

Referenced by cubic().

454  {
455  if (realtwo < realone) {
456  double aux = realtwo;
457  realtwo = realone;
458  realone = aux;
459  }
460 }
void TtFullLepKinSolver::TopRec ( const TLorentzVector  al,
const TLorentzVector  l,
const TLorentzVector  b_al,
const TLorentzVector  b_l,
double  sol 
)
private

Definition at line 267 of file TtFullLepKinSolver.cc.

References printConversionInfo::aux, C, D, F, k16, k26, k36, k46, k51, k56, k61, LV_n, LV_n_, LV_t, LV_t_, LV_tt_t, LV_tt_t_, m1, m2, m3, n1, n2, n3, pom, and funct::pow().

Referenced by addKinSolInfo(), and getNuSolution().

271  {
272 
273  TVector3 t_ttboost;
274  TLorentzVector aux;
275  double pxp, pyp, pzp, pup, pvp, pwp;
276 
277 
278  pxp = sol*(m3*n3/k51);
279  pyp = -(m3*n3/k61)*(k56*pow(sol,2) + k26*sol + k16)/(k36 + k46*sol);
280  pzp = -1/n3*(n1*pxp + n2*pyp - F);
281  pwp = 1/m3*(m1*pxp + m2*pyp + pom);
282  pup = C - pxp;
283  pvp = D - pyp;
284 
285  LV_n_.SetXYZM(pxp, pyp, pzp, 0.0);
286  LV_n.SetXYZM(pup, pvp, pwp, 0.0);
287 
288 
289  LV_t_ = b_l + l + LV_n_;
290  LV_t = b_al + al + LV_n;
291 
292 
293  aux = (LV_t_ + LV_t);
294  t_ttboost = -aux.BoostVector();
295  LV_tt_t_ = LV_t_;
296  LV_tt_t = LV_t;
297  LV_tt_t_.Boost(t_ttboost);
298  LV_tt_t.Boost(t_ttboost);
299 }
TLorentzVector LV_t_
TLorentzVector LV_n_
TLorentzVector LV_tt_t
TLorentzVector LV_tt_t_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void TtFullLepKinSolver::useWeightFromMC ( bool  useMC)
inline
double TtFullLepKinSolver::WeightSolfromMC ( )
private

Definition at line 301 of file TtFullLepKinSolver.cc.

References genLV_n, genLV_n_, LV_n, LV_n_, and CommonMethods::weight().

Referenced by addKinSolInfo().

301  {
302 
303  double weight = 1;
304  weight = ((LV_n.E() > genLV_n.E())? genLV_n.E()/LV_n.E(): LV_n.E()/genLV_n.E())
305  *((LV_n_.E() > genLV_n_.E())? genLV_n_.E()/LV_n_.E(): LV_n_.E()/genLV_n_.E());
306  return weight;
307 
308 }
TLorentzVector genLV_n
TLorentzVector LV_n_
TLorentzVector genLV_n_
double TtFullLepKinSolver::WeightSolfromShape ( )
private

Definition at line 310 of file TtFullLepKinSolver.cc.

References EventShape_, LV_n, and LV_n_.

Referenced by addKinSolInfo(), and getNuSolution().

310  {
311 
312  // Use the parametrized event shape to obtain the solution weight.
313  return EventShape_->Eval(LV_n.E(),LV_n_.E());
314 
315 }
TLorentzVector LV_n_

Member Data Documentation

double TtFullLepKinSolver::C
private

Definition at line 66 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TopRec().

double TtFullLepKinSolver::D
private

Definition at line 67 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TopRec().

TF2* TtFullLepKinSolver::EventShape_
private
double TtFullLepKinSolver::F
private

Definition at line 68 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TopRec().

TLorentzVector TtFullLepKinSolver::genLV_n
private

Definition at line 86 of file TtFullLepKinSolver.h.

Referenced by addKinSolInfo(), and WeightSolfromMC().

TLorentzVector TtFullLepKinSolver::genLV_n_
private

Definition at line 86 of file TtFullLepKinSolver.h.

Referenced by addKinSolInfo(), and WeightSolfromMC().

double TtFullLepKinSolver::k16
private

Definition at line 70 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TopRec().

double TtFullLepKinSolver::k26
private

Definition at line 71 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TopRec().

double TtFullLepKinSolver::k36
private

Definition at line 72 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TopRec().

double TtFullLepKinSolver::k46
private

Definition at line 73 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TopRec().

double TtFullLepKinSolver::k51
private

Definition at line 75 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TopRec().

double TtFullLepKinSolver::k56
private

Definition at line 74 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TopRec().

double TtFullLepKinSolver::k61
private

Definition at line 76 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TopRec().

TLorentzVector TtFullLepKinSolver::LV_n
private

Definition at line 84 of file TtFullLepKinSolver.h.

Referenced by getNuSolution(), TopRec(), WeightSolfromMC(), and WeightSolfromShape().

TLorentzVector TtFullLepKinSolver::LV_n_
private

Definition at line 84 of file TtFullLepKinSolver.h.

Referenced by getNuSolution(), TopRec(), WeightSolfromMC(), and WeightSolfromShape().

TLorentzVector TtFullLepKinSolver::LV_t
private

Definition at line 84 of file TtFullLepKinSolver.h.

Referenced by TopRec().

TLorentzVector TtFullLepKinSolver::LV_t_
private

Definition at line 84 of file TtFullLepKinSolver.h.

Referenced by TopRec().

TLorentzVector TtFullLepKinSolver::LV_tt_t
private

Definition at line 84 of file TtFullLepKinSolver.h.

Referenced by TopRec().

TLorentzVector TtFullLepKinSolver::LV_tt_t_
private

Definition at line 84 of file TtFullLepKinSolver.h.

Referenced by TopRec().

double TtFullLepKinSolver::m1
private

Definition at line 77 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TopRec().

double TtFullLepKinSolver::m2
private

Definition at line 78 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TopRec().

double TtFullLepKinSolver::m3
private

Definition at line 79 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TopRec().

double TtFullLepKinSolver::mab
private

Definition at line 64 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TtFullLepKinSolver().

double TtFullLepKinSolver::maw
private

Definition at line 64 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TtFullLepKinSolver().

double TtFullLepKinSolver::mb
private

Definition at line 64 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TtFullLepKinSolver().

double TtFullLepKinSolver::mw
private

Definition at line 64 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TtFullLepKinSolver().

double TtFullLepKinSolver::n1
private

Definition at line 80 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TopRec().

double TtFullLepKinSolver::n2
private

Definition at line 81 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TopRec().

double TtFullLepKinSolver::n3
private

Definition at line 82 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TopRec().

double TtFullLepKinSolver::pom
private

Definition at line 69 of file TtFullLepKinSolver.h.

Referenced by FindCoeff(), and TopRec().

double TtFullLepKinSolver::pxmiss_
private
double TtFullLepKinSolver::pymiss_
private
double TtFullLepKinSolver::topmass_begin
private

Definition at line 59 of file TtFullLepKinSolver.h.

Referenced by addKinSolInfo(), getNuSolution(), and TtFullLepKinSolver().

double TtFullLepKinSolver::topmass_end
private

Definition at line 60 of file TtFullLepKinSolver.h.

Referenced by addKinSolInfo(), getNuSolution(), and TtFullLepKinSolver().

double TtFullLepKinSolver::topmass_step
private

Definition at line 61 of file TtFullLepKinSolver.h.

Referenced by addKinSolInfo(), getNuSolution(), and TtFullLepKinSolver().

bool TtFullLepKinSolver::useMCforBest_
private

Definition at line 89 of file TtFullLepKinSolver.h.

Referenced by addKinSolInfo(), and useWeightFromMC().