Ignore:
Timestamp:
01/15/04 13:58:31 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhist/MHCamera.cc

    r2810 r2812  
    9595//  Default Constructor. To be used by the root system ONLY.
    9696//
    97 MHCamera::MHCamera() : TH1D(), fGeomCam(NULL), fColors(kItemsLegend), fYProj(NULL)
     97MHCamera::MHCamera() : TH1D(), fGeomCam(NULL), fColors(kItemsLegend)
    9898{
    9999    Init();
     
    474474TH1D *MHCamera::Projection(const char *name) const
    475475{
     476
     477    Int_t nbins = 50;
     478
    476479    // Create the projection histogram
    477480    TString pname(name);
     
    495498        Int_t newbins=0;
    496499
    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);
    500503
    501504        h1->SetXTitle(GetYaxis()->GetTitle());
     
    516519
    517520    return h1;
    518 }
    519 
    520 // ------------------------------------------------------------------------
    521 // Will be removed in the future
    522 void MHCamera::CreateProjection()
    523 {
    524     Int_t nbins = 50;
    525 
    526     // Create the projection histogram
    527     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 histogram
    535     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     }
    541521}
    542522
     
    689669    if (opt.Contains("proj"))
    690670    {
    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;
    701674    }
    702675   
Note: See TracChangeset for help on using the changeset viewer.