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


C++ Process::SetBackground方法代码示例

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


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

示例1: Propagate

void Propagation::Propagate(Particle &curr_particle,
		std::vector<Particle> &ParticleAtMatrix,
		std::vector<Particle> &ParticleAtGround,
		bool dropParticlesBelowEnergyThreshold
		) const {

	double theta_deflBF = 0.0;
	double BNorm = magneticFieldStrength; 

	double zin = curr_particle.Getz();
	double Ein = curr_particle.GetEnergy();
	int type = curr_particle.GetType();

	int wi_last = curr_particle.GetWeigth();

	double z_curr = zin;
	double Ecurr = Ein;

	bool interacted = 0;
	double min_dist = 1e12;
	double walkdone = 0;

	double E1 = 0;
	double E2 = 0;
	double E3 = 0;

	double stepsize = 0;
	double Elast = 0;

	double R = Uniform(0.0, 1.0);
	double R2 = Uniform(0.0, 1.0);

	Process proc;
	proc.SetIncidentParticle(curr_particle);
	proc.SetBackground(Bkg);
	
	double Ethr2 = std::max(fEthr, std::max(ElectronMass,ElectronMass*ElectronMass/proc.feps_sup));
	if (Ecurr < Ethr2)
	{
		if (!dropParticlesBelowEnergyThreshold)
			ParticleAtGround.push_back(curr_particle);

		return;
	}
		

	std::vector<double> EtargetAll = GetEtarget(proc, curr_particle);

	min_dist = ExtractMinDist(proc, curr_particle.GetType(), R, R2, EtargetAll);

	interacted = 0;
	double dz = 0;
	double zpos = zin;

	double corrB_factor = 0;
	double realpath = 0;

	double min_dist_last = min_dist;

	while (!interacted) {

		proc.SetInteractionAngle(cPI);
		theta_deflBF = 0;
		realpath = 0.1 * min_dist;

		theta_deflBF = GetMeanThetaBFDeflection(BNorm,
				curr_particle.GetEnergy(), curr_particle.GetType(), min_dist);
		corrB_factor = cos(theta_deflBF);

		stepsize = realpath * corrB_factor;
		dz = Mpc2z(stepsize);


		if ((walkdone + realpath) > min_dist) {
			interacted = 1;
		}

		if (zpos - dz <= 0) {
			dz = zpos;
			stepsize = z2Mpc(dz);
			realpath = stepsize / corrB_factor;
		}

		zpos -= dz;
		walkdone += realpath;
		Elast = Ecurr;

		if (type == 0 || type == 22)
			Ecurr = EnergyLoss1D(Ecurr, zpos + Mpc2z(realpath), zpos, 0);
		else
			Ecurr = EnergyLoss1D(Ecurr, zpos + Mpc2z(realpath), zpos, BNorm);

		z_curr = zpos;

		curr_particle.Setz(z_curr);
		curr_particle.SetEnergy(Ecurr);

				
		if (z_curr <= 0) 
		{
//.........这里部分代码省略.........
开发者ID:phyytang,项目名称:CRPropa3,代码行数:101,代码来源:Propagation.cpp


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