当前位置: 首页>>代码示例>>C++>>正文


C++ TLorentzVector类代码示例

本文整理汇总了C++中TLorentzVector的典型用法代码示例。如果您正苦于以下问题:C++ TLorentzVector类的具体用法?C++ TLorentzVector怎么用?C++ TLorentzVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TLorentzVector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Tran_to_cm

void Tran_to_cm(TLorentzVector e_vec, TLorentzVector d_vec, 
                TLorentzVector &e_cm, TLorentzVector &d_cm){
     //input: 
     //   e_vec - electron 4 vector in some frame
     //   d_vec - ion 4 vector in some frame
     //output:
     //   e_ft - electron 4 vector in center of mass frame
     //   d_ft - ion 4 vector in center of mass frame
     e_cm = e_vec;
     d_cm = d_vec;

     TLorentzVector cm_vec = e_vec + d_vec;

     e_cm.Boost(-cm_vec.BoostVector());
     d_cm.Boost(-cm_vec.BoostVector());
     return;

}
开发者ID:JeffersonLab,项目名称:LightIonEIC,代码行数:18,代码来源:lorentz_transform.cpp

示例2: CalcDeltaPhiNEW

// This is the pt corrected delta phi between the 2 mega-jets
// P and Q are the 4-vectors for the 2 hemispheres 
// M is the MET 3 vector (don't forget to set the z-component of
// MET to 0)
// This function will do the correct Lorentz transformations of the 
// leptons for you
double HWWKinematics::CalcDeltaPhiNEW(TLorentzVector P, TLorentzVector Q, TVector3 M){
    // first calculate pt-corrected MR
 float mymrnew = CalcMRNEW(L1,L2,MET);

    //Next, calculate the transverse Lorentz transformation
 TVector3 B = P.Vect()+Q.Vect()+MET;
 B.SetZ(0.0);
 B = (-1./(sqrt(4.*mymrnew*mymrnew+B.Dot(B))))*B;

 P.Boost(B);
 Q.Boost(B);

    //Now, re-calculate the delta phi
    // in the new reference frame:

 return P.DeltaPhi(Q);

}
开发者ID:alessandrothea,项目名称:gardener,代码行数:24,代码来源:unBoostedVar.C

示例3: momcor_mc

void rochcor::momcor_mc( TLorentzVector& mu, float charge, float sysdev, int runopt){
  
  //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 = 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);
  
}
开发者ID:KyeongPil-Lee,项目名称:DYAnalysis,代码行数:54,代码来源:rochcor.C

示例4: 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);
  
}
开发者ID:digiovan,项目名称:hmumuAnalysis,代码行数:54,代码来源:rochcor2012.C

示例5: CalcUnboostedMTR

double HWWKinematics::CalcUnboostedMTR(TLorentzVector P, TLorentzVector Q, TVector3 M){
    // first calculate pt-corrected MR
 float mymrnew = CalcMRNEW(L1,L2,MET);

    //Next, calculate the transverse Lorentz transformation
 TVector3 B = P.Vect()+Q.Vect()+MET;
 B.SetZ(0.0);
 B = (-1./(sqrt(4.*mymrnew*mymrnew+B.Dot(B))))*B;

 P.Boost(B);
 Q.Boost(B);

    //Now, re-calculate MTR in the new reference frame:
 float mymtrnew = CalcMTRNEW(P, Q);

    //R is now just the ratio of mymrnew and mymtrnew;

 return mymtrnew;
}
开发者ID:alessandrothea,项目名称:gardener,代码行数:19,代码来源:unBoostedVar.C

示例6: smearMom

TLorentzVector smearMom(TLorentzVector const& b,TF1 const * const fMomResolution)
{
  float const pt = b.Perp();
  float const sPt = gRandom->Gaus(pt,pt*fMomResolution->Eval(pt));

  TLorentzVector sMom;
  sMom.SetXYZM(sPt*cos(b.Phi()),sPt*sin(b.Phi()),sPt*sinh(b.PseudoRapidity()),b.M());
  return sMom;
}
开发者ID:GuannanXie,项目名称:auau200GeVRun14,代码行数:9,代码来源:pythia_decay.C

示例7: Delta

