Changeset 7193
- Timestamp:
- 07/14/05 18:45:35 (19 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r7190 r7193 45 45 - comment have been updated. 46 46 - some old code had been removed 47 48 * mhflux/MHDisp.[h,cc]: 49 - updated with a more appropriate calculation of a background model 47 50 48 51 -
trunk/MagicSoft/Mars/NEWS
r7192 r7193 115 115 more reliable in terms of gain-fluctuations and sudden VCSEL gain 116 116 changes. 117 118 - ganymed: The false source plot (MHDisp) is now based on Disp 119 and a background model determied in the first loop is 120 subtracted 117 121 118 122 - sponde: the zenith angle distribution is now weighted instead of -
trunk/MagicSoft/Mars/mhflux/MHDisp.cc
r7173 r7193 46 46 47 47 #include "MMath.h" 48 #include "MBinning.h" 48 49 49 50 #include "MParList.h" … … 64 65 // 65 66 MHDisp::MHDisp(const char *name, const char *title) 66 : fHilExt(0), fDisp(0) //, fIsWobble(kFALSE)67 : fHilExt(0), fDisp(0), fSmearing(-1), fWobble(kFALSE) 67 68 { 68 69 // … … 72 73 fTitle = title ? title : "3D-plot using Disp vs x, y"; 73 74 74 fHist.SetDirectory(NULL);75 76 75 fHist.SetName("Alpha"); 77 76 fHist.SetTitle("3D-plot of ThetaSq vs x, y"); … … 79 78 fHist.SetYTitle("y [\\circ]"); 80 79 fHist.SetZTitle("Eq.cts"); 80 81 fHist.SetDirectory(NULL); 82 fHistBg.SetDirectory(NULL); 83 fHistBg1.SetDirectory(NULL); 84 fHistBg2.SetDirectory(NULL); 85 86 fHist.SetBit(TH1::kNoStats); 81 87 } 82 88 … … 100 106 } 101 107 102 MParameterD *p = (MParameterD*)plist->FindObject("M3lCut", "MParameterD");103 if (!p)104 {105 *fLog << err << "M3lCut [MParameterD] not found... abort." << endl;106 return kFALSE;107 }108 fM3lCut = TMath::Abs(p->GetVal());109 110 p = (MParameterD*)plist->FindObject("DispXi", "MParameterD");111 if (!p)112 {113 *fLog << err << "DispXi [MParameterD] not found... abort." << endl;114 return kFALSE;115 }116 fXi = p->GetVal();117 118 p = (MParameterD*)plist->FindObject("DispXiTheta", "MParameterD");119 if (!p)120 {121 *fLog << err << "DispXiTheta [MParameterD] not found... abort." << endl;122 return kFALSE;123 }124 fXiTheta = p->GetVal();125 126 108 fHilExt = (MHillasExt*)plist->FindObject("MHillasExt"); 127 109 if (!fHilExt) … … 131 113 } 132 114 133 //const Double_t xmax = fHist.GetXaxis()->GetXmax(); 134 135 // Initialize all bins with a small (=0) value otherwise 136 // these bins are not displayed 137 for (int x=0; x<fHist.GetNbinsX(); x++) 138 for (int y=0; y<fHist.GetNbinsY(); y++) 139 { 140 const Double_t cx = fHist.GetXaxis()->GetBinCenter(x+1); 141 const Double_t cy = fHist.GetYaxis()->GetBinCenter(y+1); 142 //if (TMath::Hypot(cx, cy)<xmax) 143 fHist.Fill(cx, cy, 0.0, 1e-10); 144 } 115 fHilSrc = (MHillasSrc*)plist->FindObject("MHillasSrc"); 116 if (!fHilSrc) 117 { 118 *fLog << err << "MHillasSrc not found... aborting." << endl; 119 return kFALSE; 120 } 121 122 MBinning binsx, binsy; 123 binsx.SetEdges(fHist, 'x'); 124 binsy.SetEdges(fHist, 'y'); 125 MH::SetBinning(&fHistBg, &binsx, &binsy); 126 127 if (!fHistOff) 128 { 129 MH::SetBinning(&fHistBg1, &binsx, &binsy); 130 MH::SetBinning(&fHistBg2, &binsx, &binsy); 131 } 145 132 146 133 return kTRUE; 134 } 135 136 // -------------------------------------------------------------------------- 137 // 138 // Calculate the delta angle between fSrcPos->GetXY() and v. 139 // Return result in deg. 140 // 141 Double_t MHDisp::DeltaPhiSrc(const TVector2 &v) const 142 { 143 return TMath::Abs(fSrcPos->GetXY().DeltaPhi(v))*TMath::RadToDeg(); 147 144 } 148 145 … … 165 162 rho = fPointPos->RotationAngle(*fObservatory, *fTime); 166 163 167 // FIXME: Do wobble-rotation when subtracting? 168 if (!fHistOff/* && fIsWobble*/) 169 rho += TMath::Pi(); 170 171 // Get Disp from Parlist 172 const Double_t disp = fDisp->GetVal(); 173 174 // Calculate both postiions where disp could point 175 TVector2 pos1(hil->GetCosDelta(), hil->GetSinDelta()); 176 TVector2 pos2(hil->GetCosDelta(), hil->GetSinDelta()); 177 pos1 *= disp; // Vector of length disp in direction of shower 178 pos2 *= -disp; // Vector of length -disp in direction of shower 179 180 // Move origin of vector to center-of-gravity of shower 181 pos1 += hil->GetMean()*fMm2Deg; 182 pos2 += hil->GetMean()*fMm2Deg; 183 184 // gammaweight: If we couldn't decide which position makes the 185 // event a gamma, both position are assigned 'half of a gamma' 186 Double_t gweight = 0.5; 187 188 // Check whether our g/h-separation allows to asign definitly 189 // to one unique position. Therefor we requeire that the event 190 // would be considered a gamma for one, but not for the other 191 // position. This can only be the case if the third moment 192 // has a value higher than the absolute cut value. 193 if (TMath::Abs(fHilExt->GetM3Long()*fMm2Deg) > fM3lCut) 194 { 195 // Because at one position the event is considered a gamma 196 // we have to find out which position it is... 197 MSrcPosCam src; 198 MHillasSrc hsrc; 199 hsrc.SetSrcPos(&src); 200 201 // Calculate the sign for one of the desired source positions 202 // The other position must have the opposite sign 203 src.SetXY(pos1/fMm2Deg); 204 if (hsrc.Calc(*hil)>0) 205 { 206 *fLog << warn << "Calculation of MHillasSrc failed." << endl; 207 return kFALSE; 208 } 209 const Double_t m3l = fHilExt->GetM3Long()*TMath::Sign(fMm2Deg, hsrc.GetCosDeltaAlpha()); 210 211 gweight = m3l>fM3lCut ? 1 : 0; 212 } 213 214 // Now we can safly derotate both position... 215 TVector2 srcp; 216 if (fSrcPos) 217 srcp = fSrcPos->GetXY(); 218 219 // Derotate all position around camera center by -rho 220 if (rho!=0) 221 { 164 // Vector of length disp in direction of shower 165 const TVector2 p(hil->GetCosDelta(), hil->GetSinDelta()); 166 167 // Move origin of vector to center-of-gravity of shower and derotate 168 TVector2 pos1 = hil->GetMean()*fMm2Deg + p*fDisp->GetVal(); 169 170 Double_t w0 = 1; 171 if (fWobble) 172 { 173 const Double_t delta = DeltaPhiSrc(pos1); 174 175 // Skip off-data not in the same half than the source (here: anti-source) 176 // Could be replaced by some kind of theta cut... 177 if (!fHistOff) 178 { 179 if (delta>165) 180 return kTRUE; 181 182 // Because afterwards the plots are normalized with the number 183 // of entries the non-overlap region corresponds to half the 184 // contents, the overlap region to full contents. By taking 185 // the mean of both distributions we get the same result than 186 // we would have gotten using full off-events with a slightly 187 // increased uncertainty 188 // FIXME: The delta stuff could be replaced by a 2*antitheta cut... 189 w0 = delta>15 ? 1 : 2; 190 } 191 192 // Define by the source position which histogram to fill 193 if (DeltaPhiSrc(fFormerSrc)>90) 194 fHalf = !fHalf; 195 fFormerSrc = fSrcPos->GetXY(); 196 } 197 198 // If on-data: Derotate source and P. Translate P to center. 199 TVector2 m; 200 if (fHistOff) 201 { 202 // Derotate all position around camera center by -rho 203 // Move origin of vector to center-of-gravity of shower and derotate 222 204 pos1=pos1.Rotate(-rho); 223 pos2=pos2.Rotate(-rho); 224 srcp=srcp.Rotate(-rho); 225 } 226 227 // Shift the source position to 0/0 228 pos1 -= srcp*fMm2Deg; 229 pos2 -= srcp*fMm2Deg; 230 231 //const Double_t xmax = fHist.GetXaxis()->GetXmax(); 232 233 // Fill histograms 234 //if (pos1.Mod()<xmax) 235 fHist.Fill(pos1.X(), pos1.Y(), 0.0, w*gweight); 236 //if (pos2.Mod()<xmax) 237 fHist.Fill(pos2.X(), pos2.Y(), 0.0, w*(1-gweight)); 205 206 // Shift the source position to 0/0 207 if (fSrcPos) 208 { 209 // m: Position of the camera center in the FS plot 210 m = fSrcPos->GetXY().Rotate(-rho)*fMm2Deg; 211 pos1 -= m; 212 } 213 } 214 215 if (fSmearing<=0) 216 { 217 fHist.Fill(pos1.X(), pos1.Y(), 0.0, w*w0); 218 return kTRUE; 219 } 220 221 // ------------------------------------------------- 222 // The following algorithm may look complicated... 223 // It is optimized for speed 224 // ------------------------------------------------- 225 226 // Define a vector used to calculate rotated x and y component 227 const TVector2 rot(TMath::Sin(rho), TMath::Cos(rho)); 228 229 // Fold event position with the PSF and fill it into histogram 230 const TAxis &axex = *fHist.GetXaxis(); 231 const TAxis &axey = *fHist.GetYaxis(); 232 233 const Int_t nx = axex.GetNbins(); 234 const Int_t ny = axey.GetNbins(); 235 236 // normg: Normalization for Gauss [sqrt(2*pi)*sigma]^2 237 const Double_t weight = axex.GetBinWidth(1)*axey.GetBinWidth(1)*w*w0; 238 const Double_t psf = 2*fSmearing*fSmearing; 239 const Double_t pi2 = fSmearing * TMath::Pi()/2; 240 const Double_t normg = pi2*pi2 * TMath::Sqrt(TMath::TwoPi()) / weight; 241 const Int_t bz = fHist.GetZaxis()->FindFixBin(0); 242 243 TH1 &bg = fHalf ? fHistBg1 : fHistBg2; 244 245 // To calculate significance map smear with 2*theta-cut and 246 // do not normalize gauss, for event map use theta-cut/2 instead 247 for (int x=1; x<=nx; x++) 248 { 249 const Double_t cx = axex.GetBinCenter(x); 250 const Double_t px = cx-pos1.X(); 251 252 for (int y=1; y<=ny; y++) 253 { 254 const Double_t cy = axey.GetBinCenter(y); 255 const Double_t sp = Sq(px, cy-pos1.Y()); 256 const Double_t dp = sp/psf; 257 258 // Values below 1e-3 (>3.5sigma) are not filled into the histogram 259 if (dp<4) 260 { 261 const Double_t rc = TMath::Exp(-dp)/normg; 262 if (!fHistOff) 263 bg.AddBinContent(bg.GetBin(x, y), rc); 264 else 265 fHist.AddBinContent(fHist.GetBin(x, y, bz), rc); 266 } 267 268 if (!fHistOff) 269 continue; 270 271 // If we are filling the signal already (fHistOff!=NULL) 272 // we also fill the background by projecting the 273 // background in the camera into the sky plot. 274 const TVector2 v = TVector2(cx+m.X(), cy+m.Y()); 275 276 // Speed up further: Xmax-fWobble 277 if (v.Mod()>axex.GetXmax()) // Gains 10% speed 278 continue; 279 280 const Int_t bx = axex.FindFixBin(v^rot); 281 const Int_t by = axey.FindFixBin(v*rot); 282 const Double_t bg = fHistOff->GetBinContent(bx, by, bz); 283 284 fHistBg.AddBinContent(fHistBg.GetBin(x, y), bg); 285 } 286 } 287 fHist.SetEntries(fHist.GetEntries()+1); 288 289 if (!fHistOff) 290 bg.SetEntries(fHistBg1.GetEntries()+1); 238 291 239 292 return kTRUE; 240 293 } 241 294 295 // -------------------------------------------------------------------------- 296 // 297 // Compile the background in camera coordinates from the two background 298 // histograms 299 // 300 Bool_t MHDisp::Finalize() 301 { 302 if (fHistOff) 303 return kTRUE; 304 305 const Int_t bz = fHist.GetZaxis()->FindFixBin(0); 306 307 const Double_t n1 = fHistBg1.GetEntries(); 308 const Double_t n2 = fHistBg2.GetEntries(); 309 310 for (int x=1; x<=fHist.GetNbinsX(); x++) 311 for (int y=1; y<=fHist.GetNbinsY(); y++) 312 { 313 const Int_t bin1 = fHistBg1.GetBin(x, y); 314 315 const Double_t rc = 316 (n1==0?0:fHistBg1.GetBinContent(bin1)/n1)+ 317 (n2==0?0:fHistBg2.GetBinContent(bin1)/n2); 318 319 fHist.SetBinContent(x, y, bz, rc/2); 320 } 321 322 fHist.SetEntries(n1+n2); 323 324 // Result corresponds to one smeared background event 325 326 return kTRUE; 327 } 328 329 330 // -------------------------------------------------------------------------- 331 // 332 // Return the mean signal in h around (0,0) in a distance between 333 // 0.33 and 0.47deg 334 // 242 335 Double_t MHDisp::GetOffSignal(TH1 &h) const 243 336 { … … 245 338 const TAxis &axey = *h.GetYaxis(); 246 339 340 Int_t cnt = 0; 247 341 Double_t sum = 0; 248 342 for (int x=0; x<h.GetNbinsX(); x++) 249 343 for (int y=0; y<h.GetNbinsY(); y++) 250 344 { 251 if (TMath::Hypot(axex.GetBinCenter(x+1), axey.GetBinCenter(y+1))>0.35) 345 const Double_t d = TMath::Hypot(axex.GetBinCenter(x+1), axey.GetBinCenter(y+1)); 346 if (d>0.33 && d<0.47) 347 //if (d>0.4 && d<0.8) 348 { 252 349 sum += h.GetBinContent(x+1,y+1); 253 } 254 255 return sum; 256 } 350 cnt++; 351 } 352 } 353 354 return sum/cnt; 355 } 356 357 // -------------------------------------------------------------------------- 358 // 359 // Fill h2 with the radial profile of h1 around (x0, y0) 360 // 361 void MHDisp::Profile(TH1 &h2, const TH2 &h1, Axis_t x0, Axis_t y0) const 362 { 363 const TAxis &axex = *h1.GetXaxis(); 364 const TAxis &axey = *h1.GetYaxis(); 365 366 h2.Reset(); 367 368 for (int x=1; x<=axex.GetNbins(); x++) 369 for (int y=1; y<=axey.GetNbins(); y++) 370 { 371 const Double_t dx = axex.GetBinCenter(x)-x0; 372 const Double_t dy = axey.GetBinCenter(y)-y0; 373 374 const Double_t r = TMath::Hypot(dx, dy); 375 376 h2.Fill(r, h1.GetBinContent(x, y)); 377 } 378 } 379 380 // -------------------------------------------------------------------------- 381 // 382 // Remove contents of histogram around a circle. 383 // 384 void MHDisp::MakeDot(TH2 &h2) const 385 { 386 const TAxis &axex = *h2.GetXaxis(); 387 const TAxis &axey = *h2.GetYaxis(); 388 389 const Double_t rmax = fWobble ? axex.GetXmax()-0.4 : axex.GetXmax(); 390 391 for (int x=1; x<=axex.GetNbins(); x++) 392 for (int y=1; y<=axey.GetNbins(); y++) 393 { 394 const Int_t bin = h2.GetBin(x,y); 395 396 const Double_t px = h2.GetBinCenter(x); 397 const Double_t py = h2.GetBinCenter(y); 398 399 if (rmax<TMath::Hypot(px, py)) 400 h2.SetBinContent(bin, 0); 401 } 402 } 403 404 // -------------------------------------------------------------------------- 405 // 406 // Calculate from signal and background the significance map 407 // 408 void MHDisp::MakeSignificance(TH2 &s, const TH2 &h1, const TH2 &h2, const Double_t scale) const 409 { 410 const TAxis &axex = *s.GetXaxis(); 411 const TAxis &axey = *s.GetYaxis(); 412 413 for (int x=1; x<=axex.GetNbins(); x++) 414 for (int y=1; y<=axey.GetNbins(); y++) 415 { 416 const Int_t bin = s.GetBin(x,y); 417 418 const Double_t sig = h1.GetBinContent(bin); 419 const Double_t bg = h2.GetBinContent(bin); 420 421 const Double_t S = MMath::SignificanceLiMaSigned(sig, bg, TMath::Abs(scale)); 422 423 s.SetBinContent(bin, S); 424 } 425 } 426 257 427 258 428 void MHDisp::Paint(Option_t *o) 259 429 { 430 // Compile Background if necessary 431 Finalize(); 432 433 // Paint result 260 434 TVirtualPad *pad = gPad; 261 435 … … 264 438 // Project on data onto yx-plane 265 439 fHist.GetZaxis()->SetRange(0,9999); 266 TH 1 *h1=fHist.Project3D("yx_on");440 TH2 *h1=(TH2*)fHist.Project3D("yx_on"); 267 441 268 442 // Set Glow-palette (PaintSurface doesn't allow more than 99 colors) … … 275 449 // Project off data onto yx-plane and subtract it from on-data 276 450 fHistOff->GetZaxis()->SetRange(0,9999); 277 TH 1 *h=fHistOff->Project3D("yx_off");451 TH2 *h=(TH2*)fHistOff->Project3D("yx_off"); 278 452 279 453 scale = -1; 280 454 281 //if (!fIsWobble) 282 { 283 const Double_t h1off = GetOffSignal(*h1); 284 const Double_t hoff = GetOffSignal(*h); 285 scale = hoff==0?-1:-h1off/hoff; 286 } 287 288 h1->Add(h, scale); 455 const Double_t h1off = GetOffSignal(*h1); 456 const Double_t hoff = GetOffSignal(fHistBg); 457 458 scale = hoff==0 ? -1 : -h1off/hoff; 459 460 const Bool_t sig = kFALSE; 461 462 if (!sig) 463 h1->Add(&fHistBg, scale); 464 else 465 MakeSignificance(*h1, *h1, fHistBg, scale); 466 467 MakeDot(*h1); 468 289 469 delete h; 290 470 291 // Force calculation of minimum, maximum 292 h1->SetMinimum(); 293 h1->SetMaximum(); 294 295 // Find maximum 296 const Double_t max = TMath::Max(TMath::Abs(h1->GetMinimum()), 297 TMath::Abs(h1->GetMaximum())); 298 299 // Set new minimum, maximum 300 h1->SetMinimum(-max); 301 h1->SetMaximum( max); 302 } 303 304 Int_t ix, iy, iz; 305 TF1 func("fcn", "gaus + [3]*x*x + [4]"); 471 MakeSymmetric(h1); 472 } 306 473 307 474 pad->cd(3); 308 475 TH1 *h2 = (TH1*)gPad->FindObject("RadProf"); 309 /* 310 if (!h2) 311 { 312 const Double_t maxr = TMath::Hypot(h1->GetXaxis()->GetXmax(), h1->GetYaxis()->GetXmax()); 313 const Int_t nbin = (h1->GetNbinsX()+h1->GetNbinsY())/2; 314 TProfile *h = new TProfile("RadProf", "Radial Profile", nbin, 0, maxr); 315 //TH1F *h = new TH1F("RadProf", "Radial Profile", nbin, 0, maxr); 316 h->Sumw2(); 317 h->SetXTitle("\\vartheta [\\circ]"); 318 h->SetYTitle("<cts>/\\Delta R"); 319 h->SetBit(kCanDelete); 320 h->Draw(); 321 }*/ 476 477 TString opt(o); 478 opt.ToLower(); 479 322 480 if (h1 && h2) 323 481 { 324 h2->Reset(); 325 482 Int_t ix, iy, iz; 326 483 h1->GetMaximumBin(ix, iy, iz); 327 484 328 485 const Double_t x0 = h1->GetXaxis()->GetBinCenter(ix); 329 486 const Double_t y0 = h1->GetYaxis()->GetBinCenter(iy); 330 const Double_t w0 = h1->GetXaxis()->GetBinWidth(1); 331 332 for (int x=0; x<h1->GetNbinsX(); x++) 333 for (int y=0; y<h1->GetNbinsY(); y++) 334 { 335 const Double_t r = TMath::Hypot(h1->GetXaxis()->GetBinCenter(x+1)-x0, 336 h1->GetYaxis()->GetBinCenter(y+1)-y0); 337 h2->Fill(r, h1->GetBinContent(x+1, y+1)); 338 } 487 //const Double_t w0 = h1->GetXaxis()->GetBinWidth(1); 488 489 Profile(*h2, *h1, 0, 0); 490 //Profile(*h2, *h1, x0, y0); 339 491 340 492 // Replace with MAlphaFitter? 493 TF1 func("fcn", "gaus + [3]*x*x + [4]"); 341 494 func.SetLineWidth(1); 342 495 func.SetLineColor(kBlue); … … 347 500 func.FixParameter(1, 0); 348 501 func.SetParameter(2, 0.15); 349 func.SetParameter(4, h2->GetBinContent(10)); 350 h2->Fit(&func, "IMQ", "", 0, 1.0); 351 352 // No wintegrate the function f(x) per Delta Area 353 // which is f(x)/(pi*delta r*(2*r+delta r)) 354 TF1 func2("fcn2", Form("(gaus + [3]*x*x + [4])/(2*x+%.5f)", w0)); 355 for (int i=0; i<5; i++) 356 func2.SetParameter(i, func.GetParameter(i)); 357 358 const Double_t r0 = 2*func2.GetParameter(2); 359 const Double_t e = func2.Integral(0, r0)/(w0*TMath::Pi()); 360 func2.SetParameter(0, 0); 361 const Double_t b = func2.Integral(0, r0)/(w0*TMath::Pi()); 362 const Double_t s = MMath::SignificanceLiMa(e, b); 363 364 h2->SetTitle(Form("P=(%.2f\\circ/%.2f\\circ) \\omega=%.2f\\circ \\sigma=%.1f E=%.0f B=%.0f f=%.2f", x0, y0, func.GetParameter(2), s, e-b, b, scale)); 365 } 366 /* 367 if (h1) 368 { 369 const Double_t maxr = 0.9*TMath::Abs(fHist.GetXaxis()->GetXmax()); 370 371 TF2 f2d("Gaus2D", FcnGauss2d, -maxr, maxr, -maxr, maxr, 8); 372 f2d.SetLineWidth(1); 373 374 f2d.SetParameter(0, h1->GetMaximum()*5); // A 375 f2d.SetParLimits(1, h1->GetXaxis()->GetBinCenter(ix)-h1->GetXaxis()->GetBinWidth(ix)*5, h1->GetXaxis()->GetBinCenter(ix)+h1->GetXaxis()->GetBinWidth(ix)); // mu_1 376 f2d.SetParLimits(3, h1->GetYaxis()->GetBinCenter(iy)-h1->GetYaxis()->GetBinWidth(iy)*5, h1->GetYaxis()->GetBinCenter(iy)+h1->GetYaxis()->GetBinWidth(iy)); // mu_2 377 f2d.SetParLimits(2, 0, func.GetParameter(2)*5); // sigma_1 378 f2d.SetParLimits(4, 0, func.GetParameter(2)*5); // sigma_2 379 f2d.SetParLimits(5, 0, 45); // phi 380 f2d.SetParLimits(6, 0, func.GetParameter(3)*5); 381 f2d.SetParLimits(7, 0, func.GetParameter(4)*5); 382 383 f2d.SetParameter(0, h1->GetMaximum()); // A 384 f2d.SetParameter(1, h1->GetXaxis()->GetBinCenter(ix)); // mu_1 385 f2d.SetParameter(2, func.GetParameter(2)); // sigma_1 386 f2d.SetParameter(3, h1->GetYaxis()->GetBinCenter(iy)); // mu_2 387 f2d.SetParameter(4, func.GetParameter(2)); // sigma_2 388 f2d.FixParameter(5, 0); // phi 389 f2d.SetParameter(6, func.GetParameter(3)); 390 f2d.SetParameter(7, func.GetParameter(4)); 391 h1->Fit(&f2d, "Q", "cont2"); 392 //f2d.DrawCopy("cont2same"); 393 }*/ 502 if (fHistOff) 503 func.FixParameter(3, 0); 504 func.SetParameter(4, h2->GetBinContent(15)); 505 h2->Fit(&func, "IQ", "", 0, 1.0); 506 507 h2->SetTitle(Form("P=(%.2f\\circ/%.2f\\circ) \\omega=%.2f\\circ f=%.2f", x0, y0, func.GetParameter(2), TMath::Abs(scale))); 508 } 394 509 } 395 510 … … 400 515 pad->SetBorderMode(0); 401 516 402 AppendPad( "");517 AppendPad(o); 403 518 404 519 TString name = Form("%s_1", pad->GetName()); … … 416 531 h3->Draw("colz"); 417 532 h3->SetBit(kCanDelete); 418 // catalog->Draw("mirror same *"); 533 534 if (fHistOff) 535 GetCatalog()->Draw("white mirror same *"); 419 536 420 537 pad->cd(); … … 430 547 p = new TPad(name,name, 0.66, 0.5, 0.995, 0.995, col, 0, 0); 431 548 p->SetNumber(3); 549 p->SetGrid(); 432 550 p->Draw(); 433 551 p->cd(); … … 449 567 // The following resources are available: 450 568 // 451 // MHDisp.Wobble: on/off 452 // 453 /* 454 Int_t MHFalseSource::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 455 { 456 Bool_t rc = kFALSE; 457 if (IsEnvDefined(env, prefix, "DistMin", print)) 569 // MHDisp.Smearing: 0.1 570 // MHDisp.Wobble: on/off 571 // 572 Int_t MHDisp::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 573 { 574 Int_t rc = MHFalseSource::ReadEnv(env, prefix, print); 575 if (rc==kERROR) 576 return kERROR; 577 578 if (IsEnvDefined(env, prefix, "Smearing", print)) 458 579 { 459 580 rc = kTRUE; 460 Set MinDist(GetEnvValue(env, prefix, "DistMin", fMinDist));461 } 462 if (IsEnvDefined(env, prefix, " DistMax", print))581 SetSmearing(GetEnvValue(env, prefix, "Smearing", fSmearing)); 582 } 583 if (IsEnvDefined(env, prefix, "Wobble", print)) 463 584 { 464 585 rc = kTRUE; 465 SetMaxDist(GetEnvValue(env, prefix, "DistMax", fMaxDist)); 466 } 467 468 if (IsEnvDefined(env, prefix, "DWMin", print)) 469 { 470 rc = kTRUE; 471 SetMinDW(GetEnvValue(env, prefix, "DWMin", fMinDist)); 472 } 473 if (IsEnvDefined(env, prefix, "DWMax", print)) 474 { 475 rc = kTRUE; 476 SetMaxDW(GetEnvValue(env, prefix, "DWMax", fMaxDist)); 586 SetWobble(GetEnvValue(env, prefix, "Wobble", fWobble)); 477 587 } 478 588 479 589 return rc; 480 590 } 481 */ 591 -
trunk/MagicSoft/Mars/mhflux/MHDisp.h
r7173 r7193 5 5 #include "MHFalseSource.h" 6 6 #endif 7 #ifndef ROOT_TH2 8 #include <TH2.h> 9 #endif 10 #ifndef ROOT_TVector2 11 #include <TVector2.h> 12 #endif 7 13 8 14 class MParList; 9 15 class MHillasExt; 16 class MHillasSrc; 10 17 class MParameterD; 11 18 … … 13 20 { 14 21 private: 15 MHillasExt *fHilExt; //! 16 MParameterD *fDisp; //! 22 MHillasExt *fHilExt; //! 23 MHillasSrc *fHilSrc; //! 24 MParameterD *fDisp; //! 17 25 18 Double_t fM3lCut; //! 19 Double_t fXi; //! 20 Double_t fXiTheta; //! 26 TH2D fHistBg; 21 27 22 //Bool_t fIsWobble; 28 TH2D fHistBg1; 29 TH2D fHistBg2; 30 31 TVector2 fFormerSrc; 32 Bool_t fHalf; 33 34 Double_t fSmearing; 35 Bool_t fWobble; 23 36 24 37 // MHDisp 25 38 Double_t GetOffSignal(TH1 &h) const; 39 Double_t DeltaPhiSrc(const TVector2 &v) const; 40 41 void Profile(TH1 &h2, const TH2 &h1, Axis_t x0=0, Axis_t y0=0) const; 42 void MakeSignificance(TH2 &s, const TH2 &h1, const TH2 &h2, const Double_t scale=1) const; 43 void MakeDot(TH2 &h2) const; 44 45 Double_t Sq(Double_t x, Double_t y) const { return x*x+y*y; } 26 46 27 47 public: 28 48 MHDisp(const char *name=NULL, const char *title=NULL); 29 49 50 // MHDisp 51 void SetSmearing(Double_t s=-1) { fSmearing=s; } 52 void SetWobble(Bool_t w=kTRUE) { fWobble=w; } 53 54 // MHFalseSource (to be moved!) 55 void SetOffData(const MHFalseSource &fs) 56 { 57 MHFalseSource::SetOffData(fs); 58 if (dynamic_cast<const MHDisp*>(&fs)) 59 { 60 const MHDisp &h = dynamic_cast<const MHDisp&>(fs); 61 fWobble = h.fWobble; 62 fSmearing = h.fSmearing; 63 64 h.fHistBg1.Copy(fHistBg1); 65 h.fHistBg2.Copy(fHistBg2); 66 67 fHistBg1.SetDirectory(0); 68 fHistBg2.SetDirectory(0); 69 } 70 } 71 30 72 // MH 31 73 Bool_t SetupFill(const MParList *pList); 32 74 Bool_t Fill(const MParContainer *par, const Stat_t w=1); 75 Bool_t Finalize(); 33 76 34 77 // TObject … … 37 80 38 81 // MParContainer 39 //Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);82 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE); 40 83 41 ClassDef(MHDisp, 1) //3D-histogram in alpha, x and y84 ClassDef(MHDisp, 2) //Class to provide a Disp map 42 85 }; 43 86
Note:
See TracChangeset
for help on using the changeset viewer.