Ignore:
Timestamp:
09/03/04 14:48:31 (20 years ago)
Author:
wittek
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/MPad.cc

    r4584 r4841  
    6767
    6868#include "MBinning.h"
    69 #include "MSigmabar.h"
    7069#include "MPointingPos.h"
    7170#include "MLog.h"
     
    8281#include "MPedPhotPix.h"
    8382
    84 #include "MBlindPixels.h"
     83#include "MBadPixelsCam.h"
     84#include "MBadPixelsPix.h"
    8585
    8686#include "MRead.h"
    8787#include "MFilterList.h"
    8888#include "MTaskList.h"
    89 #include "MBlindPixelCalc.h"
    90 #include "MHBlindPixels.h"
     89#include "MHBadPixels.h"
    9190#include "MFillH.h"
    9291#include "MHSigmaTheta.h"
     
    124123  fHgOFF = NULL;
    125124
    126   fHBlindPixIdThetaMC  = NULL;
    127   fHBlindPixIdThetaON  = NULL;
    128   fHBlindPixIdThetaOFF = NULL;
    129 
    130   fHBlindPixNThetaMC   = NULL;
    131   fHBlindPixNThetaON   = NULL;
    132   fHBlindPixNThetaOFF  = NULL;
    133 
    134125  fHSigmaPedestal = NULL;
    135126  fHPhotons       = NULL;
    136127  fHNSB           = NULL;
     128
     129  fNamePedPhotCam = "MPedPhotCamFromData";
    137130}
    138131
     
    150143  delete fHSigmaPixTheta;
    151144  delete fHDiffPixTheta;
    152   delete fHBlindPixNTheta;
    153   delete fHBlindPixIdTheta;
    154145
    155146  delete fHSigmaPedestal;
     
    386377Bool_t MPad::MergeONOFFMC(
    387378   TH2D& sigthmc,  TH3D& diffpixthmc,  TH3D& sigmapixthmc,
    388    TH2D& blindidthmc,  TH2D& blindnthmc,
    389379   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)
    393381{
    394382  //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
     
    439427  *fLog << "after booking fHSigmaPixTheta" << endl;
    440428
    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;
    450429  *fLog << all << "Histograms for the merged padding plots were booked"
    451430        << endl;
     
    460439
    461440  //*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"
    484441  //      << endl;
    485442
     
    713670  //               (they are calculated as
    714671  //               averages of the ON and OFF distributions)
    715   //        fHBlindPixNTheta, fHBlindPixIdTheta
    716   //               (they are calculated as
    717   //               the sum of the ON and OFF distributions)
    718672  // (fHDiffPixTheta will be used in the padding of MC events)
    719673
     
    739693    TH2D *histOFF;
    740694
    741     TH1D *hist1;
    742     TH1D *hist1OFF;
    743695
    744696    // weights for ON and OFF distrubtions when
     
    812764    delete hist;
    813765    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 distributions
    831     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 distributions
    858     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;
    868766  }
    869767  //............   end of new loop over Theta bins   ....................
     
    887785  fHSigmaPixThetaON->SetDirectory(NULL);
    888786  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);
    897787
    898788  fHgMC->SetDirectory(NULL);
     
    1001891Bool_t MPad::MergeONMC(
    1002892   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)
    1006894{
    1007895  *fLog << all << "----------------------------------------------------------------------------------" << endl;
     
    1017905  fHSigmaPixTheta = new TH3D( (TH3D&) sigmapixthon );
    1018906  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)");
    1025907
    1026908  //--------------------------
     
    1029911  fHSigmaThetaON = &sigthon;
    1030912  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.)");
    1043913
    1044914  //--------------------------
     
    11661036  //               (they are calculated as
    11671037  //               averages of the ON and MCdistributions)
    1168   //        fHBlindPixNTheta, fHBlindPixIdTheta
    1169   //               (they are calculated as
    1170   //               the sum of the ON and MC distributions)
    11711038  // (fHDiffPixTheta will be used in the padding of MC events)
    11721039
     
    11911058    TH2D *histMC;
    11921059
    1193     TH1D *hist1;
    1194     TH1D *hist1MC;
    11951060
    11961061    // weights for ON and MC distrubtions when
     
    12641129    delete hist;
    12651130    delete histMC;
    1266 
    1267 
    12681131    //------------------------------------------------------------------
    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 distributions
    1283     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 distributions
    1310     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;
    13201132  }
    13211133  //............   end of new loop over Theta bins   ....................
     
    13361148  fHSigmaPixThetaMC->SetDirectory(NULL);
    13371149  fHSigmaPixThetaON->SetDirectory(NULL);
    1338 
    1339   fHBlindPixIdThetaMC->SetDirectory(NULL);
    1340   fHBlindPixIdThetaON->SetDirectory(NULL);
    1341 
    1342   fHBlindPixNThetaMC->SetDirectory(NULL);
    1343   fHBlindPixNThetaON->SetDirectory(NULL);
    13441150
    13451151  fHgMC->SetDirectory(NULL);
     
    15941400
    15951401    //------------------------------------
    1596       /*
    1597       fHBlindPixIdTheta =
    1598       (TH2D*) gROOT->FindObject("2D-ThetaBlindId");
    1599       if (!fHBlindPixIdTheta)
    1600         {
    1601           *fLog << all
    1602                 << "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 << all
    1610             << "MPad : Object '2D-ThetaBlindId' was read in" << endl;
    1611 
    1612       /*
    1613       fHBlindPixIdThetaMC =
    1614       (TH2D*) gROOT->FindObject("2D-ThetaBlindIdMC");
    1615       if (!fHBlindPixIdThetaMC)
    1616         {
    1617           *fLog << all
    1618                 << "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 << all
    1626             << "MPad : Object '2D-ThetaBlindIdMC' was read in" << endl;
    1627 
    1628       /*
    1629       fHBlindPixIdThetaON =
    1630       (TH2D*) gROOT->FindObject("2D-ThetaBlindIdON");
    1631       if (!fHBlindPixIdThetaON)
    1632         {
    1633           *fLog << all
    1634                 << "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 << all
    1642             << "MPad : Object '2D-ThetaBlindIdON' was read in" << endl;
    1643 
    1644       /*
    1645       fHBlindPixIdThetaOFF =
    1646       (TH2D*) gROOT->FindObject("2D-ThetaBlindIdOFF");
    1647       if (!fHBlindPixIdThetaOFF)
    1648         {
    1649           *fLog << all
    1650                 << "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 << all
    1658             << "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 << all
    1667                 << "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 << all
    1675             << "MPad : Object '2D-ThetaBlindN' was read in" << endl;
    1676 
    1677       /*
    1678       fHBlindPixNThetaMC =
    1679       (TH2D*) gROOT->FindObject("2D-ThetaBlindNMC");
    1680       if (!fHBlindPixNThetaMC)
    1681         {
    1682           *fLog << all
    1683                 << "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 << all
    1691             << "MPad : Object '2D-ThetaBlindNMC' was read in" << endl;
    1692 
    1693       /*
    1694       fHBlindPixNThetaON =
    1695       (TH2D*) gROOT->FindObject("2D-ThetaBlindNON");
    1696       if (!fHBlindPixNThetaON)
    1697         {
    1698           *fLog << all
    1699                 << "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 << all
    1707             << "MPad : Object '2D-ThetaBlindNON' was read in" << endl;
    1708 
    1709       /*
    1710       fHBlindPixNThetaOFF =
    1711       (TH2D*) gROOT->FindObject("2D-ThetaBlindNOFF");
    1712       if (!fHBlindPixNThetaOFF)
    1713         {
    1714           *fLog << all
    1715                 << "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 << all
    1723             << "MPad : Object '2D-ThetaBlindNOFF' was read in" << endl;
    1724 
    1725     //------------------------------------
    17261402
    17271403  return kTRUE;
     
    17401416
    17411417  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();
    17521418
    17531419  fHSigmaThetaMC->Write();
     
    18011467  if ( !fHSigmaThetaMC     || !fHSigmaThetaON     || !fHSigmaThetaOFF      || 
    18021468       !fHDiffPixThetaMC   || !fHDiffPixThetaON   || !fHDiffPixThetaOFF    ||
    1803        !fHBlindPixIdThetaMC|| !fHBlindPixIdThetaON|| !fHBlindPixIdThetaOFF ||
    1804        !fHBlindPixNThetaMC || !fHBlindPixNThetaON || !fHBlindPixNThetaOFF  ||
    18051469       !fHgMC              || !fHgON              || !fHgOFF                 )
    18061470  {
     
    18191483    }
    18201484 
    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
    18281493
    18291494   fCam = (MGeomCam*)pList->FindObject("MGeomCam");
     
    18441509     }
    18451510
    1846    fSigmabar = (MSigmabar*)pList->FindCreateObj("MSigmabar");
    1847    if (!fSigmabar)
     1511
     1512   fBad = (MBadPixelsCam*)pList->FindObject("MBadPixelsCam");
     1513   if (!fBad)
    18481514     {
    1849        *fLog << err << "MPad : MSigmabar not found... aborting." << endl;
    1850        return kFALSE;
     1515       *fLog << inf
     1516             << "MPad : MBadPixelsCam container not present... continue."
     1517             << endl;
    18511518     }
    18521519
    1853    fBlindPix = (MBlindPixels*)pList->FindCreateObj("MBlindPixels");
    1854    if (!fBlindPix)
    1855      {
    1856        *fLog << err << "MPad : MBlindPixels not found... aborting."
    1857              << endl;
    1858        return kFALSE;
    1859      }
    18601520   
    18611521   if (fType !="ON"  &&  fType !="OFF"  &&  fType !="MC")
     
    19051565// input for the padding :
    19061566//  - the matrices fHgON, fHgOFF, fHgMC
    1907 //  - the original distributions fHBlindPixNTheta, fHBlindPixIdTheta
    1908 //                               fHSigmaTheta, fHDiffPixTheta
     1567//  - the original distributions fHSigmaTheta, fHDiffPixTheta
    19091568//
    19101569
     
    19631622  //
    19641623
    1965   fSigmabar->Calc(*fCam, *fPed, *fEvt);
    19661624  //*fLog << all << "MPad::Process(); before padding : " << endl;
    1967   //fSigmabar->Print("");
    19681625
    19691626  // 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);
    19711629  Double_t sigbarInnerold  = sigbarInnerold_phot * fPEperPhoton;
    19721630  Double_t sigbarInnerold2 = sigbarInnerold*sigbarInnerold;
    19731631
    19741632  // 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);
    19761635  Double_t sigbarOuterold  = sigbarOuterold_phot * fPEperPhoton;
    19771636  Double_t sigbarOuterold2 = sigbarOuterold*sigbarOuterold;
     
    19811640  //*fLog << all << "theta = " << theta << endl;
    19821641
    1983   Int_t binTheta = fHBlindPixNTheta->GetXaxis()->FindBin(theta);
    1984   if ( binTheta < 1  ||  binTheta > fHBlindPixNTheta->GetNbinsX() )
     1642  Int_t binTheta = fHSigmaThetaON->GetXaxis()->FindBin(theta);
     1643  if ( binTheta < 1  ||  binTheta > fHSigmaThetaON->GetNbinsX() )
    19851644  {
    19861645    *fLog << warn
    19871646          << "MPad::Process(); binNumber out of range : theta, binTheta = "
    1988           << theta << ",  " << binTheta << ";  aborting " << endl;
     1647          << theta << ",  " << binTheta << endl;
    19891648
    19901649    rc = 2;
     
    20371696 
    20381697  //-------------------------------------------
    2039   // for the current theta :
    2040   //     generate blind pixels according to the histograms
    2041   //     fHBlindPixNTheta and fHBlindPixIDTheta
    2042   //
    2043   // ON  : add the blind pixels from the OFF data
    2044   // OFF : add the blind pixels from the ON data
    2045   // MC  : add the blind pixels from the ON and OFF data
    2046 
    2047   //-----------------------------------
    2048   if (fType == "ON"  ||  fType == "MC")
    2049   {
    2050     // numBlind is the number of blind pixels in an event
    2051     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 event
    2061       delete nblind;
    2062 
    2063       rc = 7;
    2064       fErrors[rc]++;
    2065       return kCONTINUE;
    2066     }
    2067     else
    2068     {
    2069       numBlind = (Int_t) (nblind->GetRandom()+0.5);
    2070     }
    2071     delete nblind;
    2072 
    2073 
    2074     // throw the Id of numBlind different pixels in this event
    2075     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 event
    2116     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     else
    2132     {
    2133       numBlind = (Int_t) (nblind->GetRandom()+0.5);
    2134     }
    2135     delete nblind;
    2136 
    2137 
    2138     // throw the Id of numBlind different pixels in this event
    2139     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   }
    21741698
    21751699  //******************************************************************
     
    23321856  // do the padding for each pixel
    23331857  //
    2334   // pad only pixels   - which are used and not blind (before image cleaning)
     1858  // pad only pixels   - which are used and not bad (before image cleaning)
    23351859  //
    23361860
     
    24031927    MPedPhotPix &ppix = (*fPed)[j];
    24041928
    2405     if ( fBlindPix != NULL  &&  fBlindPix->IsBlind(j) )
     1929    if ( fBad != NULL  &&  (*fBad)[j].IsUnsuitable() )
    24061930    {
    2407        // this should never occur, because blind pixels should have
    2408        // 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;
    24111935       continue;
    24121936    }   
     
    25692093  // Calculate sigmabar again and crosscheck
    25702094
    2571   fSigmabar->Calc(*fCam, *fPed, *fEvt);
    25722095  //*fLog << all << "MPad::Process(); after padding : " << endl;
    2573   //fSigmabar->Print("");
    25742096
    25752097  //*fLog << all << "Exit MPad::Process();" << endl;
     
    26122134          << (int)(fErrors[4]*100/GetNumExecutions())
    26132135          << "%) 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;
    26182136
    26192137    *fLog << " " << setw(7) << fErrors[8] << " (" << setw(3)
     
    26562174    fHSigmaTheta->DrawCopy();     
    26572175    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);     
    26782176    */
    26792177
Note: See TracChangeset for help on using the changeset viewer.