Ignore:
Timestamp:
05/10/05 12:13:12 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationCam.cc

    r6926 r7005  
    5252// The flag kAverageing steers if the event-by-event averages are treated at all.
    5353//
     54// Class Version 5:
     55//  + Double_t fLowerFitLimitHiGain;          // Lower limit for the fit range for the hi-gain hist
     56//  + Double_t fUpperFitLimitHiGain;          // Upper limit for the fit range for the hi-gain hist
     57//  + Double_t fLowerFitLimitLoGain;          // Lower limit for the fit range for the lo-gain hist
     58//  + Double_t fUpperFitLimitLoGain;          // Upper limit for the fit range for the lo-gain hist
     59//  + Bool_t   fIsHiGainFitRanges;            // Are high-gain fit ranges defined?
     60//  + Bool_t   fIsLoGainFitRanges;            // Are low-gain fit ranges defined?
     61//
     62//
    5463/////////////////////////////////////////////////////////////////////////////
    5564#include "MHCalibrationCam.h"
     
    8695using namespace std;
    8796
     97const Double_t MHCalibrationCam::fgLowerFitLimitHiGain = 0;
     98const Double_t MHCalibrationCam::fgUpperFitLimitHiGain = 0;
     99const Double_t MHCalibrationCam::fgLowerFitLimitLoGain = 0;
     100const Double_t MHCalibrationCam::fgUpperFitLimitLoGain = 0;
     101
    88102const Int_t   MHCalibrationCam::fgPulserFrequency  = 500;
    89103const Float_t MHCalibrationCam::fgProbLimit        = 0.0001;
    90104const Float_t MHCalibrationCam::fgOverflowLimit    = 0.005;
     105
    91106const TString MHCalibrationCam::gsHistName   = "Hist";
    92107const TString MHCalibrationCam::gsHistTitle  = "";
    93108const TString MHCalibrationCam::gsHistXTitle = "";
    94109const TString MHCalibrationCam::gsHistYTitle = "Nr. events";
     110
    95111// --------------------------------------------------------------------------
    96112//
     
    116132//-  SetSizeCheck   (kTRUE);
    117133//-  SetInterlaced  (kFALSE);
     134//-  SetLowerFitLimitHiGain();
     135//-  SetUpperFitLimitHiGain();
     136//-  SetLowerFitLimitLoGain();
     137//-  SetUpperFitLimitLoGain();
    118138//
    119139MHCalibrationCam::MHCalibrationCam(const char *name, const char *title)
    120     :  fHistName(gsHistName),fHistTitle(gsHistTitle),
    121        fHistXTitle(gsHistXTitle),fHistYTitle(gsHistYTitle),
    122        fColor(MCalibrationCam::kNONE), fIntensBad(NULL),
    123        fBadPixels(NULL), fIntensCam(NULL), fCam(NULL), fGeom(NULL),
    124        fRunHeader(NULL)
     140    :  fIsHiGainFitRanges(kFALSE), fIsLoGainFitRanges(kFALSE),
     141    fHistName(gsHistName),fHistTitle(gsHistTitle),
     142    fHistXTitle(gsHistXTitle),fHistYTitle(gsHistYTitle),
     143    fColor(MCalibrationCam::kNONE), fIntensBad(NULL),
     144    fBadPixels(NULL), fIntensCam(NULL), fCam(NULL), fGeom(NULL),
     145    fRunHeader(NULL)
    125146{
    126147
     
    152173    SetOscillations(kTRUE);
    153174    SetSizeCheck   (kTRUE);
     175
     176    SetLowerFitLimitHiGain();
     177    SetUpperFitLimitHiGain();
     178    SetLowerFitLimitLoGain();
     179    SetUpperFitLimitLoGain();
    154180}
    155181
     
    10481074                                       MBadPixelsPix::UncalibratedType_t osctyp)
    10491075{
    1050  
     1076  fIsHiGainFitRanges = TMath::Abs(fUpperFitLimitHiGain - fLowerFitLimitHiGain) > 1E-5;
     1077
    10511078  for (Int_t i=0; i<fHiGainArray->GetSize(); i++)
    10521079    {
     
    10971124                                            MBadPixelsPix::UncalibratedType_t osctyp)
    10981125{
    1099  
     1126  fIsLoGainFitRanges = TMath::Abs(fUpperFitLimitLoGain - fLowerFitLimitLoGain) > 1E-5;
     1127
    11001128  if (!IsLoGain())
    11011129    return;
     
    12071235  // 2) Fit the Hi Gain histograms with a Gaussian
    12081236  //
    1209   if (!hist.FitGaus())
    1210     //
    1211     // 3) In case of failure set the bit Fitted to false and take histogram means and RMS
    1212     //
    1213     if (!hist.RepeatFit())
    1214       {
    1215         hist.BypassFit();
    1216         bad.SetUncalibrated( fittyp );
    1217       }
     1237  if (fIsHiGainFitRanges)
     1238  {
     1239      if (!hist.FitGaus("R",fLowerFitLimitHiGain,fUpperFitLimitHiGain))
     1240          bad.SetUncalibrated( fittyp );
     1241  }
     1242  else
     1243      if (!hist.FitGaus())
     1244          //
     1245          // 3) In case of failure set the bit Fitted to false and take histogram means and RMS
     1246          //
     1247          if (!hist.RepeatFit())
     1248          {
     1249              hist.BypassFit();
     1250              bad.SetUncalibrated( fittyp );
     1251          }
     1252
    12181253 
    12191254  //
     
    12911326  // 2) Fit the Hi Gain histograms with a Gaussian
    12921327  //
    1293   if (!hist.FitGaus())
    1294     //
    1295     // 3) In case of failure set the bit Fitted to false and take histogram means and RMS
    1296     //
    1297     if (!hist.RepeatFit())
    1298       {
    1299         hist.BypassFit();
    1300         if (pix.IsHiGainSaturation())
     1328  if (fIsLoGainFitRanges)
     1329  {
     1330      if (!hist.FitGaus("R",fLowerFitLimitLoGain,fUpperFitLimitLoGain))
    13011331          bad.SetUncalibrated( fittyp );
    1302       }
    1303  
     1332  }
     1333  else
     1334      if (!hist.FitGaus())
     1335          //
     1336          // 3) In case of failure set the bit Fitted to false and take histogram means and RMS
     1337          //
     1338          if (!hist.RepeatFit())
     1339          {
     1340              hist.BypassFit();
     1341              if (pix.IsHiGainSaturation())
     1342                  bad.SetUncalibrated( fittyp );
     1343          }
     1344
    13041345  //
    13051346  // 4) Check for oscillations
     
    14291470}
    14301471
     1472// -----------------------------------------------------------------------------
     1473//
     1474// Available options
     1475//  Debug
     1476//  LoGain
     1477//  Oscillations
     1478//  SizeCheck
     1479//  Averageing
     1480//  Nbins
     1481//  First
     1482//  Last
     1483//  ProbLimit
     1484//  OverflowLimit
     1485//  PulserFrequency
     1486//  LowerFitLimitHiGain
     1487//  UpperFitLimitHiGain
     1488//  LowerFitLimitLoGain
     1489//  UpperFitLimitLoGain
     1490//
    14311491Int_t MHCalibrationCam::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
    14321492{
     
    14931553      rc = kTRUE;
    14941554    }
     1555
     1556  if (IsEnvDefined(env, prefix, "LowerFitLimitHiGain", print))
     1557    {
     1558      SetLowerFitLimitHiGain(GetEnvValue(env, prefix, "LowerFitLimitHiGain", fLowerFitLimitHiGain));
     1559      rc = kTRUE;
     1560    }
     1561
     1562  if (IsEnvDefined(env, prefix, "UpperFitLimitHiGain", print))
     1563    {
     1564      SetUpperFitLimitHiGain(GetEnvValue(env, prefix, "UpperFitLimitHiGain", fUpperFitLimitHiGain));
     1565      rc = kTRUE;
     1566    }
     1567
     1568  if (IsEnvDefined(env, prefix, "LowerFitLimitLoGain", print))
     1569    {
     1570      SetLowerFitLimitLoGain(GetEnvValue(env, prefix, "LowerFitLimitLoGain", fLowerFitLimitLoGain));
     1571      rc = kTRUE;
     1572    }
     1573
     1574  if (IsEnvDefined(env, prefix, "UpperFitLimitLoGain", print))
     1575    {
     1576      SetUpperFitLimitLoGain(GetEnvValue(env, prefix, "UpperFitLimitLoGain", fUpperFitLimitLoGain));
     1577      rc = kTRUE;
     1578    }
     1579
    14951580 
    14961581  return rc;
Note: See TracChangeset for help on using the changeset viewer.