Changeset 3671 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
04/06/04 16:54:53 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3670 r3671  
    154154     - updated and enlarged documentation
    155155
    156    * mcalib/MCalibrationPix.h
     156   * mcalib/MCalibrationPix.[h,cc]
    157157   * mcalib/MHCalibrationChargePINDiode.cc
    158158   * mcalib/MHCalibrationChargeCam.[h,cc]
    159159     - rename Setter for fMeanVar from SetMeanErr() to SetMeanVar()
    160160     - rename arrays of fAverageSigmaErr to AverageSigmaVar
     161     - add Getters to the relative variance
     162
    161163
    162164 2004/04/05: Nadia Tonello
  • trunk/MagicSoft/Mars/mcalib/MCalibrationPix.cc

    r3648 r3671  
    127127// --------------------------------------------------------------------------
    128128//
     129// Get the Relative Variance of either High Gain or Low Gain Mean
     130// depending on IsHighGainSaturation()
     131//
     132// If variance is smaller than 0. return -1.
     133//
     134Float_t MCalibrationPix::GetMeanRelVar()  const
     135{
     136
     137  if (IsHiGainSaturation())
     138    if (fLoGainMeanVar < 0.)
     139      return -1.;
     140    else
     141      return fLoGainMeanVar / (fLoGainMean * fLoGainMean);
     142  else
     143    if (fHiGainMeanVar < 0.)
     144      return -1.;
     145    else
     146      return fHiGainMeanVar / (fHiGainMean * fHiGainMean);
     147}
     148
     149// --------------------------------------------------------------------------
     150//
     151// Get the Relative Variance of either High Gain or Low Gain Sigma
     152// depending on IsHighGainSaturation()
     153//
     154// If variance is smaller than 0. return -1.
     155//
     156Float_t MCalibrationPix::GetSigmaRelVar()  const
     157{
     158
     159  if (IsHiGainSaturation())
     160    if (fLoGainSigmaVar < 0.)
     161      return -1.;
     162    else
     163      return fLoGainSigmaVar / (fLoGainSigma * fLoGainSigma);
     164  else
     165    if (fHiGainSigmaVar < 0.)
     166      return -1.;
     167    else
     168      return fHiGainSigmaVar / (fHiGainSigma * fHiGainSigma);
     169}
     170
     171// --------------------------------------------------------------------------
     172//
    129173// Get the High Gain Mean Error: Takes square root of fHiGainMeanVar
    130174//
    131175Float_t MCalibrationPix::GetHiGainMeanErr()  const
    132176{
    133   return TMath::Sqrt(fHiGainMeanVar);
    134 }
     177  if (fLoGainMeanVar < 0.)
     178    return -1.;
     179
     180  return TMath::Sqrt(fLoGainMeanVar);
     181}
     182
    135183
    136184// --------------------------------------------------------------------------
     
    140188Float_t MCalibrationPix::GetHiGainSigmaErr()  const
    141189{
     190  if (fHiGainSigmaVar < 0.)
     191    return -1.;
     192
    142193  return TMath::Sqrt(fHiGainSigmaVar);
    143194}
     
    145196// --------------------------------------------------------------------------
    146197//
    147 // Get the Low Gain Mean Error: Takes square root of fHiGainMeanVar
     198// Get the Low Gain Mean Error: Takes square root of fLoGainMeanVar
    148199//
    149200Float_t MCalibrationPix::GetLoGainMeanErr()  const
    150201{
     202  if (fLoGainMeanVar < 0.)
     203    return -1.;
     204
    151205  return TMath::Sqrt(fLoGainMeanVar);
    152206}
    153207
    154 
    155208// --------------------------------------------------------------------------
    156209//
     
    159212Float_t MCalibrationPix::GetLoGainSigmaErr()  const
    160213{
     214  if (fLoGainSigmaVar < 0.)
     215    return -1.;
     216
    161217  return TMath::Sqrt(fLoGainSigmaVar);
    162218}
     
    168224Bool_t MCalibrationPix::IsHiGainSaturation()    const
    169225{
    170    return TESTBIT(fFlags,kHiGainSaturation); 
     226  return TESTBIT(fFlags,kHiGainSaturation); 
    171227}
    172228
  • trunk/MagicSoft/Mars/mcalib/MCalibrationPix.h

    r3647 r3671  
    4141
    4242  void SetHiGainMean      ( const Float_t f ) { fHiGainMean      = f;   }
    43   void SetHiGainMeanErr   ( const Float_t f ) { fHiGainMeanVar   = f*f; }
     43  void SetHiGainMeanVar   ( const Float_t f ) { fHiGainMeanVar   = f; }
    4444  void SetHiGainProb      ( const Float_t f ) { fHiGainProb      = f;   }
    4545  void SetHiGainSigma     ( const Float_t f ) { fHiGainSigma     = f;   }
    46   void SetHiGainSigmaErr  ( const Float_t f ) { fHiGainSigmaVar  = f*f; }
     46  void SetHiGainSigmaVar  ( const Float_t f ) { fHiGainSigmaVar  = f; }
    4747  void SetHiGainNumPickup ( const Float_t f ) { fHiGainNumPickup = f;   }
    4848
    4949  void SetLoGainMean      ( const Float_t f ) { fLoGainMean      = f;   }
    50   void SetLoGainMeanErr   ( const Float_t f ) { fLoGainMeanVar   = f*f; }
     50  void SetLoGainMeanVar   ( const Float_t f ) { fLoGainMeanVar   = f; }
    5151  void SetLoGainProb      ( const Float_t f ) { fLoGainProb      = f;   }
    5252  void SetLoGainSigma     ( const Float_t f ) { fLoGainSigma     = f;   }
    53   void SetLoGainSigmaErr  ( const Float_t f ) { fLoGainSigmaVar  = f*f; }
     53  void SetLoGainSigmaVar  ( const Float_t f ) { fLoGainSigmaVar  = f; }
    5454  void SetLoGainNumPickup ( const Float_t f ) { fLoGainNumPickup = f;   }
    5555
    5656  void SetMean       ( const Float_t f ) { IsHiGainSaturation() ? fLoGainMean = f       : fHiGainMean = f      ; }
    57   void SetMeanErr    ( const Float_t f ) { IsHiGainSaturation() ? fLoGainMeanVar = f*f  : fHiGainMeanVar = f*f ; }
     57  void SetMeanVar    ( const Float_t f ) { IsHiGainSaturation() ? fLoGainMeanVar = f    : fHiGainMeanVar = f  ; }
    5858  void SetProb       ( const Float_t f ) { IsHiGainSaturation() ? fLoGainProb = f       : fHiGainProb = f      ; }
    5959  void SetSigma      ( const Float_t f ) { IsHiGainSaturation() ? fLoGainSigma = f      : fHiGainSigma = f     ; }
    60   void SetSigmaErr   ( const Float_t f ) { IsHiGainSaturation() ? fLoGainSigmaVar = f*f : fHiGainSigmaVar = f*f; }
     60  void SetSigmaVar   ( const Float_t f ) { IsHiGainSaturation() ? fLoGainSigmaVar = f   : fHiGainSigmaVar = f  ; }
    6161  void SetNumPickup  ( const Float_t f ) { IsHiGainSaturation() ? fLoGainNumPickup = f  : fHiGainNumPickup = f ; }
    6262 
     
    8282  Float_t GetMean       () const { return IsHiGainSaturation() ? GetLoGainMean()      : GetHiGainMean()     ; }
    8383  Float_t GetMeanErr    () const { return IsHiGainSaturation() ? GetLoGainMeanErr()   : GetHiGainMeanErr()  ; }
     84  Float_t GetMeanRelVar () const;
    8485  Float_t GetProb       () const { return IsHiGainSaturation() ? GetLoGainProb()      : GetHiGainProb()     ; }
    8586  Float_t GetSigma      () const { return IsHiGainSaturation() ? GetLoGainSigma()     : GetHiGainSigma()    ; }
    8687  Float_t GetSigmaErr   () const { return IsHiGainSaturation() ? GetLoGainSigmaErr()  : GetHiGainSigmaErr() ; }
     88  Float_t GetSigmaRelVar() const;
    8789  Float_t GetNumPickup  () const { return IsHiGainSaturation() ? GetLoGainNumPickup() : GetHiGainNumPickup(); }
    8890
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationCam.cc

    r3667 r3671  
    309309  cam->fAverageAreaSat         = fAverageAreaSat;
    310310  cam->fAverageAreaSigma       = fAverageAreaSigma;     
    311   cam->fAverageAreaSigmaErr    = fAverageAreaSigmaErr;   
     311  cam->fAverageAreaSigmaVar    = fAverageAreaSigmaVar;   
    312312  cam->fAverageAreaRelSigma    = fAverageAreaRelSigma;
    313   cam->fAverageAreaRelSigmaErr = fAverageAreaRelSigmaErr;   
     313  cam->fAverageAreaRelSigmaVar = fAverageAreaRelSigmaVar;   
    314314  cam->fAverageSectorNum       = fAverageSectorNum;     
    315315
     
    408408  fAverageAreaSat.        Set(nareas);           
    409409  fAverageAreaSigma.      Set(nareas);     
    410   fAverageAreaSigmaErr.   Set(nareas);   
     410  fAverageAreaSigmaVar.   Set(nareas);   
    411411  fAverageAreaRelSigma.   Set(nareas);   
    412   fAverageAreaRelSigmaErr.Set(nareas);
     412  fAverageAreaRelSigmaVar.Set(nareas);
    413413  fAverageSectorNum.      Set(nsectors);
    414414
     
    644644      MCalibrationPix &pix    = (*fCam).GetAverageArea(j);
    645645
    646       fAverageAreaSigma[j]    = pix.GetSigma    () * TMath::Sqrt((Float_t)fAverageAreaNum[j]);
    647       fAverageAreaSigmaErr[j] = pix.GetSigmaErr () * TMath::Sqrt((Float_t)fAverageAreaNum[j]);
     646      const Float_t numsqr    = TMath::Sqrt((Float_t)fAverageAreaNum[j]);
     647      fAverageAreaSigma[j]    = pix.GetSigma    () * numsqr;
     648      fAverageAreaSigmaVar[j] = pix.GetSigmaErr () * pix.GetSigmaErr() * numsqr;
    648649
    649650      pix.SetSigma   (fAverageAreaSigma[j]);
    650       pix.SetSigmaErr(fAverageAreaSigmaErr[j]);
    651 
    652       fAverageAreaRelSigma[j]   = fAverageAreaSigma[j] / pix.GetMean();
    653      
    654       Float_t relsigmaerr       =  fAverageAreaSigmaErr[j]*fAverageAreaSigmaErr[j]
    655                                 / (fAverageAreaSigma[j]   *fAverageAreaSigma[j]   );
    656       relsigmaerr               += pix.GetMeanErr()*pix.GetMeanErr()
    657                                 / (pix.GetMean()   *pix.GetMean()   );
    658       relsigmaerr               *= fAverageAreaRelSigma[j];
    659       fAverageAreaRelSigmaErr[j] = TMath::Sqrt(relsigmaerr);
     651      pix.SetSigmaVar(fAverageAreaSigmaVar[j]);
     652
     653      fAverageAreaRelSigma   [j]  = fAverageAreaSigma[j]    / pix.GetMean();
     654      fAverageAreaRelSigmaVar[j]  = fAverageAreaSigmaVar[j] / (fAverageAreaSigma[j]*fAverageAreaSigma[j]);
     655      fAverageAreaRelSigmaVar[j] += pix.GetMeanRelVar();
     656      fAverageAreaRelSigmaVar[j] *= fAverageAreaRelSigma[j];
    660657    }
    661658}
     
    717714  //
    718715  pix.SetHiGainMean      ( hist.GetMean()      );
    719   pix.SetHiGainMeanErr   ( hist.GetMeanErr()   );
     716  pix.SetHiGainMeanVar   ( hist.GetMeanErr() * hist.GetMeanErr()   );
    720717  pix.SetHiGainSigma     ( hist.GetSigma()     );
    721   pix.SetHiGainSigmaErr  ( hist.GetSigmaErr()  );
     718  pix.SetHiGainSigmaVar  ( hist.GetSigmaErr()* hist.GetSigmaErr()  );
    722719  pix.SetHiGainProb      ( hist.GetProb()      );
    723720  pix.SetHiGainNumPickup ( hist.GetPickup()    );
     
    780777  //
    781778  pix.SetLoGainMean      ( hist.GetMean()      );
    782   pix.SetLoGainMeanErr   ( hist.GetMeanErr()   );
     779  pix.SetLoGainMeanVar   ( hist.GetMeanErr()  * hist.GetMeanErr()   );
    783780  pix.SetLoGainSigma     ( hist.GetSigma()     );
    784   pix.SetLoGainSigmaErr  ( hist.GetSigmaErr()  );
     781  pix.SetLoGainSigmaVar  ( hist.GetSigmaErr() * hist.GetSigmaErr()  );
    785782  pix.SetLoGainProb      ( hist.GetProb()      );
    786783  pix.SetLoGainNumPickup ( hist.GetPickup()    );
     
    835832      if (!fAverageAreaSat[i])
    836833        DrawAverageSigma(fAverageAreaSat[i], i,
    837                          fAverageAreaSigma[i],    fAverageAreaSigmaErr[i],
    838                          fAverageAreaRelSigma[i], fAverageAreaRelSigmaErr[i]);
     834                         fAverageAreaSigma[i],    fAverageAreaSigmaVar[i],
     835                         fAverageAreaRelSigma[i], fAverageAreaRelSigmaVar[i]);
    839836
    840837      pad->cd(2*(i+1));
     
    843840      if (fAverageAreaSat[i])
    844841        DrawAverageSigma(fAverageAreaSat[i], i,
    845                          fAverageAreaSigma[i], fAverageAreaSigmaErr[i],
    846                          fAverageAreaRelSigma[i], fAverageAreaRelSigmaErr[i]);
     842                         fAverageAreaSigma[i], fAverageAreaSigmaVar[i],
     843                         fAverageAreaRelSigma[i], fAverageAreaRelSigmaVar[i]);
    847844    }
    848845}
     
    855852//
    856853void MHCalibrationCam::DrawAverageSigma(Bool_t sat, Bool_t inner,
    857                                               Float_t sigma, Float_t sigmaerr,
    858                                               Float_t relsigma, Float_t relsigmaerr) const
    859 {
    860  
    861   if (sigma != 0)
     854                                              Float_t sigma, Float_t sigmavar,
     855                                              Float_t relsigma, Float_t relsigmavar) const
     856{
     857 
     858  if (sigma != 0 && sigmavar >= 0 && relsigmavar >= 0.)
    862859    {
    863860     
     
    872869                                 " Pixels ", sat ? "Low Gain" : "High Gain");
    873870      TText *txt1 = text->AddText(line1.Data());
    874       const TString line2 = Form("#sigma per pix: %2.2f #pm %2.2f",sigma,sigmaerr);
     871      const TString line2 = Form("#sigma per pix: %2.2f #pm %2.2f",sigma,TMath::Sqrt(sigmavar));
    875872      TText *txt2 = text->AddText(line2.Data());
    876       const TString line3 = Form("Rel. #sigma per pix: %2.2f #pm %2.2f",relsigma,relsigmaerr);
     873      const TString line3 = Form("Rel. #sigma per pix: %2.2f #pm %2.2f",relsigma,TMath::Sqrt(relsigmavar));
    877874      TText *txt3 = text->AddText(line3.Data());
    878875      text->Draw("");
Note: See TracChangeset for help on using the changeset viewer.