Ignore:
Timestamp:
08/18/04 00:12:13 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r4670 r4672  
    4949//                  - FinalizeBadPixels()
    5050//                  - FinalizeBlindPixel()
     51//                  - FinalizeBlindCam()
    5152//                  - FinalizePINDiode()
    5253//                  - FinalizeFFactorQECam()
     
    563564//
    564565// Call FinalizeBlindPixel()
     566// Call FinalizeBlindCam()
    565567// Call FinalizePINDiode()
    566568//
     
    684686  // Finalize Blind Pixel
    685687  //
    686   if (FinalizeBlindPixel())
    687     fQECam->SetBlindPixelMethodValid(kTRUE);
    688   else
    689     fQECam->SetBlindPixelMethodValid(kFALSE);
     688  if (fBlindPixel)
     689    if (FinalizeBlindPixel())
     690      fQECam->SetBlindPixelMethodValid(kTRUE);
     691    else
     692      fQECam->SetBlindPixelMethodValid(kFALSE);
     693  else
     694    if (FinalizeBlindCam())
     695      fQECam->SetBlindPixelMethodValid(kTRUE);
     696    else
     697      fQECam->SetBlindPixelMethodValid(kFALSE);
    690698
    691699  //
     
    11711179     
    11721180      *fLog << inf << GetDescriptor()
    1173             << "Average total number phes in area idx " << aidx << ": "
     1181            << ": Average total number phes in area idx " << aidx << ": "
    11741182            << Form("%7.2f%s%6.2f",areaphes[aidx]," +- ",TMath::Sqrt(areaweights[aidx])) << endl;
    11751183                   
     
    12141222
    12151223      *fLog << inf << GetDescriptor()
    1216             << "Average number phes per area in sector " << sector << ": "
     1224            << ": Average number phes per area in sector " << sector << ": "
    12171225            << Form("%5.2f+-%4.2f  [phe/mm^2]",sectorphes[sector],TMath::Sqrt(sectorweights[sector]))
    12181226            << endl;
     
    12741282    }
    12751283 
     1284  return kTRUE;
     1285}
     1286
     1287// ------------------------------------------------------------------------
     1288//
     1289// Returns kFALSE if pointer to MCalibrationChargeBlindCam is NULL
     1290//
     1291// The check returns kFALSE if:
     1292//
     1293// 1) fLambda and fLambdaCheck are separated relatively to each other by more than fLambdaCheckLimit
     1294// 2) BlindPixel has an fLambdaErr greater than fLambdaErrLimit
     1295//
     1296// Calls:
     1297// - MCalibrationChargeBlindPix::CalcFluxInsidePlexiglass()
     1298//
     1299Bool_t MCalibrationChargeCalc::FinalizeBlindCam()
     1300{
     1301
     1302  if (!fBlindCam)
     1303    return kFALSE; 
     1304
     1305  Float_t flux    = 0.;
     1306  Float_t fluxvar = 0.; 
     1307  Int_t   nvalid  = 0;
     1308
     1309  for (UInt_t i=0; i<fBlindCam->GetNumBlindPixels(); i++)
     1310    {
     1311     
     1312      MCalibrationChargeBlindPix &blindpix = (*fBlindCam)[i];
     1313
     1314      if (!blindpix.IsValid())
     1315        continue;
     1316     
     1317      const Float_t lambda      = blindpix.GetLambda();
     1318      const Float_t lambdaerr   = blindpix.GetLambdaErr();
     1319      const Float_t lambdacheck = blindpix.GetLambdaCheck();
     1320
     1321      if (2.*(lambdacheck-lambda)/(lambdacheck+lambda) > fLambdaCheckLimit)
     1322        {
     1323          *fLog << warn << GetDescriptor()
     1324                << Form("%s%4.2f%s%4.2f%s%4.2f%s%2i",": Lambda: ",lambda," and Lambda-Check: ",
     1325                    lambdacheck," differ by more than ",fLambdaCheckLimit," in the Blind Pixel Nr.",i)
     1326                << endl;
     1327          blindpix.SetValid(kFALSE);
     1328          continue;
     1329        }
     1330     
     1331      if (lambdaerr > fLambdaErrLimit)
     1332        {
     1333          *fLog << warn << GetDescriptor()
     1334                << Form("%s%4.2f%s%4.2f%s%2i",": Error of Fitted Lambda: ",lambdaerr," is greater than ",
     1335                        fLambdaErrLimit," in Blind Pixel Nr.",i) << endl;
     1336          blindpix.SetValid(kFALSE);
     1337          continue;
     1338        }
     1339     
     1340      if (!blindpix.CalcFluxInsidePlexiglass())
     1341        {
     1342          *fLog << warn << "Could not calculate the flux of photons from Blind Pixel Nr." << i << endl;
     1343          blindpix.SetValid(kFALSE);
     1344          continue;
     1345        }
     1346     
     1347      nvalid++;
     1348      const Float_t weight = 1./ blindpix.GetFluxInsidePlexiglassErr() / blindpix.GetFluxInsidePlexiglassErr();
     1349      flux    += weight * blindpix.GetFluxInsidePlexiglass();
     1350      fluxvar += weight;
     1351    }
     1352
     1353  if (!nvalid)
     1354    return kFALSE;
     1355 
     1356  flux    /= fluxvar;
     1357  fluxvar /= 1./fluxvar;
     1358
     1359  const Float_t photons = flux * (*fGeom)[0].GetA() / fQECam->GetPlexiglassQE();
     1360  fCam->SetNumPhotonsBlindPixelMethod(photons);
     1361 
     1362  const Float_t photrelvar = fluxvar / flux / flux + fQECam->GetPlexiglassQERelVar();
     1363  if (photrelvar > 0.)
     1364    fCam->SetNumPhotonsBlindPixelMethodErr(TMath::Sqrt( photrelvar * photons * photons)); 
     1365
    12761366  return kTRUE;
    12771367}
Note: See TracChangeset for help on using the changeset viewer.