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


C++ TVector2类代码示例

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


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

示例1: getCeF3Position

void getCeF3Position( std::vector<float> cef3, float& xPos, float& yPos ) {

  xPos=0.;
  yPos=0.;

  float r02 = cef3[0]/cef3[2];
  float r13 = cef3[1]/cef3[3];

  TF1* f1_d02 = getCef3Function("diag02");
  TF1* f1_d13 = getCef3Function("diag13");

  float diag02 = f1_d02->GetX(r02, -50., 50.);
  float diag13 = f1_d13->GetX(r13, -50., 50.);

  TVector2 v( diag13, diag02 );
  float pi = 3.14159;
  float theta = pi/4.; // 45 degrees 
  TVector2 d = v.Rotate(+theta);

  xPos = d.X();
  yPos = d.Y();
  //xPos = diag02;
  //yPos = diag13;


  delete f1_d02;
  delete f1_d13;

}
开发者ID:clarajorda,项目名称:BTFAnalysis,代码行数:29,代码来源:positionAnalysis.cpp

示例2: Discretize

TVector2 HashTable::Discretize(TVector2 position) {
  position /= _NG_H_;
  position.Set(
    floor(position.X()),
    floor(position.Y())
  );
  return position;
}
开发者ID:carbolymer,项目名称:SPH,代码行数:8,代码来源:HashTable.cpp

示例3: fopen

int Load3ds::CompileObjects()
{
#ifdef GRAPHICS_DEBUG
	FILE* file = NULL;
	file = fopen("normals.out", "w+");
	assert( file );
#endif

	int j = 0;
	TVector3<float> position, normal;
	TVector2<float> texCoord;

	// the number of faces * 3: 3 indices per face
	for (int i = 0; i < mModelData->mFaceCount * 3; i+=3)
	{
		mMesh->addTriangleIndices(mModelData->mFaces[ i ], 
			mModelData->mFaces[i + 1], mModelData->mFaces[i + 2]);
	}

	// set up all the information: position, normal and eventually
	// the texture coordinates, and compile them into our TVertex class
	for (int i = 0; i < mModelData->mVertexCount; i++)
	{
		j = i * 3;

		position.setX( mModelData->mVertices[ j ] );
		position.setY( mModelData->mVertices[j + 1] );
		position.setZ( mModelData->mVertices[j + 2] );

		normal.setX( mModelData->mNormals[ j ] );
		normal.setY( mModelData->mNormals[j + 1] );
		normal.setZ( mModelData->mNormals[j + 2] );

#ifdef GRAPHICS_DEBUG
		fprintf(file, "%i: X: %f, Y: %f, Z: %f\n", i, normal.x(), normal.y(), 
			normal.z());
#endif

		if ( mModelData->mContainsTexCoords )
		{
			// stride: one face -> 2 texture coordinates
			j = i * 2;

			texCoord.setX( mModelData->mTexCoords[ j ] );
			texCoord.setY( mModelData->mTexCoords[j + 1] );
		}

		mMesh->addVertex( TVertex(normal, position, texCoord) );
	}

#ifdef GRAPHICS_DEBUG
	fclose( file );
#endif

	return 1;
}
开发者ID:ramsampath,项目名称:GLSLToon,代码行数:56,代码来源:3ds.cpp

示例4:

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;
}
开发者ID:torque,项目名称:proofana-chicago,代码行数:54,代码来源:test.C

示例5: testPadDimensions

void testPadDimensions(AliMq::Station12Type station, AliMp::PlaneType plane)
{
  AliMpDataProcessor mp;
  AliMpDataMap* dataMap = mp.CreateDataMap("data");
  AliMpDataStreams dataStreams(dataMap);

  AliMpSectorReader r(dataStreams, station, plane);
  AliMpSector* sector = r.BuildSector();
  AliMpSectorSegmentation segmentation(sector);  
  segmentation.PrintZones(); 
  
  TVector2 previousDimensions;
  for (Int_t i=1; i<segmentation.MaxPadIndexX()+1;i++) 
    for (Int_t j=1;j<segmentation.MaxPadIndexY()+1;++j) {

       if ( segmentation.HasPadByIndices(i,j) ) {

        // Check pad dimensions
	AliMpPad pad = segmentation.PadByIndices(i,j);
	TVector2 dimensions = segmentation.PadDimensions(segmentation.Zone(pad));
	
	if ( dimensions.X() != previousDimensions.X() || 
	     dimensions.Y() != previousDimensions.Y() ) {

          // Print dimensions
	  cout << "Pad: " << "(" << i << "," << j << ")";
	  cout << "  dimensions: (" << dimensions.X() << ", " << dimensions.Y() << ")" 
	       << endl;
          
	  previousDimensions = dimensions;
        }	     
     }
   }
}
开发者ID:ktf,项目名称:AliRoot,代码行数:34,代码来源:testSt12PadDimensions.C

