#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 #include using std::fstream; #include using std::list; #include using std::map; #include using std::pair; #include "TROOT.h" #include "TRint.h" #include "TVector3.h" #include "TRandom.h" #include "TRotation.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 "PndDrcOptReflPerfect.h" #include "PndDrcOptMatLithotecQ0.h" #include "PndDrcOptDevSys.h" #include "PndDrcOptVol.h" #include "PndDrcOptDevManager.h" int main(int argc, char *argv[]) { // Example for a simple bar with screen (photon detection) and mirror. //int number_photons = 50; int verbosity = 0; // 0=quiet, 1=constructors,2=member,3=functionality // 4=photons, 5=everything. // create one segment of a disk and reprocuce the other. // // y // | // | // | // 8 7 | // p4-----------------p3 | // \ / 0-----------x // \ / / // \ / / // \ / / // \ 5 / 6 z // p1-----p2 // const int nsegs = 12; // Number of segments double dist_z1 = 200;//mm // distance from beam axis (=z) double dist_z2 = 700;//mm // outer distance from beam. double angle = 2*3.1415926/nsegs; XYZPoint p1(-dist_z1*tan(angle/2), dist_z1, 200); XYZPoint p2(+dist_z1*tan(angle/2), dist_z1, 200); XYZPoint p3(+dist_z2*tan(angle/2), dist_z2, 200); XYZPoint p4(-dist_z2*tan(angle/2), dist_z2, 200); XYZPoint p5(-dist_z1*tan(angle/2), dist_z1, 210); XYZPoint p6(+dist_z1*tan(angle/2), dist_z1, 210); XYZPoint p7(+dist_z2*tan(angle/2), dist_z2, 210); XYZPoint p8(-dist_z2*tan(angle/2), dist_z2, 210); PndDrcSurfPolyFlat pfront; //pfront.SetVerbosity(4); pfront.AddPoint(p1); pfront.AddPoint(p2); pfront.AddPoint(p3); pfront.AddPoint(p4); pfront.SetName("pfront"); PndDrcSurfPolyFlat pback(pfront); // construct from pfront pback.SetVerbosity(verbosity); Transform3D trans1(XYZVector(0,0,+10)); pback.AddTransform(trans1);// and shift it pback.SetName("pback"); PndDrcOptReflPerfect refl; PndDrcSurfPolyFlat pbottom; pbottom.SetReflectivity(refl); pbottom.AddPoint(p1); pbottom.AddPoint(p2); pbottom.AddPoint(p6); pbottom.AddPoint(p5); pbottom.SetName("pbottom"); PndDrcSurfPolyFlat ptop; ptop.AddPoint(p4); ptop.AddPoint(p3); ptop.AddPoint(p7); ptop.AddPoint(p8); ptop.SetPixel(); ptop.SetPrintColor(2); ptop.SetName("ptop"); PndDrcSurfPolyFlat pleft; pleft.SetVerbosity(verbosity); pleft.AddPoint(p1); pleft.AddPoint(p5); pleft.AddPoint(p8); pleft.AddPoint(p4); pleft.SetName("pleft"); PndDrcSurfPolyFlat pright; pright.SetVerbosity(verbosity); pright.AddPoint(p2); pright.AddPoint(p6); pright.AddPoint(p7); pright.AddPoint(p3); pright.SetName("pright"); PndDrcOptVol psegment; PndDrcOptMatLithotecQ0 quartz; psegment.SetOptMaterial(quartz); psegment.AddSurface(pfront); psegment.AddSurface(pback); psegment.AddSurface(pbottom); psegment.AddSurface(ptop); psegment.AddSurface(pleft); psegment.AddSurface(pright); psegment.SetVerbosity(verbosity); PndDrcOptDevSys psystem; psystem.AddDevice(psegment); // reproduce the system nsegs times (system = segment + mirror) PndDrcOptDevSys psys[nsegs]; PndDrcOptDevSys total_sys; total_sys.SetNameCopyNumber("total",0); for (int i=0; iGetVersionInt() < 51600) { geo<<" TView *view = new TView(1);"<SetRange(-500,-500,-500,500,500,500);"<SetView(0,90,90,i);"< list_photon; PndDrcPhoton ph; ph.SetPosition(XYZPoint(0,300,205)); ph.SetDirection(XYZVector(-2,1,0)); ph.SetWavelength(500); list_photon.push_back(ph); bool photons_exist = true; manager.SetPhotonList(list_photon,"segment",0); */ XYZPoint pos(0,0,0); XYZVector dir(0,2,2); bool photons_exist = manager.Cerenkov(pos,dir.Unit(),0.99); // generate photons //bool photons_exist = (photons_exist1 || photons_exist2 || // photons_exist3 || photons_exist4); if (photons_exist) { fstream scr; scr.open("Screen.C",std::ios::out); scr<<"{"<SetMarkerStyle(20);"<SetMinimum(-100);"<SetMaximum(+100);"<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();"<