Ignore:
Timestamp:
08/12/04 06:58:34 (20 years ago)
Author:
wittek
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhist
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhist/MHSigmaTheta.cc

    r3339 r4584  
    2626//////////////////////////////////////////////////////////////////////////////
    2727//                                                                          //
    28 //  MHSigmaTheta (extension of Robert's MHSigmabarTheta)                    //
     28//  MHSigmaTheta                                                            //
    2929//                                                                          //
    30 //  calculates - the 2D-histogram   sigmabar vs. Theta, and                 //
     30//  calculates - the 2D-histogram   sigmabar vs. Theta (Inner), and         //
     31//             - the 2D-histogram   sigmabar vs. Theta (Outer)              //
    3132//             - the 3D-histogram   sigma, pixel no., Theta                 //
    3233//             - the 3D-histogram   (sigma^2-sigmabar^2), pixel no., Theta  //
     
    3940
    4041#include "MTime.h"
    41 #include "MMcEvt.hxx"
     42#include "MPointingPos.h"
    4243
    4344#include "MBinning.h"
     
    4647
    4748#include "MGeomCam.h"
     49#include "MBlindPixels.h"
    4850
    4951#include "MPedPhotCam.h"
     
    7072
    7173    fSigmaTheta.SetDirectory(NULL);
    72     fSigmaTheta.SetName("2D-ThetaSigmabar");
     74    fSigmaTheta.SetName("2D-ThetaSigmabar(Inner)");
    7375    fSigmaTheta.SetTitle("2D: \\bar{\\sigma}, \\Theta");
    7476    fSigmaTheta.SetXTitle("\\Theta [\\circ]");
    75     fSigmaTheta.SetYTitle("Sigmabar");
     77    fSigmaTheta.SetYTitle("Sigmabar(Inner) / SQRT(Area)");
     78
     79    fSigmaThetaOuter.SetDirectory(NULL);
     80    fSigmaThetaOuter.SetName("2D-ThetaSigmabar(Outer)");
     81    fSigmaThetaOuter.SetTitle("2D: \\bar{\\sigma}, \\Theta");
     82    fSigmaThetaOuter.SetXTitle("\\Theta [\\circ]");
     83    fSigmaThetaOuter.SetYTitle("Sigmabar(Outer) / SQRT(Area)");
    7684
    7785    fSigmaPixTheta.SetDirectory(NULL);
     
    8088    fSigmaPixTheta.SetXTitle("\\Theta [\\circ]");
    8189    fSigmaPixTheta.SetYTitle("Pixel Id");
    82     fSigmaPixTheta.SetZTitle("\\sigma");
     90    fSigmaPixTheta.SetZTitle("Sigma");
    8391
    8492    fDiffPixTheta.SetDirectory(NULL);
     
    8795    fDiffPixTheta.SetXTitle("\\Theta [\\circ]");
    8896    fDiffPixTheta.SetYTitle("Pixel Id");
    89     fDiffPixTheta.SetZTitle("{\\sigma}^{2}-\\bar{\\sigma}^{2}");
     97    fDiffPixTheta.SetZTitle("(Sigma2 - Sigmabar2)/Area");
    9098
    9199    // Set default binning
     
    102110    binspix.SetEdges(578, -0.5, 577.5);
    103111
    104     SetBinning(&fSigmaTheta,    &binst, &binsb);
    105     SetBinning(&fSigmaPixTheta, &binst, &binspix, &binsb);
    106     SetBinning(&fDiffPixTheta,  &binst, &binspix, &binsd);
     112    SetBinning(&fSigmaTheta,      &binst, &binsb);
     113    SetBinning(&fSigmaThetaOuter, &binst, &binsb);
     114    SetBinning(&fSigmaPixTheta,   &binst, &binspix, &binsb);
     115    SetBinning(&fDiffPixTheta,    &binst, &binspix, &binsd);
    107116}
    108117
     
    120129    }
    121130
    122     fMcEvt = (MMcEvt*)plist->FindObject("MMcEvt");
    123     if (!fMcEvt)
    124         *fLog << warn << "MMcEvt not found... aborting." << endl;
     131    fPointPos = (MPointingPos*)plist->FindObject("MPointingPos");
     132    if (!fPointPos)
     133        *fLog << warn << "MPointingPos not found... aborting." << endl;
    125134
    126135
     
    132141    }
    133142    fPed->InitSize(fCam->GetNumPixels());
     143
     144   
     145    fBlindPix = (MBlindPixels*)plist->FindObject("MBlindPixels");
     146    if (!fBlindPix)
     147    { 
     148       *fLog << err << "MBlindPixels not found... continue. " << endl;
     149    }
    134150
    135151
     
    177193    if (binssigma)
    178194    {
    179         SetBinning(&fSigmaTheta, binstheta, binssigma);
    180         SetBinning(&fSigmaPixTheta, binstheta, &binspix, binssigma);
     195        SetBinning(&fSigmaTheta,      binstheta, binssigma);
     196        SetBinning(&fSigmaThetaOuter, binstheta, binssigma);
     197        SetBinning(&fSigmaPixTheta,   binstheta, &binspix, binssigma);
    181198    }
    182199
     
    191208//  Fill the histograms
    192209//
     210//  ignore pixels if they are unused or blind
     211//
    193212Bool_t MHSigmaTheta::Fill(const MParContainer *par, const Stat_t w)
    194213{
    195     Double_t theta = fMcEvt ? fMcEvt->GetTelescopeTheta()*kRad2Deg : 0;
     214    Double_t theta = fPointPos->GetZd();
    196215    fSigmabar->Calc(*fCam, *fPed, *fEvt);
    197     Double_t mysig = fSigmabar->GetSigmabarInner();
    198 
    199     //*fLog << "theta, mysig = " << theta << ",  " << mysig << endl;
     216    Double_t mysig      = fSigmabar->GetSigmabarInner();
     217    Double_t mysigouter = fSigmabar->GetSigmabarOuter();
     218
     219    //*fLog << "theta, mysig, mysigouter = " << theta << ",  " << mysig
     220    //      << ",  " << mysigouter << endl;
    200221
    201222    fSigmaTheta.Fill(theta, mysig);
     223    fSigmaThetaOuter.Fill(theta, mysigouter);
    202224
    203225    const UInt_t npix = fEvt->GetNumPixels();
     
    205227    for (UInt_t i=0; i<npix; i++)
    206228    {
    207         MCerPhotPix cerpix = (*fEvt)[i];
     229        MCerPhotPix &cerpix = (*fEvt)[i];
     230        const Int_t id = cerpix.GetPixId();
     231
    208232        if (!cerpix.IsPixelUsed())
    209             continue;
    210 
    211         const Int_t id = cerpix.GetPixId();
     233        {
     234          //*fLog << all << "MHSigmaTheta::Fill; unused pixel found, id = "
     235          //      << id << endl;
     236          continue;
     237        }
     238
    212239        const MPedPhotPix &pix = (*fPed)[id];
     240
     241        if ( fBlindPix != NULL  &&  fBlindPix->IsBlind(id) )
     242        {
     243          // this should never occur, because blind pixels should have
     244          // been set unused by MBlindPixelsCalc2::UnMap()
     245          //*fLog << all << "MHSigmaTheta::Fill; blind pixel found which is used, id = "
     246          //      << id << "... go to next pixel." << endl;
     247          continue;
     248        }
    213249
    214250        // ratio is the area of pixel 0
     
    219255        fSigmaPixTheta.Fill(theta, (Double_t)id, sigma*sqrt(ratio));
    220256
    221         const Double_t diff = sigma*sigma*ratio - mysig*mysig;
     257        Double_t diff;
     258        if (ratio > 0.5)
     259        {
     260          // inner pixel
     261          diff = sigma*sigma*ratio - mysig*mysig;
     262        }
     263        else
     264        {
     265          // outer pixel
     266          diff = sigma*sigma*ratio - mysigouter*mysigouter;
     267        }
     268
    222269        fDiffPixTheta.Fill(theta, (Double_t)id, diff);
    223270    }
     
    262309    AppendPad("");
    263310
    264     pad->Divide(3, 2);
     311    pad->Divide(3, 3);
    265312
    266313    // draw the 2D histogram Sigmabar versus Theta
     
    283330    h->SetTitle("\\sigma_{ped}^{2}-\\bar{\\sigma}_{ped}^{2} vs. \\Theta (all pixels)");
    284331    h->SetXTitle("\\Theta [\\circ]");
    285     h->SetYTitle("\\sigma_{ped}^{2}-\\bar{\\sigma}_{ped}^{2}");
     332    h->SetYTitle("(Sigma2 - Sigmabar2) / Area");
    286333    h->Draw("box");
    287334    h->SetBit(kCanDelete);
     
    293340    h->SetTitle("\\sigma_{ped} vs. \\Theta (all pixels)");
    294341    h->SetXTitle("\\Theta [\\circ]");
    295     h->SetYTitle("\\sigma_{ped}");
     342    h->SetYTitle("Sigma");
    296343    h->Draw("box");
    297344    h->SetBit(kCanDelete);
     
    313360    h->SetTitle("\\sigma_{ped}^{2}-\\bar{\\sigma}_{ped}^{2} vs. pixel Id (all  \\Theta)");
    314361    h->SetXTitle("Pixel Id");
    315     h->SetYTitle("\\sigma_{ped}^{2}-\\bar{\\sigma}_{ped}^{2}");
     362    h->SetYTitle("Sigma2 - sigmabar2) / Area");
    316363    h->Draw("box");
    317364    h->SetBit(kCanDelete);
     
    323370    h->SetTitle("\\sigma_{ped} vs. pixel Id (all  \\Theta)");
    324371    h->SetXTitle("Pixel Id");
    325     h->SetYTitle("\\sigma_{ped}");
     372    h->SetYTitle("Sigma");
    326373    h->Draw("box");
    327374    h->SetBit(kCanDelete);
     
    329376    pad->cd(4);
    330377    fSigmaTheta.Draw(opt);
     378
     379    pad->cd(7);
     380    fSigmaThetaOuter.Draw(opt);
    331381
    332382    //pad->cd(8);
  • trunk/MagicSoft/Mars/mhist/MHSigmaTheta.h

    r2798 r4584  
    1616class MGeomCam;
    1717class MCerPhotEvt;
    18 class MMcEvt;
     18class MPointingPos;
    1919class MPedPhotCam;
    2020class MSigmabar;
    2121class MParList;
     22class MBlindPixels;
    2223
    2324
     
    2930    MCerPhotEvt    *fEvt;        //!
    3031    MSigmabar      *fSigmabar;   //!
    31     MMcEvt         *fMcEvt;      //!
    32  
    33     TH2D fSigmaTheta;    // 2D-distribution sigmabar versus Theta;
    34                          // sigmabar is the average pedestasl sigma in an event
     32    MPointingPos   *fPointPos;   //!
     33    MBlindPixels   *fBlindPix;   //!
     34
     35                           // sigmabar is the average pedestal sigma 
     36    TH2D fSigmaTheta;      // 2D-distribution sigmabar versus Theta (Inner)
     37    TH2D fSigmaThetaOuter; // 2D-distribution sigmabar versus Theta (Outer)
     38
    3539    TH3D fSigmaPixTheta; // 3D-distr.:Theta, pixel, pedestal sigma
    3640    TH3D fDiffPixTheta;  // 3D-distr.:Theta, pixel, sigma^2-sigmabar^2
     
    4650    const TH2D *GetSigmaTheta() { return &fSigmaTheta; }
    4751    const TH2D *GetSigmaTheta() const { return &fSigmaTheta; }
     52
     53    const TH2D *GetSigmaThetaOuter() { return &fSigmaThetaOuter; }
     54    const TH2D *GetSigmaThetaOuter() const { return &fSigmaThetaOuter; }
    4855
    4956    const TH3D *GetSigmaPixTheta() { return &fSigmaPixTheta; }
Note: See TracChangeset for help on using the changeset viewer.