Changeset 5052 for trunk/MagicSoft
- Timestamp:
- 09/15/04 23:18:04 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbadpixels/MBadPixelsIntensityCam.cc
r5016 r5052 43 43 #include "MBadPixelsIntensityCam.h" 44 44 45 #include <T ClonesArray.h>45 #include <TOrdCollection.h> 46 46 47 47 #include "MGeomCam.h" … … 64 64 fTitle = title ? title : "Base container for the Intensity Calibration"; 65 65 66 fCams = new TO bjArray;66 fCams = new TOrdCollection; 67 67 fCams->SetOwner(); 68 68 … … 139 139 // ------------------------------------------------------------------- 140 140 // 141 // Calls TClonesArray::ExpandCreate() for fCams 142 // 143 void MBadPixelsIntensityCam::InitSize(const UInt_t n) 144 { 145 146 fCams->Expand(n); 147 148 for (Int_t i=0; i<fCams->GetSize(); i++) 149 (*fCams)[i] = new MBadPixelsCam; 150 } 141 // Initialize the objects inside the TOrdCollection using the 142 // function Add(). 143 // 144 // InitSize can only increase the size, but not shrink. 145 // 146 // It can be called more than one time. New Containers are 147 // added only from the current size to the argument i. 148 // 149 void MBadPixelsIntensityCam::InitSize(const UInt_t i) 150 { 151 152 const UInt_t save = GetSize(); 153 154 if (i==save) 155 return; 156 157 if (i>save) 158 Add(save,i); 159 } 160 161 // ------------------------------------------------------------------- 162 // 163 // Add MBadPixelsCams in the ranges from - to. In order to initialize 164 // from MBadPixelsCam derived containers, overwrite this function 165 // 166 void MBadPixelsIntensityCam::Add(const UInt_t from, const UInt_t to) 167 { 168 for (UInt_t i=from; i<to; i++) 169 fCams->AddAt(new MBadPixelsCam,i); 170 } 171 151 172 152 173 // ------------------------------------------------------------------- … … 166 187 // -------------------------------------------------------------------------- 167 188 // 168 // Returns the current size of the T ClonesArrayfCams189 // Returns the current size of the TOrdCollection fCams 169 190 // independently if the MBadPixelsCam is filled with values or not. 170 191 // 171 192 Int_t MBadPixelsIntensityCam::GetSize() const 172 193 { 173 return fCams->Get Entries();194 return fCams->GetSize(); 174 195 } 175 196 … … 180 201 MBadPixelsPix &MBadPixelsIntensityCam::operator[](Int_t i) 181 202 { 182 return (*GetCam( GetSize()-1))[i];203 return (*GetCam())[i]; 183 204 } 184 205 … … 189 210 const MBadPixelsPix &MBadPixelsIntensityCam::operator[](Int_t i) const 190 211 { 191 return (*GetCam( GetSize()-1))[i];212 return (*GetCam())[i]; 192 213 } 193 214 … … 199 220 MBadPixelsCam *MBadPixelsIntensityCam::GetCam(Int_t i) 200 221 { 201 return static_cast<MBadPixelsCam*>( fCams->UncheckedAt(i==-1 ? GetSize()-1 :i));222 return static_cast<MBadPixelsCam*>(i==-1 ? fCams->Last() : fCams->At(i)); 202 223 } 203 224 … … 208 229 const MBadPixelsCam *MBadPixelsIntensityCam::GetCam(Int_t i) const 209 230 { 210 return static_cast<MBadPixelsCam*>( fCams->UncheckedAt(i==-1 ? GetSize()-1 :i));231 return static_cast<MBadPixelsCam*>(i==-1 ? fCams->Last() : fCams->At(i)); 211 232 } 212 233 -
trunk/MagicSoft/Mars/mbadpixels/MBadPixelsIntensityCam.h
r5013 r5052 12 12 #endif 13 13 14 class TO bjArray;14 class TOrdCollection; 15 15 class MGeomCam; 16 16 class MBadPixelsIntensityCam : public MParContainer, public MCamEvent 17 17 { 18 18 private: 19 20 TOrdCollection *fCams; //-> Array of MBadPixelsCams, one per pulse colour and intensity 21 22 void Add(const UInt_t from, const UInt_t to); 19 23 20 void InitSize( const UInt_t n );21 22 protected:23 24 TObjArray *fCams; //-> Array of MBadPixelsCams, one per pulse colour and intensity25 26 24 public: 27 25 … … 70 68 71 69 // Inits 72 void Init ( const MGeomCam &geom ); 70 void Init ( const MGeomCam &geom ); 71 void InitSize( const UInt_t i ); 73 72 74 73 Bool_t GetPixelContent ( Double_t &val, Int_t idx, const MGeomCam &cam,Int_t type=0) const; -
trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityCam.cc
r5046 r5052 359 359 MCalibrationCam *MCalibrationIntensityCam::GetCam(Int_t i) 360 360 { 361 return static_cast<MCalibrationCam*>( fCams->Last());361 return static_cast<MCalibrationCam*>(i==-1 ? fCams->Last() : fCams->At(i)); 362 362 } 363 363 … … 368 368 const MCalibrationCam *MCalibrationIntensityCam::GetCam(Int_t i) const 369 369 { 370 return static_cast<MCalibrationCam*>( fCams->Last());370 return static_cast<MCalibrationCam*>(i==-1 ? fCams->Last() : fCams->At(i)); 371 371 } 372 372
Note:
See TracChangeset
for help on using the changeset viewer.