Changeset 4159


Ignore:
Timestamp:
05/24/04 19:37:02 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r4158 r4159  
    529529// Call  FinalizeBlindPixelQECam() (fifth loop over pixels and areas)
    530530// Call  FinalizePINDiodeQECam() (sixth loop over pixels and areas)
     531//
     532// Call  FinalizeUnsuitablePixels()
    531533// 
    532534// Call MParContainer::SetReadyToSave() for fCam, fQECam, fBadPixels and
     
    609611
    610612      const MPedestalPix     &ped = fPedestals->GetAverageSector(sector);
     613
    611614      MCalibrationChargePix &pix = (MCalibrationChargePix&)fCam->GetAverageSector(sector);
    612615      FinalizePedestals(ped,pix, 0);
     
    928931        }
    929932
    930       //      if (bad.IsUnsuitable(MBadPixelsPix::kUnreliableRun))
     933      // if (bad.IsUnsuitable(MBadPixelsPix::kUnreliableRun))
    931934      //        continue;
    932935     
     
    970973
    971974  //
    972   // Second loop: Get weighted mean number of photo-electrons and its RMS excluding
     975  // Second loop: Get mean number of photo-electrons and its RMS excluding
    973976  //              pixels deviating by more than fPheErrLimit sigma.
    974977  //              Set the conversion factor FADC counts to photo-electrons
     
    10071010        }
    10081011     
    1009       const Float_t weight = 1./nvar;
    1010      
    1011       areaweights   [aidx]   += weight;
    1012       areaphes      [aidx]   += weight*nphe;
     1012      //      const Float_t weight = 1./nvar;
     1013      //      areaweights   [aidx]   += weight;
     1014      //      areaphes      [aidx]   += weight*nphe;
     1015      areaweights   [aidx]   += nphe*nphe;
     1016      areaphes      [aidx]   += nphe;
    10131017      numareavalid  [aidx]   ++;
    1014       sectorweights [sector] += weight;
    1015       sectorphes    [sector] += weight*nphe;
     1018      //       sectorweights [sector] += weight;
     1019      //      sectorphes    [sector] += weight*nphe;
     1020      sectorweights [sector] += nphe*nphe;
     1021      sectorphes    [sector] += nphe;
    10161022      numsectorvalid[sector] ++;
    10171023    }
     
    10221028      MCalibrationChargePix &apix = (MCalibrationChargePix&)fCam->GetAverageArea(aidx);
    10231029
     1030      areaweights[aidx] -=  areaphes[aidx]*areaphes[aidx]/numareavalid[aidx];
     1031      areaphes[aidx]    /=  numareavalid[aidx];
     1032      areaweights[aidx] /=  numareavalid[aidx]-1.;
     1033     
    10241034      if (areaweights[aidx] <= 0. || areaphes[aidx] <= 0.)
    10251035        {
    10261036          *fLog << warn << " Mean number of phe's from area index " << aidx << " cannot be calculated: "
    1027                 << " Sum of weights: "       << areaweights[aidx]
    1028                 << " Sum of weighted phes: " << areaphes[aidx]    << endl;
     1037                << " Mean number of phes: "  << areaphes[aidx]
     1038                << " Variance: " << areaweights[aidx]    << endl;
    10291039          apix.SetFFactorMethodValid(kFALSE);
    10301040          continue;
    10311041        }
    1032 
     1042     
    10331043      *fLog << inf << "Replacing number photo-electrons of average area idx " << aidx << ": "
    10341044            << Form("%5.3f%s%5.3f",apix.GetPheFFactorMethod()," +- ",apix.GetPheFFactorMethodErr()) << endl;
    10351045      *fLog << inf << "  by average number of photo-electrons from area idx " << aidx <<  ": "
    1036             << Form("%5.3f%s%5.3f",areaphes[aidx] / areaweights[aidx]," +- ",
    1037                     TMath::Sqrt(1./areaweights[aidx])) << endl;
    1038 
    1039       apix.SetPheFFactorMethod   ( areaphes[aidx]/ areaweights[aidx] );
    1040       apix.SetPheFFactorMethodVar(    1.         / areaweights[aidx] );     
     1046            << Form("%5.3f%s%5.3f",areaphes[aidx]," +- ",TMath::Sqrt(areaweights[aidx])) << endl;
     1047                   
     1048      //      apix.SetPheFFactorMethod   ( areaphes[aidx]/ areaweights[aidx] );
     1049      //      apix.SetPheFFactorMethodVar(    1.         / areaweights[aidx] );     
     1050      apix.SetPheFFactorMethod   ( areaphes[aidx] );
     1051      apix.SetPheFFactorMethodVar( areaweights[aidx] / numareavalid[aidx] );     
    10411052      apix.SetFFactorMethodValid ( kTRUE );
    10421053
     
    10461057    {
    10471058
     1059      sectorweights[sector] -=  sectorphes[sector]*sectorphes[sector]/numsectorvalid[sector];
     1060      sectorphes[sector]    /=  numsectorvalid[sector];
     1061      sectorweights[sector] /=  numsectorvalid[sector]-1.;
     1062
    10481063      MCalibrationChargePix &spix = (MCalibrationChargePix&)fCam->GetAverageSector(sector);
    10491064
     
    10511066        {
    10521067          *fLog << warn << " Mean number of phe's from sector " << sector << " cannot be calculated: "
    1053                 << " Sum of weights: "       << sectorweights[sector]
    1054                 << " Sum of weighted phes: " << sectorphes[sector]    << endl;
     1068                << " Mean number of phes: "  << sectorphes[sector]
     1069                << " Variance: "             << sectorweights[sector]    << endl;
    10551070          spix.SetFFactorMethodValid(kFALSE);
    10561071          continue;
     
    10601075            << Form("%5.3f%s%5.3f",spix.GetPheFFactorMethod()," +- ",spix.GetPheFFactorMethodErr()) << endl;
    10611076      *fLog << inf << "   by average number photo-electrons from sector " << sector <<  ": "
    1062             << Form("%5.3f%s%5.3f",sectorphes[sector]/ sectorweights[sector]," +- ",
    1063                     TMath::Sqrt(1./sectorweights[sector])) << endl;
    1064 
    1065       spix.SetPheFFactorMethod   ( sectorphes[sector]/ sectorweights[sector] );
    1066       spix.SetPheFFactorMethodVar(    1.        / sectorweights[sector] );     
     1077            << Form("%5.3f%s%5.3f",sectorphes[sector]," +- ",TMath::Sqrt(sectorweights[sector])) << endl;
     1078
     1079      //      spix.SetPheFFactorMethod   ( sectorphes[sector]/ sectorweights[sector] );
     1080      //      spix.SetPheFFactorMethodVar(    1.        / sectorweights[sector] );     
     1081      spix.SetPheFFactorMethod   ( sectorphes[sector] );
     1082      spix.SetPheFFactorMethodVar( sectorweights[sector] / numsectorvalid[sector]);     
    10671083      spix.SetFFactorMethodValid ( kTRUE );
    10681084
Note: See TracChangeset for help on using the changeset viewer.