Changeset 1428 for trunk/WuerzburgSoft/Thomas/mphys/MParticle.cc
- Timestamp:
- 07/24/02 09:17:52 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WuerzburgSoft/Thomas/mphys/MParticle.cc
r1371 r1428 72 72 } 73 73 74 Double_t MParticle::Planck(Double_t *x, Double_t *k) 74 #include <fstream.h> 75 #include <TH2.h> 76 #include "../mhist/MBinning.h" 77 #include "../mhist/MH.h" 78 79 TH2D *hist2; 80 81 Double_t MParticle::Planck(Double_t *x, Double_t *k=NULL) 82 { 83 static Bool_t isloaded = kFALSE; 84 85 if (!isloaded) 86 { 87 Double_t c = 299792458; // [m/s] 88 Double_t e = 1.602176462e-19; // [C] 89 Double_t h = 1e-9/e*6.62606876e-34; // [GeVs] 90 Double_t hc = h*c; // [GeVm] 91 Double_t konst = 4.*TMath::Pi() * 2. / (hc*hc*hc); 92 93 ifstream fin("background.txt"); 94 95 hist2 = new TH2D; 96 97 MBinning binsz; 98 MBinning binse; 99 binsz.SetEdgesLog(100, 1e-6, 1); // --> 101 Edges / 100 bins 100 binse.SetEdgesLog(100, 7e-15, 3e-8); // --> 101 Edges / 100 bins 101 102 MH::SetBinning(hist2, &binsz, &binse); 103 104 for (int y=0; y<101; y++) 105 { 106 Double_t val; 107 fin >> val; 108 for (int x=0; x<101; x++) 109 { 110 fin >> val; 111 112 val += 9; 113 114 Double_t z = binsz.GetEdges()[x]; 115 Double_t f = z+1; 116 117 Double_t newval = pow(10, val)/konst; 118 hist2->SetBinContent(x, y, newval*f*f*f); 119 120 } 121 } 122 isloaded = kTRUE; 123 } 124 125 // 126 // y = (y1-y0)/(x1-x0) * (x-x0) + y0 127 // 128 Double_t z = k ? k[0] : 0; 129 Double_t E = x[0]; 130 131 Int_t i = hist2->GetXaxis()->FindFixBin(z); 132 Int_t j = hist2->GetYaxis()->FindFixBin(E); 133 134 Double_t z1 = hist2->GetXaxis()->GetBinLowEdge(i+1); 135 Double_t z0 = hist2->GetXaxis()->GetBinLowEdge(i); 136 137 Double_t E1 = hist2->GetYaxis()->GetBinLowEdge(j+1); 138 Double_t E0 = hist2->GetYaxis()->GetBinLowEdge(j); 139 140 Double_t n00 = hist2->GetBinContent(i, j); 141 Double_t n01 = hist2->GetBinContent(i+1, j); 142 Double_t n10 = hist2->GetBinContent(i, j+1); 143 Double_t n11 = hist2->GetBinContent(i+1, j+1); 144 145 Double_t dz = (z-z0)/(z1-z0); 146 Double_t dE = (E-E0)/(E1-E0); 147 148 Double_t n0 = dz*(n01-n00)+n00; 149 Double_t n1 = dz*(n11-n10)+n10; 150 151 Double_t n = dE*(n1-n0)+n0; 152 153 return n; 154 /* 155 // 156 // TANJA2 157 // 158 Double_t E1 = x[0]; 159 Double_t E2 = x[0]/8; 160 return (MParticle::Planck0(&E1, k)+MParticle::Planck0(&E2, k)/40e3)*0.7/0.4; 161 */ 162 /* 163 // 164 // TANJA 165 // 166 Double_t E1 = x[0]; 167 Double_t E2 = x[0]/8; 168 return Planck0(&E1, k)+Planck0(&E2, k)/5e3; 169 */ 170 } 171 172 Double_t MParticle::Planck0(Double_t *x, Double_t *k) 75 173 { 76 174 //
Note:
See TracChangeset
for help on using the changeset viewer.