Ignore:
Timestamp:
08/03/04 16:39:27 (20 years ago)
Author:
hbartko
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/manalysis
Files:
2 edited

Legend:

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

    r2781 r4444  
    1717!
    1818!   Author(s): Thomas Bretz, 10/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
     19!              Hendrik Bartko, 08/2004 <mailto:hbartko@mppmu.mpg.de>
    1920!
    2021!   Copyright: MAGIC Software Development, 2000-2003
     
    3435
    3536#include "MGeomCam.h"
     37#include "MGeomPix.h"
    3638
    3739#include "MLog.h"
     
    5759}
    5860
     61/*
    5962// --------------------------------------------------------------------------
    6063//
    6164// This is not yet implemented like it should.
    6265//
    63 /*
     66
    6467void MCameraData::Draw(Option_t* option)
    6568{
     
    7679}
    7780*/
     81
     82
     83// --------------------------------------------------------------------------
     84//
     85// Function to calculate the cleaning level for all pixels in a given event
     86// as the ratio between the measured photons and the pedestal rms.
     87// In order to do the image cleaning on average in the same photon flux
     88// (reconstructed photons per pixel area) for the inner and outer pixels,
     89// a correction factor is applied to the outer pixels (see TDAS 02-14).
     90// The correction factor assumes the ideal case that the pedestal rms
     91// scales with the inverse square root of the pixel area.
     92//
    7893
    7994void MCameraData::CalcCleaningLevel(const MCerPhotEvt &evt, const MPedPhotCam &cam,
     
    113128}
    114129
     130// --------------------------------------------------------------------------
     131//
     132// Function to calculate the cleaning level for all pixels in a given event
     133// as the ratio between the measured photons and the pedestal rms.
     134// In order to do the image cleaning on average in the same photon flux
     135// (reconstructed photons per pixel area) for the inner and outer pixels,
     136// a correction factor is applied to the outer pixels (see TDAS 02-14).
     137// The correction factor takes the actual average pedestal RMS of the
     138// inner and outer pixels into account.
     139//
     140
     141void MCameraData::CalcCleaningLevel2(const MCerPhotEvt &evt, const MPedPhotCam &cam,
     142                                    const MGeomCam &geom)
     143{
     144    const Int_t n = geom.GetNumPixels();
     145
     146    fData.Set(n);
     147    fData.Reset();
     148
     149    fValidity.Set(n);
     150    fValidity.Reset();
     151
     152    const Int_t entries = evt.GetNumPixels();
     153
     154    const Float_t meannoise[2] = {cam.GetArea(0).GetRms(), cam.GetArea(1).GetRms()} ; // mean noise for the inner and the outer pixels
     155
     156    //
     157    // check the number of all pixels against the noise level and
     158    // set them to 'unused' state if necessary
     159    //
     160    for (Int_t i=0; i<entries; i++)
     161    {
     162        const MCerPhotPix &pix = evt[i];
     163
     164        const Int_t idx = pix.GetPixId();
     165        const Float_t noise = cam[idx].GetRms();
     166
     167        if (noise<=0) // fData[idx]=0, fValidity[idx]=0
     168            continue;
     169
     170        //
     171        // We calculate a correction factor which accounts for the
     172        // fact that pixels have different size (see TDAS 02-14).
     173        // We also take into account that the RMS does not scale
     174        // with the square root of the pixel area.
     175        //
     176
     177        const UInt_t aidx = geom[idx].GetAidx();
     178
     179
     180        if (meannoise[0] > 0 && meannoise[1] > 0) 
     181        {
     182          fData[idx] = pix.GetNumPhotons() * geom.GetPixRatio(idx) * meannoise[aidx] / meannoise[0] / noise;
     183         
     184        }
     185        else fData[idx] = pix.GetNumPhotons() * geom.GetPixRatioSqrt(idx) / noise;
     186
     187        fValidity[idx] = 1;
     188    }
     189}
     190
     191
    115192void MCameraData::CalcCleaningLevel(const MCerPhotEvt &evt, const MSigmabar &sgb,
    116193                                    const MGeomCam &geom)
     
    154231}
    155232
     233
     234// --------------------------------------------------------------------------
     235//
     236// Function to calculate the cleaning level for all pixels in a given event
     237// as the ratio between the reconstructed number of photons per area of an
     238// inner pixel and the average pedestal RMS of the inner pixels (democratic
     239// image cleaning, see TDAS 02-14).
     240
     241
     242void MCameraData::CalcCleaningLevelDemocratic(const MCerPhotEvt &evt, const MPedPhotCam &cam,
     243                                              const MGeomCam &geom)
     244{
     245    const Int_t n = geom.GetNumPixels();
     246
     247    fData.Set(n);
     248    fData.Reset();
     249
     250    fValidity.Set(n);
     251    fValidity.Reset();
     252
     253    const Int_t entries = evt.GetNumPixels();
     254
     255    const Float_t meannoise[2] = {cam.GetArea(0).GetRms(), cam.GetArea(1).GetRms()} ; // mean noise for the inner and the outer pixels
     256
     257       
     258    //
     259    // check the number of all pixels against the noise level and
     260    // set them to 'unused' state if necessary
     261    //
     262    for (Int_t i=0; i<entries; i++)
     263    {
     264      const MCerPhotPix &pix = evt[i];
     265     
     266      const Int_t idx = pix.GetPixId();
     267      const Float_t noise = cam[idx].GetRms();
     268     
     269      if (noise<=0)
     270        continue;
     271       
     272      //
     273      // We calculate a correction factor which accounts for the     
     274      // fact that pixels have different size (see TDAS 02-14).
     275      //
     276     
     277     
     278      if (meannoise[0]>0) // fData[idx]=0, fValidity[idx]=0
     279      {
     280        fData[idx] = pix.GetNumPhotons() * geom.GetPixRatio(idx) / meannoise[0];
     281        fValidity[idx] = 1;
     282      }
     283      else
     284        fValidity[idx] = 0;
     285    }
     286   
     287}
     288
     289
     290
    156291// --------------------------------------------------------------------------
    157292//
  • trunk/MagicSoft/Mars/manalysis/MCameraData.h

    r2958 r4444  
    3838    void CalcCleaningLevel(const MCerPhotEvt &evt, Double_t noise,
    3939                           const MGeomCam &geom);
     40
     41    void CalcCleaningLevel2(const MCerPhotEvt &evt, const MPedPhotCam &fCam,
     42                           const MGeomCam &geom);
     43
     44    void CalcCleaningLevelDemocratic(const MCerPhotEvt &evt, const MPedPhotCam &cam,
     45                                     const MGeomCam &geom);
     46
    4047/*
    4148    void Calc(const MCerPhotEvt &evt, const MGeomCam &geom)
Note: See TracChangeset for help on using the changeset viewer.