Changeset 8478


Ignore:
Timestamp:
05/09/07 13:15:53 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r8477 r8478  
    1919                                                 -*-*- END OF LINE -*-*-
    2020
     21 2007/05/09 Thomas Bretz
     22
     23   * callisto.rc, callisto_Dec04Jan05.rc, callisto_MarApr05.rc,
     24     callisto_mux.rc:
     25     - changed ArrTimeRmsLimit in all cases to default 5.0
     26       because of the new meaning
     27
     28   * showplot.cc:
     29     - changed that it closes automatically if the file cannot
     30       be read
     31
     32   * datacenter/macros/fillstar.C:
     33     - commented the output of the query
     34
     35   * datacenter/macros/plotdb.C:
     36     - adapted ranges to MUX data values
     37     - added plots for new unsuitable columns
     38
     39   * mbadpixels/MBadPixelsPix.h:
     40     - added a new member function IsUncalibrated
     41     - further adapted the usuitable levels
     42
     43   * mcalib/MCalibrationChargeCalc.[h,cc]:
     44     - changed the meaning of ArrTimeRmsLimit such that it is now
     45       the deviation from the average rms expressed in significance
     46       levels
     47     - the new check is done similar to the check for the relative
     48       arrival time (to be unified!)
     49     - removed FinalizeArrivalTimes
     50     - removed calibration levels for first and last bin, this
     51       has to be redone more properly taken the extractor properties
     52       into account
     53     - some updates to the output
     54     - some simplifications to the code
     55
     56   * mcalib/MCalibrationRelTimeCalc.cc:
     57     - when calculating the median check for UnsuitableRun not
     58       unsuitable in general
     59     - small changes to output
     60     - calculate upper and lower limits only once
     61
     62   * mhvstime/MHVsTime.[h,cc]:
     63     - added fMinimum and fMaximum data members similar to
     64       MHSectorVsTime
     65     - to be unified with MHSectorVsTime
     66     - fixed draw/paint
     67     - increased version number
     68
     69   * mjobs/MJCalibration.cc:
     70     - removed the bad pixel levels for first and last bins
     71
     72   * msignal/MExtractTimeAndChargeSpline.[h,cc]:
     73     - changed to allow setup of the extraction type and the
     74       relative or absolute height for arrival
     75     - accordingly increased version number by one
     76
     77
     78
    2179 2007/05/08 Daniel Hoehne
    2280
  • trunk/MagicSoft/Mars/callisto.rc

    r8451 r8478  
    214214#MJCalibration.MCalibColorSet.ExplicitColor: green,blue,uv,ct1
    215215
    216 #MJCalibration.MCalibrationChargeCalc.ArrTimeRmsLimit:    3.5
     216#MJCalibration.MCalibrationChargeCalc.ArrTimeRmsLimit:    5.0
    217217#MJCalibration.MCalibrationChargeCalc.ChargeLimit:        2.5
    218218#MJCalibration.MCalibrationChargeCalc.ChargeErrLimit:     0
  • trunk/MagicSoft/Mars/callisto_Dec04Jan05.rc

    r8439 r8478  
    238238#MJCalibration.MCalibColorSet.ExplicitColor: green,blue,uv,ct1
    239239
    240 #MJCalibration.MCalibrationChargeCalc.ArrTimeRmsLimit:    3.5
     240#MJCalibration.MCalibrationChargeCalc.ArrTimeRmsLimit:    5.0
    241241#MJCalibration.MCalibrationChargeCalc.ChargeLimit:        2.5
    242242#MJCalibration.MCalibrationChargeCalc.ChargeErrLimit:     0
  • trunk/MagicSoft/Mars/callisto_MarApr05.rc

    r8439 r8478  
    238238#MJCalibration.MCalibColorSet.ExplicitColor: green,blue,uv,ct1
    239239
    240 #MJCalibration.MCalibrationChargeCalc.ArrTimeRmsLimit:    3.5
     240#MJCalibration.MCalibrationChargeCalc.ArrTimeRmsLimit:    5.0
    241241#MJCalibration.MCalibrationChargeCalc.ChargeLimit:        2.5
    242242#MJCalibration.MCalibrationChargeCalc.ChargeErrLimit:     0
  • trunk/MagicSoft/Mars/callisto_mux.rc

    r8452 r8478  
    238238#MJCalibration.MCalibColorSet.ExplicitColor: green,blue,uv,ct1
    239239
    240 MJCalibration.MCalibrationChargeCalc.ArrTimeRmsLimit:    2.5
     240#MJCalibration.MCalibrationChargeCalc.ArrTimeRmsLimit:    5.0
    241241#MJCalibration.MCalibrationChargeCalc.ChargeLimit:        2.5
    242242#MJCalibration.MCalibrationChargeCalc.ChargeErrLimit:     0
  • trunk/MagicSoft/Mars/datacenter/macros/fillstar.C

    r8332 r8478  
    345345    }
    346346
    347     cout << "Q: " << query << endl;
     347//    cout << "Q: " << query << endl;
    348348
    349349    if (dummy)
  • trunk/MagicSoft/Mars/datacenter/macros/plotdb.C

    r8338 r8478  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: plotdb.C,v 1.33 2007-02-28 13:50:06 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: plotdb.C,v 1.34 2007-05-09 12:15:51 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    528528    //from calib*.root
    529529    plot.SetDescription("Conversion Factor inner Camera;C_{I} [phe/fadc cnts]", "ConvI");
    530     plot.Plot("Calibration.fConvFactorInner",  0, 0.5, 0.002);
     530    plot.Plot("Calibration.fConvFactorInner",  0, 0.7, 0.002);
    531531    plot.SetDescription("Mean Arrival Time inner Camera;T_{I} [sl]", "ArrTmI");
    532     plot.Plot("Calibration.fArrTimeMeanInner", 0, 9.0, 0.1);
     532    plot.Plot("Calibration.fArrTimeMeanInner", 0, 40.0, 0.1);
    533533    plot.SetDescription("RMS Arrival Time inner Camera;\\sigma_{T,I} [sl]", "RmsArrTmI");
    534     plot.Plot("Calibration.fArrTimeRmsInner",  0, 0.8, 0.01);
     534    plot.Plot("Calibration.fArrTimeRmsInner",  0, 3.0, 0.01);
    535535    plot.SetDescription("Number of unsuitable pixels inner Camera;N{I}", "UnsuitI");
    536     plot.Plot("Calibration.fUnsuitableInner",  0, 25, 1);
     536    plot.Plot("Calibration.fUnsuitableInner",  0, 75, 1);
     537    plot.SetDescription("Number of unsuitable pixels >50%;N", "Unsuit50");
     538    plot.Plot("Calibration.fUnsuitable50",  0, 75, 1);
     539    plot.SetDescription("Number of unsuitable pixels >1%;N", "Unsuit01");
     540    plot.Plot("Calibration.fUnsuitable01",  0, 75, 1);
    537541
    538542    //from signal*.root
     
    542546    plot.Plot("Calibration.fMeanSignalInner",  0, 7.0, 0.05);
    543547    plot.SetDescription("Mean PulsePosCheck (falling edge) inner camera;T [sl]", "ChkPos");
    544     plot.Plot("Calibration.fPulsePosCheckMean", 1, 15.0, 0.1);
     548    plot.Plot("Calibration.fPulsePosCheckMean", 1, 40.0, 0.1);
    545549    plot.SetDescription("Rms PulsePosCheck (falling edge) inner camera;T [sl]", "ChkRms");
    546550    plot.Plot("Calibration.fPulsePosCheckRms", 0, 5.0, 0.1);
    547551    plot.SetDescription("Mean calibrated PulsePos;T", "PulPos");
    548     plot.Plot("Calibration.fPulsePosMean", 1, 15.0, 0.1);
     552    plot.Plot("Calibration.fPulsePosMean", 1, 40.0, 0.1);
    549553    plot.SetDescription("Rms calibrated PulsePos;T", "PulRms");
    550     plot.Plot("Calibration.fPulsePosRms", 0, 2.0, 0.02);
     554    plot.Plot("Calibration.fPulsePosRms", 0, 3.0, 0.02);
    551555
    552556    plot.SetDescription("Hi-/Lo-Gain offset;", "PulOff");
     
    606610    //from calib*.root
    607611    plot.SetDescription("Conversion Factor outer Camera;C_{O} [phe/fadc cnts]", "ConvO");
    608     plot.Plot("Calibration.fConvFactorOuter",  0, 2.0, 0.01);
     612    plot.Plot("Calibration.fConvFactorOuter",  0, 3.0, 0.01);
    609613    plot.SetDescription("Mean Arrival Time outer Camera;T_{O} [sl]", "ArrTmO");
    610     plot.Plot("Calibration.fArrTimeMeanOuter", 0, 8.5, 0.1);
     614    plot.Plot("Calibration.fArrTimeMeanOuter", 0, 45, 0.1);
    611615    plot.SetDescription("RMS Arrival Time outer Camera;\\sigma_{T,O} [sl]", "RmsArrTmO");
    612     plot.Plot("Calibration.fArrTimeRmsOuter",  0, 1.0, 0.01);
     616    plot.Plot("Calibration.fArrTimeRmsOuter",  0, 3.0, 0.01);
    613617    plot.SetDescription("Number of unsuitable pixels outer Camera;N{O}", "UnsuitO");
    614618    plot.Plot("Calibration.fUnsuitableOuter",  0, 25, 1);
  • trunk/MagicSoft/Mars/mbadpixels/MBadPixelsPix.h

    r8458 r8478  
    8282    Bool_t IsHardwareBad (HardwareType_t     typ) const { return fInfo[2]&typ; }
    8383
    84     Bool_t IsUnsuitable() const { return fInfo[0]&kUnsuitable; }
    85     Bool_t IsUnreliable() const { return fInfo[0]&kUnreliable; }
     84    Bool_t IsUnsuitable() const   { return fInfo[0]&kUnsuitable; }
     85    Bool_t IsUnreliable() const   { return fInfo[0]&kUnreliable; }
     86    Bool_t IsUncalibrated() const { return fInfo[1]!=0; }
    8687
    8788    Bool_t IsOK()  const { return fInfo[0]==0; }
     
    100101      if (IsUncalibrated( kChargeIsPedestal    ))    return 1;
    101102      if (IsUncalibrated( kLoGainSaturation    ))    return 2;
    102       if (IsUncalibrated( kMeanTimeInFirstBin  ))    return 3;
    103       if (IsUncalibrated( kMeanTimeInLast2Bins ))    return 4;
    104       if (IsUncalibrated( kHiGainOverFlow      ))    return 5;
    105       if (IsUncalibrated( kLoGainOverFlow      ))    return 6;
    106       if (IsUncalibrated( kDeadPedestalRms     ))    return 7;
    107       if (IsUncalibrated( kFluctuatingArrivalTimes)) return 8;
    108       if (IsUncalibrated( kDeviatingNumPhes    ))    return 9;
    109       if (IsUncalibrated( kDeviatingTimeResolution)) return 10;
    110       if (IsUncalibrated( kLoGainBlackout      ))    return 11;
    111       if (IsUncalibrated( kPreviouslyExcluded  ))    return 12;
    112       return 13;
     103//      if (IsUncalibrated( kMeanTimeInFirstBin  ))    return 3;
     104//      if (IsUncalibrated( kMeanTimeInLast2Bins ))    return 4;
     105      if (IsUncalibrated( kHiGainOverFlow      ))    return 3;
     106      if (IsUncalibrated( kLoGainOverFlow      ))    return 4;
     107      if (IsUncalibrated( kDeadPedestalRms     ))    return 5;
     108      if (IsUncalibrated( kDeviatingNumPhes    ))    return 6;
     109      if (IsUncalibrated( kFluctuatingArrivalTimes)) return 7;
     110      if (IsUncalibrated( kDeviatingTimeResolution)) return 8;
     111      if (IsUncalibrated( kLoGainBlackout      ))    return 9;
     112      if (IsUncalibrated( kPreviouslyExcluded  ))    return 10;
     113      return 11;
    113114    }
    114115
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc

    r8452 r8478  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MCalibrationChargeCalc.cc,v 1.177 2007-04-27 10:04:46 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MCalibrationChargeCalc.cc,v 1.178 2007-05-09 12:15:52 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    1919!
    2020!   Author(s): Markus Gaug  02/2004 <mailto:markus@ifae.es>
     21!   Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de>
    2122!
    22 !   Copyright: MAGIC Software Development, 2000-2004
     23!   Copyright: MAGIC Software Development, 2000-2007
    2324!
    2425!
     
    213214#include "MLogManip.h"
    214215
     216#include "MMath.h"
     217
    215218#include "MParList.h"
    216219
     
    255258const Float_t MCalibrationChargeCalc::fgPheErrUpperLimit       = 5.5;
    256259const Float_t MCalibrationChargeCalc::fgFFactorErrLimit        = 4.5;
    257 const Float_t MCalibrationChargeCalc::fgArrTimeRmsLimit        = 3.5;
     260const Float_t MCalibrationChargeCalc::fgArrTimeRmsLimit        = 5.0;
    258261const Float_t MCalibrationChargeCalc::fgUnsuitablesLimit       = 0.1;
    259262const Float_t MCalibrationChargeCalc::fgUnreliablesLimit       = 0.3;
     
    672675}
    673676
     677// ----------------------------------------------------------------------------------------------------
     678//
     679// Check for outliers. They are marked with
     680// MBadPixelsPix::kFluctuatingArrivalTimes
     681//
     682// see also MCalibrationRelTimeCalc::FinalizeRelTimes
     683//
     684void MCalibrationChargeCalc::FinalizeAbsTimes()
     685{
     686    const Int_t npixels = fGeom->GetNumPixels();
     687    const Int_t nareas  = fGeom->GetNumAreas();
     688
     689    // Create an array capable of holding all pixels
     690    TArrayF arr(npixels);
     691
     692    for (Int_t aidx=0; aidx<nareas; aidx++)
     693    {
     694        Int_t n = 0;
     695        for (Int_t i=0; i<npixels; i++)
     696        {
     697            // Check for this aidx only
     698            if ((*fGeom)[i].GetAidx()!=aidx)
     699                continue;
     700
     701            // check if pixel may not contain a valid value
     702            if ((*fBadPixels)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
     703                continue;
     704
     705            // check if it was excluded for some reason
     706            const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
     707            if (pix.IsExcluded())
     708                continue;
     709
     710            // if TimePrecision is valid fill it into array
     711            if (pix.GetAbsTimeRms()>0)
     712                arr[n++] = pix.GetAbsTimeRms();
     713        }
     714
     715        // Check the ratio of valid entries to the ratio of pixels
     716        const Float_t ratio = 100*n/fGeom->GetNumPixWithAidx(aidx);
     717        if (3*ratio<2)
     718            *fLog << warn << "Area   " << setw(4) << aidx << ": Only " << ratio << "% pixels with valid time resolution found." << endl;
     719
     720        // Calculate median and median deviation
     721        Double_t med;
     722        const Double_t dev = MMath::MedianDev(n, arr.GetArray(), med);
     723
     724        // Calculate upper and lower limit
     725        const Float_t lolim = TMath::Max(med-fArrTimeRmsLimit*dev, 0.);
     726        const Float_t hilim = TMath::Max(med+fArrTimeRmsLimit*dev, 0.);
     727
     728        // Now find the outliers
     729        for (Int_t i=0; i<npixels; i++)
     730        {
     731            // Search only within this aidx
     732            if ((*fGeom)[i].GetAidx()!=aidx)
     733                continue;
     734
     735            // skip pixels already known to be unsuitable
     736            if ((*fBadPixels)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
     737                continue;
     738
     739            // check if a pixel has been excluded. This
     740            const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
     741
     742            // Check if time precision is valid (might be invalid
     743            // for example in cae of empty histograms)
     744            const Float_t res = pix.GetAbsTimeRms();
     745            if (res<0) //FIXME!!! How does this happen?
     746            {
     747                *fLog << warn << "Pixel  " << setw(4) << i << ": Abs-time resolution could not be calculated." << endl;
     748                (*fBadPixels)[i].SetUncalibrated(MBadPixelsPix::kDeviatingTimeResolution);
     749                continue;
     750            }
     751
     752            // Now compare to a lower and upper limit
     753            if (res<=lolim || res>=hilim)
     754            {
     755                *fLog << warn << "Pixel  " << setw(4) << i << ": Deviating abs-time resolution: "
     756                    << Form("%5.2f", res) << " out of range "
     757                    << Form("[%4.2f,%4.2f]", lolim, hilim) << endl;
     758
     759                (*fBadPixels)[i].SetUncalibrated(MBadPixelsPix::kFluctuatingArrivalTimes);
     760            }
     761        }
     762    }
     763}
     764
    674765// -----------------------------------------------------------------------
    675766//
     
    723814  // First loop over pixels, call FinalizePedestals and FinalizeCharges
    724815  //
    725   Int_t   nvalid      = 0;
    726 
     816  Int_t nvalid = 0;
    727817  for (Int_t pixid=0; pixid<fPedestals->GetSize(); pixid++)
    728     {
    729 
    730       MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[pixid];
     818  {
    731819      //
    732820      // Check if the pixel has been excluded from the fits
    733821      //
     822      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[pixid];
    734823      if (pix.IsExcluded())
    735         continue;
    736 
    737       MPedestalPix  &ped = (*fPedestals)[pixid];
    738       MBadPixelsPix &bad = (*fBadPixels)[pixid];
    739 
    740       const Int_t aidx    = (*fGeom)[pixid].GetAidx();
    741 
    742       FinalizePedestals(ped,pix,aidx);
    743 
    744       if (FinalizeCharges(pix,bad,"pixel  "))
    745         nvalid++;
    746 
    747       FinalizeArrivalTimes(pix,bad,"pixel  ");
    748     }
     824          continue;
     825
     826      FinalizePedestals((*fPedestals)[pixid], pix, (*fGeom)[pixid].GetAidx());
     827
     828      if (FinalizeCharges(pix, (*fBadPixels)[pixid], "Pixel  "))
     829          nvalid++;
     830  }
     831
     832  FinalizeAbsTimes();
    749833
    750834  *fLog << endl; 
     
    779863      // (already done for calibration sigma in MHCalibrationCam::CalcAverageSigma()
    780864      //
    781       pix.SetPedRMS(pix.GetPedRms()*TMath::Sqrt((Float_t)arr[aidx]),
    782                     pix.GetPedRmsErr()*TMath::Sqrt((Float_t)arr[aidx]));
     865      const Double_t sqrtnum = TMath::Sqrt((Double_t)arr[aidx]);
     866
     867      pix.SetPedRMS(pix.GetPedRms()*sqrtnum, pix.GetPedRmsErr()*sqrtnum);
    783868      pix.SetSigma (pix.GetSigma()/pix.GetFFactorFADC2Phe());
    784869
    785870      FinalizeCharges(pix, fCam->GetAverageBadArea(aidx),"area id");
    786       FinalizeArrivalTimes(pix, fCam->GetAverageBadArea(aidx), "area id");
    787871    }
    788872 
     
    850934  PrintUncalibrated(MBadPixelsPix::kLoGainSaturation,   
    851935                    "Low Gain Saturation:                              ");
    852   PrintUncalibrated(MBadPixelsPix::kMeanTimeInFirstBin,
    853                     Form("%s%2.1f%s","Mean Abs. Arr. Time in First ",1.," Bin(s):          "));
    854   PrintUncalibrated(MBadPixelsPix::kMeanTimeInLast2Bins,
    855                     Form("%s%2.1f%s","Mean Abs. Arr. Time in Last ",2.," Bin(s):           "));
     936//  PrintUncalibrated(MBadPixelsPix::kMeanTimeInFirstBin,
     937//                    Form("%s%2.1f%s","Mean Abs. Arr. Time in First ",1.," Bin(s):          "));
     938//  PrintUncalibrated(MBadPixelsPix::kMeanTimeInLast2Bins,
     939//                    Form("%s%2.1f%s","Mean Abs. Arr. Time in Last ",2.," Bin(s):           "));
    856940  PrintUncalibrated(MBadPixelsPix::kHiGainOverFlow,   
    857941                    "Pixels with High Gain Overflow:                   ");
     
    9741058  const TString desc = Form("%7s%4d: ", what, cal.GetPixId());
    9751059
     1060  if (cal.GetMean()<0)
     1061  {
     1062      *fLog << warn << desc << "Charge not fitted." << endl;
     1063      bad.SetUncalibrated( MBadPixelsPix::kChargeIsPedestal);
     1064      return kFALSE;
     1065  }
     1066
     1067  if (cal.GetSigma()<0)
     1068  {
     1069      *fLog << warn << desc << "Charge Sigma invalid." << endl;
     1070      bad.SetUncalibrated( MBadPixelsPix::kChargeIsPedestal);
     1071      return kFALSE;
     1072  }
     1073
    9761074  if (cal.GetMean() < fChargeLimit*cal.GetPedRms())
    9771075    {
     
    10841182
    10851183  return kTRUE;
    1086 }
    1087 
    1088 // -----------------------------------------------------------------------------------
    1089 //
    1090 // Test the arrival Times RMS of the pixel and set the bit
    1091 // - MBadPixelsPix::kFluctuatingArrivalTimes
    1092 //
    1093 void MCalibrationChargeCalc::FinalizeArrivalTimes(MCalibrationChargePix &cal, MBadPixelsPix &bad, const char* what)
    1094 {
    1095     if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
    1096         return;
    1097 
    1098     const TString desc = Form("%7s%4d: ", what, cal.GetPixId());
    1099 
    1100     if (cal.GetAbsTimeRms() > fArrTimeRmsLimit)
    1101     {
    1102         *fLog << warn;
    1103         *fLog << desc << "RMS of pulse arrival times: " << Form("%2.1f", cal.GetAbsTimeRms());
    1104         *fLog << " FADC sl. < " << Form("%2.1f", fArrTimeRmsLimit) << endl;
    1105         bad.SetUncalibrated( MBadPixelsPix::kFluctuatingArrivalTimes);
    1106     }
    11071184}
    11081185
     
    11341211            bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun   );
    11351212        }
    1136      
     1213/*
    11371214      if (IsCheckExtractionWindow())
    11381215        {
     
    11431220            bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun    );
    11441221        }
    1145 
     1222 */
    11461223      if (IsCheckDeviatingBehavior())
    11471224        {
     
    12751352          continue;
    12761353        }
    1277      
     1354
     1355      // FIXME: WHAT IS THIS FOR? It is overwritten!
    12781356      lowlim[i] = areaphes[i] - fPheErrLowerLimit*TMath::Sqrt(areavars[i]);
    12791357      upplim[i] = areaphes[i] + fPheErrUpperLimit*TMath::Sqrt(areavars[i]);
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h

    r8452 r8478  
    8383
    8484  // Pointers
    85 //  MBadPixelsIntensityCam         *fIntensBad;      //!  Bad Pixels
    8685  MBadPixelsCam                  *fBadPixels;      //!  Bad Pixels
    8786  MCalibrationChargeCam          *fCam;            //!  Calibrated Charges results of all pixels
     
    128127
    129128  // functions
    130   void   FinalizeArrivalTimes    ( MCalibrationChargePix &cal, MBadPixelsPix &bad, const char* what);
    131129  void   FinalizeBadPixels       ();
    132130  Bool_t FinalizeBlindCam        (); 
     
    141139  Bool_t FinalizeUnsuitablePixels();
    142140
     141  void FinalizeAbsTimes();
     142
    143143  const char* GetOutputFile();
    144144
  • trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc

    r8458 r8478  
    1717!
    1818!   Author(s): Markus Gaug  04/2004 <mailto:markus@ifae.es>
    19 !
    20 !   Copyright: MAGIC Software Development, 2000-2004
     19!   Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de>
     20!
     21!   Copyright: MAGIC Software Development, 2000-2007
    2122!
    2223!
     
    242243// MBadPixelsPix::kDeviatingTimeResolution
    243244//
     245// see also MCalibrationChargeCalc::FinalizeAbsTimes
     246//
    244247void MCalibrationRelTimeCalc::FinalizeRelTimes()
    245248{
     
    260263
    261264            // check if pixel may not contain a valid value
    262             if ((*fBadPixels)[i].IsUnsuitable())
     265            if ((*fBadPixels)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
    263266                continue;
    264267
     
    281284        Double_t med;
    282285        const Double_t dev = MMath::MedianDev(n, arr.GetArray(), med);
     286
     287        // Calculate upper and lower limit
     288        const Float_t lolim = TMath::Max(med-fRelTimeResolutionLimit*dev, 0.);
     289        const Float_t hilim = TMath::Max(med+fRelTimeResolutionLimit*dev, 0.);
    283290
    284291        // Now find the outliers
     
    290297
    291298            // skip pixels already known to be unsuitable
    292             if ((*fBadPixels)[i].IsUnsuitable())
     299            if ((*fBadPixels)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
    293300                continue;
    294301
     
    301308            if (res<0) //FIXME!!! How does this happen?
    302309            {
    303                 *fLog << warn << "Pixel  " << setw(4) << i << ": Time resolution could not be calculated." << endl;
     310                *fLog << warn << "Pixel  " << setw(4) << i << ": Rel-time resolution could not be calculated." << endl;
    304311                (*fBadPixels)[i].SetUncalibrated(MBadPixelsPix::kDeviatingTimeResolution);
    305312                continue;
     
    307314
    308315            // Now compare to a lower and upper limit
    309             const Float_t lolim = TMath::Max(med-fRelTimeResolutionLimit*dev, 0.);
    310             const Float_t hilim = TMath::Max(med+fRelTimeResolutionLimit*dev, 0.);
    311 
    312316            if (res<=lolim || res>=hilim)
    313317            {
    314                 *fLog << warn << "Pixel  " << setw(4) << i << ": Deviating time resolution: "
    315                     << Form("%4.2f", res) << " out of range "
     318                *fLog << warn << "Pixel  " << setw(4) << i << ": Deviating rel-time resolution: "
     319                    << Form("%5.2f", res) << " out of range "
    316320                    << Form("[%4.2f,%4.2f]", lolim, hilim) << endl;
    317321
  • trunk/MagicSoft/Mars/mhvstime/MHVsTime.cc

    r8082 r8478  
    1818!   Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2004
     20!   Copyright: MAGIC Software Development, 2000-2007
    2121!
    2222!
     
    5858//  - MDataChain *fError;     // Object from which the error is filled
    5959//
     60// Class Version 3:
     61// ----------------
     62//  + Double_t fMinimum;      // User defined minimum
     63//  + Double_t fMaximum;      // User defined maximum
     64//
    6065/////////////////////////////////////////////////////////////////////////////
    6166#include "MHVsTime.h"
     
    9297MHVsTime::MHVsTime(const char *rule, const char *error)
    9398    : fGraph(NULL), fData(NULL), fError(NULL), fScale(1), fMaxPts(-1),
    94     fNumEvents(1), fUseEventNumber(0)
     99    fNumEvents(1), fMinimum(-1111), fMaximum(-1111), fUseEventNumber(0)
    95100{
    96101    fName  = gsDefName;
     
    129134// --------------------------------------------------------------------------
    130135//
    131 // Call SetMinimum of fGraph
    132 //
    133 void MHVsTime::SetMinimum(Double_t min)
    134 {
    135     if (fGraph)
    136         fGraph->SetMinimum(min);
    137 }
    138 
    139 // --------------------------------------------------------------------------
    140 //
    141136// Return the data members used by the data chain to be used in
    142137// MTask::AddBranchToList
     
    178173    fMean = 0;
    179174    fN    = 0;
     175
     176    fMin =  FLT_MAX;
     177    fMax = -FLT_MAX;
    180178
    181179    return kTRUE;
     
    252250        }
    253251
    254         fGraph->SetPoint(fGraph->GetN(), t, fMean/fN*fScale);
     252        const Double_t val = fMean/fN*fScale;
     253
     254        fGraph->SetPoint(fGraph->GetN(), t, val);
    255255
    256256        if (fError)
    257257            static_cast<TGraphErrors*>(fGraph)->SetPointError(fGraph->GetN()-1, 0, fMeanErr/fN*fScale);
     258
     259        fMin = TMath::Min(fMin, val);
     260        fMax = TMath::Max(fMax, val);
    258261
    259262        fMean = 0;
     
    265268}
    266269
     270// --------------------------------------------------------------------------
     271//
     272// Set Minimum and Maximum;
     273Bool_t MHVsTime::Finalize()
     274{
     275    const Double_t add = (fMax-fMin)*0.15;
     276
     277    if (fMinimum==-1111)
     278        fGraph->SetMinimum(fMin-add);
     279    if (fMaximum==-1111)
     280        fGraph->SetMaximum(fMax+add);
     281
     282    return kTRUE;
     283}
     284
    267285void MHVsTime::Paint(Option_t *opt)
    268286{
    269     /*
    270      *fLog << all << fGraph << " " << gPad->GetName() << " ----> Paint " << opt << endl;
    271      TListIter Next(gPad->GetListOfPrimitives()); TObject *obj;
    272      while ((obj=Next())) *fLog << obj << " " << obj->GetName() << " " << obj->ClassName() << " " << Next.GetOption() << endl;
    273      */
    274287    if (!fGraph)
    275288        return;
    276 
    277 //    *fLog << all << fGraph->GetN() << " " << opt << endl;
    278289
    279290    if (fGraph->GetN()==0)
     
    318329        gPad->SetLogy();
    319330
     331    // If this is set to early the plot remains empty in root 5.12/00
     332    if (fMinimum!=-1111)
     333        fGraph->SetMinimum(fMinimum);
     334    if (fMaximum!=-1111)
     335        fGraph->SetMaximum(fMaximum);
     336
     337
    320338    // This is a workaround if the TGraph has only one point.
    321339    // Otherwise MStatusDisplay::Update hangs.
    322 //    gPad->GetListOfPrimitives()->Remove(fGraph);
    323 //    fGraph->Draw(fGraph->GetN()<2 ? "A" : str.Data());
    324     //gPad->GetListOfPrimitives()->Add(fGraph, fGraph->GetN()<2 ? "A" : opt);
    325     //    AppendPad(str);
    326     //    fGraph->Draw(str);
    327 
     340    gPad->GetListOfPrimitives()->Remove(fGraph);
     341    fGraph->Draw(fGraph->GetN()<2 ? "A" : str.Data());
    328342}
    329343
     
    339353    pad->SetBorderMode(0);
    340354    AppendPad(opt);
    341 
    342     fGraph->Draw("A");
    343355}
    344356
  • trunk/MagicSoft/Mars/mhvstime/MHVsTime.h

    r8082 r8478  
    3434    MTime       fLast;      //! For checks
    3535
     36    Double_t fMinimum;      // User defined minimum
     37    Double_t fMaximum;      // User defined maximum
     38
     39    Double_t fMin;          //! Calculation of minimum
     40    Double_t fMax;          //! Calculation of maximum
     41
    3642    enum {
    3743        kIsLogy = BIT(18)
     
    4046    Bool_t fUseEventNumber;
    4147
     48    Bool_t Finalize();
     49
    4250public:
    4351    MHVsTime(const char *rule=NULL, const char *ruleerr=NULL);
     
    4553
    4654    void SetScale(Double_t scale) { fScale = scale; }
    47     void SetMinimum(Double_t min=-1111);
     55
     56    void SetMinimum(Double_t min=-1111) { fMinimum = min; }
     57    void SetMaximum(Double_t max=-1111) { fMaximum = max; }
    4858
    4959    Int_t GetNbins() const;
     
    7888    void SetMaxPts(Int_t n) { fMaxPts=n; }
    7989
    80     ClassDef(MHVsTime, 2) // Generalized 1/2/3D-histogram for Mars variables
     90    ClassDef(MHVsTime, 3) // Generalized 1/2/3D-histogram for Mars variables
    8191};
    8292
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.cc

    r8455 r8478  
    829829
    830830      const Double_t min = 1;
    831       const Double_t max = 12.;
     831      const Double_t max = 10.;
    832832      const Double_t f   = (numcol-1)/(max-min);
    833833
     
    848848      DrawBadPixel(*pave, disp24,  1, f, "Signal smaller 4.5 Pedestal RMS:               ");
    849849      DrawBadPixel(*pave, disp24,  2, f, "Low Gain Saturation:                                   ");
    850       DrawBadPixel(*pave, disp24,  3, f, "Mean Arr. Time In First Extraction Bin:      ");
    851       DrawBadPixel(*pave, disp24,  4, f, "Mean Arr. Time In Last 2 Extraction Bins:  ");
    852       DrawBadPixel(*pave, disp24,  5, f, "High-Gain Histogram Overflow:                  ");
    853       DrawBadPixel(*pave, disp24,  6, f, "Low-Gain Histogram Overflow:                   ");
    854       DrawBadPixel(*pave, disp24,  7, f, "Presumably dead from Ped. Rms:              ");
    855       DrawBadPixel(*pave, disp24,  8, f, "Fluctuating Pulse Arrival Times:                 ");
    856       DrawBadPixel(*pave, disp24,  9, f, "Deviating Number of Photo-electrons:       ");
    857       DrawBadPixel(*pave, disp24, 10, f, "Deviating Rel. Arrival Time RMS:                ");
    858       DrawBadPixel(*pave, disp24, 11, f, "Too many Low-Gain Blackout Events:       ");
    859       DrawBadPixel(*pave, disp24, 12, f, "Previously Excluded:                                   ");
     850      // DrawBadPixel(*pave, disp24,  3, f, "Mean Arr. Time In First Extraction Bin:      ");
     851      // DrawBadPixel(*pave, disp24,  4, f, "Mean Arr. Time In Last 2 Extraction Bins:  ");
     852      DrawBadPixel(*pave, disp24,  3, f, "High-Gain Histogram Overflow:                  ");
     853      DrawBadPixel(*pave, disp24,  4, f, "Low-Gain Histogram Overflow:                   ");
     854      DrawBadPixel(*pave, disp24,  5, f, "Presumably dead from Ped. Rms:              ");
     855      DrawBadPixel(*pave, disp24,  6, f, "Deviating Number of Photo-electrons:       ");
     856      DrawBadPixel(*pave, disp24,  7, f, "Fluctuating Pulse Arrival Times:                 ");
     857      DrawBadPixel(*pave, disp24,  8, f, "Deviating Rel. Arrival Time RMS:                ");
     858      DrawBadPixel(*pave, disp24,  9, f, "Too many Low-Gain Blackout Events:       ");
     859      DrawBadPixel(*pave, disp24, 10, f, "Previously Excluded:                                   ");
    860860      pave->Draw();
    861861
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSpline.cc

    r8368 r8478  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndChargeSpline.cc,v 1.67 2007-03-05 08:55:09 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndChargeSpline.cc,v 1.68 2007-05-09 12:15:53 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    2020!   Author(s): Markus Gaug 09/2004 <mailto:markus@ifae.es>
    2121!
    22 !   Copyright: MAGIC Software Development, 2002-2006
     22!   Copyright: MAGIC Software Development, 2002-2007
    2323!
    2424!
     
    145145#include "MExtractTimeAndChargeSpline.h"
    146146
    147 #include "MExtralgoSpline.h"
    148 
    149147#include "MPedestalPix.h"
    150148
     
    181179//
    182180MExtractTimeAndChargeSpline::MExtractTimeAndChargeSpline(const char *name, const char *title)
    183     : fExtractionType(kIntegral)
     181    : fHeightTm(0.5), fExtractionType(MExtralgoSpline::kIntegralRel)
    184182{
    185183
     
    220218//               second derivative to zero, there.
    221219//
    222 void MExtractTimeAndChargeSpline::SetChargeType( ExtractionType_t typ )
     220void MExtractTimeAndChargeSpline::SetChargeType(MExtralgoSpline::ExtractionType_t typ)
    223221{
    224222  fExtractionType = typ;
     
    228226  switch (fExtractionType)
    229227  {
    230   case kAmplitude:
     228  case MExtralgoSpline::kAmplitude:
    231229      SetResolutionPerPheHiGain(0.053);
    232230      SetResolutionPerPheLoGain(0.016);
    233231      return;
    234232
    235   case kIntegral:
     233  case MExtralgoSpline::kIntegralRel:
     234  case MExtralgoSpline::kIntegralAbs:
    236235      switch (fWindowSizeHiGain)
    237236      {
     
    305304    switch (fExtractionType)
    306305    {
    307     case kAmplitude:
     306    case MExtralgoSpline::kAmplitude:
    308307        fNumHiGainSamples  = 1.;
    309308        fNumLoGainSamples  = fLoGainLast ? 1. : 0.;
     
    315314        break;
    316315
    317     case kIntegral:
     316    case MExtralgoSpline::kIntegralAbs:
     317    case MExtralgoSpline::kIntegralRel:
    318318        fNumHiGainSamples  = fRiseTimeHiGain + fFallTimeHiGain;
    319319        fNumLoGainSamples  = fLoGainLast ? fRiseTimeLoGain + fFallTimeLoGain : 0.;
     
    336336    MExtralgoSpline s(ptr, num, fHiGainFirstDeriv.GetArray(), fHiGainSecondDeriv.GetArray());
    337337
     338    s.SetExtractionType(fExtractionType);
     339    s.SetHeightTm(fHeightTm);
    338340    s.SetRiseFallTime(fRiseTimeHiGain, fFallTimeHiGain);
    339341
     
    357359    MExtralgoSpline s(ptr, num, fLoGainFirstDeriv.GetArray(), fLoGainSecondDeriv.GetArray());
    358360
     361    s.SetExtractionType(fExtractionType);
     362    s.SetHeightTm(fHeightTm);
    359363    s.SetRiseFallTime(fRiseTimeLoGain, fFallTimeLoGain);
    360364
     
    404408      rc = kTRUE;
    405409    }
    406  
     410  if (IsEnvDefined(env, prefix, "HeightTm", print))
     411    {
     412      fHeightTm = GetEnvValue(env, prefix, "HeightTm", fHeightTm);
     413      rc = kTRUE;
     414    }
     415
    407416  if (IsEnvDefined(env, prefix, "ExtractionType", print))
    408417  {
     
    411420      type = type.Strip(TString::kBoth);
    412421      if (type==(TString)"amplitude")
    413           SetChargeType(kAmplitude);
    414       if (type==(TString)"integral")
    415           SetChargeType(kIntegral);
     422          SetChargeType(MExtralgoSpline::kAmplitude);
     423      if (type==(TString)"integralabsolute")
     424          SetChargeType(MExtralgoSpline::kIntegralAbs);
     425      if (type==(TString)"integralrelative")
     426          SetChargeType(MExtralgoSpline::kIntegralRel);
    416427      rc=kTRUE;
    417428  }
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSpline.h

    r8304 r8478  
    44#ifndef MARS_MExtractTimeAndCharge
    55#include "MExtractTimeAndCharge.h"
     6#endif
     7
     8#ifndef MARS_MExtralgoSpline
     9#include "MExtralgoSpline.h"
    610#endif
    711
     
    4145
    4246    Float_t fLoGainStretch;                  // The stretch of the low-gain w.r.t. the high-gain pulse
     47    Float_t fHeightTm;
    4348
    4449//    Int_t   fRandomIter;                     //! Counter used to randomize weights for noise calculation
     
    4752    Bool_t  InitArrays(Int_t n);
    4853
    49 public:
    50     enum ExtractionType_t { kAmplitude, kIntegral };    //! Possible time and charge extraction types
    51 
    5254private:
    53     ExtractionType_t fExtractionType;
     55    MExtralgoSpline::ExtractionType_t fExtractionType;
    5456
    5557public:
    5658    MExtractTimeAndChargeSpline(const char *name=NULL, const char *title=NULL);
    57     ~MExtractTimeAndChargeSpline() {}
    5859
    5960    Float_t GetRiseTimeHiGain() const { return fRiseTimeHiGain; }
     
    8384    void SetLoGainStretch(const Float_t f=fgLoGainStretch) { fLoGainStretch = f;   }
    8485
    85     void SetChargeType(const ExtractionType_t typ=kIntegral);
     86    void SetChargeType(const MExtralgoSpline::ExtractionType_t typ=MExtralgoSpline::kIntegralRel);
    8687/*
    8788    void FindTimeAndChargeHiGain(Byte_t *first, Byte_t *logain, Float_t &sum, Float_t &dsum,
     
    100101                                  Byte_t sat, Int_t maxpos) const;
    101102
    102     ClassDef(MExtractTimeAndChargeSpline, 4)   // Task to Extract Arrival Times and Charges using a Cubic Spline
     103    ClassDef(MExtractTimeAndChargeSpline, 5)   // Task to Extract Arrival Times and Charges using a Cubic Spline
    103104};
    104105
  • trunk/MagicSoft/Mars/showplot.cc

    r8088 r8478  
    258258        d->SetCanvasWidth(kCanvasWidth);
    259259
    260     d->Open(kInput);
     260    const Int_t rc = d->Open(kInput);
    261261
    262262    if (kPrint)
     
    285285        d->SaveAsC(kTab,    kNameC);
    286286
    287     if (kBatch || kQuit)
     287    if (kBatch || kQuit || !rc)
    288288    {
    289289        delete d;
Note: See TracChangeset for help on using the changeset viewer.