Changeset 5032 for trunk/MagicSoft


Ignore:
Timestamp:
09/15/04 15:43:19 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r5031 r5032  
    6767
    6868   * mhcalib/MHCalibrationChargeCam.cc
     69   * mcalib/MCalibrationChargeCalc.cc
    6970     - simply calls to IntensityCam somewhat
    7071
  • trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc

    r5030 r5032  
    4848//                  - FinalizeFFactorMethod()
    4949//                  - FinalizeBadPixels()
    50 //                  - FinalizeBlindPixel()
    5150//                  - FinalizeBlindCam()
    5251//                  - FinalizePINDiode()
     
    466465        {
    467466          *fLog << endl;
    468           *fLog << warn << "No MCalibrationBlindCam found... no Blind Pixel method! " << endl;
     467          *fLog << warn << GetDescriptor()
     468                << ": No MCalibrationBlindCam found... no Blind Pixel method! " << endl;
    469469          return kFALSE;
    470470        }
     
    491491    {
    492492      *fLog << endl;
    493       *fLog << "MCalibrationChargePINDiode not found... no PIN Diode method! " << endl;
     493      *fLog << warn << GetDescriptor()
     494            << ": MCalibrationChargePINDiode not found... no PIN Diode method! " << endl;
    494495    }
    495496 
     
    649650// Call FinalizeFFactorMethod() (second and third loop over pixels and areas)
    650651//
    651 // Call FinalizeBlindPixel()
    652652// Call FinalizeBlindCam()
    653653// Call FinalizePINDiode()
     
    681681
    682682  *fLog << endl;
     683
     684  MCalibrationBlindCam  *blindcam  = fIntensBlind   
     685    ? (MCalibrationBlindCam*)fIntensBlind->GetCam() : fBlindCam;
     686  MCalibrationQECam     *qecam     = fIntensQE     
     687    ? (MCalibrationQECam*)    fIntensQE->GetCam()   : fQECam;
     688  MCalibrationChargeCam *chargecam = fIntensCam
     689    ? (MCalibrationChargeCam*)fIntensCam->GetCam()  : fCam;
     690  MBadPixelsCam         *badcam    = fIntensBad
     691    ? (MBadPixelsCam*)        fIntensBad->GetCam()  : fBadPixels;
     692
    683693  //
    684694  // First loop over pixels, call FinalizePedestals and FinalizeCharges
     
    689699    {
    690700
    691       MCalibrationChargePix &pix = fIntensCam
    692         ? (MCalibrationChargePix&)(*fIntensCam)[pixid]
    693         : (MCalibrationChargePix&)(*fCam)[pixid];
     701      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*chargecam)[pixid];
    694702      //
    695703      // Check if the pixel has been excluded from the fits
     
    699707
    700708      MPedestalPix  &ped = (*fPedestals)[pixid];
    701       MBadPixelsPix &bad = fIntensBad
    702         ? (*fIntensBad)[pixid]
    703         : (*fBadPixels)[pixid];
     709      MBadPixelsPix &bad = (*badcam)    [pixid];
     710
    704711      const Int_t aidx    = (*fGeom)[pixid].GetAidx();
    705712
     
    728735
    729736      const MPedestalPix     &ped = fPedestals->GetAverageArea(aidx);
    730       MCalibrationChargePix &pix = fIntensCam
    731         ? (MCalibrationChargePix&)fIntensCam->GetAverageArea(aidx)
    732         : (MCalibrationChargePix&)fCam->GetAverageArea(aidx);
     737      MCalibrationChargePix &pix = (MCalibrationChargePix&)chargecam->GetAverageArea(aidx);
    733738
    734739      FinalizePedestals(ped,pix,aidx);
     
    745750      const MPedestalPix     &ped = fPedestals->GetAverageSector(sector);
    746751
    747       MCalibrationChargePix &pix = fIntensCam
    748         ? (MCalibrationChargePix&)fIntensCam->GetAverageSector(sector)
    749         : (MCalibrationChargePix&)fCam->GetAverageSector(sector);
     752      MCalibrationChargePix &pix = (MCalibrationChargePix&)chargecam->GetAverageSector(sector);
    750753      FinalizePedestals(ped,pix, 0);
    751754    }
     
    761764  // Finalize F-Factor method
    762765  //
    763   if (!FinalizeFFactorMethod())
     766  if (FinalizeFFactorMethod())
     767    chargecam->SetFFactorMethodValid(kTRUE);
     768  else
    764769    {
    765770      *fLog << warn << "Could not calculate the photons flux from the F-Factor method " << endl;
    766       if (fIntensCam)
    767         fIntensCam->SetFFactorMethodValid(kFALSE);
    768       else
    769         fCam->SetFFactorMethodValid(kFALSE);
     771      chargecam->SetFFactorMethodValid(kFALSE);
    770772      return kFALSE;
    771773    }
    772   else
    773     if (fIntensCam)
    774       fIntensCam->SetFFactorMethodValid(kTRUE);
    775     else
    776       fCam->SetFFactorMethodValid(kTRUE);
    777  
     774
    778775  *fLog << endl;
    779776  //
    780777  // Finalize Blind Pixel
    781778  //
    782   if (fIntensQE)
    783     fIntensQE->SetBlindPixelMethodValid(FinalizeBlindCam());
    784   else
    785     fQECam->SetBlindPixelMethodValid(FinalizeBlindCam());
     779  qecam->SetBlindPixelMethodValid(FinalizeBlindCam());
    786780
    787781  //
    788782  // Finalize PIN Diode
    789783  //
    790   if (fIntensQE)
    791     fIntensQE->SetBlindPixelMethodValid(FinalizePINDiode());
    792   else
    793     fQECam->SetBlindPixelMethodValid(FinalizePINDiode());
     784  qecam->SetBlindPixelMethodValid(FinalizePINDiode());
    794785
    795786  //
     
    812803  FinalizeUnsuitablePixels();
    813804
    814   if (fIntensCam)
    815     fIntensCam->SetReadyToSave();
    816   else
    817     fCam      ->SetReadyToSave();
    818 
    819   if (fIntensQE)
    820     fIntensQE ->SetReadyToSave();
    821   else
    822     fQECam    ->SetReadyToSave();
    823 
    824   if (fIntensBad)
    825     fIntensBad->SetReadyToSave();
    826   else
    827     fBadPixels->SetReadyToSave();
    828 
    829   if (fIntensBlind)
    830     fIntensBlind->SetReadyToSave();
    831   if (fBlindCam)
    832     fBlindCam->SetReadyToSave();
     805  chargecam->SetReadyToSave();
     806  qecam    ->SetReadyToSave();
     807  badcam   ->SetReadyToSave();
     808 
     809  if (blindcam)
     810    blindcam->SetReadyToSave();
    833811  if (fPINDiode)
    834812    fPINDiode->SetReadyToSave();
     
    1021999{
    10221000 
    1023   for (Int_t i=0; i<fBadPixels->GetSize(); i++)
    1024     {
    1025      
    1026       MBadPixelsPix    &bad    = fIntensBad ? (*fIntensBad)[i] : (*fBadPixels)[i];
    1027       MCalibrationPix  &pix    = fIntensCam ? (*fIntensCam)[i] : (*fCam)[i];
     1001  MBadPixelsCam         *badcam    = fIntensBad
     1002    ? (MBadPixelsCam*)        fIntensBad->GetCam()  : fBadPixels;
     1003  MCalibrationChargeCam *chargecam = fIntensCam
     1004    ? (MCalibrationChargeCam*)fIntensCam->GetCam()  : fCam;
     1005
     1006  for (Int_t i=0; i<badcam->GetSize(); i++)
     1007    {
     1008     
     1009      MBadPixelsPix    &bad    = (*badcam)   [i];
     1010      MCalibrationPix  &pix    = (*chargecam)[i];
    10281011
    10291012      if (IsCheckDeadPixels())
     
    11041087{
    11051088
     1089  MBadPixelsCam         *badcam    = fIntensBad
     1090    ? (MBadPixelsCam*)        fIntensBad->GetCam()  : fBadPixels;
     1091  MCalibrationChargeCam *chargecam = fIntensCam
     1092    ? (MCalibrationChargeCam*)fIntensCam->GetCam()  : fCam;
     1093
    11061094  const Int_t npixels  = fGeom->GetNumPixels();
    11071095  const Int_t nareas   = fGeom->GetNumAreas();
     
    11271115    {
    11281116     
    1129       MCalibrationChargePix &pix = fIntensCam
    1130         ? (MCalibrationChargePix&)(*fIntensCam)[i]
    1131         : (MCalibrationChargePix&)(*fCam)  [i];
    1132       MBadPixelsPix         &bad = fIntensBad
    1133         ? (*fIntensBad)[i]
    1134         : (*fBadPixels)[i];
     1117      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*chargecam)[i];
     1118      MBadPixelsPix         &bad =                         (*badcam)[i];
    11351119     
    11361120      if (!pix.IsFFactorMethodValid())
     
    12441228    {
    12451229     
    1246       MCalibrationChargePix &pix = fIntensCam
    1247         ? (MCalibrationChargePix&)(*fIntensCam)[i]
    1248         : (MCalibrationChargePix&)(*fCam)[i];
     1230      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*chargecam)[i];
    12491231
    12501232      if (!pix.IsFFactorMethodValid())
    12511233        continue;
    12521234
    1253       MBadPixelsPix         &bad = fIntensBad
    1254         ? (*fIntensBad)[i]
    1255         : (*fBadPixels)[i];
     1235      MBadPixelsPix         &bad =           (*badcam)[i];
    12561236
    12571237      if (bad.IsUncalibrated(MBadPixelsPix::kChargeSigmaNotValid))
     
    13021282    {
    13031283
    1304       MCalibrationChargePix &apix = fIntensCam
    1305         ? (MCalibrationChargePix&)fIntensCam->GetAverageArea(aidx)
    1306         : (MCalibrationChargePix&)fCam->GetAverageArea(aidx);
     1284      MCalibrationChargePix &apix = (MCalibrationChargePix&)chargecam->GetAverageArea(aidx);
    13071285
    13081286      if (numareavalid[aidx] == 1)
     
    13611339        }
    13621340     
    1363       MCalibrationChargePix &spix = fIntensCam
    1364         ? (MCalibrationChargePix&)fIntensCam->GetAverageSector(sector)
    1365         : (MCalibrationChargePix&)fCam->GetAverageSector(sector);
     1341      MCalibrationChargePix &spix = (MCalibrationChargePix&)chargecam->GetAverageSector(sector);
    13661342
    13671343      if (sectorweights[sector] < 0. || sectorphes[sector] <= 0.)
     
    13931369    {
    13941370     
    1395       MCalibrationChargePix &pix = fIntensCam
    1396         ? (MCalibrationChargePix&)(*fIntensCam)[i]
    1397         : (MCalibrationChargePix&)(*fCam)[i];
    1398       MBadPixelsPix         &bad = fIntensBad
    1399         ? (*fIntensBad)[i]
    1400         : (*fBadPixels)[i];
     1371      MCalibrationChargePix &pix = (MCalibrationChargePix&)(*chargecam)[i];
     1372      MBadPixelsPix         &bad =                         (*badcam)[i];
    14011373
    14021374      if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
     
    14061378        {
    14071379          const Int_t            aidx = (*fGeom)[i].GetAidx();
    1408           MCalibrationChargePix &apix = fIntensCam
    1409             ? (MCalibrationChargePix&)fIntensCam->GetAverageArea(aidx)
    1410             : (MCalibrationChargePix&)fCam->GetAverageArea(aidx);
     1380          MCalibrationChargePix &apix = (MCalibrationChargePix&)chargecam->GetAverageArea(aidx);
     1381
    14111382          pix.SetPheFFactorMethod   ( apix.GetPheFFactorMethod()    );
    14121383          pix.SetPheFFactorMethodVar( apix.GetPheFFactorMethodVar() );
     
    14441415{
    14451416
    1446   if (!fBlindCam && !fIntensBlind)
    1447     return kFALSE; 
    1448 
    1449   Float_t flux    = 0.;
    1450   Float_t fluxvar = 0.; 
    1451   Int_t   nvalid  = 0;
    1452 
    14531417  MCalibrationBlindCam  *blindcam = fIntensBlind   
    14541418    ? (MCalibrationBlindCam*)fIntensBlind->GetCam() : fBlindCam;
    1455   MCalibrationQECam     *qecam    = fIntensQE     
    1456     ? (MCalibrationQECam*)fIntensQE->GetCam()    : fQECam;
    1457   MCalibrationChargeCam *chargecam = fIntensCam
    1458     ? (MCalibrationChargeCam*)fIntensCam->GetCam()  : fCam;
     1419
     1420  if (!blindcam)
     1421    return kFALSE; 
     1422
     1423  Int_t   nvalid  = 0;
    14591424
    14601425  for (Int_t i=0; i<blindcam->GetSize(); i++)
     
    14971462     
    14981463      nvalid++;
    1499       const Float_t weight = 1./ blindpix.GetFluxInsidePlexiglassErr() / blindpix.GetFluxInsidePlexiglassErr();
    1500       flux    += weight * blindpix.GetFluxInsidePlexiglass();
    1501       fluxvar += weight;
    15021464    }
    15031465
     
    15051467    return kFALSE;
    15061468 
    1507   flux    /= fluxvar;
    1508   fluxvar /= 1./fluxvar;
    1509 
    1510   const Float_t photons = flux * (*fGeom)[0].GetA() / qecam->GetPlexiglassQE();
    1511   chargecam->SetNumPhotonsBlindPixelMethod(photons);
    1512  
    1513   const Float_t photrelvar = fluxvar / flux / flux + qecam->GetPlexiglassQERelVar();
    1514   if (photrelvar > 0.)
    1515     chargecam->SetNumPhotonsBlindPixelMethodErr(TMath::Sqrt( photrelvar * photons * photons)); 
    1516 
    15171469  return kTRUE;
    15181470}
     
    16481600  // Set the results in the MCalibrationChargeCam
    16491601  //
    1650   charge->SetNumPhotonsFFactorMethod  (avphotons);
     1602  chargecam->SetNumPhotonsFFactorMethod (avphotons);
    16511603
    16521604  if (avphotrelvar > 0.)
    1653     charge->SetNumPhotonsFFactorMethodErr(TMath::Sqrt( avphotrelvar * avphotons * avphotons)); 
     1605    chargecam->SetNumPhotonsFFactorMethodErr(TMath::Sqrt( avphotrelvar * avphotons * avphotons)); 
    16541606
    16551607  TArrayF lowlim           (nareas);
     
    16661618    {
    16671619     
    1668       MCalibrationChargePix &avpix = (MCalibrationChargePix&)(*chargecam)[i];
     1620      MCalibrationChargePix &pix  = (MCalibrationChargePix&)(*chargecam)[i];
    16691621      MCalibrationQEPix     &qepix = (MCalibrationQEPix&)    (*qecam)    [i];
    1670       MBadPixelsPix         &bad                          (*badcam)   [i];
     1622      MBadPixelsPix         &bad   =                         (*badcam)   [i];
    16711623
    16721624      if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
     
    18431795{
    18441796
    1845   const UInt_t npixels  = fGeom->GetNumPixels();
    1846 
     1797
     1798  MCalibrationBlindCam  *blindcam  = fIntensBlind
     1799    ? (MCalibrationBlindCam*) fIntensBlind->GetCam(): fBlindCam;
     1800  MBadPixelsCam         *badcam    = fIntensBad
     1801    ? (MBadPixelsCam*)        fIntensBad->GetCam()  : fBadPixels;
    18471802  MCalibrationQECam     *qecam     = fIntensQE     
    18481803    ? (MCalibrationQECam*)    fIntensQE->GetCam()   : fQECam;
    18491804  MCalibrationChargeCam *chargecam = fIntensCam
    18501805    ? (MCalibrationChargeCam*)fIntensCam->GetCam()  : fCam;
    1851   MCalibrationBlindCam  *blindcam  = fIntensBlind
    1852     ? (MCalibrationBlindCam*) fIntensBlind->GetCam(): fBlindCam;
    1853   MBadPixelsCam         *badcam    = fIntensBad
    1854     ? (MBadPixelsCam*)        fIntensBad->GetCam()  : fBadPixels;
    18551806
    18561807  //
    18571808  // Set the results in the MCalibrationChargeCam
    18581809  //
    1859   /*
    1860   if (blindcam)
    1861     {
    1862       if (fBlindPixel->IsFluxInsidePlexiglassAvailable())
    1863         {
    1864 
    1865           const Float_t photons = fBlindPixel->GetFluxInsidePlexiglass() * (*fGeom)[0].GetA()
    1866                                / fQECam->GetPlexiglassQE();
    1867           if (fIntensCam)
    1868             fCam->SetNumPhotonsBlindPixelMethod(photons);
    1869           else
    1870             fCam->SetNumPhotonsBlindPixelMethod(photons);
    1871 
    1872           const Float_t photrelvar = fBlindPixel->GetFluxInsidePlexiglassRelVar()
    1873                                    + fQECam->GetPlexiglassQERelVar();
    1874           if (photrelvar > 0.)
    1875             if (fIntensCam)
    1876               fIntensCam->SetNumPhotonsBlindPixelMethodErr(TMath::Sqrt( photrelvar * photons * photons)); 
    1877             else
    1878               fCam->SetNumPhotonsBlindPixelMethodErr(TMath::Sqrt( photrelvar * photons * photons)); 
    1879         }
    1880     }
    1881   */
     1810  if (!blindcam || !(blindcam->IsFluxInsidePlexiglassAvailable()))
     1811    {
     1812 
     1813      const Float_t photons = blindcam->GetFluxInsidePlexiglass() * (*fGeom)[0].GetA()
     1814                           / qecam->GetPlexiglassQE();
     1815      chargecam->SetNumPhotonsBlindPixelMethod(photons);
     1816         
     1817      const Float_t photrelvar = blindcam->GetFluxInsidePlexiglassRelVar()
     1818                              + qecam->GetPlexiglassQERelVar();
     1819 
     1820      if (photrelvar > 0.)
     1821        chargecam->SetNumPhotonsBlindPixelMethodErr(TMath::Sqrt( photrelvar * photons * photons)); 
     1822    }
     1823 
    18821824  //
    18831825  //  With the knowledge of the overall photon flux, calculate the
    18841826  //  quantum efficiencies after the Blind Pixel and PIN Diode method
    18851827  //
     1828  const UInt_t npixels  = fGeom->GetNumPixels();
    18861829  for (UInt_t i=0; i<npixels; i++)
    18871830    {
     
    18891832      MCalibrationQEPix     &qepix = (MCalibrationQEPix&)    (*qecam)    [i];
    18901833     
    1891       if (!blindcam)
     1834      if (!blindcam || !(blindcam->IsFluxInsidePlexiglassAvailable()))
    18921835        {
    18931836          qepix.SetBlindPixelMethodValid(kFALSE, fPulserColor);
     
    19511894  MCalibrationChargeCam *chargecam = fIntensCam
    19521895    ? (MCalibrationChargeCam*)fIntensCam->GetCam()  : fCam;
    1953   MCalibrationBlindCam  *blindcam  = fIntensBlind
    1954     ? (MCalibrationBlindCam*) fIntensBlind->GetCam(): fBlindCam;
    19551896  MBadPixelsCam         *badcam    = fIntensBad
    19561897    ? (MBadPixelsCam*)        fIntensBad->GetCam()  : fBadPixels;
Note: See TracChangeset for help on using the changeset viewer.