Ignore:
Timestamp:
02/09/04 22:50:52 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mcalib
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.cc

    r3072 r3075  
    445445  fEvents++;
    446446
    447   Float_t referencetime = 0.;
     447  //  Float_t referencetime = 0.;
    448448 
    449449  //
     
    468468
    469469      Float_t abstime = 0.;
     470#if 0
    470471      Float_t reltime = 0.;
    471472
    472 #if 0
    473473      if (TESTBIT(fFlags,kUseTimes))
    474474        {
     
    702702          fCalibrations->SetBlindPixelMethodValid(kFALSE);
    703703        }
    704 
    705       blindpixel.CheckOscillations();
    706 
    707       fCalibrations->SetBlindPixelMethodValid(kTRUE);
     704      else
     705        fCalibrations->SetBlindPixelMethodValid(kTRUE);
     706     
     707      if (blindpixel.CheckOscillations())
     708        fCalibrations->SetBlindPixelMethodValid(kFALSE);
     709
    708710      blindpixel.DrawClone();
    709711    }
     
    753755  if (TESTBIT(fFlags,kUseBlindPixelFit) && fCalibrations->IsBlindPixelMethodValid())
    754756    {
    755      
    756       if (!fCalibrations->CalcNumPhotInsidePlexiglass())
     757      if (!fCalibrations->CalcFluxInsidePlexiglass())
    757758        {
    758759          *fLog << err
     
    760761          *fLog << err
    761762                << "You can try to calibrate using the MCalibrationCalc::SkipBlindPixelFit()" << endl;
    762           fCalibrations->SetBlindPixelMethodValid(kFALSE);
     763        fCalibrations->SetBlindPixelMethodValid(kFALSE);         
    763764        }
    764765    }
     
    769770  if (TESTBIT(fFlags,kUsePinDiodeFit) && fCalibrations->IsPINDiodeMethodValid())
    770771    {
    771      
    772       if (!fCalibrations->CalcNumPhotInsidePlexiglass())
     772      if (!fCalibrations->CalcFluxOutsidePlexiglass())
    773773        {
    774774          *fLog << err
  • trunk/MagicSoft/Mars/mcalib/MCalibrationCam.cc

    r3065 r3075  
    184184  fPINDiode->Clear();
    185185
    186   fMeanPhotInsidePlexiglass          = -1.;
    187   fMeanPhotErrInsidePlexiglass       = -1.;
    188   fMeanPhotOutsidePlexiglass         = -1.;
    189   fMeanPhotErrOutsidePlexiglass      = -1.;
     186  fMeanFluxInsidePlexiglass          = -1.;
     187  fMeanFluxErrInsidePlexiglass       = -1.;
     188  fMeanFluxOutsidePlexiglass         = -1.;
     189  fMeanFluxErrOutsidePlexiglass      = -1.;
    190190
    191191  fNumExcludedPixels                 = 0;
     
    193193  CLRBIT(fFlags,kBlindPixelMethodValid);
    194194  CLRBIT(fFlags,kPINDiodeMethodValid);
    195   CLRBIT(fFlags,kNumPhotInsidePlexiglassAvailable);
    196   CLRBIT(fFlags,kNumPhotOutsidePlexiglassAvailable); 
     195  CLRBIT(fFlags,kFluxInsidePlexiglassAvailable);
     196  CLRBIT(fFlags,kFluxOutsidePlexiglassAvailable); 
    197197
    198198  return;
     
    231231
    232232
    233 Bool_t  MCalibrationCam::IsNumPhotInsidePlexiglassAvailable()   const
    234 {
    235   return TESTBIT(fFlags,kNumPhotInsidePlexiglassAvailable);
    236 }
    237 
    238 Bool_t  MCalibrationCam::IsNumPhotOutsidePlexiglassAvailable()   const
    239 {
    240   return TESTBIT(fFlags,kNumPhotOutsidePlexiglassAvailable);
     233Bool_t  MCalibrationCam::IsFluxInsidePlexiglassAvailable()   const
     234{
     235  return TESTBIT(fFlags,kFluxInsidePlexiglassAvailable);
     236}
     237
     238Bool_t  MCalibrationCam::IsFluxOutsidePlexiglassAvailable()   const
     239{
     240  return TESTBIT(fFlags,kFluxOutsidePlexiglassAvailable);
    241241}
    242242
     
    262262    {
    263263     
    264       if (pix->IsChargeValid() && !pix->IsExcluded())
     264      if (pix->IsChargeValid() && !pix->IsExcluded() && !pix->IsOscillating() && pix->IsFitted())
    265265        {
    266266
     
    284284      {
    285285       
    286         if (!pix->IsChargeValid() && !pix->IsExcluded())
     286        if (!pix->IsChargeValid() && !pix->IsExcluded() && !pix->IsFitted())
    287287          {
    288288
     
    294294      }
    295295    *fLog << all << id << " pixels with errors :-((" << endl;
     296
     297  *fLog << all << endl;
     298  *fLog << all << "Pixels with oscillations:" << endl;
     299  *fLog << all << endl;
     300 
     301  id = 0;
     302
     303  TIter Next3(fPixels);
     304  while ((pix=(MCalibrationPix*)Next3()))
     305    {
     306     
     307      if (pix->IsOscillating() && !pix->IsExcluded())
     308        {
     309         
     310          *fLog << all << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- "
     311                << pix->GetPedRms() << " Reduced Charge: " << pix->GetCharge() << " +- "
     312                << pix->GetSigmaCharge() << " Reduced Sigma: " << pix->GetRSigmaCharge() << endl;
     313          Float_t area = (*fGeomCam)[pix->GetPixId()].GetA();
     314          *fLog << "Area: " << area << endl;
     315          pix->DrawClone();
     316          id++;
     317        }
     318    }
     319  *fLog << all << id << " Oscillating pixels :-((" << endl;
     320 
    296321   
    297322  *fLog << all << endl;
     
    299324  *fLog << all << endl;
    300325 
    301   TIter Next3(fPixels);
    302     while ((pix=(MCalibrationPix*)Next3()))
    303       if (pix->IsExcluded())
     326  TIter Next4(fPixels);
     327  while ((pix=(MCalibrationPix*)Next4()))
     328    if (pix->IsExcluded())
    304329        *fLog << all << pix->GetPixId() << endl;
    305330
     
    381406    return kFALSE;
    382407
    383   Float_t arearatio = cam.GetPixRatio(idx);
    384 
    385  if (arearatio == 0)
     408  Float_t area = cam[idx].GetA()/100.;
     409
     410 if (area == 0)
    386411    return kFALSE;
    387412
     
    475500      if ((*this)[idx].IsExcluded())
    476501        return kFALSE;
    477       if (arearatio == 1.)
    478         val = GetMeanPhotInsidePlexiglass();
    479       else
    480         val = GetMeanPhotInsidePlexiglass()*gkCalibrationOutervsInnerPixelArea;
     502      val = GetMeanFluxInsidePlexiglass()*area;
    481503      break;
    482504    case 16:
    483505      if ((*this)[idx].IsExcluded())
    484506        return kFALSE;
    485       if (arearatio == 1.)
    486         val = (double)fMeanPhotInsidePlexiglass;
    487       else
    488         val = (double)fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelArea;
     507      val = GetMeanFluxInsidePlexiglass()*area;
    489508      break;
    490509    case 17:
    491510      if ((*this)[idx].IsExcluded())
    492511        return kFALSE;
    493       if (arearatio == 1.)
    494         val = (*this)[idx].GetMeanConversionBlindPixelMethod();
    495       else
    496         val = (*this)[idx].GetMeanConversionBlindPixelMethod()*gkCalibrationOutervsInnerPixelArea;
     512      val = (*this)[idx].GetMeanConversionBlindPixelMethod();
    497513      break;
    498514    case 18:
    499515      if ((*this)[idx].IsExcluded())
    500516        return kFALSE;
    501       if (arearatio == 1.)
    502         val = (*this)[idx].GetErrorConversionBlindPixelMethod();
    503       else
    504         {
    505         val =  (*this)[idx].GetErrorConversionBlindPixelMethod()*(*this)[idx].GetErrorConversionBlindPixelMethod()
    506                           * gkCalibrationOutervsInnerPixelArea * gkCalibrationOutervsInnerPixelArea;
    507         val +=  gkCalibrationOutervsInnerPixelAreaError * gkCalibrationOutervsInnerPixelAreaError
    508          * (*this)[idx].GetMeanConversionBlindPixelMethod() *(*this)[idx].GetMeanConversionBlindPixelMethod();
    509         val = TMath::Sqrt(val);
    510         }
     517      val = (*this)[idx].GetErrorConversionBlindPixelMethod();
    511518      break;
    512519    case 19:
     
    523530      if ((*this)[idx].IsExcluded())
    524531        return kFALSE;
    525       if (arearatio == 1.)
    526         val = GetMeanPhotOutsidePlexiglass();
    527       else
    528         val = GetMeanPhotOutsidePlexiglass()*gkCalibrationOutervsInnerPixelArea;
     532      val = GetMeanFluxOutsidePlexiglass()*area;
    529533      break;
    530534    case 22:
    531535      if ((*this)[idx].IsExcluded())
    532536        return kFALSE;
    533       if (arearatio == 1.)
    534         val = (double)fMeanPhotOutsidePlexiglass;
    535       else
    536         val = (double)fMeanPhotOutsidePlexiglass*gkCalibrationOutervsInnerPixelArea;
     537      val = GetMeanFluxOutsidePlexiglass()*area;
    537538      break;
    538539    case 23:
    539540      if ((*this)[idx].IsExcluded())
    540541        return kFALSE;
    541       if (arearatio == 1.)
    542         val = (*this)[idx].GetMeanConversionPINDiodeMethod();
    543       else
    544         val = (*this)[idx].GetMeanConversionPINDiodeMethod()*gkCalibrationOutervsInnerPixelArea;
     542      val = (*this)[idx].GetMeanConversionPINDiodeMethod();
    545543      break;
    546544    case 24:
    547545      if ((*this)[idx].IsExcluded())
    548546        return kFALSE;
    549       if (arearatio == 1.)
    550         val = (*this)[idx].GetErrorConversionPINDiodeMethod();
    551       else
    552         {
    553           val =  (*this)[idx].GetErrorConversionPINDiodeMethod()*(*this)[idx].GetErrorConversionPINDiodeMethod()
    554                           * gkCalibrationOutervsInnerPixelArea * gkCalibrationOutervsInnerPixelArea;
    555           val +=  gkCalibrationOutervsInnerPixelAreaError * gkCalibrationOutervsInnerPixelAreaError
    556                * (*this)[idx].GetMeanConversionPINDiodeMethod() *(*this)[idx].GetMeanConversionPINDiodeMethod();
    557           val = TMath::Sqrt(val);
    558         }
     547      val = (*this)[idx].GetErrorConversionPINDiodeMethod();
    559548      break;
    560549    case 25:
     
    694683//
    695684//
    696 Bool_t MCalibrationCam::CalcNumPhotInsidePlexiglass()
     685Bool_t MCalibrationCam::CalcFluxInsidePlexiglass()
    697686{
    698687
     
    707696  //
    708697  // The blind pixel has exactly one cm^2 area (with negligible error),
    709   // thus we omi division by 1.
     698  // thus we omit division by 1.
    710699  //
    711   fMeanPhotInsidePlexiglass    = mean * gkCalibrationInnerPixelArea;
     700  fMeanFluxInsidePlexiglass    = mean;
    712701
    713702  // Start calculation of number of photons relative Variance (!!)
    714   fMeanPhotErrInsidePlexiglass  = merr*merr/mean/mean;
    715   fMeanPhotErrInsidePlexiglass += gkCalibrationInnerPixelAreaError*gkCalibrationInnerPixelAreaError
    716                                 / gkCalibrationInnerPixelArea/gkCalibrationInnerPixelArea;
     703  fMeanFluxErrInsidePlexiglass  = merr*merr/mean/mean;
    717704 
    718705  switch (fColor)
    719706    {
    720707    case kECGreen:
    721       fMeanPhotInsidePlexiglass    /= gkCalibrationBlindPixelQEGreen;   
    722       fMeanPhotErrInsidePlexiglass += gkCalibrationBlindPixelQEGreenError*gkCalibrationBlindPixelQEGreenError
     708      fMeanFluxInsidePlexiglass    /= gkCalibrationBlindPixelQEGreen;   
     709      fMeanFluxErrInsidePlexiglass += gkCalibrationBlindPixelQEGreenError*gkCalibrationBlindPixelQEGreenError
    723710                                    / gkCalibrationBlindPixelQEGreen  /   gkCalibrationBlindPixelQEGreen;   
    724711
    725       fMeanPhotInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttGreen); // correct for absorption
     712      fMeanFluxInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttGreen); // correct for absorption
    726713      // attenuation has negligible error
    727714      break;
    728715    case kECBlue:
    729       fMeanPhotInsidePlexiglass    /= gkCalibrationBlindPixelQEBlue;   
    730       fMeanPhotErrInsidePlexiglass += gkCalibrationBlindPixelQEBlueError*gkCalibrationBlindPixelQEBlueError
     716      fMeanFluxInsidePlexiglass    /= gkCalibrationBlindPixelQEBlue;   
     717      fMeanFluxErrInsidePlexiglass += gkCalibrationBlindPixelQEBlueError*gkCalibrationBlindPixelQEBlueError
    731718                                    / gkCalibrationBlindPixelQEBlue  /   gkCalibrationBlindPixelQEBlue;   
    732719
    733       fMeanPhotInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttBlue); // correct for absorption
     720      fMeanFluxInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttBlue); // correct for absorption
    734721      // attenuation has negligible error
    735722      break;
    736723    case kECUV:
    737       fMeanPhotInsidePlexiglass    /= gkCalibrationBlindPixelQEUV;   
    738       fMeanPhotErrInsidePlexiglass += gkCalibrationBlindPixelQEUVError*gkCalibrationBlindPixelQEUVError
     724      fMeanFluxInsidePlexiglass    /= gkCalibrationBlindPixelQEUV;   
     725      fMeanFluxErrInsidePlexiglass += gkCalibrationBlindPixelQEUVError*gkCalibrationBlindPixelQEUVError
    739726                                    / gkCalibrationBlindPixelQEUV  /   gkCalibrationBlindPixelQEUV;   
    740727
    741       fMeanPhotInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttUV); // correct for absorption
     728      fMeanFluxInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttUV); // correct for absorption
    742729      // attenuation has negligible error
    743730      break;
    744731    case kECCT1:
    745732    default:
    746       fMeanPhotInsidePlexiglass    /= gkCalibrationBlindPixelQECT1;   
    747       fMeanPhotErrInsidePlexiglass += gkCalibrationBlindPixelQECT1Error*gkCalibrationBlindPixelQECT1Error
     733      fMeanFluxInsidePlexiglass    /= gkCalibrationBlindPixelQECT1;   
     734      fMeanFluxErrInsidePlexiglass += gkCalibrationBlindPixelQECT1Error*gkCalibrationBlindPixelQECT1Error
    748735                                    / gkCalibrationBlindPixelQECT1  /   gkCalibrationBlindPixelQECT1;   
    749736
    750       fMeanPhotInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttCT1); // correct for absorption
     737      fMeanFluxInsidePlexiglass *= TMath::Power(10,gkCalibrationBlindPixelAttCT1); // correct for absorption
    751738      // attenuation has negligible error
    752739      break;
     
    754741
    755742  *fLog << inf << endl;
    756   *fLog << inf << " Mean number of Photons for an Inner Pixel (inside Plexiglass): "
    757         << fMeanPhotInsidePlexiglass << endl;
    758 
    759   if (fMeanPhotInsidePlexiglass > 0.)
    760     SETBIT(fFlags,kNumPhotInsidePlexiglassAvailable); 
     743  *fLog << inf << " Photon flux [ph/cm^2] inside Plexiglass: "
     744        << fMeanFluxInsidePlexiglass << endl;
     745
     746  if (fMeanFluxInsidePlexiglass > 0.)
     747    SETBIT(fFlags,kFluxInsidePlexiglassAvailable); 
    761748  else
    762749    {
    763       CLRBIT(fFlags,kNumPhotInsidePlexiglassAvailable);       
     750      CLRBIT(fFlags,kFluxInsidePlexiglassAvailable);       
    764751      return kFALSE;
    765752    }
    766753
    767   if (fMeanPhotErrInsidePlexiglass < 0.)
    768     {
    769       *fLog << warn << " Relative Variance on number of Photons for an Inner Pixel (inside Plexiglass): "
    770             << fMeanPhotErrInsidePlexiglass << endl;
    771       CLRBIT(fFlags,kNumPhotInsidePlexiglassAvailable);       
     754  if (fMeanFluxErrInsidePlexiglass < 0.)
     755    {
     756      *fLog << warn << " Relative Variance on Photon flux inside Plexiglass: "
     757            << fMeanFluxErrInsidePlexiglass << endl;
     758      CLRBIT(fFlags,kFluxInsidePlexiglassAvailable);       
    772759      return kFALSE;
    773760    }
    774761
    775762  // Finish calculation of errors -> convert from relative variance to absolute error
    776   fMeanPhotErrInsidePlexiglass = TMath::Sqrt(fMeanPhotErrInsidePlexiglass);
    777   fMeanPhotErrInsidePlexiglass *= fMeanPhotInsidePlexiglass;
    778 
    779   *fLog << inf << " Error on number of Photons for an Inner Pixel (inside Plexiglass): "
    780         << fMeanPhotErrInsidePlexiglass << endl;
     763  fMeanFluxErrInsidePlexiglass = TMath::Sqrt(fMeanFluxErrInsidePlexiglass);
     764  fMeanFluxErrInsidePlexiglass *= fMeanFluxInsidePlexiglass;
     765
     766  *fLog << inf << " Error on photon flux [ph/cm^2] inside Plexiglass: "
     767        << fMeanFluxErrInsidePlexiglass << endl;
    781768  *fLog << inf << endl;
    782 
    783 
    784769
    785770  TIter Next(fPixels);
     
    790775      if(pix->IsChargeValid())
    791776        {
     777         
     778          const Int_t idx = pix->GetPixId();
    792779
    793780          const Float_t charge    = pix->GetCharge();
    794           const Float_t ratio     = fGeomCam->GetPixRatio(pix->GetPixId());
     781          const Float_t area      = (*fGeomCam)[idx].GetA()/100.;
    795782          const Float_t chargeerr = pix->GetErrCharge();         
    796783
    797           Float_t nphot;
    798           Float_t nphoterr;
    799          
    800           if (ratio == 1.)
    801             {
    802               nphot    = fMeanPhotInsidePlexiglass;
    803               nphoterr = fMeanPhotErrInsidePlexiglass;
    804             }
    805           else
    806             {
    807               nphot = fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelArea;
    808               nphoterr = fMeanPhotErrInsidePlexiglass*gkCalibrationOutervsInnerPixelArea
    809                         *fMeanPhotErrInsidePlexiglass*gkCalibrationOutervsInnerPixelArea;
    810               nphoterr += fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelAreaError
    811                          *fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelAreaError;
    812               nphoterr = TMath::Sqrt(nphoterr);
    813             }
    814 
    815          
    816 
    817           const Float_t conversion      = nphot/charge;
     784          const Float_t nphot      = fMeanFluxInsidePlexiglass*area;
     785          const Float_t nphoterr   = fMeanFluxErrInsidePlexiglass*area;
     786          const Float_t conversion = nphot/charge;
    818787          Float_t conversionerr;
    819788         
     
    837806
    838807
    839 Bool_t MCalibrationCam::CalcNumPhotOutsidePlexiglass()
     808Bool_t MCalibrationCam::CalcFluxOutsidePlexiglass()
    840809{
    841810
     
    847816
    848817  // Start calculation of number of photons
    849   fMeanPhotOutsidePlexiglass = mean * gkCalibrationInnerPixelvsPINDiodeArea;
     818  fMeanFluxOutsidePlexiglass = mean * gkCalibrationFluxCameravsPINDiode;
    850819
    851820  // Start calculation of number of photons relative Variance (!!)
    852   fMeanPhotErrOutsidePlexiglass  = merr*merr/mean/mean;
    853   fMeanPhotErrOutsidePlexiglass += gkCalibrationInnerPixelvsPINDiodeAreaError*gkCalibrationInnerPixelvsPINDiodeAreaError
    854                                  / gkCalibrationInnerPixelvsPINDiodeArea/gkCalibrationInnerPixelvsPINDiodeArea;
     821  fMeanFluxErrOutsidePlexiglass  = merr*merr/mean/mean;
     822  fMeanFluxErrOutsidePlexiglass += gkCalibrationFluxCameravsPINDiodeError*gkCalibrationFluxCameravsPINDiodeError
     823                                 / gkCalibrationFluxCameravsPINDiode/gkCalibrationFluxCameravsPINDiode;
    855824 
    856825  switch (fColor)
    857826    {
    858827    case kECGreen:
    859       fMeanPhotOutsidePlexiglass    /= gkCalibrationPINDiodeQEGreen;
    860       fMeanPhotErrOutsidePlexiglass += gkCalibrationPINDiodeQEGreenError*gkCalibrationPINDiodeQEGreenError
     828      fMeanFluxOutsidePlexiglass    /= gkCalibrationPINDiodeQEGreen;
     829      fMeanFluxErrOutsidePlexiglass += gkCalibrationPINDiodeQEGreenError*gkCalibrationPINDiodeQEGreenError
    861830                                     / gkCalibrationPINDiodeQEGreen/gkCalibrationPINDiodeQEGreen;
    862831      break;
    863832    case kECBlue:
    864       fMeanPhotOutsidePlexiglass    /= gkCalibrationPINDiodeQEBlue;
    865       fMeanPhotErrOutsidePlexiglass += gkCalibrationPINDiodeQEBlueError*gkCalibrationPINDiodeQEBlueError
     833      fMeanFluxOutsidePlexiglass    /= gkCalibrationPINDiodeQEBlue;
     834      fMeanFluxErrOutsidePlexiglass += gkCalibrationPINDiodeQEBlueError*gkCalibrationPINDiodeQEBlueError
    866835                                     / gkCalibrationPINDiodeQEBlue/gkCalibrationPINDiodeQEBlue;
    867836      break;
    868837    case kECUV:
    869       fMeanPhotOutsidePlexiglass    /= gkCalibrationPINDiodeQEUV;
    870       fMeanPhotErrOutsidePlexiglass += gkCalibrationPINDiodeQEUVError*gkCalibrationPINDiodeQEUVError
     838      fMeanFluxOutsidePlexiglass    /= gkCalibrationPINDiodeQEUV;
     839      fMeanFluxErrOutsidePlexiglass += gkCalibrationPINDiodeQEUVError*gkCalibrationPINDiodeQEUVError
    871840                                     / gkCalibrationPINDiodeQEUV/gkCalibrationPINDiodeQEUV;
    872841      break;
    873842    case kECCT1:
    874843    default:
    875       fMeanPhotOutsidePlexiglass    /= gkCalibrationPINDiodeQECT1;
    876       fMeanPhotErrOutsidePlexiglass += gkCalibrationPINDiodeQECT1Error*gkCalibrationPINDiodeQECT1Error
     844      fMeanFluxOutsidePlexiglass    /= gkCalibrationPINDiodeQECT1;
     845      fMeanFluxErrOutsidePlexiglass += gkCalibrationPINDiodeQECT1Error*gkCalibrationPINDiodeQECT1Error
    877846                                     / gkCalibrationPINDiodeQECT1/gkCalibrationPINDiodeQECT1;
    878847      break;
     
    881850
    882851  *fLog << inf << endl;
    883   *fLog << inf << " Mean number of Photons for an Inner Pixel (outside Plexiglass): "
    884         << fMeanPhotOutsidePlexiglass << endl;
    885 
    886   if (fMeanPhotOutsidePlexiglass > 0.)
    887     SETBIT(fFlags,kNumPhotOutsidePlexiglassAvailable); 
     852  *fLog << inf << " Mean Photon flux [ph/cm^2] outside Plexiglass: "
     853        << fMeanFluxOutsidePlexiglass << endl;
     854
     855  if (fMeanFluxOutsidePlexiglass > 0.)
     856    SETBIT(fFlags,kFluxOutsidePlexiglassAvailable); 
    888857  else
    889858    {
    890       CLRBIT(fFlags,kNumPhotOutsidePlexiglassAvailable);       
     859      CLRBIT(fFlags,kFluxOutsidePlexiglassAvailable);       
    891860      return kFALSE;
    892861    }
    893862
    894   if (fMeanPhotErrOutsidePlexiglass < 0.)
    895     {
    896       *fLog << warn << "Relative Variance on number of Photons for an Inner Pixel (outside Plexiglass): "
    897             << fMeanPhotErrOutsidePlexiglass << endl;
    898       CLRBIT(fFlags,kNumPhotOutsidePlexiglassAvailable);       
     863  if (fMeanFluxErrOutsidePlexiglass < 0.)
     864    {
     865      *fLog << warn << "Relative Variance on Photon flux outside Plexiglass: "
     866            << fMeanFluxErrOutsidePlexiglass << endl;
     867      CLRBIT(fFlags,kFluxOutsidePlexiglassAvailable);       
    899868      return kFALSE;
    900869    }
    901870
    902871  // Finish calculation of errors -> convert from relative variance to absolute error
    903   fMeanPhotErrOutsidePlexiglass = TMath::Sqrt(fMeanPhotErrOutsidePlexiglass);
    904   fMeanPhotErrOutsidePlexiglass *= fMeanPhotOutsidePlexiglass;
    905 
    906   *fLog << inf << " Error on number of Photons for an Inner Pixel (outside Plexiglass): "
    907         << fMeanPhotErrOutsidePlexiglass << endl;
     872  fMeanFluxErrOutsidePlexiglass = TMath::Sqrt(fMeanFluxErrOutsidePlexiglass);
     873  fMeanFluxErrOutsidePlexiglass *= fMeanFluxOutsidePlexiglass;
     874
     875  *fLog << inf << " Error on Photon flux [ph/cm^2] outside Plexiglass: "
     876        << fMeanFluxErrOutsidePlexiglass << endl;
    908877  *fLog << inf << endl;
    909878
     
    916885        {
    917886
     887          const Int_t idx = pix->GetPixId();
     888
    918889          const Float_t charge    = pix->GetCharge();
    919           const Float_t ratio = fGeomCam->GetPixRatio(pix->GetPixId());
     890          const Float_t area      = (*fGeomCam)[idx].GetA()/100.;
    920891          const Float_t chargeerr = pix->GetErrCharge();         
    921892
    922           Float_t nphot;
    923           Float_t nphoterr;
    924          
    925           if (ratio == 1.)
    926             {
    927               nphot    = fMeanPhotInsidePlexiglass;
    928               nphoterr = fMeanPhotErrInsidePlexiglass;
    929             }
    930           else
    931             {
    932               nphot = fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelArea;
    933               nphoterr = fMeanPhotErrInsidePlexiglass*gkCalibrationOutervsInnerPixelArea
    934                         *fMeanPhotErrInsidePlexiglass*gkCalibrationOutervsInnerPixelArea;
    935               nphoterr += fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelAreaError
    936                          *fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelAreaError;
    937               nphoterr = TMath::Sqrt(nphoterr);
    938             }
    939 
    940           const Float_t conversion      = nphot/charge;
     893          const Float_t nphot      = fMeanFluxOutsidePlexiglass*area;
     894          const Float_t nphoterr   = fMeanFluxErrOutsidePlexiglass*area;
     895          const Float_t conversion = nphot/charge;
     896
    941897          Float_t conversionerr;
    942898         
     
    951907          const Float_t conversionsigma = 0.;
    952908
    953           pix->SetConversionBlindPixelMethod(conversion, conversionerr, conversionsigma);
     909          pix->SetConversionPINDiodeMethod(conversion, conversionerr, conversionsigma);
    954910
    955911          if (conversionerr/conversion < 0.1)
    956             pix->SetBlindPixelMethodValid();
     912            pix->SetPINDiodeMethodValid();
    957913         
    958914        }
     
    969925    return kFALSE;
    970926
    971   if (!IsNumPhotInsidePlexiglassAvailable())
    972     if (!CalcNumPhotInsidePlexiglass())
     927  if (!IsFluxInsidePlexiglassAvailable())
     928    if (!CalcFluxInsidePlexiglass())
    973929      return kFALSE;
    974930
     
    1014970    return kFALSE;
    1015971
    1016   if (!IsNumPhotOutsidePlexiglassAvailable())
    1017     if (!CalcNumPhotOutsidePlexiglass())
     972  if (!IsFluxOutsidePlexiglassAvailable())
     973    if (!CalcFluxOutsidePlexiglass())
    1018974      return kFALSE;
    1019975
  • trunk/MagicSoft/Mars/mcalib/MCalibrationCam.h

    r3073 r3075  
    3737  TH2D* fOffvsSlope;                          //!
    3838
    39   Float_t fMeanPhotInsidePlexiglass;     //  The mean number of photons in an INNER PIXEL inside the plexiglass
    40   Float_t fMeanPhotErrInsidePlexiglass;  //  The uncertainty about the number of photons in an INNER PIXEL 
    41   Float_t fMeanPhotOutsidePlexiglass;    //  The mean number of photons in an INNER PIXEL outside the plexiglass
    42   Float_t fMeanPhotErrOutsidePlexiglass; //  The uncertainty about the number of photons in an INNER PIXEL 
     39  Float_t fMeanFluxInsidePlexiglass;     //  The mean number of photons in an INNER PIXEL inside the plexiglass
     40  Float_t fMeanFluxErrInsidePlexiglass;  //  The uncertainty about the number of photons in an INNER PIXEL 
     41  Float_t fMeanFluxOutsidePlexiglass;    //  The mean number of photons in an INNER PIXEL outside the plexiglass
     42  Float_t fMeanFluxErrOutsidePlexiglass; //  The uncertainty about the number of photons in an INNER PIXEL 
    4343
    4444  UInt_t fNumExcludedPixels;
     
    4747
    4848  enum  { kBlindPixelMethodValid, kPINDiodeMethodValid,
    49           kNumPhotInsidePlexiglassAvailable, kNumPhotOutsidePlexiglassAvailable  };
     49          kFluxInsidePlexiglassAvailable, kFluxOutsidePlexiglassAvailable  };
    5050 
    5151public:
     
    8383  MCalibrationPINDiode *GetPINDiode()         { return fPINDiode;    }
    8484
    85   Float_t GetMeanPhotInsidePlexiglass()     const { return fMeanPhotInsidePlexiglass;     }
    86   Float_t GetMeanPhotErrInsidePlexiglass()  const { return fMeanPhotErrInsidePlexiglass;  }
    87   Float_t GetMeanPhotOutsidePlexiglass()    const { return fMeanPhotOutsidePlexiglass;    }
    88   Float_t GetMeanPhotErrOutsidePlexiglass() const { return fMeanPhotErrOutsidePlexiglass; }
     85  Float_t GetMeanFluxInsidePlexiglass()     const { return fMeanFluxInsidePlexiglass;     }
     86  Float_t GetMeanFluxErrInsidePlexiglass()  const { return fMeanFluxErrInsidePlexiglass;  }
     87  Float_t GetMeanFluxOutsidePlexiglass()    const { return fMeanFluxOutsidePlexiglass;    }
     88  Float_t GetMeanFluxErrOutsidePlexiglass() const { return fMeanFluxErrOutsidePlexiglass; }
    8989
    9090  Bool_t GetConversionFactorFFactor(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma);
     
    9999  Bool_t IsPINDiodeMethodValid()     const; 
    100100
    101   Bool_t IsNumPhotInsidePlexiglassAvailable() const;
    102   Bool_t IsNumPhotOutsidePlexiglassAvailable() const;
     101  Bool_t IsFluxInsidePlexiglassAvailable() const;
     102  Bool_t IsFluxOutsidePlexiglassAvailable() const;
    103103
    104104  // Others
     
    119119  Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
    120120
    121   Bool_t CalcNumPhotInsidePlexiglass();
    122   Bool_t CalcNumPhotOutsidePlexiglass();
     121  Bool_t CalcFluxInsidePlexiglass();
     122  Bool_t CalcFluxOutsidePlexiglass();
    123123
    124124  ClassDef(MCalibrationCam, 1)  // Container for calibration information of the camera
  • trunk/MagicSoft/Mars/mcalib/MCalibrationConfig.h

    r3065 r3075  
    3636const Float_t gkCalibrationBlindPixelAttCT1   = 1.95;
    3737
    38 //
    39 // Area of Inner Pixel w.r.t. Blind Pixel (which is 1 sq. cm)
    40 //
    41 // Hexagone of diagonal axis b = 3.5 cm
    42 //             straight axis a = 3.0 cm +- 2%
    43 // Area =  sqrt(3)*a*a/2 = 7.79 sq.cm +- 4% = 7.8 +- 0.3 sq.cm
    44 //
    45 const Float_t gkCalibrationInnerPixelArea      = 7.8;
    46 const Float_t gkCalibrationInnerPixelAreaError = 0.3;
    47 //
    48 // Area of Outer Pixel w.r.t. Inner Pixel
    49 //
    50 // Hexagone of diagonal axis b = 7.0 cm
    51 //             straight axis a = 6.0 cm +- 1%
    52 // Area = sqrt(3)*a*a/2 = 31.177 sq.cm +- 2% = 31.2 +- 0.6 sq.cm
    53 //
    5438const Float_t gkCalibrationOutervsInnerPixelArea      = 4.0;
    5539const Float_t gkCalibrationOutervsInnerPixelAreaError = 0.2;
     
    7761// C = 0.05 +- 0.02
    7862//
    79 const Float_t gkCalibrationInnerPixelvsPINDiodeArea      = 0.05;
    80 const Float_t gkCalibrationInnerPixelvsPINDiodeAreaError = 0.02;
     63const Float_t gkCalibrationFluxCameravsPINDiode      = 0.05;
     64const Float_t gkCalibrationFluxCameravsPINDiodeError = 0.02;
    8165
    8266//
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationBlindPixel.cc

    r3061 r3075  
    289289  fPSDExpFit->SetParNames("Area","slope");
    290290  fPSDExpFit->SetParLimits(0,0.,3.*area_guess);
    291   fPSDExpFit->SetParLimits(1,5.,20.);
     291  fPSDExpFit->SetParLimits(1,0.,20.);
    292292  fPSDExpFit->SetRange(fMinFreq,fNyquistFreq);
    293293
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationPixel.cc

    r3074 r3075  
    6161const Int_t   MHCalibrationPixel::fNDFLimit          = 5;
    6262
    63 const Axis_t  MHCalibrationPixel::fMaxFreq           = 30.5;
    6463const Axis_t  MHCalibrationPixel::fMinFreq           = 0.;
    65 const Int_t   MHCalibrationPixel::fPSDNbins          = 30;
     64const Int_t   MHCalibrationPixel::fPSDNbins          = 50;
    6665 
    6766// --------------------------------------------------------------------------
     
    260259  //
    261260 
    262   // This cuts only the non-used zero's, but MFFT will cut the rest
     261  // This cuts only the non-used zero's, but MFFT will later cut the rest
    263262  CutArrayBorder(fHiGains);
    264263  CutArrayBorder(fLoGains); 
    265264
    266 
    267265  MFFT fourier;
    268266
     
    272270  Int_t entries;
    273271  TArrayF *array;
    274  
     272
     273  const Double_t max_freq = (fChargeSigma > 0.) ? fChargeSigma*0.2 : 2.;
     274  const Double_t min_freq = 0.;
     275
    275276  if (IsUseLoGain())
    276277    {
    277278      fHPSD = new TH1F(Form("%s%d","HPSD",fPixId),
    278279                       Form("%s%s","Power Spectrum Density Projection ","LoGain"),
    279                        fPSDNbins,fMinFreq,fMaxFreq);
     280                       fPSDNbins,min_freq,max_freq);
    280281     
    281282      array = fPSDLoGain;
     
    286287      fHPSD = new TH1F(Form("%s%d","HPSD",fPixId),
    287288                       Form("%s%s","Power Spectrum Density Projection ","HiGain"),
    288                        fPSDNbins,fMinFreq,fMaxFreq);
     289                       fPSDNbins,min_freq,max_freq);
    289290     
    290291      array = fPSDHiGain;
     
    305306  fPSDExpFit->SetParameters(area_guess,10.);
    306307  fPSDExpFit->SetParNames("Area","slope");
    307   fPSDExpFit->SetParLimits(0,0.,3.*area_guess);
    308   fPSDExpFit->SetParLimits(1,0.,20.);
    309   fPSDExpFit->SetRange(fMinFreq,fMaxFreq);
     308  fPSDExpFit->SetParLimits(0,0.,20.*area_guess);
     309  fPSDExpFit->SetParLimits(1,0.,30.);
     310  fPSDExpFit->SetRange(min_freq,max_freq);
    310311
    311312  fHPSD->Fit(fPSDExpFit,"RQL0");
     
    351352
    352353  const Int_t diff = fChargeXaxis->GetSize()-n;
     354
    353355  fChargeXaxis->Set(n);
    354356  if (diff < 0)
    355     for (Int_t i=n;i<n+diff;i++)
     357    for (Int_t i=n-1;i>n-diff-1;i--)
    356358      fChargeXaxis->AddAt((Float_t)i,i);
    357359}
     
    582584 
    583585  TCanvas *c = MH::MakeDefCanvas(this,600,900);
     586  c->SetBit(kCanDelete);
    584587 
    585588  c->Divide(2,5);
     
    714717 
    715718  gStyle->SetOptStat(111111);
     719  gStyle->SetOptFit();
    716720  gPad->SetTicks(); 
    717721
     
    729733  c->Modified();
    730734  c->Update();
     735
     736  c->Iconify();
    731737 
    732738  return;
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationPixel.h

    r3073 r3075  
    2626  static const Int_t   fNDFLimit; 
    2727
    28   static const Axis_t  fMaxFreq;
    2928  static const Axis_t  fMinFreq;
    3029  static const Int_t   fPSDNbins;
Note: See TracChangeset for help on using the changeset viewer.