Changeset 2209 for trunk/MagicSoft/Mars/mgeom
- Timestamp:
- 06/23/03 12:09:05 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mgeom
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mgeom/MGeomCam.cc
r2173 r2209 46 46 using namespace std; 47 47 48 MGeomCam::MGeomCam() 49 : fNumPixels(0), fCamDist(0), fConvMm2Deg(0) 50 { 51 } 52 53 54 48 55 // -------------------------------------------------------------------------- 49 56 // … … 52 59 // 53 60 MGeomCam::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) 55 62 { 56 63 fName = name ? name : "MGeomCam"; 57 64 fTitle = title ? title : "Storage container for a camera geometry"; 58 65 59 fPixels = new TObjArray(npix);60 61 66 // 62 67 // make sure that the destructor delete all contained objects 63 68 // 64 fPixels ->SetOwner();69 fPixels.SetOwner(); 65 70 66 71 for (UInt_t i=0; i<npix; i++) 67 (*fPixels)[i] = new MGeomPix;72 fPixels[i] = new MGeomPix; 68 73 69 74 SetReadyToSave(); 70 75 } 71 76 72 // -------------------------------------------------------------------------- 73 // 74 // Destructor delete the pixel array with all pixels 75 // 76 MGeomCam::~MGeomCam() 77 MGeomPix &MGeomCam::operator[](Int_t i) 77 78 { 78 delete fPixels; 79 return *static_cast<MGeomPix*>(fPixels.UncheckedAt(i)); 80 } 81 82 MGeomPix &MGeomCam::operator[](Int_t i) const 83 { 84 return *static_cast<MGeomPix*>(fPixels.UncheckedAt(i)); 79 85 } 80 86 … … 86 92 void MGeomCam::InitOuterRing() 87 93 { 88 for (UInt_t i=0; i<fNumPixels; i++) 89 (*this)[i].CheckOuterRing(*this); 94 fPixels.ForEach(MGeomPix, CheckOuterRing)(*this); 90 95 } 91 96 … … 134 139 *fLog << all << " Number of Pixels (" << GetTitle() << "): " << fNumPixels << endl; 135 140 136 for (UInt_t i=0; i<fNumPixels; i++) 137 { 138 *fLog << " Pixel: " << i << " "; 139 (*this)[i].Print(); 140 } 141 fPixels.Print(); 141 142 } 142 143 -
trunk/MagicSoft/Mars/mgeom/MGeomCam.h
r2135 r2209 14 14 { 15 15 private: 16 UInt_t fNumPixels; // Number of pixels in this camera17 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) 18 18 19 Float_t fCamDist; // [m] Average distance of the camera from the mirror20 Float_t fConvMm2Deg; // conversion factor to convert mm in the camera plain into degrees19 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 21 21 22 TObjArray *fPixels;// Array of singel pixels storing the geometry22 TObjArray fPixels; // Array of singel pixels storing the geometry 23 23 24 24 protected: … … 27 27 28 28 public: 29 MGeomCam(); 29 30 MGeomCam(UInt_t npix, Float_t dist, const char *name=NULL, const char *title=NULL); 30 virtual ~MGeomCam();31 31 32 32 virtual TObject *Clone(const char *newname=NULL) const; … … 39 39 Float_t GetPixRatio(UInt_t i) const; 40 40 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; 43 43 44 44 virtual void Print(Option_t *opt=NULL) const;
Note:
See TracChangeset
for help on using the changeset viewer.