Ignore:
Timestamp:
06/23/03 12:09:05 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mgeom
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mgeom/MGeomCam.cc

    r2173 r2209  
    4646using namespace std;
    4747
     48MGeomCam::MGeomCam()
     49    : fNumPixels(0), fCamDist(0), fConvMm2Deg(0)
     50{
     51}
     52
     53
     54
    4855// --------------------------------------------------------------------------
    4956//
     
    5259//
    5360MGeomCam::MGeomCam(UInt_t npix, Float_t dist, const char *name, const char *title)
    54     : fNumPixels(npix), fCamDist(dist), fConvMm2Deg(kRad2Deg/(dist*1000))
     61    : fNumPixels(npix), fCamDist(dist), fConvMm2Deg(kRad2Deg/(dist*1000)), fPixels(npix)
    5562{
    5663    fName  = name  ? name  : "MGeomCam";
    5764    fTitle = title ? title : "Storage container for  a camera geometry";
    5865
    59     fPixels = new TObjArray(npix);
    60 
    6166    //
    6267    // make sure that the destructor delete all contained objects
    6368    //
    64     fPixels->SetOwner();
     69    fPixels.SetOwner();
    6570
    6671    for (UInt_t i=0; i<npix; i++)
    67         (*fPixels)[i] = new MGeomPix;
     72        fPixels[i] = new MGeomPix;
    6873
    6974    SetReadyToSave();
    7075}
    7176
    72 // --------------------------------------------------------------------------
    73 //
    74 //  Destructor delete the pixel array with all pixels
    75 //
    76 MGeomCam::~MGeomCam()
     77MGeomPix &MGeomCam::operator[](Int_t i)
    7778{
    78     delete fPixels;
     79    return *static_cast<MGeomPix*>(fPixels.UncheckedAt(i));
     80}
     81
     82MGeomPix &MGeomCam::operator[](Int_t i) const
     83{
     84    return *static_cast<MGeomPix*>(fPixels.UncheckedAt(i));
    7985}
    8086
     
    8692void MGeomCam::InitOuterRing()
    8793{
    88     for (UInt_t i=0; i<fNumPixels; i++)
    89         (*this)[i].CheckOuterRing(*this);
     94    fPixels.ForEach(MGeomPix, CheckOuterRing)(*this);
    9095}
    9196
     
    134139    *fLog << all << " Number of Pixels (" << GetTitle() << "): " << fNumPixels << endl;
    135140
    136     for (UInt_t i=0; i<fNumPixels; i++)
    137     {
    138         *fLog << " Pixel: " << i << "  ";
    139         (*this)[i].Print();
    140     }
     141    fPixels.Print();
    141142}
    142143
  • trunk/MagicSoft/Mars/mgeom/MGeomCam.h

    r2135 r2209  
    1414{
    1515private:
    16     UInt_t   fNumPixels;  // Number of pixels in this camera
    17     Float_t  fMaxRadius;  // maximum radius of the camera (eg. for GUI layout)
     16    UInt_t    fNumPixels;  // Number of pixels in this camera
     17    Float_t   fMaxRadius;  // maximum radius of the camera (eg. for GUI layout)
    1818
    19     Float_t  fCamDist;    // [m] Average distance of the camera from the mirror
    20     Float_t  fConvMm2Deg; // conversion factor to convert mm in the camera plain into degrees
     19    Float_t   fCamDist;    // [m] Average distance of the camera from the mirror
     20    Float_t   fConvMm2Deg; // conversion factor to convert mm in the camera plain into degrees
    2121
    22     TObjArray *fPixels;   // Array of singel pixels storing the geometry
     22    TObjArray fPixels;     // Array of singel pixels storing the geometry
    2323
    2424protected:
     
    2727
    2828public:
     29    MGeomCam();
    2930    MGeomCam(UInt_t npix, Float_t dist, const char *name=NULL, const char *title=NULL);
    30     virtual ~MGeomCam();
    3131
    3232    virtual TObject *Clone(const char *newname=NULL) const;
     
    3939    Float_t GetPixRatio(UInt_t i) const;
    4040
    41     MGeomPix &operator[](Int_t i)       { return *(MGeomPix*)fPixels->UncheckedAt(i); }
    42     MGeomPix &operator[](Int_t i) const { return *(MGeomPix*)fPixels->UncheckedAt(i); }
     41    MGeomPix &operator[](Int_t i);
     42    MGeomPix &operator[](Int_t i) const;
    4343
    4444    virtual void Print(Option_t *opt=NULL) const;
Note: See TracChangeset for help on using the changeset viewer.