#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::pair; #include using std::map; //#include #include "TROOT.h" #include "TRint.h" #include "TVector3.h" #include "TRandom.h" #include "TRotation.h" #include "TFile.h" #include "TH1F.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 "PndDrcEffiPerfect.h" #include "PndDrcPhoton.h" #include "PndDrcSurfPolyFlat.h" #include "PndDrcOptReflSilver.h" #include "PndDrcOptReflPerfect.h" #include "PndDrcOptMatLithotecQ0.h" #include "PndDrcOptDevSys.h" #include "PndDrcOptVol.h" #include "PndDrcOptDevManager.h" #include "PndDrcOptBrik.h" #include "PndDrcOptBurle.h" int main(int argc, char *argv[]) { /* Combine several optical systems to one system */ const double pi=3.1415926535; PndDrcOptBrik bar(17,17.5/2,1000); bar.SetOptMaterial(PndDrcOptMatLithotecQ0()); bar.SetName("bar"); bar.Surface("side6")->SetReflectivity(PndDrcOptReflPerfect()); //********** //bar.Surface("side1")->SetPixel(); bar.AddTransform(Transform3D(XYZVector(0,500,0))); PndDrcOptBrik box(600,600,200); box.SetOptMaterial(PndDrcOptMatLithotecQ0()); box.SetName("box"); //box.Surface("side6")->SetReflectivity(PndDrcOptReflSilver()); //box.Surface("side1")->SetPixel(); box.AddTransform(Transform3D(XYZVector(0,0,-1200))); // bar + 1/2 box PndDrcOptDevSys opt_sys_box; opt_sys_box.AddDevice(box); // box side6 is to couple to the bars opt_sys_box.SetNameCopyNumber("sysbox",0); PndDrcOptDevSys opt_sys_bar; opt_sys_bar.AddDevice(bar); // box side6 is to couple to the bars PndDrcOptDevSys opt_system; opt_system.AddDeviceSystem(opt_sys_box); for (int ibar=0; ibar<90; ibar++) { opt_sys_bar.AddTransform(Transform3D(RotationZ(pi/180.*4))); opt_sys_bar.SetNameCopyNumber("sysbar",ibar); opt_system.AddDeviceSystem(opt_sys_bar); opt_system.CoupleDeviceSystem("sysbar","sysbox","bar","box","side1","side6",ibar); } // 16x16 array of burles double wp = 58; double ws = (1200 - 16*wp)/15; int icnt1=0; PndDrcEffiPerfect effi; for (int ix=0; ix<16; ix++) { for (int iy=0; iy<16; iy++) { //int ix=0,iy=0; PndDrcOptBurle burle; //burle.SetEffi(effi); // default is bialkali //burle.SetPosCorr(false); // default is turned on. burle.AddTransform( Transform3D(XYZVector(-600+wp/2 + ix*(wp+ws), -600+wp/2 + iy*(wp+ws),-1400))); burle.SetNameCopyNumber("burle",icnt1); opt_system.AddDeviceSystem(burle); //opt_system.Print(); opt_system.CoupleDeviceSystem("burle","sysbox","housing","box", "front","side1",icnt1); icnt1++; } } //opt_system.Print(); // The manager must be created as pointer. It is created as singleton, that is only // one manager can exist per application. PndDrcOptDevManager* manager = new PndDrcOptDevManager(); //manager->SetVerbosity(5); 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);"<Print(geo); // // the intention is to play around with routines. // create a list of photons in bar XYZPoint pos(0,-10,0); XYZVector dir(0,1,1); double beta = 0.85; bool photons_exist = manager->Cerenkov(pos,dir,beta); // gen.photons if (photons_exist) manager->Propagate(); // propagate photons list list_photon = manager->PhotonList(); // get list // propagate writes to geo, that has finished, therefore, close geo geo<<"}"<SetCanvasColor(0);" << endl; scr << "gStyle->SetCanvasBorderMode(0);" << endl; scr << "gStyle->SetFrameBorderMode(0);" << endl; scr << "gStyle->SetTitleFillColor(0);" << endl; scr << "gStyle->SetTitleFontSize(0.05);" << endl; scr << "TCanvas *c1 = new TCanvas( \"c1\", \"\" ,200, 10, 700, 500 );" << endl; TString str_beta; str_beta+=beta; str_beta.Remove(TString::kLeading,' '); scr << "TString title;"<SetStats( 0 );" << endl; scr << " hgr->SetMarkerStyle(7);"<SetMarkerSize(0.5);"<SetMinimum(-600);"<SetMaximum(+600);"<Draw(\"POL\");"<::iterator iph; for(iph=list_photon.begin(); iph != list_photon.end(); ++iph) { if ((*iph).Fate()==Drc::kPhotMeasured) icnt_measured++; else if ((*iph).Fate()==Drc::kPhotFlying) icnt_flying++; // should never happen. else if ((*iph).Fate()==Drc::kPhotAbsorbed) { icnt_absorbed++; XYZPoint pos = (*iph).Position(); double z = pos.Z(); absorpt1[(int)((z+1500)/100+0.5)]++; // -150cm ... 150cm steps of 10 cm } else icnt_lost++; if ((*iph).Fate()==Drc::kPhotMeasured) { XYZPoint pos = (*iph).Position(); double x = pos.X(); double y = pos.Y(); scr<<" TMarker* t = new TMarker("<SetMarkerStyle(7);"<SetMarkerColor("<<(*iph).ColorNumber((*iph).Wavelength())<<");"<SetMarkerSize(0.7);"<Draw();"<