double Delta(double pt1, double eta1, double phi1,double pt2, double eta2, double phi2,double t1pfmetPhi){
  TLorentzVector fLorentzVec1; 
  TLorentzVector fLorentzVec2; 
  TLorentzVector fLorentzVecgg;
  
  // Fill TLorentzVector
  fLorentzVec1.SetPtEtaPhiM(pt1,eta1,phi1,0.);
  fLorentzVec2.SetPtEtaPhiM(pt2,eta2,phi2,0.);
  fLorentzVecgg = fLorentzVec1 + fLorentzVec2;
  double phigg= fLorentzVecgg.Phi();
  double delta = phigg-t1pfmetPhi;
  if(delta>3.14){
    delta-=6.28;
  }
  if(delta<-3.14){
    delta+=6.28;
  }
  delta =fabs(delta);
  return delta;
}
开发者ID:camendola,项目名称:macro,代码行数:20,代码来源:t1pfmetPhiwithCorr.C

示例8: smearEmEnergy

void smearEmEnergy( TLorentzVector& p ) {

    float smearEBlowEta     = 0.013898;
    float smearEBhighEta    = 0.0189895;
    float smearEElowEta     = 0.027686;
    float smearEEhighEta    = 0.031312;
    float theGaussMean      = 1.;
    float pt = p.Pt();
    float eta = p.Eta();
    float phi = p.Phi();
    float mass = p.M();
    float theSmear = 0.;
    if      (fabs(eta)<1.                   )  theSmear = smearEBlowEta;
    else if (fabs(eta)>=1.  && fabs(eta)<1.5)  theSmear = smearEBhighEta;
    else if (fabs(eta)>=1.5 && fabs(eta)<2. )  theSmear = smearEElowEta;
    else if (fabs(eta)>=2.  && fabs(eta)<2.5)  theSmear = smearEEhighEta;
    float fromGauss = myRandom_.Gaus(theGaussMean,theSmear);
    p.SetPtEtaPhiM( fromGauss*pt, eta, phi, mass ); // keep mass and direction same

}
开发者ID:pandolf,项目名称:ZGAnalysis,代码行数:20,代码来源:computeGenEfficiency.cpp

示例9: minDrPhoB

double Histogrammer::minDrPhoB(int PhoInd, EventTree* tree){
	// find the closest b-jet
	TLorentzVector b;
	TLorentzVector bBar;
	int phoGen=-1;
	double mindr = 999.0;
	for( int mcI = 0; mcI < tree->nMC_; ++mcI){
		if( tree->mcIndex->at(mcI) == tree->phoGenIndex_->at(PhoInd) ) 
			phoGen=mcI;
		if( tree->mcPID->at(mcI) == 5) 
			b.SetPtEtaPhiM(tree->mcPt->at(mcI), tree->mcEta->at(mcI), tree->mcPhi->at(mcI), tree->mcMass->at(mcI));
		if( tree->mcPID->at(mcI) == -5) 
			bBar.SetPtEtaPhiM(tree->mcPt->at(mcI), tree->mcEta->at(mcI), tree->mcPhi->at(mcI), tree->mcMass->at(mcI));
	}
	if( phoGen > 0 && b.Pt() > 0.0001 && bBar.Pt() > 0.0001 ) {
		mindr = std::min(dR(tree->mcEta->at(phoGen), tree->mcPhi->at(phoGen), b.Eta(), b.Phi()),
						 dR(tree->mcEta->at(phoGen), tree->mcPhi->at(phoGen), bBar.Eta(), bBar.Phi()));
	}
	return mindr;
}
开发者ID:titasroy89,项目名称:Muons,代码行数:20,代码来源:Histogrammer.cpp

示例10: AnalyseParticles

void Output_Delphes::AnalyseParticles(ExRootTreeBranch *branch, const HepMC::GenEvent& evt)
{
  TRootC::GenParticle *element;
  TLorentzVector momentum;
  Double_t signPz;
  ReadStats();
  for(int n=1; n<=evt.particles_size(); n++) {
    int mo1, mo2, da1, da2, status, pid;
    getStatsFromTuple(mo1,mo2,da1,da2,status,pid,n);
    element = static_cast<TRootC::GenParticle*>(branch->NewEntry());
    element->PID = pid;
    element->Status = status;
    element->M1 = mo1 - 1; // added -1 as the numbering in the tree starts from 0
    element->M2 = mo2 - 1;
    element->D1 = da1 - 1;
    element->D2 = da2 - 1;
    element->E = index_to_particle[n]->momentum().e();
    element->Px = index_to_particle[n]->momentum().px();
    element->Py = index_to_particle[n]->momentum().py();
    element->Pz = index_to_particle[n]->momentum().pz();
    element->PT = sqrt(pow(element->Px,2)+pow(element->Py,2));
    momentum.SetPxPyPzE(element->Px, element->Py, element->Pz, element->E);
    signPz = (element->Pz >= 0.0) ? 1.0 : -1.0;
    element->Eta = element->PT < 1e-6 ? signPz*999.9 : momentum.Eta();
    element->Phi = index_to_particle[n]->momentum().phi();
    HepMC::GenVertex* vrtI = (index_to_particle[n])->production_vertex();
    HepMC::GenVertex::particles_in_const_iterator partI;
    if(vrtI) {
      element->T = vrtI->position().t();
      element->X = vrtI->position().x();
      element->Y = vrtI->position().y();
      element->Z = vrtI->position().z();
    }
    else {
      element->T = 0.;
      element->X = 0.;
      element->Y = 0.;
      element->Z = 0.;
    }  
  }
}
开发者ID:alisw,项目名称:SHERPA,代码行数:41,代码来源:Output_Delphes.C

