示例#1
0
void particle_class::process(spectrometer_class *spect) {
	double x = this->raw->data.x;
	double y = this->raw->data.y;
	double t = this->raw->data.tof;

	// first correct raw data with individual correction parameters
	x += cor.dx;
	x *= cor.x_stretch;
	x *= cor.overall_stretch;

	y += cor.dy;
	y *= cor.y_stretch;
	y *= cor.overall_stretch;

	t += cor.dt;
	
	// calculate momenta
	this->phy->mom.x = calc_px(t, x, y, this->raw->m, this->raw->q, spect->Bfield_ns, spect->Bfield_clockwise);
	this->phy->mom.y = calc_py(t, x, y, this->raw->m, this->raw->q, spect->Bfield_ns, spect->Bfield_clockwise);

	if(this->raw->m < 1.0) { 
		this->phy->mom.z = tof2mom_3accel(t, spect->electron_side->lengths[0], spect->electron_side->lengths[1], spect->electron_side->lengths[2], spect->electron_side->Efields[0], spect->electron_side->Efields[1], spect->electron_side->Efields[2], fabs(this->raw->q), this->raw->m);
	} else {
		if(spect->ion_side->linear_approximation) {	
			this->phy->mom.z = spect->ion_side->Efields[0] * this->raw->q * t / 124.38;  // according to Markus' diploma thesis
		} else {
			this->phy->mom.z = tof2mom_3accel(t, spect->ion_side->lengths[0], spect->ion_side->lengths[1], spect->ion_side->lengths[2], spect->ion_side->Efields[0], spect->ion_side->Efields[1], spect->ion_side->Efields[2], this->raw->q, this->raw->m);			
		}
	}

	this->phy->mom.mag = sqrt(this->phy->mom.x * this->phy->mom.x + this->phy->mom.y * this->phy->mom.y + this->phy->mom.z * this->phy->mom.z);

	// calculate momentum angles etc.
	this->phy->ang_px.ctheta = this->phy->mom.x / this->phy->mom.mag;
	this->phy->ang_py.ctheta = this->phy->mom.y / this->phy->mom.mag;
	this->phy->ang_pz.ctheta = this->phy->mom.z / this->phy->mom.mag;

	this->phy->ang_px.theta = acos(this->phy->ang_px.ctheta)/PI*180.0;
	this->phy->ang_py.theta = acos(this->phy->ang_py.ctheta)/PI*180.0;
	this->phy->ang_pz.theta = acos(this->phy->ang_pz.ctheta)/PI*180.0;

	this->phy->ang_px.phi = atan2(this->phy->mom.z,this->phy->mom.y)/PI*180.0;
	this->phy->ang_py.phi = atan2(this->phy->mom.x,this->phy->mom.z)/PI*180.0;
	this->phy->ang_pz.phi = atan2(this->phy->mom.y,this->phy->mom.x)/PI*180.0;

	// calculate energy
	this->phy->energy = this->phy->mom.mag * this->phy->mom.mag / (2.0 * this->raw->m * MASSAU) * EVAU;  

}
示例#2
0
文件: pci_dma.c 项目: 03199618/linux
static unsigned long *dma_walk_cpu_trans(unsigned long *rto, dma_addr_t dma_addr)
{
	unsigned long *sto, *pto;
	unsigned int rtx, sx, px;

	rtx = calc_rtx(dma_addr);
	sto = dma_get_seg_table_origin(&rto[rtx]);
	if (!sto)
		return NULL;

	sx = calc_sx(dma_addr);
	pto = dma_get_page_table_origin(&sto[sx]);
	if (!pto)
		return NULL;

	px = calc_px(dma_addr);
	return &pto[px];
}