示例6: getPlaneProjection

bool TPinholeCamera::getPlaneProjection (const TVector& rktPOINT, TVector2& rtPROJ) const
{

  TScalar   u, v;
  TScalar   pt, pu, pv;
  TVector   tPoint = (rktPOINT - tLocation);
  
  pt = dotProduct (tDirection, tPoint);
  pu = dotProduct (I, tPoint) / tPixelSize;
  pv = dotProduct (J, tPoint) / tPixelSize;

  u = tHalfResX + ((pu / pt) / tPixelSize);
  if ( ( u < 0 ) || ( u > (tHalfResX * 2) ) )
  {
    return false;
  }
  v = tHalfResY - ((pv / pt) / tPixelSize);
  if ( ( v < 0 ) || ( v > (tHalfResY * 2) ) )
  {
    return false;
  }

  rtPROJ.set (u, v);
  
  return true;
  
}  /* getPlaneProjection() */
开发者ID:bartholomule,项目名称:panorama,代码行数:27,代码来源:pinhole.cpp

示例7: Pi_versor_reco_from_2hits

inline TVector3 Pi_versor_reco_from_2hits(double deltaz, TVector2 hit1, TVector2 hit2)
{
    double px = (hit2.X() - hit1.X())/deltaz;
    double py = (hit2.Y() - hit1.Y())/deltaz;
    return TVector3(px, py, 1);
}
开发者ID:12345ieee,项目名称:spectrometer,代码行数:6,代码来源:analysis.cpp

示例8: getD0RedMet

