Ignore:
Timestamp:
12/12/03 09:41:11 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhist
Files:
2 edited

Legend:

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

    r2661 r2662  
    6565MHCalibrationPixel::MHCalibrationPixel(const char *name, const char *title)
    6666      : fPixId(-1),
    67         fHiGainvsLoGain(NULL),
    6867        fTotalEntries(0),
    6968        fHiGains(NULL),
     
    7170        fChargeGausFit(NULL),
    7271        fTimeGausFit(NULL),
     72        fHivsLoGain(NULL),
    7373        fFitLegend(NULL),
    7474        fLowerFitRange(-2000.),
     
    166166  delete fHChargevsNLoGain;
    167167
    168   if (fHiGainvsLoGain)
    169     delete fHiGainvsLoGain;
    170 
    171168  delete fHiGains;
    172169  delete fLoGains;
     
    178175  if (fFitLegend)
    179176    delete fFitLegend;
     177  if (fHivsLoGain)
     178    delete fHivsLoGain;
     179
    180180
    181181}
     
    379379{
    380380
    381   if (!fHiGainvsLoGain)
    382     {
    383 
    384     // Create TGraph, we set the points later, get hold of the number of points with fTotalEntries
    385     fHiGainvsLoGain = new TGraph(fTotalEntries,fHiGains->GetArray(),fLoGains->GetArray());
    386     fHiGainvsLoGain->SetName("HiGainvsLoGain");
    387     fHiGainvsLoGain->SetTitle("Plot the High Gain vs. Low Gain");
    388     fHiGainvsLoGain->GetXaxis()->Set(300,0.,1500.);
    389     fHiGainvsLoGain->GetYaxis()->Set(400,0.,2000.);
    390     fHiGainvsLoGain->GetXaxis()->SetTitle("Sum of Charges High Gain");
    391     fHiGainvsLoGain->GetYaxis()->SetTitle("Sum of Charges Low Gain");
    392     fHiGainvsLoGain->SetMarkerStyle(7);
    393 
    394     }
    395 
    396   TProfile *hist = new TProfile("PePe","Shit is still moving",100,0.,1000.,0.,1000.);
    397 
    398   for (Int_t i=0;i<fTotalEntries;i++)
    399       hist->Fill(fHiGains->At(i),fLoGains->At(i),1);
    400 
     381  if (!fHivsLoGain)
     382    FitHiGainvsLoGain();
     383     
     384 
    401385  gStyle->SetOptFit(0);
    402386  gStyle->SetOptStat(1111111);
    403    
    404     TCanvas *c = MakeDefCanvas(this,600,900);
    405 
    406     gROOT->SetSelectedPad(NULL);
    407 
     387 
     388  TCanvas *c = MakeDefCanvas(this,600,900);
     389 
     390  gROOT->SetSelectedPad(NULL);
     391 
    408392    c->Divide(2,4);
    409393
     
    440424        gROOT->SetSelectedPad(NULL);
    441425        gStyle->SetOptFit();
    442         //      fHiGainvsLoGain->DrawClone("Apq")->SetBit(kCanDelete);
    443         //      fHiGainvsLoGain->Fit("p1","q");
    444         hist->Draw("prof");
    445         hist->Fit("pol1","pepe","markus",hist->GetMean()-3.*hist->GetRMS(),hist->GetMean()+2.*hist->GetRMS());
    446 
    447         fOffset = hist->GetFunction("pepe")->GetParameter(0);
    448         fSlope  = hist->GetFunction("pepe")->GetParameter(1);
    449 
    450         cout << "Pepe: " << fOffset << " Markus: " << fSlope << endl;
     426        fHivsLoGain->Draw("prof");
    451427
    452428
     
    484460        gROOT->SetSelectedPad(NULL);
    485461        gStyle->SetOptFit();
    486         hist->Draw("prof");
    487         hist->Fit("p1","pepe","markus",hist->GetMean()-3.*hist->GetRMS(),hist->GetMean()+3.*hist->GetRMS());
    488         //      fHiGainvsLoGain->DrawClone("Apq")->SetBit(kCanDelete);
    489         //      fHiGainvsLoGain->Fit("p1","q");
     462        fHivsLoGain->Draw("prof");
    490463        gPad->Modified();
    491464        gPad->Update();
     
    563536}
    564537
     538void MHCalibrationPixel::FitHiGainvsLoGain()
     539{
     540
     541  if (fHivsLoGain)
     542    return;
     543
     544  gStyle->SetOptFit();
     545
     546  fHivsLoGain = new TProfile("HiGainvsLoGain","Plot the High Gain vs. Low Gain",100,0.,1000.,0.,1000.);
     547  fHivsLoGain->GetXaxis()->SetTitle("Sum of Charges High Gain");
     548  fHivsLoGain->GetYaxis()->SetTitle("Sum of Charges Low Gain");
     549 
     550  for (Int_t i=0;i<fTotalEntries;i++)
     551    fHivsLoGain->Fill(fHiGains->At(i),fLoGains->At(i),1);
     552 
     553  fHivsLoGain->Fit("pol1","rq","",fHivsLoGain->GetMean()-2.5*fHivsLoGain->GetRMS(),fHivsLoGain->GetMean()+2.*fHivsLoGain->GetRMS());
     554 
     555  fOffset = fHivsLoGain->GetFunction("pol1")->GetParameter(0);
     556  fSlope  = fHivsLoGain->GetFunction("pol1")->GetParameter(1);
     557 
     558}
    565559
    566560
  • trunk/MagicSoft/Mars/mhist/MHCalibrationPixel.h

    r2661 r2662  
    1818#endif
    1919
    20 #ifndef ROOT_TGraph
    21 #include "TGraph.h"
     20#ifndef ROOT_TProfile
     21#include "TProfile.h"
    2222#endif
    2323
     
    3636
    3737  Int_t fPixId;                  // Pixel Nr
    38   TGraph *fHiGainvsLoGain;       //! Plot the HiGain vs. the LoGain
    3938  Int_t fTotalEntries;           // Number of entries
    4039
     
    5554  TF1* fTimeGausFit;
    5655 
     56  TProfile* fHivsLoGain;
     57
    5758  TPaveText *fFitLegend; 
    5859 
     
    102103
    103104  void   SetPointInGraph(Float_t qhi, Float_t qlo);
     105  void   FitHiGainvsLoGain();
    104106
    105107  Bool_t FillChargeLoGain(Float_t q)             { return (fHChargeLoGain->Fill(q) > -1); }
Note: See TracChangeset for help on using the changeset viewer.