Changeset 5032 for trunk/MagicSoft
- Timestamp:
- 09/15/04 15:43:19 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r5031 r5032 67 67 68 68 * mhcalib/MHCalibrationChargeCam.cc 69 * mcalib/MCalibrationChargeCalc.cc 69 70 - simply calls to IntensityCam somewhat 70 71 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
r5030 r5032 48 48 // - FinalizeFFactorMethod() 49 49 // - FinalizeBadPixels() 50 // - FinalizeBlindPixel()51 50 // - FinalizeBlindCam() 52 51 // - FinalizePINDiode() … … 466 465 { 467 466 *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; 469 469 return kFALSE; 470 470 } … … 491 491 { 492 492 *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; 494 495 } 495 496 … … 649 650 // Call FinalizeFFactorMethod() (second and third loop over pixels and areas) 650 651 // 651 // Call FinalizeBlindPixel()652 652 // Call FinalizeBlindCam() 653 653 // Call FinalizePINDiode() … … 681 681 682 682 *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 683 693 // 684 694 // First loop over pixels, call FinalizePedestals and FinalizeCharges … … 689 699 { 690 700 691 MCalibrationChargePix &pix = fIntensCam 692 ? (MCalibrationChargePix&)(*fIntensCam)[pixid] 693 : (MCalibrationChargePix&)(*fCam)[pixid]; 701 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*chargecam)[pixid]; 694 702 // 695 703 // Check if the pixel has been excluded from the fits … … 699 707 700 708 MPedestalPix &ped = (*fPedestals)[pixid]; 701 MBadPixelsPix &bad = fIntensBad 702 ? (*fIntensBad)[pixid] 703 : (*fBadPixels)[pixid]; 709 MBadPixelsPix &bad = (*badcam) [pixid]; 710 704 711 const Int_t aidx = (*fGeom)[pixid].GetAidx(); 705 712 … … 728 735 729 736 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); 733 738 734 739 FinalizePedestals(ped,pix,aidx); … … 745 750 const MPedestalPix &ped = fPedestals->GetAverageSector(sector); 746 751 747 MCalibrationChargePix &pix = fIntensCam 748 ? (MCalibrationChargePix&)fIntensCam->GetAverageSector(sector) 749 : (MCalibrationChargePix&)fCam->GetAverageSector(sector); 752 MCalibrationChargePix &pix = (MCalibrationChargePix&)chargecam->GetAverageSector(sector); 750 753 FinalizePedestals(ped,pix, 0); 751 754 } … … 761 764 // Finalize F-Factor method 762 765 // 763 if (!FinalizeFFactorMethod()) 766 if (FinalizeFFactorMethod()) 767 chargecam->SetFFactorMethodValid(kTRUE); 768 else 764 769 { 765 770 *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); 770 772 return kFALSE; 771 773 } 772 else 773 if (fIntensCam) 774 fIntensCam->SetFFactorMethodValid(kTRUE); 775 else 776 fCam->SetFFactorMethodValid(kTRUE); 777 774 778 775 *fLog << endl; 779 776 // 780 777 // Finalize Blind Pixel 781 778 // 782 if (fIntensQE) 783 fIntensQE->SetBlindPixelMethodValid(FinalizeBlindCam()); 784 else 785 fQECam->SetBlindPixelMethodValid(FinalizeBlindCam()); 779 qecam->SetBlindPixelMethodValid(FinalizeBlindCam()); 786 780 787 781 // 788 782 // Finalize PIN Diode 789 783 // 790 if (fIntensQE) 791 fIntensQE->SetBlindPixelMethodValid(FinalizePINDiode()); 792 else 793 fQECam->SetBlindPixelMethodValid(FinalizePINDiode()); 784 qecam->SetBlindPixelMethodValid(FinalizePINDiode()); 794 785 795 786 // … … 812 803 FinalizeUnsuitablePixels(); 813 804 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(); 833 811 if (fPINDiode) 834 812 fPINDiode->SetReadyToSave(); … … 1021 999 { 1022 1000 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]; 1028 1011 1029 1012 if (IsCheckDeadPixels()) … … 1104 1087 { 1105 1088 1089 MBadPixelsCam *badcam = fIntensBad 1090 ? (MBadPixelsCam*) fIntensBad->GetCam() : fBadPixels; 1091 MCalibrationChargeCam *chargecam = fIntensCam 1092 ? (MCalibrationChargeCam*)fIntensCam->GetCam() : fCam; 1093 1106 1094 const Int_t npixels = fGeom->GetNumPixels(); 1107 1095 const Int_t nareas = fGeom->GetNumAreas(); … … 1127 1115 { 1128 1116 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]; 1135 1119 1136 1120 if (!pix.IsFFactorMethodValid()) … … 1244 1228 { 1245 1229 1246 MCalibrationChargePix &pix = fIntensCam 1247 ? (MCalibrationChargePix&)(*fIntensCam)[i] 1248 : (MCalibrationChargePix&)(*fCam)[i]; 1230 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*chargecam)[i]; 1249 1231 1250 1232 if (!pix.IsFFactorMethodValid()) 1251 1233 continue; 1252 1234 1253 MBadPixelsPix &bad = fIntensBad 1254 ? (*fIntensBad)[i] 1255 : (*fBadPixels)[i]; 1235 MBadPixelsPix &bad = (*badcam)[i]; 1256 1236 1257 1237 if (bad.IsUncalibrated(MBadPixelsPix::kChargeSigmaNotValid)) … … 1302 1282 { 1303 1283 1304 MCalibrationChargePix &apix = fIntensCam 1305 ? (MCalibrationChargePix&)fIntensCam->GetAverageArea(aidx) 1306 : (MCalibrationChargePix&)fCam->GetAverageArea(aidx); 1284 MCalibrationChargePix &apix = (MCalibrationChargePix&)chargecam->GetAverageArea(aidx); 1307 1285 1308 1286 if (numareavalid[aidx] == 1) … … 1361 1339 } 1362 1340 1363 MCalibrationChargePix &spix = fIntensCam 1364 ? (MCalibrationChargePix&)fIntensCam->GetAverageSector(sector) 1365 : (MCalibrationChargePix&)fCam->GetAverageSector(sector); 1341 MCalibrationChargePix &spix = (MCalibrationChargePix&)chargecam->GetAverageSector(sector); 1366 1342 1367 1343 if (sectorweights[sector] < 0. || sectorphes[sector] <= 0.) … … 1393 1369 { 1394 1370 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]; 1401 1373 1402 1374 if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun)) … … 1406 1378 { 1407 1379 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 1411 1382 pix.SetPheFFactorMethod ( apix.GetPheFFactorMethod() ); 1412 1383 pix.SetPheFFactorMethodVar( apix.GetPheFFactorMethodVar() ); … … 1444 1415 { 1445 1416 1446 if (!fBlindCam && !fIntensBlind)1447 return kFALSE;1448 1449 Float_t flux = 0.;1450 Float_t fluxvar = 0.;1451 Int_t nvalid = 0;1452 1453 1417 MCalibrationBlindCam *blindcam = fIntensBlind 1454 1418 ? (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; 1459 1424 1460 1425 for (Int_t i=0; i<blindcam->GetSize(); i++) … … 1497 1462 1498 1463 nvalid++; 1499 const Float_t weight = 1./ blindpix.GetFluxInsidePlexiglassErr() / blindpix.GetFluxInsidePlexiglassErr();1500 flux += weight * blindpix.GetFluxInsidePlexiglass();1501 fluxvar += weight;1502 1464 } 1503 1465 … … 1505 1467 return kFALSE; 1506 1468 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 1517 1469 return kTRUE; 1518 1470 } … … 1648 1600 // Set the results in the MCalibrationChargeCam 1649 1601 // 1650 charge ->SetNumPhotonsFFactorMethod(avphotons);1602 chargecam->SetNumPhotonsFFactorMethod (avphotons); 1651 1603 1652 1604 if (avphotrelvar > 0.) 1653 charge ->SetNumPhotonsFFactorMethodErr(TMath::Sqrt( avphotrelvar * avphotons * avphotons));1605 chargecam->SetNumPhotonsFFactorMethodErr(TMath::Sqrt( avphotrelvar * avphotons * avphotons)); 1654 1606 1655 1607 TArrayF lowlim (nareas); … … 1666 1618 { 1667 1619 1668 MCalibrationChargePix & avpix= (MCalibrationChargePix&)(*chargecam)[i];1620 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*chargecam)[i]; 1669 1621 MCalibrationQEPix &qepix = (MCalibrationQEPix&) (*qecam) [i]; 1670 MBadPixelsPix &bad =(*badcam) [i];1622 MBadPixelsPix &bad = (*badcam) [i]; 1671 1623 1672 1624 if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun)) … … 1843 1795 { 1844 1796 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; 1847 1802 MCalibrationQECam *qecam = fIntensQE 1848 1803 ? (MCalibrationQECam*) fIntensQE->GetCam() : fQECam; 1849 1804 MCalibrationChargeCam *chargecam = fIntensCam 1850 1805 ? (MCalibrationChargeCam*)fIntensCam->GetCam() : fCam; 1851 MCalibrationBlindCam *blindcam = fIntensBlind1852 ? (MCalibrationBlindCam*) fIntensBlind->GetCam(): fBlindCam;1853 MBadPixelsCam *badcam = fIntensBad1854 ? (MBadPixelsCam*) fIntensBad->GetCam() : fBadPixels;1855 1806 1856 1807 // 1857 1808 // Set the results in the MCalibrationChargeCam 1858 1809 // 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 1882 1824 // 1883 1825 // With the knowledge of the overall photon flux, calculate the 1884 1826 // quantum efficiencies after the Blind Pixel and PIN Diode method 1885 1827 // 1828 const UInt_t npixels = fGeom->GetNumPixels(); 1886 1829 for (UInt_t i=0; i<npixels; i++) 1887 1830 { … … 1889 1832 MCalibrationQEPix &qepix = (MCalibrationQEPix&) (*qecam) [i]; 1890 1833 1891 if (!blindcam )1834 if (!blindcam || !(blindcam->IsFluxInsidePlexiglassAvailable())) 1892 1835 { 1893 1836 qepix.SetBlindPixelMethodValid(kFALSE, fPulserColor); … … 1951 1894 MCalibrationChargeCam *chargecam = fIntensCam 1952 1895 ? (MCalibrationChargeCam*)fIntensCam->GetCam() : fCam; 1953 MCalibrationBlindCam *blindcam = fIntensBlind1954 ? (MCalibrationBlindCam*) fIntensBlind->GetCam(): fBlindCam;1955 1896 MBadPixelsCam *badcam = fIntensBad 1956 1897 ? (MBadPixelsCam*) fIntensBad->GetCam() : fBadPixels;
Note:
See TracChangeset
for help on using the changeset viewer.