Ignore:
Timestamp:
04/04/04 17:50:30 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/MHPedestalPix.cc

    r3165 r3642  
    2727//  MHPedestalPix
    2828//
    29 //  Histogram class for pedestal analysis. Holds the histogrammed pedestals,
    30 //  derives from MHGausEvents, perform Fourier analysis
     29//  Histogram class for pedestal analysis.
     30//  Stores and fits the pedestals taken from MPedestalPix on an event-by-event
     31//  basis. The results are re-normalized to a value per slice with the formulae:
     32//
     33// - Mean Pedestal        / slice = Mean Pedestal        / Number slices
     34// - Mean Pedestal Error  / slice = Mean Pedestal Error  / Number slices
     35// - Sigma Pedestal       / slice = Sigma Pedestal       / Sqrt (Number slices)
     36// - Sigma Pedestal Error / slice = Sigma Pedestal Error / Sqrt (Number slices)
     37//
     38//  Derives from MHGausEvents, fits the pedestals to a Gaussian and performs
     39//  a Fourier analysis.
    3140//
    3241//////////////////////////////////////////////////////////////////////////////
     
    4655// Default Constructor.
    4756//
     57// Sets:
     58// - the default number for fNbins        (fgChargeNbins)
     59// - the default number for fFirst        (fgChargeFirst)
     60// - the default number for fLast         (fgChargeLast)
     61//
     62// - the default name of the  fHGausHist ("HPedestalCharge")
     63// - the default title of the fHGausHist ("Distribution of Summed FADC Pedestal slices Pixel ")
     64// - the default x-axis title for fHGausHist ("Sum FADC Slices")
     65// - the default y-axis title for fHGausHist ("Nr. of events")
     66// - TH1::Sumw2() for fHGausHist
     67//
     68// Initializes:
     69// - fNSlices to 1
     70//
    4871MHPedestalPix::MHPedestalPix(const char *name, const char *title)
    49     : fPixId(-1)
     72    : fNSlices(1)
    5073{
    5174
     
    5376  fTitle = title ? title : "Histogrammed Pedestal events";
    5477
    55   SetChargeNbins();
    56   SetChargeFirst();
    57   SetChargeLast();
     78  SetNbins( fgChargeNbins );
     79  SetFirst( fgChargeFirst );
     80  SetLast(  fgChargeLast  );
    5881
    5982  // Create a large number of bins, later we will rebin
     
    6689}
    6790
    68 MHPedestalPix::~MHPedestalPix()
    69 {
    70 }
    71 
    72 void MHPedestalPix::Clear(Option_t *o)
     91// --------------------------------------------------------------------------
     92//
     93// If mean and sigma have not yet been set, returns.
     94//
     95// Renormalizes the pedestal fit results by the following formulae:
     96//
     97// - Mean Pedestal        / slice = Mean Pedestal        / Number slices
     98// - Mean Pedestal Error  / slice = Mean Pedestal Error  / Number slices
     99// - Sigma Pedestal       / slice = Sigma Pedestal       / Sqrt (Number slices)
     100// - Sigma Pedestal Error / slice = Sigma Pedestal Error / Sqrt (Number slices)
     101//
     102void MHPedestalPix::Renorm()
    73103{
    74104
    75   fPixId = -1;
    76   MHGausEvents::Clear();
    77   return;
    78 }
    79 
    80 
    81 
    82 void MHPedestalPix::InitBins()
    83 {
    84 
    85   fHGausHist.SetBins(fChargeNbins,fChargeFirst,fChargeLast);
    86 
    87 }
    88 
    89 
    90 void MHPedestalPix::ChangeHistId(Int_t id)
    91 {
    92 
    93   fPixId = id;
    94 
    95   fHGausHist.SetName(Form("%s%d", fHGausHist.GetName(), id));
    96   fHGausHist.SetTitle(Form("%s%d", fHGausHist.GetTitle(), id));
    97 }
    98 
    99 
    100 void MHPedestalPix::Renorm(const Float_t nslices)
    101 {
    102 
    103   if (!IsGausFitOK())
     105  if (fMean == fMeanErr == fSigma == fSigmaErr == 0.)
    104106    return;
    105107
    106   Float_t sqslices = TMath::Sqrt(nslices);
     108  //
     109  // One never knows...
     110  //
     111  if (fNSlices <= 0)
     112    return;
    107113 
    108   SetMean(GetMean()/nslices);
     114  const Float_t sqslices = TMath::Sqrt(fNSlices);
     115 
     116  SetMean     ( GetMean()    / fNSlices  );
    109117  //
    110118  // Mean error goes with PedestalRMS/Sqrt(entries) -> scale with slices
    111119  //
    112   SetMeanErr(GetMeanErr()/nslices);
     120  SetMeanErr  ( GetMeanErr() / fNSlices  );
    113121  //
    114122  // Sigma goes like PedestalRMS -> scale with sqrt(slices)   
    115123  //
    116   SetSigma(GetSigma()/sqslices);
     124  SetSigma    ( GetSigma()   / sqslices  );
    117125  //
    118   // Sigma error goes like PedestalRMS/2.(entries) -> scale with slices
     126  // Sigma error goes like PedestalRMS/2.(entries) -> scale with sqrt(slices)
    119127  //
    120   SetSigmaErr(GetSigmaErr()/nslices);
     128  SetSigmaErr ( GetSigmaErr() / sqslices );
    121129 
    122130}
Note: See TracChangeset for help on using the changeset viewer.