// ---------------------------------------------------- // This file belongs to the ray tracing framework // for the use with Cherenkov detectors // // created 2007 //----------------------------------------------------- #include "PndDrcPhoton.h" #include "PndDrcOptMatAbs.h" #include "PndDrcOptDev.h" #include using std::cout; //using std::cerr; //using std::cin; using std::endl; //---------------------------------------------------------------------- PndDrcPhoton::PndDrcPhoton() { fLambda = 0; fPosition = XYZPoint(0,0,0); fPositionOld = XYZPoint(0,0,0); fDirection = XYZPoint(0,0,0); fFate = Drc::kPhotFlying; fReflections = 0; fVerbosity = 0; fTime = 0; fDev = 0; fReflectionLimit = 1000; fPrintFlag = true; } //---------------------------------------------------------------------- void PndDrcPhoton::Copy(const PndDrcPhoton& ph) { fLambda = ph.fLambda; fPosition = ph.fPosition; fPositionOld = ph.fPositionOld; fDirection = ph.fDirection; fFate = ph.fFate; fReflections = ph.fReflections; fVerbosity = ph.fVerbosity; fTime = ph.fTime; fDev = ph.fDev; fReflectionLimit = ph.fReflectionLimit; fPrintFlag = ph.fPrintFlag; } //---------------------------------------------------------------------- PndDrcPhoton::PndDrcPhoton(const PndDrcPhoton& ph) { if (ph.fVerbosity>=1) cout<<" PndDrcPhoton::PndDrcPhoton" <<"(const PndDrcPhoton&)"<=1) cout<<" PndDrcPhoton::operator=" <<"(const PndDrcPhoton&) "<Radiator()) // no flat device { double n = (fDev->OptMaterial()).RefIndex(fLambda); double dndl = (fDev->OptMaterial()).RefIndexDeriv(fLambda); double len = sqrt((pos-fPosition).Mag2()); // mm double v_phase = 299.792/n; double v_group = v_phase * ( 1.0 - fLambda/n*dndl); double time = len/v_group; fTime += time; // pos in mm time in ns } fPositionOld = fPosition; fPosition = pos; }; //---------------------------------------------------------------------- bool PndDrcPhoton::Refract(XYZVector normal, double n1, double n2) { static const double kEps = 1.0e-9; bool refract_flag; XYZVector dir1 = Direction(); // norm points outside. XYZVector norm = (dir1.Dot(normal)>0) ? normal : -normal; // // sin(alpha1) n2 // ----------- = -- (Snellius) // sin(alpha2) n1 // // alpaha1, alpha2 > 0 if (Verbosity()>=4) { cout<<" norm="<=4) cout<<" alpha1,n1,n2 = "<=4) cout<<" x,alpha2 = "<=4) { cout<<" dir2 before unit = "<=4) { cout<<" refraction, brought it inside to " < 740) return 50; // dark red else if (lambda> 625) return 2; // red else if (lambda> 590) return 42; // orange else if (lambda> 565) return 5; // yellow else if (lambda> 520) return 3; // green else if (lambda> 500) return 7; // cyan else if (lambda> 450) return 4; // blue else if (lambda> 430) return 9; // indigo else if (lambda> 380) return 39; // violet return 33; // blue grey } //---------------------------------------------------------------------- void PndDrcPhoton::Print(fstream& stream) const { if (fPrintFlag) { stream<<" TPolyLine3D *l = new TPolyLine3D(2);"<SetPoint("<<0<<"," <SetPoint("<<1<<"," <SetLineColor("<Draw();"<