Changeset 6983 for trunk/MagicSoft/Mars/mhflux
- Timestamp:
- 04/28/05 11:10:12 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhflux/MHEnergyEst.cc
r6954 r6983 45 45 #include "MMcEvt.hxx" 46 46 47 #include "MEnergyEst.h"48 47 #include "MBinning.h" 49 48 #include "MParList.h" … … 156 155 return kTRUE; 157 156 } 158 157 /* 158 #include <TSpline.h> 159 Double_t x[] = {33, 75, 153, 343, 745, 1617, 3509, 7175}; 160 Double_t y[] = {2, 24, 302, 333, 132, 53, 11, 1}; 161 Int_t n = 8; 162 TSpline3 spline("", x, y, n); 163 */ 159 164 // -------------------------------------------------------------------------- 160 165 // … … 180 185 // lg(N0) = 4.3*2.2-6 181 186 182 const Double_t n = 2; //pow(10, -4.3*(log10(etru)-2.2)); 183 184 fChisq += log10(etru)<2.2? res*res*n/2:res*res; 185 fBias += log10(etru)<2.2? res*sqrt(n/2):res; 187 const Double_t n = 2.;///spline.Eval(etru); //pow(10, -4.3*(log10(etru)-2.2)); 188 if (n<=0) 189 return kCONTINUE; 190 191 fChisq += log10(etru)>0 ? res*res*n/2 : res*res; 192 fBias += log10(etru)>0 ? res*sqrt(n/2) : res; 186 193 187 194 return kTRUE; 188 195 } 189 196 /* 197 void MHEnergyEst::CalcChisq(Double_t &chisq, Double_t &prob) const 198 { 199 TH1D *h1 = (TH1D*)fHEnergy.Project3D("dum2_ex"); 200 TH1D *h2 = (TH1D*)fHEnergy.Project3D("dum2_ey"); 201 202 Int_t df = 0; 203 chisq = 0; 204 prob = 0; 205 206 for (Int_t i=1; i<=h1->GetNbinsX(); i++) 207 { 208 if (h1->GetBinContent(i)>0 && h2->GetBinContent(i)>0) 209 { 210 const Double_t bin1 = log10(h1->GetBinContent(i)); 211 const Double_t bin2 = log10(h2->GetBinContent(i)); 212 213 const Double_t temp = bin1-bin2; 214 215 chisq += temp*temp/(bin1+bin2); 216 df ++; 217 } 218 } 219 220 prob = TMath::Prob(0.5*chisq, Int_t(0.5*df)); 221 222 chisq /= df; 223 224 delete h1; 225 delete h2; 226 } 227 */ 190 228 Bool_t MHEnergyEst::Finalize() 191 229 { 230 //Double_t chisq, prob; 231 //CalcChisq(chisq, prob); 232 192 233 fChisq /= GetNumExecutions(); 193 234 fBias /= GetNumExecutions(); 194 235 236 fResult->SetVal(TMath::Sqrt(fChisq)); 237 238 /* 195 239 Double_t sigma = TMath::Sqrt(fChisq);//+TMath::Abs(fBias); 196 240 fResult->SetVal(sigma); 197 241 */ 198 242 Print(); 199 243 … … 225 269 TH1D *h2 = (TH1D*)fHEnergy.Project3D("rtlprmft_ey"); 226 270 227 h 1->Copy(hist);228 hist.Divide(h 2);271 h2->Copy(hist); 272 hist.Divide(h1); 229 273 230 274 delete h1; … … 233 277 hist.SetNameTitle("EnergyRatio", "Ratio between estimated and monte carlo energy"); 234 278 hist.SetXTitle("E [GeV]"); 235 hist.SetYTitle("N_{ est}/N_{mc} [1]");279 hist.SetYTitle("N_{mc}/N_{est} [1]"); 236 280 hist.SetDirectory(0); 237 281 }
Note:
See TracChangeset
for help on using the changeset viewer.