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


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

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


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

示例1: ExtractPhotonEnergyMC

double Propagation::ExtractPhotonEnergyMC(double z, Process &proc) const {
	double esoft = 0;
//double snew = 0;
	double emin = proc.GetMin();
	Particle pi = proc.GetIncidentParticle();
	Particle pb = proc.GetTargetParticle();

	double Epi = pi.GetEnergy();
	double m = pi.GetMass();
	esoft = ShootPhotonEnergyMC(emin / (4.0 * Epi), z);
	//snew = 4 * Epi * esoft + m * m;
	pb.SetEnergy(esoft);
	proc.SetTargetParticle(pb);
	proc.SetCMEnergy();
	return esoft;
}
开发者ID:phyytang,项目名称:CRPropa3,代码行数:16,代码来源:Propagation.cpp

示例2: Propagate


//.........这里部分代码省略.........
			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) 
		{
			ParticleAtGround.push_back(curr_particle);
			return;
		}
		if (Ecurr <= Ethr2) 
		{ 
			if (!dropParticlesBelowEnergyThreshold)
			{
				ParticleAtGround.push_back(curr_particle);
			}
			return;
		}
		proc.SetIncidentParticle(curr_particle);
		proc.SetCMEnergy();
		proc.SetLimits();
		//      std::vector<double> EtargetAll=GetEtarget(proc,curr_particle);
		min_dist = ExtractMinDist(proc, curr_particle.GetType(), R, R2,
				EtargetAll);
	} //end while

	if (interacted == 1) {
		if (proc.GetName() == Process::PP) {

			E1 = ExtractPPSecondariesEnergy(proc);

			if (E1 == 0 || E1 == Ecurr)
				std::cerr << "ERROR in PP process:  E : " << Ecurr << "  " << E1
						<< " " << std::endl;

			Particle pp(11, E1, z_curr,curr_particle.Generation()+1);
			pp.SetWeigth(wi_last);
			ParticleAtMatrix.push_back(pp);

			Particle pe(-11, Ecurr - E1, z_curr,curr_particle.Generation()+1);
			pe.SetWeigth(wi_last);
			ParticleAtMatrix.push_back(pe);
			return;
		} //if PP
		else if (proc.GetName() == Process::DPP) {
		  E1 = (Ecurr - 2 * ElectronMass) / 2.0;
			if (E1 == 0)
				std::cerr << "ERROR in DPP process E : " << E1 << std::endl;

			Particle pp(11, E1, z_curr,curr_particle.Generation()+1);
			pp.SetWeigth(wi_last);
			ParticleAtMatrix.push_back(pp);
开发者ID:phyytang,项目名称:CRPropa3,代码行数:67,代码来源:Propagation.cpp

示例3: ExtractMinDist

double Propagation::ExtractMinDist(Process &proc, int type, double R, double R2,
		std::vector<double> &Etarget) const {

	double min_dist1 = 0;
	double min_dist2 = 0;
	Process proc1(proc);
	Process proc2(proc);
	double tmp_lambda1 = 0;
	double tmp_lambda2 = 0;
	Particle pt;
	pt.SetType(0);
	pt.Setz(proc.GetIncidentParticle().Getz());

	if (type == 22) {
	  if (Etarget[0]) {
		proc1.SetName(Process::PP);
		pt.SetEnergy(Etarget[0]);
		proc1.SetTargetParticle(pt);
		proc1.SetCMEnergy();

		tmp_lambda1 = GetLambdaTab(proc1, Process::PP);

		min_dist1 = -tmp_lambda1 * log(R);
	  }
	  if (Etarget[1]) {
		pt.SetEnergy(Etarget[1]);
		proc2.SetTargetParticle(pt);
		proc2.SetCMEnergy();
		tmp_lambda2 = GetLambdaTab(proc2, Process::DPP);
		min_dist2 = -tmp_lambda2 * log(R2);
	  }
#ifdef DEBUG_ELECA
		std::cerr << "comparing 2 mindists: " << min_dist1 << "("
		<< tmp_lambda1 << ") vs " << min_dist2 << " ( "
		<< tmp_lambda2 << ") " << std::endl;
#endif

		if (min_dist2 < min_dist1) {
			min_dist1 = min_dist2;
			proc.SetName(Process::DPP);
			pt.SetEnergy(Etarget[1]);
			proc.SetTargetParticle(pt);
			proc.SetCMEnergy();
		} else {
			proc.SetName(Process::PP);
			pt.SetEnergy(Etarget[0]);
			proc.SetTargetParticle(pt);
			proc.SetCMEnergy();
		}
	}    //end if type 0
	else if (abs(type) == 11) {

		proc1.SetName(Process::ICS);
		pt.SetEnergy(Etarget[0]);
		proc1.SetTargetParticle(pt);
		tmp_lambda1 = GetLambdaTab(proc1, Process::ICS);
		min_dist1 = -tmp_lambda1 * log(R);

		proc2.SetName(Process::TPP);
		pt.SetEnergy(Etarget[1]);
		proc2.SetTargetParticle(pt);
		tmp_lambda2 = GetLambdaTab(proc2, Process::TPP);
		min_dist2 = -tmp_lambda2 * log(R2);

#ifdef DEBUG_ELECA
		std::cerr << "comparing 2 mindists: " << min_dist1 << "("
		<< tmp_lambda1 << ") vs " << min_dist2 << " ( "
		<< tmp_lambda2 << ") " << std::endl;
#endif

		if (min_dist2 < min_dist1) {
			min_dist1 = min_dist2;
			proc.SetName(Process::TPP);
			pt.SetEnergy(Etarget[1]);
			proc.SetTargetParticle(pt);
			proc.SetCMEnergy();
		} else {
			proc.SetName(Process::ICS);
			pt.SetEnergy(Etarget[0]);
			proc.SetTargetParticle(pt);
			proc.SetCMEnergy();
		}
	}    //else e+/e-
	else
		std::cerr << "something wrong in particle type ( " << type
				<< ". Propagation of photons and e+/e- is the only allowed.)"
				<< std::endl;

	return min_dist1;
}
开发者ID:phyytang,项目名称:CRPropa3,代码行数:90,代码来源:Propagation.cpp


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