本文整理汇总了C++中TVector2::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ TVector2::Set方法的具体用法?C++ TVector2::Set怎么用?C++ TVector2::Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TVector2
的用法示例。
在下文中一共展示了TVector2::Set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Discretize
TVector2 HashTable::Discretize(TVector2 position) {
position /= _NG_H_;
position.Set(
floor(position.X()),
floor(position.Y())
);
return position;
}
示例2:
void test::runtest3()
{
TLorentzVector v1,v2,vds;
double ecm = 14000.0;
double mxlo = 0.0;
TVector2 ptm;
TMctLib t;
// CGL/AB ExampleEvent.h: numerical = 412.629
v1.SetPxPyPzE(410.0,20.0,-20.0,422.9657197);
v2.SetPxPyPzE(-210.0,-300.0,44.0,398.1657946);
vds.SetPxPyPzE(0,0,0,0);
ptm.Set(-200.0,280.0);
mxlo = 100.0;
// // QCD J7
// double in[10] = {1.258670e+05,1.571520e+06,1.572370e+05,9.757710e+04
// ,-1.183100e+06,1.479710e+04,-5.753920e+04,-2.356870e+02,1.258670e+05,4.443730e+05};
// double in[10] = {6.256940e+04,1.288650e+05,1.180090e+06,7.800940e+04
// ,-1.329990e+05,-1.089660e+06,7.652250e+02,-8.213820e+04,8.228860e+04,4.454130e+05};
// double in[10] = {1.341360e+05,3.326890e+05,-1.283550e+06,9.644650e+04
// ,-6.514870e+04,1.149020e+06,1.437980e+03,9.277770e+04,1.341360e+05,5.101580e+05};
// double in[10] = {9.235300e+04,-3.740560e+05,-1.064090e+06,1.830350e+05
// ,3.642610e+05,1.065280e+06,-1.448250e+03,-3.466820e+04,1.830350e+05,3.324730e+05};
// double in[10] = {9.046870e+04,1.840110e+06,6.785220e+05,9.780580e+04
// ,-1.630920e+06,-6.143020e+05,-5.887950e+04,4.870900e+02,1.062900e+05,4.814570e+05};
// double in[10] = {1.182120e+05,1.367560e+06,5.090250e+05,6.409280e+04
// ,-1.290560e+06,-4.467530e+05,-2.323400e+04,-5.225580e+02,1.182120e+05,2.829080e+05};
// double in[10] = {7.755540e+04,-9.667320e+05,7.152930e+05,1.010010e+05
// ,8.471940e+05,-5.228630e+05,-8.270070e+02,3.081700e+04,1.043150e+05,2.405480e+05};
// double in[10] = {9.918510e+04,-6.460480e+04,-1.343380e+06,1.204820e+05
// ,9.848800e+04,1.335590e+06,3.381800e+02,-5.554830e+04,1.204820e+05,4.041840e+05};
// // QCD J4
// double in[10] = {1.990270e+04,8.762820e+03,1.808790e+05,1.786660e+04
// ,-1.777620e+04,-1.537630e+05,-1.771590e+02,-4.196540e+04,2.149110e+04,1.250350e+05};
// // SUSY SU3
// double in[10] = {5.393630e+04,2.803780e+05,-5.825570e+05,4.760900e+04
// ,-3.659650e+05,2.836080e+05,1.240290e+04,2.463720e+05,2.151650e+05,5.504520e+05};
//
// v1.SetPxPyPzE(in[1]*0.001,in[2]*0.001,0.0
// ,sqrt(pow(in[1],2)+pow(in[2],2)+pow(in[0],2))*0.001);
// v2.SetPxPyPzE(in[4]*0.001,in[5]*0.001,0.0
// ,sqrt(pow(in[4],2)+pow(in[5],2)+pow(in[3],2))*0.001);
// vds.SetPxPyPzE(0,0,0,0);
// ptm.Set(in[6]*0.001,in[7]*0.001);
// cout<<in[8]*0.001<<" "<<t.mt2(v1,v2,vds,ptm,ecm,mxlo)<<endl;
cout<<"MCT = "<<t.mct(v1,v2)
<<", MCTcorr = "<<t.mctcorr(v1,v2,vds,ptm,ecm,mxlo)
<<", MT2 = "<<t.mt2(v1,v2,vds,ptm,ecm,mxlo)
<<", MCy = "<<t.mcy(v1,v2,vds,ptm)
<<", MCx = "<<t.mcx(v1,v2,vds,ptm)
<<endl;
}
示例3: Process
void StdTopVarProcessor::Process(const InputCollections& input,VariableContainer& vars){
if(!initialized) cerr << "tree processor not initialized" << endl;
std::vector<pat::Jet> selectedTaggedJets;
std::vector<pat::Jet> selectedUntaggedJets;
for(std::vector<pat::Jet>::const_iterator itJet = input.selectedJets.begin(); itJet != input.selectedJets.end(); ++itJet){
if(BoostedUtils::PassesCSV(*itJet, 'M')) selectedTaggedJets.push_back(*itJet);
else selectedUntaggedJets.push_back(*itJet);
}
math::XYZTLorentzVector HadW;
math::XYZTLorentzVector HadW1;
math::XYZTLorentzVector HadW2;
for(std::vector<pat::Jet>::const_iterator it1Jet = selectedUntaggedJets.begin(); it1Jet != selectedUntaggedJets.end(); ++it1Jet){
for(std::vector<pat::Jet>::const_iterator it2Jet = selectedUntaggedJets.begin(); it2Jet != selectedUntaggedJets.end(); ++it2Jet){
if(abs(80.4-(it1Jet->p4()+it2Jet->p4()).M())<abs(80.4-(HadW1+HadW2).M())){
HadW1 = it1Jet->p4();
HadW2 = it2Jet->p4();
HadW = HadW1+HadW2;
}
}
}
vars.FillVar( "HadTop_W_Pt",HadW.Pt() );
vars.FillVar( "HadTop_W_E",HadW.E() );
vars.FillVar( "HadTop_W_Eta",HadW.Eta() );
vars.FillVar( "HadTop_W_Phi",HadW.Phi() );
vars.FillVar( "HadTop_W_M",HadW.M() );
vars.FillVar( "HadTop_W1_Pt",HadW1.Pt() );
vars.FillVar( "HadTop_W1_E",HadW1.E() );
vars.FillVar( "HadTop_W1_Eta",HadW1.Eta() );
vars.FillVar( "HadTop_W1_Phi",HadW1.Phi() );
vars.FillVar( "HadTop_W1_M",HadW1.M() );
vars.FillVar( "HadTop_W2_Pt",HadW2.Pt() );
vars.FillVar( "HadTop_W2_E",HadW2.E() );
vars.FillVar( "HadTop_W2_Eta",HadW2.Eta() );
vars.FillVar( "HadTop_W2_Phi",HadW2.Phi() );
vars.FillVar( "HadTop_W2_M",HadW2.M() );
math::XYZTLorentzVector HadB;
math::XYZTLorentzVector HadTop;
for(std::vector<pat::Jet>::const_iterator itJet = selectedTaggedJets.begin(); itJet != selectedTaggedJets.end(); ++itJet){
if(HadTop.M()==0 || abs(172.4-(HadW+itJet->p4()).M())<abs(172.4-HadTop.M())){
HadB = itJet->p4();
HadTop = HadB+HadW;
}
else{
cout << "HadTop_W_Pt: " << HadW.Pt() << ", HadTop_B_Pt: " << itJet->pt() << ", Top mass: " << (HadW+itJet->p4()).M() << endl;
}
}
vars.FillVar( "HadTop_B_Pt",HadB.Pt() );
vars.FillVar( "HadTop_B_E",HadB.E() );
vars.FillVar( "HadTop_B_Eta",HadB.Eta() );
vars.FillVar( "HadTop_B_Phi",HadB.Phi() );
vars.FillVar( "HadTop_B_M",HadB.M() );
// vars.FillVar( "HadTop_B_CSV",MiniAODHelper::GetJetCSV(HadB,btagger) );
// vars.FillVar( "HadTop_B_Flav",HadB.flavour() );
vars.FillVar( "HadTop_Pt",HadTop.Pt() );
vars.FillVar( "HadTop_E",HadTop.E() );
vars.FillVar( "HadTop_Eta",HadTop.Eta() );
vars.FillVar( "HadTop_Phi",HadTop.Phi() );
vars.FillVar( "HadTop_M",HadTop.M() );
math::XYZTLorentzVector nu1;
math::XYZTLorentzVector nu2;
TVector2 MET;
MET.Set(input.pfMET.px(),input.pfMET.py());
math::XYZTLorentzVector PrimLep = BoostedUtils::GetPrimLepVec(input.selectedElectrons, input.selectedMuons);
BoostedUtils::GetNuVecs(PrimLep, MET, nu1, nu2);
math::XYZTLorentzVector LepW;
if(abs(80.4-(nu1+PrimLep).M())<abs(80.4-(nu2+PrimLep).M())) LepW = nu1+PrimLep;
else LepW = nu2+PrimLep;
vars.FillVar( "LepTop_W_Pt",LepW.Pt() );
vars.FillVar( "LepTop_W_E",LepW.E() );
vars.FillVar( "LepTop_W_Eta",LepW.Eta() );
vars.FillVar( "LepTop_W_Phi",LepW.Phi() );
vars.FillVar( "LepTop_W_M",LepW.M() );
math::XYZTLorentzVector LepB;
math::XYZTLorentzVector LepTop;
for(std::vector<pat::Jet>::const_iterator itJet = selectedTaggedJets.begin(); itJet != selectedTaggedJets.end(); ++itJet){
if(LepTop.M()==0 || abs(172.4-(LepW+itJet->p4()).M())<abs(172.4-LepTop.M())){
LepB = itJet->p4();
LepTop = LepW+LepB;
}
}
vars.FillVar( "LepTop_B_Pt",LepB.Pt() );
vars.FillVar( "LepTop_B_E",LepB.E() );
vars.FillVar( "LepTop_B_Eta",LepB.Eta() );
//.........这里部分代码省略.........
示例4: smear_JetMET
void smear_JetMET(vector <TLorentzVector> & orig_jets, const TVector2 & orig_met, vector <TLorentzVector> & smear_jets, TVector2 & smear_met, TRandom3* rand3, vector <TF1*> vPtRes, vector <TF1*> vEtaRes, vector <TF1*> vPhiRes, TLorentzVector lep_sum){
smear_jets.clear();
double sum_jpx = 0;
double sum_jpy = 0;
double sum_jpx_sm = 0;
double sum_jpy_sm = 0;
double Pt_sm, Eta_sm, Phi_sm;
TLorentzVector v_temp;
// double a, b, c;
// double Et;
for (unsigned int sui = 0; sui < orig_jets.size(); sui++){
// a = 1.84; b = 1.14; c = 0.027;
// if (orig_jets.at(sui).Eta() < 1.4){
// a = 1.78; b = 1.3; c = 0.053;
// }
// Et = orig_jets.at(sui).Pt();
// Pt_sm = Et + sqrt(a*a + b*b*Et + c*c*Et*Et) * rand3->Gaus();
// Eta_sm = orig_jets.at(sui).Eta();
// Phi_sm = orig_jets.at(sui).Phi();
Long64_t iseed = (Long64_t) 10E10;
gRandom->SetSeed(rand3->Integer(iseed));
// Pt_sm = orig_jets.at(sui).Pt() * (1 + (vPtRes.at(sui)->GetRandom() - 1) * 1.1);
Pt_sm = orig_jets.at(sui).Pt() * vPtRes.at(sui)->GetRandom();
gRandom->SetSeed(rand3->Integer(iseed));
Eta_sm = orig_jets.at(sui).Eta() + vEtaRes.at(sui)->GetRandom();
gRandom->SetSeed(rand3->Integer(iseed));
Phi_sm = orig_jets.at(sui).Phi() + vPhiRes.at(sui)->GetRandom();
v_temp.SetPtEtaPhiM(Pt_sm, Eta_sm, Phi_sm, orig_jets.at(sui).M());
sum_jpx += orig_jets.at(sui).Px();
sum_jpy += orig_jets.at(sui).Py();
sum_jpx_sm += v_temp.Px();
sum_jpy_sm += v_temp.Py();
smear_jets.push_back(v_temp);
}
double unclust_metx = orig_met.Px() + sum_jpx + lep_sum.Px();
double unclust_mety = orig_met.Py() + sum_jpy + lep_sum.Py();
//10% resolution
double unclust_metx_sm = unclust_metx * (1 + 0.1*rand3->Gaus());
double unclust_mety_sm = unclust_mety * (1 + 0.1*rand3->Gaus());
smear_met.Set(orig_met.Px() + sum_jpx - unclust_metx - sum_jpx_sm + unclust_metx_sm, orig_met.Py() + sum_jpy - unclust_mety - sum_jpy_sm + unclust_mety_sm);
}