//#include //#include //#include #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 "TROOT.h" #include "TRint.h" #include "TVector3.h" #include "TRandom.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 "PndDrcSurfPolyFlat.h" #include "PndDrcSurfCyl.h" #include "PndDrcOptReflSilver.h" #include "PndDrcOptMatLithotecQ0.h" #include "PndDrcOptDevSys.h" #include "PndDrcOptVol.h" #include "PndDrcOptDevManager.h" int main(int argc, char *argv[]) { //const double pi = 3.1415926535; int verbosity = 0; // 0=quiet, 1=constructors,2=member,3=functionality // 4=photons, 5=everything. // 8 points define a bar XYZPoint p1(-1500.0, 490+8.5, 1000); // p5----------p8 XYZPoint p2(-1500.0, 490-8.5, 1000); // /| /| XYZPoint p3(+1500.0, 490-8.5, 1000); // / | / | XYZPoint p4(+1500.0, 490+8.5, 1000); // / p6-------/--p7 // / / / / // / / / / // / / / / // / / / / XYZPoint p5(-1500.0, 490+8.5, -1000); // p1---------p4 / XYZPoint p6(-1500.0, 490-8.5, -1000); // | / | / XYZPoint p7(+1500.0, 490-8.5, -1000); // |/ |/ XYZPoint p8(+1500.0, 490+8.5, -1000); // p2---------p3 // Define from points 6 surfaces of the bar. The points have to be given in // the sequence going around the surface, clock- or counterclock-wise. // There are 2 additional surfaces, a mirror and a screen. // How to produce surfaces by shift and rotate operation is for sake of clearness // not shown here, but in one of the other examples. PndDrcOptReflSilver refl; // Declare flat surfaces with arbitrary number of points. PndDrcSurfPolyFlat a1,a2,a3,a4,a5,a6; a1.SetVerbosity(verbosity); a1.SetReflectivity(refl); a1.AddPoint(p1); a1.AddPoint(p2); a1.AddPoint(p3); a1.AddPoint(p4); a1.SetName("pfront"); a2.SetVerbosity(verbosity); a2.AddPoint(p2); a2.AddPoint(p6); a2.AddPoint(p7); a2.AddPoint(p3); a2.SetName("pside1"); a3.SetVerbosity(verbosity); a3.AddPoint(p1); a3.AddPoint(p5); a3.AddPoint(p6); a3.AddPoint(p2); a3.SetName("pside2"); a4.SetVerbosity(verbosity); a4.AddPoint(p4); a4.AddPoint(p3); a4.AddPoint(p7); a4.AddPoint(p8); a4.SetName("pside3"); a5.SetVerbosity(verbosity); a5.AddPoint(p1); a5.AddPoint(p4); a5.AddPoint(p8); a5.AddPoint(p5); a5.SetName("pside4"); a6.SetVerbosity(verbosity); a6.AddPoint(p8); a6.AddPoint(p7); a6.AddPoint(p6); a6.AddPoint(p5); a6.SetPixel(); a6.SetPrintColor(2); a6.SetName("pback"); PndDrcSurfPolyFlat as; as = a6; as.SetName("screen_front"); as.SetPrintColor(2); // root red // create a volume consiting of surfaces // create a material the bar will consist of PndDrcOptVol bar; PndDrcOptMatLithotecQ0 quartz; bar.SetVerbosity(verbosity); bar.SetOptMaterial(quartz); bar.AddSurface(a1); bar.AddSurface(a2); bar.AddSurface(a3); bar.AddSurface(a4); bar.AddSurface(a5); bar.AddSurface(a6); bar.SetName("bar"); PndDrcOptDevSys opt_system; opt_system.SetVerbosity(verbosity); opt_system.AddDevice(bar); // The manager must be created as pointer. It is created as singleton, that is only // one manager can exist per application. PndDrcOptDevManager manager; manager.SetVerbosity(verbosity); manager.AddDeviceSystem(opt_system); fstream geo; geo.open("Geo.C",std::ios::out); geo<<"{"<GetVersionInt() < 51600) { geo<<" TView *view = new TView(1);"<SetRange(-1000,-1000,-1000,1000,1000,1000);"<SetView(0,90,90,i);"<SetMarkerStyle(20);"<SetMinimum(-100);"<SetMaximum(+100);"<Draw(\"POL\");"<SetMarkerStyle(20);"<SetMinimum(0);"<SetMaximum(50);"<Draw(\"POL\");"< list_photon = manager.PhotonList(); // get list list::iterator iph; for (iph = list_photon.begin(); iph != list_photon.end(); ++iph) { //cout<<(*iph).fate()<SetMarkerColor(" <<(*iph).ColorNumber((*iph).Wavelength()) <<");"<SetMarkerSize(0.7);"<Draw();"< pi) phi-=2*pi; //if (phi < -pi) phi+=2*pi; //cout<<(*iph).position().X()<<" "<<(*iph).position().Y()<<" " // <<(*iph).time()<SetMarkerColor(" <<(*iph).ColorNumber((*iph).Wavelength()) <<");"<SetMarkerSize(0.7);"<Draw();"<