#include using std::cout; using std::cerr; using std::cin; using std::endl; #include using std::valarray; #include using std::vector; #include using std::string; #include using std::list; #include using std::map; #include #include using std::fstream; #include using std::pair; //#include #include "TObject.h" #include "TVector3.h" #include "Math/Vector3D.h" using ROOT::Math::XYZVector; #include "Math/Point3D.h" using ROOT::Math::XYZPoint; #include "Math/Transform3D.h" using ROOT::Math::Transform3D; #include "Math/RotationX.h" using ROOT::Math::RotationX; #include "Math/RotationY.h" using ROOT::Math::RotationY; #include "Math/RotationZ.h" using ROOT::Math::RotationZ; #include "Math/Rotation3D.h" using ROOT::Math::Rotation3D; #include "PndDrcPhoton.h" #include "PndDrcOptMatAbs.h" #include "PndDrcOptDev.h" #include "PndDrcUtil.h" //---------------------------------------------------------------------- PndDrcPhoton::PndDrcPhoton() { m_lambda = 0; m_position = XYZPoint(0,0,0); m_positionOld = XYZPoint(0,0,0); m_direction = XYZPoint(0,0,0); m_fate = Drc::PhotFlying; m_reflections = 0; m_verbosity = 0; m_time = 0; m_dev = 0; } //---------------------------------------------------------------------- void PndDrcPhoton::setPosition(const XYZPoint& pos) { if (m_dev && m_dev->radiator()) // no flat device { double n = (m_dev->optMaterial()).refIndex(m_lambda); double dndl = (m_dev->optMaterial()).refIndexDeriv(m_lambda); double len = sqrt((pos-m_position).Mag2()); // mm double v_phase = 299.792/n; double v_group = v_phase * ( 1.0 - m_lambda/n*dndl); double time = len/v_group; m_time += time; // pos in mm time in ns } m_positionOld = m_position; m_position = pos; }; //---------------------------------------------------------------------- bool PndDrcPhoton::refract(XYZVector normal, double n1, double n2) { static const double eps = 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 (m_reflections==0) return; stream<<" TPolyLine3D *l = new TPolyLine3D(2);"<SetPoint("<<0<<"," <SetPoint("<<1<<"," <SetLineColor("<Draw();"<