5 : topmass_begin(0), topmass_end(0), topmass_step(0), mw(80.4), mb(4.8), pxmiss_(0), pymiss_(0) {
8 EventShape_ =
new TF2(
"landau2D",
"[0]*TMath::Landau(x,[1],[2],0)*TMath::Landau(y,[3],[4],0)", 0, 500, 0, 500);
9 EventShape_->SetParameters(30.7137, 56.2880, 23.0744, 59.1015, 24.9145);
13 const double b,
const double e,
const double s,
const std::vector<double>& nupars,
const double mW,
const double mB)
14 : topmass_begin(
b), topmass_end(
e), topmass_step(
s), mw(
mW), mb(mB), pxmiss_(0), pymiss_(0) {
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(nupars[0], nupars[1], nupars[2], nupars[3], nupars[4]);
28 TLorentzVector LV_e, LV_e_;
30 TLorentzVector LV_b, LV_b_;
32 bool hasMCinfo =
true;
51 LV_e = TLorentzVector(
53 }
else if (fitsol.
getWpDecay() ==
"electron") {
65 LV_e_ = TLorentzVector(
67 }
else if (fitsol.
getWmDecay() ==
"electron") {
78 LV_b = TLorentzVector(
88 double weightmax = -1e30;
92 double q_coeff[5], q_sol[4];
94 int NSol =
quartic(q_coeff, q_sol);
97 for (
int isol = 0; isol < NSol; isol++) {
98 TopRec(LV_e, LV_e_, LV_b, LV_b_, q_sol[isol]);
126 const TLorentzVector& LV_l_,
127 const TLorentzVector& LV_b,
128 const TLorentzVector& LV_b_) {
133 double weightmax = -1;
135 double q_coeff[5], q_sol[4];
137 int NSol =
quartic(q_coeff, q_sol);
140 for (
int isol = 0; isol < NSol; isol++) {
141 TopRec(LV_l, LV_l_, LV_b, LV_b_, q_sol[isol]);
158 const TLorentzVector&
l,
159 const TLorentzVector& b_al,
160 const TLorentzVector& b_l,
163 const double px_miss,
164 const double py_miss,
165 double* koeficienty) {
166 double E, apom1, apom2, apom3;
167 double k11, k21, k31, k41, cpom1, cpom2, cpom3, l11, l21, l31, l41, l51, l61, k1,
k2, k3, k4, k5, k6;
168 double l1, l2, l3, l4, l5, l6, k15, k25, k35, k45;
170 C = -al.Px() - b_al.Px() -
l.Px() - b_l.Px() + px_miss;
171 D = -al.Py() - b_al.Py() -
l.Py() - b_l.Py() + py_miss;
176 al.Px() * b_al.Px() / b_al.E() + al.Py() * b_al.Py() / b_al.E() + al.Pz() * b_al.Pz() / b_al.E();
177 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() +
178 l.Py() * b_l.Py() / b_l.E() +
l.Pz() * b_l.Pz() / b_l.E();
180 m1 = al.Px() / al.E() - b_al.Px() / b_al.E();
181 m2 = al.Py() / al.E() - b_al.Py() / b_al.E();
182 m3 = al.Pz() / al.E() - b_al.Pz() / b_al.E();
184 n1 =
l.Px() /
l.E() - b_l.Px() / b_l.E();
185 n2 =
l.Py() /
l.E() - b_l.Py() / b_l.E();
186 n3 =
l.Pz() /
l.E() - b_l.Pz() / b_l.E();
189 apom1 =
sqr(al.Px()) -
sqr(al.E());
190 apom2 =
sqr(al.Py()) -
sqr(al.E());
191 apom3 =
sqr(al.Pz()) -
sqr(al.E());
193 k11 = 1 /
sqr(al.E()) *
195 sqr(
mw) * (al.Px() *
C + al.Py() *
D + al.Pz() *
pom /
m3) + 2 * al.Px() * al.Py() *
C *
D +
196 2 * al.Px() * al.Pz() *
C *
pom /
m3 + 2 * al.Py() * al.Pz() *
D *
pom /
m3);
197 k21 = 1 /
sqr(al.E()) *
199 sqr(
mw) *
m1 *
n3 * al.Pz() - 2 * al.Px() * al.Py() *
D *
m3 *
n3 + 2 * al.Px() * al.Pz() *
C *
m1 *
n3 -
200 2 * al.Px() * al.Pz() *
n3 *
pom + 2 * al.Py() * al.Pz() *
D *
m1 *
n3);
201 k31 = 1 /
sqr(al.E()) *
203 sqr(
mw) *
m2 *
n3 * al.Pz() - 2 * al.Px() * al.Py() *
C *
m3 *
n3 + 2 * al.Px() * al.Pz() *
C *
m2 *
n3 -
204 2 * al.Py() * al.Pz() *
n3 *
pom + 2 * al.Py() * al.Pz() *
D *
m2 *
n3);
205 k41 = 1 /
sqr(al.E()) *
207 2 * al.Px() * al.Pz() *
m2 *
m3 *
sqr(
n3) - 2 * al.Py() * al.Pz() *
m1 *
m3 *
sqr(
n3));
224 l41 = 1 /
sqr(
l.E()) *
227 l51 = 1 /
sqr(
l.E()) *
229 l61 = 1 /
sqr(
l.E()) *
246 k15 = k1 * l5 - l1 * k5;
247 k25 =
k2 * l5 - l2 * k5;
248 k35 = k3 * l5 - l3 * k5;
249 k45 = k4 * l5 - l4 * k5;
251 k16 = k1 * l6 - l1 * k6;
252 k26 =
k2 * l6 - l2 * k6;
253 k36 = k3 * l6 - l3 * k6;
254 k46 = k4 * l6 - l4 * k6;
255 k56 = k5 * l6 - l5 * k6;
266 int moc = (
int(log10(fabs(koeficienty[0]))) +
int(log10(fabs(koeficienty[4])))) / 2;
268 koeficienty[0] = koeficienty[0] / TMath::Power(10, moc);
269 koeficienty[1] = koeficienty[1] / TMath::Power(10, moc);
270 koeficienty[2] = koeficienty[2] / TMath::Power(10, moc);
271 koeficienty[3] = koeficienty[3] / TMath::Power(10, moc);
272 koeficienty[4] = koeficienty[4] / TMath::Power(10, moc);
276 const TLorentzVector&
l,
277 const TLorentzVector& b_al,
278 const TLorentzVector& b_l,
282 double pxp, pyp, pzp, pup, pvp, pwp;
286 pzp = -1 /
n3 * (
n1 * pxp +
n2 * pyp -
F);
287 pwp = 1 /
m3 * (
m1 * pxp +
m2 * pyp +
pom);
291 LV_n_.SetXYZM(pxp, pyp, pzp, 0.0);
292 LV_n.SetXYZM(pup, pvp, pwp, 0.0);
298 t_ttboost = -
aux.BoostVector();
320 if (koeficienty[4] == 0.0) {
321 return cubic(koeficienty, koreny);
324 w = koeficienty[3] / (4 * koeficienty[4]);
326 b2 = -6 *
sqr(
w) + koeficienty[2] / koeficienty[4];
328 b1 = (8 *
sqr(
w) - 2 * koeficienty[2] / koeficienty[4]) *
w + koeficienty[1] / koeficienty[4];
329 b0 = ((-3 *
sqr(
w) + koeficienty[2] / koeficienty[4]) *
w - koeficienty[1] / koeficienty[4]) *
w +
330 koeficienty[0] / koeficienty[4];
338 if (
cubic(
c, koreny) == 0) {
353 for (
int i = -1;
i <= 1;
i += 2) {
354 d0 = -0.5 *
z +
i *
t;
361 *
px++ = -0.5 *
d1 -
h -
w;
362 *
px++ = -0.5 *
d1 +
h -
w;
381 if (coeffs[3] != 0.0) {
383 w = coeffs[2] / (3 * coeffs[3]);
384 p =
sqr(coeffs[1] / (3 * coeffs[3]) -
sqr(
w)) * (coeffs[1] / (3 * coeffs[3]) -
sqr(
w));
385 q = -0.5 * (2 *
sqr(
w) *
w - (coeffs[1] *
w - coeffs[0]) / coeffs[3]);
398 p = 2 * TMath::Power(-
p, 1.0 / 6.0);
399 for (
unsigned i = 0;
i < 3;
i++)
401 if (koreny[1] < koreny[0])
402 SWAP(koreny[0], koreny[1]);
404 if (koreny[2] < koreny[1])
405 SWAP(koreny[1], koreny[2]);
406 if (koreny[1] < koreny[0])
407 SWAP(koreny[0], koreny[1]);
412 h = TMath::Power(fabs(
q + dis), 1.0 / 3.0);
413 p = TMath::Power(fabs(
q - dis), 1.0 / 3.0);
414 koreny[0] = ((
q + dis > 0.0) ?
h : -
h) + ((
q - dis > 0.0) ?
p : -
p) -
w;
420 for (
unsigned i = 0;
i < nreal;
i++) {
421 h = coeffs[1] + koreny[
i] * (2 * coeffs[2] + 3 * koreny[
i] * coeffs[3]);
423 koreny[
i] -= (coeffs[0] + koreny[
i] * (coeffs[1] + koreny[
i] * (coeffs[2] + koreny[
i] * coeffs[3]))) /
h;
427 else if (coeffs[2] != 0.0) {
429 p = 0.5 * coeffs[1] / coeffs[2];
430 dis =
sqr(
p) - coeffs[0] / coeffs[2];
434 koreny[0] = -
p - dis;
435 koreny[1] = -
p + dis;
442 else if (coeffs[1] != 0.0) {
444 koreny[0] = -coeffs[0] / coeffs[1];
456 if (realtwo < realone) {
457 double aux = realtwo;
double WeightSolfromMC() const
void setRecWeightMax(double wgt)
const reco::GenParticle * getGenN() const
double pz() const final
z coordinate of momentum vector
pat::Jet getCalJetBbar() const
NeutrinoSolution getNuSolution(const TLorentzVector &LV_l, const TLorentzVector &LV_l_, const TLorentzVector &LV_b, const TLorentzVector &LV_b_)
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()
double WeightSolfromShape() const
use the parametrized event shape to obtain the solution weight.
pat::Electron getElectronp() 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
double px() const final
x coordinate of momentum vector
reco::LeafCandidate neutrino
TtDilepEvtSolution addKinSolInfo(TtDilepEvtSolution *asol)
int quartic(double *q_coeff, double *q_sol) const
Cos< T >::type cos(const T &t)
TF2 * EventShape_
Event shape.
void TopRec(const TLorentzVector &al, const TLorentzVector &l, const TLorentzVector &b_al, const TLorentzVector &b_l, const double sol)
double py() const final
y coordinate of momentum vector
~TtFullLepKinSolver()
destructor
pat::Muon getMuonm() const
static constexpr float d0
pat::Muon getMuonp() const
double sqr(const double x) const
unsigned int cubic(const double *c_coeff, double *c_sol) const
std::string getWpDecay() const
std::string getWmDecay() const
const reco::GenParticle * getGenNbar() const
static constexpr float b0
pat::Jet getCalJetB() const
static constexpr float d1
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
const double topmass_begin
reco::LeafCandidate neutrinoBar
void setRecTopMass(double mass)
Power< A, B >::type pow(const A &a, const B &b)
pat::Electron getElectronm() const
static constexpr float b1
double energy() const final
energy