Changeset 3612 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
03/30/04 20:10:03 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3611 r3612  
    2222 
    2323   * mcalib/MHGausEvents.[h,cc]
     24   * mcalib/MHCalibrationChargePix.[h,cc]
    2425     - updated and enlarged documentation
    2526
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePix.cc

    r3609 r3612  
    5656const Axis_t  MHCalibrationChargePix::fgAbsTimeFirst    = -0.5;
    5757const Axis_t  MHCalibrationChargePix::fgAbsTimeLast     = 14.5;
    58 
    5958const Float_t MHCalibrationChargePix::fgPickupLimit     = 5.;
    6059// --------------------------------------------------------------------------
    6160//
    6261// Default Constructor.
     62//
     63// Sets:
     64// - the default number for fChargeNbins  (fgChargeNbins)
     65// - the default number for fChargeFirst  (fgChargeFirst)
     66// - the default number for fChargeLast   (fgChargeLast)
     67// - the default number for fAbsTimeNbins (fgAbstTimeNbins)
     68// - the default number for fAbsTimeFirst (fgAbsTimeFirst)
     69// - the default number for fAbsTimeLast  (fgAbsTimeLast)
     70// - the default number for fPickupLimit  (fgPickupLimit)
     71//
     72// - the default name of the  fHGausHist ("HCalibrationCharge")
     73// - the default title of the fHGausHist ("Distribution of Summed FADC slices Pixel ")
     74// - the default x-axis title for fHGausHist ("Sum FADC Slices")
     75// - the default y-axis title for fHGausHist ("Nr. of events")
     76//
     77// - the default name of the  fHAbsTime ("HAbsTimePixel")
     78// - the default title of the fHAbsTime ("Distribution of Absolute Arrival Times Pixel ")
     79// - the default x-axis title for fHAbsTime ("Absolute Arrival Time [FADC slice nr]")
     80// - the default y-axis title for fHAbsTime ("Nr. of events");
     81// - the default directory of the fHAbsTime (NULL)
     82//
     83// Initializes:
     84// - fHAbsTime()
     85// - fPixId to -1
     86// - all variables to 0.
     87// - all flags to kFALSE
    6388//
    6489MHCalibrationChargePix::MHCalibrationChargePix(const char *name, const char *title)
     
    6792 
    6893  fName  = name  ? name  : "MHCalibrationChargePix";
    69   fTitle = title ? title : "Fill the FADC sums of calibration events and perform the fits";
     94  fTitle = title ? title : "Statistics of the FADC sums of calibration events";
    7095
    7196  SetChargeNbins();
     
    96121}
    97122
     123// --------------------------------------------------------------------------
     124//
     125// Sets:
     126// - fHGausHist.SetBins(fChargeNbins,fChargeFirst,fChargeLast);
     127// - fHAbsTime.SetBins(fAbsTimeNbins,fAbsTimeFirst,fAbsTimeLast);
     128//
    98129void MHCalibrationChargePix::Init()
    99130{
     
    103134}
    104135
    105 
     136// --------------------------------------------------------------------------
     137//
     138// Sets:
     139// - all variables to 0., except fPixId to -1
     140// - all flags to kFALSE
     141//
     142// - executes MHGausEvents::Clear()
     143//
    106144void MHCalibrationChargePix::Clear(Option_t *o)
    107145{
     
    117155}
    118156
    119 
     157// --------------------------------------------------------------------------
     158//
     159// Empty function to overload MHGausEvents::Reset()
     160//
    120161void MHCalibrationChargePix::Reset()
    121162{
    122163}
    123164
    124 
     165// --------------------------------------------------------------------------
     166//
     167// - Set fPixId to id
     168// - Add id to name and title of this
     169// - Add id to names of fHGausHist and fHAbsTime
     170// - Add id to the titles of fHGausHist and fHAbsTime
     171//
    125172void MHCalibrationChargePix::ChangeHistId(Int_t id)
    126173{
     
    144191}
    145192
     193// --------------------------------------------------------------------------
     194//
     195// returns fHGausHist.Integral("width")
     196//
    146197const Float_t MHCalibrationChargePix::GetIntegral() const
    147198{
     
    159210}
    160211
    161 Bool_t MHCalibrationChargePix::IsExcluded()      const
     212const Bool_t MHCalibrationChargePix::IsExcluded()      const
    162213{
    163214  return TESTBIT(fFlags,kExcluded);
    164215}
    165216
     217// --------------------------------------------------------------------------
     218//
     219// Fills fHAbsTime with t
     220// Returns kFALSE, if overflow or underflow occurred, else kTRUE
     221//
    166222Bool_t MHCalibrationChargePix::FillAbsTime(Float_t t)
    167223{
     
    169225}
    170226
    171 
     227// -----------------------------------------------------------------------------
     228//
     229// Default draw:
     230//
     231// The following options can be chosen:
     232//
     233// "": displays the fHGausHist and the fHAbsTime
     234// "all": executes additionally MHGausEvents::Draw(), with options
     235//
    172236void MHCalibrationChargePix::Draw(const Option_t *opt)
    173237{
     
    240304}
    241305
     306// -----------------------------------------------------------------------------
     307//
     308// Repeats the Gauss fit in a smaller range, defined by:
     309//
     310// min = GetMean() - fPickupLimit * GetSigma();
     311// max = GetMean() + fPickupLimit * GetSigma();
     312//
    242313Bool_t MHCalibrationChargePix::RepeatFit(const Option_t *option)
    243314{
     
    279350}
    280351
     352
     353// -----------------------------------------------------------------------------
     354//
     355// Bypasses the Gauss fit by taking mean and RMS from the histogram
     356//
     357// Errors are determined in the following way:
     358// MeanErr  = RMS / Sqrt(entries)
     359// SigmaErr = RMS / (2.*Sqrt(entries) )
     360//
    281361void MHCalibrationChargePix::BypassFit()
    282362{
     
    287367  //
    288368  SetMean     ( fHGausHist.GetMean() );
    289   SetMeanErr  ( fHGausHist.GetRMS() / fHGausHist.GetEntries() );
     369  SetMeanErr  ( fHGausHist.GetRMS() / TMath::Sqrt(fHGausHist.GetEntries()) );
    290370  SetSigma    ( fHGausHist.GetRMS() );
    291   SetSigmaErr ( fHGausHist.GetRMS() / fHGausHist.GetEntries() / 2. );
     371  SetSigmaErr ( fHGausHist.GetRMS() / TMath::Sqrt(fHGausHist.GetEntries()) / 2. );
    292372}
    293373
    294374void MHCalibrationChargePix::CountPickup()
    295375{
    296     fPickup  = (Int_t)GetHGausHist()->Integral(GetHGausHist()->GetXaxis()->FindBin(GetMean()+fPickupLimit*GetSigma()),
     376   fPickup  = (Int_t)GetHGausHist()->Integral(GetHGausHist()->GetXaxis()->FindBin(GetMean()+fPickupLimit*GetSigma()),
    297377                                               GetHGausHist()->GetXaxis()->GetLast(),
    298378                                               "width");
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePix.h

    r3609 r3612  
    1212private:
    1313
    14   static const Int_t   fgChargeNbins;
    15   static const Axis_t  fgChargeFirst;
    16   static const Axis_t  fgChargeLast; 
    17 
    18   static const Int_t   fgAbsTimeNbins;
    19   static const Axis_t  fgAbsTimeFirst;
    20   static const Axis_t  fgAbsTimeLast;
    21 
    22   static const Float_t fgPickupLimit;
     14  static const Int_t   fgChargeNbins;        // Default for fChargeNBins  (now set to: 2000  )
     15  static const Axis_t  fgChargeFirst;        // Default for fChargeFirst  (now set to: -0.5  )
     16  static const Axis_t  fgChargeLast;         // Default for fChargeLast   (now set to: 1999.5)
     17  static const Int_t   fgAbsTimeNbins;       // Default for fAbsTimeNbins (now set to: 15    )
     18  static const Axis_t  fgAbsTimeFirst;       // Default for fAbsTimeFirst (now set to: -0.5  )
     19  static const Axis_t  fgAbsTimeLast;        // Default for fAbsTimeLast  (now set to: 14.5  )
     20  static const Float_t fgPickupLimit;        // Default for fPickupLimit  (now set to:  5.   )
    2321
    2422protected:
    2523
    26   Int_t    fPixId;
     24  Int_t    fPixId;         // The pixel ID
    2725
    28   TH1F     fHAbsTime;          // Histogram to hold the absolute arrival times in number of FADC slices
     26  TH1F     fHAbsTime;      // Histogram to hold the absolute arrival times in number of FADC slices
    2927                         
    30   Int_t    fChargeNbins;
    31   Axis_t   fChargeFirst;
    32   Axis_t   fChargeLast;
     28  Int_t    fChargeNbins;   // Number of  bins used for the fHGausHist
     29  Axis_t   fChargeFirst;   // Lower bound bin used for the fHGausHist
     30  Axis_t   fChargeLast;    // Upper bound bin used for the fHGausHist
    3331
    34   Int_t    fAbsTimeNbins;
    35   Axis_t   fAbsTimeFirst;
    36   Axis_t   fAbsTimeLast;
     32  Int_t    fAbsTimeNbins;  // Number of  bins used for the fHAbsTime
     33  Axis_t   fAbsTimeFirst;  // Lower bound bin used for the fHAbsTime
     34  Axis_t   fAbsTimeLast;   // Upper bound bin used for the fHAbsTime
    3735
    38   Float_t    fPickupLimit;      // The limit in number of sigmas from the fitted mean above which events are considered as pickup
     36  Float_t  fPickupLimit;   // Upper number of sigmas from the fitted mean above which events are considered as pickup
    3937
    40   Float_t  fSaturated;
    41   Float_t  fPickup;
     38  Float_t  fSaturated;     // Number of events classified as saturated
     39  Float_t  fPickup;        // Number of events classified as pick-up
    4240
    43   Byte_t   fFlags;
    44   enum     { kExcluded };
     41  Byte_t   fFlags;         // Bit-field for the flags
     42  enum     { kExcluded };  // Possible bits to be set
    4543
    4644public:
     
    5452  virtual void ChangeHistId(Int_t i);
    5553 
    56   // Setters
    57   virtual void SetChargeNbins(const Int_t  bins =fgChargeNbins)    { fChargeNbins = bins; }
    58   virtual void SetChargeFirst(const Axis_t first=fgChargeFirst)    { fChargeFirst = first; }
    59   virtual void SetChargeLast( const Axis_t last =fgChargeLast)     { fChargeLast  = last; }
     54  // Setters 
     55  virtual void SetChargeNbins(const Int_t  bins =fgChargeNbins)    { fChargeNbins = bins;   }
     56  virtual void SetChargeFirst(const Axis_t first=fgChargeFirst)    { fChargeFirst = first;  }
     57  virtual void SetChargeLast( const Axis_t last =fgChargeLast)     { fChargeLast  = last;   }
    6058 
    61   virtual void SetAbsTimeNbins(const Int_t  bins =fgAbsTimeNbins)  { fAbsTimeNbins = bins; }
     59  virtual void SetAbsTimeNbins(const Int_t  bins =fgAbsTimeNbins)  { fAbsTimeNbins = bins;  }
    6260  virtual void SetAbsTimeFirst(const Axis_t first=fgAbsTimeFirst)  { fAbsTimeFirst = first; }
    63   virtual void SetAbsTimeLast( const Axis_t last =fgAbsTimeLast)   { fAbsTimeLast  = last; }
     61  virtual void SetAbsTimeLast( const Axis_t last =fgAbsTimeLast)   { fAbsTimeLast  = last;  }
    6462
    65   virtual void SetPickupLimit( const Float_t  lim =fgPickupLimit)    { fPickupLimit  = lim; }
     63  virtual void SetPickupLimit( const Float_t  lim =fgPickupLimit)  { fPickupLimit  = lim;  }
    6664
    67   void SetSaturated      ( const Float_t f    )                   { fSaturated += f; }
    68   void SetExcluded       ( const Bool_t b=kTRUE );
     65  void SetSaturated          ( const Float_t f    )                { fSaturated += f;      }
     66  void SetExcluded           ( const Bool_t b=kTRUE );
    6967
    7068  // Getters
    71   TH1F *GetHAbsTime()                       { return &fHAbsTime;  }
    72   const TH1F *GetHAbsTime()           const { return &fHAbsTime;  }
     69  TH1F *GetHAbsTime()                         { return &fHAbsTime;  }
     70  const TH1F *GetHAbsTime()             const { return &fHAbsTime;  }
    7371
    74   const Float_t  GetIntegral()        const;
     72  const Float_t  GetIntegral()          const;
    7573 
    76   const Float_t  GetAbsTimeMean()     const;
    77   const Float_t  GetAbsTimeRms()      const;
     74  const Float_t  GetAbsTimeMean(  )     const;
     75  const Float_t  GetAbsTimeRms()        const;
    7876
    79   const Float_t    GetSaturated()       const { return fSaturated;   }
    80   const Float_t    GetPickup()          const { return fPickup;      }
     77  const Float_t  GetSaturated()         const { return fSaturated;   }
     78  const Float_t  GetPickup()            const { return fPickup;      }
    8179
    82   Bool_t   IsExcluded()         const;
     80  const Bool_t   IsExcluded()          const;
    8381
    8482  // Fill histos
     
    9593  void CountPickup();
    9694
    97   ClassDef(MHCalibrationChargePix, 1)     // Base class for charge calibrated pixel
     95  ClassDef(MHCalibrationChargePix, 1)     // Base Histogram class for a Calibration Pixel
    9896};
    9997
Note: See TracChangeset for help on using the changeset viewer.