Changeset 2762 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 01/09/04 22:47:53 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r2698 r2762 103 103 // Default Constructor. To be used by the root system ONLY. 104 104 // 105 MHCamera::MHCamera() : TH1D(), fGeomCam(NULL), fColors(kItemsLegend) 105 MHCamera::MHCamera() : TH1D(), fGeomCam(NULL), fColors(kItemsLegend), fYProj(NULL) 106 106 { 107 107 Init(); … … 116 116 MHCamera::MHCamera(const MGeomCam &geom, const char *name, const char *title) 117 117 : fGeomCam(NULL), /*TH1D(name, title, geom.GetNumPixels(), -0.5, geom.GetNumPixels()-0.5), 118 fUsed(geom.GetNumPixels()),*/ fColors(kItemsLegend)118 fUsed(geom.GetNumPixels()),*/ fColors(kItemsLegend), fYProj(NULL) 119 119 { 120 120 //fGeomCam = (MGeomCam*)geom.Clone(); … … 160 160 { 161 161 if (fGeomCam) 162 162 delete fGeomCam; 163 163 if (fNotify) 164 delete fNotify; 164 delete fNotify; 165 if (fYProj) 166 delete fYProj; 167 165 168 } 166 169 … … 399 402 gPad->SetBorderMode(0); 400 403 404 TString opt(option); 405 opt.ToLower(); 406 401 407 AppendPad(option); 402 408 … … 414 420 // If this makes trouble please write a bug report. 415 421 // 416 TObject *MHCamera::DrawClone(Option_t *option) const 422 TObject *MHCamera::DrawClone(Option_t *option) const 417 423 { 418 424 // Draw a clone of this object in the current pad … … 423 429 424 430 TObject *newobj = Clone(); 431 425 432 if (!newobj) 426 433 return 0; … … 437 444 */ 438 445 439 const TString opt(option); 446 TString opt(option); 447 opt.ToLower(); 448 440 449 newobj->Draw(opt.IsNull() ? GetDrawOption() : option); 441 450 … … 445 454 return newobj; 446 455 } 456 457 void MHCamera::CreateProjection() 458 { 459 460 Int_t nbins = 50; 461 462 // Create the projection histogram 463 TString ytitle(GetYaxis()->GetTitle()); 464 fYProj = new TH1D(ytitle.Data(),GetTitle(),nbins,GetMinimum()-0.1,GetMaximum()+0.1); 465 fYProj->SetXTitle(ytitle.Data()); 466 fYProj->SetYTitle("Nr. of pixels"); 467 fYProj->Sumw2(); 468 fYProj->SetDirectory(NULL); 469 470 // Fill the projected histogram 471 Double_t cont; 472 for (Int_t binx =0;binx<=GetNbinsX()+1;binx++) { 473 cont = GetBinContent(binx); 474 if (cont) 475 fYProj->Fill(cont); 476 } 477 } 478 447 479 448 480 // ------------------------------------------------------------------------ … … 592 624 } 593 625 626 if (opt.Contains("proj")) 627 { 628 629 CreateProjection(); 630 opt.ReplaceAll("proj", ""); 631 fYProj->Paint(opt); 632 return; 633 } 634 594 635 gPad->Clear(); 595 636
Note:
See TracChangeset
for help on using the changeset viewer.