Changeset 7173 for trunk/MagicSoft/Mars/mhflux
- Timestamp:
- 06/28/05 10:22:44 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mhflux
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhflux/MHDisp.cc
r7145 r7173 64 64 // 65 65 MHDisp::MHDisp(const char *name, const char *title) 66 : fHilExt(0), fDisp(0) 66 : fHilExt(0), fDisp(0)//, fIsWobble(kFALSE) 67 67 { 68 68 // … … 78 78 fHist.SetXTitle("x [\\circ]"); 79 79 fHist.SetYTitle("y [\\circ]"); 80 fHist.SetZTitle(" \\vartheta [deg^{2}]");80 fHist.SetZTitle("Eq.cts"); 81 81 } 82 82 … … 130 130 return kFALSE; 131 131 } 132 133 //const Double_t xmax = fHist.GetXaxis()->GetXmax(); 132 134 133 135 // Initialize all bins with a small (=0) value otherwise 134 136 // these bins are not displayed 135 137 for (int x=0; x<fHist.GetNbinsX(); x++) 136 for (int y=0; y<fHist.GetNbinsX(); y++) 137 fHist.Fill(fHist.GetXaxis()->GetBinCenter(x+1), 138 fHist.GetYaxis()->GetBinCenter(y+1), 139 0.0, 1e-10); 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 } 140 145 141 146 return kTRUE; … … 160 165 rho = fPointPos->RotationAngle(*fObservatory, *fTime); 161 166 167 // FIXME: Do wobble-rotation when subtracting? 168 if (!fHistOff/* && fIsWobble*/) 169 rho += TMath::Pi(); 170 162 171 // Get Disp from Parlist 163 172 const Double_t disp = fDisp->GetVal(); 164 173 165 // Calculate where disp is pointing174 // Calculate both postiions where disp could point 166 175 TVector2 pos1(hil->GetCosDelta(), hil->GetSinDelta()); 167 176 TVector2 pos2(hil->GetCosDelta(), hil->GetSinDelta()); 168 pos1 *= disp; 169 pos2 *= -disp; 170 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 171 181 pos1 += hil->GetMean()*fMm2Deg; 172 182 pos2 += hil->GetMean()*fMm2Deg; … … 207 217 srcp = fSrcPos->GetXY(); 208 218 219 // Derotate all position around camera center by -rho 209 220 if (rho!=0) 210 221 { … … 214 225 } 215 226 227 // Shift the source position to 0/0 216 228 pos1 -= srcp*fMm2Deg; 217 229 pos2 -= srcp*fMm2Deg; 218 230 219 fHist.Fill(pos1.X(), pos1.Y(), 0.0, w*gweight); 220 fHist.Fill(pos2.X(), pos2.Y(), 0.0, w*(1-gweight)); 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)); 221 238 222 239 return kTRUE; 223 240 } 224 /* 225 static Double_t FcnGauss2d(Double_t *x, Double_t *par) 226 { 227 TVector2 v = TVector2(x[0], x[1]).Rotate(par[5]*TMath::DegToRad()); 228 229 const Double_t g0 = TMath::Gaus(v.X(), par[1], par[2]); 230 const Double_t g1 = TMath::Gaus(v.Y(), par[3], par[4]); 231 232 //Gaus(Double_t x, Double_t mean=0, Double_t sigma=1, Bool_t norm=kFALSE); 233 return par[0]*g0*g1 + par[6]*(v.X()*v.X() + v.Y()*v.Y()) + par[7]; 234 }*/ 241 242 Double_t MHDisp::GetOffSignal(TH1 &h) const 243 { 244 const TAxis &axex = *h.GetXaxis(); 245 const TAxis &axey = *h.GetYaxis(); 246 247 Double_t sum = 0; 248 for (int x=0; x<h.GetNbinsX(); x++) 249 for (int y=0; y<h.GetNbinsY(); y++) 250 { 251 if (TMath::Hypot(axex.GetBinCenter(x+1), axey.GetBinCenter(y+1))>0.35) 252 sum += h.GetBinContent(x+1,y+1); 253 } 254 255 return sum; 256 } 235 257 236 258 void MHDisp::Paint(Option_t *o) … … 240 262 pad->cd(1); 241 263 264 // Project on data onto yx-plane 242 265 fHist.GetZaxis()->SetRange(0,9999); 243 266 TH1 *h1=fHist.Project3D("yx_on"); 244 gStyle->SetPalette(1, 0); 267 268 // Set Glow-palette (PaintSurface doesn't allow more than 99 colors) 269 MH::SetPalette(fHistOff?"glowsym":"glow1", 99); 270 h1->SetContour(99); 271 272 Double_t scale = 1; 273 if (fHistOff) 274 { 275 // Project off data onto yx-plane and subtract it from on-data 276 fHistOff->GetZaxis()->SetRange(0,9999); 277 TH1 *h=fHistOff->Project3D("yx_off"); 278 279 scale = -1; 280 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); 289 delete h; 290 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 } 245 303 246 304 Int_t ix, iy, iz; … … 304 362 const Double_t s = MMath::SignificanceLiMa(e, b); 305 363 306 h2->SetTitle(Form("P=(%.2f\\circ/%.2f\\circ) \\omega=%.2f\\circ \\sigma=%.1f E=%.0f B=%.0f ", x0, y0, func.GetParameter(2), s, e-b, b));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)); 307 365 } 308 366 /* … … 386 444 h->Draw(); 387 445 } 446 447 // -------------------------------------------------------------------------- 448 // 449 // The following resources are available: 450 // 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)) 458 { 459 rc = kTRUE; 460 SetMinDist(GetEnvValue(env, prefix, "DistMin", fMinDist)); 461 } 462 if (IsEnvDefined(env, prefix, "DistMax", print)) 463 { 464 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)); 477 } 478 479 return rc; 480 } 481 */ -
trunk/MagicSoft/Mars/mhflux/MHDisp.h
r7114 r7173 13 13 { 14 14 private: 15 MHillasExt *fHilExt; //!16 MParameterD *fDisp; //!15 MHillasExt *fHilExt; //! 16 MParameterD *fDisp; //! 17 17 18 Double_t fM3lCut; //! 19 Double_t fXi; //! 20 Double_t fXiTheta; //! 18 Double_t fM3lCut; //! 19 Double_t fXi; //! 20 Double_t fXiTheta; //! 21 22 //Bool_t fIsWobble; 23 24 // MHDisp 25 Double_t GetOffSignal(TH1 &h) const; 21 26 22 27 public: … … 27 32 Bool_t Fill(const MParContainer *par, const Stat_t w=1); 28 33 34 // TObject 29 35 void Paint(Option_t *o=""); 30 36 void Draw(Option_t *o=""); 37 38 // MParContainer 39 //Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE); 31 40 32 41 ClassDef(MHDisp, 1) //3D-histogram in alpha, x and y
Note:
See TracChangeset
for help on using the changeset viewer.