Changeset 2812 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 01/15/04 13:58:31 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r2810 r2812 95 95 // Default Constructor. To be used by the root system ONLY. 96 96 // 97 MHCamera::MHCamera() : TH1D(), fGeomCam(NULL), fColors(kItemsLegend) , fYProj(NULL)97 MHCamera::MHCamera() : TH1D(), fGeomCam(NULL), fColors(kItemsLegend) 98 98 { 99 99 Init(); … … 474 474 TH1D *MHCamera::Projection(const char *name) const 475 475 { 476 477 Int_t nbins = 50; 478 476 479 // Create the projection histogram 477 480 TString pname(name); … … 495 498 Int_t newbins=0; 496 499 497 THLimitsFinder::OptimizeLimits( 50, newbins, min, max, kFALSE);498 499 h1 = new TH1D(pname, GetTitle(), 50, min, max);500 THLimitsFinder::OptimizeLimits(nbins, newbins, min, max, kFALSE); 501 502 h1 = new TH1D(pname, GetTitle(), nbins, min, max); 500 503 501 504 h1->SetXTitle(GetYaxis()->GetTitle()); … … 516 519 517 520 return h1; 518 }519 520 // ------------------------------------------------------------------------521 // Will be removed in the future522 void MHCamera::CreateProjection()523 {524 Int_t nbins = 50;525 526 // Create the projection histogram527 TString ytitle(GetYaxis()->GetTitle());528 fYProj = new TH1D(ytitle.Data(),GetTitle(),nbins,GetMinimum()-0.1,GetMaximum()+0.1);529 fYProj->SetXTitle(ytitle.Data());530 fYProj->SetYTitle("Nr. of pixels");531 fYProj->Sumw2();532 fYProj->SetDirectory(NULL);533 534 // Fill the projected histogram535 Double_t cont;536 for (Int_t binx =0;binx<=GetNbinsX()+1;binx++) {537 cont = GetBinContent(binx);538 if (cont)539 fYProj->Fill(cont);540 }541 521 } 542 522 … … 689 669 if (opt.Contains("proj")) 690 670 { 691 CreateProjection(); 692 opt.ReplaceAll("proj", ""); 693 Float_t he = gStyle->GetStatH(); 694 Float_t wi = gStyle->GetStatH(); 695 gStyle->SetStatH(0.4); 696 gStyle->SetStatW(0.25); 697 fYProj->Paint(opt); 698 gStyle->SetStatH(he); 699 gStyle->SetStatW(wi); 700 return; 671 opt.ReplaceAll("proj", ""); 672 Projection(GetName())->Paint(opt); 673 return; 701 674 } 702 675
Note:
See TracChangeset
for help on using the changeset viewer.