Changeset 4841 for trunk/MagicSoft/Mars/manalysis/MPad.cc
- Timestamp:
- 09/03/04 14:48:31 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MPad.cc
r4584 r4841 67 67 68 68 #include "MBinning.h" 69 #include "MSigmabar.h"70 69 #include "MPointingPos.h" 71 70 #include "MLog.h" … … 82 81 #include "MPedPhotPix.h" 83 82 84 #include "MBlindPixels.h" 83 #include "MBadPixelsCam.h" 84 #include "MBadPixelsPix.h" 85 85 86 86 #include "MRead.h" 87 87 #include "MFilterList.h" 88 88 #include "MTaskList.h" 89 #include "MBlindPixelCalc.h" 90 #include "MHBlindPixels.h" 89 #include "MHBadPixels.h" 91 90 #include "MFillH.h" 92 91 #include "MHSigmaTheta.h" … … 124 123 fHgOFF = NULL; 125 124 126 fHBlindPixIdThetaMC = NULL;127 fHBlindPixIdThetaON = NULL;128 fHBlindPixIdThetaOFF = NULL;129 130 fHBlindPixNThetaMC = NULL;131 fHBlindPixNThetaON = NULL;132 fHBlindPixNThetaOFF = NULL;133 134 125 fHSigmaPedestal = NULL; 135 126 fHPhotons = NULL; 136 127 fHNSB = NULL; 128 129 fNamePedPhotCam = "MPedPhotCamFromData"; 137 130 } 138 131 … … 150 143 delete fHSigmaPixTheta; 151 144 delete fHDiffPixTheta; 152 delete fHBlindPixNTheta;153 delete fHBlindPixIdTheta;154 145 155 146 delete fHSigmaPedestal; … … 386 377 Bool_t MPad::MergeONOFFMC( 387 378 TH2D& sigthmc, TH3D& diffpixthmc, TH3D& sigmapixthmc, 388 TH2D& blindidthmc, TH2D& blindnthmc,389 379 TH2D& sigthon, TH3D& diffpixthon, TH3D& sigmapixthon, 390 TH2D& blindidthon, TH2D& blindnthon, 391 TH2D& sigthoff, TH3D& diffpixthoff, TH3D& sigmapixthoff, 392 TH2D& blindidthoff, TH2D& blindnthoff) 380 TH2D& sigthoff, TH3D& diffpixthoff, TH3D& sigmapixthoff) 393 381 { 394 382 //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ … … 439 427 *fLog << "after booking fHSigmaPixTheta" << endl; 440 428 441 fHBlindPixNTheta = new TH2D( (const TH2D&) blindnthon );442 fHBlindPixNTheta->SetNameTitle("2D-ThetaBlindN", "2D-ThetaBlindN (target)");443 444 *fLog << "after booking fHBlindPixNTheta" << endl;445 446 fHBlindPixIdTheta = new TH2D( (const TH2D&) blindidthon );447 fHBlindPixIdTheta->SetNameTitle("2D-ThetaBlindId", "2D-ThetaBlindId (target)");448 449 *fLog << "after booking fHBlindPixIdTheta" << endl;450 429 *fLog << all << "Histograms for the merged padding plots were booked" 451 430 << endl; … … 460 439 461 440 //*fLog << all << "addresses of SigmaTheta padding plots were copied" 462 // << endl;463 464 //--------------------------465 fHBlindPixNThetaMC = &blindnthmc;466 fHBlindPixNThetaMC->SetNameTitle("2D-ThetaBlindNMC", "2D-ThetaBlindNMC (orig.)");467 fHBlindPixNThetaON = &blindnthon;468 fHBlindPixNThetaON->SetNameTitle("2D-ThetaBlindNON", "2D-ThetaBlindNON (orig.)");469 fHBlindPixNThetaOFF = &blindnthoff;470 fHBlindPixNThetaOFF->SetNameTitle("2D-ThetaBlindNOFF", "2D-ThetaBlindNOFF (orig.)");471 472 //*fLog << all << "addresses of BlindPixTheta padding plots were copied"473 // << endl;474 475 //--------------------------476 fHBlindPixIdThetaMC = &blindidthmc;477 fHBlindPixIdThetaMC->SetNameTitle("2D-ThetaBlindIdMC", "2D-ThetaBlindIdMC (orig.)");478 fHBlindPixIdThetaON = &blindidthon;479 fHBlindPixIdThetaON->SetNameTitle("2D-ThetaBlindIdON", "2D-ThetaBlindIdON (orig.)");480 fHBlindPixIdThetaOFF = &blindidthoff;481 fHBlindPixIdThetaOFF->SetNameTitle("2D-ThetaBlindIdOFF", "2D-ThetaBlindIdOFF (orig.)");482 483 //*fLog << all << "addresses of BlindPixIdTheta padding plots were copied"484 441 // << endl; 485 442 … … 713 670 // (they are calculated as 714 671 // averages of the ON and OFF distributions) 715 // fHBlindPixNTheta, fHBlindPixIdTheta716 // (they are calculated as717 // the sum of the ON and OFF distributions)718 672 // (fHDiffPixTheta will be used in the padding of MC events) 719 673 … … 739 693 TH2D *histOFF; 740 694 741 TH1D *hist1;742 TH1D *hist1OFF;743 695 744 696 // weights for ON and OFF distrubtions when … … 812 764 delete hist; 813 765 delete histOFF; 814 815 816 //------------------------------------------------------------------817 // define target distribution 'number of blind pixels per event'818 ay = blindnthon.GetYaxis();819 Int_t nbinsn = ay->GetNbins();820 821 hist1 = fHBlindPixNThetaON->ProjectionY("", j, j, "");822 hist1->SetName("dummy");823 hist1OFF = fHBlindPixNThetaOFF->ProjectionY("", j, j, "");824 825 normON = hist1->Integral();826 normOFF = hist1OFF->Integral();827 if (normON != 0.0) hist1->Scale(1.0/normON);828 if (normOFF != 0.0) hist1OFF->Scale(1.0/normOFF);829 830 // sum of ON and OFF distributions831 hist1->Add(hist1OFF, 1.0);832 Stat_t sum1 = hist1->Integral();833 if (sum1 != 0.0) hist1->Scale( 1.0/sum1 );834 835 for (Int_t k=1; k<=nbinsn; k++)836 {837 Double_t cont = hist1->GetBinContent(k);838 fHBlindPixNTheta->SetBinContent(j, k, cont);839 }840 841 delete hist1;842 delete hist1OFF;843 844 //------------------------------------------------------------------845 // define target distribution 'id of blind pixel'846 ay = blindidthon.GetYaxis();847 Int_t nbinsid = ay->GetNbins();848 849 hist1 = fHBlindPixIdThetaON->ProjectionY("", j, j, "");850 hist1->SetName("dummy");851 hist1OFF = fHBlindPixIdThetaOFF->ProjectionY("", j, j, "");852 853 // divide by the number of events (from fHBlindPixNTheta)854 if (normON != 0.0) hist1->Scale(1.0/normON);855 if (normOFF != 0.0) hist1OFF->Scale(1.0/normOFF);856 857 // sum of ON and OFF distributions858 hist1->Add(hist1OFF, 1.0);859 860 for (Int_t k=1; k<=nbinsid; k++)861 {862 Double_t cont = hist1->GetBinContent(k);863 fHBlindPixIdTheta->SetBinContent(j, k, cont);864 }865 866 delete hist1;867 delete hist1OFF;868 766 } 869 767 //............ end of new loop over Theta bins .................... … … 887 785 fHSigmaPixThetaON->SetDirectory(NULL); 888 786 fHSigmaPixThetaOFF->SetDirectory(NULL); 889 890 fHBlindPixIdThetaMC->SetDirectory(NULL);891 fHBlindPixIdThetaON->SetDirectory(NULL);892 fHBlindPixIdThetaOFF->SetDirectory(NULL);893 894 fHBlindPixNThetaMC->SetDirectory(NULL);895 fHBlindPixNThetaON->SetDirectory(NULL);896 fHBlindPixNThetaOFF->SetDirectory(NULL);897 787 898 788 fHgMC->SetDirectory(NULL); … … 1001 891 Bool_t MPad::MergeONMC( 1002 892 TH2D& sigthmc, TH3D& diffpixthmc, TH3D& sigmapixthmc, 1003 TH2D& blindidthmc, TH2D& blindnthmc, 1004 TH2D& sigthon, TH3D& diffpixthon, TH3D& sigmapixthon, 1005 TH2D& blindidthon, TH2D& blindnthon) 893 TH2D& sigthon, TH3D& diffpixthon, TH3D& sigmapixthon) 1006 894 { 1007 895 *fLog << all << "----------------------------------------------------------------------------------" << endl; … … 1017 905 fHSigmaPixTheta = new TH3D( (TH3D&) sigmapixthon ); 1018 906 fHSigmaPixTheta->SetNameTitle("3D-ThetaPixSigma", "3D-ThetaPixSigma (target)"); 1019 1020 fHBlindPixNTheta = new TH2D( (TH2D&) blindnthon );1021 fHBlindPixNTheta->SetNameTitle("2D-ThetaBlindN", "2D-ThetaBlindN (target)");1022 1023 fHBlindPixIdTheta = new TH2D( (TH2D&) blindidthon );1024 fHBlindPixIdTheta->SetNameTitle("2D-ThetaBlindId", "2D-ThetaBlindId (target)");1025 907 1026 908 //-------------------------- … … 1029 911 fHSigmaThetaON = &sigthon; 1030 912 fHSigmaThetaON->SetNameTitle("2D-ThetaSigmabarON", "2D-ThetaSigmabarON (orig.)"); 1031 1032 //--------------------------1033 fHBlindPixNThetaMC = &blindnthmc;1034 fHBlindPixNThetaMC->SetNameTitle("2D-ThetaBlindNMC", "2D-ThetaBlindNMC (orig.)");1035 fHBlindPixNThetaON = &blindnthon;1036 fHBlindPixNThetaON->SetNameTitle("2D-ThetaBlindNON", "2D-ThetaBlindNON (orig.)");1037 1038 //--------------------------1039 fHBlindPixIdThetaMC = &blindidthmc;1040 fHBlindPixIdThetaMC->SetNameTitle("2D-ThetaBlindIdMC", "2D-ThetaBlindIdMC (orig.)");1041 fHBlindPixIdThetaON = &blindidthon;1042 fHBlindPixIdThetaON->SetNameTitle("2D-ThetaBlindIdON", "2D-ThetaBlindIdON (orig.)");1043 913 1044 914 //-------------------------- … … 1166 1036 // (they are calculated as 1167 1037 // averages of the ON and MCdistributions) 1168 // fHBlindPixNTheta, fHBlindPixIdTheta1169 // (they are calculated as1170 // the sum of the ON and MC distributions)1171 1038 // (fHDiffPixTheta will be used in the padding of MC events) 1172 1039 … … 1191 1058 TH2D *histMC; 1192 1059 1193 TH1D *hist1;1194 TH1D *hist1MC;1195 1060 1196 1061 // weights for ON and MC distrubtions when … … 1264 1129 delete hist; 1265 1130 delete histMC; 1266 1267 1268 1131 //------------------------------------------------------------------ 1269 // define target distribution 'number of blind pixels per event'1270 ay = blindnthon.GetYaxis();1271 Int_t nbinsn = ay->GetNbins();1272 1273 hist1 = fHBlindPixNThetaON->ProjectionY("", j, j, "");1274 hist1->SetName("dummy");1275 hist1MC = fHBlindPixNThetaMC->ProjectionY("", j, j, "");1276 1277 normON = hist1->Integral();1278 normMC = hist1MC->Integral();1279 if (normON != 0.0) hist1->Scale(1.0/normON);1280 if (normMC != 0.0) hist1MC->Scale(1.0/normMC);1281 1282 // sum of ON and MC distributions1283 hist1->Add(hist1MC, 1.0);1284 Stat_t sum1 = hist1->Integral();1285 if (sum1 != 0.0) hist1->Scale( 1.0/sum1 );1286 1287 for (Int_t k=1; k<=nbinsn; k++)1288 {1289 Double_t cont = hist1->GetBinContent(k);1290 fHBlindPixNTheta->SetBinContent(j, k, cont);1291 }1292 1293 delete hist1;1294 delete hist1MC;1295 1296 //------------------------------------------------------------------1297 // define target distribution 'id of blind pixel'1298 ay = blindidthon.GetYaxis();1299 Int_t nbinsid = ay->GetNbins();1300 1301 hist1 = fHBlindPixIdThetaON->ProjectionY("", j, j, "");1302 hist1->SetName("dummy");1303 hist1MC = fHBlindPixIdThetaMC->ProjectionY("", j, j, "");1304 1305 // divide by the number of events (from fHBlindPixNTheta)1306 if (normON != 0.0) hist1->Scale(1.0/normON);1307 if (normMC != 0.0) hist1MC->Scale(1.0/normMC);1308 1309 // sum of ON and MC distributions1310 hist1->Add(hist1MC, 1.0);1311 1312 for (Int_t k=1; k<=nbinsid; k++)1313 {1314 Double_t cont = hist1->GetBinContent(k);1315 fHBlindPixIdTheta->SetBinContent(j, k, cont);1316 }1317 1318 delete hist1;1319 delete hist1MC;1320 1132 } 1321 1133 //............ end of new loop over Theta bins .................... … … 1336 1148 fHSigmaPixThetaMC->SetDirectory(NULL); 1337 1149 fHSigmaPixThetaON->SetDirectory(NULL); 1338 1339 fHBlindPixIdThetaMC->SetDirectory(NULL);1340 fHBlindPixIdThetaON->SetDirectory(NULL);1341 1342 fHBlindPixNThetaMC->SetDirectory(NULL);1343 fHBlindPixNThetaON->SetDirectory(NULL);1344 1150 1345 1151 fHgMC->SetDirectory(NULL); … … 1594 1400 1595 1401 //------------------------------------ 1596 /*1597 fHBlindPixIdTheta =1598 (TH2D*) gROOT->FindObject("2D-ThetaBlindId");1599 if (!fHBlindPixIdTheta)1600 {1601 *fLog << all1602 << "MPad : Object '2D-ThetaBlindId' not found on root file"1603 << endl;1604 return kFALSE;1605 }1606 */1607 fHBlindPixIdTheta = new TH2D;1608 fHBlindPixIdTheta->Read("2D-ThetaBlindId");1609 *fLog << all1610 << "MPad : Object '2D-ThetaBlindId' was read in" << endl;1611 1612 /*1613 fHBlindPixIdThetaMC =1614 (TH2D*) gROOT->FindObject("2D-ThetaBlindIdMC");1615 if (!fHBlindPixIdThetaMC)1616 {1617 *fLog << all1618 << "MPad : Object '2D-ThetaBlindIdMC' not found on root file"1619 << endl;1620 return kFALSE;1621 }1622 */1623 fHBlindPixIdThetaMC = new TH2D;1624 fHBlindPixIdThetaMC->Read("2D-ThetaBlindIdMC");1625 *fLog << all1626 << "MPad : Object '2D-ThetaBlindIdMC' was read in" << endl;1627 1628 /*1629 fHBlindPixIdThetaON =1630 (TH2D*) gROOT->FindObject("2D-ThetaBlindIdON");1631 if (!fHBlindPixIdThetaON)1632 {1633 *fLog << all1634 << "MPad : Object '2D-ThetaBlindIdON' not found on root file"1635 << endl;1636 return kFALSE;1637 }1638 */1639 fHBlindPixIdThetaON = new TH2D;1640 fHBlindPixIdThetaON->Read("2D-ThetaBlindIdON");1641 *fLog << all1642 << "MPad : Object '2D-ThetaBlindIdON' was read in" << endl;1643 1644 /*1645 fHBlindPixIdThetaOFF =1646 (TH2D*) gROOT->FindObject("2D-ThetaBlindIdOFF");1647 if (!fHBlindPixIdThetaOFF)1648 {1649 *fLog << all1650 << "MPad : Object '2D-ThetaBlindIdOFF' not found on root file"1651 << endl;1652 return kFALSE;1653 }1654 */1655 fHBlindPixIdThetaOFF = new TH2D;1656 fHBlindPixIdThetaOFF->Read("2D-ThetaBlindIdOFF");1657 *fLog << all1658 << "MPad : Object '2D-ThetaBlindIdOFF' was read in" << endl;1659 1660 //------------------------------------1661 /*1662 fHBlindPixNTheta =1663 (TH2D*) gROOT->FindObject("2D-ThetaBlindN");1664 if (!fHBlindPixNTheta)1665 {1666 *fLog << all1667 << "MPad : Object '2D-ThetaBlindN' not found on root file"1668 << endl;1669 return kFALSE;1670 }1671 */1672 fHBlindPixNTheta = new TH2D;1673 fHBlindPixNTheta->Read("2D-ThetaBlindN");1674 *fLog << all1675 << "MPad : Object '2D-ThetaBlindN' was read in" << endl;1676 1677 /*1678 fHBlindPixNThetaMC =1679 (TH2D*) gROOT->FindObject("2D-ThetaBlindNMC");1680 if (!fHBlindPixNThetaMC)1681 {1682 *fLog << all1683 << "MPad : Object '2D-ThetaBlindNMC' not found on root file"1684 << endl;1685 return kFALSE;1686 }1687 */1688 fHBlindPixNThetaMC = new TH2D;1689 fHBlindPixNThetaMC->Read("2D-ThetaBlindNMC");1690 *fLog << all1691 << "MPad : Object '2D-ThetaBlindNMC' was read in" << endl;1692 1693 /*1694 fHBlindPixNThetaON =1695 (TH2D*) gROOT->FindObject("2D-ThetaBlindNON");1696 if (!fHBlindPixNThetaON)1697 {1698 *fLog << all1699 << "MPad : Object '2D-ThetaBlindNON' not found on root file"1700 << endl;1701 return kFALSE;1702 }1703 */1704 fHBlindPixNThetaON = new TH2D;1705 fHBlindPixNThetaON->Read("2D-ThetaBlindNON");1706 *fLog << all1707 << "MPad : Object '2D-ThetaBlindNON' was read in" << endl;1708 1709 /*1710 fHBlindPixNThetaOFF =1711 (TH2D*) gROOT->FindObject("2D-ThetaBlindNOFF");1712 if (!fHBlindPixNThetaOFF)1713 {1714 *fLog << all1715 << "MPad : Object '2D-ThetaBlindNOFF' not found on root file"1716 << endl;1717 return kFALSE;1718 }1719 */1720 fHBlindPixNThetaOFF = new TH2D;1721 fHBlindPixNThetaOFF->Read("2D-ThetaBlindNOFF");1722 *fLog << all1723 << "MPad : Object '2D-ThetaBlindNOFF' was read in" << endl;1724 1725 //------------------------------------1726 1402 1727 1403 return kTRUE; … … 1740 1416 1741 1417 TFile outfile(namefileout, "RECREATE"); 1742 1743 fHBlindPixNTheta->Write();1744 fHBlindPixNThetaMC->Write();1745 fHBlindPixNThetaON->Write();1746 fHBlindPixNThetaOFF->Write();1747 1748 fHBlindPixIdTheta->Write();1749 fHBlindPixIdThetaMC->Write();1750 fHBlindPixIdThetaON->Write();1751 fHBlindPixIdThetaOFF->Write();1752 1418 1753 1419 fHSigmaThetaMC->Write(); … … 1801 1467 if ( !fHSigmaThetaMC || !fHSigmaThetaON || !fHSigmaThetaOFF || 1802 1468 !fHDiffPixThetaMC || !fHDiffPixThetaON || !fHDiffPixThetaOFF || 1803 !fHBlindPixIdThetaMC|| !fHBlindPixIdThetaON|| !fHBlindPixIdThetaOFF ||1804 !fHBlindPixNThetaMC || !fHBlindPixNThetaON || !fHBlindPixNThetaOFF ||1805 1469 !fHgMC || !fHgON || !fHgOFF ) 1806 1470 { … … 1819 1483 } 1820 1484 1821 fPed = (MPedPhotCam*)pList->FindObject("MPedPhotCam"); 1822 if (!fPed) 1823 { 1824 *fLog << err << "MPad : MPedPhotCam not found... aborting." 1825 << endl; 1826 return kFALSE; 1827 } 1485 fPed = (MPedPhotCam*)pList->FindObject(AddSerialNumber(fNamePedPhotCam), "MPedPhotCam"); 1486 if (!fPed) 1487 { 1488 *fLog << err << AddSerialNumber(fNamePedPhotCam) 1489 << "[MPedPhotCam] not found... aborting." << endl; 1490 return kFALSE; 1491 } 1492 1828 1493 1829 1494 fCam = (MGeomCam*)pList->FindObject("MGeomCam"); … … 1844 1509 } 1845 1510 1846 fSigmabar = (MSigmabar*)pList->FindCreateObj("MSigmabar"); 1847 if (!fSigmabar) 1511 1512 fBad = (MBadPixelsCam*)pList->FindObject("MBadPixelsCam"); 1513 if (!fBad) 1848 1514 { 1849 *fLog << err << "MPad : MSigmabar not found... aborting." << endl; 1850 return kFALSE; 1515 *fLog << inf 1516 << "MPad : MBadPixelsCam container not present... continue." 1517 << endl; 1851 1518 } 1852 1519 1853 fBlindPix = (MBlindPixels*)pList->FindCreateObj("MBlindPixels");1854 if (!fBlindPix)1855 {1856 *fLog << err << "MPad : MBlindPixels not found... aborting."1857 << endl;1858 return kFALSE;1859 }1860 1520 1861 1521 if (fType !="ON" && fType !="OFF" && fType !="MC") … … 1905 1565 // input for the padding : 1906 1566 // - the matrices fHgON, fHgOFF, fHgMC 1907 // - the original distributions fHBlindPixNTheta, fHBlindPixIdTheta 1908 // fHSigmaTheta, fHDiffPixTheta 1567 // - the original distributions fHSigmaTheta, fHDiffPixTheta 1909 1568 // 1910 1569 … … 1963 1622 // 1964 1623 1965 fSigmabar->Calc(*fCam, *fPed, *fEvt);1966 1624 //*fLog << all << "MPad::Process(); before padding : " << endl; 1967 //fSigmabar->Print("");1968 1625 1969 1626 // inner sigmabar/sqrt(area) 1970 Double_t sigbarInnerold_phot = fSigmabar->GetSigmabarInner(); 1627 Double_t ratioinn = fCam->GetPixRatio(0); 1628 Double_t sigbarInnerold_phot = (fPed->GetArea(0)).GetRms() * sqrt(ratioinn); 1971 1629 Double_t sigbarInnerold = sigbarInnerold_phot * fPEperPhoton; 1972 1630 Double_t sigbarInnerold2 = sigbarInnerold*sigbarInnerold; 1973 1631 1974 1632 // outer sigmabar/sqrt(area) 1975 Double_t sigbarOuterold_phot = fSigmabar->GetSigmabarOuter(); 1633 Double_t ratioout = fCam->GetPixRatio(500); 1634 Double_t sigbarOuterold_phot = (fPed->GetArea(1)).GetRms() * sqrt(ratioout); 1976 1635 Double_t sigbarOuterold = sigbarOuterold_phot * fPEperPhoton; 1977 1636 Double_t sigbarOuterold2 = sigbarOuterold*sigbarOuterold; … … 1981 1640 //*fLog << all << "theta = " << theta << endl; 1982 1641 1983 Int_t binTheta = fH BlindPixNTheta->GetXaxis()->FindBin(theta);1984 if ( binTheta < 1 || binTheta > fH BlindPixNTheta->GetNbinsX() )1642 Int_t binTheta = fHSigmaThetaON->GetXaxis()->FindBin(theta); 1643 if ( binTheta < 1 || binTheta > fHSigmaThetaON->GetNbinsX() ) 1985 1644 { 1986 1645 *fLog << warn 1987 1646 << "MPad::Process(); binNumber out of range : theta, binTheta = " 1988 << theta << ", " << binTheta << "; aborting " <<endl;1647 << theta << ", " << binTheta << endl; 1989 1648 1990 1649 rc = 2; … … 2037 1696 2038 1697 //------------------------------------------- 2039 // for the current theta :2040 // generate blind pixels according to the histograms2041 // fHBlindPixNTheta and fHBlindPixIDTheta2042 //2043 // ON : add the blind pixels from the OFF data2044 // OFF : add the blind pixels from the ON data2045 // MC : add the blind pixels from the ON and OFF data2046 2047 //-----------------------------------2048 if (fType == "ON" || fType == "MC")2049 {2050 // numBlind is the number of blind pixels in an event2051 TH1D *nblind;2052 UInt_t numBlind;2053 2054 nblind = fHBlindPixNThetaOFF->ProjectionY("", binTheta, binTheta, "");2055 if ( nblind->Integral() == 0.0 )2056 {2057 *fLog << warn << "MPad::Process(); projection of '"2058 << fHBlindPixNThetaOFF->GetName() << "' for Theta bin "2059 << binTheta << " has no entries; aborting " << endl;2060 // event cannot be padded; skip event2061 delete nblind;2062 2063 rc = 7;2064 fErrors[rc]++;2065 return kCONTINUE;2066 }2067 else2068 {2069 numBlind = (Int_t) (nblind->GetRandom()+0.5);2070 }2071 delete nblind;2072 2073 2074 // throw the Id of numBlind different pixels in this event2075 if ( numBlind > 0)2076 {2077 TH1D *hblind;2078 UInt_t idBlind;2079 UInt_t listId[npix];2080 UInt_t nlist = 0;2081 Bool_t equal;2082 2083 hblind = fHBlindPixIdThetaOFF->ProjectionY("", binTheta, binTheta, "");2084 if ( hblind->Integral() > 0.0 )2085 for (UInt_t i=0; i<numBlind; i++)2086 {2087 while(1)2088 {2089 idBlind = (Int_t) (hblind->GetRandom()+0.5);2090 equal = kFALSE;2091 for (UInt_t j=0; j<nlist; j++)2092 if (idBlind == listId[j])2093 {2094 equal = kTRUE;2095 break;2096 }2097 if (!equal) break;2098 }2099 listId[nlist] = idBlind;2100 nlist++;2101 2102 fBlindPix->SetPixelBlind(idBlind);2103 //*fLog << all << "idBlind = " << idBlind << endl;2104 }2105 fBlindPix->SetReadyToSave();2106 2107 delete hblind;2108 }2109 }2110 2111 //------------------------------------2112 if (fType == "OFF" || fType == "MC")2113 {2114 // throw numBlind;2115 // numBlind is the number of blind pixels in an event2116 TH1D *nblind;2117 UInt_t numBlind;2118 2119 nblind = fHBlindPixNThetaON->ProjectionY("", binTheta, binTheta, "");2120 if ( nblind->Integral() == 0.0 )2121 {2122 *fLog << warn << "MPad::Process(); projection of '"2123 << fHBlindPixNThetaON->GetName() << "' for Theta bin "2124 << binTheta << " has no entries; Skip event " << endl;2125 delete nblind;2126 2127 rc = 7;2128 fErrors[rc]++;2129 return kCONTINUE;2130 }2131 else2132 {2133 numBlind = (Int_t) (nblind->GetRandom()+0.5);2134 }2135 delete nblind;2136 2137 2138 // throw the Id of numBlind different pixels in this event2139 if ( numBlind > 0)2140 {2141 TH1D *hblind;2142 UInt_t idBlind;2143 UInt_t listId[npix];2144 UInt_t nlist = 0;2145 Bool_t equal;2146 2147 hblind = fHBlindPixIdThetaON->ProjectionY("", binTheta, binTheta, "");2148 if ( hblind->Integral() > 0.0 )2149 for (UInt_t i=0; i<numBlind; i++)2150 {2151 while(1)2152 {2153 idBlind = (Int_t) (hblind->GetRandom()+0.5);2154 equal = kFALSE;2155 for (UInt_t j=0; j<nlist; j++)2156 if (idBlind == listId[j])2157 {2158 equal = kTRUE;2159 break;2160 }2161 if (!equal) break;2162 }2163 listId[nlist] = idBlind;2164 nlist++;2165 2166 fBlindPix->SetPixelBlind(idBlind);2167 //*fLog << all << "idBlind = " << idBlind << endl;2168 }2169 fBlindPix->SetReadyToSave();2170 2171 delete hblind;2172 }2173 }2174 1698 2175 1699 //****************************************************************** … … 2332 1856 // do the padding for each pixel 2333 1857 // 2334 // pad only pixels - which are used and not b lind (before image cleaning)1858 // pad only pixels - which are used and not bad (before image cleaning) 2335 1859 // 2336 1860 … … 2403 1927 MPedPhotPix &ppix = (*fPed)[j]; 2404 1928 2405 if ( fB lindPix != NULL && fBlindPix->IsBlind(j) )1929 if ( fBad != NULL && (*fBad)[j].IsUnsuitable() ) 2406 1930 { 2407 // this should never occur, because b lind pixels should have2408 // been set unused by MBlindPixelsCalc2::UnMap()2409 //*fLog << all << "MPad::Process; blind pixel found which is used, j = "2410 //<< j << "... go to next pixel." << endl;1931 // this should never occur, because bad pixels should have 1932 // been set unused 1933 *fLog << all << "MPad::Process; bad pixel found which is used, j = " 1934 << j << "... go to next pixel." << endl; 2411 1935 continue; 2412 1936 } … … 2569 2093 // Calculate sigmabar again and crosscheck 2570 2094 2571 fSigmabar->Calc(*fCam, *fPed, *fEvt);2572 2095 //*fLog << all << "MPad::Process(); after padding : " << endl; 2573 //fSigmabar->Print("");2574 2096 2575 2097 //*fLog << all << "Exit MPad::Process();" << endl; … … 2612 2134 << (int)(fErrors[4]*100/GetNumExecutions()) 2613 2135 << "%) Evts skipped due to: Target sigma <= Sigmabar_old" << endl; 2614 2615 *fLog << " " << setw(7) << fErrors[7] << " (" << setw(3)2616 << (int)(fErrors[7]*100/GetNumExecutions())2617 << "%) Evts skipped due to: No data for generating Blind pixels" << endl;2618 2136 2619 2137 *fLog << " " << setw(7) << fErrors[8] << " (" << setw(3) … … 2656 2174 fHSigmaTheta->DrawCopy(); 2657 2175 fHSigmaTheta->SetBit(kCanDelete); 2658 */2659 2660 //--------------------------------------------------------------------2661 2662 /*2663 c.cd(7);2664 fHBlindPixNTheta->SetDirectory(NULL);2665 fHBlindPixNTheta->SetTitle("(Target) 2D : no.of blind pixels, \\Theta");2666 fHBlindPixNTheta->DrawCopy();2667 fHBlindPixNTheta->SetBit(kCanDelete);2668 */2669 2670 //--------------------------------------------------------------------2671 2672 /*2673 c.cd(10);2674 fHBlindPixIdTheta->SetDirectory(NULL);2675 fHBlindPixIdTheta->SetTitle("(Target) 2D : blind pixel Id, \\Theta");2676 fHBlindPixIdTheta->DrawCopy();2677 fHBlindPixIdTheta->SetBit(kCanDelete);2678 2176 */ 2679 2177
Note:
See TracChangeset
for help on using the changeset viewer.