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


C++ TVector3::y方法代码示例

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


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

示例1: SetPosition

void Mpdshape::SetPosition(TVector3 vec) {
  ostringstream o;
  o.precision(6);
  o.setf(ios::showpoint); 
  o.setf(ios::fixed);
  o << vec.x() << " " << vec.y() << " " << vec.z();
  fPosition.append(o.str().c_str());
}
开发者ID:TrueGuy,项目名称:mpdroot_CI,代码行数:8,代码来源:mpdshape.class.C

示例2: TFile

 void tv3Read2() {
   //second read example illustrating how to read one branch only
   TVector3 *v = 0;
   TFile *f = new TFile("v3.root");
   TTree *T = (TTree*)f->Get("T");
   T->SetBranchAddress("v3",&v);
   TBranch *by = T->GetBranch("fY");
   TH1F *h2 = new TH1F("y","y component of TVector3",100,-5,20);
   Int_t nentries = Int_t(T->GetEntries());
   for (Int_t i=0;i<nentries;i++) {
      by->GetEntry(i);
      h2->Fill(v->y());
   }
   h2->Draw();
}
开发者ID:alcap-org,项目名称:AlcapDAQ,代码行数:15,代码来源:tv3.C

示例3:

	  void qaP3(TString pre, TVector3 v, RhoTuple *n, bool skip=false){

		  if (n==0) return;

		  if(!skip){
			  n->Column(pre+"decayvx", (Float_t) v.x(), 0.0f);
			  n->Column(pre+"decayvy", (Float_t) v.y(), 0.0f);
			  n->Column(pre+"decayvz", (Float_t) v.z(), 0.0f);
		  }
		  else{
			  n->Column(pre+"decayvx", (Float_t) -999, 0.0f);
			  n->Column(pre+"decayvy", (Float_t) -999, 0.0f);
			  n->Column(pre+"decayvz", (Float_t) -999, 0.0f);
		  }

	  }
开发者ID:xyBlackWitch,项目名称:PhD,代码行数:16,代码来源:common_jenny.cpp

示例4: distance2

double distance2(double px,double py,double pz, double *p) {
   TVector3 xp(px,py,pz);
   TVector3 x0(p[0], p[1], p[2]);
   TVector3 u (TMath::Sin(p[3])*TMath::Cos(p[4]), TMath::Sin(p[3])*TMath::Sin(p[4]), TMath::Cos(p[3]));

   double coeff = u*(xp-x0);
   TVector3 n = xp - x0 - coeff * u;

   double dx = n.x();
   double dy = n.y();
   double dz = n.z();
   double d2_x = TMath::Power(dx/weight[0], 2);
   double d2_y = TMath::Power(dy/weight[1], 2);
   double d2_z = TMath::Power(dz/weight[2], 2);
   double d2 = d2_x + d2_y + d2_z;

   return d2;
}
开发者ID:mhedges,项目名称:tpc_skimmer,代码行数:18,代码来源:TPCfitter.cpp

示例5: PropagateParticle

void KVGeoNavigator::PropagateParticle(KVNucleus* part, TVector3* TheOrigin)
{
   // Propagate a particle through the geometry in the direction of its momentum,
   // until we reach the boundary of the geometry, or until fStopPropagation is set to kFALSE.
   // Propagation will also stop if we encounter a volume whose name begins with "DEADZONE"

   // Define point of origin of particles
   if (TheOrigin) fGeometry->SetCurrentPoint(TheOrigin->X(), TheOrigin->Y(), TheOrigin->Z());
   else fGeometry->SetCurrentPoint(0., 0., 0.);

   // unit vector in direction of particle's momentum
   TVector3 v = part->GetMomentum().Unit();
   // use particle's momentum direction
   fGeometry->SetCurrentDirection(v.x(), v.y(), v.z());
   fGeometry->FindNode();

   fCurrentVolume = fGeometry->GetCurrentVolume();
   fCurrentNode = fGeometry->GetCurrentNode();
   fMotherNode = fGeometry->GetMother();
   fCurrentMatrix = *(fGeometry->GetCurrentMatrix());
   fCurrentPath = fGeometry->GetPath();
   // move along trajectory until we hit a new volume
   fGeometry->FindNextBoundaryAndStep();
   fStepSize = fGeometry->GetStep();
   TGeoVolume* newVol = fGeometry->GetCurrentVolume();
   TGeoNode* newNod = fGeometry->GetCurrentNode();
   TGeoNode* newMom = fGeometry->GetMother();
   TGeoHMatrix* newMatx = fGeometry->GetCurrentMatrix();
   TString newPath = fGeometry->GetPath();

   Double_t XX, YY, ZZ;
   XX = YY = ZZ = 0.;

   // reset user flag for stopping propagation of particle
   SetStopPropagation(kFALSE);

//    Info("PropagateParticle","Beginning: i am in %s on node %s with path %s, and matrix:",
//         fCurrentVolume->GetName(),fCurrentNode->GetName(),fCurrentPath.Data());
//    fCurrentMatrix.Print();

   // track particle until we leave the geometry or until fStopPropagation
   // becomes kTRUE
   while (!fGeometry->IsOutside()) {

      const Double_t* posi = fGeometry->GetCurrentPoint();
      fEntryPoint.SetXYZ(XX, YY, ZZ);
      XX = posi[0];
      YY = posi[1];
      ZZ = posi[2];
      fExitPoint.SetXYZ(XX, YY, ZZ);

      TString vn = GetCurrentVolume()->GetName();
      if (vn.BeginsWith("DEADZONE")) {
         part->GetParameters()->SetValue("DEADZONE", Form("%s/%s", GetCurrentVolume()->GetName(), GetCurrentNode()->GetName()));
         break;
      }

//        Info("PropagateParticle","just before ParticleEntersNewVolume\nnow i am in %s on node %s with path %s and matrix:",
//             fCurrentVolume->GetName(),fCurrentNode->GetName(),fCurrentPath.Data());
//        fCurrentMatrix.Print();

      ParticleEntersNewVolume(part);

      if (StopPropagation()) break;

      fCurrentVolume = newVol;
      fCurrentNode = newNod;
      fMotherNode = newMom;
      fCurrentMatrix = *newMatx;
      fCurrentPath = newPath;

//        Info("PropagateParticle","after ParticleEntersNewVolume\nnow i am in %s on node %s with path %s and matrix:",
//             fCurrentVolume->GetName(),fCurrentNode->GetName(),fCurrentPath.Data());
//        fCurrentMatrix.Print();

      // move on to next volume crossed by trajectory
      fGeometry->FindNextBoundaryAndStep();
      fStepSize = fGeometry->GetStep();
      newVol = fGeometry->GetCurrentVolume();
      newNod = fGeometry->GetCurrentNode();
      newMom = fGeometry->GetMother();
      newMatx = fGeometry->GetCurrentMatrix();
      newPath = fGeometry->GetPath();
   }
}
开发者ID:GiuseppePast,项目名称:kaliveda,代码行数:85,代码来源:KVGeoNavigator.cpp

