#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 "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 "PndDrcOptReflAbs.h" #include "PndDrcSurfAbs.h" #include "PndDrcSurfPolyFlat.h" #include "PndDrcOptReflPerfect.h" #include "PndDrcOptMatAbs.h" #include "PndDrcOptMatLithotecQ0.h" #include "PndDrcOptDev.h" #include "PndDrcOptDevSys.h" #include "PndDrcOptVol.h" #include "PndDrcOptDevManager.h" int main() { // 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.setName("segment"); psegment.setVerbosity(verbosity); PndDrcOptDevSys psystem; psystem.addDevice(psegment); psystem.setName("sys_segment"); // reproduce the system nsegs times (system = segment + mirror) PndDrcOptDevSys psys[nsegs]; PndDrcOptDevSys total_sys; total_sys.setName("total"); for (int i=0; iSetRange(-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();"<