示例11: sqrt

//This is the function to determine the interaction point in case of a cylinder (case1), for BDXmini.
//The cylinder is with the axis along y(vertical), center at x=0,y=0,z=ldet, radius is R,height is h
double KinUtils::findInteractionPointCylinder1(const TLorentzVector &chi,double ldet,double h,double R,TVector3 &vin,TVector3 &vout,TVector3 &vhit){

	double tIN,tOUT,t2,t3,t,L;

	double px=chi.Px();
	double py=chi.Py();
	double pz=chi.Pz();

	double delta=pz*pz*ldet*ldet-(pz*pz+px*px)*(ldet*ldet-R*R);
	if (delta<0){
		cout<<"KinUtils::findInteractionPointCylinder1 error, the delta is: "<<delta<<endl;
		return 0;
	}

	//entry point
	tIN = (pz*ldet - sqrt(delta))/(px*px+pz*pz);
	t2 = (pz*ldet + sqrt(delta))/(px*px+pz*pz);

	t3 = (h/2)/py;


	if ((t3>0)&&(t3<t2)&&(t3>tIN)){
		tOUT=t3;
	}else{
		tOUT=t2;
	}

	t=Rand.Uniform(tIN,tOUT);

	vin.SetXYZ(tIN*px,tIN*py,tIN*pz);
	vout.SetXYZ(tOUT*px,tOUT*py,tOUT*pz);

	vhit.SetXYZ(t*px,t*py,t*pz);


	L = (vout - vin).Mag();



	return L;
}
开发者ID:JeffersonLab,项目名称:BDXEventGenerator,代码行数:43,代码来源:KinUtils.cpp

示例12: CalculateDeltaEtaAndPhi

std::vector<double> CalculateDeltaEtaAndPhi(bool possibleMultW, bool possibleMultAntiW, int w1, TLorentzVector TL_munu){

  //Don't take into account the events with multiple W's. Think of something

  double deltaphi, deltaeta;
  if(possibleMultW == false && possibleMultAntiW == false){
    deltaphi = TMath::Abs(TVector2::Phi_mpi_pi(TL_munu.Phi() - genPhi[w1]) );
     deltaeta = TMath::Abs(TL_munu.Eta() - genEta[w1] );
  } else {
    deltaphi = 99.;
    deltaeta = 99.;
  }

  std::vector<double> EtaAndPhi;

  EtaAndPhi.push_back(deltaeta);
  EtaAndPhi.push_back(deltaphi);

  return EtaAndPhi;

}
开发者ID:LuukVermunt,项目名称:PbPbTopAnalysis,代码行数:21,代码来源:checkOriginSelectedMuon.C

示例13: getKinematics

void getKinematics(TLorentzVector& b, double const mass)
{
   float const pt = gRandom->Uniform(momentumRange.first, momentumRange.second);
   float const y = gRandom->Uniform(-acceptanceRapidity, acceptanceRapidity);
   float const phi = TMath::TwoPi() * gRandom->Rndm();

   float const mT = sqrt(mass * mass + pt * pt);
   float const pz = mT * sinh(y);
   float const E = mT * cosh(y);

   b.SetPxPyPzE(pt * cos(phi), pt * sin(phi) , pz, E);
}
开发者ID:amcw7777,项目名称:auau200GeVRun14Ana,代码行数:12,代码来源:toyMcEffKS.C

示例14: muPtcorr

