Changeset 3642


Ignore:
Timestamp:
04/04/04 17:50:30 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3638 r3642  
    2121 2004/04/02: Markus Gaug
    2222   * mcalib/MHGausEvents.[h,cc]
     23   * mcalib/MHPedestalPix.[h,cc]
    2324   * mcalib/MHCalibrationChargePix.[h,cc]
    2425   * mcalib/MHCalibrationChargeHiGainPix.[h,cc]
     
    3738       more direct way to implement
    3839
     40   * mcalib/MHPedestalCam.[h,cc]
    3941   * mcalib/MHCalibrationCam.[h,cc]
    4042   * mcalib/MHCalibrationChargeCam.[h,cc]
  • trunk/MagicSoft/Mars/manalysis/MHPedestalCam.h

    r3176 r3642  
    22#define MARS_MHPedestalCam
    33
    4 #ifndef ROOT_TObjArray
    5 #include <TObjArray.h>
     4#ifndef MARS_MHCalibrationCam
     5#include "MHCalibrationCam.h"
    66#endif
    77
    8 #ifndef MARS_MH
    9 #include "MH.h"
    10 #endif
    11 #ifndef MARS_MCamEvent
    12 #include "MCamEvent.h"
    13 #endif
    14 
     8class MGeomCam;
     9class MPedestalCam;
    1510class MHPedestalPix;
    16 class MPedestalCam;
    17 class MHPedestalCam : public MH, public MCamEvent
     11class MHPedestalCam : public MHCalibrationCam
    1812{
    1913
    2014private:
    2115
    22   TObjArray  *fArray;       //-> List of MHPedestalPix's
     16  void   InitPedHists(MHPedestalPix &hist, const Int_t i, const Float_t nslices);
     17 
     18  Bool_t ReInitHists(MParList *pList);
     19  Bool_t FillHists(const MParContainer *par, const Stat_t w=1);
     20  Bool_t FinalizeHists();
     21 
     22  Float_t fExtractHiGainSlices;           // Number of FADC slices used for high gain signal extraction
     23  Float_t fExtractLoGainSlices;           // Number of FADC slices used for low  gain signal extraction
    2324
    24   MPedestalCam *fPedestals; //! need to initialize MPedestalCam to zero (which is not default!)
    25  
    26   Float_t fExtractSlices;
     25  MPedestalCam *fPedestals;               //! Pedestal Cam filled by MPedCalcPedRun
    2726 
    2827public:
    2928  MHPedestalCam(const char *name=NULL, const char *title=NULL);
    30   ~MHPedestalCam();
    31  
    32   MHPedestalPix &operator[](UInt_t i);
    33   const MHPedestalPix &operator[](UInt_t i) const;
    34  
    35   Bool_t SetupFill(const MParList *pList);
    36   Bool_t Fill(const MParContainer *par, const Stat_t w=1);
    37   Bool_t Finalize();
    38  
    39   TObject *Clone(const char *) const;
     29  ~MHPedestalCam() {}
    4030 
    4131  Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
  • 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}
  • trunk/MagicSoft/Mars/manalysis/MHPedestalPix.h

    r3165 r3642  
    1111private:
    1212
    13   static const Int_t   fgChargeNbins;
    14   static const Axis_t  fgChargeFirst;
    15   static const Axis_t  fgChargeLast;
     13  static const Int_t   fgChargeNbins;        // Default for fNBins          (now set to: 450  )
     14  static const Axis_t  fgChargeFirst;        // Default for fFirst          (now set to: -0.5  )
     15  static const Axis_t  fgChargeLast;         // Default for fLast           (now set to: 449.5)
    1616
    17   Int_t   fChargeNbins;
    18   Axis_t  fChargeFirst;
    19   Axis_t  fChargeLast;
    20 
    21   Int_t fPixId;                  // Pixel Nr
    22 
     17  Float_t fNSlices;                         // Number of FADC slices summed in extraction
     18 
    2319public:
    2420
    2521  MHPedestalPix(const char *name=NULL, const char *title=NULL);
    26   ~MHPedestalPix();
     22  ~MHPedestalPix() {}
    2723
    28   void Clear(Option_t *o="");
    29   void InitBins();
     24  // Setters
     25  void SetNSlices( const Float_t n)    { fNSlices = n ; }
    3026 
    31   // Setters
    32   void SetChargeNbins(const Int_t  bins =fgChargeNbins)    { fChargeNbins = bins; }
    33   void SetChargeFirst(const Axis_t first=fgChargeFirst)    { fChargeFirst = first; }
    34   void SetChargeLast( const Axis_t last =fgChargeLast)     { fChargeLast  = last; }
     27  // Getters
     28  Float_t GetNSlices() const       { return fNSlices; }
    3529 
    3630  // Others
    37   void ChangeHistId(Int_t i);
    38   void Renorm(const Float_t nslices); 
     31  void Renorm(); 
    3932
    40   //  TObject *DrawClone(Option_t *opt="") const;
    41  
    4233  ClassDef(MHPedestalPix, 1)     // Histograms for each calibrated pixel
    4334};
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargePINDiode.cc

    r3617 r3642  
    8585//
    8686MCalibrationChargePINDiode::MCalibrationChargePINDiode(const char *name, const char *title)
    87     : fFlags(0)
     87    : fCalibFlags(0)
    8888{
    8989
     
    112112{
    113113
    114     SetChargeFitValid     ( kFALSE );
    115     SetTimeFitValid       ( kFALSE );
    116     SetMeanTimeInFirstBin ( kFALSE );
    117     SetMeanTimeInLastBin  ( kFALSE );
     114  SetChargeFitValid     ( kFALSE );
     115  SetTimeFitValid       ( kFALSE );
     116  SetMeanTimeInFirstBin ( kFALSE );
     117  SetMeanTimeInLastBin  ( kFALSE );
    118118   
    119   fMeanCharge                       =  -1.;
    120   fMeanChargeErr                    =  -1.;
    121   fSigmaCharge                      =  -1.;
    122   fSigmaChargeErr                   =  -1.;
    123   fChargeProb                       =  -1.;
    124119  fPed                              =  -1.;
    125120  fPedRms                           =  -1.;
     
    163158void  MCalibrationChargePINDiode::SetOscillating( const Bool_t b)
    164159{
    165     b ? SETBIT(fFlags,kOscillating) : CLRBIT(fFlags,kOscillating);
    166 }
    167 
    168 // --------------------------------------------------------------------------
    169 //
    170 // Set the Excluded Bit from outside
    171 //
    172 void MCalibrationChargePINDiode::SetExcluded(Bool_t b )
    173 {
    174   b ?  SETBIT(fFlags, kExcluded) : CLRBIT(fFlags, kExcluded);
     160    b ? SETBIT(fCalibFlags,kOscillating) : CLRBIT(fCalibFlags,kOscillating);
    175161}
    176162
     
    182168void MCalibrationChargePINDiode::SetExcludeQualityCheck(Bool_t b )
    183169{
    184   b ?  SETBIT(fFlags, kExcludeQualityCheck) : CLRBIT(fFlags, kExcludeQualityCheck);
     170  b ?  SETBIT(fCalibFlags, kExcludeQualityCheck) : CLRBIT(fCalibFlags, kExcludeQualityCheck);
    185171}
    186172
     
    191177void MCalibrationChargePINDiode::SetChargeFitValid(Bool_t b )   
    192178{
    193   b ?  SETBIT(fFlags, kChargeFitValid) : CLRBIT(fFlags, kChargeFitValid);
     179  b ?  SETBIT(fCalibFlags, kChargeFitValid) : CLRBIT(fCalibFlags, kChargeFitValid);
    194180}
    195181
     
    200186void MCalibrationChargePINDiode::SetTimeFitValid(Bool_t b )   
    201187{
    202   b ?  SETBIT(fFlags, kTimeFitValid) : CLRBIT(fFlags, kTimeFitValid);
     188  b ?  SETBIT(fCalibFlags, kTimeFitValid) : CLRBIT(fCalibFlags, kTimeFitValid);
    203189}
    204190
    205191void MCalibrationChargePINDiode::SetFluxOutsidePlexiglassAvailable (const Bool_t b)
    206192{
    207   b ?  SETBIT(fFlags, kFluxOutsidePlexiglassAvailable) : CLRBIT(fFlags, kFluxOutsidePlexiglassAvailable);
     193  b ?  SETBIT(fCalibFlags, kFluxOutsidePlexiglassAvailable) : CLRBIT(fCalibFlags, kFluxOutsidePlexiglassAvailable);
    208194}
    209195
    210196void MCalibrationChargePINDiode::SetMeanTimeInFirstBin(const Bool_t b)
    211197{
    212   b ? SETBIT(fFlags,kMeanTimeInFirstBin) : CLRBIT(fFlags,kMeanTimeInFirstBin);
     198  b ? SETBIT(fCalibFlags,kMeanTimeInFirstBin) : CLRBIT(fCalibFlags,kMeanTimeInFirstBin);
    213199}
    214200
    215201void MCalibrationChargePINDiode::SetMeanTimeInLastBin(const Bool_t b)
    216202{
    217   b ? SETBIT(fFlags,kMeanTimeInLastBin) : CLRBIT(fFlags,kMeanTimeInLastBin);
     203  b ? SETBIT(fCalibFlags,kMeanTimeInLastBin) : CLRBIT(fCalibFlags,kMeanTimeInLastBin);
    218204}
    219205
    220206Bool_t MCalibrationChargePINDiode::IsMeanTimeInFirstBin() const
    221207{
    222   return TESTBIT(fFlags,kMeanTimeInFirstBin);
     208  return TESTBIT(fCalibFlags,kMeanTimeInFirstBin);
    223209}
    224210
    225211Bool_t MCalibrationChargePINDiode::IsMeanTimeInLastBin() const
    226212{
    227   return TESTBIT(fFlags,kMeanTimeInLastBin);
    228 }
    229 
    230 Bool_t MCalibrationChargePINDiode::IsExcluded()       const
    231 {
    232    return TESTBIT(fFlags,kExcluded); 
     213  return TESTBIT(fCalibFlags,kMeanTimeInLastBin);
    233214}
    234215
    235216Bool_t MCalibrationChargePINDiode::IsChargeFitValid() const
    236217{
    237   return TESTBIT(fFlags, kChargeFitValid); 
     218  return TESTBIT(fCalibFlags, kChargeFitValid); 
    238219}
    239220
    240221Bool_t MCalibrationChargePINDiode::IsTimeFitValid()   const
    241222{
    242   return TESTBIT(fFlags, kTimeFitValid); 
     223  return TESTBIT(fCalibFlags, kTimeFitValid); 
    243224}
    244225
     
    255236
    256237
    257   if (fMeanCharge < fChargeLimit*GetPedRms())
     238  if (GetMean() < fChargeLimit*GetPedRms())
    258239    {
    259240      *fLog << warn << "WARNING: Fitted Charge is smaller than "
     
    262243    }
    263244 
    264   if (fMeanChargeErr < fChargeErrLimit)
     245  if (GetMeanErr() < fChargeErrLimit)
    265246    {
    266247      *fLog << warn << "WARNING: Error of Fitted Charge is smaller than "
     
    269250    }
    270251     
    271   if (fMeanCharge < fChargeRelErrLimit*fMeanChargeErr)
     252  if (GetMean() < fChargeRelErrLimit*GetMeanErr())
    272253    {
    273254      *fLog << warn << "WARNING: Fitted Charge is smaller than "
     
    276257    }
    277258     
    278   if (fSigmaCharge < GetPedRms())
     259  if (GetSigma() < GetPedRms())
    279260    {
    280261      *fLog << warn << "WARNING: Sigma of Fitted Charge smaller than Pedestal RMS in PINDiode " << endl;
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargePINDiode.h

    r3617 r3642  
    22#define MARS_MCalibrationChargePINDiode
    33
    4 #ifndef MARS_MParContainer
    5 #include "MParContainer.h"
     4#ifndef MARS_MCalibrationPix
     5#include "MCalibrationPix.h"
    66#endif
    77
    8 class MCalibrationChargePINDiode : public MParContainer
     8class MCalibrationChargePINDiode : public MCalibrationPix
    99{
    1010private:
     
    4242  Float_t fPedRms;                // The pedestal  RMS (from MPedestalPix)
    4343
    44   Float_t fMeanCharge;            // The mean charge after the fit
    45   Float_t fMeanChargeErr;         // The error of mean charge after the fit
    46   Float_t fSigmaCharge;           // The sigma of the mean charge after the fit
    47   Float_t fSigmaChargeErr;        // The error of the sigma of the mean charge after the fit
    48   Float_t fChargeProb;            // The probability of the fit function
    49 
    5044  Float_t fRmsChargeMean;
    5145  Float_t fRmsChargeMeanErr;
     
    5347  Float_t fRmsChargeSigmaErr;
    5448
    55   Byte_t  fFlags;                            // Flag for the set Bits
     49  Byte_t  fCalibFlags;                            // Flag for the set Bits
    5650
    5751  Float_t fAbsTimeMean;
     
    6963  PulserColor_t fColor; 
    7064
    71   enum  { kExcluded, kExcludeQualityCheck, kOscillating,
     65  enum  { kExcludeQualityCheck, kOscillating,
    7266          kChargeFitValid, kTimeFitValid,
    7367          kMeanTimeInFirstBin, kMeanTimeInLastBin,
     
    8377  // Setters
    8478  void SetColor(   const PulserColor_t color )  {  fColor = color;         }
    85 
    86   void SetMeanCharge     (   const Float_t f )    { fMeanCharge        = f;  }
    87   void SetMeanChargeErr  (   const Float_t f )    { fMeanChargeErr     = f;  }
    88   void SetSigmaCharge    (   const Float_t f )    { fSigmaCharge       = f;  }
    89   void SetSigmaChargeErr (   const Float_t f )    { fSigmaChargeErr    = f;  }
    9079
    9180  void SetRmsChargeMean    ( const Float_t f )    { fRmsChargeMean     = f;  }
     
    10796
    10897  void SetOscillating     ( const Bool_t b=kTRUE);
    109   void SetExcluded           ( const Bool_t b = kTRUE );
    11098  void SetExcludeQualityCheck( const Bool_t b = kTRUE );
    11199  void SetChargeFitValid     ( const Bool_t b = kTRUE );
     
    118106
    119107  // Getters
    120   Float_t GetMeanCharge()      const { return fMeanCharge;         }
    121   Float_t GetMeanChargeErr()   const { return fMeanChargeErr;      }
    122   Float_t GetSigmaCharge()     const { return fSigmaCharge;        }
    123   Float_t GetSigmaChargeErr()  const { return fSigmaChargeErr;     }
    124   Float_t GetChargeProb()      const { return fChargeProb;         }   
    125 
    126108  Float_t GetMeanFluxOutsidePlexiglass()    const { return fMeanFluxOutsidePlexiglass; }
    127109  Float_t GetMeanFluxErrOutsidePlexiglass() const { return fMeanFluxErrOutsidePlexiglass; }
     
    132114
    133115
    134   Bool_t  IsExcluded()          const;
    135116  Bool_t  IsChargeFitValid()    const;
    136117  Bool_t  IsTimeFitValid()      const;
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationCam.cc

    r3636 r3642  
    702702      }
    703703 
     704  hist.Renorm();
    704705  //
    705706  // 4) Check for oscillations
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationRelTimeCam.cc

    r3639 r3642  
    232232                                        "Relative Arrival Times average sector ");
    233233
     234          InitHists(GetAverageHiGainSector(j),fCam->GetAverageBadSector(j),j);
     235
    234236          GetAverageHiGainSector(j).GetHGausHist()->SetTitle("Relative Arrival Times average Sector ");
    235237          GetAverageHiGainSector(j).SetNbins(fAverageNbins);
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationRelTimePix.cc

    r3639 r3642  
    3131//  pixel number 1 (hardware index: 2). Times are taken from MArrivalTimePix
    3232//
     33//  Results are re-normalized to a value per time (ns) with the formulae:
     34//
     35// - Mean Rel. Time         = Mean Rel. Time        * fFADCSliceWidth
     36// - Mean Rel. Time Error   = Mean Rel. Time Error  * fFADCSliceWidth
     37// - Sigma Rel. Time        = Sigma Rel. Time       * fFADCSliceWidth
     38// - Sigma Rel. Time Error  = Sigma Rel. Time Error * fFADCSliceWidth
     39//
    3340//////////////////////////////////////////////////////////////////////////////
    3441#include "MHCalibrationRelTimePix.h"
     
    4350const Axis_t  MHCalibrationRelTimePix::fgRelTimeFirst    = -13.;
    4451const Axis_t  MHCalibrationRelTimePix::fgRelTimeLast     =  13.;
     52const Float_t MHCalibrationRelTimePix::fgFADCSliceWidth  =  3.3333;
    4553// --------------------------------------------------------------------------
    4654//
     
    5664// - the default x-axis title for fHGausHist ("FADC Slice")
    5765// - the default y-axis title for fHGausHist ("Nr. of events")
    58 //
    59 // Executes:
    60 // - MHGausEvents::Clear()
     66//
     67// - the default number for fFADCSliceWidth (fgFADCSliceWidth)
    6168//
    6269MHCalibrationRelTimePix::MHCalibrationRelTimePix(const char *name, const char *title)
     
    6976  SetFirst ( fgRelTimeFirst );
    7077  SetLast  ( fgRelTimeLast  );
     78  SetFADCSliceWidth();
    7179
    7280  // Create a large number of bins, later we will rebin
     
    7583  fHGausHist.SetXTitle("FADC Slice");
    7684  fHGausHist.SetYTitle("Nr. of events");
    77 
    78   Clear();
    7985
    8086}
     
    8995}
    9096
     97// --------------------------------------------------------------------------
     98//
     99// If mean and sigma have not yet been set, returns.
     100//
     101// Results are re-normalized to a value per time (ns) with the formulae:
     102//
     103// - Mean Rel. Time         = Mean Rel. Time        * fFADCSliceWidth
     104// - Mean Rel. Time Error   = Mean Rel. Time Error  * fFADCSliceWidth
     105// - Sigma Rel. Time        = Sigma Rel. Time       * fFADCSliceWidth
     106// - Sigma Rel. Time Error  = Sigma Rel. Time Error * fFADCSliceWidth
     107//
     108void MHCalibrationRelTimePix::Renorm()
     109{
    91110
     111  if (fMean == fMeanErr == fSigma == fSigmaErr == 0.)
     112    return;
     113
     114  fMean    *= fFADCSliceWidth;
     115  fMeanErr *= fFADCSliceWidth;
     116  fSigma   *= fFADCSliceWidth;
     117  fSigmaErr*= fFADCSliceWidth;
     118 
     119}
Note: See TracChangeset for help on using the changeset viewer.