Changeset 3697 for trunk


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

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3696 r3697  
    2525     - put abs. time consistency check from MCalibrationChargeCalc into
    2626       MHCalibrationChargePINDiode and MHCalibrationChargeCam
     27
     28   * mcalib/MHCalibrationCam.[h,cc]     
     29   * mcalib/MHCalibrationChargeCalc.[h,cc]     
     30     - number of used FADC slices also stored in MHCalibrationCam,
     31       MHCalibrationChargeCalc needs no pointer to the signal extractors
     32       any more -> removed
    2733
    2834
  • trunk/MagicSoft/Mars/mcalib/MCalibrationCam.cc

    r3694 r3697  
    7676// Initializes:
    7777// - fPulserColor to kCT1
     78// - fNumHiGainFADCSlices to 0.
     79// - fNumLoGainFADCSlices to 0.
    7880//
    7981// Creates a TClonesArray of MBadPixelsPix containers for the TClonesArray's:
     
    8688//
    8789MCalibrationCam::MCalibrationCam(const char *name, const char *title)
    88     : fPulserColor(kCT1), fPixels(NULL), fAverageAreas(NULL), fAverageSectors(NULL)
     90    : fNumHiGainFADCSlices(0.), fNumLoGainFADCSlices(0.), fPulserColor(kCT1),
     91      fPixels(NULL), fAverageAreas(NULL), fAverageSectors(NULL)
    8992{
    9093    fName  = name  ? name  : "MCalibrationCam";
  • trunk/MagicSoft/Mars/mcalib/MCalibrationCam.h

    r3694 r3697  
    1818class MCalibrationCam : public MParContainer, public MCamEvent
    1919{
    20 
    2120public:
    2221
     
    2524 
    2625protected:
     26
     27  Float_t fNumHiGainFADCSlices;      // Number High-Gain FADC slices used by extractor     
     28  Float_t fNumLoGainFADCSlices;      // Number Low -Gain FADC slices used by extractor
    2729 
    2830  PulserColor_t fPulserColor;        // Colour of the pulsed LEDs
     
    5355  const Int_t            GetAverageSectors   ()           const; 
    5456  const MCalibrationPix &GetAverageSector    ( UInt_t i ) const;
     57  const Float_t          GetNumHiGainFADCSlices()         const { return fNumHiGainFADCSlices; }
     58  const Float_t          GetNumLoGainFADCSlices()         const { return fNumLoGainFADCSlices; } 
    5559  virtual Bool_t         GetPixelContent     ( Double_t &val, Int_t idx,
    5660                                               const MGeomCam &cam, Int_t type=0) const;
    57   const PulserColor_t    GetPulserColor()                 const { return fPulserColor; }
     61  const PulserColor_t    GetPulserColor()                 const { return fPulserColor;         }
    5862  const Int_t            GetSize()                        const;
    5963
     
    6266
    6367  // Inits
    64   void  Init               ( const MGeomCam &geom       );
    65   void  InitSize           ( const UInt_t i             );
    66   void  InitAverageAreas   ( const UInt_t i             );
    67   void  InitAverageSectors ( const UInt_t i             );
     68  void  Init                   ( const MGeomCam &geom         );
     69  void  InitSize               ( const UInt_t i               );
     70  void  InitAverageAreas       ( const UInt_t i               );
     71  void  InitAverageSectors     ( const UInt_t i               );
    6872
    6973  // Setters
    70   void  SetPulserColor     ( const PulserColor_t col=kCT1 )  { fPulserColor = col; }
     74  void  SetNumHiGainFADCSlices ( const Float_t f              )  { fNumHiGainFADCSlices = f; }
     75  void  SetNumLoGainFADCSlices ( const Float_t f              )  { fNumLoGainFADCSlices = f; } 
     76  void  SetPulserColor         ( const PulserColor_t col=kCT1 )  { fPulserColor = col; }
    7177 
    7278  ClassDef(MCalibrationCam, 1)  // Base class Container for Calibration Results Camera
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc

    r3694 r3697  
    2828//
    2929//   Task to calculate the calibration conversion factors and quantum efficiencies
    30 //   from the FADC time slices. The integrated time slices have to be delivered by an
    31 //   MExtractedSignalCam, pedestals by an MPedestalCam.
    32 //
    33 //   The output container MCalibrationCam holds one entry of type MCalibrationChargePix
    34 //   for every pixel. It is filled in the following way:
    35 //
    36 //   PreProcess(): Initialize MCalibrationCam
     30//   from the fit results to the summed FADC slice distributions delivered by
     31//   MCalibrationChargeCam, MCalibrationChargePix, MCalibrationChargeBlindPix and
     32//   MCalibrationChargePINDiode, calculated and filled by MHCalibrationChargeCam,
     33//   MHCalibrationChargePix, MHCalibrationChargeBlindPix and MHCalibrationChargePINDiode.
     34//
     35//   PreProcess(): Initialize pointers to MCalibrationChargeCam, MCalibrationChargeBlindPix
     36//                 MCalibrationChargePINDiode and  MCalibrationQECam
     37//
    3738//                 Initialize pulser light wavelength
    3839//               
     
    231232const Float_t MCalibrationChargeCalc::fgLambdaCheckLimit       = 0.2;
    232233const Float_t MCalibrationChargeCalc::fgPheErrLimit            = 5.;
    233 const Float_t MCalibrationChargeCalc::fgTimeLowerLimit         = 1.;
    234 const Float_t MCalibrationChargeCalc::fgTimeUpperLimit         = 2.;
    235234// --------------------------------------------------------------------------
    236235//
     
    251250// - fLambdaCheckLimit  to fgLambdaCheckLimit
    252251// - fLambdaErrLimit    to fgLambdaErrLimit
    253 // - fTimeLowerLimit    to fgTimeLowerLimit
    254 // - fTimeUpperLimit    to fgTimeUpperLimit
    255252// - fPheErrLimit       to fgPheErrLimit 
    256253// - fPulserColor       to MCalibrationCam::kCT1
     
    261258MCalibrationChargeCalc::MCalibrationChargeCalc(const char *name, const char *title)
    262259    : fBadPixels(NULL), fCam(NULL), fBlindPixel(NULL), fPINDiode(NULL),
    263       fQECam(NULL), fSignals(NULL), fSigBlind(NULL), fSigPIN(NULL),
    264       fGeom(NULL), fPedestals(NULL), fEvtTime(NULL)
     260      fQECam(NULL), fGeom(NULL), fPedestals(NULL), fEvtTime(NULL)
    265261      {
    266262
     
    280276  SetPheErrLimit();
    281277  SetPulserColor(MCalibrationCam::kCT1);
    282   SetTimeLowerLimit();
    283   SetTimeUpperLimit();
    284278
    285279  Clear();
     
    302296// The following container are searched for and execution aborted if not in MParList:
    303297//  - MPedestalCam
    304 //  - MExtractedSignalCam
    305 //  - MCalibrationChargeCam
    306298//
    307299// The following containers are searched and created if they were not found:
     
    313305// cannot be found, the corresponding calibration part is only skipped.
    314306//
    315 //  - MExtractedSignalBlindPixel and MCalibrationChargeBlindPix
    316 //  - MExtractedSignalPINDiode   and MCalibrationChargePINDiode
     307//  - MCalibrationChargeBlindPix
     308//  - MCalibrationChargePINDiode
    317309//  - MTime
    318310//
     
    336328    }
    337329 
    338   fSignals = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam");
    339   if (!fSignals)
    340     {
    341       *fLog << err << "MExtractedSignalCam not found... aborting" << endl;
    342       return kFALSE;
    343     }
    344  
    345   fCam = (MCalibrationChargeCam*)pList->FindObject("MCalibrationChargeCam");
    346   if (!fCam)
    347     {
    348       *fLog << err << "Cannot find MCalibrationChargeCam... aborting" << endl;
    349       *fLog << err << "Maybe you forget to call an MFillH for the MHCalibrationChargeCam before..." << endl;
    350       return kFALSE;
    351     }
    352 
    353330  //
    354331  // Containers that are created in case that they are not there.
     
    368345    }
    369346
    370   //
    371   // Optional Containers
    372   //
    373   fSigBlind = (MExtractedSignalBlindPixel*)pList->FindObject("MExtractedSignalBlindPixel");
    374   if (!fSigBlind)
    375     *fLog << warn << "MExtractedSignalBlindPixel not found... no blind pixel method! " << endl;
    376   else
    377     {
    378       fBlindPixel = (MCalibrationChargeBlindPix*)pList->FindCreateObj("MCalibrationChargeBlindPix");
    379       if (!fBlindPixel)
    380         {
    381           *fLog << err << "Cannot find nor create MCalibrationChargeBlindPix... aborting" << endl;
    382           return kFALSE;
    383         }
    384     }
    385  
    386   fSigPIN  = (MExtractedSignalPINDiode*)pList->FindObject("MExtractedSignalPINDiode");
    387   if (!fSigPIN)
    388     *fLog << warn << "MExtractedSignalPINDiode not found... no PIN Diode method! " << endl;
    389   else
    390     {
    391       fPINDiode = (MCalibrationChargePINDiode*)pList->FindCreateObj("MCalibrationChargePINDiode");
    392       if (!fPINDiode)
    393         {
    394           *fLog << err << "Cannot find nor create MCalibrationChargePINDiode... aborting" << endl;
    395           return kFALSE;
    396         }
    397     }
    398347 
    399348  fEvtTime = (MTime*)pList->FindObject("MTime");
     
    418367// The ReInit searches for the following input containers:
    419368//  - MGeomCam
    420 //
    421 // It retrieves the following variables from MExtractedSignalCam:
     369//  - MCalibrationChargeCam
     370//
     371// It retrieves the following variables from MCalibrationChargeCam:
    422372//
    423373//  - fNumHiGainSamples
     
    446396    }
    447397 
    448   fNumHiGainSamples  =  fSignals->GetNumUsedHiGainFADCSlices();
    449   fNumLoGainSamples  =  fSignals->GetNumUsedLoGainFADCSlices();
     398  fCam = (MCalibrationChargeCam*)pList->FindObject("MCalibrationChargeCam");
     399  if (!fCam)
     400    {
     401      *fLog << err << "Cannot find MCalibrationChargeCam... aborting" << endl;
     402      *fLog << err << "Maybe you forget to call an MFillH for the MHCalibrationChargeCam before..." << endl;
     403      return kFALSE;
     404    }
     405
     406  //
     407  // Optional Containers
     408  //
     409  fBlindPixel = (MCalibrationChargeBlindPix*)pList->FindObject("MCalibrationChargeBlindPix");
     410  if (!fBlindPixel)
     411    {
     412      *fLog << warn << GetDescriptor()
     413            << ": MCalibrationChargeBlindPix not found... no blind pixel method! " << endl;
     414      return kFALSE;
     415    }
     416 
     417  fPINDiode = (MCalibrationChargePINDiode*)pList->FindCreateObj("MCalibrationChargePINDiode");
     418  if (!fPINDiode)
     419    {
     420      *fLog << warn << GetDescriptor()
     421            << "MCalibrationChargePINDiode not found... no PIN Diode method! " << endl;
     422      return kFALSE;
     423    }
     424
     425  fNumHiGainSamples  =  fCam->GetNumHiGainFADCSlices();
     426  fNumLoGainSamples  =  fCam->GetNumLoGainFADCSlices();
    450427  fSqrtHiGainSamples =  TMath::Sqrt(fNumHiGainSamples);
    451428  fSqrtLoGainSamples =  TMath::Sqrt(fNumLoGainSamples);
     
    565542// Finalize charges per pixel:
    566543// - Check chage validity
    567 // - Check absolute time validity
    568544// - Calculate the reduced sigma
    569545// - Calculate the number of photo-electrons
     
    609585    }
    610586
    611   //
    612   // The check returns kTRUE if:
    613   //
    614   // The mean arrival time is at least fTimeLowerLimit slices from the lower edge
    615   // and fUpperLimit slices from the upper edge
    616   //
    617   const Byte_t loweredge  = cal.IsHiGainSaturation() ? fSignals->GetFirstUsedSliceLoGain()
    618                                                      : fSignals->GetFirstUsedSliceHiGain();
    619   const Byte_t upperedge  = cal.IsHiGainSaturation() ? fSignals->GetLastUsedSliceLoGain()
    620                                                      : fSignals->GetLastUsedSliceHiGain();
    621 
    622   const Float_t lowerlimit = (Float_t)loweredge + fTimeLowerLimit;
    623   const Float_t upperlimit = (Float_t)upperedge + fTimeUpperLimit; 
    624 
    625   if ( cal.GetAbsTimeMean() < lowerlimit)
    626     {
    627       *fLog << warn << GetDescriptor() << ": Mean ArrivalTime in first " << fTimeLowerLimit
    628             << " extraction bin of the Pixel " << cal.GetPixId() << endl;
    629       *fLog << cal.GetAbsTimeMean() << "   " << lowerlimit << endl;
    630       bad.SetUncalibrated( MBadPixelsPix::kMeanTimeInFirstBin );
    631     }
    632  
    633   if ( cal.GetAbsTimeMean() > upperlimit )
    634     {
    635       *fLog << warn << GetDescriptor() << ": Mean ArrivalTime in last " << fTimeUpperLimit
    636             << " two extraction bins of the Pixel " << cal.GetPixId() << endl;
    637       *fLog << cal.GetAbsTimeMean() << "   " << upperlimit << endl;
    638       bad.SetUncalibrated( MBadPixelsPix::kMeanTimeInLast2Bins );
    639     }
    640      
    641587  if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
    642588    return kFALSE;
     
    671617// 3) PINDiode has a fitted charge smaller its fChargeRelErrLimit times its charge error
    672618// 4) PINDiode has a charge sigma smaller than its Pedestal RMS
    673 // 5) The mean arrival time is in fTimeLowerLimit slices from the lower edge
    674 //    and fUpperLimit slices from the upper edge
    675619//
    676620// Calls:
     
    680624{
    681625
    682   if (!fSigPIN)
    683     return kFALSE;
    684  
    685626  if (!fPINDiode)
    686627    return kFALSE; 
     
    709650  if (fPINDiode->GetSigma() < fPINDiode->GetPedRms())
    710651    {
    711       *fLog << warn << GetDescriptor() << ": Sigma of Fitted Charge smaller than Pedestal RMS in PINDiode " << endl;
    712     }
    713       return kFALSE;
    714 
    715   const Byte_t  loweredge  = fSigPIN->GetFirstUsedSlice();
    716   const Byte_t  upperedge  = fSigPIN->GetLastUsedSlice();
    717   const Float_t lowerlimit = (Float_t)loweredge + fTimeLowerLimit;
    718   const Float_t upperlimit = (Float_t)upperedge + fTimeUpperLimit; 
    719 
    720   if (fPINDiode->GetAbsTimeMean() < lowerlimit)
    721     {
    722       *fLog << warn << GetDescriptor() << ": Mean ArrivalTime in first " << fTimeLowerLimit
    723             << " extraction bin in PIN Diode " << endl;
    724       *fLog << fPINDiode->GetAbsTimeMean() << "   " << lowerlimit << endl;
    725       return kFALSE;
    726     }
    727  
    728   if ( fPINDiode->GetAbsTimeMean() > upperlimit )
    729     {
    730       *fLog << warn << GetDescriptor() << ": Mean ArrivalTime in last " << fTimeUpperLimit
    731             << " two extraction bins in PIN Diode " << endl;
    732       *fLog << fPINDiode->GetAbsTimeMean() << "   " << upperlimit << endl;
    733       return kFALSE;
    734     }
     652      *fLog << warn << GetDescriptor()
     653            << ": Sigma of Fitted Charge smaller than Pedestal RMS in PINDiode " << endl;
     654      return kFALSE;
     655    }
     656
    735657
    736658  if (!fPINDiode->CalcFluxOutsidePlexiglass())
     
    760682{
    761683
    762   if (!fSigBlind)
    763     return kFALSE;
    764  
    765684  if (!fBlindPixel)
    766685    return kFALSE; 
     
    13401259                    "Pixels with Low Gain Saturation:                  ");
    13411260  PrintUncalibrated(MBadPixelsPix::kMeanTimeInFirstBin,
    1342                     Form("%s%2.1f%s","Mean Abs. Arr. Time in First ",fTimeLowerLimit," Bin(s):          "));
     1261                    Form("%s%2.1f%s","Mean Abs. Arr. Time in First ",1," Bin(s):          "));
    13431262  PrintUncalibrated(MBadPixelsPix::kMeanTimeInLast2Bins,
    1344                     Form("%s%2.1f%s","Mean Abs. Arr. Time in Last ",fTimeUpperLimit," Bin(s):           "));
     1263                    Form("%s%2.1f%s","Mean Abs. Arr. Time in Last ",2," Bin(s):           "));
    13451264  PrintUncalibrated(MBadPixelsPix::kHiGainOscillating,   
    13461265                    "Pixels with changing Hi Gain signal over time:    ");
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h

    r3694 r3697  
    4949  static const Float_t fgLambdaErrLimit;       //! Default for fLabmdaErrLimit    (now set to: 0.2)
    5050  static const Float_t fgPheErrLimit;          //! Default for fPheErrLimit       (now set to: 5.)
    51   static const Float_t fgTimeLowerLimit;       //! Default for fTimeLowerLimit    (now set to: 1.)
    52   static const Float_t fgTimeUpperLimit;       //! Default for fTimeUpperLimit    (now set to: 2.)
    5351
    5452  // Variables
     
    5654  Float_t fChargeErrLimit;                     // Limit acceptance charge error (in abs. numbers)
    5755  Float_t fChargeRelErrLimit;                  // Limit acceptance rel. error mean (in abs. numbers)
    58   Int_t   fFlags;                              // Bit-field for the flags
     56  Byte_t  fFlags;                              // Bit-field for the flags
    5957  Float_t fLambdaCheckLimit;                   // Limit rel. diff. lambda and lambdacheck in Blind Pixel
    6058  Float_t fLambdaErrLimit;                     // Limit acceptance lambda error in Blind Pixel
     
    6462  Float_t fSqrtHiGainSamples;                  // Square root nr. High-Gain FADC slices used by extractor
    6563  Float_t fSqrtLoGainSamples;                  // Square root nr. Low -Gain FADC slices used by extractor
    66   Float_t fTimeLowerLimit;                     // Limit dist. to first signal slice (in units of FADC slices)
    67   Float_t fTimeUpperLimit;                     // Limit dist. to last signal slice  (in units of FADC slices)
    6864  MCalibrationCam::PulserColor_t fPulserColor; // Calibration LEDs colour
    6965
     
    7470  MCalibrationChargePINDiode *fPINDiode;       //  Calibrated Charges of the PIN Diode
    7571  MCalibrationQECam          *fQECam;          //  Calibrated Quantum Efficiencies of all pixels
    76   MExtractedSignalCam        *fSignals;        //! Extracted signal of all pixels
    77   MExtractedSignalBlindPixel *fSigBlind;       //! Extracted signal of Blind Pixel
    78   MExtractedSignalPINDiode   *fSigPIN;         //! Extracted signal of PIN Diode
    7972  MGeomCam                   *fGeom;           //! Camera geometry
    8073  MPedestalCam               *fPedestals;      //! Pedestals all pixels (calculated previously from ped.file)
     
    119112  void SetPheErrLimit       ( const Float_t f=fgPheErrLimit            ) { fPheErrLimit       = f;   } 
    120113  void SetPulserColor       ( const MCalibrationCam::PulserColor_t col ) { fPulserColor       = col; }
    121   void SetTimeLowerLimit    ( const Float_t f=fgTimeLowerLimit         ) { fTimeLowerLimit    = f;   }
    122   void SetTimeUpperLimit    ( const Float_t f=fgTimeUpperLimit         ) { fTimeUpperLimit    = f;   }
    123114
    124115  void SkipHiLoGainCalibration ( const Bool_t b=kTRUE )
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h

    r3678 r3697  
    1717  TH2D* fOffvsSlope;                 //! Histogram with Higain-vs-LoGain fit result Offsets vs. Slopes
    1818
     19  Byte_t  fFlags;                    // Bit-field to hold the flags
     20
    1921  enum  { kFFactorMethodValid };
    2022
    21   Byte_t  fFlags;                    // Bit-field to hold the flags
    2223 
    2324public:
     
    2728 
    2829  void   Clear ( Option_t *o="" );
    29 
    30   // Setters   
    31   void   SetFFactorMethodValid     ( const Bool_t  b=kTRUE );
     30 
     31  // Draws
     32//  void DrawHiLoFits();
     33  void   DrawPixelContent(Int_t num)   const;   
    3234
    3335  // Getters
    3436  Bool_t GetConversionFactorFFactor( Int_t ipx, Float_t &mean, Float_t &err, Float_t &ffactor );
    35 
     37  Bool_t GetPixelContent           ( Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
    3638  Bool_t IsFFactorMethodValid()      const;
    3739
    3840  // Prints
    39   void Print(Option_t *o="")         const;
    40  
    41   // Draws
    42 //  void DrawHiLoFits();
    43  
    44   // Others
    45   Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
    46   void DrawPixelContent(Int_t num)   const;   
     41  void   Print(Option_t *o="")         const;
     42
     43  // Setters   
     44  void   SetFFactorMethodValid (const Bool_t b=kTRUE );
    4745
    4846  ClassDef(MCalibrationChargeCam, 1) // Container Charge Calibration Results Camera
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc

    r3669 r3697  
    144144const Float_t MHCalibrationChargeCam::fgNumHiGainSaturationLimit = 0.01;
    145145const Float_t MHCalibrationChargeCam::fgNumLoGainSaturationLimit = 0.005;
     146const Float_t MHCalibrationChargeCam::fgTimeLowerLimit           = 1.;
     147const Float_t MHCalibrationChargeCam::fgTimeUpperLimit           = 2.;
    146148// --------------------------------------------------------------------------
    147149//
     
    154156// - fNumHiGainSaturationLimit to fgNumHiGainSaturationLimit
    155157// - fNumLoGainSaturationLimit to fgNumLoGainSaturationLimit
     158// - fTimeLowerLimit           to fgTimeLowerLimit
     159// - fTimeUpperLimit           to fgTimeUpperLimit
    156160//
    157161MHCalibrationChargeCam::MHCalibrationChargeCam(const char *name, const char *title)
    158     : fRawEvt(NULL)
    159 {
    160     fName  = name  ? name  : "MHCalibrationChargeCam";
    161     fTitle = title ? title : "Class to fill the calibration histograms ";
    162 
    163     SetNumHiGainSaturationLimit();
    164     SetNumLoGainSaturationLimit();
     162    : fRawEvt(NULL), fSig(NULL)
     163{
     164  fName  = name  ? name  : "MHCalibrationChargeCam";
     165  fTitle = title ? title : "Class to fill the calibration histograms ";
     166 
     167  SetNumHiGainSaturationLimit();
     168  SetNumLoGainSaturationLimit();
     169  SetTimeLowerLimit();
     170  SetTimeUpperLimit();
    165171}
    166172
     
    169175// Gets the pointers to:
    170176// - MRawEvtData
     177// - MExtractedSignalCam
    171178//
    172179Bool_t MHCalibrationChargeCam::SetupHists(const MParList *pList)
     
    180187  }
    181188
     189  MExtractedSignalCam *fSig = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam");
     190  if (!fSig)
     191  {
     192      *fLog << err << "MExtractedSignalCam not found... abort." << endl;
     193      return kFALSE;
     194  }
     195
    182196  return kTRUE;
    183197}
     
    187201// Gets or creates the pointers to:
    188202// - MCalibrationChargeCam
    189 //
    190 // Searches pointer to:
    191 // - MExtractedSignalCam
     203// - MBadPixelsCam
     204//
     205// Initializes the number of used FADC slices from MExtractedSignalCam
     206// into MCalibrationChargeCam and test for changes in that variable
    192207//
    193208// Initializes, if empty to MGeomCam::GetNumPixels():
     
    229244    }
    230245
    231   MExtractedSignalCam *signal = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam");
    232   if (!signal)
    233   {
    234       *fLog << err << "MExtractedSignalCam not found... abort." << endl;
     246  const Float_t numhigain = fSig->GetNumUsedHiGainFADCSlices();
     247  const Float_t numlogain = fSig->GetNumUsedLoGainFADCSlices(); 
     248
     249  if (fCam->GetNumHiGainFADCSlices() == 0.)
     250    fCam->SetNumHiGainFADCSlices ( numhigain );
     251  else if (fCam->GetNumHiGainFADCSlices() != numhigain)
     252    {
     253      *fLog << err << GetDescriptor()
     254            << ": Number of High Gain FADC extraction slices has changes, abort..." << endl;
    235255      return kFALSE;
    236   }
     256    }
     257 
     258  if (fCam->GetNumLoGainFADCSlices() == 0.)
     259    fCam->SetNumLoGainFADCSlices ( numlogain );
     260  else if (fCam->GetNumLoGainFADCSlices() != numlogain)
     261    {
     262      *fLog << err << GetDescriptor()
     263            << ": Number of Low Gain FADC extraction slices has changes, abort..." << endl;
     264      return kFALSE;
     265    }
    237266
    238267  const Int_t npixels  = fGeom->GetNumPixels();
     
    532561{
    533562
     563  const Byte_t firsthi = fSig->GetFirstUsedSliceHiGain();
     564  const Byte_t lasthi  = fSig->GetLastUsedSliceHiGain();
     565  const Byte_t firstlo = fSig->GetFirstUsedSliceLoGain();
     566  const Byte_t lastlo  = fSig->GetLastUsedSliceLoGain();
     567
     568
    534569  for (Int_t i=0; i<fHiGainArray->GetSize(); i++)
    535570    {
     
    537572      MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)(*this)[i];
    538573      MCalibrationChargePix  &pix    = (MCalibrationChargePix&)(*fCam)[i];
     574      MBadPixelsPix          &bad    = (*fBadPixels)[i];
    539575     
    540576      if (histhi.IsExcluded())
     
    548584        }
    549585
    550       pix.SetAbsTimeMean ( histhi.GetAbsTimeMean());
    551       pix.SetAbsTimeRms  ( histhi.GetAbsTimeRms() );
     586      FinalizeAbsTimes(histhi, pix, bad, firsthi, lasthi);
    552587    }
    553588
     
    572607     
    573608      if (pix.IsHiGainSaturation())
    574         {
    575           pix.SetAbsTimeMean     ( histlo.GetAbsTimeMean());
    576           pix.SetAbsTimeRms      ( histlo.GetAbsTimeRms() );
    577         }           
     609        FinalizeAbsTimes(histlo, pix, bad, firstlo, lastlo);
    578610    }
    579611
     
    583615      MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)GetAverageHiGainArea(j);     
    584616      MCalibrationChargePix  &pix    = (MCalibrationChargePix&)fCam->GetAverageArea(j);
     617      MBadPixelsPix          &bad    = fCam->GetAverageBadArea(j);
    585618     
    586619      if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
     
    591624        }
    592625
    593       pix.SetAbsTimeMean ( histhi.GetAbsTimeMean());
    594       pix.SetAbsTimeRms  ( histhi.GetAbsTimeRms() );
    595     }
     626      FinalizeAbsTimes(histhi, pix, bad, firsthi, lasthi);
     627   }
    596628 
    597629  for (Int_t j=0; j<fAverageLoGainAreas->GetSize(); j++)
     
    600632      MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)GetAverageLoGainArea(j);     
    601633      MCalibrationChargePix  &pix    = (MCalibrationChargePix&)fCam->GetAverageArea(j);
    602      
     634      MBadPixelsPix          &bad    = fCam->GetAverageBadArea(j);     
     635
    603636      if (histlo.GetSaturated() > fNumLoGainSaturationLimit*histlo.GetHGausHist()->GetEntries())
    604637        {
     
    609642
    610643      if (pix.IsHiGainSaturation())
    611         {
    612           pix.SetAbsTimeMean  ( histlo.GetAbsTimeMean());
    613           pix.SetAbsTimeRms   ( histlo.GetAbsTimeRms() );
    614         }           
     644        FinalizeAbsTimes(histlo, pix, bad, firstlo, lastlo);
    615645    }
    616646
     
    620650      MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)GetAverageHiGainSector(j);     
    621651      MCalibrationChargePix  &pix    = (MCalibrationChargePix&)fCam->GetAverageSector(j);
    622      
     652      MBadPixelsPix          &bad    = fCam->GetAverageBadSector(j);     
     653
    623654      if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
    624655        {
     
    628659        }
    629660
    630       pix.SetAbsTimeMean ( histhi.GetAbsTimeMean());
    631       pix.SetAbsTimeRms  ( histhi.GetAbsTimeRms() );
     661      FinalizeAbsTimes(histhi, pix, bad, firsthi, lasthi);
    632662    }
    633663 
     
    648678
    649679      if (pix.IsHiGainSaturation())
    650         {
    651           pix.SetAbsTimeMean  ( histlo.GetAbsTimeMean());
    652           pix.SetAbsTimeRms   ( histlo.GetAbsTimeRms() );
    653         }           
     680        FinalizeAbsTimes(histlo, pix, bad, firstlo, lastlo);
    654681    }
    655682 
     
    670697}
    671698
     699// --------------------------------------------------------------------------------
     700//
     701// Fill the absolute time results into MCalibrationChargePix
     702//
     703// Check absolute time validity:
     704// - Mean arrival time is at least fTimeLowerLimit slices from the lower edge
     705// - Mean arrival time is at least fUpperLimit     slices from the upper edge
     706//
     707void MHCalibrationChargeCam::FinalizeAbsTimes(MHCalibrationChargePix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad,
     708                                              Byte_t first, Byte_t last)
     709{
     710 
     711  const Float_t mean = hist.GetAbsTimeMean();
     712  const Float_t rms  = hist.GetAbsTimeRms();
     713
     714  pix.SetAbsTimeMean ( mean );
     715  pix.SetAbsTimeRms  ( rms  );
     716 
     717  const Float_t lowerlimit = (Float_t)first + fTimeLowerLimit;
     718  const Float_t upperlimit = (Float_t)last  + fTimeUpperLimit; 
     719
     720  if ( mean < lowerlimit)
     721    {
     722      *fLog << warn << GetDescriptor()
     723            << Form("%s%3.1f%s%2i%s%4i",": Mean ArrivalTime: ",mean," smaller than ",fTimeLowerLimit,
     724                    " FADC slices from lower edge in pixel ",hist.GetPixId()) << endl;
     725      bad.SetUncalibrated( MBadPixelsPix::kMeanTimeInFirstBin );
     726    }
     727 
     728  if ( mean  > upperlimit )
     729    {
     730      *fLog << warn << GetDescriptor()
     731            << Form("%s%3.1f%s%2i%s%4i",": Mean ArrivalTime: ",mean," greater than ",fTimeUpperLimit,
     732                    " FADC slices from upper edge in pixel ",hist.GetPixId()) << endl;
     733      bad.SetUncalibrated( MBadPixelsPix::kMeanTimeInLast2Bins );
     734    }
     735}
     736
    672737// --------------------------------------------------------------------------
    673738//
Note: See TracChangeset for help on using the changeset viewer.