Changeset 8452


Ignore:
Timestamp:
04/27/07 11:05:11 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r8451 r8452  
    1919                                                 -*-*- END OF LINE -*-*-
    2020
     21 2007/04/27 Thomas Bretz
     22
     23   * mcalib/CalibLinkDef.h, mcalib/Makefile:
     24     - removed obsolete MCalibrationIntensityCam
     25     - removed obsolete MCalibrationIntensityChargeCam
     26
     27   * mcalib/MCalibCalcFromPast.[h,cc], mcalib/MCalibColorSteer.[h,cc],
     28     mcalib/MCalibrateData.[h,cc], mhcalib/MHCalibrationChargeCam.[h,cc]:
     29     - removed obsolete MCalibrationIntensityChargeCam and replaced by
     30       MCalibrationChargeCam
     31
     32   * mcalib/MCalibrationChargeCalc.[h,cc]:
     33     - removed obsolete MCalibrationIntensityChargeCam and replaced by
     34       MCalibrationChargeCam
     35     - to realize the difference between continous and single calibration
     36       a new data member fContinousCalibration has been introduced
     37     - consequently increased version number to 6
     38     - do not set any exclusion in ReInit. it is nonsense not to fill
     39       histograms which might give (or give not) correct result,
     40       if the checks are all executed anyhow
     41
     42   * mcalib/MCalibrationRelTimeCalc.cc:
     43     - do not set any exclusion in ReInit and if a pixel is unsuitable.
     44       it is nonsense not to fill histograms which might give (or give
     45       not) correct result, if the checks are all executed anyhow
     46     - switched on the check for outliers
     47     - outliers are now set unsuitable rather than unreliable
     48     - some code simplification of the checks
     49
     50   * mcalib/MCalibrationChargeCam.cc:
     51     - added a comment in the Clear member function
     52
     53   * mcalib/MCalibrationRelTimeCam.cc:
     54     - some fixes of looong Form statements
     55     - a small cosmetic change to GetPixelContent
     56     - replaced the old check of the average time resolution by
     57       a more accurate check using the median and deviation
     58
     59   * mhcalib/MHCalibrationRelTimeCam.[h,cc]:
     60     - removed data member fReferencePixel and corresponding code
     61     - use the median of pixels with area index 0 as reference instead of
     62       an artificial pixel
     63
     64   * mhcalib/MHCalibrationCam.[h,cc]:
     65     - finally removed all dependencies on the intensity cams and replaced
     66       them by the direct cam
     67     - if the lo-gain histogram is empty this is not a reason for an
     68       uncalibrated pixel. At least in case of extracted properties (charge
     69       and time) it is ok. 
     70
     71   * mjobs/MJCalibration.cc:
     72     - let MCalibrationRelTimeCalc run after MCalibrationChargeCalc
     73       otherwise almost all unsuitable pixels have deviating
     74       relative arrival resolution.
     75     - added new level for deviating time reolution to plot of bad pixels
     76     - changed reference lines for timr resolution plots
     77     - removed data member fRefTimeOffsetInner, it is now 0 by definition
     78
     79   * mjobs/MJCalibrateSignal.cc:
     80     - finally removed all dependencies of Intensity cams
     81     - enable ContinousCalibration in MCalibrationChargeCalc instead
     82     - switched on interleaved relative time calibration
     83
     84   * mbadpixels/MBadPixelsPix.h:
     85     - adapted to new unsuitable flag kDeviatingTimeResolution
     86
     87   * callisto_mux.rc:
     88     - removed the obsolete resource statement about the level
     89       for the relative arrival time check.
     90
     91   * mjobs/calibrationref.rc, mjobs/calibrationref_Dec04.rc,
     92     mjobs/calibrationref_Nov04.rc, resources/calibrationref_mux.rc:
     93     - changed time resolution references accordingly
     94
     95
     96
    2197 2007/04/26 Thomas Bretz
    2298
  • trunk/MagicSoft/Mars/NEWS

    r8442 r8452  
    5656     helps to get rid of artefacts in histograms. For the signal this
    5757     is not necessray because it is displayed in log-scale anyhow
     58
     59   - callisto: Fixed a problem with internal exclusions. Pixels which
     60     have once been marked as unsuitable didn't get the necessary
     61     histograms filled anymore to be rechecked with each interleaved
     62     calibration.
     63
     64   - callisto: The relative arrival time resolution (the rms of the
     65     relative arrival time offset) is now checked against its
     66     median and the median deviation, instead of the average
     67     plus an absolute offset.
     68
     69   - callisto: The relative arrival time offset is now calculated
     70     w.r.t. its median not w.r.t. to an artificial reference pixel.
     71
     72   - callisto: The relative time calibration now marks pixels with
     73     outlaying offset as unsuitable
     74
     75   - callisto: The interleaved relative time calibration has been switched
     76     on. The advantage is that pixels which are marked as outliers
     77     now can recover. An improvement over time is not expected, because
     78     the relative time calibration seems stable.
    5879
    5980   - ganymed: If the dataset file containes "MonteCarlo: Yes" the "-mc"
  • trunk/MagicSoft/Mars/callisto_mux.rc

    r8439 r8452  
    282282#MJCalibration.MHCalibrationRelTimeCam.PulserFrequency: 500
    283283
    284 MJCalibration.MCalibrationRelTimeCalc.RelTimeResolutionLimit: 0.2
    285 
    286284# ==========================================================================
    287285#############################################################################
  • trunk/MagicSoft/Mars/mbadpixels/MBadPixelsPix.h

    r7188 r8452  
    107107      if (IsUncalibrated( kFluctuatingArrivalTimes)) return 8;
    108108      if (IsUncalibrated( kDeviatingNumPhes    ))    return 9;
    109       if (IsUncalibrated( kLoGainBlackout      ))    return 10;
    110       if (IsUncalibrated( kPreviouslyExcluded  ))    return 11;
    111       return 12;
     109      if (IsUncalibrated( kDeviatingTimeResolution)) return 10;
     110      if (IsUncalibrated( kLoGainBlackout      ))    return 11;
     111      if (IsUncalibrated( kPreviouslyExcluded  ))    return 12;
     112      return 13;
    112113    }
    113114
     
    115116      if (!IsUnreliable() || IsUnsuitable())      return 0;
    116117      if (IsUncalibrated( kChargeSigmaNotValid )) return 1;
    117       if (IsUncalibrated( kDeviatingNumPhes    )) return 2;
    118118      if (IsUncalibrated( kHiGainNotFitted     )) return 3;
    119119      if (IsUncalibrated( kLoGainNotFitted     )) return 4;
  • trunk/MagicSoft/Mars/mcalib/CalibLinkDef.h

    r8429 r8452  
    1616#pragma link C++ class MCalibConstCam+;
    1717#pragma link C++ class MCalibConstPix+;
    18 
    19 #pragma link C++ class MCalibrationIntensityCam+;
    20 #pragma link C++ class MCalibrationIntensityChargeCam+;
    2118
    2219#pragma link C++ class MCalibrationCam+;
  • trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.cc

    r8428 r8452  
    3030//  Input Containers:
    3131//   MParList
    32 //   MCalibrationIntensityChargeCam
    3332//
    3433//  Output Containers:
    35 //   MCalibrationIntensityChargeCam
    3634//
    3735// Class version 2:
     
    5553#include "MHCalibrationCam.h"
    5654
    57 #include "MCalibrationIntensityChargeCam.h"
    58 
    5955#include "MBadPixelsCam.h"
    6056
    6157#include "MCalibrationQECam.h"
    6258#include "MCalibrationBlindCam.h"
     59#include "MCalibrationChargeCam.h"
    6360#include "MCalibrationChargePix.h"
    6461#include "MCalibrationChargeCalc.h"
     
    8380MCalibCalcFromPast::MCalibCalcFromPast(const char *name, const char *title)
    8481    : fGeom(NULL), fParList(NULL), fRunHeader(NULL),
    85     fIntensCharge(NULL), fBlindCam(NULL), fQECam(NULL), fBadPixels(NULL),
     82    fCharge(NULL), fBlindCam(NULL), fQECam(NULL), fBadPixels(NULL),
    8683    fChargeCalc(NULL), fRelTimeCalc(NULL), fCalibrate(NULL),
    8784    fNumCam(0), fNumEvents(0), fUpdateWithFFactorMethod(kTRUE), fUpdateNumPhes(kTRUE),
     
    133130
    134131  //
    135   // Look for the MBadPixels Intensity Cam
     132  // Look for the MCalibrationQECam
    136133  //
    137134  fQECam = (MCalibrationQECam*)pList->FindObject("MCalibrationQECam");
     
    143140
    144141  //
    145   // Look for the MFillH-class "MHCalibrationBlindCam". In case yes, initialize the
    146   // corresponding IntensityCam
     142  // Look for the MFillH-class "MHCalibrationBlindCam".
    147143  //
    148144  if (pList->FindObject(AddSerialNumber("MHCalibrationBlindCam")))
     
    156152
    157153  //
    158   // Look for the MFillH-class "MHCalibrationChargeCam". In case yes, initialize the
    159   // corresponding IntensityCam
     154  // Look for the MFillH-class "MHCalibrationChargeCam".
    160155  //
    161156  if (pList->FindObject(AddSerialNumber("MHCalibrationChargeCam")))
    162157  {
    163158
    164     fIntensCharge = (MCalibrationIntensityChargeCam*)pList->FindCreateObj("MCalibrationIntensityChargeCam");
    165     if (!fIntensCharge)
    166         return kFALSE;
    167 
    168     MCalibrationChargeCam *chargeinit = (MCalibrationChargeCam*)pList->FindObject("MCalibrationChargeCam");
    169 
    170     if (chargeinit)
    171       fIntensCharge->SetCam(chargeinit,0);
    172     else
    173       *fLog << "Could not find initial MCalibrationChargeCam, cannot initialize intensity cam" << endl;
     159    fCharge = (MCalibrationChargeCam*)pList->FindCreateObj("MCalibrationChargeCam");
     160    if (!fCharge)
     161        return kFALSE;
    174162
    175163    if (!fChargeCalc)
     
    194182
    195183  //
    196   // Look for the MFillH name "FillRelTimeCam". In case yes, initialize the
    197   // corresponding IntensityCam
     184  // Look for the MFillH name "FillRelTimeCam".
    198185  //
    199186  if (pList->FindObject(AddSerialNumber("MHCalibrationRelTimeCam")))
    200187  {
    201     // if (!pList->FindCreateObj("MCalibrationIntensityRelTimeCam"))
    202     //    return kFALSE;
    203 
    204188    if (!fRelTimeCalc)
    205189      fRelTimeCalc   = (MCalibrationRelTimeCalc*)pList->FindObject(AddSerialNumber("MCalibrationRelTimeCalc"));
     
    252236//
    253237// - Initializes new containers in the
    254 // - Intensity Cams, if the number of calibration events has reach fNumEventsDump.
     238// - if the number of calibration events has reach fNumEventsDump.
    255239// - Executes Finalize() of the MCalibration*Calc classes in that case.
    256240// - Sets the latest MCalibrationChargeCam as update class into MCalibrateData
    257 // - Initialize new MCalibration*Cams into the intensity cams.
     241// - clean MCalibration*Cams
    258242//
    259243Int_t MCalibCalcFromPast::Process()
     
    263247
    264248  // Replace the old cams by (empty) new ones
    265   // MCalibrationChargeCam: fIntensCharge
     249  // MCalibrationChargeCam: fCharge
    266250  // MCalibrationQECam:     fIntensQE
    267251  // MCalibrationBlindCam:  fIntensBlind
     
    276260  *fLog << inf << "Finalize calibration histograms:" << endl;
    277261
    278   // This fills the IntensityCam which are newly created by
     262  // This fills the Cams which are cleared by
    279263  // ReInitialize with the result of the last calib cycle
    280264  Finalize("MHCalibrationChargeCam");
     
    299283        if (fUpdateNumPhes)
    300284        {
    301           MCalibrationChargePix &avpix =(MCalibrationChargePix&)fIntensCharge->GetCam()->GetAverageArea(0);
     285          MCalibrationChargePix &avpix =(MCalibrationChargePix&)fCharge->GetAverageArea(0);
    302286          fPhes   [fNumPhes] = avpix.GetPheFFactorMethod();
    303287          fPhesVar[fNumPhes] = avpix.GetPheFFactorMethodVar();
     
    329313
    330314  if (fCalibrate)
    331     return fCalibrate->UpdateConversionFactors(fUpdateWithFFactorMethod ? NULL
    332                                                : (MCalibrationChargeCam*)fIntensCharge->GetCam() );
     315    return fCalibrate->UpdateConversionFactors(fUpdateWithFFactorMethod ? NULL : fCharge);
    333316
    334317  return kTRUE;
     
    358341// --------------------------------------------------------------------------
    359342//
    360 // Re-Intitializes new containers inside the Intensity Cams.
    361 // From now on, a call to the IntensityCam functions returns pointers
    362 // to the newly created Containers.
     343// Clear contents of cams
    363344//
    364345Bool_t MCalibCalcFromPast::ReInitialize()
     
    391372  // IF SIMPLE ENOUGH, REMOVE THE FUNCTION!
    392373
    393   if (fIntensCharge)
    394   {
    395         *fLog << "MCalibrationChargeCam...";
    396         MCalibrationChargeCam *cold = (MCalibrationChargeCam*)fIntensCharge->GetCam();
    397 
    398         fIntensCharge->AddToList(Form("MCalibrationChargeCam%04d",fNumCam),*fGeom);
    399 
    400         MCalibrationChargeCam *cnew = (MCalibrationChargeCam*)fIntensCharge->GetCam();
    401         cnew->SetRunNumber(runnumber);
    402 
    403         if (cold)
    404         {
    405             cnew->MergeHiLoConversionFactors(*cold);
    406             fIntensCharge->DeleteOldCam(cold);
    407         }
     374  if (fCharge)
     375  {
     376      *fLog << "MCalibrationChargeCam...";
     377      fCharge->Clear();
     378      fCharge->SetRunNumber(runnumber);
    408379  }
    409380
  • trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.h

    r8427 r8452  
    1717class MCalibrationRelTimeCalc;
    1818class MCalibrateData;
    19 class MCalibrationIntensityChargeCam;
     19class MCalibrationChargeCam;
    2020class MCalibrationBlindCam;
    2121class MCalibrationQECam;
     
    3232  MParList                        *fParList;         //! Parameter List
    3333  MRawRunHeader                   *fRunHeader;       //! Run header storing the run number
    34   MCalibrationIntensityChargeCam  *fIntensCharge;    //! Intensity Charge Cam (to be created)
     34  MCalibrationChargeCam           *fCharge;          //! Intensity Charge Cam (to be created)
    3535
    3636  MCalibrationBlindCam            *fBlindCam;        //! Blind  Cam
  • trunk/MagicSoft/Mars/mcalib/MCalibColorSteer.cc

    r8428 r8452  
    3333//   MCalibrationPattern
    3434//   MParList
    35 //   MCalibrationIntensityChargeCam
    3635//
    3736//  Output Containers:
    38 //   MCalibrationIntensityChargeCam
    3937//
    4038//////////////////////////////////////////////////////////////////////////////
     
    5553#include "MBadPixelsCam.h"
    5654
    57 #include "MCalibrationIntensityChargeCam.h"
    58 
    5955#include "MCalibrationPattern.h"
    6056#include "MCalibrationQECam.h"
     
    7672//
    7773MCalibColorSteer::MCalibColorSteer(const char *name, const char *title)
    78     : fCalibPattern(NULL), fGeom(NULL), fParList(NULL),
    79       fIntensCharge(NULL),
     74    : fCalibPattern(NULL), fGeom(NULL), fParList(NULL), fCharge(NULL),
    8075      fBad(NULL), fChargeCalc(NULL), fRelTimeCalc(NULL), fHistCopy(kFALSE)
    8176{
     
    148143
    149144  //
    150   // Look for the MFillH name "FillChargeCam". In case yes, initialize the
    151   // corresponding IntensityCam
     145  // Look for the MFillH name "FillChargeCam".
    152146  //
    153147  if (pList->FindObject(AddSerialNumber("MHCalibrationChargeCam")))
     
    155149      *fLog << inf << "Found MHCalibrationChargeCam ... " << flush;
    156150
    157       fIntensCharge = (MCalibrationIntensityChargeCam*)pList->FindCreateObj("MCalibrationIntensityChargeCam");
    158       if (!fIntensCharge)
     151      fCharge = (MCalibrationChargeCam*)pList->FindCreateObj("MCalibrationChargeCam");
     152      if (!fCharge)
    159153          return kFALSE;
    160154
     
    172166
    173167  //
    174   // Look for the MFillH name "FillRelTimeCam". In case yes, initialize the
    175   // corresponding IntensityCam
     168  // Look for the MFillH name "FillRelTimeCam".
    176169  //
    177170  if (pList->FindObject(AddSerialNumber("MHCalibrationRelTimeCam")))
     
    199192// --------------------------------------------------------------------------
    200193//
    201 // Reads the pattern from MCalibrationPattern and initializes new containers in the
    202 // Intensity Cams, if the pattern has changed. Executes Finalize of the
     194// Reads the pattern from MCalibrationPattern and clear
     195// Cams, if the pattern has changed. Executes Finalize of the
    203196// MCalibration*Calc classes in that case.
    204197//
     
    256249// --------------------------------------------------------------------------
    257250//
    258 // Reads the pattern from MCalibrationPattern and initializes new containers in the
    259 // Intensity Cams, if the pattern has changed. Executes Finalize of the
     251// Reads the pattern from MCalibrationPattern and clear
     252// Cams, if the pattern has changed. Executes Finalize of the
    260253// MCalibration*Calc classes in that case.
    261254//
     
    290283
    291284  hist->Finalize();
    292   CopyHist(name);
     285  //CopyHist(name);
    293286  hist->ResetHists();
    294287  hist->SetColor( fCalibPattern->GetPulserColor());
     
    298291// --------------------------------------------------------------------------
    299292//
    300 // Re-Intitializes new containers inside the Intensity Cams.
    301 // From now on, a call to the IntensityCam functions returns pointers
    302 // to the newly created Containers.
     293// Clear cams
    303294//
    304295Bool_t MCalibColorSteer::ReInitialize()
     
    310301
    311302  fBad->Clear(); // FIXME:::::: MERGE PreExcl!!!!
    312   fQECam->Clear();
     303
     304  if (fQECam)
     305      fQECam->Clear();
    313306
    314307  fBlindCam->Clear();
    315308  fBlindCam->SetPulserColor(fCalibPattern->GetPulserColor());
    316309
    317   fRelTimeCam->Clear();
    318   fRelTimeCam->SetPulserColor(fCalibPattern->GetPulserColor());
    319 
    320   if (fIntensCharge)
    321     {
    322       MCalibrationChargeCam *oldcam = (MCalibrationChargeCam*)fIntensCharge->GetCam();
    323       fIntensCharge->AddToList(Form("MCalibrationChargeCam%s",namep.Data()),*fGeom);
    324       MCalibrationChargeCam *cam    = (MCalibrationChargeCam*)fIntensCharge->GetCam();
    325       cam->SetPulserColor(fCalibPattern->GetPulserColor());
    326       if (!cam->MergeHiLoConversionFactors(*oldcam))
    327           return kFALSE;
    328       *fLog << inf << "New MCalibrationChargeCam with name: " << cam->GetName() << endl;
    329     }
     310  if (fRelTimeCam)
     311  {
     312      fRelTimeCam->Clear();
     313      fRelTimeCam->SetPulserColor(fCalibPattern->GetPulserColor());
     314  }
     315
     316  if (fCharge)
     317  {
     318      fCharge->Clear();
     319      fCharge->SetPulserColor(fCalibPattern->GetPulserColor());
     320  }
    330321
    331322  return kTRUE;
     
    360351  return result;
    361352}
    362 
    363 // --------------------------------------------------------------------------
    364 //
    365 // Copies the histogram classes into the intensity cams
    366 //
    367 void MCalibColorSteer::CopyHist(const char* name)
    368 {
    369   MHCalibrationCam *hcam = (MHCalibrationCam*)fParList->FindObject(name);
    370   TString n(name);
    371   if (n.Contains("ChargeCam"))
    372     {
    373       if (fIntensCharge)
    374           fIntensCharge->AddHist((MHCalibrationCam*)hcam->Clone());
    375     }
    376 //  if (n.Contains("Blind"))
    377 //    if (fIntensBlind)
    378 //        fIntensBlind->AddHist((MHCalibrationCam*)hcam->Clone());
    379 
    380 //  if (n.Contains("RelTime"))
    381 //    if (fIntensRelTime)
    382 //        fIntensRelTime->AddHist((MHCalibrationCam*)hcam->Clone());
    383 }
    384 
    385 // --------------------------------------------------------------------------
  • trunk/MagicSoft/Mars/mcalib/MCalibColorSteer.h

    r8428 r8452  
    1616class MRawRunHeader;
    1717class MCalibrationChargeCalc;
     18class MCalibrationChargeCam;
    1819class MCalibrationRelTimeCalc;
    19 class MCalibrationIntensityChargeCam;
    2020class MCalibrationRelTimeCam;
    2121class MCalibrationBlindCam;
     
    3030  MGeomCam                        *fGeom;            //!
    3131  MParList                        *fParList;         //!
    32   MCalibrationIntensityChargeCam  *fIntensCharge;    //!
     32  MCalibrationChargeCam           *fCharge;          //!
    3333  MCalibrationRelTimeCam          *fRelTimeCam;      //!
    3434  MCalibrationBlindCam            *fBlindCam;        //!
    3535  MCalibrationQECam               *fQECam;           //!
    3636  MBadPixelsCam                   *fBad;             //!
    37  
     37
    3838  MCalibrationChargeCalc          *fChargeCalc;      //!
    3939  MCalibrationRelTimeCalc         *fRelTimeCalc;     //!
    40                                                      
     40
    4141  MCalibrationCam::PulserColor_t   fColor;
    4242  Float_t                          fStrength;
    4343
    4444  Bool_t                           fHistCopy;        // Decide whether MHCalibrationCams will get copied
    45  
     45
    4646  Int_t  PreProcess(MParList *pList);
    4747  Int_t  Process();
    4848  Int_t  PostProcess();
    49  
     49
    5050  Bool_t ReInitialize();
    5151  Bool_t Finalize(const char* name);
    5252
    53   void    CopyHist(const char* name);
     53  //void    CopyHist(const char* name);
    5454  TString GetNamePattern();
    55  
     55
    5656public:
    5757    MCalibColorSteer(const char *name=NULL, const char *title=NULL);
  • trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc

    r8425 r8452  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MCalibrateData.cc,v 1.67 2007-04-20 11:48:08 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MCalibrateData.cc,v 1.68 2007-04-27 10:04:46 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    114114#include "MPedestalPix.h"
    115115
    116 #include "MCalibrationIntensityChargeCam.h"
    117116#include "MCalibrationChargeCam.h"
    118117#include "MCalibrationChargePix.h"
     
    155154//
    156155MCalibrateData::MCalibrateData(CalibrationMode_t calmode,const char *name, const char *title)
    157     : fGeomCam(NULL),   fBadPixels(NULL), fCalibrations(NULL), fIntensCalib(NULL),
     156    : fGeomCam(NULL),   fBadPixels(NULL), fCalibrations(NULL),
    158157      fQEs(NULL), fSignals(NULL), fCerPhotEvt(NULL), fCalibConstCam(NULL),
    159158    fPedestalFlag(kNo), fSignalType(kPhot), fRenormFactor(1.), fScaleFactor(1.)
     
    238237    if (fCalibrationMode>kNone)
    239238    {
    240         fIntensCalib = (MCalibrationIntensityChargeCam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityChargeCam"));
    241         if (fIntensCalib)
    242           *fLog << inf << "Found MCalibrationIntensityChargeCam ... " << endl;
    243 
    244239        fCalibrations = (MCalibrationChargeCam*)pList->FindObject(AddSerialNumber("MCalibrationChargeCam"));
    245240        if (!fCalibrations)
     
    465460    if (fCalibrationMode > kNone)
    466461    {
    467 
    468         const MCalibrationCam *chargecam = fIntensCalib ? fIntensCalib->GetCam() : fCalibrations;
    469         if (chargecam->GetSize() != npixels)
     462        if (fCalibrations->GetSize() != npixels)
    470463        {
    471464            *fLog << "Size mismatch between MGeomCam and MCalibrationChargeCam... abort!" << endl;
     
    478471            return kFALSE;
    479472        }
    480       }
    481    
     473    }
     474
    482475    fCalibConsts  .Set(npixels);
    483476    fCalibFFactors.Set(npixels);
     
    512505    fHiLoConv.Reset();
    513506    fHiLoConvErr.Reset();
    514 
    515     MCalibrationChargeCam *chargecam = NULL;
    516     if (updatecam)
    517         chargecam = fCalibrations;
    518     else
    519         chargecam = fIntensCalib ? (MCalibrationChargeCam*)fIntensCalib->GetCam() : fCalibrations;
    520507
    521508    //
     
    546533             }
    547534           
    548             const MCalibrationChargePix &pix   = (MCalibrationChargePix&)(*chargecam)[pixidx];
    549             const MCalibrationChargePix &avpix = (MCalibrationChargePix&)chargecam->GetAverageArea(0);
     535            const MCalibrationChargePix &pix   = (MCalibrationChargePix&)(*fCalibrations)[pixidx];
     536            const MCalibrationChargePix &avpix = (MCalibrationChargePix&)fCalibrations->GetAverageArea(0);
    550537
    551538            hiloconv   = pix.GetConversionHiLo     ();
    552539            hiloconverr= pix.GetConversionHiLoSigma();
    553            
     540
    554541            calibConv    = pix.GetMeanConvFADC2Phe();
    555542            calibConvVar = pix.GetMeanConvFADC2PheVar();
    556543            calibFFactor = pix.GetMeanFFactorFADC2Phot();
    557            
     544
    558545            const MCalibrationQEPix &qe = (MCalibrationQEPix&)(*fQEs)[pixidx];
    559546
  • trunk/MagicSoft/Mars/mcalib/MCalibrateData.h

    r8425 r8452  
    2020class MCalibrationChargeCam;
    2121class MCalibrationQECam;
    22 
    23 class MCalibrationIntensityChargeCam;
    2422
    2523class MCalibrateData : public MTask
     
    6361  MBadPixelsCam                  *fBadPixels;     //! Bad Pixels information
    6462  MCalibrationChargeCam          *fCalibrations;  //! Calibration constants
    65   MCalibrationIntensityChargeCam *fIntensCalib;   //! Calibration constants from interlaced calib.
    6663  MCalibrationQECam              *fQEs;           //! Quantum efficiencies
    6764  MExtractedSignalCam            *fSignals;       //! Integrated charge in FADCs counts
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc

    r8427 r8452  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MCalibrationChargeCalc.cc,v 1.176 2007-04-20 13:21:11 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MCalibrationChargeCalc.cc,v 1.177 2007-04-27 10:04:46 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    200200//   -  TString fOutputFile
    201201//
     202//  ClassVersion 6:
     203//   -  Bool_t fContinousCalibration
     204//
    202205//////////////////////////////////////////////////////////////////////////////
    203206#include "MCalibrationChargeCalc.h"
     
    220223#include "MPedestalCam.h"
    221224#include "MPedestalPix.h"
    222 
    223 #include "MCalibrationIntensityChargeCam.h"
    224225
    225226#include "MHCalibrationChargeCam.h"
     
    362363
    363364    fBadPixels   = NULL;
    364     fIntensCam   = NULL;
    365365    fCam         = NULL;
    366366    fHCam        = NULL;
     
    440440// Search for the following input containers and abort if not existing:
    441441//  - MGeomCam
    442 // -  MCalibrationIntensityChargeCam or MCalibrationChargeCam
     442// -  MCalibrationChargeCam
    443443//  - MCalibrationQECam
    444444//  - MBadPixelsCam
     
    455455// It defines the PixId of every pixel in:
    456456//
    457 // - MCalibrationIntensityChargeCam
    458457// - MCalibrationChargeCam
    459458// - MCalibrationQECam
     
    495494 
    496495    //
    497     // Intensity containers
     496    // MCalibrationChargeCam
    498497    //
    499   fIntensCam = (MCalibrationIntensityChargeCam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityChargeCam"));
    500   if (fIntensCam)
    501     *fLog << inf << "Found MCalibrationIntensityChargeCam... " << flush;
    502   else
    503     {
    504       fCam = (MCalibrationChargeCam*)pList->FindObject(AddSerialNumber("MCalibrationChargeCam"));
    505       if (!fCam)
    506         {
    507           *fLog << err << "Cannot find MCalibrationChargeCam ... abort." << endl;
    508           *fLog << "Maybe you forget to call an MFillH for the MHCalibrationChargeCam before..." << endl;
    509           return kFALSE;
    510         }
    511     }
    512  
     498  fCam = (MCalibrationChargeCam*)pList->FindObject(AddSerialNumber("MCalibrationChargeCam"));
     499  if (!fCam)
     500  {
     501      *fLog << err << "Cannot find MCalibrationChargeCam ... abort." << endl;
     502      *fLog << "Maybe you forget to call an MFillH for the MHCalibrationChargeCam before..." << endl;
     503      return kFALSE;
     504  }
     505
    513506  //
    514507  // Blind pixel calibration
     
    550543  // Further initialization
    551544  //
    552   MCalibrationChargeCam *chargecam = fIntensCam
    553     ? (MCalibrationChargeCam*)fIntensCam->GetCam()  : fCam;
    554 
    555   const UInt_t npixels = fGeom->GetNumPixels();
    556  
    557   for (UInt_t i=0; i<npixels; i++)
    558     {
    559 
    560       MCalibrationChargePix &pix = (MCalibrationChargePix&)(*chargecam)[i];
    561 
    562       if ((*fBadPixels)[i].IsBad())
    563       {
    564           MCalibrationQEPix &pqe = (MCalibrationQEPix&)(*fQECam)[i];
    565           pix.SetExcluded();
    566           pqe.SetExcluded();
    567           continue;
    568       }
    569 
    570       if (IsDebug())
    571         pix.SetDebug();
    572     }
     545  if (IsDebug())
     546  {
     547      const UInt_t npixels = fGeom->GetNumPixels();
     548      for (UInt_t i=0; i<npixels; i++)
     549          (*fCam)[i].SetDebug();
     550  }
    573551
    574552  fResultFlags.Set(fGeom->GetNumAreas());
     
    606584  // Now retrieve the colour and check if not various colours have been used
    607585  //
    608   if (!fIntensCam)
    609     {
    610       if (fPulserColor != MCalibrationCam::kNONE)
    611         {
    612           *fLog << warn << "Multiple colours used simultaneously!" << flush;
    613           fHCam->Finalize();
    614           if (fHBlindCam)
    615             fHBlindCam->Finalize();
    616 
    617           Finalize();
    618 
    619           fHCam->ResetHists();
    620           if (fHBlindCam)
    621             fHBlindCam->ResetHists();
    622 
    623           *fLog << inf << "Starting next calibration... " << flush;
    624 
    625           fHCam->SetColor(col);
    626           if (fHBlindCam)
    627             fHBlindCam->SetColor(col);
    628 
    629           fCam->SetPulserColor(col);
    630           if (fBlindCam)
    631             fBlindCam->SetPulserColor(col);
    632         }
    633     }
     586  if (!fContinousCalibration && fPulserColor != MCalibrationCam::kNONE)
     587  {
     588      *fLog << warn << "Multiple colours used simultaneously!" << flush;
     589      fHCam->Finalize();
     590      if (fHBlindCam)
     591          fHBlindCam->Finalize();
     592
     593      Finalize();
     594
     595      fHCam->ResetHists();
     596      if (fHBlindCam)
     597          fHBlindCam->ResetHists();
     598
     599      *fLog << inf << "Starting next calibration... " << flush;
     600
     601      fHCam->SetColor(col);
     602      if (fHBlindCam)
     603          fHBlindCam->SetColor(col);
     604
     605      fCam->SetPulserColor(col);
     606      if (fBlindCam)
     607          fBlindCam->SetPulserColor(col);
     608  }
    634609
    635610  //
     
    655630  // Distribute new color to all containers
    656631  //
     632  fCam->SetPulserColor(col);
     633  if (fBlindCam)
     634    fBlindCam->SetPulserColor(col);
     635
    657636  fHCam->SetColor(col);
    658637  if (fHBlindCam)
    659638    fHBlindCam->SetColor(col);
    660 
    661   MCalibrationChargeCam *chargecam = fIntensCam
    662     ? (MCalibrationChargeCam*)fIntensCam->GetCam()  : fCam;
    663 
    664   chargecam->SetPulserColor(col);
    665 
    666   if (fBlindCam)
    667     fBlindCam->SetPulserColor(col);
    668639  if (fPINDiode)
    669640    fPINDiode->SetColor(col);
     
    724695// Call  FinalizeUnsuitablePixels()
    725696// 
    726 // Call MParContainer::SetReadyToSave() for fIntensCam, fCam, fQECam, fBadPixels and
    727 //                                          fBlindCam and fPINDiode if they exist
     697// Call MParContainer::SetReadyToSave() for fCam, fQECam, fBadPixels and
     698//      fBlindCam and fPINDiode if they exist
    728699//
    729700// Print out some statistics
     
    749720      }
    750721
    751   MCalibrationChargeCam *chargecam = fIntensCam   ? (MCalibrationChargeCam*)fIntensCam->GetCam()  : fCam;
    752 
    753722  //
    754723  // First loop over pixels, call FinalizePedestals and FinalizeCharges
     
    759728    {
    760729
    761       MCalibrationChargePix &pix = (MCalibrationChargePix&)(*chargecam)[pixid];
     730      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[pixid];
    762731      //
    763732      // Check if the pixel has been excluded from the fits
     
    786755  if (nvalid == 0)
    787756  {
    788     if (!fIntensCam)
     757      if (!fContinousCalibration)
    789758      {
    790759        *fLog << warn << GetDescriptor() << ": All pixels have non-valid calibration. "
     
    801770
    802771      const MPedestalPix    &ped = fPedestals->GetAverageArea(aidx);
    803       MCalibrationChargePix &pix = (MCalibrationChargePix&)chargecam->GetAverageArea(aidx);
     772      MCalibrationChargePix &pix = (MCalibrationChargePix&)fCam->GetAverageArea(aidx);
    804773      const MArrayI &arr         = fHCam->GetAverageAreaNum();
    805774
     
    814783      pix.SetSigma (pix.GetSigma()/pix.GetFFactorFADC2Phe());
    815784
    816       FinalizeCharges(pix, chargecam->GetAverageBadArea(aidx),"area id");
    817       FinalizeArrivalTimes(pix, chargecam->GetAverageBadArea(aidx), "area id");
     785      FinalizeCharges(pix, fCam->GetAverageBadArea(aidx),"area id");
     786      FinalizeArrivalTimes(pix, fCam->GetAverageBadArea(aidx), "area id");
    818787    }
    819788 
     
    825794      const MPedestalPix     &ped = fPedestals->GetAverageSector(sector);
    826795
    827       MCalibrationChargePix &pix = (MCalibrationChargePix&)chargecam->GetAverageSector(sector);
     796      MCalibrationChargePix &pix = (MCalibrationChargePix&)fCam->GetAverageSector(sector);
    828797      FinalizePedestals(ped,pix, 0);
    829798    }
     
    840809  //
    841810  if (FinalizeFFactorMethod())
    842     chargecam->SetFFactorMethodValid(kTRUE);
     811    fCam->SetFFactorMethodValid(kTRUE);
    843812  else
    844813    {
    845814      *fLog << warn << "Could not calculate the photons flux from the F-Factor method " << endl;
    846       chargecam->SetFFactorMethodValid(kFALSE);
    847       if (!fIntensCam)
    848         return kFALSE;
     815      fCam->SetFFactorMethodValid(kFALSE);
     816      if (!fContinousCalibration)
     817          return kFALSE;
    849818    }
    850819
     
    916885                    "Deviating F-Factor:                     ");
    917886
    918   chargecam->SetReadyToSave();
    919   fQECam    ->SetReadyToSave();
     887  fCam->SetReadyToSave();
     888  fQECam->SetReadyToSave();
    920889  fBadPixels->SetReadyToSave();
    921890
     
    11091078  if (!cal.CalcConvFFactor())
    11101079    {
    1111       *fLog << warn << desc << "Could not calculate the Conv. FADC counts to Phes" << endl;
     1080      *fLog << warn << desc << "Could not calculate the conv. FADC cts to phes" << endl;
    11121081      bad.SetUncalibrated(MBadPixelsPix::kDeviatingNumPhes);
    11131082      return kFALSE;
     
    11491118// - MBadPixelsPix::kLoGainOverFlow
    11501119//
    1151 // - Call MCalibrationPix::SetExcluded() for the bad pixels
    1152 //
    11531120// Sets pixel to MBadPixelsPix::kUnreliableRun, if one of the following flags is set:
    11541121// - MBadPixelsPix::kChargeSigmaNotValid
     
    11761143            bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun    );
    11771144        }
    1178      
     1145
    11791146      if (IsCheckDeviatingBehavior())
    11801147        {
     
    11821149            bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun    );
    11831150        }
    1184      
     1151
    11851152      if (IsCheckHistOverflow())
    11861153        {
    11871154          if (bad.IsUncalibrated( MBadPixelsPix::kHiGainOverFlow   ))
    11881155            bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun    );
    1189          
     1156
    11901157          if (bad.IsUncalibrated( MBadPixelsPix::kLoGainOverFlow   ))
    11911158            bad.SetUnsuitable(   MBadPixelsPix::kUnsuitableRun    );
    11921159        }
    1193      
     1160
    11941161      if (IsCheckArrivalTimes())
    11951162        {
     
    12351202Bool_t MCalibrationChargeCalc::FinalizeFFactorMethod()
    12361203{
    1237   MCalibrationChargeCam *chargecam = fIntensCam
    1238     ? (MCalibrationChargeCam*)fIntensCam->GetCam()  : fCam;
    1239 
    12401204  const Int_t npixels  = fGeom->GetNumPixels();
    12411205  const Int_t nareas   = fGeom->GetNumAreas();
     
    12601224  for (Int_t i=0; i<npixels; i++)
    12611225    {
    1262       MCalibrationChargePix &pix = (MCalibrationChargePix&)(*chargecam)[i];
     1226      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
    12631227
    12641228      MBadPixelsPix &bad = (*fBadPixels)[i];
     
    13851349    {
    13861350     
    1387       MCalibrationChargePix &pix = (MCalibrationChargePix&)(*chargecam)[i];
     1351      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
    13881352
    13891353      if (!pix.IsFFactorMethodValid())
     
    14401404    {
    14411405
    1442       MCalibrationChargePix &apix = (MCalibrationChargePix&)chargecam->GetAverageArea(aidx);
     1406      MCalibrationChargePix &apix = (MCalibrationChargePix&)fCam->GetAverageArea(aidx);
    14431407
    14441408      if (numareavalid[aidx] == 1)
     
    14951459        }
    14961460     
    1497       MCalibrationChargePix &spix = (MCalibrationChargePix&)chargecam->GetAverageSector(sector);
     1461      MCalibrationChargePix &spix = (MCalibrationChargePix&)fCam->GetAverageSector(sector);
    14981462
    14991463      if (sectorweights[sector] < 0. || sectorphes[sector] <= 0.)
     
    15241488    {
    15251489     
    1526       MCalibrationChargePix &pix = (MCalibrationChargePix&)(*chargecam)[i];
     1490      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
    15271491
    15281492      MBadPixelsPix &bad = (*fBadPixels)[i];
     
    15341498        {
    15351499          const Int_t            aidx = (*fGeom)[i].GetAidx();
    1536           MCalibrationChargePix &apix = (MCalibrationChargePix&)chargecam->GetAverageArea(aidx);
     1500          MCalibrationChargePix &apix = (MCalibrationChargePix&)fCam->GetAverageArea(aidx);
    15371501
    15381502          pix.SetPheFFactorMethod   ( apix.GetPheFFactorMethod()    );
     
    17261690    }
    17271691 
    1728   MCalibrationChargeCam *chargecam = fIntensCam
    1729     ? (MCalibrationChargeCam*)fIntensCam->GetCam()  : fCam;
    1730 
    1731   MCalibrationChargePix &avpix = (MCalibrationChargePix&)chargecam->GetAverageArea(0);
     1692  MCalibrationChargePix &avpix = (MCalibrationChargePix&)fCam->GetAverageArea(0);
    17321693  MCalibrationQEPix     &qepix = (MCalibrationQEPix&)    fQECam->GetAverageArea(0);
    17331694
     
    17571718  // Set the results in the MCalibrationChargeCam
    17581719  //
    1759   chargecam->SetNumPhotonsFFactorMethod (avphotons);
     1720  fCam->SetNumPhotonsFFactorMethod (avphotons);
    17601721
    17611722  if (avphotrelvar > 0.)
    1762     chargecam->SetNumPhotonsFFactorMethodErr(TMath::Sqrt( avphotrelvar * avphotons * avphotons)); 
     1723    fCam->SetNumPhotonsFFactorMethodErr(TMath::Sqrt( avphotrelvar * avphotons * avphotons));
    17631724
    17641725  TArrayF lowlim           (nareas);
     
    17751736    {
    17761737     
    1777       MCalibrationChargePix &pix   = (MCalibrationChargePix&)(*chargecam)[i];
    1778       MCalibrationQEPix     &qpix  = (MCalibrationQEPix&)    (*fQECam)   [i];
     1738      MCalibrationChargePix &pix   = (MCalibrationChargePix&)(*fCam)[i];
     1739      MCalibrationQEPix     &qpix  = (MCalibrationQEPix&)    (*fQECam)[i];
    17791740
    17801741      MBadPixelsPix &bad = (*fBadPixels)[i];
     
    18951856    {
    18961857     
    1897       MCalibrationChargePix &pix   = (MCalibrationChargePix&)(*chargecam)[i];
    1898 
     1858      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
    18991859      MBadPixelsPix &bad = (*fBadPixels)[i];
    19001860
     
    19201880    {
    19211881     
    1922       MCalibrationChargePix &pix  = (MCalibrationChargePix&)(*chargecam)[i];
    1923       MCalibrationQEPix     &qpix = (MCalibrationQEPix&)    (*fQECam)   [i];
     1882      MCalibrationChargePix &pix  = (MCalibrationChargePix&)(*fCam)[i];
     1883      MCalibrationQEPix     &qpix = (MCalibrationQEPix&)(*fQECam)[i];
    19241884
    19251885      if ((*fBadPixels)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
     
    19571917    return;
    19581918
    1959   MCalibrationChargeCam *chargecam = fIntensCam
    1960     ? (MCalibrationChargeCam*)fIntensCam->GetCam()  : fCam;
    1961 
    1962 
    19631919  //
    19641920  // Set the results in the MCalibrationChargeCam
     
    19691925      const Float_t photons = fBlindCam->GetFluxInsidePlexiglass() * (*fGeom)[0].GetA()
    19701926                           / fQECam->GetPlexiglassQE();
    1971       chargecam->SetNumPhotonsBlindPixelMethod(photons);
     1927      fCam->SetNumPhotonsBlindPixelMethod(photons);
    19721928         
    19731929      const Float_t photrelvar = fBlindCam->GetFluxInsidePlexiglassRelVar()
     
    19751931 
    19761932      if (photrelvar > 0.)
    1977         chargecam->SetNumPhotonsBlindPixelMethodErr(TMath::Sqrt( photrelvar * photons * photons)); 
     1933        fCam->SetNumPhotonsBlindPixelMethodErr(TMath::Sqrt( photrelvar * photons * photons));
    19781934    }
    19791935 
     
    20021958        }
    20031959     
    2004       MCalibrationChargePix &pix   = (MCalibrationChargePix&)(*chargecam)[i];
    2005       MGeomPix              &geo   =                         (*fGeom)    [i];
     1960      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
     1961      MGeomPix &geo = (*fGeom)[i];
    20061962
    20071963      const Float_t qe        = pix.GetPheFFactorMethod()
     
    20462002  const UInt_t npixels  = fGeom->GetNumPixels();
    20472003
    2048   MCalibrationChargeCam *chargecam = fIntensCam
    2049     ? (MCalibrationChargeCam*)fIntensCam->GetCam()  : fCam;
    2050 
    20512004  if (!fPINDiode)
    20522005    return;
     
    20802033          continue;
    20812034        }
    2082      
    2083       MCalibrationChargePix &pix   = (MCalibrationChargePix&)(*chargecam)[i];
    2084       MGeomPix              &geo =                           (*fGeom)    [i];
    2085      
    2086       const Float_t qe       =  pix.GetPheFFactorMethod() 
     2035
     2036      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
     2037      MGeomPix &geo = (*fGeom)[i];
     2038
     2039      const Float_t qe       =  pix.GetPheFFactorMethod()
    20872040                               / fPINDiode->GetFluxOutsidePlexiglass()
    20882041                               / geo.GetA();
     
    21292082//
    21302083// - Print out statistics about BadPixels of type UnsuitableType_t
    2131 // - store numbers of bad pixels of each type in fCam or fIntensCam
     2084// - store numbers of bad pixels of each type in fCam
    21322085//
    21332086Bool_t MCalibrationChargeCalc::FinalizeUnsuitablePixels()
     
    21432096  TArrayI unsuit(nareas);
    21442097  TArrayI unrel(nareas);
    2145 
    2146   MCalibrationChargeCam *chargecam = fIntensCam ? (MCalibrationChargeCam*)fIntensCam->GetCam() : fCam;
    21472098
    21482099  Int_t unsuitcnt=0;
     
    21592110      unrelcnt    += unrel[aidx];
    21602111
    2161       chargecam->SetNumUnsuitable(unsuit[aidx], aidx);
    2162       chargecam->SetNumUnreliable(unrel[aidx],  aidx);
     2112      fCam->SetNumUnsuitable(unsuit[aidx], aidx);
     2113      fCam->SetNumUnreliable(unrel[aidx],  aidx);
    21632114  }
    21642115
    21652116  TArrayI counts(nareas);
    2166   for (Int_t i=0; i<chargecam->GetSize(); i++)
     2117  for (Int_t i=0; i<fCam->GetSize(); i++)
    21672118  {
    2168       MCalibrationPix &pix = (*chargecam)[i];
     2119      const MCalibrationPix &pix = (*fCam)[i];
    21692120      if (pix.IsHiGainSaturation())
    21702121      {
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h

    r8425 r8452  
    2323class MCalibrationChargePINDiode;
    2424class MHCalibrationChargeBlindCam;
    25 class MCalibrationIntensityBlindCam;
    2625class MCalibrationBlindCam;
    2726class MCalibrationChargePix;
    28 class MCalibrationIntensityChargeCam;
    2927class MCalibrationChargeCam;
    3028class MHCalibrationChargeCam;
     
    8179
    8280  Int_t   fNumProcessed;                       // Number of processed events (for Intensity calibration)
    83  
     81
     82  Bool_t fContinousCalibration;
     83
    8484  // Pointers
    8585//  MBadPixelsIntensityCam         *fIntensBad;      //!  Bad Pixels
    8686  MBadPixelsCam                  *fBadPixels;      //!  Bad Pixels
    87   MCalibrationIntensityChargeCam *fIntensCam;      //!  Intensity Calibration results of all pixels   
    8887  MCalibrationChargeCam          *fCam;            //!  Calibrated Charges results of all pixels
    8988  MHCalibrationChargeCam         *fHCam;           //!  Charges histograms of all pixels   
    90   MCalibrationIntensityBlindCam  *fIntensBlind;    //!  Intensity Calibration results of the Blind Pixels
    9189  MCalibrationBlindCam           *fBlindCam;       //!  Calibrated Charges of the Blind Pixels
    9290  MHCalibrationChargeBlindCam    *fHBlindCam;      //!  Charges histograms of the Blind Pixels 
     
    198196  void SetUseExternalNumPhes(const Bool_t b=kTRUE)     { b ? SETBIT(fFlags, kUseExternalNumPhes)         : CLRBIT(fFlags, kUseExternalNumPhes); }
    199197
     198  void SetContinousCalibration(const Bool_t b=kTRUE)   { fContinousCalibration = b; }
     199
    200200  // pointers
    201201  void SetPedestals(MPedestalCam *cam) { fPedestals=cam; }
     
    217217  void SetPheErrUpperLimit     ( const Float_t f=fgPheErrUpperLimit       ) { fPheErrUpperLimit  = f;    }   
    218218  void SetPulserColor          ( const MCalibrationCam::PulserColor_t col ) { fPulserColor       = col;  }
    219  
    220   ClassDef(MCalibrationChargeCalc, 5)   // Task calculating Calibration Containers and Quantum Efficiencies
     219
     220  ClassDef(MCalibrationChargeCalc, 6)   // Task calculating Calibration Containers and Quantum Efficiencies
    221221};
    222222
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc

    r8106 r8452  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MCalibrationChargeCam.cc,v 1.69 2006-10-17 17:18:40 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MCalibrationChargeCam.cc,v 1.70 2007-04-27 10:04:46 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    216216void MCalibrationChargeCam::Clear(Option_t *o)
    217217{
    218 
     218  // DO NOT RESET THE HI-/LO-GAIN CONSTANTS
    219219  SetFFactorMethodValid    ( kFALSE );
    220220
    221   fNumPhotonsBlindPixelMethod    = 0.; 
    222   fNumPhotonsFFactorMethod       = 0.; 
    223   fNumPhotonsPINDiodeMethod      = 0.; 
    224   fNumPhotonsBlindPixelMethodErr = 0.; 
    225   fNumPhotonsFFactorMethodErr    = 0.; 
    226   fNumPhotonsPINDiodeMethodErr   = 0.; 
     221  fNumPhotonsBlindPixelMethod    = 0.;
     222  fNumPhotonsFFactorMethod       = 0.;
     223  fNumPhotonsPINDiodeMethod      = 0.;
     224  fNumPhotonsBlindPixelMethodErr = 0.;
     225  fNumPhotonsFFactorMethodErr    = 0.;
     226  fNumPhotonsPINDiodeMethodErr   = 0.;
    227227
    228228  MCalibrationCam::Clear();
    229 
    230   return;
    231229}
    232230
  • trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc

    r8428 r8452  
    6464#include "MLogManip.h"
    6565
     66#include "MMath.h"
     67
    6668#include "MParList.h"
    6769
     
    8183using namespace std;
    8284
    83 const Float_t MCalibrationRelTimeCalc::fgRelTimeResolutionLimit = 0.05;
     85const Float_t MCalibrationRelTimeCalc::fgRelTimeResolutionLimit = 5.0;
    8486
    8587// --------------------------------------------------------------------------
    8688//
    87 // Default constructor. 
     89// Default constructor.
    8890//
    8991// Sets all pointers to NULL
     
    98100    : fGeom(NULL), fFlags(0)
    99101{
    100        
     102
    101103  fName  = name  ? name  : "MCalibrationRelTimeCalc";
    102104  fTitle = title ? title : "Task to finalize the relative time calibration";
    103105
    104106  SetCheckFitResults       ( kFALSE );
    105   SetCheckDeviatingBehavior( kFALSE );
     107  SetCheckDeviatingBehavior( kTRUE );
    106108  SetCheckHistOverflow     ( kFALSE );
    107109  SetCheckOscillations     ( kFALSE );
     
    164166  }
    165167
    166   const UInt_t npixels = fGeom->GetNumPixels();
    167   for (UInt_t i=0; i<npixels; i++)
     168  if (IsDebug())
    168169  {
    169       MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i];
    170 
    171       if ((*fBadPixels)[i].IsBad())
    172       {
    173           pix.SetExcluded();
    174           continue;
    175       }
    176 
    177       if (IsDebug())
    178           pix.SetDebug();
     170      const UInt_t npixels = fGeom->GetNumPixels();
     171      for (UInt_t i=0; i<npixels; i++)
     172          (*fCam)[i].SetDebug();
    179173  }
    180174
     
    233227
    234228  PrintUncalibrated(MBadPixelsPix::kDeviatingTimeResolution,   
    235                     Form("%s%2.1f%s","Time resol. less than ", fRelTimeResolutionLimit, " FADC sl. from Mean:"));
     229                    Form("%s%2.1f%s","Time resol. less than ", fRelTimeResolutionLimit, " med-dev from median:"));
    236230  PrintUncalibrated(MBadPixelsPix::kRelTimeOscillating,   
    237231                    "Pixels with changing Rel. Times over time:");
     
    245239// ----------------------------------------------------------------------------------------------------
    246240//
    247 //
    248 // First loop: Calculate a mean and mean RMS of time resolution per area index
    249 //             Include only pixels which are not MBadPixelsPix::kUnsuitableRun or
    250 //             MBadPixelsPix::kUnreliableRun (see FinalizeBadPixels())
    251 //             
    252 // Second loop: Exclude those deviating by more than fRelTimeResolutionLimit FADC slices
    253 //              from the mean (obtained in first loop). Set
    254 //              MBadPixelsPix::kDeviatingTimeResolution if excluded.
    255 //
     241// Check for outliers. They are marked with
     242// MBadPixelsPix::kDeviatingTimeResolution
     243//
    256244void MCalibrationRelTimeCalc::FinalizeRelTimes()
    257245{
    258 
    259   const UInt_t npixels  = fGeom->GetNumPixels();
    260   const UInt_t nareas   = fGeom->GetNumAreas();
    261 
    262   TArrayF lowlim       (nareas);
    263   TArrayF upplim       (nareas);
    264   TArrayF areasum      (nareas);
    265   TArrayI numareavalid (nareas);
    266   TArrayI useunreliable(nareas);
    267 
    268   //
    269   // Apero loop: Count number of unreliable pixels:
    270   //     
    271   for (UInt_t i=0; i<npixels; i++)
    272     {
    273       MBadPixelsPix &bad = (*fBadPixels)[i];
    274       const Int_t  aidx  = (*fGeom)[i].GetAidx();
    275 
    276       if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
    277         continue;
    278 
    279       if (bad.IsUnsuitable(MBadPixelsPix::kUnreliableRun))
    280         continue;
    281 
    282       numareavalid[aidx] ++;
    283     }
    284 
    285   for (UInt_t aidx=0; aidx<nareas; aidx++)
    286     if (numareavalid[aidx] < 100)
    287       useunreliable[aidx] = 1;
    288 
    289   numareavalid.Reset();
    290   //
    291   // First loop: Get mean time resolution the RMS
    292   //             The loop is only to recognize later pixels with very deviating numbers
    293   //
    294   for (UInt_t i=0; i<npixels; i++)
    295     {
    296 
    297       const MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i];
    298 
    299       if (pix.IsExcluded())
    300         continue;
    301 
    302       MBadPixelsPix &bad = (*fBadPixels)[i];
    303       if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
    304         continue;
    305 
    306       const Int_t   aidx  = (*fGeom)[i].GetAidx();
    307 
    308       if (!useunreliable[aidx])
    309         if (bad.IsUnsuitable(MBadPixelsPix::kUnreliableRun))
    310           continue;
    311 
    312       const Float_t res   = pix.GetTimePrecision();
    313 
    314       areasum     [aidx] += res;
    315       //      areasum2    [aidx] += res*res;
    316       numareavalid[aidx] ++;
    317     }
    318 
    319 
    320   for (UInt_t aidx=0; aidx<nareas; aidx++)
    321     {
    322       if (numareavalid[aidx] < 20)
     246    const Int_t npixels = fGeom->GetNumPixels();
     247    const Int_t nareas  = fGeom->GetNumAreas();
     248
     249    // Create an array capable of holding all pixels
     250    TArrayF arr(npixels);
     251
     252    for (Int_t aidx=0; aidx<nareas; aidx++)
     253    {
     254        Int_t n = 0;
     255        for (Int_t i=0; i<npixels; i++)
    323256        {
    324           *fLog << warn << "Area   " << setw(4) << aidx << ": Less than 20 pixels with valid time resolution found." << endl;
    325           continue;
     257            // Check for this aidx only
     258            if ((*fGeom)[i].GetAidx()!=aidx)
     259                continue;
     260
     261            // check if pixel may not contain a valid value
     262            if ((*fBadPixels)[i].IsUnsuitable())
     263                continue;
     264
     265            // check if it was excluded for some reason
     266            const MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i];
     267            if (pix.IsExcluded())
     268                continue;
     269
     270            // if TimePrecision is valid fill it into array
     271            if (pix.GetTimePrecision()>0)
     272                arr[n++] = pix.GetTimePrecision();
    326273        }
    327274
    328       // Calculate the rms out of sum2:
    329       /*
    330       areasum2[aidx]  = (areasum2[aidx] - areasum[aidx]*areasum[aidx]/numareavalid[aidx]);
    331       areasum2[aidx] /= (numareavalid[aidx]-1.);
    332       */
    333       areasum [aidx] /= numareavalid[aidx];
    334       lowlim  [aidx]  = 0;
    335       upplim  [aidx]  = areasum [aidx] + fRelTimeResolutionLimit;
    336 
    337     }
    338   *fLog << endl; 
    339 
    340 
    341   for (UInt_t i=0; i<npixels; i++)
    342     {
    343 
    344       MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i];
    345 
    346       if (pix.IsExcluded())
    347         continue;
    348 
    349       MBadPixelsPix &bad = (*fBadPixels)[i];
    350       if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
    351         continue;
    352 
    353       const Float_t res    = pix.GetTimePrecision();
    354       const Int_t   aidx   = (*fGeom)[i].GetAidx();
    355 
    356       if ( res < lowlim[aidx] || res > upplim[aidx] )
     275        // Check the ratio of valid entries to the ratio of pixels
     276        const Float_t ratio = 100*n/fGeom->GetNumPixWithAidx(aidx);
     277        if (3*ratio<2)
     278            *fLog << warn << "Area   " << setw(4) << aidx << ": Only " << ratio << "% pixels with valid time resolution found." << endl;
     279
     280        // Calculate median and median deviation
     281        Double_t med;
     282        const Double_t dev = MMath::MedianDev(n, arr.GetArray(), med);
     283
     284        // Now find the outliers
     285        for (Int_t i=0; i<npixels; i++)
    357286        {
    358             *fLog << warn << "Pixel  " << setw(4) << i << ": Deviating time resolution: "
    359                 << Form("%4.2f",res) << " out of range ["
    360                 << Form("%4.2f,%4.2f",lowlim[aidx],upplim[aidx]) << "]" << endl;
    361           bad.SetUncalibrated( MBadPixelsPix::kDeviatingTimeResolution);
    362           pix.SetExcluded();
     287            // Search only within this aidx
     288            if ((*fGeom)[i].GetAidx()!=aidx)
     289                continue;
     290
     291            // skip pixels already known to be unsuitable
     292            if ((*fBadPixels)[i].IsUnsuitable())
     293                continue;
     294
     295            // check if a pixel has been excluded. This
     296            const MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i];
     297
     298            // Check if time precision is valid (might be invalid
     299            // for example in cae of empty histograms)
     300            const Float_t res = pix.GetTimePrecision();
     301            if (res<0) //FIXME!!! How does this happen?
     302            {
     303                *fLog << warn << "Pixel  " << setw(4) << i << ": Time resolution not calculated." << endl;
     304                (*fBadPixels)[i].SetUncalibrated(MBadPixelsPix::kDeviatingTimeResolution);
     305                continue;
     306            }
     307
     308            // 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
     312            if (res<=lolim || res>=hilim)
     313            {
     314                *fLog << warn << "Pixel  " << setw(4) << i << ": Deviating time resolution: "
     315                    << Form("%4.2f", res) << " out of range "
     316                    << Form("[%4.2f,%4.2f]", lolim, hilim) << endl;
     317
     318                (*fBadPixels)[i].SetUncalibrated(MBadPixelsPix::kDeviatingTimeResolution);
     319            }
    363320        }
    364321    }
     
    373330// - MBadPixelsPix::kRelTimeRelErrNotValid
    374331//
    375 // - Call MCalibrationPix::SetExcluded() for the bad pixels
    376 //
    377332void MCalibrationRelTimeCalc::FinalizeBadPixels()
    378333{
     
    380335  for (Int_t i=0; i<fBadPixels->GetSize(); i++)
    381336    {
    382 
    383337      MBadPixelsPix &bad = (*fBadPixels)[i];
    384338
    385339      if (IsCheckDeviatingBehavior())
    386340          if (bad.IsUncalibrated(MBadPixelsPix::kDeviatingTimeResolution))
    387               bad.SetUnsuitable(MBadPixelsPix::kUnreliableRun);
     341              bad.SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
    388342
    389343      if (IsCheckFitResults())
     
    394348          if (bad.IsUncalibrated(MBadPixelsPix::kRelTimeOscillating))
    395349              bad.SetUnsuitable(MBadPixelsPix::kUnreliableRun);
    396 
    397       if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
    398       {
    399           MCalibrationRelTimePix &pix = (MCalibrationRelTimePix&)(*fCam)[i];
    400           pix.SetExcluded();
    401       }
    402350    }
    403351
     
    460408void MCalibrationRelTimeCalc::PrintUncalibrated(const char *text, Int_t in, Int_t out) const
    461409{
    462     *fLog << " " << setfill(' ') << setw(56) << setiosflags(ios::left) << text;
     410    *fLog << " " << setfill(' ') << setw(48) << setiosflags(ios::left) << text;
    463411    *fLog << " Inner: " << Form("%3i", in);
    464412    *fLog << " Outer: " << Form("%3i", out);
  • trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCam.cc

    r5047 r8452  
    131131  *fLog << all << GetDescriptor() << ":" << endl;
    132132  int id = 0;
    133  
     133
    134134  *fLog << all << "Calibrated pixels:" << endl;
    135135  *fLog << all << endl;
     
    138138  MCalibrationRelTimePix *pix;
    139139  while ((pix=(MCalibrationRelTimePix*)Next()))
    140     {
    141      
    142       if (!pix->IsExcluded())
    143         {                           
    144 
    145           *fLog << all
    146                 << Form("%s%4i%s%4.2f%s%4.2f%s%4.2f%s%4.2f","Pix  ",pix->GetPixId(),
    147                         ":            Offset: ",pix->GetTimeOffset()," +- ",pix->GetTimeOffsetErr(),
    148                         "   Precision: ",pix->GetTimePrecision()," +- ",pix->GetTimePrecisionErr())
    149                 << endl;
     140  {
     141      if (!pix->IsExcluded())
     142      {
     143          *fLog << all
     144              << "Pix  " << Form("%4i", pix->GetPixId()) << ":         "
     145              << "   Offset: "
     146              << Form("%4.2f +- %4,2f", pix->GetTimeOffset(), pix->GetTimeOffsetErr())
     147              << "   Precision: "
     148              << Form("%4.2f +- %4.2f", pix->GetTimePrecision(), pix->GetTimePrecisionErr())
     149              << endl;
    150150          id++;
    151         }
    152     }
    153  
     151      }
     152  }
     153
    154154  *fLog << all << id << " pixels" << endl;
    155155  id = 0;
    156  
    157    
     156
     157
    158158  *fLog << all << endl;
    159159  *fLog << all << "Excluded pixels:" << endl;
    160160  *fLog << all << endl;
    161  
     161
    162162  id = 0;
    163163
     
    177177  while ((pix=(MCalibrationRelTimePix*)Next5()))
    178178  {
    179     *fLog << all
    180           << Form("%s%4i%s%4.2f%s%4.2f%s%4.2f%s%4.2f","Average Area   ",pix->GetPixId(),
    181                   ":  Offset: ",pix->GetTimeOffset()," +- ",pix->GetTimeOffsetErr(),
    182                   "   Precision: ",pix->GetTimePrecision()," +- ",pix->GetTimePrecisionErr())
     179      *fLog << all
     180          << "Average Area   " << Form("%4i", pix->GetPixId()) << ":"
     181          << "Offset: "
     182          << Form("%4.2f +- %4,2f", pix->GetTimeOffset(), pix->GetTimeOffsetErr())
     183          << "   Precision: "
     184          << Form("%4.2f +- %4.2f", pix->GetTimePrecision(), pix->GetTimePrecisionErr())
    183185          << endl;
    184186  }
     
    187189  while ((pix=(MCalibrationRelTimePix*)Next5()))
    188190  {
    189     *fLog << all
    190           << Form("%s%4i%s%4.2f%s%4.2f%s%4.2f%s%4.2f","Average Sector ",pix->GetPixId(),
    191                   ":  Offset: ",pix->GetTimeOffset()," +- ",pix->GetTimeOffsetErr(),
    192                   "   Precision: ",pix->GetTimePrecision()," +- ",pix->GetTimePrecisionErr())
     191      *fLog << all
     192          << "Average Sector " << Form("%4i", pix->GetPixId()) << ":"
     193          << "Offset: "
     194          << Form("%4.2f +- %4.2f", pix->GetTimeOffset(), pix->GetTimeOffsetErr())
     195          << "   Precision: "
     196          << Form("%4.2f +- %4.2f", pix->GetTimePrecision(), pix->GetTimePrecisionErr())
    193197          << endl;
    194198  }
     
    232236        return kFALSE;
    233237      val = pix.GetMean();
    234       break;
     238      return val!=-1.;
    235239    case 1:
    236240      if (pix.IsExcluded())
     
    257261    }
    258262
    259   return val!=-1.;
    260 
    261 }
    262 
     263  return val>=0;
     264
     265}
     266
  • trunk/MagicSoft/Mars/mcalib/Makefile

    r8429 r8452  
    3939           MCalibrationPatternDecode.cc \
    4040           MCalibrateRelTimes.cc \
    41            MCalibrationIntensityCam.cc \
    42            MCalibrationIntensityChargeCam.cc \
    4341           MCalibrationCam.cc \
    4442           MCalibrationPix.cc  \
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationCam.cc

    r8417 r8452  
    7878#include "MLogManip.h"
    7979
    80 #include "MCalibrationIntensityCam.h"
    8180#include "MCalibrationCam.h"
    8281#include "MCalibrationPix.h"
     
    144143    fHistXTitle(gsHistXTitle),fHistYTitle(gsHistYTitle),
    145144    fCurrentNumEvts(0), fColor(MCalibrationCam::kNONE),
    146     fBadPixels(NULL), fIntensCam(NULL), fCam(NULL), fGeom(NULL),
     145    fBadPixels(NULL), fCam(NULL), fGeom(NULL),
    147146    fRunHeader(NULL)
    148147{
     
    606605  if (!fBadPixels)
    607606  {
     607      /*
    608608      fBadPixels = (MBadPixelsCam*)pList->FindCreateObj(AddSerialNumber("MBadPixelsCam"));
    609609      if (!fBadPixels)
    610610          return kFALSE;
    611611
    612       fBadPixels->InitSize(npixels);
     612          fBadPixels->InitSize(npixels);
     613          */
     614      *fLog << err << "MBadPixelsCam not found... abort." << endl;
     615      return kFALSE;
    613616  }
    614617
     
    762765          }
    763766        else
    764           InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
     767          InitHists(pix, fCam->GetAverageBadArea(j),j);
    765768      }
    766769  }
     
    775778
    776779          pix.SetBinning(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nsectors), fFirst, fLast);
    777          
    778           InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
     780
     781          InitHists(pix, fCam->GetAverageBadSector(j),j);
    779782      }
    780783  }
     
    835838          }
    836839        else
    837           InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
     840          InitHists(pix, fCam->GetAverageBadArea(j),j);
    838841      }
    839842  }
     
    849852          pix.SetBinning(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nsectors), fFirst, fLast);
    850853         
    851           InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
     854          InitHists(pix, fCam->GetAverageBadSector(j),j);
    852855      }
    853856  }
     
    10341037// -------------------------------------------------------------
    10351038//
    1036 // - Searches for the CalibrationIntensity*Cam corresponding to 'name'.
    1037 // - In case, it does not exist in the parameter list, it searches
    1038 //   for the corresponding MCalibration*Cam.
     1039// - Searches for the Calibration*Cam corresponding to 'name'.
    10391040// - Initializes the MCalibration*Cam, if not yet done.
    10401041//
     
    10421043{
    10431044
    1044   TString intensname = "MCalibrationIntensity";
    1045   intensname += name;
    1046   intensname += "Cam";
    1047 
    1048   TString ordname    = "MCalibration";
    1049   ordname    += name;
    1050   ordname    += "Cam";
    1051 
    1052   fIntensCam = (MCalibrationIntensityCam*)plist->FindObject(AddSerialNumber(intensname));
    1053   if (fIntensCam)
    1054     *fLog << inf << "Found " << intensname << "... " << endl;
    1055   else
    1056     {
    1057       fCam = (MCalibrationCam*)plist->FindObject(AddSerialNumber(ordname));
     1045  TString ordname = "MCalibration";
     1046  ordname += name;
     1047  ordname += "Cam";
     1048
     1049  fCam = (MCalibrationCam*)plist->FindObject(AddSerialNumber(ordname));
     1050  if (!fCam)
     1051  {
     1052      fCam = (MCalibrationCam*)plist->FindCreateObj(AddSerialNumber(ordname));
    10581053      if (!fCam)
    1059         {
    1060           fCam = (MCalibrationCam*)plist->FindCreateObj(AddSerialNumber(ordname));
    1061           if (!fCam)
    1062               return kFALSE;
    1063 
    1064           fCam->Init(*fGeom);
    1065         }
    1066     }
     1054          return kFALSE;
     1055
     1056      fCam->Init(*fGeom);
     1057  }
     1058
    10671059  return kTRUE;
    10681060}
     
    11821174  if (!IsAverageing())
    11831175    return;
    1184  
    1185   MCalibrationCam *cam = fIntensCam ? fIntensCam->GetCam() : fCam;
     1176
     1177  MCalibrationCam *cam = fCam;
    11861178  if (!cam)
    11871179    return;
    1188  
     1180
    11891181  for (UInt_t j=0; j<fGeom->GetNumAreas(); j++)
    11901182    {
    1191  
     1183
    11921184      MCalibrationPix &pix    = cam->GetAverageArea(j);
    11931185
     
    12411233  if (hist.IsEmpty())
    12421234  {
    1243       *fLog << warn << "Pixel  " << setw(4) << pix.GetPixId() << ": Hi-Gain histogram empty." << endl;
     1235      //*fLog << warn << "Pixel  " << setw(4) << pix.GetPixId() << ": Hi-Gain histogram empty." << endl;
     1236      //bad.SetUncalibrated( fittyp );
     1237      return;
     1238  }
     1239  if (hist.IsOnlyOverflow())
     1240  {
     1241      *fLog << warn << "Pixel  " << setw(4) << pix.GetPixId() << ": Hi-Gain histogram contains only overflows (Check Binning!)." << endl;
    12441242      bad.SetUncalibrated( fittyp );
    12451243      return;
    12461244  }
    1247   if (hist.IsOnlyOverflow())
    1248   {
    1249       *fLog << warn << "Pixel  " << setw(4) << pix.GetPixId() << ": Hi-Gain histogram contains only overflows." << endl;
    1250       bad.SetUncalibrated( fittyp );
    1251       return;
    1252   }
    12531245  if (hist.IsOnlyUnderflow())
    12541246  {
    1255       *fLog << warn << "Pixel  " << setw(4) << pix.GetPixId() << ": Hi-Gain histogram contains only underflows." << endl;
     1247      *fLog << warn << "Pixel  " << setw(4) << pix.GetPixId() << ": Hi-Gain histogram contains only underflows (Check Binning!)." << endl;
    12561248      bad.SetUncalibrated( fittyp );
    12571249      return;
     
    13461338  if (hist.IsEmpty())
    13471339  {
    1348       // *fLog << warn << "Pixel   " << setw(4) << pix.GetPixId() << ": Lo-Gain histogram empty." << endl;
     1340      //*fLog << warn << "Pixel   " << setw(4) << pix.GetPixId() << ": Lo-Gain histogram empty." << endl;
     1341      //bad.SetUncalibrated( fittyp ); // FIXME: Combine with HiGain!
     1342      return;
     1343  }
     1344  if (hist.IsOnlyOverflow())
     1345  {
     1346      *fLog << warn << "Pixel  " << setw(4) << pix.GetPixId() << ": Lo-Gain histogram contains only overflows (Check Binning!)." << endl;
    13491347      bad.SetUncalibrated( fittyp );
    13501348      return;
    13511349  }
    1352   if (hist.IsOnlyOverflow())
    1353   {
    1354       *fLog << warn << "Pixel  " << setw(4) << pix.GetPixId() << ": Lo-Gain histogram contains only overflows." << endl;
    1355       bad.SetUncalibrated( fittyp );
    1356       return;
    1357   }
    13581350  if (hist.IsOnlyUnderflow())
    13591351  {
    1360       *fLog << warn << "Pixel  " << setw(4) << pix.GetPixId() << ": Lo-Gain histogram contains only underflows." << endl;
     1352      *fLog << warn << "Pixel  " << setw(4) << pix.GetPixId() << ": Lo-Gain histogram contains only underflows (Check Binning!)." << endl;
    13611353      bad.SetUncalibrated( fittyp );
    13621354      return;
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationCam.h

    r8417 r8452  
    2929class MGeomCam;
    3030class MRawRunHeader;
    31 class MCalibrationIntensityCam;
    3231class MCalibrationCam;
    3332class MCalibrationPix;
     
    10099
    101100  MBadPixelsCam    *fBadPixels;           //! Bad Pixels storage container
    102   MCalibrationIntensityCam *fIntensCam;   //! Intensity Calibration Cam with the results
    103101  MCalibrationCam  *fCam;                 //! Calibration Cam with the results
    104102  MGeomCam         *fGeom;                //! Camera geometry
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.cc

    r8446 r8452  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MHCalibrationChargeCam.cc,v 1.57 2007-04-25 14:39:43 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MHCalibrationChargeCam.cc,v 1.58 2007-04-27 10:04:47 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    143143#include "MHCalibrationPix.h"
    144144
    145 #include "MCalibrationIntensityCam.h"
    146145#include "MCalibrationChargeCam.h"
    147146#include "MCalibrationChargePix.h"
     
    339338// Gets or creates the pointers to:
    340339// - MExtractedSignalCam
    341 // - MCalibrationChargeCam or MCalibrationIntensityChargeCam
     340// - MCalibrationChargeCam
    342341// - MBadPixelsCam
    343342//
     
    472471        pix.SetBinningAbsTime(higainsamples, -0.5, higainsamples-0.5);
    473472
    474         InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
     473        InitHists(pix, fCam->GetAverageBadArea(j),j);
    475474
    476475        h =  pix.GetHAbsTime();
     
    498497          pix.SetBinningAbsTime(higainsamples, -0.5, higainsamples-0.5);
    499498
    500           InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
     499          InitHists(pix, fCam->GetAverageBadSector(j),j);
    501500
    502501          h =  pix.GetHAbsTime();
     
    582581          pix.SetBinningAbsTime(logainsamples, -0.5, logainsamples-0.5);
    583582         
    584           InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
     583          InitHists(pix, fCam->GetAverageBadArea(j),j);
    585584
    586585          h =  pix.GetHAbsTime();
     
    609608        pix.SetBinningAbsTime(logainsamples, -0.5, logainsamples-0.5);
    610609       
    611         InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
     610        InitHists(pix, fCam->GetAverageBadSector(j),j);
    612611
    613612        h =  pix.GetHAbsTime();
     
    862861  TH1F *h = NULL;
    863862
    864   MCalibrationCam *chargecam = fIntensCam ? fIntensCam->GetCam() : fCam;
    865 
    866863  const Int_t hifirst = fSignal->GetFirstUsedSliceHiGain();
    867864  const Int_t hilast  = fSignal->GetLastUsedSliceHiGain();
     
    871868  for (Int_t i=0; i<fHiGainArray->GetSize(); i++)
    872869    {
    873      
     870
    874871      MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)(*this)[i];
    875      
    876872      if (histhi.IsExcluded())
    877873        continue;
    878874
    879       MCalibrationChargePix  &pix = (MCalibrationChargePix&)(*chargecam)[i] ;
     875      MCalibrationChargePix  &pix = (MCalibrationChargePix&)(*fCam)[i];
    880876
    881877      const Int_t numsat = histhi.GetSaturated();
     
    935931          }
    936932
    937         MCalibrationChargePix &pix = (MCalibrationChargePix&)(*chargecam)[i] ;
     933        MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i] ;
    938934        if (!pix.IsHiGainSaturation())
    939935            continue;
     
    966962     
    967963      MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)GetAverageHiGainArea(j);     
    968       MCalibrationChargePix  &pix    = (MCalibrationChargePix&)chargecam->GetAverageArea(j);
     964      MCalibrationChargePix  &pix    = (MCalibrationChargePix&)fCam->GetAverageArea(j);
    969965
    970966      if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
     
    976972        }
    977973
    978       MBadPixelsPix &bad = chargecam->GetAverageBadArea(j);
     974      MBadPixelsPix &bad = fCam->GetAverageBadArea(j);
    979975      FinalizeAbsTimes(histhi, pix, bad, hifirst, hilast);
    980976   }
     
    994990          }
    995991       
    996         MCalibrationChargePix  &pix    = (MCalibrationChargePix&)chargecam->GetAverageArea(j);
    997 
     992        MCalibrationChargePix &pix = (MCalibrationChargePix&)fCam->GetAverageArea(j);
    998993        if (pix.IsHiGainSaturation())
    999994          {
    1000             MBadPixelsPix &bad = chargecam->GetAverageBadArea(j);
     995            MBadPixelsPix &bad = fCam->GetAverageBadArea(j);
    1001996            FinalizeAbsTimes(histlo, pix, bad, lofirst, lolast);
    1002997          }
    1003        
     998
    1004999      }
    10051000 
     
    10081003     
    10091004      MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)GetAverageHiGainSector(j);     
    1010       MCalibrationChargePix  &pix    = (MCalibrationChargePix&)chargecam->GetAverageSector(j);
     1005      MCalibrationChargePix  &pix    = (MCalibrationChargePix&)fCam->GetAverageSector(j);
    10111006
    10121007      if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
     
    10181013        }
    10191014
    1020       MBadPixelsPix &bad = chargecam->GetAverageBadSector(j);
     1015      MBadPixelsPix &bad = fCam->GetAverageBadSector(j);
    10211016      FinalizeAbsTimes(histhi, pix, bad, hifirst, hilast);
    10221017    }
     
    10251020    for (Int_t j=0; j<fAverageLoGainSectors->GetSize(); j++)
    10261021      {
    1027        
     1022
    10281023        MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)GetAverageLoGainSector(j);     
    1029         MBadPixelsPix          &bad    = chargecam->GetAverageBadSector(j);
    1030        
     1024        MBadPixelsPix          &bad    = fCam->GetAverageBadSector(j);
     1025
    10311026        if (histlo.GetSaturated() > fNumLoGainSaturationLimit*histlo.GetHGausHist()->GetEntries())
    10321027          {
     
    10371032            continue;
    10381033          }
    1039        
    1040         MCalibrationChargePix  &pix    = (MCalibrationChargePix&)chargecam->GetAverageSector(j);
    1041 
     1034
     1035        MCalibrationChargePix &pix = (MCalibrationChargePix&)fCam->GetAverageSector(j);
    10421036        if (pix.IsHiGainSaturation())
    10431037          FinalizeAbsTimes(histlo, pix, bad, lofirst, lolast);
     
    10471041  // Perform the fitting for the High Gain (done in MHCalibrationCam)
    10481042  //
    1049   FitHiGainArrays(*chargecam, *fBadPixels,
     1043  FitHiGainArrays(*fCam, *fBadPixels,
    10501044                  MBadPixelsPix::kHiGainNotFitted,
    10511045                  MBadPixelsPix::kHiGainOscillating);
     
    10551049  //
    10561050  if (IsLoGain())
    1057     FitLoGainArrays(*chargecam, *fBadPixels,
     1051    FitLoGainArrays(*fCam, *fBadPixels,
    10581052                    MBadPixelsPix::kLoGainNotFitted,
    10591053                    MBadPixelsPix::kLoGainOscillating);
     
    10711065          continue;
    10721066
    1073       MCalibrationChargePix  &pix = (MCalibrationChargePix&)(*chargecam)[i] ;
     1067      MCalibrationChargePix  &pix = (MCalibrationChargePix&)(*fCam)[i];
    10741068      if (!pix.IsHiGainSaturation())
    10751069          continue;
     
    11431137{
    11441138
    1145   MCalibrationCam *chargecam = fIntensCam ? fIntensCam->GetCam() : fCam;
    1146      
    11471139  for (Int_t i=0; i<fBadPixels->GetSize(); i++)
    11481140    {
    1149      
    1150       MBadPixelsPix    &bad    = (*fBadPixels)[i];
    1151       MCalibrationPix  &pix    = (*chargecam)[i];
     1141
     1142      MBadPixelsPix &bad = (*fBadPixels)[i];
     1143      MCalibrationPix &pix = (*fCam)[i];
    11521144
    11531145      if (bad.IsUncalibrated(MBadPixelsPix::kHiGainNotFitted))
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationRelTimeCam.cc

    r8428 r8452  
    125125
    126126const Float_t MHCalibrationRelTimeCam::fgNumHiGainSaturationLimit = 0.25;
    127 const UInt_t  MHCalibrationRelTimeCam::fgReferencePixel = 1;
     127//const UInt_t  MHCalibrationRelTimeCam::fgReferencePixel = 1;
    128128const Int_t   MHCalibrationRelTimeCam::fgNbins      = 400;
    129129const Axis_t  MHCalibrationRelTimeCam::fgFirst      = -9.975;
     
    141141//
    142142// Sets:
    143 // - fReferencePixel to fgReferencePixel
    144143// - fNbins to fgNbins
    145144// - fFirst to fgFirst
     
    159158  SetNumHiGainSaturationLimit(fgNumHiGainSaturationLimit);
    160159
    161   SetReferencePixel();
     160//  SetReferencePixel();
    162161
    163162  SetBinning(fgNbins, fgFirst, fgLast);
     
    263262    return kFALSE;
    264263
    265   MArrivalTimeCam *signal = (MArrivalTimeCam*)pList->FindObject("MArrivalTimeCam");
    266   if (!signal)
    267   {
    268       *fLog << err << "MArrivalTimeCam not found... abort." << endl;
    269       return kFALSE;
    270   }
    271 
    272264  const Int_t npixels  = fGeom->GetNumPixels();
    273265  const Int_t nsectors = fGeom->GetNumSectors();
     
    313305      return kFALSE;
    314306    }
    315  
     307
    316308  const Int_t npixels  = fGeom->GetNumPixels();
    317309  const Int_t nareas   = fGeom->GetNumAreas();
     
    327319  fNumsectorlo.Reset();
    328320
    329   const MArrivalTimePix &refpix = (*arrtime)[fReferencePixel];
    330   // FIXME: What do we do if pixel is invalid?
    331   if (!refpix.IsArrivalTimeValid())
     321  TArrayF arr(npixels);
     322  Int_t n = 0;
     323  for (Int_t i=0; i<npixels; i++)
    332324  {
    333       gLog << warn << "WARNING - Arrival time in refrence pixel " << fReferencePixel << " invalid." << endl;
    334       return kTRUE;
     325      if ((*fGeom)[i].GetAidx()>0)
     326          continue;
     327
     328      const MArrivalTimePix &pix = (*arrtime)[i];
     329      if (pix.IsHiGainValid() && !pix.IsHiGainSaturated())
     330          arr[n++] = pix.GetArrivalTimeHiGain();
    335331  }
    336332
    337   const Float_t reftime = refpix.GetArrivalTime();
    338 //      refpix.IsHiGainSaturated()
    339 //     ? refpix.GetArrivalTimeLoGain() : refpix.GetArrivalTimeHiGain();
     333  const Float_t reftime = TMath::Median(n, arr.GetArray());
    340334
    341335  for (Int_t i=0; i<npixels; i++)
     
    345339          continue;
    346340
    347       const Int_t aidx   = (*fGeom)[i].GetAidx();
    348       const Int_t sector = (*fGeom)[i].GetSector();
    349 
    350341      const MArrivalTimePix &pix = (*arrtime)[i];
    351342
     
    361352              histhi.FillHist(time-reftime);
    362353
     354          const Int_t aidx   = (*fGeom)[i].GetAidx();
     355          const Int_t sector = (*fGeom)[i].GetSector();
     356
    363357          fSumareahi  [aidx]   += time;
    364358          fNumareahi  [aidx]   ++;
     
    373367/*
    374368      // If lo-gain arrival time has been extracted successfully,
    375       // the hi-gain has saturateed and the lo-gain is switched on
     369      // the hi-gain has saturated and the lo-gain is switched on
    376370      // fill hi-gain histograms and arrays
    377371      if (pix.IsLoGainValid() && IsLoGain())
    378372      {
    379373          const Float_t time = pix.GetArrivalTimeLoGain();
     374
     375          // FIXME: We need the reference time of the lo-gains!
    380376
    381377          MHCalibrationPix &histlo = (*this)(i);
     
    393389
    394390  for (Int_t j=0; j<nareas; j++)
    395     {
    396       MHCalibrationPix &histhi = GetAverageHiGainArea(j);
    397       if (IsOscillations())
    398           histhi.FillHistAndArray(fNumareahi[j] == 0 ? 0. : fSumareahi[j]/fNumareahi[j]);
    399       else
    400           histhi.FillHist(fNumareahi[j] == 0 ? 0. : fSumareahi[j]/fNumareahi[j]);
    401 
    402       if (IsLoGain())
    403         {
     391  {
     392      if (fNumareahi[j]>0)
     393      {
     394          MHCalibrationPix &histhi = GetAverageHiGainArea(j);
     395          if (IsOscillations())
     396              histhi.FillHistAndArray(fSumareahi[j]/fNumareahi[j]);
     397          else
     398              histhi.FillHist(fSumareahi[j]/fNumareahi[j]);
     399      }
     400
     401      if (IsLoGain() && fNumarealo[j]>0)
     402      {
    404403          MHCalibrationPix &histlo = GetAverageLoGainArea(j);
    405           if (IsOscillations())
    406               histlo.FillHistAndArray(fNumarealo[j] == 0 ? 0. : fSumarealo[j]/fNumarealo[j]);
     404          if (IsOscillations())
     405              histlo.FillHistAndArray(fSumarealo[j]/fNumarealo[j]);
    407406          else
    408               histlo.FillHist(fNumarealo[j] == 0 ? 0. : fSumarealo[j]/fNumarealo[j]);
    409         }
    410     }
    411  
     407              histlo.FillHist(fSumarealo[j]/fNumarealo[j]);
     408      }
     409  }
     410
    412411  for (Int_t j=0; j<nsectors; j++)
    413     {
    414       MHCalibrationPix &histhi = GetAverageHiGainSector(j);
    415       if (IsOscillations())
    416           histhi.FillHistAndArray(fNumsectorhi[j] == 0 ? 0. : fSumsectorhi[j]/fNumsectorhi[j]);
    417       else
    418           histhi.FillHist(fNumsectorhi[j] == 0 ? 0. : fSumsectorhi[j]/fNumsectorhi[j]);
    419 
    420       if (IsLoGain())
    421         {
     412  {
     413      if (fNumsectorhi[j]>0)
     414      {
     415          MHCalibrationPix &histhi = GetAverageHiGainSector(j);
     416          if (IsOscillations())
     417              histhi.FillHistAndArray(fSumsectorhi[j]/fNumsectorhi[j]);
     418          else
     419              histhi.FillHist(fSumsectorhi[j]/fNumsectorhi[j]);
     420      }
     421
     422      if (IsLoGain() && fNumsectorlo[j]>0)
     423      {
    422424          MHCalibrationPix &histlo = GetAverageLoGainSector(j);
    423           if (IsOscillations())
    424               histlo.FillHistAndArray(fNumsectorlo[j] == 0 ? 0. : fSumsectorlo[j]/fNumsectorlo[j]);
     425          if (IsOscillations())
     426              histlo.FillHistAndArray(fSumsectorlo[j]/fNumsectorlo[j]);
    425427          else
    426               histlo.FillHist(fNumsectorlo[j] == 0 ? 0. : fSumsectorlo[j]/fNumsectorlo[j]);
    427         }
    428     }
     428              histlo.FillHist(fSumsectorlo[j]/fNumsectorlo[j]);
     429      }
     430  }
    429431
    430432  return kTRUE;
     
    459461      if (histhi.IsExcluded())
    460462        continue;
    461      
     463
    462464      const Int_t aidx   = (*fGeom)[i].GetAidx();
    463465      const Int_t sector = (*fGeom)[i].GetSector();
     
    562564
    563565      if (bad.IsUncalibrated( MBadPixelsPix::kRelTimeNotFitted ))
    564         bad.SetUnsuitable(   MBadPixelsPix::kUnreliableRun    );
     566          bad.SetUnsuitable(   MBadPixelsPix::kUnreliableRun    );
    565567
    566568      if (bad.IsUncalibrated( MBadPixelsPix::kRelTimeOscillating))
    567         bad.SetUnsuitable(   MBadPixelsPix::kUnreliableRun    );
    568      
     569          bad.SetUnsuitable(   MBadPixelsPix::kUnreliableRun    );
     570
    569571    }
    570572}
     
    577579// ==============
    578580//
    579 // 0: Fitted Mean Relative Arrival Time in FADC slices (MHGausEvents::GetMean()
    580 // 1: Error Mean Relative Arrival Time in FADC slices  (MHGausEvents::GetMeanErr()
     581// 0: Fitted Mean  Relative Arrival Time in FADC slices (MHGausEvents::GetMean()
     582// 1: Error  Mean  Relative Arrival Time in FADC slices (MHGausEvents::GetMeanErr()
    581583// 2: Sigma fitted Relative Arrival Time in FADC slices (MHGausEvents::GetSigma()
    582 // 3: Error Sigma Relative Arrival Time in FADC slices (MHGausEvents::GetSigmaErr()
     584// 3: Error Sigma  Relative Arrival Time in FADC slices (MHGausEvents::GetSigmaErr()
    583585//
    584586// Useful variables derived from the fit results:
    585587// =============================================
    586588//
    587 // 4: Returned probability of Gauss fit              (calls: MHGausEvents::GetProb())
     589// 4: Returned probability of Gauss fit  (MHGausEvents::GetProb())
    588590//
    589591// Localized defects:
    590592// ==================
    591593//
    592 // 5: Gaus fit not OK                               (calls: MHGausEvents::IsGausFitOK())
    593 // 6: Fourier spectrum not OK                       (calls: MHGausEvents::IsFourierSpectrumOK())
     594// 5: Gaus fit not OK                    (MHGausEvents::IsGausFitOK())
     595// 6: Fourier spectrum not OK            (MHGausEvents::IsFourierSpectrumOK())
    594596//
    595597Bool_t MHCalibrationRelTimeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
     
    849851    }
    850852
    851     if (IsEnvDefined(env, prefix, "ReferencePixel", print))
    852     {
    853         SetReferencePixel(GetEnvValue(env, prefix, "ReferencePixel", (Int_t)fReferencePixel));
    854         rc = kTRUE;
    855     }
    856 
    857853    TEnv refenv(fReferenceFile);
    858854
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationRelTimeCam.h

    r8001 r8452  
    2222
    2323  static const Float_t fgNumHiGainSaturationLimit;   //! The default for fNumHiGainSaturationLimit (now at: 0.25)
    24   static const UInt_t  fgReferencePixel;             //! Default for fReferencePixel   (now set to: 1)
    2524  static const Int_t   fgNbins;                      //! Default number of bins        (now set to: 900   )
    2625  static const Axis_t  fgFirst;                      //! Default lower histogram limit (now set to: -13.5 )
     
    3534  static const TString fgReferenceFile;              //! default for fReferenceFile ("mjobs/calibrationref.rc")
    3635
    37   UInt_t  fReferencePixel;                           // The reference pixel for rel. times
    3836  Float_t fInnerRefTime;                             // The reference mean arrival time inner pixels
    3937  Float_t fOuterRefTime;                             // The reference mean arrival time outer pixels
     
    6664  ~MHCalibrationRelTimeCam() {}
    6765
    68   UInt_t GetReferencePixel() const { return fReferencePixel; }
    69 
    7066  // Clone
    7167  TObject *Clone(const char *name="") const;
    7268
    7369  // Setters
    74   void  SetReferencePixel( const UInt_t i=fgReferencePixel   ) { fReferencePixel = i;   }
    7570  void  SetReferenceFile ( const TString ref=fgReferenceFile ) { fReferenceFile  = ref; }
    7671
  • trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc

    r8445 r8452  
    6969
    7070#include "MCalibConstCam.h"
    71 #include "MCalibrationIntensityChargeCam.h"
    7271
    7372#include "MHCalibrationChargeCam.h"
     
    125124//
    126125MJCalibrateSignal::MJCalibrateSignal(const char *name, const char *title)
    127     : fExtractor(0), fIsInterlaced(kTRUE), fIsRelTimesUpdate(kFALSE), fIsMovieMode(kFALSE)
     126    : fExtractor(0), fIsInterlaced(kTRUE), fIsRelTimesUpdate(kTRUE), fIsMovieMode(kFALSE)
    128127{
    129128    fName  = name  ? name  : "MJCalibrateSignal";
     
    250249
    251250    // Read File
    252     MCalibrationIntensityChargeCam      ichcam;
    253 
    254251    MHCalibrationChargeCam      hchacam;
    255252    MHCalibrationChargeBlindCam hbndcam;
     
    276273    if (fIsInterlaced)
    277274    {
    278         interlacedcont.Add(&ichcam);
    279275        interlacedcont.Add(&hchacam);
    280276        if (IsUseBlindPixel())
     
    531527
    532528    MCalibrationChargeCalc  chcalc;
     529    chcalc.SetContinousCalibration();
    533530    chcalc.SetExtractor(extractor3);
    534531
     
    546543
    547544    //
    548     // Intensity Calibration histogramming
     545    // Calibration histogramming
    549546    //
    550547    MFillH filpin(&hpndiod, "MExtractedSignalPINDiode",   "FillPINDiode");
     
    695692    tlist3.SetFilter(&fcalib);
    696693
    697     //MFDataPhrase filcalco("MCalibrationIntensityConstCam.IsReadyToSave>0.5", "CalibConstFilter");
     694    //MFDataPhrase filcalco("MCalibrationConstCam.IsReadyToSave>0.5", "CalibConstFilter");
    698695    if (fIsInterlaced)
    699696    {
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.cc

    r8434 r8452  
    1919!   Author(s): Markus Gaug, 02/2004 <mailto:markus@ifae.es>
    2020!
    21 !   Copyright: MAGIC Software Development, 2000-2005
     21!   Copyright: MAGIC Software Development, 2000-2007
    2222!
    2323!
     
    218218  fRefConvFADC2PheInner      = 0.14;
    219219  fRefConvFADC2PheOuter      = 0.52;
    220   fRefQEInner                = 0.18;           
     220  fRefQEInner                = 0.18;
    221221  fRefQEOuter                = 0.12;
    222   fRefArrivalTimeInner       = 4.5;           
     222  fRefArrivalTimeInner       = 4.5;
    223223  fRefArrivalTimeOuter       = 5.0;
    224   fRefArrivalTimeRmsInner    = 0.5;           
     224  fRefArrivalTimeRmsInner    = 0.5;
    225225  fRefArrivalTimeRmsOuter    = 0.5;
    226   fRefTimeOffsetInner        = -0.23;   
    227   fRefTimeOffsetOuter        = 0.39;   
    228   fRefTimeResolutionInner    = 0.153;
    229   fRefTimeResolutionOuter    = 0.128;
     226  fRefTimeOffsetOuter        = 0.62;
     227  fRefTimeResolutionInner    = 0.12;
     228  fRefTimeResolutionOuter    = 0.09;
    230229
    231230}
     
    813812      // for the datacheck, fix the ranges!!
    814813      //
    815       const Double_t max = 11.;
     814      const Double_t max = 12.;
    816815      obj8->SetMinimum(0.);
    817816      obj8->SetMaximum(max);
     
    825824      const Int_t numcol = gStyle->GetNumberOfColors()-3;
    826825     
    827       TPaveText *pave = new TPaveText(0.05,0.02,0.975,0.99);
     826      TPaveText *pave = new TPaveText(0.05,0.02,0.975,0.999);
    828827      pave->SetBit(kCanDelete);
    829828      pave->ConvertNDCtoPad();
     
    866865      t17->SetTextColor(gStyle->GetColorPalette(Int_t(9./max*numcol)));
    867866      t17->SetTextAlign(12);
     867      TText *t18 = pave->AddText(Form("Deviating Rel. Arrival Time RMS:                %3i pixels",
     868                                       CountBadPixels(&disp24,10 )));
     869      t18->SetTextColor(gStyle->GetColorPalette(Int_t(10./max*numcol)));
     870      t18->SetTextAlign(12);
    868871      TText *t15= pave->AddText(Form("Too many Low-Gain Blackout Events:       %3i pixels",
    869                                        CountBadPixels(&disp24,10 )));
    870       t15->SetTextColor(gStyle->GetColorPalette(Int_t(10./max*numcol)));
     872                                       CountBadPixels(&disp24,11 )));
     873      t15->SetTextColor(gStyle->GetColorPalette(Int_t(11./max*numcol)));
    871874      t15->SetTextAlign(12);
    872875      TText *t14= pave->AddText(Form("Previously Excluded:                                   %3i pixels",
    873                                        CountBadPixels(&disp24,11)));
    874       t14->SetTextColor(gStyle->GetColorPalette(Int_t(11./max*numcol)));
     876                                       CountBadPixels(&disp24,12)));
     877      t14->SetTextColor(gStyle->GetColorPalette(Int_t(12./max*numcol)));
    875878      t14->SetTextAlign(12);
    876879      pave->Draw();
     
    903906      gStyle->SetPalette(1);
    904907     
    905       TPaveText *pave2 = new TPaveText(0.025,0.02,0.95,0.99);
     908      TPaveText *pave2 = new TPaveText(0.025,0.02,0.95,0.999);
    906909      pave2->SetBit(kCanDelete);
    907910      pave2->ConvertNDCtoPad();
     
    12391242      break;
    12401243    case 5:
    1241       l1 = line.DrawLine(0, fRefTimeOffsetInner, x, fRefTimeOffsetInner );
     1244      l1 = line.DrawLine(0, 0, x, 0);
    12421245      break;
    12431246    case 6:
     
    13911394//   RefArrivalTimeRmsOuter
    13921395//
    1393 //   RefTimeOffsetInner
    13941396//   RefTimeOffsetOuter
    13951397//   RefTimeResolutionInner
     
    14251427    fRefArrivalTimeRmsInner = refenv.GetValue("RefArrivalTimeRmsInner",fRefArrivalTimeRmsInner);
    14261428    fRefArrivalTimeRmsOuter = refenv.GetValue("RefArrivalTimeRmsOuter",fRefArrivalTimeRmsOuter);
    1427     fRefTimeOffsetInner     = refenv.GetValue("RefTimeOffsetInner",fRefTimeOffsetInner);
    14281429    fRefTimeOffsetOuter     = refenv.GetValue("RefTimeOffsetOuter",fRefTimeOffsetOuter);
    14291430    fRefTimeResolutionInner = refenv.GetValue("RefTimeResolutionInner",fRefTimeResolutionInner);
     
    18941895    tlist.AddToList(&cont);
    18951896
    1896     if (IsRelTimes())
    1897     {
    1898         tlist.AddToList(&filltme);
    1899         tlist.AddToList(&timecalc);
    1900     }
    1901 
    19021897    tlist.AddToList(&fillcam);
    19031898
     
    19091904    tlist.AddToList(&calcalc);
    19101905
     1906    if (IsRelTimes())
     1907    {
     1908        tlist.AddToList(&filltme);
     1909        tlist.AddToList(&timecalc);
     1910    }
    19111911
    19121912    MHCamEvent evt2(0, "Extra'd", "Extracted Calibration Signal;;S [cnts/sl]");
  • trunk/MagicSoft/Mars/mjobs/calibrationref.rc

    r7013 r8452  
    6363# Relative Time Calibration:
    6464#
    65 RefTimeOffsetInner:       -0.23
    66 RefTimeOffsetOuter:       0.39   
    67 RefTimeResolutionInner:   0.153
    68 RefTimeResolutionOuter:   0.128
     65RefTimeOffsetOuter:       0.62   
     66RefTimeResolutionInner:   0.12
     67RefTimeResolutionOuter:   0.09
    6968#
    7069# Mean Absolute Time:
  • trunk/MagicSoft/Mars/mjobs/calibrationref_Dec04.rc

    r7013 r8452  
    6363# Relative Time Calibration:
    6464#
    65 RefTimeOffsetInner:       -0.23
    66 RefTimeOffsetOuter:       0.39   
    67 RefTimeResolutionInner:   0.153
    68 RefTimeResolutionOuter:   0.128
     65RefTimeOffsetOuter:       0.62
     66RefTimeResolutionInner:   0.12
     67RefTimeResolutionOuter:   0.09
    6968#
    7069# Mean Absolute Time:
  • trunk/MagicSoft/Mars/mjobs/calibrationref_Nov04.rc

    r7013 r8452  
    6363# Relative Time Calibration:
    6464#
    65 RefTimeOffsetInner:       -0.23
    66 RefTimeOffsetOuter:       0.39   
    67 RefTimeResolutionInner:   0.153
    68 RefTimeResolutionOuter:   0.128
     65RefTimeOffsetOuter:       0.62
     66RefTimeResolutionInner:   0.12
     67RefTimeResolutionOuter:   0.09
    6968#
    7069# Mean Absolute Time:
  • trunk/MagicSoft/Mars/resources/calibrationref_mux.rc

    r8370 r8452  
    3030#
    3131TimeOffsetMin:           -9.
    32 TimeOffsetMax:            9.
     32TimeOffsetMax:           12.
    3333
    34 TimeResolutionMin:        1.
    35 TimeResolutionMax:        1.5
     34TimeResolutionMin:        0.45
     35TimeResolutionMax:        1.25
    3636
    3737######################################################################
     
    6868# Relative Time Calibration:
    6969#
    70 RefTimeOffsetInner:       -3.5
    71 RefTimeOffsetOuter:        2
    72 RefTimeResolutionInner:    1.25
    73 RefTimeResolutionOuter:    1.1
     70RefTimeOffsetOuter:        5.5
     71RefTimeResolutionInner:    0.9
     72RefTimeResolutionOuter:    0.7
    7473
    7574#
Note: See TracChangeset for help on using the changeset viewer.