Changeset 1352 for trunk/WuerzburgSoft/Thomas/mphys/phys.C
- Timestamp:
- 06/10/02 08:49:28 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WuerzburgSoft/Thomas/mphys/phys.C
r1349 r1352 6 6 #include <TF1.h> 7 7 #include <TH1.h> 8 #include <TH2.h> 8 9 #include <TList.h> 9 10 #include <TRandom.h> … … 689 690 void DoIt() 690 691 { 691 Double_t rcygnusx3 = 100; //30/3.258; // [~10kpc]692 Double_t rcygnusx3 = 5000; //100; //30/3.258; // [~10kpc] 692 693 693 694 Double_t startz = ZofR(&rcygnusx3); … … 697 698 698 699 //Double_t nphot = 50; 699 Double_t runtime = 1 8*60*60; // [s]700 Double_t runtime = 15*60; ///*18*60*/60; // [s] 700 701 701 702 Double_t lo = 2e4; … … 717 718 718 719 gStyle->SetOptStat(10); 720 721 TH2D position; 722 TH2D angle; 723 TH1D histpos; 724 TH1D hista; 725 726 MBinning binspolx; 727 MBinning binspoly; 728 binspolx.SetEdges(32, -180, 180); 729 binspoly.SetEdgesLog(20, 1e-9, 1e-5); 730 MH::SetBinning(&position, &binspolx, &binspoly); 731 MH::SetBinning(&angle, &binspolx, &binspoly); 732 MH::SetBinning(&histpos, &binspoly); 733 MH::SetBinning(&hista, &binspoly); 734 735 hista.SetTitle("Particle Angle"); 736 angle.SetTitle("Particle Angle"); 737 histpos.SetTitle("Particle Position"); 738 position.SetTitle("Particle Position"); 719 739 720 740 TH1D hist; … … 735 755 MH::SetBinning(&histsrc, &bins); 736 756 737 TH1D hista;738 MBinning binsa;739 binsa.SetEdgesLog(16, 1e-12, 1e-8);740 MH::SetBinning(&hista, &binsa);741 742 757 MH::MakeDefCanvas(); 743 758 … … 791 806 while ((p=(MPhoton*)NextP())) 792 807 { 793 // 794 // Calculate way until interaction takes place 795 // 796 Double_t z = p->GetZ(); 797 Double_t l = rand.Exp(p->GetInteractionLength()); 798 Double_t r = RofZ(&z); 799 800 // 801 // If photon went along us... (l==0: infinite) 802 // 803 if (r<l || l==0) 808 if (!p->SetNewPosition()) 804 809 { 805 cout << (l==0?">":"!") << flush; 810 cout << "!" << flush; 811 806 812 hist.Fill(p->GetEnergy(), p->GetEnergy()); 813 position.Fill(p->GetPhi()*kRad2Deg, p->GetR()); 814 angle.Fill(p->GetPsi()*kRad2Deg, p->GetTheta()*kRad2Deg); 815 histpos.Fill(p->GetR()); 816 hista.Fill(p->GetTheta()*kRad2Deg); 817 807 818 fcas << p->GetEnergy() << endl; 819 808 820 listg.Remove(p); 809 821 continue; 810 822 } 811 812 //813 // Set new z value814 //815 r -= l;816 z = ZofR(&r);817 p->SetZ(z);818 823 819 824 // … … 822 827 MPhoton photon; 823 828 824 phot.SetParameter(0, z);829 phot.SetParameter(0, p->GetZ()); 825 830 photon.SetEnergy(pow(10, phot.GetRandom())); 826 photon.SetAngle(rand.Uniform(TMath::Pi() * 2));827 828 if (!pair.Process(p, &photon, &liste))831 Double_t theta = rand.Uniform(TMath::Pi() * 2); 832 833 if (!pair.Process(p, &photon, theta, &liste)) 829 834 { 830 835 cout << "0" << flush;; … … 832 837 } 833 838 839 listg.Remove(p); 834 840 cout << "." << flush; 835 836 listg.Remove(p);837 841 } 838 842 … … 847 851 { 848 852 cout << ":" << flush; 849 850 hista.Fill(fabs(e->GetAngle()));851 852 853 while(1) 853 854 { 854 Double_t E = e->GetEnergy(); 855 Double_t z = e->GetZ(); 856 Double_t l = rand.Exp(e->GetInteractionLength()); 857 Double_t r = RofZ(&z) - l; 858 859 if (r<0) 855 if (!e->SetNewPosition()) 860 856 { 861 857 cout << "!" << flush; … … 863 859 } 864 860 865 z = ZofR(&r); 866 e->SetZ(z); 867 868 Double_t ep = e->GetEnergyLoss(); 869 870 if (E-ep<lo*5) 861 MPhoton *p = e->DoInvCompton(); 862 if (e->GetEnergy()<lo*5) 871 863 { 872 864 cout << "0" << flush; 865 delete p; 873 866 break; 874 867 } 875 868 876 e->SetEnergy(E-ep); 877 878 if (ep<lo) 869 if (p->GetEnergy()<lo) 879 870 { 880 871 cout << "i" << flush; // ignored 872 delete p; 881 873 continue; 882 874 } 883 /* 884 Double_t eps = 1e-11; // photon vorher 885 886 Double_t E0 = 511e-6; 887 Double_t gamma = E/E0; 888 Double_t gamma2 = gamma*gamma; 889 Double_t beta = sqrt(1-1/gamma2); 890 891 Double_t theta = rand.Uniform(TMath::Pi()*2); 892 893 Double_t p3 = gamma2 * (1-cos(theta)) - ep/E0; 894 895 Double_t a = 1- (1 + ep/(eps*p3)); 896 897 cout << "/" << gamma << "," << p3 << "," << ep << "," << a; 898 cout << "(" << 90-180*(TMath::Pi()-acos(a))/TMath::Pi() <<")" << flush; 899 */ 900 901 MPhoton *p = new MPhoton(ep, z); 875 902 876 listg.Add(p); 903 904 877 cout << "." << flush; 905 878 } … … 912 885 if (now!=timer || n<10) 913 886 { 914 histsrc.SetTitle(Form("E^%.1f, z=%f, T=%d'%d\", N=%d", alpha, startz, (int)runtime/60, (int)runtime%60, n)); 887 histsrc.SetTitle(Form("E^%.1f, z=%f, T=%d'%d\", N=%d", alpha, startz, 888 (int)runtime/60, (int)runtime%60, hist.GetEntries())); 915 889 gPad->Modified(); 916 890 gPad->Update(); … … 943 917 944 918 MH::MakeDefCanvas(); 945 hista.SetXTitle("[rad]"); 919 position.SetXTitle("Pos: \\Phi [\\circ]"); 920 position.SetYTitle("Pos: R [kpc]"); 921 position.DrawCopy("surf1pol"); 922 gPad->SetLogy(); 923 924 MH::MakeDefCanvas(); 925 angle.SetXTitle("Angle: \\Psi [\\circ]"); 926 angle.SetYTitle("Angle: \\Theta [\\circ]"); 927 angle.DrawCopy("surf1pol"); 928 gPad->SetLogy(); 929 930 MH::MakeDefCanvas(); 931 histpos.SetXTitle("R [kpc]"); 932 histpos.SetYTitle("Counts"); 933 histpos.DrawCopy(); 934 gPad->SetLogx(); 935 936 MH::MakeDefCanvas(); 937 hista.SetXTitle("\\Theta [\\circ]"); 938 hista.SetYTitle("Counts"); 946 939 hista.DrawCopy(); 947 940 gPad->SetLogx();
Note:
See TracChangeset
for help on using the changeset viewer.