示例6: rotate_3vector

void rotate_3vector(void){

  PI = TMath::Pi();

  TVector3 beam = TVector3(0.,0.,1.);
  TVector3 scat = TVector3(0.2,0.4,1.);
  std::cout << "beam x : " << beam.x() << std::endl;
  std::cout << "beam y : " << beam.y() << std::endl;
  std::cout << "beam z : " << beam.z() << std::endl;
  std::cout << "scat x : " << scat.x() << std::endl;
  std::cout << "scat y : " << scat.y() << std::endl;
  std::cout << "scat z : " << scat.z() << std::endl;

  double bx=beam.x();
  double by=beam.y();
  double bz=beam.z();
  double sx=scat.x();
  double sy=scat.y();
  double sz=scat.z();

  double theta  = acos((bx*sx + by*sy + bz*sz)/sqrt(bx*bx + by*by + bz*bz)/sqrt(sx*sx + sy*sy + sz*sz));
  double theta_ = acos(sz/sqrt(sx*sx+sy*sy+sz*sz));

  std::cout << "theta  : " << theta  << std::endl;
  std::cout << "theta_ : " << theta_ << std::endl;

  TVector3 beam2 = TVector3(0, 1, 0);
  double bx2=beam2.x();
  double by2=beam2.y();
  double bz2=beam2.z();

  std::cout << "beam2 x (nom) : " << beam2.x()/sqrt(bx2*bx2+by2*by2+bz2*bz2) << std::endl;
  std::cout << "beam2 y (nom) : " << beam2.y()/sqrt(bx2*bx2+by2*by2+bz2*bz2) << std::endl;
  std::cout << "beam2 z (nom) : " << beam2.z()/sqrt(bx2*bx2+by2*by2+bz2*bz2) << std::endl;

  double theta_tmp  = - atan(by2/sqrt(bx2*bx2 + bz2*bz2));
  double phi_tmp    = atan2(bx2, bz2);

  std::cout << "theta_tmp  : " << theta_tmp  << std::endl;
  std::cout << "phi_tmp  : " << phi_tmp  << std::endl;

  beam.RotateX(theta_tmp);
  beam.RotateY(phi_tmp);

  scat.RotateX(theta_tmp);
  scat.RotateY(phi_tmp);

  bx=beam.x();
  by=beam.y();
  bz=beam.z();
  sx=scat.x();
  sy=scat.y();
  sz=scat.z();

  std::cout << "roteta beam x : " << bx << std::endl;
  std::cout << "roteta beam y : " << by << std::endl;
  std::cout << "roteta beam z : " << bz << std::endl;
  std::cout << "roteta scat x : " << sx << std::endl;
  std::cout << "roteta scat y : " << sy << std::endl;
  std::cout << "roteta scat z : " << sz << std::endl;


  double theta_rotate  = acos((bx*sx + by*sy + bz*sz)/sqrt(bx*bx + by*by + bz*bz)/sqrt(sx*sx + sy*sy + sz*sz));

  std::cout << "===========================" << std::endl;
  std::cout << "theta         : " << theta  << std::endl;
  std::cout << "theta_rotate  : " << theta_rotate  << std::endl;

}
开发者ID:ekawa,项目名称:test,代码行数:69,代码来源:rotate_3vector.c


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