本文整理汇总了C++中TLorentzVector::E方法的典型用法代码示例。如果您正苦于以下问题:C++ TLorentzVector::E方法的具体用法?C++ TLorentzVector::E怎么用?C++ TLorentzVector::E使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLorentzVector
的用法示例。
在下文中一共展示了TLorentzVector::E方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void rochcor2012::musclefit_data( TLorentzVector& mu, TLorentzVector& mubar){
float dpar1 = 0.0;
float dpar2 = 0.0;
float epar1 = 0.0;
float epar2 = 0.0;
if(fabs(mu.PseudoRapidity())<=0.9){
dpar1 = d0par;
epar1 = e0par;
}else if(mu.PseudoRapidity()>0.9){
dpar1 = d1par;
epar1 = e1par;
}else if(mu.PseudoRapidity()<-0.9){
dpar1 = d2par;
epar1 = e2par;
}
if(fabs(mubar.PseudoRapidity())<=0.9){
dpar2 = d0par;
epar2 = e0par;
}else if(mubar.PseudoRapidity()>0.9){
dpar2 = d1par;
epar2 = e1par;
}else if(mubar.PseudoRapidity()<-0.9){
dpar2 = d2par;
epar2 = e2par;
}
float corr1 = 1.0 + bpar*mu.Pt() + (-1.0)*cpar*mu.Pt()*TMath::Sign(float(1.0),float(mu.PseudoRapidity()))*TMath::Power(mu.PseudoRapidity(),2)
+ (-1.0)*dpar1*mu.Pt()*sin(mu.Phi() + epar1);
float corr2 = 1.0 + bpar*mubar.Pt() + (1.0)*cpar*mubar.Pt()*TMath::Sign(float(1.0),float(mubar.PseudoRapidity()))*TMath::Power(mubar.PseudoRapidity(),2)
+ (1.0)*dpar2*mubar.Pt()*sin(mubar.Phi() + epar2);
float px1 = mu.Px();
float py1 = mu.Py();
float pz1 = mu.Pz();
float e1 = mu.E();
float px2 = mubar.Px();
float py2 = mubar.Py();
float pz2 = mubar.Pz();
float e2 = mubar.E();
px1 *= corr1;
py1 *= corr1;
pz1 *= corr1;
e1 *= corr1;
px2 *= corr2;
py2 *= corr2;
pz2 *= corr2;
e2 *= corr2;
mu.SetPxPyPzE(px1,py1,pz1,e1);
mubar.SetPxPyPzE(px2,py2,pz2,e2);
}
示例2: HHLorentzVector
HHKinFit2::HHKinFitMasterSingleHiggs::HHKinFitMasterSingleHiggs(TLorentzVector const& tauvis1,
TLorentzVector const& tauvis2,
TVector2 const& met,
TMatrixD const& met_cov,
bool istruth,
TLorentzVector const& higgsgen)
:m_MET_COV(TMatrixD(4,4))
{
m_tauvis1 = HHLorentzVector(tauvis1.Px(), tauvis1.Py(), tauvis1.Pz(), tauvis1.E());
m_tauvis2 = HHLorentzVector(tauvis2.Px(), tauvis2.Py(), tauvis2.Pz(), tauvis2.E());
m_tauvis1.SetMkeepE(1.77682);
m_tauvis2.SetMkeepE(1.77682);
m_MET = met;
m_MET_COV = met_cov;
m_chi2_best = pow(10,10);
m_bestHypo = 0;
// if (istruth){
// TRandom3 r(0);
//
// HHLorentzVector recoil;
// if(heavyhiggsgen != NULL){
// Double_t pxRecoil = r.Gaus(-(heavyhiggsgen->Px() ), 10.0);
// Double_t pyRecoil = r.Gaus(-(heavyhiggsgen->Py() ), 10.0);
//
// recoil = HHLorentzVector(pxRecoil, pyRecoil, 0,
// sqrt(pxRecoil*pxRecoil+pyRecoil*pyRecoil));
// }
// else{
// recoil = HHLorentzVector(0,0,0,0);
// std::cout << "WARNING! Truthinput mode active but no Heavy Higgs gen-information given! Setting Recoil to Zero!" << std::endl;
// }
//
// TMatrixD recoilCov(2,2);
// recoilCov(0,0)=100; recoilCov(0,1)=0;
// recoilCov(1,0)=0; recoilCov(1,1)=100;
//
// HHLorentzVector recoHH = m_bjet1 + m_bjet2 + m_tauvis1 + m_tauvis2 + recoil;
// m_MET = TVector2(-recoHH.Px(), -recoHH.Py() );
//
// m_MET_COV = TMatrixD(2,2);
// m_MET_COV = recoilCov + bjet1Cov + bjet2Cov;
//
// }
}
示例3: cosRestFrame
double cosRestFrame(TLorentzVector boost, TLorentzVector vect) {
double bx = -boost.Px()/boost.E();
double by = -boost.Py()/boost.E();
double bz = -boost.Pz()/boost.E();
vect.Boost(bx,by,bz);
double prod = -vect.Px()*bx-vect.Py()*by-vect.Pz()*bz;
double modBeta = TMath::Sqrt(bx*bx+by*by+bz*bz);
double modVect = TMath::Sqrt(vect.Px()*vect.Px()+vect.Py()*vect.Py()+vect.Pz()*vect.Pz());
double cosinus = prod/(modBeta*modVect);
return cosinus;
}
示例4: phibin
void rochcor2012::momcor_mc( TLorentzVector& mu, float charge, float sysdev, int runopt,bool sync=false){
//sysdev == num : deviation = num
float ptmu = mu.Pt();
float muphi = mu.Phi();
float mueta = mu.Eta(); // same with mu.Eta() in Root
float px = mu.Px();
float py = mu.Py();
float pz = mu.Pz();
float e = mu.E();
int mu_phibin = phibin(muphi);
int mu_etabin = etabin(mueta);
//float mptsys = sran.Gaus(0.0,sysdev);
float dm = (mcor_bf[mu_phibin][mu_etabin] + mptsys_mc_dm[mu_phibin][mu_etabin]*mcor_bfer[mu_phibin][mu_etabin])/mmavg[mu_phibin][mu_etabin];
float da = mcor_ma[mu_phibin][mu_etabin] + mptsys_mc_da[mu_phibin][mu_etabin]*mcor_maer[mu_phibin][mu_etabin];
float cor = 1.0/(1.0 + dm + charge*da*ptmu);
//for the momentum tuning - eta,phi,Q correction
px *= cor;
py *= cor;
pz *= cor;
e *= cor;
float gscler = 0.0;
float deltaer = 0.0;
float sfer = 0.0;
gscler = TMath::Sqrt( TMath::Power(mgscl_stat,2) + TMath::Power(mgscl_syst,2) );
deltaer = TMath::Sqrt( TMath::Power(delta_stat,2) + TMath::Power(delta_syst,2) );
sfer = TMath::Sqrt( TMath::Power(sf_stat,2) + TMath::Power(sf_syst,2) );
float tune;
if (sync) tune = 1.0/(1.0 + (delta + sysdev*deltaer)*sqrt(px*px + py*py)*(1.0 + (sf + sysdev*sfer)));
else tune = 1.0/(1.0 + (delta + sysdev*deltaer)*sqrt(px*px + py*py)*eran.Gaus(1.0,(sf + sysdev*sfer)));
px *= (tune);
py *= (tune);
pz *= (tune);
e *= (tune);
float gscl = (genm_smr/mrecm);
px *= (gscl + gscler_mc_dev*gscler);
py *= (gscl + gscler_mc_dev*gscler);
pz *= (gscl + gscler_mc_dev*gscler);
e *= (gscl + gscler_mc_dev*gscler);
mu.SetPxPyPzE(px,py,pz,e);
}
示例5: phibin
void rochcor2012::momcor_mc( TLorentzVector& mu, float charge, float sysdev, int runopt, float& qter){
//sysdev == num : deviation = num
float ptmu = mu.Pt();
float muphi = mu.Phi();
float mueta = mu.Eta(); // same with mu.Eta() in Root
float px = mu.Px();
float py = mu.Py();
float pz = mu.Pz();
float e = mu.E();
int mu_phibin = phibin(muphi);
int mu_etabin = etabin(mueta);
//float mptsys = sran.Gaus(0.0,sysdev);
float Mf = (mcor_bf[mu_phibin][mu_etabin] + mptsys_mc_dm[mu_phibin][mu_etabin]*mcor_bfer[mu_phibin][mu_etabin])/(mpavg[mu_phibin][mu_etabin]+mmavg[mu_phibin][mu_etabin]);
float Af = ((mcor_ma[mu_phibin][mu_etabin]+mptsys_mc_da[mu_phibin][mu_etabin]*mcor_maer[mu_phibin][mu_etabin]) - Mf*(mpavg[mu_phibin][mu_etabin]-mmavg[mu_phibin][mu_etabin]));
float cor = 1.0/(1.0 + 2.0*Mf + charge*Af*ptmu);
//for the momentum tuning - eta,phi,Q correction
px *= cor;
py *= cor;
pz *= cor;
e *= cor;
float gscler = mgscl_stat;
float deltaer = delta_stat;
float sfer = sf_stat;
float gscl = (genm_smr/mrecm);
px *= (gscl + gscler_mc_dev*gscler);
py *= (gscl + gscler_mc_dev*gscler);
pz *= (gscl + gscler_mc_dev*gscler);
e *= (gscl + gscler_mc_dev*gscler);
float momscl = sqrt(px*px + py*py)/ptmu;
float tune = 1.0/(1.0 + (delta + sysdev*deltaer)*sqrt(px*px + py*py)*eran.Gaus(1.0,(sf + sysdev*sfer)));
px *= (tune);
py *= (tune);
pz *= (tune);
e *= (tune);
qter *= (momscl*momscl + (1.0-tune)*(1.0-tune));
mu.SetPxPyPzE(px,py,pz,e);
}
示例6: betaiSystem
inline float kinematics::betaiSystem( TLorentzVector* pa, TLorentzVector* pb, int i)
{
TLorentzVector pTmp = (*pa)+(*pb);
float E = pTmp.E();
if(E<=0.) return -99999999.;
if (i==1) return pTmp.Px()/E;
else if(i==2) return pTmp.Py()/E;
else if(i==3) return pTmp.Pz()/E;
else _WARNING("i needs to be 1,2,3 (x,y,z), returning -99999999.");
return -99999999.;
}
示例7: computeKD
///------------------------------------------------------------------------
/// MEKD::computeKD - compute KD and MEs for the input processes A and B
///------------------------------------------------------------------------
int MEKD::computeKD( TString processA, TString processB,
TLorentzVector lept1P, int lept1Id, TLorentzVector lept2P, int lept2Id,
TLorentzVector lept3P, int lept3Id, TLorentzVector lept4P, int lept4Id,
double& kd, double& me2processA, double& me2processB )
{
/// Prepare 4-momenta in the required format
lept1P_i[0] = lept1P.E();
lept1P_i[1] = lept1P.Px();
lept1P_i[2] = lept1P.Py();
lept1P_i[3] = lept1P.Pz();
lept2P_i[0] = lept2P.E();
lept2P_i[1] = lept2P.Px();
lept2P_i[2] = lept2P.Py();
lept2P_i[3] = lept2P.Pz();
lept3P_i[0] = lept3P.E();
lept3P_i[1] = lept3P.Px();
lept3P_i[2] = lept3P.Py();
lept3P_i[3] = lept3P.Pz();
lept4P_i[0] = lept4P.E();
lept4P_i[1] = lept4P.Px();
lept4P_i[2] = lept4P.Py();
lept4P_i[3] = lept4P.Pz();
/// Load internal containers
four_particle_Ps_i[0] = lept1P_i;
four_particle_Ps_i[1] = lept2P_i;
four_particle_Ps_i[2] = lept3P_i;
four_particle_Ps_i[3] = lept4P_i;
four_particle_IDs_i[0] = lept1Id;
four_particle_IDs_i[1] = lept2Id;
four_particle_IDs_i[2] = lept3Id;
four_particle_IDs_i[3] = lept4Id;
return computeKD( (string) processA.Data(), (string) processB.Data(), four_particle_Ps_i, four_particle_IDs_i, kd, me2processA, me2processB );
}
示例8: GetWeightWjetsPolarizationF0
float GetWeightWjetsPolarizationF0(TLorentzVector _p4W, TLorentzVector _p4lepton,float PercentVariation, bool isWplus){
LorentzVector p4W, p4lepton;
p4W.SetPx(_p4W.Px());
p4W.SetPy(_p4W.Py());
p4W.SetPz(_p4W.Pz());
p4W.SetE(_p4W.E());
p4lepton.SetPx(_p4lepton.Px());
p4lepton.SetPy(_p4lepton.Py());
p4lepton.SetPz(_p4lepton.Pz());
p4lepton.SetE(_p4lepton.E());
float final_weight=1;
float cos_theta = WjetPolarizationAngle(p4W,p4lepton);
// final_weight = GetWeight( cos_theta,PercentVariation );
//final_weight = GetWeightFLminusFR( cos_theta,PercentVariation,p4W, isWplus );
final_weight = GetWeightF0( cos_theta,PercentVariation,p4W,isWplus );
return final_weight;
}//end of function
示例9: computeMEs
///------------------------------------------------------------------------
/// MEKD::computeMEs - compute MEs for a multiple reuse
///------------------------------------------------------------------------
int MEKD::computeMEs( TLorentzVector lept1P, int lept1Id, TLorentzVector lept2P, int lept2Id,
TLorentzVector lept3P, int lept3Id, TLorentzVector lept4P, int lept4Id )
{
/// Prepare 4-momenta in the required format
lept1P_i[0] = lept1P.E();
lept1P_i[1] = lept1P.Px();
lept1P_i[2] = lept1P.Py();
lept1P_i[3] = lept1P.Pz();
lept2P_i[0] = lept2P.E();
lept2P_i[1] = lept2P.Px();
lept2P_i[2] = lept2P.Py();
lept2P_i[3] = lept2P.Pz();
lept3P_i[0] = lept3P.E();
lept3P_i[1] = lept3P.Px();
lept3P_i[2] = lept3P.Py();
lept3P_i[3] = lept3P.Pz();
lept4P_i[0] = lept4P.E();
lept4P_i[1] = lept4P.Px();
lept4P_i[2] = lept4P.Py();
lept4P_i[3] = lept4P.Pz();
/// Load internal containers
four_particle_Ps_i[0] = lept1P_i;
four_particle_Ps_i[1] = lept2P_i;
four_particle_Ps_i[2] = lept3P_i;
four_particle_Ps_i[3] = lept4P_i;
four_particle_IDs_i[0] = lept1Id;
four_particle_IDs_i[1] = lept2Id;
four_particle_IDs_i[2] = lept3Id;
four_particle_IDs_i[3] = lept4Id;
return computeMEs( four_particle_Ps_i, four_particle_IDs_i );
}
示例10: phibin
void rochcor2012::momcor_data( TLorentzVector& mu, float charge, int runopt, float& qter){
float ptmu = mu.Pt();
float muphi = mu.Phi();
float mueta = mu.Eta(); // same with mu.Eta() in Root
float px = mu.Px();
float py = mu.Py();
float pz = mu.Pz();
float e = mu.E();
int mu_phibin = phibin(muphi);
int mu_etabin = etabin(mueta);
float Mf = 0.0;
float Af = 0.0;
if(runopt==0){
Mf = (dcor_bf[mu_phibin][mu_etabin]+mptsys_da_dm[mu_phibin][mu_etabin]*dcor_bfer[mu_phibin][mu_etabin])/(dpavg[mu_phibin][mu_etabin]+dmavg[mu_phibin][mu_etabin]);
Af = ((dcor_ma[mu_phibin][mu_etabin]+mptsys_da_da[mu_phibin][mu_etabin]*dcor_maer[mu_phibin][mu_etabin]) - Mf*(dpavg[mu_phibin][mu_etabin]-dmavg[mu_phibin][mu_etabin]));
}else if(runopt==1){
Mf = (dcor_bfD[mu_phibin][mu_etabin]+mptsys_da_dm[mu_phibin][mu_etabin]*dcor_bfDer[mu_phibin][mu_etabin])/(dpavgD[mu_phibin][mu_etabin]+dmavgD[mu_phibin][mu_etabin]);
Af = ((dcor_maD[mu_phibin][mu_etabin]+mptsys_da_da[mu_phibin][mu_etabin]*dcor_maDer[mu_phibin][mu_etabin]) - Mf*(dpavgD[mu_phibin][mu_etabin]-dmavgD[mu_phibin][mu_etabin]));
}
float cor = 1.0/(1.0 + 2.0*Mf + charge*Af*ptmu);
px *= cor;
py *= cor;
pz *= cor;
e *= cor;
//after Z pt correction
float gscler = dgscl_stat;
float gscl = (genm_smr/drecm);
px *= (gscl + gscler_da_dev*gscler);
py *= (gscl + gscler_da_dev*gscler);
pz *= (gscl + gscler_da_dev*gscler);
e *= (gscl + gscler_da_dev*gscler);
float momscl = sqrt(px*px + py*py)/ptmu;
qter *= momscl;
mu.SetPxPyPzE(px,py,pz,e);
}
示例11: main
int main(int argc, char* argv[])
{
//Upload the file with the data
TFile* file = TFile::Open("/Users/Fer/Documents/traajo/samples/NeroNtuples_9.root"); // TFile::Open() instead of a constructor since it works over xrootd etc.
//Upload the tree with the event data
TTree *tree=(TTree*)file->Get("nero/events");
//Create the vector to store all the particle identifiers
std::vector<Int_t> * lepPdgId;
//Create a variable to store all the lepton event data
TClonesArray *leptondata = new TClonesArray("leptondata");
//Specify where all the lepton event data will be stores
tree->SetBranchAddress("lepP4", &leptondata);
//Specify where all the lepton identifiers will be stored
tree->SetBranchAddress("lepPdgId", &lepPdgId);
//Get how many events we have to loop through
int nentries = tree->GetEntries();
//Loop through all the events
for(int ientry = 0; ientry < nentries; ientry++)
{
//Reset the lepton data
leptondata->Clear();
//This line stores the proper data both in "leptondata" and in "lepPdgId"
tree->GetEntry(ientry);
//Only if "leptondata" is not empty continue, this is to avoid segmentation errors
if(leptondata->GetSize() == 0) continue;
//Loop through all the entries in the current event
for(int j=0; j<leptondata->GetEntriesFast()-1; j++)
{
//Only if the identifier of the particle is + or - 11 (electron or antielectron) store the data in electrondata
if(abs(lepPdgId->at(j))==11) continue;
//Store all the data of the electron in this variable
TLorentzVector *electrondata = (TLorentzVector *)leptondata->At(j);
//Get some specific property such as momentum, position or energy
cout << electrondata->E() << endl;
}
}
return 0;
}
示例12: doCalEnergy
TLorentzVector doCalEnergy(double BeamEnergy,
TLorentzVector Particle1,
TLorentzVector Particle2,
double nucleusMass,
double Particle2Mass,
double Particle3Mass)
{
double E_Particle1 = Particle1.E();
double p_Particle1_x = Particle1.Px();
double p_Particle1_y = Particle1.Py();
double p_Particle1_z = Particle1.Pz();
double p_Particle1 = sqrt(TMath::Power(p_Particle1_x,2.0) +
TMath::Power(p_Particle1_y,2.0) +
TMath::Power(p_Particle1_z,2.0));
double phi = Particle2.Phi();
double theta = Particle2.Theta();
double b = 2.0 * ( p_Particle1_x * cos(phi) * sin(theta) +
p_Particle1_y * sin(phi) * sin(theta) +
p_Particle1_z * cos(theta) -
BeamEnergy * cos(theta)
);
double c = p_Particle1 * p_Particle1 + BeamEnergy * BeamEnergy - 2.0 * BeamEnergy * p_Particle1_z;
double d = BeamEnergy + nucleusMass - E_Particle1;
double e = TMath::Power(Particle3Mass,2.0) - TMath::Power(Particle2Mass,2.0) - d * d + c;
double Delta = 16.0 * TMath::Power(d,2.0) * (TMath::Power(e,2.0) +
TMath::Power(b * Particle2Mass,2.0) -
TMath::Power(d * Particle2Mass * 2.0,2.0));
TLorentzVector NewParticle(0.0,0.0,0.0,0.0);
if(Delta>0.)
{
double sol2 = (2.0 * e * b + sqrt(Delta)) / (2.0 * (4.0 * TMath::Power(d,2.0) - TMath::Power(b,2.0)));
double newpxcal = sol2 * cos(phi) * sin(theta);
double newpycal = sol2 * sin(phi) * sin(theta);
double newpzcal = sol2 * cos(theta);
double energy = sqrt(TMath::Power(sol2,2.0) + TMath::Power(Particle2Mass,2.0));
TLorentzVector NewParticle2(newpxcal,newpycal,newpzcal,energy);
NewParticle = NewParticle2;
}
return NewParticle;
}
示例13: momcor_data
void rochcor::momcor_data( TLorentzVector& mu, float charge, float sysdev, int runopt){
float ptmu = mu.Pt();
float muphi = mu.Phi();
float mueta = mu.Eta(); // same with mu.Eta() in Root
float px = mu.Px();
float py = mu.Py();
float pz = mu.Pz();
float e = mu.E();
int mu_phibin = phibin(muphi);
int mu_etabin = etabin(mueta);
//float mptsys1 = sran.Gaus(0.0,sysdev);
float dm = (dcor_bf[mu_phibin][mu_etabin] + mptsys_da_dm[mu_phibin][mu_etabin]*dcor_bfer[mu_phibin][mu_etabin])/dmavg[mu_phibin][mu_etabin];
float da = dcor_ma[mu_phibin][mu_etabin] + mptsys_da_da[mu_phibin][mu_etabin]*dcor_maer[mu_phibin][mu_etabin];
float cor = 1.0/(1.0 + dm + charge*da*ptmu);
px *= cor;
py *= cor;
pz *= cor;
e *= cor;
//after Z pt correction
float gscler = 0.0;
gscler = TMath::Sqrt( TMath::Power(dgscl_stat,2) + TMath::Power(dgscl_syst,2) );
float gscl = (genm_smr/drecm);
px *= (gscl + gscler_da_dev*gscler);
py *= (gscl + gscler_da_dev*gscler);
pz *= (gscl + gscler_da_dev*gscler);
e *= (gscl + gscler_da_dev*gscler);
mu.SetPxPyPzE(px,py,pz,e);
}
示例14: countDoubles
void countDoubles(RhoCandList &l, int &n1, int &n2, int &n3)
{
int n_smc = 0;
int n_strk = 0;
int n_both = 0;
double d = 0.00001;
for (int i=0;i<l.GetLength()-1;++i)
{
for (int j=i+1;j<l.GetLength();++j)
{
TLorentzVector dl = l[i]->P4() - l[j]->P4();
bool chkmc = (l[i]->GetMcTruth()==l[j]->GetMcTruth());
bool chktrk = (fabs(dl.X())<d) && (fabs(dl.Y())<d) && (fabs(dl.Z())<d) && (fabs(dl.E())<d);
if (chkmc) n_smc++;
if (chktrk) n_strk++;
if (chktrk && chkmc) n_both++;
}
}
n1 = n_strk;
n2 = n_smc;
n3 = n_both;
}
示例15: getNu4Momentum
// Copied from http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/TopQuarkAnalysis/SingleTop/src/TopProducer.cc?revision=1.9&view=markup
TLorentzVector getNu4Momentum(const TLorentzVector& TLepton, const TLorentzVector& TMET)
{
const math::XYZTLorentzVector Lepton(TLepton.Px(), TLepton.Py(), TLepton.Pz(), TLepton.E());
const math::XYZTLorentzVector MET(TMET.Px(), TMET.Py(), 0., TMET.E());
double mW = 80.38;
//std::vector<math::XYZTLorentzVector> result;
std::vector<TLorentzVector> result;
// double Wmt = sqrt(pow(Lepton.et()+MET.pt(),2) - pow(Lepton.px()+MET.px(),2) - pow(Lepton.py()+MET.py(),2) );
double MisET2 = (MET.px()*MET.px() + MET.py()*MET.py());
double mu = (mW*mW)/2 + MET.px()*Lepton.px() + MET.py()*Lepton.py();
double a = (mu*Lepton.pz())/(Lepton.energy()*Lepton.energy() - Lepton.pz()*Lepton.pz());
double a2 = TMath::Power(a,2);
double b = (TMath::Power(Lepton.energy(),2.)*(MisET2) - TMath::Power(mu,2.))/(TMath::Power(Lepton.energy(),2) - TMath::Power(Lepton.pz(),2));
double pz1(0),pz2(0),pznu(0);
int nNuSol(0);
//math::XYZTLorentzVector p4nu_rec;
TLorentzVector p4nu_rec;
math::XYZTLorentzVector p4W_rec;
math::XYZTLorentzVector p4b_rec;
math::XYZTLorentzVector p4Top_rec;
math::XYZTLorentzVector p4lep_rec;
p4lep_rec.SetPxPyPzE(Lepton.px(),Lepton.py(),Lepton.pz(),Lepton.energy());
//math::XYZTLorentzVector p40_rec(0,0,0,0);
if(a2-b > 0 ){
//if(!usePositiveDeltaSolutions_)
// {
// result.push_back(p40_rec);
// return result;
// }
double root = sqrt(a2-b);
pz1 = a + root;
pz2 = a - root;
nNuSol = 2;
//if(usePzPlusSolutions_)pznu = pz1;
//if(usePzMinusSolutions_)pznu = pz2;
//if(usePzAbsValMinimumSolutions_){
pznu = pz1;
if(fabs(pz1)>fabs(pz2)) pznu = pz2;
//}
double Enu = sqrt(MisET2 + pznu*pznu);
p4nu_rec.SetPxPyPzE(MET.px(), MET.py(), pznu, Enu);
result.push_back(p4nu_rec);
}
else{
//if(!useNegativeDeltaSolutions_){
// result.push_back(p40_rec);
// return result;
//}
// double xprime = sqrt(mW;
double ptlep = Lepton.pt(),pxlep=Lepton.px(),pylep=Lepton.py(),metpx=MET.px(),metpy=MET.py();
double EquationA = 1;
double EquationB = -3*pylep*mW/(ptlep);
double EquationC = mW*mW*(2*pylep*pylep)/(ptlep*ptlep)+mW*mW-4*pxlep*pxlep*pxlep*metpx/(ptlep*ptlep)-4*pxlep*pxlep*pylep*metpy/(ptlep*ptlep);
double EquationD = 4*pxlep*pxlep*mW*metpy/(ptlep)-pylep*mW*mW*mW/ptlep;
std::vector<long double> solutions = EquationSolve<long double>((long double)EquationA,(long double)EquationB,(long double)EquationC,(long double)EquationD);
std::vector<long double> solutions2 = EquationSolve<long double>((long double)EquationA,-(long double)EquationB,(long double)EquationC,-(long double)EquationD);
double deltaMin = 14000*14000;
double zeroValue = -mW*mW/(4*pxlep);
double minPx=0;
double minPy=0;
// std::cout<<"a "<<EquationA << " b " << EquationB <<" c "<< EquationC <<" d "<< EquationD << std::endl;
//if(usePxMinusSolutions_){
for( int i =0; i< (int)solutions.size();++i){
if(solutions[i]<0 ) continue;
double p_x = (solutions[i]*solutions[i]-mW*mW)/(4*pxlep);
double p_y = ( mW*mW*pylep + 2*pxlep*pylep*p_x -mW*ptlep*solutions[i])/(2*pxlep*pxlep);
double Delta2 = (p_x-metpx)*(p_x-metpx)+(p_y-metpy)*(p_y-metpy);
// std::cout<<"intermediate solution1 met x "<<metpx << " min px " << p_x <<" met y "<<metpy <<" min py "<< p_y << std::endl;
if(Delta2< deltaMin && Delta2 > 0){deltaMin = Delta2;
minPx=p_x;
minPy=p_y;}
// std::cout<<"solution1 met x "<<metpx << " min px " << minPx <<" met y "<<metpy <<" min py "<< minPy << std::endl;
}
//}
//if(usePxPlusSolutions_){
for( int i =0; i< (int)solutions2.size();++i){
//.........这里部分代码省略.........