Changeset 8528


Ignore:
Timestamp:
05/21/07 11:02:49 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r8527 r8528  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20 2007/05/21 Daniela Dorner
     21
     22   * msignal/MSignalPix.h:
     23     - added missing arrival time in Copy function
     24     - added copy constructor
     25
     26   * msignal/MSignalCam.[h,cc]:
     27     - added a function to compare cleanigngs of two objects
     28     - added a function to compare the islands in two objects
     29
     30
     31
    2032 2007/05/18 Daniela Dorner
    2133
  • trunk/MagicSoft/Mars/msignal/MSignalCam.cc

    r8489 r8528  
    6868// --------------------------------------------------------------------------
    6969//
     70// Copy contants of obj into this instance.
     71//
     72void MSignalCam::Copy(TObject &obj) const
     73{
     74    MSignalCam &cam = static_cast<MSignalCam&>(obj);
     75
     76    cam.fNumIslands = fNumIslands;
     77    cam.fNumSinglePixels = fNumSinglePixels;
     78    cam.fSizeSinglePixels = fSizeSinglePixels;
     79    cam.fSizeSubIslands = fSizeSubIslands;
     80    cam.fSizeMainIsland = fSizeMainIsland;
     81
     82    cam.fNumPixelsSaturatedHiGain = fNumPixelsSaturatedHiGain;
     83    cam.fNumPixelsSaturatedLoGain = fNumPixelsSaturatedLoGain;
     84
     85    cam.fPixels->Delete();
     86
     87    const UInt_t n = GetNumPixels();
     88
     89    cam.InitSize(n);
     90
     91    for (UInt_t i=0; i<n; i++)
     92        new ((*cam.fPixels)[i]) MSignalPix((*this)[i]);
     93}
     94
     95// --------------------------------------------------------------------------
     96//
    7097// reset counter and delete netries in list.
    7198//
     
    463490// --------------------------------------------------------------------------
    464491//
     492// Compares the cleaning (fRing and fIsCore) of this object and the
     493// argument. Return the result (kFALSE if different).
     494//
     495// If differences are found the pixels (the pixel from this object first)
     496// is printed.
     497//
     498Bool_t MSignalCam::CompareCleaning(const MSignalCam &cam) const
     499{
     500    const UInt_t n = GetNumPixels();
     501
     502    if (n != cam.GetNumPixels())
     503    {
     504        *fLog << warn << "MSignalCam::CompareCleaning - Number of pixels mismatch." << endl;
     505        return kFALSE;
     506    }
     507
     508    for (UInt_t i=0; i<n; i++)
     509    {
     510        const MSignalPix &p = (*this)[i];
     511        const MSignalPix &q = cam[i];
     512
     513        if (p.GetRing()==q.GetRing() && p.IsPixelCore()==q.IsPixelCore())
     514            continue;
     515
     516        *fLog << warn << "MSignalCam::CompareCleaning - Pixel #" << i << " mismatch." << endl;
     517        p.Print();
     518        q.Print();
     519        return kFALSE;
     520    }
     521    return kTRUE;
     522}
     523
     524// --------------------------------------------------------------------------
     525//
     526// Compares the islands (fIdxIsland) of this object and the
     527// argument. Return the result (kFALSE if different).
     528//
     529// If differences are found the pixels (the pixel from this object first)
     530// is printed.
     531//
     532Bool_t MSignalCam::CompareIslands(const MSignalCam &cam) const
     533{
     534    const UInt_t n = GetNumPixels();
     535
     536    if (n != cam.GetNumPixels())
     537    {
     538        *fLog << warn << "MSignalCam::CompareIslands - Number of pixels mismatch." << endl;
     539        return kFALSE;
     540    }
     541
     542    for (UInt_t i=0; i<n; i++)
     543    {
     544        const MSignalPix &p = (*this)[i];
     545        const MSignalPix &q = cam[i];
     546
     547        if (p.GetIdxIsland()==q.GetIdxIsland())
     548            continue;
     549
     550        *fLog << warn << "MSignalCam::CompareIslands - Pixel #" << i << " mismatch." << endl;
     551        p.Print();
     552        q.Print();
     553        return kFALSE;
     554    }
     555
     556    return kTRUE;
     557}
     558
     559// --------------------------------------------------------------------------
     560//
    465561// Returns, depending on the type flag:
    466562//
  • trunk/MagicSoft/Mars/msignal/MSignalCam.h

    r8489 r8528  
    7575    Int_t CalcIslands(const MGeomCam &geom);
    7676
     77    // Functions for easy comparisons
     78    Bool_t CompareCleaning(const MSignalCam &cam) const;
     79    Bool_t CompareIslands(const MSignalCam &cam) const;
     80
    7781    // class MParContainer
    7882    void Reset();
    7983
    8084    // class TObject
     85    void Copy(TObject &obj) const;
    8186    void Print(Option_t *opt=NULL) const;
    8287    void Clear(Option_t *opt=NULL) { Reset(); }
  • trunk/MagicSoft/Mars/msignal/MSignalPix.h

    r8391 r8528  
    2222public:
    2323    MSignalPix(Float_t phot=0, Float_t errphot=0);
     24    MSignalPix(const MSignalPix &pix)
     25        : fIsCore(pix.fIsCore), fRing(pix.fRing), fIdxIsland(pix.fIdxIsland),
     26        fPhot(pix.fPhot), fErrPhot(pix.fErrPhot), fArrivalTime(pix.fArrivalTime)
     27    {
     28    }
    2429
     30    // TObject
    2531    void Clear(Option_t *o=0);
    2632    void Copy(TObject &obj) const
    2733    {
    2834        MSignalPix &pix = (MSignalPix&)obj;
    29         pix.fIsCore     = fIsCore;
    30         pix.fRing       = fRing;
    31         pix.fIdxIsland  = fIdxIsland;
    32         pix.fPhot       = fPhot;
    33         pix.fErrPhot    = fErrPhot;
     35        pix.fIsCore      = fIsCore;
     36        pix.fRing        = fRing;
     37        pix.fIdxIsland   = fIdxIsland;
     38        pix.fPhot        = fPhot;
     39        pix.fErrPhot     = fErrPhot;
     40        pix.fArrivalTime = fArrivalTime;
    3441    }
     42    void    Print(Option_t *opt = NULL) const;
    3543
     44    // MSignalPix
    3645    Float_t GetNumPhotons() const         { return fPhot;    }
    3746    Float_t GetErrorPhot() const          { return fErrPhot; }
     
    6069    //void    Scale(Float_t f)              { fPhot /= f; }
    6170
    62     void    Print(Option_t *opt = NULL) const;
    63 
    6471    ClassDef(MSignalPix, 7)  // class containing information about the Cerenkov Photons in a pixel
    6572};
Note: See TracChangeset for help on using the changeset viewer.