// // //
double analysisClass::RecoHLTdeltaRmin_SingleMu24Trigger( unsigned int iReco ){
  TLorentzVector HLTLep;
  TLorentzVector RecoLep;
  double deltaRmin=999999.9;
  RecoLep.SetPtEtaPhiM( muPtcorr(iReco),   MuonEta->at(iReco),   MuonPhi->at(iReco),   0);
  //
  for(unsigned int ifilter=0; ifilter<HLTFilterName->size(); ifilter++){  
    //
    // HLT_Mu24_eta2p1_v*
    if( HLTFilterName->at(ifilter) == "hltL3fL1sMu16Eta2p1L1f0L2f16QL3Filtered24Q" //V3,V4,V5
	){
      //
      // -----  extract TrigObject 4-vector  -----
      std::vector<std::vector<float> > * TrigObjectPt_TrigArray;  vector<float> trigObjPtArray;  float trigObjPt_;
      std::vector<std::vector<float> > * TrigObjectEta_TrigArray; vector<float> trigObjEtaArray; float trigObjEta_;
      std::vector<std::vector<float> > * TrigObjectPhi_TrigArray; vector<float> trigObjPhiArray; float trigObjPhi_;
      TrigObjectPt_TrigArray  = HLTFilterObjPt;    trigObjPtArray  = (*TrigObjectPt_TrigArray)[ifilter];
      TrigObjectEta_TrigArray = HLTFilterObjEta;   trigObjEtaArray = (*TrigObjectEta_TrigArray)[ifilter];
      TrigObjectPhi_TrigArray = HLTFilterObjPhi;   trigObjPhiArray = (*TrigObjectPhi_TrigArray)[ifilter];
      // ----- ----- ----- ----- ----- ----- -----
      for(unsigned int iobj=0; iobj<trigObjPtArray.size(); iobj++){//loop over all trigObjects of selected Filter
	trigObjPt_ = (trigObjPtArray)[iobj];  trigObjEta_= (trigObjEtaArray)[iobj];  trigObjPhi_= (trigObjPhiArray)[iobj];
	HLTLep.SetPtEtaPhiM( trigObjPt_, trigObjEta_, trigObjPhi_, 0 );
	if(RecoLep.DeltaR(HLTLep)<deltaRmin) deltaRmin = RecoLep.DeltaR(HLTLep);
      }
    }
  }
  //
  return deltaRmin;
}
开发者ID:dertexaner,项目名称:LQ3,代码行数:31,代码来源:ADDON2_LAC.C

示例15: HistResp

double PTCut::HistResp(TLorentzVector tmpP, double respHCAL, double respECAL,
                         double respEHHCAL, double respEHECAL)
{
    double respSum = 0;
    // In case of inconsistensies in binning, the bins are checked explicitely
    int binHadrf = 0;
    int binEcalf = 0;
    double trueFracECAL = 0;
    double fE = 0;
    // H: all energy in HCAL; this is multiplied with HCAL response
    binHadrf = pfh->FindBin(tmpP.Perp());
    respSum += (pfh->GetBinContent(binHadrf))*respHCAL; 
    
    // E: energy only in ECAL, fraction multiplied with ECAL response
    binHadrf = pfe->FindBin(tmpP.Perp());
    respSum += (pfe->GetBinContent(binHadrf))*respECAL; 
    
    // pf0: nothing is added for the lost hadrons, effectively:
    // respSum += (pf0->GetBinContent(binHadrf))*0;
    
    // eH: energy in both ECAL and HCAL, mostly HCAL. Does not work
    // intuitively (compared to EH). First, approximate H by HCAL
    // resp. times tot energy - 0.3 GeV. Move 0.3 GeV to ECAL and
    // use response for this.
    binHadrf = pfe0h->FindBin(tmpP.Perp());
    respSum += (pfe0h->GetBinContent(binHadrf))*( 0.3*(respECAL-1)
        + respHCAL );

    // EH: energy in both ECAL and HCAL
    binHadrf = pfe1h->FindBin(tmpP.Perp());
    binEcalf = pef1->FindBin(tmpP.Perp());

    fE = pef1->GetBinContent(binEcalf); 
    trueFracECAL = fE/((1-fE)*respEHECAL/respEHHCAL+1); 
    respSum += (pfe1h->GetBinContent(binHadrf))*(trueFracECAL*respEHECAL
        +(1-trueFracECAL)*respEHHCAL);

    return respSum;
}
开发者ID:errai-,项目名称:jetscripts,代码行数:39,代码来源:PTCut.cpp


注:本文中的TLorentzVector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。