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]);
100 if (weight > weightmax) {
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]);
143 if (weight > weightmax) {
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;
175 E = (
sqr(mt) -
sqr(
mw) -
sqr(
mb)) / (2 * b_al.E()) -
sqr(
mw) / (2 * al.E()) - al.E() +
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));
213 cpom1 =
sqr(l.Px()) -
sqr(l.E());
214 cpom2 =
sqr(l.Py()) -
sqr(l.E());
215 cpom3 =
sqr(l.Pz()) -
sqr(l.E());
220 (-2 * cpom3 *
F *
m3 *
n1 /
n3 +
sqr(
mw) * (l.Px() *
m3 *
n3 - l.Pz() *
n1 *
m3) + 2 * l.Px() * l.Pz() *
F *
m3);
223 (-2 * cpom3 *
F *
m3 *
n2 /
n3 +
sqr(
mw) * (l.Py() *
m3 *
n3 - l.Pz() *
n2 *
m3) + 2 * l.Py() * l.Pz() *
F *
m3);
224 l41 = 1 /
sqr(l.E()) *
227 l51 = 1 /
sqr(l.E()) *
229 l61 = 1 /
sqr(l.E()) *
233 k2 = k61 * k21 /
k51;
240 l2 = l21 * k61 /
k51;
243 l5 = l51 * k61 / (
sqr(k51));
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);
323 w = koeficienty[3] / (4 * koeficienty[4]);
325 b2 = -6 *
sqr(w) + koeficienty[2] / koeficienty[4];
327 b1 = (8 *
sqr(w) - 2 * koeficienty[2] / koeficienty[4]) * w + koeficienty[1] / koeficienty[4];
328 b0 = ((-3 *
sqr(w) + koeficienty[2] / koeficienty[4]) * w - koeficienty[1] / koeficienty[4]) * w +
329 koeficienty[0] / koeficienty[4];
335 c[0] =
sqr(b1) - 4 * b0 *
b2;
348 for (
int i = -1;
i <= 1;
i += 2) {
349 d0 = -0.5 * z +
i *
t;
351 d1 = (t != 0.0) ? -
i * 0.5 * b1 / t :
i *
sqrt(-z - b2);
352 h = 0.25 *
sqr(d1) -
d0;
356 *px++ = -0.5 * d1 - h -
w;
357 *px++ = -0.5 * d1 + h -
w;
376 if (coeffs[3] != 0.0) {
378 w = coeffs[2] / (3 * coeffs[3]);
379 p =
sqr(coeffs[1] / (3 * coeffs[3]) -
sqr(w)) * (coeffs[1] / (3 * coeffs[3]) -
sqr(w));
380 q = -0.5 * (2 *
sqr(w) * w - (coeffs[1] * w - coeffs[0]) / coeffs[3]);
393 p = 2 * TMath::Power(-p, 1.0 / 6.0);
394 for (
unsigned i = 0;
i < 3;
i++)
396 if (koreny[1] < koreny[0])
397 SWAP(koreny[0], koreny[1]);
399 if (koreny[2] < koreny[1])
400 SWAP(koreny[1], koreny[2]);
401 if (koreny[1] < koreny[0])
402 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;
437 else if (coeffs[1] != 0.0) {
439 koreny[0] = -coeffs[0] / coeffs[1];
451 if (realtwo < realone) {
452 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
const edm::EventSetup & c
double pz() const final
z coordinate of momentum vector
NeutrinoSolution getNuSolution(const TLorentzVector &LV_l, const TLorentzVector &LV_l_, const TLorentzVector &LV_b, const TLorentzVector &LV_b_)
double WeightSolfromMC() const
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
double px() const final
x coordinate of momentum vector
const reco::GenParticle * getGenNbar() const
reco::LeafCandidate neutrino
TtDilepEvtSolution addKinSolInfo(TtDilepEvtSolution *asol)
Cos< T >::type cos(const T &t)
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)
double py() const final
y coordinate of momentum vector
~TtFullLepKinSolver()
destructor
pat::Muon getMuonm() const
double WeightSolfromShape() const
use the parametrized event shape to obtain the solution weight.
static constexpr float d0
pat::Jet getCalJetB() const
static constexpr float b2
static constexpr float b0
pat::Muon getMuonp() 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)
static constexpr float b1
double energy() const final
energy