Changeset 4784 for trunk/MagicSoft


Ignore:
Timestamp:
08/27/04 21:37:26 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mpedestal
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mpedestal/MPedestalCam.cc

    r4777 r4784  
    320320// --------------------------------------------------------------------------
    321321//
     322// Calculates the average pedestal for pixel sizes.
     323// The geometry container is used to get the necessary
     324// geometry information (area index) If the bad pixel
     325// container is given all pixels which have the flag 'kUnsuitableRun' are ignored
     326// in the calculation of the size average.
     327//
     328Float_t MPedestalCam::GetAveragedPedPerArea(const MGeomCam &geom, const UInt_t ai, MBadPixelsCam *bad)
     329{
     330
     331  const Int_t np = GetSize();
     332
     333  Double_t mean = 0.;
     334  Int_t    nr   = 0;
     335
     336  for (int i=0; i<np; i++)
     337    {
     338      if (bad && (*bad)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
     339        continue;
     340     
     341      const UInt_t aidx = geom[i].GetAidx();
     342     
     343      if (ai != aidx)
     344        continue;
     345
     346      const MPedestalPix &pix = (*this)[i];
     347     
     348      mean += pix.GetPedestal();
     349      nr   ++;
     350     
     351    }
     352
     353  return mean/nr;
     354}
     355
     356// --------------------------------------------------------------------------
     357//
     358// Calculates the average pedestal rms for pixel sizes.
     359// The geometry container is used to get the necessary
     360// geometry information (area index) If the bad pixel
     361// container is given all pixels which have the flag 'kUnsuitableRun' are ignored
     362// in the calculation of the size average.
     363//
     364Float_t MPedestalCam::GetAveragedRmsPerArea(const MGeomCam &geom, const UInt_t ai, MBadPixelsCam *bad)
     365{
     366
     367  const Int_t np = GetSize();
     368
     369  Double_t rms = 0.;
     370  Int_t    nr  = 0;
     371
     372  for (int i=0; i<np; i++)
     373    {
     374      if (bad && (*bad)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
     375        continue;
     376     
     377      const UInt_t aidx = geom[i].GetAidx();
     378     
     379      if (ai != aidx)
     380        continue;
     381
     382      const MPedestalPix &pix = (*this)[i];
     383     
     384      rms += pix.GetPedestalRms();
     385      nr  ++;
     386    }
     387
     388  return rms/nr;
     389}
     390
     391// --------------------------------------------------------------------------
     392//
     393// Calculates the average pedestal for camera sectors.
     394// The geometry container is used to get the necessary
     395// geometry information (area index) If the bad pixel
     396// container is given all pixels which have the flag 'kUnsuitableRun' are ignored
     397// in the calculation of the size average.
     398//
     399Float_t MPedestalCam::GetAveragedPedPerSector(const MGeomCam &geom, const UInt_t sec, MBadPixelsCam *bad)
     400{
     401
     402  const Int_t np = GetSize();
     403
     404  Double_t mean = 0.;
     405  Int_t    nr   = 0;
     406
     407  for (int i=0; i<np; i++)
     408    {
     409      if (bad && (*bad)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
     410        continue;
     411     
     412      const UInt_t sector = geom[i].GetSector();
     413     
     414      if (sec != sector)
     415        continue;
     416
     417      const MPedestalPix &pix = (*this)[i];
     418     
     419      mean += pix.GetPedestal();
     420      nr   ++;
     421     
     422    }
     423
     424  return mean/nr;
     425}
     426
     427// --------------------------------------------------------------------------
     428//
     429// Calculates the average pedestal rms for camera sectors.
     430// The geometry container is used to get the necessary
     431// geometry information (area index) If the bad pixel
     432// container is given all pixels which have the flag 'kUnsuitableRun' are ignored
     433// in the calculation of the size average.
     434//
     435Float_t MPedestalCam::GetAveragedRmsPerSector(const MGeomCam &geom, const UInt_t sec, MBadPixelsCam *bad)
     436{
     437
     438  const Int_t np = GetSize();
     439
     440  Double_t rms = 0.;
     441  Int_t    nr  = 0;
     442
     443  for (int i=0; i<np; i++)
     444    {
     445      if (bad && (*bad)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
     446        continue;
     447     
     448      const UInt_t sector = geom[i].GetSector();
     449     
     450      if (sec != sector)
     451        continue;
     452
     453      const MPedestalPix &pix = (*this)[i];
     454     
     455      rms += pix.GetPedestalRms();
     456      nr  ++;
     457     
     458    }
     459
     460  return rms/nr;
     461}
     462
     463
     464// --------------------------------------------------------------------------
     465//
    322466// Calculates the avarage pedestal and pedestal rms for all sectors
    323467// and pixel sizes. The geometry container is used to get the necessary
    324468// geometry information (sector number, size index) If the bad pixel
    325 // container is given all pixels which have the flag 'bad' are ignored
     469// container is given all pixels which have the flag 'kUnsuitableRun' are ignored
    326470// in the calculation of the sector and size average.
    327471//
  • trunk/MagicSoft/Mars/mpedestal/MPedestalCam.h

    r4609 r4784  
    4343  Int_t               GetSize          ()                      const;
    4444  ULong_t             GetTotalEntries  ()                      const { return fTotalEntries; }
     45
     46  Float_t GetAveragedPedPerArea  ( const MGeomCam &geom, const UInt_t ai=0,  MBadPixelsCam *bad=NULL );
     47  Float_t GetAveragedPedPerSector( const MGeomCam &geom, const UInt_t sec=0, MBadPixelsCam *bad=NULL ); 
     48  Float_t GetAveragedRmsPerArea  ( const MGeomCam &geom, const UInt_t ai=0,  MBadPixelsCam *bad=NULL );
     49  Float_t GetAveragedRmsPerSector( const MGeomCam &geom, const UInt_t sec=0, MBadPixelsCam *bad=NULL ); 
    4550 
    4651        MPedestalPix &operator[]       ( Int_t i             );
     
    5863  // Setters
    5964  void SetTotalEntries(const ULong_t n) { fTotalEntries = n; }
    60 
     65 
    6166  Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
    6267  void DrawPixelContent(Int_t idx) const;
Note: See TracChangeset for help on using the changeset viewer.