// D0 RedMET with CMG trees
double getD0RedMet(double lpx1, double lpy1, double lpterr1, 
		   double lpx2, double lpy2, double lpterr2, 
		   double sumjpx, double sumjpy, 
		   double pfmet, double pfmetphi, 
		   int flav, int pickAFlav = 1) {
			   


  if( flav==3 ) { 
    if( pickAFlav!=1 && pickAFlav!=2 ) {
      cout << " *** ERROR *** " << endl;
      cout << "  You need to pick a flavor in getD0RedMet(...)! " << endl;
      throw std::exception();
      return -1.;
    }
    else {
      flav = pickAFlav;
    }
  }

  // double wPerpMu = 1.0;
  // double wRecMu  = 2.0;
  // double wUncMu  = 2.5;
  double wPerpMu = 1.0;
  double wRecMu  = 1.5;
  double wUncMu  = 2.75;

  // double wPerpEl = 1.5;
  // double wRecEl  = 2.25;
  // double wUncEl  = 0.0;
  double wPerpEl = 0.75;
  double wRecEl  = 1.0;
  double wUncEl  = 0.25;
  
  int seplep = 1;
  
  if (seplep == 0){
		wPerpMu = 1.0;
		wRecMu  = 1.25;
		wUncMu  = 0.0;
		wPerpEl = wPerpMu;
		wRecEl  = wRecMu;
		wUncEl  = wUncMu;
  }

  double kPerp = 1.;
  double kRecoil_l = 1.;
  double kRecoil_t = 1.;
  double kSigmaPt_l = 1.;
  double kSigmaPt_t = 1.;

  if( flav==1 ) {        // mm
    kPerp = wPerpMu;
    kRecoil_l = kRecoil_t = wRecMu;
    kSigmaPt_l = kSigmaPt_t = wUncMu;
  }
  else if( flav==2 ) {  // ee
    kPerp = wPerpEl;
    kRecoil_l = kRecoil_t = wRecEl;
    kSigmaPt_l = kSigmaPt_t = wUncEl;
  }
  else {}

  double pt1 = sqrt(lpx1*lpx1 + lpy1*lpy1);
  double pt2 = sqrt(lpx2*lpx2 + lpy2*lpy2);

  TVector2 lead, subl;
  double leadpt, sublpt, leadpterr, sublpterr;
  if(pt1>pt2) {
    lead = TVector2(lpx1, lpy1);
    subl = TVector2(lpx2, lpy2);
    leadpt = pt1;
    leadpterr = lpterr1;
    sublpt = pt2;
    sublpterr = lpterr2;
  }
  else {
    lead = TVector2(lpx2, lpy2);
    subl = TVector2(lpx1, lpy1);
    leadpt = pt2;
    leadpterr = lpterr2;
    sublpt = pt1;
    sublpterr = lpterr1;
  }

  // Define the thrust and dilepton
  TVector2 dil = lead+subl;
  TVector2 thr = lead-subl;
  TVector2 longi;
  TVector2 perpe;
  double deltaPhi = fabs(lead.DeltaPhi(subl));

  if( deltaPhi>(3.141592654/2.) ) {
    longi = thr.Unit();
    perpe = longi.Rotate(3.141592654/2.);
    if(perpe*lead<0) perpe *= -1;
  }
  else {
    perpe = dil.Unit();
//.........这里部分代码省略.........
开发者ID:beknapp,项目名称:usercode,代码行数:101,代码来源:plotting_functions.C

示例9: 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() );
//.........这里部分代码省略.........
开发者ID:okkuntze,项目名称:BoostedTTH,代码行数:101,代码来源:StdTopVarProcessor.cpp

示例10: ttreco2

void ttreco2( TString process ) {

	cout << "\n\n" << process << "\n" <<  endl; 

	TFile* fshape  = new TFile( "/afs/cern.ch/user/j/jgarciaf/mimick/mlb.root" ); 

	TH1F* shapemlb = (TH1F*) fshape->Get( "mlb" );

	MassReconstructor theMass( 100, shapemlb );  


	//TFile myfile( "../minitrees/" + inputdir + "/TTDM/" + process + ".root", "update" ); 
	TFile myfile( "../../../../public/minitrees_week-1_with-ttReco/" + process + ".root", "update" ); 
	//TFile myfile( "../minitrees/week-1-checks/" + process + ".root", "update" ); 

   	TTreeReader myreader( "latino", &myfile );

	TTree* mytree = (TTree*) myfile.Get( "latino" );


	//----- read -------------------------------------------------------

   	TTreeReaderValue<float> metPfType1   ( myreader, "metPfType1"    );
   	TTreeReaderValue<float> metPfType1Phi( myreader, "metPfType1Phi" );

   	TTreeReaderValue<float> lep1pt  ( myreader, "lep1pt"   );
   	TTreeReaderValue<float> lep1eta ( myreader, "lep1eta"  );
   	TTreeReaderValue<float> lep1phi ( myreader, "lep1phi"  );
   	TTreeReaderValue<float> lep1mass( myreader, "lep1mass" );

	TTreeReaderValue<float> lep2pt  ( myreader, "lep2pt"   );
   	TTreeReaderValue<float> lep2eta ( myreader, "lep2eta"  );
   	TTreeReaderValue<float> lep2phi ( myreader, "lep2phi"  );
   	TTreeReaderValue<float> lep2mass( myreader, "lep2mass" );

   	TTreeReaderValue<std::vector<float>> jet_pt ( myreader, "jet_pt"  );
   	TTreeReaderValue<std::vector<float>> jet_eta( myreader, "jet_eta" );
   	TTreeReaderValue<std::vector<float>> jet_phi( myreader, "jet_phi" );

   	TTreeReaderValue<std::vector<float>> bjet30csvv2m_pt ( myreader, "bjet30csvv2m_pt"  );
   	TTreeReaderValue<std::vector<float>> bjet30csvv2m_eta( myreader, "bjet30csvv2m_eta" );
   	TTreeReaderValue<std::vector<float>> bjet30csvv2m_phi( myreader, "bjet30csvv2m_phi" );

	//TTreeReaderValue<float> top1pt  ( myreader, "top1pt_gen"   );
   	//TTreeReaderValue<float> top1eta ( myreader, "top1eta_gen"  );
   	//TTreeReaderValue<float> top1phi ( myreader, "top1phi_gen"  );

	//TTreeReaderValue<float> top2pt  ( myreader, "top2pt_gen"   );
   	//TTreeReaderValue<float> top2eta ( myreader, "top2eta_gen"  );
   	//TTreeReaderValue<float> top2phi ( myreader, "top2phi_gen"  );


	//----- write ------------------------------------------------------

	float topRecoW;
	float darkpt  ; 

	TBranch* b_topRecoW = mytree -> Branch( "topRecoW", &topRecoW, "topRecoW/F" );
	TBranch* b_darkpt   = mytree -> Branch( "newdarkpt"  , &darkpt  , "darkpt/F"   );

	TBranch* b_mimick = mytree -> Branch( "mimick"  , &mimick  , "mimick/F"   );

	

	//----- loop -------------------------------------------------------


	int nentries = myreader.GetEntries(1); 

	//if ( nentries > 10 ) nentries = 10; 

	for ( Long64_t ievt = 0; ievt < nentries; ievt++ ) {

		if( ievt%10000 == 0 ) cout << "\n\n ievt: " << ievt << endl;

		myreader.SetEntry(ievt);

		//--- MET

		TVector2 MET;

		MET.SetMagPhi( *metPfType1, *metPfType1Phi );

		myreader.SetEntry(ievt);

		//--- leptons

		TLorentzVector l1, l2;   // top1gen, top2gen; 

		l1.SetPtEtaPhiM( *lep1pt, *lep1eta, *lep1phi, *lep1mass ); 
  		l2.SetPtEtaPhiM( *lep2pt, *lep2eta, *lep2phi, *lep2mass );

		//top1gen.SetPtEtaPhiM( *top1pt, *top1eta, *top1phi, 173.34 );
		//top2gen.SetPtEtaPhiM( *top2pt, *top2eta, *top2phi, 173.34 );


		//--- jets

		std::vector<TLorentzVector> jets;
 		std::vector<TLorentzVector> bjets;
//.........这里部分代码省略.........
开发者ID:cedricpri,项目名称:AnalysisCMS,代码行数:101,代码来源:ttreco.C

示例11: e1

void PMCSZCand::SetA(PMCSEMObj &elec1, PMCSEMObj &elec2) {

  // First we need to calculate the thrust axis
  //
  TVector2 e1(elec1.ppx(),elec1.ppy());
  TVector2 e2(elec2.ppx(),elec2.ppy());

  // Calculate the two phi angles
  double phi1=e1.Phi();
  double phi2=e2.Phi();

  // Order in phi
  if (phi1<phi2) {
    TVector2 dummy=e1;
    e1=e2;
    e2=dummy;
    double dummy2=phi1;
    phi1=phi2;
    phi2=dummy2;
  }

  // Calculate lengths as well
  double len1=e1.Mod();
  double len2=e2.Mod();

  // Good old Newton
  //
  // initial guess
  TVector2 bisector=(e1.Unit()+e2.Unit()).Unit();
  double alpha=bisector.Phi()-TMath::Pi()/2.;
  double alphaBackup=alpha;
  int nIt=0;
  // iterate
  double oldAlpha=9999.;
  while (fabs(alpha-oldAlpha)>0.000001) {
    oldAlpha=alpha;
    double f=len2*sin(phi2-oldAlpha)+len1*sin(oldAlpha-phi1);
    double fp=-len2*cos(phi2-oldAlpha)+len1*cos(oldAlpha-phi1);
    alpha=oldAlpha-f/fp;
    nIt++;
    if (nIt>1000) {
      cout<<"Newton did not converge in search for thrust axis"<<endl;
      alpha=alphaBackup;
      break;
    }
  }

  // Build unit vector
  TVector2 r;
  r.SetMagPhi(1.,alpha);
  TVector2 rPerp=r.Rotate(TMath::Pi()/2.);

  // Checks
  if (fabs(e1*rPerp-e2*rPerp)>0.001) {
    cout<<"Looks like Newton was imprecise in calculation of thrust axis: "<<e1*rPerp<<" "<<e2*rPerp<<endl;
  }

  // now we can do the projections
  TVector2 Z=e1+e2;
  _pat=Z*rPerp;
  _pal=Z*r;
}
开发者ID:hengne,项目名称:d0wmass,代码行数:62,代码来源:PMCSZCand.cpp

示例12: selectAntiWm


//.........这里部分代码省略.........
          u1        = -999;
          u2        = -999;
          tkU1      = -999;
          tkU2      = -999;
	  mvaU1     = -999;
          mvaU2     = -999;
          id_1      = -999;
          id_2      = -999;
          x_1       = -999;
          x_2       = -999;
          xPDF_1    = -999;
          xPDF_2    = -999;
          scalePDF  = -999;
          weightPDF = -999;

	  if(isSignal && hasGen) {
	    TLorentzVector *gvec=new TLorentzVector(0,0,0,0);
            TLorentzVector *glep1=new TLorentzVector(0,0,0,0);
            TLorentzVector *glep2=new TLorentzVector(0,0,0,0);
	    toolbox::fillGen(genPartArr, BOSON_ID, gvec, glep1, glep2,1);

            if (gvec && glep1) {
	      genV      = new TLorentzVector(0,0,0,0);
              genV->SetPtEtaPhiM(gvec->Pt(),gvec->Eta(),gvec->Phi(),gvec->M());
              genLep    = new TLorentzVector(0,0,0,0);
              genLep->SetPtEtaPhiM(glep1->Pt(),glep1->Eta(),glep1->Phi(),glep1->M());
              genVPt    = gvec->Pt();
              genVPhi   = gvec->Phi();
              genVy     = gvec->Rapidity();
              genVMass  = gvec->M();
              genLepPt  = glep1->Pt();
              genLepPhi = glep1->Phi();

	      TVector2 vWPt((genVPt)*cos(genVPhi),(genVPt)*sin(genVPhi));
	      TVector2 vLepPt(vLep.Px(),vLep.Py());
	      
	      TVector2 vMet((info->pfMETC)*cos(info->pfMETCphi), (info->pfMETC)*sin(info->pfMETCphi));
	      TVector2 vU = -1.0*(vMet+vLepPt);
	      u1 = ((vWPt.Px())*(vU.Px()) + (vWPt.Py())*(vU.Py()))/(genVPt);  // u1 = (pT . u)/|pT|
	      u2 = ((vWPt.Px())*(vU.Py()) - (vWPt.Py())*(vU.Px()))/(genVPt);  // u2 = (pT x u)/|pT|

	      TVector2 vTkMet((info->trkMET)*cos(info->trkMETphi), (info->trkMET)*sin(info->trkMETphi));
	      TVector2 vTkU = -1.0*(vTkMet+vLepPt);
	      tkU1 = ((vWPt.Px())*(vTkU.Px()) + (vWPt.Py())*(vTkU.Py()))/(genVPt);  // u1 = (pT . u)/|pT|
	      tkU2 = ((vWPt.Px())*(vTkU.Py()) - (vWPt.Py())*(vTkU.Px()))/(genVPt);  // u2 = (pT x u)/|pT|
	      
	      TVector2 vMvaMet((info->mvaMET)*cos(info->mvaMETphi), (info->mvaMET)*sin(info->mvaMETphi));
	      TVector2 vMvaU = -1.0*(vMvaMet+vLepPt);
	      mvaU1 = ((vWPt.Px())*(vMvaU.Px()) + (vWPt.Py())*(vMvaU.Py()))/(genVPt);  // u1 = (pT . u)/|pT|
	      mvaU2 = ((vWPt.Px())*(vMvaU.Py()) - (vWPt.Py())*(vMvaU.Px()))/(genVPt);  // u2 = (pT x u)/|pT|
          
            }
	    id_1      = gen->id_1;
            id_2      = gen->id_2;
            x_1       = gen->x_1;
            x_2       = gen->x_2;
            xPDF_1    = gen->xPDF_1;
            xPDF_2    = gen->xPDF_2;
            scalePDF  = gen->scalePDF;
            weightPDF = gen->weight;

	    delete gvec;
            delete glep1;
            delete glep2;
            gvec=0; glep1=0; glep2=0;
	  }
开发者ID:thongonary,项目名称:MitEwk13TeV,代码行数:67,代码来源:selectAntiWm.C

示例13: x

template <typename T> ork::TVector2<T>::TVector2( const TVector2<T>& vec)
	: x( vec.GetX() )
	, y( vec.GetY() )
{
}
开发者ID:tweakoz,项目名称:orkid,代码行数:5,代码来源:cvector2.hpp

示例14: X

matrixstack::Vector::Vector(const TVector2 &v): TVectorT<double>(2)
{
    X() = v.X();
    Y() = v.Y();
}
开发者ID:A2-Collaboration-dev,项目名称:a2display,代码行数:5,代码来源:matrixstack.cpp

示例15: selectZmm


//.........这里部分代码省略.........
	}
	
	//
	// Fill tree
	//
	runNum   = info->runNum;
	lumiSec  = info->lumiSec;
	evtNum   = info->evtNum;
	
	if (hasGenMatch) matchGen=1;
	else matchGen=0;
	
	category = icat;
	
	vertexArr->Clear();
	vertexBr->GetEntry(ientry);
	
	npv      = vertexArr->GetEntries();
	npu      = info->nPUmean;
	genWeight= hasGen ? gen->weight: 1.;
	PUWeight = puWeight;
	scale1fb = weight;
	scale1fbUp = weightUp;
	scale1fbDown = weightDown;
	met      = info->pfMETC;
	metPhi   = info->pfMETCphi;
	sumEt    = 0;
	tkMet    = info->trkMET;
	tkMetPhi = info->trkMETphi;
	tkSumEt  = 0;
	mvaMet   = info->mvaMET;
	mvaMetPhi = info->mvaMETphi;
	mvaSumEt = 0;
	TVector2 vZPt((vDilep.Pt())*cos(vDilep.Phi()),(vDilep.Pt())*sin(vDilep.Phi()));

        puppiMet = info->puppET;
        puppiMetPhi = info->puppETphi;
	puppiSumEt = 0;
	lep1     = &vTag;
	lep2     = &vProbe;
	dilep    = &vDilep;
	sta1        = &vTagSta;
	sta2        = &vProbeSta;
	
	TVector2 vMet((info->pfMETC)*cos(info->pfMETCphi), (info->pfMETC)*sin(info->pfMETCphi));
	TVector2 vU = -1.0*(vMet+vZPt);
	u1 = ((vDilep.Px())*(vU.Px()) + (vDilep.Py())*(vU.Py()))/(vDilep.Pt());  // u1 = (pT . u)/|pT|
	u2 = ((vDilep.Px())*(vU.Py()) - (vDilep.Py())*(vU.Px()))/(vDilep.Pt());  // u2 = (pT x u)/|pT|
	
	TVector2 vTkMet((info->trkMET)*cos(info->trkMETphi), (info->trkMET)*sin(info->trkMETphi));
	TVector2 vTkU = -1.0*(vTkMet+vZPt);
	tkU1 = ((vDilep.Px())*(vTkU.Px()) + (vDilep.Py())*(vTkU.Py()))/(vDilep.Pt());  // u1 = (pT . u)/|pT|
	tkU2 = ((vDilep.Px())*(vTkU.Py()) - (vDilep.Py())*(vTkU.Px()))/(vDilep.Pt());  // u2 = (pT x u)/|pT|
	
	TVector2 vMvaMet((info->mvaMET)*cos(info->mvaMETphi), (info->mvaMET)*sin(info->mvaMETphi));
	TVector2 vMvaU = -1.0*(vMvaMet+vZPt);
	mvaU1 = ((vDilep.Px())*(vMvaU.Px()) + (vDilep.Py())*(vMvaU.Py()))/(vDilep.Pt());  // u1 = (pT . u)/|pT|
	mvaU2 = ((vDilep.Px())*(vMvaU.Py()) - (vDilep.Py())*(vMvaU.Px()))/(vDilep.Pt());  // u2 = (pT x u)/|pT|
        
        TVector2 vPuppiMet((info->puppET)*cos(info->puppETphi), (info->puppET)*sin(info->puppETphi));
	TVector2 vPuppiU = -1.0*(vPuppiMet+vZPt);
	puppiU1 = ((vDilep.Px())*(vPuppiU.Px()) + (vDilep.Py())*(vPuppiU.Py()))/(vDilep.Pt());  // u1 = (pT . u)/|pT|
	puppiU2 = ((vDilep.Px())*(vPuppiU.Py()) - (vDilep.Py())*(vPuppiU.Px()))/(vDilep.Pt());  // u2 = (pT x u)/|pT|
	
        outTree->Fill();
	delete genV;
开发者ID:MiT-HEP,项目名称:MitEwk13TeV,代码行数:67,代码来源:selectZmm.C


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