Changeset 3292


Ignore:
Timestamp:
02/25/04 06:31:32 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3291 r3292  
    2020
    2121 2004/02/24: Markus Gaug
     22
     23   * mcalib/MHCalibrationChargeBlindPix.[h,cc]
     24
     25   - receives a pointer to MCalibrationChargePINDiode which is filled
     26     with the results and told to calculate the fluxes in the
     27     Finalize function
     28   - is filled via MFillH from MExtractBlindPixel
     29
     30   * mcalib/MCalibrationChargeBlindPix.[h,cc]
     31    - new storage container of the blind pxiel resutls, replaces
     32      MCalibrationBlindPix
     33
     34   * mcalib/MCalibrationChargeCalc.[h,cc]
     35
     36     - does not fill the histograms any more, but does ony the
     37       calculations in the postprocess. No pointer to MExtractPINDidoe
     38       or MExtractBlindPixel any more.
    2239
    2340   * mcalib/MCalibrationChargePix.cc
  • trunk/MagicSoft/Mars/mcalib/CalibLinkDef.h

    r3284 r3292  
    99
    1010#pragma link C++ class MCalibrationChargePix+;
    11 #pragma link C++ class MCalibrationBlindPix+;
     11#pragma link C++ class MCalibrationChargeBlindPix+;
    1212#pragma link C++ class MCalibrationChargeCam+;
    1313#pragma link C++ class MCalibrationChargeCalc+;
    1414#pragma link C++ class MCalibrationChargePINDiode+;
    1515
    16 #pragma link C++ class MHCalibrationBlindPixel+;
     16#pragma link C++ class MHCalibrationChargeBlindPix+;
     17#pragma link C++ class MHCalibrationChargeBlindPix+;
    1718#pragma link C++ class MHCalibrationChargePix+;
    1819#pragma link C++ class MHCalibrationChargeCam+;
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc

    r3264 r3292  
    9696
    9797#include "MCalibrationChargeCam.h"
     98#include "MCalibrationChargePix.h"
    9899#include "MCalibrationChargePINDiode.h"
    99 #include "MCalibrationChargePix.h"
     100#include "MCalibrationChargeBlindPix.h"
    100101
    101102#include "MExtractedSignalCam.h"
    102103#include "MExtractedSignalPix.h"
    103 #include "MExtractedSignalBlindPixel.h"
    104 
    105 #include "MCalibrationBlindPix.h"
     104
    106105
    107106ClassImp(MCalibrationChargeCalc);
    108107
    109108using namespace std;
    110 
    111 const UInt_t MCalibrationChargeCalc::fgBlindPixelIdx   = 559;
    112 const UInt_t MCalibrationChargeCalc::fgPINDiodeIdx     = 9999;
    113 const UInt_t MCalibrationChargeCalc::fgBlindPixelSinglePheCut = 400;
    114109
    115110// --------------------------------------------------------------------------
     
    120115    : fPedestals(NULL), fCam(NULL),
    121116      fRawEvt(NULL), fRunHeader(NULL), fEvtTime(NULL),
    122       fSignals(NULL), fBlindPixel(NULL), fPINDiode(NULL)
     117      fSignals(NULL), fPINDiode(NULL), fBlindPixel(NULL)
    123118{
    124119
     
    132127
    133128    Clear();
    134     SetBlindPixelIdx();
    135     SetPINDiodeIdx();
    136129}
    137130
     
    139132{
    140133 
    141     SETBIT(fFlags, kUseBlindPixelFit);
    142134    SETBIT(fFlags, kUseQualityChecks);
    143135    SETBIT(fFlags, kHiLoGainCalibration);
    144 
    145     fNumBlindPixelSinglePhe = 0;
    146     fNumBlindPixelPedestal  = 0; 
    147136
    148137    fNumHiGainSamples  = 0;
     
    163152// they were not found:
    164153//
    165 //  - MHCalibrationBlindPixel
    166154//  - MCalibrationCam
    167155//
     
    205193    fCam->SetPINDiode(fPINDiode);
    206194
     195    fBlindPixel = (MCalibrationChargeBlindPix*)pList->FindCreateObj("MCalibrationChargeBlindPix");
     196    if (!fBlindPixel)
     197      {
     198        *fLog << err << dbginf << "MCalibrationChargeBlindPix could not be created ... aborting." << endl;       
     199        return kFALSE;
     200      }
     201
     202    fCam->SetBlindPixel(fBlindPixel);
     203
    207204    fEvtTime      = (MTime*)pList->FindObject("MTime");
    208205
     
    222219      }
    223220
    224     fBlindPixel = (MExtractedSignalBlindPixel*)pList->FindObject("MExtractedSignalBlindPixel");
    225     if (!fBlindPixel)
    226       {
    227         *fLog << err << dbginf << "Cannot find MExtractedSignalBlindPixel ... aborting" << endl;
    228         return kFALSE;
    229       }
    230    
    231221    return kTRUE;
    232222}
     
    275265                                    fSignals->GetLastUsedSliceLoGain());
    276266       
    277 
    278         // Exclude the blind pixel and the PIN Diode from normal pixel calibration:
    279         if (i == fBlindPixelIdx)
    280           pix.SetExcluded();
    281 
    282         if (i == fPINDiodeIdx)
    283           pix.SetExcluded();
    284 
    285267     }
    286268   
     
    354336Int_t MCalibrationChargeCalc::Process()
    355337{
    356 
    357  
    358   MRawEvtPixelIter pixel(fRawEvt);
    359  
    360   //
    361   // Create a loop to fill the calibration histograms
    362   // Search for: a signal in MExtractedSignalCam
    363   // Search for: a signal in MExtractedSignalBlindPixel
    364   // Fill histograms with:
    365   //             charge
    366   //             charge vs. event nr.
    367   //
    368   //
    369   // Initialize pointers to blind pixel and individual pixels
    370   //
    371   // FIXME: filling the bind pixel histograms in this class is preliminary
    372   //        and will be replaced soon to fill them with MFillH
    373   //
    374   MCalibrationBlindPix       &blindpixel = *(fCam->GetBlindPixel());
    375   MExtractedSignalBlindPixel &blindsig   = (*fBlindPixel);
    376 
    377   const UInt_t signal = blindsig.GetExtractedSignal();
    378  
    379   if (!blindpixel.FillCharge(signal))
    380     *fLog << warn <<
    381       "Overflow or Underflow occurred filling Blind Pixel sum = " << signal << endl;
    382 
    383   blindpixel.FillGraphs(signal,0);
    384  
    385   TH1I *hist;
    386  
    387   if (signal > fBlindPixelSinglePheCut)
    388     {
    389       hist = (blindpixel.GetHist())->GetHSinglePheFADCSlices();
    390       fNumBlindPixelSinglePhe++;
    391     }
    392   else
    393     {
    394       hist = (blindpixel.GetHist())->GetHPedestalFADCSlices();
    395       fNumBlindPixelPedestal++;
    396     }
    397 
    398   pixel.Jump(fBlindPixelIdx);
    399  
    400   const Byte_t *ptr = pixel.GetHiGainSamples();
    401 
    402   for (Int_t i=1;i<16;i++)
    403     hist->Fill(i,*ptr++);
    404  
    405   ptr = pixel.GetLoGainSamples();
    406   for (Int_t i=16;i<31;i++)
    407     hist->Fill(i,*ptr++);
    408 
    409338  return kTRUE;
    410339}
     
    412341Int_t MCalibrationChargeCalc::PostProcess()
    413342{
    414   *fLog << inf << GetDescriptor() << ": Cut Histogram Edges" << endl;
    415 
    416   //
    417   // Fit the blind pixel
    418   //
    419   if (TESTBIT(fFlags,kUseBlindPixelFit))
    420   {
    421       //
    422       // Get pointer to blind pixel
    423       //
    424       MCalibrationBlindPix &blindpixel = *(fCam->GetBlindPixel());
    425      
    426       *fLog << inf << GetDescriptor() << ": Fitting the Blind Pixel" << endl;
    427 
    428       //
    429       // retrieve the histogram containers
    430       //
    431       MHCalibrationBlindPixel *hist = blindpixel.GetHist();
    432          
    433       //
    434       // retrieve mean and sigma of the blind pixel pedestal,
    435       // so that we can use it for the fit
    436       //
    437       // FIXME: This part has to be migrated into the future MHCalibrationChargeBlindPix class
    438       //
    439       const UInt_t nentries    = fPedestals->GetTotalEntries();
    440       const UInt_t nslices     = 12;
    441       const Float_t sqrslice   = TMath::Sqrt((Float_t)nslices);
    442 
    443       MPedestalPix &pedpix  = (*fPedestals)[fBlindPixelIdx];
    444       if (&pedpix)
    445         {
    446           const Float_t pedestal    = pedpix.GetPedestal()*nslices;
    447           const Float_t pederr      = pedpix.GetPedestalRms()*nslices/nentries;
    448           const Float_t pedsigma    = pedpix.GetPedestalRms()*sqrslice;
    449           const Float_t pedsigmaerr = pederr/2.;
    450          
    451           hist->SetMeanPedestal(pedestal);
    452           hist->SetMeanPedestalErr(pederr);
    453           hist->SetSigmaPedestal(pedsigma);
    454           hist->SetSigmaPedestalErr(pedsigmaerr);
    455         }
    456      
    457       if (!blindpixel.FitCharge())
    458         {
    459           *fLog << warn << "Could not fit the blind pixel! " << endl;
    460           *fLog << warn << "Setting bit kBlindPixelMethodValid to FALSE in MCalibrationCam" << endl;
    461           fCam->SetBlindPixelMethodValid(kFALSE);
    462         }
    463       else
    464         fCam->SetBlindPixelMethodValid(kTRUE);
    465      
    466       if (blindpixel.CheckOscillations())
    467         fCam->SetBlindPixelMethodValid(kFALSE);
    468 
    469       TH1I *sphehist = hist->GetHSinglePheFADCSlices();
    470       TH1I *pedhist  = hist->GetHPedestalFADCSlices();
    471 
    472       if (fNumBlindPixelSinglePhe > 1)
    473         sphehist->Scale(1./fNumBlindPixelSinglePhe);
    474       if (fNumBlindPixelPedestal > 1)
    475         pedhist->Scale(1./fNumBlindPixelPedestal);
    476      
    477       blindpixel.DrawClone();
    478   }
    479   else
    480       *fLog << inf << GetDescriptor() << ": Skipping Blind Pixel Fit " << endl;
    481 
    482   *fLog << inf << "total: " << GetNumExecutions() << " sphe: " << fNumBlindPixelSinglePhe << " ped: " << fNumBlindPixelPedestal << endl;
    483 
    484  
    485   *fLog << inf << GetDescriptor() << ": Fitting the Normal Pixels" << endl;
    486343
    487344  //
    488345  // loop over the pedestal events and check if we have calibration
    489346  //
     347  Int_t nvalid = 0;
    490348  for (Int_t pixid=0; pixid<fPedestals->GetSize(); pixid++)
    491349    {
     
    504362      const Float_t ped    = (*fPedestals)[pixid].GetPedestal();
    505363      const Float_t prms   = (*fPedestals)[pixid].GetPedestalRms();
    506       const Int_t   num    = fPedestals->GetTotalEntries();
     364      const Float_t num    = TMath::Sqrt((Float_t)fPedestals->GetTotalEntries());
    507365
    508366      //
     
    511369      if (pix.IsHiGainSaturation())
    512370      {
    513           pix.SetPedestal(ped  * (Float_t)fNumLoGainSamples,
     371          pix.SetPedestal(ped  * fNumLoGainSamples,
    514372                          prms * TMath::Sqrt((Float_t)fNumLoGainSamples),
    515                           prms * (Float_t)fNumLoGainSamples / num);
     373                          prms * fNumLoGainSamples / num);
    516374          pix.SetNumLoGainSamples((Float_t)fNumLoGainSamples);
    517375          pix.ApplyLoGainConversion();
     
    519377      else
    520378      {
    521           pix.SetPedestal(ped  * (Float_t)fNumHiGainSamples,
     379          pix.SetPedestal(ped  * fNumHiGainSamples,
    522380                          prms * TMath::Sqrt((Float_t)fNumHiGainSamples),
    523                           prms * (Float_t)fNumHiGainSamples / num);
     381                          prms * fNumHiGainSamples / num);
    524382      }
    525383
     
    527385          continue;
    528386
     387      nvalid++;
     388
    529389      if (!pix.CalcReducedSigma())
    530390          continue;
     
    534394    }
    535395
    536   if (TESTBIT(fFlags,kUseBlindPixelFit) && fCam->IsBlindPixelMethodValid())
     396  //
     397  // The Michele check ...
     398  //
     399  if (nvalid == 0)
    537400  {
    538       if (!fCam->CalcFluxInsidePlexiglass())
    539       {
    540           *fLog << warn << "Could not calculate the number of photons from the blind pixel " << endl;
    541           *fLog << "You can try to calibrate using the MCalibrationChargeCalc::SkipBlindPixelFit()" << endl;
    542         fCam->SetBlindPixelMethodValid(kFALSE);         
    543       }
     401      *fLog << err << GetDescriptor() << ": Dear Michele! All pixels have non-valid calibration. "
     402            << "Did you forget to fill the histograms (filling MHCalibrationChargeCam from MExtractedSignalCam using MFillH) ? " << endl;
     403      return kFALSE;
     404  }
     405
     406  if (!fBlindPixel->CheckChargeFitValidity())
     407  {
     408      *fLog << warn << "Could not calculate the flux of photons from the PIN Diode, charge fit not valid " << endl;
     409      fCam->SetBlindPixelMethodValid(kFALSE);
    544410  }
    545411  else
    546     *fLog << inf << GetDescriptor() << ": Skipping Blind Pixel Calibration! " << endl;
     412  {
     413      if (!fBlindPixel->CalcFluxInsidePlexiglass())
     414      {
     415          *fLog << warn << "Could not calculate the flux of photons from the PIN Diode, will skip PIN Diode Calibration " << endl;
     416          fCam->SetBlindPixelMethodValid(kFALSE);
     417      }
     418      else
     419      {
     420          fCam->SetBlindPixelMethodValid(kTRUE);
     421          fCam->ApplyBlindPixelCalibration();
     422      }
     423  }
    547424
    548425  if (!fPINDiode->CheckChargeFitValidity() || !fPINDiode->CheckTimeFitValidity())
     
    561438      {
    562439          fCam->SetPINDiodeMethodValid(kTRUE);
     440          fCam->ApplyPINDiodeCalibration();
    563441      }
    564442  }
     
    571449
    572450
     451
     452
     453
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h

    r3264 r3292  
    2121class MPedestalCam;
    2222class MCalibrationChargePINDiode;
     23class MCalibrationChargeBlindPix;
    2324class MCalibrationChargeCam;
    2425class MGeomCam;
    2526class MExtractedSignalCam;
    26 class MExtractedSignalBlindPixel;
    2727class MTime;
    2828class MCalibrationChargeCalc : public MTask
     
    3131private:
    3232
    33   static const UInt_t fgBlindPixelIdx;                    // ID of the blind pixel
    34   static const UInt_t fgPINDiodeIdx;                      // ID of the PIN Diode
    35   static const UInt_t fgBlindPixelSinglePheCut;           // FADC sum from which on an event is considered as a S.ph. one.
    36  
    3733  MPedestalCam               *fPedestals;                 //! Pedestals of all pixels in the camera
    3834  MCalibrationChargeCam      *fCam;                       // Calibration events of all pixels in the camera
     
    4339
    4440  MExtractedSignalCam        *fSignals;                   // Extracted signal of all pixels in the camera
    45   MExtractedSignalBlindPixel *fBlindPixel;                // Extracted signal of the blind pixel 
    46   MCalibrationChargePINDiode *fPINDiode;                  // Calibration events of all pixels in the camera
     41  MCalibrationChargePINDiode *fPINDiode;                  // Calibration results of the PIN Diode
     42  MCalibrationChargeBlindPix *fBlindPixel;                // Calibration results of the Blind Pixel
    4743
    48 
    49   UInt_t  fBlindPixelIdx; 
    50   UInt_t  fPINDiodeIdx;     
    5144 
    5245  Byte_t  fNumHiGainSamples;
    5346  Byte_t  fNumLoGainSamples;
    5447  Float_t fSqrtHiGainSamples;
    55  
    56   UInt_t  fBlindPixelSinglePheCut;
    57 
    58   Int_t   fNumBlindPixelSinglePhe;
    59   Int_t   fNumBlindPixelPedestal; 
    6048 
    6149  Float_t fConversionHiLo;
     
    6553  UInt_t  fNumExcludedPixels;
    6654
    67   enum  { kUseBlindPixelFit,
    68           kUseQualityChecks,
     55  enum  { kUseQualityChecks,
    6956          kHiLoGainCalibration };
    7057 
     
    8067  void Clear(const Option_t *o="");
    8168 
    82   void SkipBlindPixelFit(Bool_t b=kTRUE)
    83       {b ? CLRBIT(fFlags, kUseBlindPixelFit)    : SETBIT(fFlags, kUseBlindPixelFit);}
    8469  void SkipQualityChecks(Bool_t b=kTRUE)
    8570      {b ? CLRBIT(fFlags, kUseQualityChecks)    : SETBIT(fFlags, kUseQualityChecks);}
     
    8772      {b ? CLRBIT(fFlags, kHiLoGainCalibration) : SETBIT(fFlags, kHiLoGainCalibration);}
    8873
    89 
    90   // Setters
    91   void SetBlindPixelSinglePheCut ( const Int_t         cut=fgBlindPixelSinglePheCut)   
    92                                                                     { fBlindPixelSinglePheCut = cut; }
    93 
    94   void SetPINDiodeIdx(   const UInt_t idx=fgPINDiodeIdx   ) {   fPINDiodeIdx   = idx; }
    95   void SetBlindPixelIdx( const UInt_t idx=fgBlindPixelIdx ) {   fBlindPixelIdx = idx; }
    9674
    9775  // Exclude pixels from configuration file
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc

    r3264 r3292  
    3737//
    3838// The calculated values (types of GetPixelContent) are:
     39//
     40// --------------------------------------------------------------------------
     41//
     42// The types are as follows:
    3943//
    4044// Fitted values:
     
    8286// 27: Excluded Pixels
    8387// 28: Pixels where the fit did not succeed --> results obtained only from the histograms
    84 // 29: Pixels with succeeded fit, but apparently wrong results
    85 // 30: Pixels with un-expected behavior in the fourier spectrum (e.g. oscillations)
     88// 29: Pixels with apparently wrong results
     89// 30: Pixels with un-expected behavior in the Hi Gain fourier spectrum (e.g. oscillations)
     90// 31: Pixels with un-expected behavior in the Lo Gain fourier spectrum (e.g. oscillations)a
     91// 32: Number of probable pickup events in the Hi Gain
     92// 33: Number of probable pickup events in the Lo Gain
    8693//
    8794// Other classifications of pixels:
    8895// ================================
    8996//
    90 // 31: Pixels with saturated Hi-Gain
     97// 34: Pixels with saturated Hi-Gain
    9198//
    9299// Classification of validity of the calibrations:
    93100// ===============================================
    94101//
    95 // 32: Pixels with valid calibration by the F-Factor-Method
    96 // 33: Pixels with valid calibration by the Blind Pixel-Method
    97 // 34: Pixels with valid calibration by the PIN Diode-Method
     102// 35: Pixels with valid calibration by the F-Factor-Method
     103// 36: Pixels with valid calibration by the Blind Pixel-Method
     104// 37: Pixels with valid calibration by the PIN Diode-Method
    98105//
    99106// Used Pedestals:
    100107// ===============
    101108//
    102 // 35: Mean Pedestal over the entire range of signal extraction
    103 // 36: Error on the Mean Pedestal over the entire range of signal extraction
    104 // 37: Pedestal RMS over the entire range of signal extraction
    105 // 38: Error on the Pedestal RMS over the entire range of signal extraction
     109// 38: Mean Pedestal over the entire range of signal extraction
     110// 39: Error on the Mean Pedestal over the entire range of signal extraction
     111// 40: Pedestal RMS over the entire range of signal extraction
     112// 41: Error on the Pedestal RMS over the entire range of signal extraction
    106113//
    107114// Calculated absolute arrival times (very low precision!):
    108115// ========================================================
    109116//
    110 // 39: Absolute Arrival time of the signal
    111 // 40: Error on the Absolute Arrival time of the signal
    112 // 41: RMS of the Absolute Arrival time of the signal
    113 // 42: Error on the RMS of the Absolute Arrival time of the signal
     117// 42: Absolute Arrival time of the signal
     118// 43: RMS of the Absolute Arrival time of the signal
    114119//
    115120/////////////////////////////////////////////////////////////////////////////
     
    127132
    128133#include "MCalibrationChargePix.h"
    129 #include "MCalibrationBlindPix.h"
     134#include "MCalibrationChargeBlindPix.h"
    130135#include "MCalibrationChargePINDiode.h"
    131136
     
    137142const Int_t   MCalibrationChargeCam::gkBlindPixelId   =  559;
    138143const Int_t   MCalibrationChargeCam::gkPINDiodeId     = 9999;
    139 const Float_t MCalibrationChargeCam::gkBlindPixelArea = 100;
    140 // Average QE of Blind Pixel (three colours)
    141 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelQEGreen = 0.154;
    142 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelQEBlue  = 0.226;
    143 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelQEUV    = 0.247;
    144 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelQECT1   = 0.247;
    145 // Average QE Error of Blind Pixel (three colours)
    146 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelQEGreenErr = 0.015;
    147 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelQEBlueErr  = 0.02;
    148 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelQEUVErr    = 0.02;
    149 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelQECT1Err   = 0.02;
    150 // Attenuation factor Blind Pixel (three colours)
    151 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelAttGreen = 1.97;
    152 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelAttBlue  = 1.96;
    153 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelAttUV    = 1.95;
    154 const Float_t MCalibrationChargeCam::gkCalibrationBlindPixelAttCT1   = 1.95;
    155144
    156145// --------------------------------------------------------------------------
     
    174163
    175164    fPixels     = new TClonesArray("MCalibrationChargePix",1);
    176     fBlindPixel = new MCalibrationBlindPix();
    177165
    178166    Clear();
     
    193181  //
    194182  delete fPixels;
    195   delete fBlindPixel;
    196183
    197184  if (fOffsets)
     
    272259
    273260  fPixels->ForEach(TObject, Clear)();
    274   fBlindPixel->Clear();
    275 
    276   fMeanFluxInsidePlexiglass          = -1.;
    277   fMeanFluxErrInsidePlexiglass       = -1.;
    278261
    279262  fNumExcludedPixels                 = 0;
     
    281264  CLRBIT(fFlags,kBlindPixelMethodValid);
    282265  CLRBIT(fFlags,kPINDiodeMethodValid);
    283   CLRBIT(fFlags,kFluxInsidePlexiglassAvailable);
    284266
    285267  return;
     
    304286{
    305287  return TESTBIT(fFlags,kPINDiodeMethodValid); 
    306 }
    307 
    308 
    309 Bool_t  MCalibrationChargeCam::IsFluxInsidePlexiglassAvailable()   const
    310 {
    311   return TESTBIT(fFlags,kFluxInsidePlexiglassAvailable);
    312288}
    313289
     
    335311        {
    336312
    337           *fLog << all << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- "
    338                 << pix->GetPedRms() << " Reduced Charge: " << pix->GetMeanCharge() << " +- "
    339                 << pix->GetSigmaCharge() << " Reduced Sigma: " << pix->GetRSigmaCharge()
    340                 << " Nr Phe's: " << pix->GetPheFFactorMethod() << endl;
     313            *fLog << all << "Pix " << pix->GetPixId()
     314                << ":  Ped.  Rms: "            << pix->GetPedRms()        << " +- " << pix->GetPedRmsErr()
     315                << "   Mean signal: "          << pix->GetMeanCharge()    << " +- " << pix->GetSigmaCharge()
     316                << "   Reduced Sigma: "        << pix->GetRSigmaCharge()
     317                << "   Nr Phe's: "             << pix->GetPheFFactorMethod()
     318                << endl;
    341319          id++;
    342320        }
     
    357335          {
    358336
    359             *fLog << all << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- "
    360                   << pix->GetPedRms() << " Reduced Charge: " <<  pix->GetMeanCharge() << " +- "
    361                   << pix->GetSigmaCharge() << " Reduced Sigma: " << pix->GetRSigmaCharge() << endl;
     337
     338            *fLog << all << "Pix " << pix->GetPixId()
     339                << ":  Ped.  Rms: "            << pix->GetPedRms()        << " +- " << pix->GetPedRmsErr()
     340                << "   Mean signal: "          << pix->GetMeanCharge()    << " +- " << pix->GetSigmaCharge()
     341                << "   Reduced Sigma: "        << pix->GetRSigmaCharge()
     342                << "   Nr Phe's: "             << pix->GetPheFFactorMethod()
     343                << endl;
    362344            id++;
    363345          }
     
    377359      if ( pix->IsOscillating()  && !pix->IsExcluded())
    378360        {
    379          
    380           *fLog << all << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- "
    381                 << pix->GetPedRms() << " Reduced Charge: " << pix->GetMeanCharge() << " +- "
    382                 << pix->GetSigmaCharge() << " Reduced Sigma: " << pix->GetRSigmaCharge() << endl;
    383           id++;
     361
     362            *fLog << all << "Pix " << pix->GetPixId()
     363                << ":  Ped.  Rms: "            << pix->GetPedRms()        << " +- " << pix->GetPedRmsErr()
     364                << "   Mean signal: "          << pix->GetMeanCharge()    << " +- " << pix->GetSigmaCharge()
     365                << "   Reduced Sigma: "        << pix->GetRSigmaCharge()
     366                << "   Nr Phe's: "             << pix->GetPheFFactorMethod()
     367                << endl;
     368            id++;
    384369        }
    385370    }
     
    406391
    407392
    408 // --------------------------------------------------------------------------
    409 //
    410 // Sets the user ranges of all histograms such that
    411 // empty bins at the edges are not used. Additionally, it rebins the
    412 // histograms such that in total, 50 bins are used.
    413 //
    414 void MCalibrationChargeCam::CutEdges()
    415 {
    416 
    417   fBlindPixel->GetHist()->CutAllEdges();
    418 
    419   return;
    420 }
    421  
    422393// --------------------------------------------------------------------------
    423394//
     
    468439// 27: Excluded Pixels
    469440// 28: Pixels where the fit did not succeed --> results obtained only from the histograms
    470 // 29: Pixels with succeeded fit, but apparently wrong results
     441// 29: Pixels with apparently wrong results
    471442// 30: Pixels with un-expected behavior in the Hi Gain fourier spectrum (e.g. oscillations)
    472443// 31: Pixels with un-expected behavior in the Lo Gain fourier spectrum (e.g. oscillations)a
     
    600571      if ((*this)[idx].IsExcluded())
    601572        return kFALSE;
    602       val = GetMeanFluxInsidePlexiglass()*area;
     573      val = fBlindPixel->GetMeanFluxInsidePlexiglass()*area;
    603574      break;
    604575    case 16:
    605576      if ((*this)[idx].IsExcluded())
    606577        return kFALSE;
    607       val = GetMeanFluxInsidePlexiglass()*area;
     578      val = fBlindPixel->GetMeanFluxErrInsidePlexiglass()*area;
    608579      break;
    609580    case 17:
     
    635606      if ((*this)[idx].IsExcluded())
    636607        return kFALSE;
    637       val = fPINDiode->GetMeanFluxOutsidePlexiglass()*area;
     608      val = fPINDiode->GetMeanFluxErrOutsidePlexiglass()*area;
    638609      break;
    639610    case 23:
     
    673644    case 29:
    674645      if ((*this)[idx].IsExcluded())
    675         return kFALSE;
    676       if (!(*this)[idx].IsFitted())
    677646        return kFALSE;
    678647      if (!(*this)[idx].IsChargeValid())
     
    784753}
    785754
    786 
    787 // --------------------------------------------------------------------------
    788 //
    789 //
    790 //
    791 Bool_t MCalibrationChargeCam::CalcFluxInsidePlexiglass()
    792 {
    793 
    794   if (!fBlindPixel->IsFitOK())
    795     return kFALSE;
    796  
    797   const Float_t mean = fBlindPixel->GetLambda();
    798   const Float_t merr = fBlindPixel->GetErrLambda();
    799 
    800   //
    801   // Start calculation of number of photons
    802   //
    803   // The blind pixel has exactly 100 mm^2 area (with negligible error),
    804   //
    805   fMeanFluxInsidePlexiglass    = mean*gkBlindPixelArea;
    806 
    807   // Start calculation of number of photons relative Variance (!!)
    808   fMeanFluxErrInsidePlexiglass  = merr*merr/mean/mean;
    809  
    810   switch (fColor)
    811     {
    812     case kEGreen:
    813       fMeanFluxInsidePlexiglass    /= gkCalibrationBlindPixelQEGreen;   
    814       fMeanFluxErrInsidePlexiglass += gkCalibrationBlindPixelQEGreenErr*gkCalibrationBlindPixelQEGreenErr
    815                                     / gkCalibrationBlindPixelQEGreen  /   gkCalibrationBlindPixelQEGreen;   
    816 
    817       fMeanFluxInsidePlexiglass  *= TMath::Power(10,gkCalibrationBlindPixelAttGreen); // correct for absorption
    818       // attenuation has negligible error
    819       break;
    820     case kEBlue:
    821       fMeanFluxInsidePlexiglass    /= gkCalibrationBlindPixelQEBlue;   
    822       fMeanFluxErrInsidePlexiglass += gkCalibrationBlindPixelQEBlueErr*gkCalibrationBlindPixelQEBlueErr
    823                                     / gkCalibrationBlindPixelQEBlue  /   gkCalibrationBlindPixelQEBlue;   
    824 
    825       fMeanFluxInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttBlue); // correct for absorption
    826       // attenuation has negligible error
    827       break;
    828     case kEUV:
    829       fMeanFluxInsidePlexiglass    /= gkCalibrationBlindPixelQEUV;   
    830       fMeanFluxErrInsidePlexiglass += gkCalibrationBlindPixelQEUVErr*gkCalibrationBlindPixelQEUVErr
    831                                     / gkCalibrationBlindPixelQEUV  /   gkCalibrationBlindPixelQEUV;   
    832 
    833       fMeanFluxInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttUV); // correct for absorption
    834       // attenuation has negligible error
    835       break;
    836     case kECT1:
    837     default:
    838       fMeanFluxInsidePlexiglass    /= gkCalibrationBlindPixelQECT1;   
    839       fMeanFluxErrInsidePlexiglass += gkCalibrationBlindPixelQECT1Err*gkCalibrationBlindPixelQECT1Err
    840                                     / gkCalibrationBlindPixelQECT1  /   gkCalibrationBlindPixelQECT1;   
    841 
    842       fMeanFluxInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttCT1); // correct for absorption
    843       // attenuation has negligible error
    844       break;
    845     }
    846 
    847   *fLog << inf << endl;
    848   *fLog << inf << " Photon flux [ph/mm^2] inside Plexiglass: "
    849         << fMeanFluxInsidePlexiglass << endl;
    850 
    851   if (fMeanFluxInsidePlexiglass > 0.)
    852     SETBIT(fFlags,kFluxInsidePlexiglassAvailable); 
    853   else
    854     {
    855       CLRBIT(fFlags,kFluxInsidePlexiglassAvailable);       
    856       return kFALSE;
    857     }
    858 
    859   if (fMeanFluxErrInsidePlexiglass < 0.)
    860     {
    861       *fLog << warn << " Relative Variance on Photon flux inside Plexiglass: "
    862             << fMeanFluxErrInsidePlexiglass << endl;
    863       CLRBIT(fFlags,kFluxInsidePlexiglassAvailable);       
    864       return kFALSE;
    865     }
    866 
    867   // Finish calculation of errors -> convert from relative variance to absolute error
    868   fMeanFluxErrInsidePlexiglass = TMath::Sqrt(fMeanFluxErrInsidePlexiglass);
    869   fMeanFluxErrInsidePlexiglass *= fMeanFluxInsidePlexiglass;
    870 
    871   *fLog << inf << " Error on photon flux [ph/mm^2] inside Plexiglass: "
    872         << fMeanFluxErrInsidePlexiglass << endl;
    873   *fLog << inf << endl;
     755void MCalibrationChargeCam::ApplyBlindPixelCalibration()
     756{
     757
     758  Float_t flux    = fBlindPixel->GetMeanFluxInsidePlexiglass();
     759  Float_t fluxerr = fBlindPixel->GetMeanFluxErrInsidePlexiglass();
    874760
    875761  TIter Next(fPixels);
     
    887773          const Float_t chargeerr = pix->GetMeanChargeErr();         
    888774
    889           const Float_t nphot      = fMeanFluxInsidePlexiglass*area;
    890           const Float_t nphoterr   = fMeanFluxErrInsidePlexiglass*area;
     775          const Float_t nphot      = flux    * area;
     776          const Float_t nphoterr   = fluxerr * area;
    891777          const Float_t conversion = nphot/charge;
    892778          Float_t conversionerr;
     
    907793        }
    908794    }
    909   return kTRUE;
    910795}
    911796
     
    960845Bool_t MCalibrationChargeCam::GetConversionFactorBlindPixel(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
    961846{
    962  
    963 
    964   if (!IsFluxInsidePlexiglassAvailable())
    965     if (!CalcFluxInsidePlexiglass())
    966       return kFALSE;
    967847
    968848  mean  = (*this)[ipx].GetMeanConversionBlindPixelMethod();
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h

    r3264 r3292  
    1313class TClonesArray;
    1414
    15 class MCalibrationBlindPix;
     15class MCalibrationChargeBlindPix;
    1616class MCalibrationChargePINDiode;
    1717class MCalibrationChargePix;
     
    2222  static const Int_t   gkBlindPixelId;
    2323  static const Int_t   gkPINDiodeId;
    24   static const Float_t gkBlindPixelArea;       // The Blind Pixel area in mm^2
    25 
    26   static const Float_t gkCalibrationBlindPixelQEGreen;
    27   static const Float_t gkCalibrationBlindPixelQEBlue ;
    28   static const Float_t gkCalibrationBlindPixelQEUV   ;
    29   static const Float_t gkCalibrationBlindPixelQECT1  ;
    30 
    31   static const Float_t gkCalibrationBlindPixelQEGreenErr;
    32   static const Float_t gkCalibrationBlindPixelQEBlueErr ;
    33   static const Float_t gkCalibrationBlindPixelQEUVErr   ;
    34   static const Float_t gkCalibrationBlindPixelQECT1Err  ;
    35  
    36   static const Float_t gkCalibrationBlindPixelAttGreen;
    37   static const Float_t gkCalibrationBlindPixelAttBlue ;
    38   static const Float_t gkCalibrationBlindPixelAttUV   ;
    39   static const Float_t gkCalibrationBlindPixelAttCT1  ;
    4024
    4125  Int_t fNumPixels;
    4226  TClonesArray *fPixels;                                        //-> Array of MCalibrationPix with fit results
    4327 
    44   MCalibrationBlindPix       *fBlindPixel;                      //-> Pointer to the Blind Pixel with fit results
     28  const MCalibrationChargeBlindPix *fBlindPixel;                //! Pointer to the Blind Pixel with fit results
    4529  const MCalibrationChargePINDiode *fPINDiode;                  //! Pointer to the PIN Diode with fit results
    4630
     
    5236  TH2D* fOffvsSlope;                                            //!
    5337
    54   Float_t fMeanFluxInsidePlexiglass;          //  The mean number of photons in an INNER PIXEL inside the plexiglass
    55   Float_t fMeanFluxErrInsidePlexiglass;       //  The uncertainty about the number of photons in an INNER PIXEL 
    56 
    5738  UInt_t  fNumExcludedPixels;
    5839
    5940  Byte_t  fFlags;
    6041
    61   enum  { kBlindPixelMethodValid, kPINDiodeMethodValid, kCombinedMethodValid,
    62           kFluxInsidePlexiglassAvailable };
     42  enum  { kBlindPixelMethodValid, kPINDiodeMethodValid, kCombinedMethodValid };
    6343 
    6444public:
     
    8262  void SetNumPixelsExcluded(  const UInt_t n )            {  fNumExcludedPixels = n; }
    8363  void SetGeomCam(  const MGeomCam *geom)                 {  fGeomCam = geom;        }
    84   void SetPINDiode( const MCalibrationChargePINDiode *d ) {  fPINDiode = d;          }
     64
     65  void SetPINDiode  ( const MCalibrationChargePINDiode *d ) {  fPINDiode   = d;      }
     66  void SetBlindPixel( const MCalibrationChargeBlindPix *b ) {  fBlindPixel = b;      }
    8567
    8668  // Setters only for MC!!
     
    8971
    9072  // Getters
    91   Int_t GetSize()                                  const;
    92   UInt_t GetNumPixels()                            const { return fNumPixels; }
    93 
    94   MCalibrationBlindPix *GetBlindPixel()                  { return fBlindPixel;  }
    95   const MCalibrationBlindPix *GetBlindPixel()      const { return fBlindPixel;  }
    96 
    97   Float_t GetMeanFluxInsidePlexiglass()     const { return fMeanFluxInsidePlexiglass;     }
    98   Float_t GetMeanFluxErrInsidePlexiglass()  const { return fMeanFluxErrInsidePlexiglass;  }
     73  Int_t  GetSize()               const;
     74  UInt_t GetNumPixels()          const { return fNumPixels; }
    9975
    10076  Bool_t GetConversionFactorFFactor(    Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma );
     
    10682  Bool_t IsPINDiodeMethodValid()     const; 
    10783
    108   Bool_t IsFluxInsidePlexiglassAvailable()  const;
    109 
    11084  // Others
    11185  MCalibrationChargePix &operator[](UInt_t i);
    11286  const MCalibrationChargePix &operator[](UInt_t i) const;
    11387 
    114   void CutEdges();
    11588  Bool_t CheckBounds(Int_t i) const;
    11689
     
    12598  Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
    12699
    127   Bool_t CalcFluxInsidePlexiglass();
    128100  void   ApplyPINDiodeCalibration();
     101  void   ApplyBlindPixelCalibration();
    129102
    130103  ClassDef(MCalibrationChargeCam, 1)    // Container for calibration information of the camera
     
    135108
    136109
     110
     111
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.cc

    r3289 r3292  
    317317 
    318318  if (FitSinglePhe())
    319       fBlindPix->SetFitted(kTRUE);
     319      fBlindPix->SetSinglePheFitOK();
    320320
    321321  fBlindPix->SetLambda      (    fLambda      );
  • trunk/MagicSoft/Mars/mcalib/Makefile

    r3284 r3292  
    4141           MCalibrationChargeCalc.cc \
    4242           MCalibrationChargePix.cc  \
    43            MCalibrationBlindPix.cc  \
     43           MCalibrationChargeBlindPix.cc  \
    4444           MCalibrationChargePINDiode.cc  \
    4545           MCalibrationChargeCam.cc \
    46            MHCalibrationBlindPixel.cc \
     46           MHCalibrationChargeBlindPix.cc \
     47           MHCalibrationChargeBlindPix.cc \
    4748           MHCalibrationChargePix.cc \
    4849           MHCalibrationChargeCam.cc \
Note: See TracChangeset for help on using the changeset viewer.