• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ XYZTVector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: EnergyFlow_DetLevel_DataZeroBias1AllBx_TreeProducer


//.........这里部分代码省略.........
	EnergyCutRecHitPlus=false;
	EnergyCutPFCluster=false;
	EnergyCutRecHitHFAnd=false;
	RunCut=false;
	LumiCut=false;
	bxCut=false;
			    
	if (filetype =="DATA" && run==247324) RunCut=true;
	if(filetype =="MC") RunCut =true;// for MC
		
	// ----------------------- fat bunch ------------------//
	if (filetype =="DATA" && bx==208) bxCut=true;
	if(filetype =="MC") bxCut =true;// for MC
		
	// ----------------------- lumi cut ------------------//
		
	if (filetype =="DATA")LumiCut=(lumi>=lumimin &&lumi<lumimax);
	else LumiCut=true;// for MC
		
	//if(LumiCut && RunCut ){
	if(RunCut && LumiCut ){
		    
	  // ----------------------- triger cut --------------//
	  if (filetype =="DATA")TrigerPass =  (trgZeroBias== 1);
	  else TrigerPass=true;
		    
	  if(TrigerPass){
	    //-- Event Selection for Det Level --//
                
	    //------------ HF_AND ------------//
	    //----------HF Minus-------//
	    for (unsigned long cal=0; cal<CaloTowersp4_->size(); cal++){
                    
	      XYZTVector caltwr = (*CaloTowersp4_)[cal];
                    
	      if((caltwr.Eta()>=etaminMinus && caltwr.Eta()<=etamaxMinus) && ((caltwr.E())*Norm) > emin) {
                        
		EnergyCutTowerMinus=true;
	      }
	    }
                
                
	    //----------HF Plus-------//
	    for (unsigned long cal=0; cal<CaloTowersp4_->size(); cal++){
                    
	      XYZTVector caltwr = (*CaloTowersp4_)[cal];
                    
	      if((caltwr.Eta()>=etamin && caltwr.Eta()<=etamax) && ((caltwr.E())*Norm) > emin) {
                        
		EnergyCutTowerPlus=true;
	      }
	    }
                
                
                
	    if ((EnergyCutTowerMinus && !EnergyCutTowerPlus) || (!EnergyCutTowerMinus && EnergyCutTowerPlus)){
	      // Gen Level Event selection for Detlevel
	      if (filetype =="MC"){
		for (unsigned long gd=0; gd<genParticlesp4_->size(); gd++){
		  XYZTVector genDet = (*genParticlesp4_)[gd];
				    
		  if((abs(genDet.Eta())<= cmseta)  ) {
		    selcetetabin=getBin(genDet.Eta(),EtaBins, nEtaBins);
		    GenEtaSumsDetEvntSelct[selcetetabin] = GenEtaSumsDetEvntSelct[selcetetabin] + genDet.E();
		  }
		}//Gen
开发者ID:higgs313,项目名称:EnergyFlow13TeV,代码行数:67,代码来源:EnergyFlow_DetLevel_DataZeroBias1AllBx_TreeProducer.C


示例2: EnergyFlow_TreeProducer


//.........这里部分代码省略.........
		PFClustersHFEtaSumsLo[i]=0.;
	  
		PFClustersEtaSumsRaw[i]=0.;
		PFClustersECALEtaSumsRaw[i]=0.;
		PFClustersHCALEtaSumsRaw[i]=0.;
		PFClustersHFEtaSumsRaw[i]=0.;
	 
		GenEtaSums[i]=0.;
		GenEtaSums_1GeV[i]=0.;
		GenEtaSums_2GeV[i]=0.;
		GenEtaSums_HadronElectronCut[i]=0.;
		GenEtaSums_EM[i]=0.;
		GenEtaSums_EM_withEnergyCuts[i]=0.;
		GenEtaSums_Had[i]=0.;
		GenEtaSums_Had_withEnergyCuts[i]=0.;
		GenEtaSumsDetEvntSelct[i]=0.;
	    }
      
	    // -----------------------  Gen  -----------------------//
	    //event selection for Gen Level
	    //
	    if (f>0){
		XiCutGen=false;
		EnergyCutGen1GeV=false;
		EnergyCutGen2GeV=false;

		// Aply XiSD
		if(XiSD>minXiSD)XiCutGen=true;
		//(abs(gen_.Eta())<=etamin && abs(gen_.Eta())>=etamax)
	  
		if(XiCutGen){
	      
		    for (unsigned long g=0; g<genParticlesp4_->size(); g++){
			XYZTVector gen = (*genParticlesp4_)[g];
			ElectronPhotonCut=false;
			EBEnergyCut=false;
			EEEnergyCut=false;
			HBEnergyCut=false;
			HEEnergyCut=false;
			HFEnergyCut=false;
			HF_EPEnergyCut=false;
			HadronCut=false;
			//Electron-Photon Cut begins
			if(genParticlespdg->at(g) ==11 || genParticlespdg->at(g) ==22) {
			    ElectronPhotonCut=true;
			    //EB
			    if((abs(gen.Eta())<= 1.479)  ) {
				if(gen.E()> 0.23 ) {
				    EBEnergyCut=true;
				}
			    }
			    //EE
			    if((abs(gen.Eta())>=1.479) && (abs(gen.Eta())<= 3.0 )  ) {
				if(gen.E()> 0.6 && gen.Et()> 0.15) {
				    EEEnergyCut=true;
				}
			    }
			    //HF
			    if((abs(gen.Eta()) >= 2.8) && (abs(gen.Eta()) <= 5.191)   ) {
				if(gen.E()> 1.4 ) {
				    HF_EPEnergyCut=true;
				}
			    }
		      
			} //Electron-Photon Cut ends
			//Hadron Cut begins
开发者ID:zdemirog,项目名称:EnergyFlow13TeVProducePlots,代码行数:67,代码来源:EnergyFlow_TreeProducer.C


示例3: EnergyFlow_GenLevel_TreeProducer_TuneCUETP8M1_3p8Tesla


//.........这里部分代码省略.........
            Gen.clear();
            Gen_1GeV.clear();
            Gen_2GeV.clear();
            Gen_HadronElectronCut.clear();
            Gen_EM.clear();
            Gen_EM_withEnergyCuts.clear();
            Gen_Had.clear();
            Gen_Had_withEnergyCuts.clear();
            
		for (int i =0; i<nEtaBins;i++) {
            
            GenEtaSums[i]=0.;
            GenEtaSums_1GeV[i]=0.;
            GenEtaSums_2GeV[i]=0.;
            GenEtaSums_HadronElectronCut[i]=0.;
            GenEtaSums_EM[i]=0.;
            GenEtaSums_EM_withEnergyCuts[i]=0.;
            GenEtaSums_Had[i]=0.;
            GenEtaSums_Had_withEnergyCuts[i]=0.;
            
		}
		
		// Ini. for each event
            XiCutGen=false;
            EnergyCutGen1GeV=false;
            EnergyCutGen2GeV=false;
        //--------------------XiCut-----------------------//
		if (filetype =="MC" && XiSD>minXiSD) XiCutGen=true;

		
        if(XiCutGen){
            
            for (unsigned long g=0; g<genParticlesp4_->size(); g++){
                XYZTVector gen = (*genParticlesp4_)[g];
                ElectronPhotonCut=false;
                EBEnergyCut=false;
                EEEnergyCut=false;
                HBEnergyCut=false;
                HEEnergyCut=false;
                HFEnergyCut=false;
                HF_EPEnergyCut=false;
                HadronCut=false;
                //Electron-Photon Cut begins
                if(genParticlespdg->at(g) ==11 || genParticlespdg->at(g) ==22) {
                    ElectronPhotonCut=true;
                    //EB
                    if((abs(gen.Eta())<= 1.479)  ) {
                        if(gen.E()> 0.23 ) {
                            EBEnergyCut=true;
                        }
                    }
                    //EE
                    if((abs(gen.Eta())>=1.479) && (abs(gen.Eta())<= 3.0 )  ) {
                        if(gen.E()> 0.6 && gen.Et()> 0.15) {
                            EEEnergyCut=true;
                        }
                    }
                    //HF
                    if((abs(gen.Eta()) >= 3.152) && (abs(gen.Eta()) <= 5.205)   ) {
                        if(gen.E()> 1.4 ) {
                            HF_EPEnergyCut=true;
                        }
                    }
                    
                } //Electron-Photon Cut ends
                //Hadron Cut begins
开发者ID:higgs313,项目名称:EnergyFlow13TeV,代码行数:67,代码来源:EnergyFlow_GenLevel_TreeProducer_TuneCUETP8M1_3p8Tesla.C


示例4: read

double read() {


  TRandom R;
  TStopwatch timer;


  TH1D * h1 = new TH1D("h1","total event  energy ",100,0,1000.);
  TH1D * h2 = new TH1D("h2","Number of track per event",21,-0.5,20.5);
  TH1D * h3 = new TH1D("h3","Track Energy",100,0,200);
  TH1D * h4 = new TH1D("h4","Track Pt",100,0,100);
  TH1D * h5 = new TH1D("h5","Track Eta",100,-5,5);
  TH1D * h6 = new TH1D("h6","Track Cos(theta)",100,-1,1);


  TFile f1("mathcoreLV.root");

  // create tree
  TTree *t1 = (TTree*)f1.Get("t1");

  std::vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > > * pTracks = 0;
  t1->SetBranchAddress("tracks",&pTracks);

  timer.Start();
  int n = (int) t1->GetEntries();
  std::cout << " Tree Entries " << n << std::endl;
  double sum=0;
  for (int i = 0; i < n; ++i) {
    t1->GetEntry(i);
    int ntrk = pTracks->size();
    h3->Fill(ntrk);
    XYZTVector q;
    for (int j = 0; j < ntrk; ++j) {
      XYZTVector v = (*pTracks)[j];
      q += v;
      h3->Fill(v.E());
      h4->Fill(v.Pt());
      h5->Fill(v.Eta());
      h6->Fill(cos(v.Theta()));
      sum += v.x() + v.y() + v.z() + v.t();
    }
    h1->Fill(q.E() );
    h2->Fill(ntrk);
  }


  timer.Stop();
  std::cout << " Time for new Vector " << timer.RealTime() << "  " << timer.CpuTime() << std::endl;



  TCanvas *c1 = new TCanvas("c1","demo of Trees",10,10,600,800);
  c1->Divide(2,3);

  c1->cd(1);
  h1->Draw();
  c1->cd(2);
  h2->Draw();
  c1->cd(3);
  h3->Draw();
  c1->cd(3);
  h3->Draw();
  c1->cd(4);
  h4->Draw();
  c1->cd(5);
  h5->Draw();
  c1->cd(6);
  h6->Draw();

  return sum;
}
开发者ID:digideskio,项目名称:root,代码行数:71,代码来源:mathcoreVectorCollection.C


示例5: EnergyFlow_DataZeroBias_TreeProducer_withCastor


//.........这里部分代码省略.........
      
      
	    // if (f==0 && run==251721){
	    if (f==0 && run==247324) RunCut=true;
	    if(f>0) RunCut =true;// for MC
            
	    // ----------------------- fat bunch ------------------//
	    // if (f==0 && bx==208) bxCut=true;
	    bxCut =true;// for MC
            
	    // ----------------------- lumi cut ------------------//
      
	    if (f==0)LumiCut=(lumi>=lumimin &&lumi<lumimax);
	    else LumiCut=true;// for MC
      
	    //if(LumiCut && RunCut ){
	    if(RunCut && LumiCut && bxCut){
	  
		// ----------------------- triger cut --------------//
		if (f==0)TrigerPass =  (trgZeroBias== 1);
		else TrigerPass=true;
	  
		if(TrigerPass){
		    //-- Event Selection for Det Level --//
			
			/////-------from Sebastian Castor event selection ------/////	
			//castorEventSelection = False
			//for i in xrange(0, self.fChain.CastorTowerp4.size()):
			//if self.fChain.CastorTowerp4.at(i).energy() > self.CastorNoiseThreshold*math.sqrt(self.fChain.CastorTowerNrechits.at(i)):
       			//castorEventSelection = True
       			///break

		        for(unsigned long cstr=0; cstr<CastorTowerp4_->size(); cstr++){
			XYZTVector cstrtwr = (*CastorTowerp4_)[cstr];
   			if(cstrtwr.E() > CastorNoiseThreshold * sqrt(CastorTowerNrechits->at(cstr))) {
			    EnergyCutTower=true;
			}
		    }

		    //--------- HF OR-------//
		    //for(unsigned long cal=0; cal<CaloTowersp4_->size(); cal++){
		    //XYZTVector caltwr = (*CaloTowersp4_)[cal];
		    ///if((abs(caltwr.Eta())>=etamin && abs(caltwr.Eta())<=etamax) && caltwr.E() > emin) {
		    //   EnergyCutTower=true;
		    ///	}
		    ///  }
		    if (EnergyCutTower){
			// Gen Level Event selection for Detlevel
			if (f>0){
			    for (unsigned long gd=0; gd<genParticlesp4_->size(); gd++){
				XYZTVector genDet = (*genParticlesp4_)[gd];
			  
				if((abs(genDet.Eta())<= Etabnd)  ) {
				    selcetetabin=getBin(genDet.Eta(),EtaBins, nEtaBins);
				    GenEtaSumsDetEvntSelct[selcetetabin] = GenEtaSumsDetEvntSelct[selcetetabin] + genDet.E();
				}
			    }//Gen
			}
			// ----------------------- ECALRecHit --------------- //
			for(unsigned long j=0; j<EcalRecHitenergy->size(); j++) {
			    selcetetabin=getBin(EcalRecHiteta->at(j),EtaBins,nEtaBins);
			    RecHitECALEtaSums[selcetetabin]= RecHitECALEtaSums[selcetetabin] + EcalRecHitenergy->at(j);
			}  
		  
			// ----------------------- HCALRecHit --------------- //
			for(unsigned long j=0; j<HBHERecHitenergy->size(); j++) {
开发者ID:higgs313,项目名称:EnergyFlow13TeV,代码行数:67,代码来源:EnergyFlow_DataZeroBias_TreeProducer_withCastor.C


示例6: track_selection_tree_1


//.........这里部分代码省略.........
        {
            cout << "lumisection is " << nlumi_section << endl;


            //we select only events that are triggered by ZeroBias Trigger. "True" in ZeroBias evaluate to 1
            if (iZeroBias == 1)
            {
                cout << "track pass zero bias" << endl;
                fvecVtxz_size = fvecVtxz->size();
                //vtxz_plot->Fill(fvecVtxz_size);

                if (fvecVtxz_size == vtxz_number)
                {
                    cout << "number of vertex for event " << i << " is " << fvecVtxz_size << endl;

                    //looping over vertices
                    for (int k = 0; k != fvecVtxz_size; ++k)
                    {
                        nBeamSize = fabs((*fvecVtxz)[k] - (*fvecVtxzBS)[0]);
                        cout << "Beam Size is " << nBeamSize << endl;

                        if (nBeamSize <= vtxz_size)
                        {
                            ntrk = tracks->size();

                            //fill with the lumi sections that meet the above event-level cuts
                            lumi_histo->Fill(nlumi_section);

                            nMulti = 0;

                            //looping over tracks
                            for (int j = 0; j != ntrk; ++j)
                            {
                                XYZTVector vec = (*tracks)[j];
                                dz_dzErr = ((*fVec_dz)[j])/((*fVec_dzErr)[j]);
                                d0_d0Err = ((*fVec_d0)[j])/((*fVec_d0Err)[j]);
                                pt_ptErr = ((vec.Pt())/(*fVec_ptErr)[j]);

                                if ((*nVec_HighPurity)[j] == 1)
                                {
                                    if (abs (vec.Eta()) <= eta_cut && vec.Pt() >= pt_cut)
                                    {
                                        phi_histo->Fill(vec.Phi());
                                        pt_histo->Fill(vec.Pt());
                                        eta_histo->Fill(vec.Eta());
                                        dz_sigmadz->Fill(dz_dzErr);
                                        d0_sigmad0->Fill(d0_d0Err);
                                        pt_sigmapt->Fill(pt_ptErr);
                                        ++nMulti;
                                    }
                                    ++nHigh_Purity;
                                }



                                /*if (abs (vec.Eta()) <= eta_cut && vec.Pt() >= pt_cut)
                                {
                                    pt_histo->Fill(vec.Pt());
                                }

                                if (vec.Pt() >= pt_cut)
                                {
                                    eta_histo->Fill(vec.Eta());
                                }*/

开发者ID:hanweiz,项目名称:Multiplicity,代码行数:65,代码来源:track_selection_tree_1.cpp


示例7: testRotation


//.........这里部分代码省略.........

  XYZVector n = plane.Normal();
  // normal is perpendicular to vectors on the planes obtained from subracting the points
  ok+= compare(n.Dot(p2-p1), 0.0, "n.v12",10); 
  ok+= compare(n.Dot(p3-p1), 0.0, "n.v13",10); 
  ok+= compare(n.Dot(p3-p2), 0.0, "n.v23",10); 

  Plane3D plane1 = t(plane);
  
  // transform the points
  XYZPoint pt1 = t(p1);
  XYZPoint pt2 = t(p2);
  XYZPoint pt3 = t(p3);
  Plane3D plane2(pt1,pt2,pt3);

  XYZVector n1 = plane1.Normal();
  XYZVector n2 = plane2.Normal();


  ok+= compare(n1.X(), n2.X(), "a",10); 
  ok+= compare(n1.Y(), n2.Y(), "b",10); 
  ok+= compare(n1.Z(), n2.Z(), "c",10); 
  ok+= compare(plane1.HesseDistance(), plane2.HesseDistance(), "d",10); 

  // check distances  
  ok += compare(plane1.Distance(pt1), 0.0, "distance",10);

  if (ok == 0) std::cout << "\t OK " << std::endl;
  else  std::cout << std::endl;

  std::cout << "Test LorentzRotation :          "; 
  ok = 0; 

  XYZTVector lv(1.,2.,3.,4.);
  
  // test from rotx (using boosts and 3D rotations not yet impl.)
  // rx,ry and rz already defined
  Rotation3D r3d = rx*ry*rz; 

  LorentzRotation rlx(rx);
  LorentzRotation rly(ry);
  LorentzRotation rlz(rz);

  LorentzRotation rl0 = rlx*rly*rlz;
  LorentzRotation rl1( r3d);
  
//   cout << rl << endl;
//   cout << rl0 << endl;
//   int eq = rl0 == rl;
//   cout << eq << endl;
//   double d1[16];
//   double d2[16];
//   rl.GetComponents(d1,d1+16);
//   rl0.GetComponents(d2,d2+16);
//   for (int i = 0; i < 16; ++i) 
//     ok+= compare(d1[i], d2[i], "i",1); 

  //ok+= compare( rl == rl2, static_cast<double>(true), " LorenzRot");


  //  cout << Rotation3D(rx) << endl;

  XYZTVector lv0 = rl0 * lv; 

  XYZTVector lv1 = rl1 * lv; 
开发者ID:My-Source,项目名称:root,代码行数:66,代码来源:mathcoreGenVector.C


示例8: testVectorUtil

int testVectorUtil() { 

 
  std::cout << "\n************************************************************************\n " 
	    << " Utility Function Tests" 
	    << "\n************************************************************************\n";

  std::cout << "Test Vector utility functions : ";


  XYZVector v1(1.0, 2.0, 3.0); 
  Polar3DVector v2pol(v1.R(), v1.Theta()+TMath::PiOver2(), v1.Phi() + 1.0); 
  // mixedmethods not yet impl. 
  XYZVector v2; v2 = v2pol; 

  ok = 0; 
  ok += compare( VectorUtil::DeltaPhi(v1,v2), 1.0, "deltaPhi Vec");
  
  RhoEtaPhiVector v2cyl(v1.Rho(), v1.Eta() + 1.0, v1.Phi() + 1.0);
  v2 = v2cyl; 


  ok += compare( VectorUtil::DeltaR(v1,v2), sqrt(2.0), "DeltaR Vec");

  XYZVector vperp = v1.Cross(v2);
  ok += compare( VectorUtil::CosTheta(v1,vperp), 0.0, "costheta Vec");
  ok += compare( VectorUtil::Angle(v1,vperp), TMath::PiOver2(), "angle Vec");

  if (ok == 0) std::cout << "\t\t OK " << std::endl;


  std::cout << "Test Point utility functions :  ";


  XYZPoint p1(1.0, 2.0, 3.0); 
  Polar3DPoint p2pol(p1.R(), p1.Theta()+TMath::PiOver2(), p1.Phi() + 1.0); 
  // mixedmethods not yet impl. 
  XYZPoint p2; p2 = p2pol; 

  ok = 0; 
  ok += compare( VectorUtil::DeltaPhi(p1,p2), 1.0, "deltaPhi Point");
  
  RhoEtaPhiPoint p2cyl(p1.Rho(), p1.Eta() + 1.0, p1.Phi() + 1.0);
  p2 = p2cyl; 
  ok += compare( VectorUtil::DeltaR(p1,p2), sqrt(2.0), "DeltaR Point");

  XYZPoint pperp(vperp.X(), vperp.Y(), vperp.Z());
  ok += compare( VectorUtil::CosTheta(p1,pperp), 0.0, "costheta Point");
  ok += compare( VectorUtil::Angle(p1,pperp), TMath::PiOver2(), "angle Point");

  if (ok == 0) std::cout << "\t\t OK " << std::endl;


  std::cout << "LorentzVector utility funct.:   ";


  XYZTVector q1(1.0, 2.0, 3.0,4.0); 
  PtEtaPhiEVector q2cyl(q1.Pt(), q1.Eta()+1.0, q1.Phi() + 1.0, q1.E() ); 
  // mixedmethods not yet impl. 
  XYZTVector q2; q2 = q2cyl; 

  ok = 0; 
  ok += compare( VectorUtil::DeltaPhi(q1,q2), 1.0, "deltaPhi LVec");
  ok += compare( VectorUtil::DeltaR(q1,q2), sqrt(2.0), "DeltaR LVec");
  
  XYZTVector qsum = q1+q2; 
  ok += compare( VectorUtil::InvariantMass(q1,q2), qsum.M(), "InvMass");

  if (ok == 0) std::cout << "\t\t OK " << std::endl;

  return ok;

}
开发者ID:My-Source,项目名称:root,代码行数:73,代码来源:mathcoreGenVector.C



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ XaLibCurl类代码示例发布时间:2022-05-31
下一篇:
C++ XYZGen类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap