Changeset 3761


Ignore:
Timestamp:
04/15/04 22:54:38 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3760 r3761  
    4646     - set the fAvNorm variables to 1 in Clean()
    4747
     48   * manalysis/MPedPhotCalc.[h,cc]
     49     - included possibility to use an MBadPixelsCam
     50 
    4851
    4952 2004/04/14: Thomas Bretz
  • trunk/MagicSoft/Mars/manalysis/MPedPhotCalc.cc

    r3374 r3761  
    1818!   Author(s): Josep Flix 1/2004 <mailto:jflix@ifae.es>
    1919!   Author(s): Javier Rico 1/2004 <mailto:jrico@ifae.es>
     20!   Author(s): Markus Gaug 4/2004 <mailto:markus@ifae.es>
    2021!
    2122!   Copyright: MAGIC Software Development, 2000-2004
     
    5556#include "MPedPhotCam.h"
    5657
     58#include "MBadPixelsPix.h"
     59#include "MBadPixelsCam.h"
     60
    5761ClassImp(MPedPhotCalc);
    5862
     
    6367//
    6468MPedPhotCalc::MPedPhotCalc(const char *name, const char *title)
     69    : fPedestals(NULL), fCerPhot(NULL), fBadPixels(NULL)
    6570{
    6671  fName  = name  ? name  : "MPedPhotCalc";
    67   fTitle = title ? title : "Task to calculate pedestals from the charge computed from pedestal runs (in units of photons)";
     72  fTitle = title ? title : "Task to calculate pedestals in units of photons";
    6873}
    6974
     
    7378//
    7479//  - MCerPhotEvt
     80//  - MBadPixelsCam
    7581//
    7682// The following output containers are also searched and created if
     
    8793      *fLog << err << "MPedPhotCalc::PreProcess Error: MCerPhotEvt not found... aborting." << endl;
    8894      return kFALSE;
     95    }
     96
     97
     98  fBadPixels = (MBadPixelsCam*)pList->FindObject("MBadPixelsCam");
     99  if (!fBadPixels)
     100    {
     101      *fLog << warn << "MPedPhotCalc::PreProcess Warning: No MBadPixelsCam found." << endl;
    89102    }
    90103
     
    130143  }
    131144
     145
    132146  return kTRUE;
    133147}
     
    142156    for(UInt_t i=0;i<fCerPhot->GetNumPixels();i++)
    143157    {
    144         const MCerPhotPix &pix = (*fCerPhot)[i];
     158 
     159       const MCerPhotPix &pix = (*fCerPhot)[i];
     160
     161        if (fBadPixels)
     162          {
     163            const MBadPixelsPix &bad = (*fBadPixels)[i];
     164            if (bad.IsBad())
     165              continue;
     166          }
    145167
    146168        const Float_t nphot = pix.GetNumPhotons();
    147         const Int_t idx     = pix.GetPixId();
    148 
    149         fSumx[idx]  += nphot;
    150         fSumx2[idx] += nphot*nphot;
     169
     170        fSumx[i]  += nphot;
     171        fSumx2[i] += nphot*nphot;
    151172    }
    152173
     
    168189    for(Int_t i=0; i<npix; i++)
    169190    {
    170         const Float_t sum  = fSumx[i];
    171         const Float_t sum2 = fSumx2[i];
    172 
    173         const Float_t photped = sum/n;
    174         const Float_t photrms = TMath::Sqrt((sum2-sum*sum/n)/(n-1.));
    175 
    176         (*fPedestals)[i].Set(photped,photrms);
     191
     192      if (fBadPixels)
     193        {
     194          const MBadPixelsPix &bad = (*fBadPixels)[i];
     195          if (bad.IsBad())
     196            continue;
     197        }
     198
     199      const Float_t sum  = fSumx[i];
     200      const Float_t sum2 = fSumx2[i];
     201     
     202      const Float_t photped = sum/n;
     203      const Float_t photrms = TMath::Sqrt((sum2-sum*sum/n)/(n-1.));
     204     
     205      (*fPedestals)[i].Set(photped,photrms);
    177206    }
    178207
  • trunk/MagicSoft/Mars/manalysis/MPedPhotCalc.h

    r2848 r3761  
    1212class MPedPhotCam;
    1313class MCerPhotEvt;
    14 
     14class MBadPixelsCam;
    1515class MPedPhotCalc : public MTask
    1616{
    17     MPedPhotCam  *fPedestals;  // Pedestals of all pixels in the camera
    18     MCerPhotEvt  *fCerPhot;
    1917
    20     TArrayF fSumx;   // sum of values
    21     TArrayF fSumx2;  // sum of squared values
     18  MPedPhotCam   *fPedestals;  // Pedestals of all pixels in the camera
     19  MCerPhotEvt   *fCerPhot;    // Calibrated Cherenkov events
     20  MBadPixelsCam *fBadPixels;  // Bad Pixels
     21 
     22  TArrayF fSumx;   // sum of values
     23  TArrayF fSumx2;  // sum of squared values
    2224
    23     Bool_t ReInit(MParList *pList);
     25  Bool_t ReInit(MParList *pList);
    2426
    25     Int_t PreProcess(MParList *pList);
    26     Int_t Process();
    27     Int_t PostProcess();
     27  Int_t PreProcess(MParList *pList);
     28  Int_t Process();
     29  Int_t PostProcess();
     30 
     31public:
     32  MPedPhotCalc(const char *name=NULL, const char *title=NULL);
    2833
    29 public:
    30     MPedPhotCalc(const char *name=NULL, const char *title=NULL);
    31 
    32     ClassDef(MPedPhotCalc, 0)//Task to calculate pedestals from the charge computed from pedestal runs (in units of photons)
     34  ClassDef(MPedPhotCalc, 0) //Task to calculate pedestals in units of photons
    3335};
    3436
Note: See TracChangeset for help on using the changeset viewer.