15 EventShape_ =
new TF2(
"landau2D",
"[0]*TMath::Landau(x,[1],[2],0)*TMath::Landau(y,[3],[4],0)",0,500,0,500);
16 EventShape_->SetParameters(30.7137,56.2880,23.0744,59.1015,24.9145);
28 EventShape_ =
new TF2(
"landau2D",
"[0]*TMath::Landau(x,[1],[2],0)*TMath::Landau(y,[3],[4],0)",0,500,0,500);
29 EventShape_->SetParameters(nupars[0],nupars[1],nupars[2],nupars[3],nupars[4]);
45 TLorentzVector LV_e, LV_e_;
47 TLorentzVector LV_b, LV_b_;
49 bool hasMCinfo =
true;
53 }
else hasMCinfo =
false;
58 }
else hasMCinfo =
false;
67 }
else if (fitsol.
getWpDecay() ==
"electron") {
79 }
else if (fitsol.
getWmDecay() ==
"electron") {
96 double weightmax = -1e30;
102 double q_coeff[5], q_sol[4];
104 int NSol =
quartic(q_coeff, q_sol);
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) {
139 const TLorentzVector& LV_l_,
140 const TLorentzVector& LV_b,
141 const TLorentzVector& LV_b_)
147 double weightmax = -1;
151 double q_coeff[5], q_sol[4];
153 int NSol =
quartic(q_coeff, q_sol);
156 for (
int isol = 0; isol < NSol; isol++) {
157 TopRec(LV_l, LV_l_, LV_b, LV_b_, q_sol[isol]);
159 if (weight > weightmax) {
175 const TLorentzVector&
l,
176 const TLorentzVector& b_al,
177 const TLorentzVector& b_l,
180 const double px_miss,
181 const double py_miss,
184 double E, apom1, apom2, apom3;
185 double k11, k21, k31, k41, cpom1, cpom2, cpom3, l11, l21, l31, l41, l51, l61, k1, k2, k3, k4, k5,k6;
186 double l1, l2, l3, l4, l5, l6, k15, k25, k35, k45;
188 C = -al.Px()-b_al.Px()-l.Px()-b_l.Px() + px_miss;
189 D = -al.Py()-b_al.Py()-l.Py()-b_l.Py() + py_miss;
193 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();
194 F = (
sqr(mat)-
sqr(
mw)-
sqr(
mb))/(2*b_l.E())-
sqr(
mw)/(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();
196 m1 = al.Px()/al.E()-b_al.Px()/b_al.E();
197 m2 = al.Py()/al.E()-b_al.Py()/b_al.E();
198 m3 = al.Pz()/al.E()-b_al.Pz()/b_al.E();
200 n1 = l.Px()/l.E()-b_l.Px()/b_l.E();
201 n2 = l.Py()/l.E()-b_l.Py()/b_l.E();
202 n3 = l.Pz()/l.E()-b_l.Pz()/b_l.E();
205 apom1 =
sqr(al.Px())-
sqr(al.E());
206 apom2 =
sqr(al.Py())-
sqr(al.E());
207 apom3 =
sqr(al.Pz())-
sqr(al.E());
216 cpom1 =
sqr(l.Px())-
sqr(l.E());
217 cpom2 =
sqr(l.Py())-
sqr(l.E());
218 cpom3 =
sqr(l.Pz())-
sqr(l.E());
238 l5 = l51*k61/(
sqr(k51));
259 int moc=(
int(log10(fabs(koeficienty[0])))+
int(log10(fabs(koeficienty[4]))))/2;
261 koeficienty[0]=koeficienty[0]/TMath::Power(10,moc);
262 koeficienty[1]=koeficienty[1]/TMath::Power(10,moc);
263 koeficienty[2]=koeficienty[2]/TMath::Power(10,moc);
264 koeficienty[3]=koeficienty[3]/TMath::Power(10,moc);
265 koeficienty[4]=koeficienty[4]/TMath::Power(10,moc);
269 const TLorentzVector&
l,
270 const TLorentzVector& b_al,
271 const TLorentzVector& b_l,
276 double pxp, pyp, pzp, pup, pvp, pwp;
280 pzp = -1/
n3*(
n1*pxp +
n2*pyp -
F);
285 LV_n_.SetXYZM(pxp, pyp, pzp, 0.0);
286 LV_n.SetXYZM(pup, pvp, pwp, 0.0);
292 t_ttboost = -aux.BoostVector();
317 double w, b0, b1, b2;
319 double d0, d1,
h,
t,
z;
322 if (koeficienty[4]==0.0)
323 return cubic(koeficienty, koreny);
325 w = koeficienty[3]/(4*koeficienty[4]);
327 b2 = -6*
sqr(w) + koeficienty[2]/koeficienty[4];
329 b1 = (8*
sqr(w) - 2*koeficienty[2]/koeficienty[4])*w + koeficienty[1]/koeficienty[4];
330 b0 = ((-3*
sqr(w) + koeficienty[2]/koeficienty[4])*w - koeficienty[1]/koeficienty[4])*w + koeficienty[0]/koeficienty[4];
336 c[0] =
sqr(b1) - 4*b0*b2;
349 for(
int i=-1;
i<=1;
i+=2) {
352 d1 = (t!=0.0)? -
i*0.5*b1/t :
i*
sqrt(-z - b2);
353 h = 0.25*
sqr(d1) -
d0;
357 *px++ = -0.5*d1 - h -
w;
358 *px++ = -0.5*d1 + h -
w;
380 if (coeffs[3]!=0.0) {
382 w = coeffs[2]/(3*coeffs[3]);
383 p =
sqr(coeffs[1]/(3*coeffs[3])-
sqr(w))*(coeffs[1]/(3*coeffs[3])-
sqr(w));
384 q = -0.5*(2*
sqr(w)*w-(coeffs[1]*w-coeffs[0])/coeffs[3]);
392 if (h<-1.0) h = -1.0;
395 p = 2*TMath::Power(-p, 1.0/6.0);
396 for(
unsigned i=0;
i<3;
i++)
398 if (koreny[1]<koreny[0])
SWAP(koreny[0], koreny[1]);
400 if (koreny[2]<koreny[1])
SWAP(koreny[1], koreny[2]);
401 if (koreny[1]<koreny[0])
SWAP(koreny[0], koreny[1]);
407 h = TMath::Power(fabs(q+dis), 1.0/3.0);
408 p = TMath::Power(fabs(q-dis), 1.0/3.0);
409 koreny[0] = ((q+dis>0.0)? h : -
h) + ((q-dis>0.0)? p : -
p) - w;
415 for(
unsigned i=0;
i<nreal;
i++) {
416 h = coeffs[1] + koreny[
i] * (2 * coeffs[2] + 3 * koreny[
i] * coeffs[3]);
418 koreny[
i] -= (coeffs[0] + koreny[
i] * (coeffs[1] + koreny[
i] * (coeffs[2] + koreny[
i] * coeffs[3])))/h;
422 else if (coeffs[2]!=0.0) {
424 p = 0.5*coeffs[1]/coeffs[2];
425 dis =
sqr(p) - coeffs[0]/coeffs[2];
429 koreny[0] = -p - dis;
430 koreny[1] = -p + dis;
438 else if (coeffs[1]!=0.0) {
440 koreny[0] = -coeffs[0]/coeffs[1];
455 if (realtwo < realone) {
456 double aux = realtwo;
pat::Jet getCalJetBbar() const
void setRecWeightMax(double wgt)
int quartic(double *q_coeff, double *q_sol) const
int cubic(const double *c_coeff, double *c_sol) const
NeutrinoSolution getNuSolution(const TLorentzVector &LV_l, const TLorentzVector &LV_l_, const TLorentzVector &LV_b, const TLorentzVector &LV_b_)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
double WeightSolfromMC() const
double px() const final
x coordinate of momentum vector
void SetConstraints(const double xx=0, const double yy=0)
void FindCoeff(const TLorentzVector &al, const TLorentzVector &l, const TLorentzVector &b_al, const TLorentzVector &b_l, const double mt, const double mat, const double pxboost, const double pyboost, double *q_coeff)
TtFullLepKinSolver()
default constructor
bool useMCforBest_
flag to swith from WeightSolfromMC() to WeightSolfromShape()
const reco::GenParticle * getGenN() const
pat::Electron getElectronm() const
std::string getWmDecay() const
std::string getWpDecay() const
TLorentzVector genLV_n
provisional
const double topmass_step
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void SWAP(double &realone, double &realtwo) const
const reco::GenParticle * getGenNbar() const
double pz() const final
z coordinate of momentum vector
reco::LeafCandidate neutrino
TtDilepEvtSolution addKinSolInfo(TtDilepEvtSolution *asol)
Cos< T >::type cos(const T &t)
double energy() const final
energy
TF2 * EventShape_
Event shape.
double sqr(const double x) const
pat::Electron getElectronp() const
void TopRec(const TLorentzVector &al, const TLorentzVector &l, const TLorentzVector &b_al, const TLorentzVector &b_l, const double sol)
~TtFullLepKinSolver()
destructor
pat::Muon getMuonm() const
double WeightSolfromShape() const
use the parametrized event shape to obtain the solution weight.
pat::Jet getCalJetB() const
double py() const final
y coordinate of momentum vector
pat::Muon getMuonp() const
const double topmass_begin
reco::LeafCandidate neutrinoBar
void setRecTopMass(double mass)
Power< A, B >::type pow(const A &a, const B &b)