Esempio n. 1
0
void findEangHang(const TVector3& antnorm,
                  const TVector3& sourcedir,
                  Float_t& eang,
                  Float_t& hang) {
   // both should already be unit vectors
   
   // E angle projects onto the plane
   const TVector3 w = (antnorm.Dot(sourcedir)) * antnorm;
   const TVector3 v = sourcedir - w;
   eang = TMath::Abs( TMath::Pi() - v.Theta() );
   
   // H angle projects out of the plane
   hang = TMath::Abs( TMath::Pi() - w.Theta() );

#ifdef DEBUG
   Printf("w:");
   w.Print();
   Printf("v:");
   v.Print();
#endif

}
double CorrectionPixel(const TVector3 &v0,int iface,int idetector,int ipixel,const TDetector *m_detector){
	double ret=0;

	double n1=1.58;
	double n2=1;

	TVector3 vp,vn,vrel;

	double theta1,theta2;
	double stheta1,stheta2;
	double ctheta1,ctheta2;
	double tpara,tperp;

	vn=m_detector->getFaceNormal(iface);
	vn=-vn; //entering normal

	vp=m_detector->getPosPixel(iface,idetector,ipixel);
	vrel=vp-v0;
	cout<<iface<<" "<<idetector<<" "<<ipixel<<endl;
	v0.Print();
	vp.Print();


	theta1=vrel.Angle(vn);
	stheta1=sin(theta1);
	ctheta1=cos(theta2);


	stheta2=n1*stheta1/n2;
	cout<<theta1<<" "<<stheta1<<" "<<stheta2<<endl;
	if (stheta2>1) ret=0;
	else{
		ctheta2=sqrt(1-stheta2*stheta2);
		theta2=asin(stheta2); //for print
		tpara=((n2*ctheta2)/(n1*ctheta1))*((2*n1*ctheta1)/(n2*ctheta1+n1*ctheta2))*((2*n1*ctheta1)/(n2*ctheta1+n1*ctheta2));
		tperp=((n2*ctheta2)/(n1*ctheta1))*((2*n1*ctheta1)/(n1*ctheta1+n2*ctheta2))*((2*n1*ctheta1)/(n1*ctheta1+n2*ctheta2));
		ret=0.5*(tpara+tperp);
	}

	return ret;
}