Changeset 4384 for trunk/MagicSoft
- Timestamp:
- 07/14/04 21:44:14 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r4382 r4384 19 19 20 20 -*-*- END OF LINE -*-*- 21 22 23 2004/07/14: Hendrik Bartko 24 * mpedestal/MPedPhotCam.[h,cc] 25 - added average areas and sectors (in analogy MPedestalCam) 26 - added new function InitAreas(const UInt_t i) 27 - added new function InitSectors(const UInt_t i) 28 - added new function GetNumAreas() 29 - added new function GetNumSectors() 30 - added new function ReCalc, computes the average values for the 31 sectors from all pixels which are not marked 32 MBadPixelsPix::kUnsuitableRun 33 * mpedestal/MPedPhotPix.[h,cc] 34 - added a variable for the number of events from which the 35 pedestals are computed 36 * manalysis/MGeomApply.cc 37 - changed initialization of MPedPhotCam 38 39 21 40 22 41 2004/07/14: Markus Gaug -
trunk/MagicSoft/Mars/manalysis/MGeomApply.cc
r3752 r4384 18 18 ! Author(s): Thomas Bretz, 09/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! Markus Gaug, 03/2004 <mailto:markus@ifae.es> 20 ! 20 ! Hendrik Bartko, 07/2003 <mailto:hbartko@mppmu.mpg.de> 21 ! 21 22 ! Copyright: MAGIC Software Development, 2000-2004 22 23 ! … … 156 157 MPedPhotCam *pedphot = (MPedPhotCam*)pList->FindObject(AddSerialNumber("MPedPhotCam")); 157 158 if (pedphot) 158 pedphot->Init Size(cam->GetNumPixels());159 pedphot->Init(*cam); 159 160 160 161 MExtractedSignalCam *ext = (MExtractedSignalCam*)pList->FindObject(AddSerialNumber("MExtractedSignalCam")); -
trunk/MagicSoft/Mars/mpedestal/MPedPhotCam.cc
r3803 r4384 17 17 ! 18 18 ! Author(s): Thomas Bretz, 12/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! 20 ! Copyright: MAGIC Software Development, 2000-2003 19 ! Hendrik Bartko, 07/2003 <mailto:hbartko@mppmu.mpg.de> 20 ! 21 ! Copyright: MAGIC Software Development, 2000-2004 21 22 ! 22 23 ! … … 30 31 // of photons) 31 32 // 33 // Version 2: 34 // ---------- 35 // - added fAreas 36 // - added fSectors 37 // 32 38 ///////////////////////////////////////////////////////////////////////////// 33 39 #include "MPedPhotCam.h" 34 #include "MPedPhotPix.h" 35 40 41 #include <TArrayI.h> 42 #include <TArrayD.h> 36 43 #include <TClonesArray.h> 37 44 … … 39 46 #include "MLogManip.h" 40 47 48 #include "MPedPhotPix.h" 49 41 50 #include "MGeomCam.h" 51 #include "MGeomPix.h" 52 53 #include "MBadPixelsCam.h" 54 #include "MBadPixelsPix.h" 42 55 43 56 ClassImp(MPedPhotCam); … … 54 67 fTitle = title ? title : "Storage container for all Pedestal Information in the camera (in units of photons)"; 55 68 56 fArray = new TClonesArray("MPedPhotPix", 1); 57 58 // for (int i=0; i<577; i++) 59 // new ((*fArray)[i]) MPedPhotPix; 69 fArray = new TClonesArray("MPedPhotPix", 1); 70 fAreas = new TClonesArray("MPedPhotPix", 1); 71 fSectors = new TClonesArray("MPedPhotPix", 1); 60 72 } 61 73 … … 67 79 { 68 80 delete fArray; 81 delete fAreas; 82 delete fSectors; 69 83 } 70 84 … … 78 92 } 79 93 94 // ------------------------------------------------------------------- 95 // 96 // Calls TClonesArray::ExpandCreate() for: 97 // - fAverageAreas 98 // 99 void MPedPhotCam::InitAreas(const UInt_t i) 100 { 101 fAreas->ExpandCreate(i); 102 } 103 104 // ------------------------------------------------------------------- 105 // 106 // Calls TClonesArray::ExpandCreate() for: 107 // - fAverageSectors 108 // 109 void MPedPhotCam::InitSectors(const UInt_t i) 110 { 111 fSectors->ExpandCreate(i); 112 } 113 114 // ------------------------------------------------------------------- 115 // 116 // Calls: 117 // - InitSize() 118 // - InitAverageAreas() 119 // - InitAverageSectors() 120 // 121 void MPedPhotCam::Init(const MGeomCam &geom) 122 { 123 InitSize(geom.GetNumPixels()); 124 InitAreas(geom.GetNumAreas()); 125 InitSectors(geom.GetNumSectors()); 126 } 127 128 80 129 // -------------------------------------------------------------------------- 81 130 // … … 89 138 // -------------------------------------------------------------------------- 90 139 // 140 // Get the size of the MPedPhotCam 141 // 142 Int_t MPedPhotCam::GetNumSectors() const 143 { 144 return fSectors->GetEntriesFast(); 145 } 146 147 // -------------------------------------------------------------------------- 148 // 149 // Get the size of the MPedPhotCam 150 // 151 Int_t MPedPhotCam::GetNumAreas() const 152 { 153 return fAreas->GetEntriesFast(); 154 } 155 156 // -------------------------------------------------------------------------- 157 // 91 158 // Get i-th pixel (pixel number) 92 159 // … … 100 167 // Get i-th pixel (pixel number) 101 168 // 102 MPedPhotPix &MPedPhotCam::operator[](Int_t i) const169 const MPedPhotPix &MPedPhotCam::operator[](Int_t i) const 103 170 { 104 171 return *static_cast<MPedPhotPix*>(fArray->UncheckedAt(i)); 105 172 } 106 173 107 /* 108 // -------------------------------------------------------------------------- 109 // 110 // Check if position i is inside bounds 111 // 112 Bool_t MPedPhotCam::CheckBounds(Int_t i) 113 { 114 return i < fArray->GetEntriesFast(); 115 } 116 */ 174 // -------------------------------------------------------------------------- 175 // 176 // Get i-th average pixel (area number) 177 // 178 MPedPhotPix &MPedPhotCam::GetArea(UInt_t i) 179 { 180 return *static_cast<MPedPhotPix*>(fAreas->UncheckedAt(i)); 181 } 182 183 // -------------------------------------------------------------------------- 184 // 185 // Get i-th average pixel (sector number) 186 // 187 MPedPhotPix &MPedPhotCam::GetSector(UInt_t i) 188 { 189 return *static_cast<MPedPhotPix*>(fSectors->UncheckedAt(i)); 190 } 191 192 // -------------------------------------------------------------------------- 193 // 194 // Get i-th average pixel (area number) 195 // 196 const MPedPhotPix &MPedPhotCam::GetArea(UInt_t i)const 197 { 198 return *static_cast<MPedPhotPix*>(fAreas->UncheckedAt(i)); 199 } 200 201 // -------------------------------------------------------------------------- 202 // 203 // Get i-th average pixel (sector number) 204 // 205 const MPedPhotPix &MPedPhotCam::GetSector(UInt_t i) const 206 { 207 return *static_cast<MPedPhotPix*>(fSectors->UncheckedAt(i)); 208 } 209 210 // -------------------------------------------------------------------------- 211 // 212 // Call clear of all three TClonesArray 213 // 117 214 void MPedPhotCam::Clear(Option_t *o) 118 215 { 119 fArray->ForEach(TObject, Clear)(); 120 } 121 216 { fArray->ForEach(TObject, Clear)(); } 217 { fAreas->ForEach(TObject, Clear)(); } 218 { fSectors->ForEach(TObject, Clear)(); } 219 } 220 221 // -------------------------------------------------------------------------- 222 // 223 // Calculates the avarage pedestal and pedestal rms for all sectors 224 // and pixel sizes. The geometry container is used to get the necessary 225 // geometry information (sector number, size index) If the bad pixel 226 // container is given all pixels which have the flag 'bad' are ignored 227 // in the calculation of the sector and size average. 228 // 229 void MPedPhotCam::ReCalc(const MGeomCam &geom, MBadPixelsCam *bad) 230 { 231 232 const Int_t np = GetSize(); 233 const Int_t ns = GetNumSectors(); 234 const Int_t na = GetNumAreas(); 235 236 237 238 TArrayI acnt(na); 239 TArrayI scnt(ns); 240 TArrayD asumx(na); 241 TArrayD ssumx(ns); 242 TArrayD asumr(na); 243 TArrayD ssumr(ns); 244 245 246 for (int i=0; i<np; i++) 247 { 248 249 250 if (bad && (*bad)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun)) 251 continue; //was: .IsBad() 252 253 // Create sums for areas and sectors 254 const UInt_t aidx = geom[i].GetAidx(); 255 const UInt_t sect = geom[i].GetSector(); 256 257 const MPedPhotPix &pix = (*this)[i]; 258 259 const UInt_t ne = pix.GetNumEvents(); 260 const Float_t mean = pix.GetMean(); 261 const Float_t rms = pix.GetRms(); 262 263 asumx[aidx] += ne*mean; 264 asumr[aidx] += ne*rms; 265 acnt[aidx] += ne; 266 267 ssumx[sect] += ne*mean; 268 ssumr[sect] += ne*rms; 269 scnt[sect] += ne; 270 271 272 } 273 274 for (int i=0; i<ns; i++){ 275 if (scnt[i]>0) GetSector(i).Set(ssumx[i]/scnt[i], ssumr[i]/scnt[i], scnt[i]); 276 else GetSector(i).Set(-1., -1., 0); 277 } 278 279 for (int i=0; i<na; i++){ 280 if (acnt[i]>0) GetArea(i).Set(asumx[i]/acnt[i], asumr[i]/acnt[i], acnt[i]); 281 else GetArea(i).Set(-1., -1., 0); 282 } 283 } 284 285 // -------------------------------------------------------------------------- 286 // 287 // print contents 288 // 122 289 void MPedPhotCam::Print(Option_t *o) const 123 290 { … … 138 305 } 139 306 } 140 /* 141 Float_t MPedPhotCam::GetPedestalMin(const MGeomCam *geom) const 142 { 143 if (fArray->GetEntries() <= 0) 144 return 50.; 145 146 Float_t minval = (*this)[0].GetPedestalRms(); 147 148 for (Int_t i=1; i<fArray->GetEntries(); i++) 149 { 150 const MPedPhotPix &pix = (*this)[i]; 151 152 Float_t testval = pix.GetPedestalRms(); 153 154 if (geom) 155 testval *= geom->GetPixRatio(i); 156 157 if (testval < minval) 158 minval = testval; 159 } 160 return minval; 161 } 162 163 Float_t MPedPhotCam::GetPedestalMax(const MGeomCam *geom) const 164 { 165 if (fArray->GetEntries() <= 0) 166 return 50.; 167 168 Float_t maxval = (*this)[0].GetPedestalRms(); 169 170 for (Int_t i=1; i<fArray->GetEntries(); i++) 171 { 172 const MPedPhotPix &pix = (*this)[i]; 173 174 Float_t testval = pix.GetPedestalRms(); 175 176 if (geom) 177 testval *= geom->GetPixRatio(i); 178 179 if (testval > maxval) 180 maxval = testval; 181 } 182 return maxval; 183 } 184 */ 307 308 // -------------------------------------------------------------------------- 309 // 310 // See MCamEvent 311 // 185 312 Bool_t MPedPhotCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const 186 313 { 314 315 const Float_t ped = (*this)[idx].GetMean(); 316 const Float_t rms = (*this)[idx].GetRms(); 317 const UInt_t nevt = (*this)[idx].GetNumEvents(); 318 319 320 Float_t pederr; 321 Float_t rmserr; 322 323 if (nevt>0) 324 { 325 pederr = rms/TMath::Sqrt((Float_t)nevt); 326 rmserr = rms/TMath::Sqrt((Float_t)nevt)/2.; 327 } 328 else 329 { 330 pederr = -1; 331 rmserr = -1; 332 } 333 187 334 switch (type) 188 335 { 189 336 case 0: 190 val = (*this)[idx].GetMean();337 val = ped;// (*this)[idx].GetMean(); 191 338 break; 192 339 case 1: 193 val = (*this)[idx].GetRms(); 340 val = rms; // (*this)[idx].GetRms(); 341 break; 342 case 2: 343 val = pederr; // new 344 break; 345 case 3: 346 val = rmserr; // new 194 347 break; 195 348 default: -
trunk/MagicSoft/Mars/mpedestal/MPedPhotCam.h
r3803 r4384 13 13 class MGeomCam; 14 14 class MPedPhotPix; 15 class MBadPixelsCam; 15 16 16 17 class MPedPhotCam : public MParContainer, public MCamEvent 17 18 { 18 19 private: 19 TClonesArray *fArray; // FIXME: Change TClonesArray away from a pointer? 20 TClonesArray *fArray; // FIXME: Change TClonesArray away from a pointer? 21 TClonesArray *fAreas; //-> Array of MPedPhotPix, one per pixel area 22 TClonesArray *fSectors; //-> Array of MPedPhotPix, one per camera sector 23 24 // void InitSize(const UInt_t i); 25 void InitAreas(const UInt_t i); 26 void InitSectors(const UInt_t i); 20 27 21 28 public: … … 25 32 void Clear(Option_t *o=""); 26 33 27 void InitSize(const UInt_t i); 34 void Init(const MGeomCam &geom); 35 void InitSize(const UInt_t i); // HB 28 36 Int_t GetSize() const; 29 37 30 38 MPedPhotPix &operator[](Int_t i); 31 MPedPhotPix &operator[](Int_t i) const;39 const MPedPhotPix &operator[](Int_t i) const; 32 40 33 // Float_t GetPedestalMin(const MGeomCam *cam) const;34 // Float_t GetPedestalMax(const MGeomCam *cam) const;41 MPedPhotPix &GetArea(UInt_t i); 42 const MPedPhotPix &GetArea(UInt_t i) const; 35 43 36 // Bool_t CheckBounds(Int_t i); 44 Int_t GetNumAreas() const; 45 46 MPedPhotPix &GetSector(UInt_t i); 47 const MPedPhotPix &GetSector(UInt_t i) const; 48 49 Int_t GetNumSectors() const; 37 50 38 51 void Print(Option_t *o="") const; 52 53 void ReCalc(const MGeomCam &geom, MBadPixelsCam *bad); 39 54 40 55 Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const; 41 56 void DrawPixelContent(Int_t num) const; 42 57 43 ClassDef(MPedPhotCam, 1) // Storage Container for all pedestal information of the camera (in units of photons)58 ClassDef(MPedPhotCam, 2) // Storage Container for all pedestal information of the camera (in units of photons) 44 59 }; 45 60 -
trunk/MagicSoft/Mars/mpedestal/MPedPhotPix.cc
r3803 r4384 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@ uni-sw.gwdg.de>18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 120 ! Copyright: MAGIC Software Development, 2000-2004 21 21 ! 22 22 ! … … 28 28 // 29 29 // This is the storage container to hold informations about the pedestal 30 // (offset) value of one Pixel (PMT) in units of photons 30 // (offset) value of one Pixel (PMT) in units of photons. 31 // 32 // Version 2: 33 // ---------- 34 // - added fNumEvents 31 35 // 32 36 ///////////////////////////////////////////////////////////////////////////// … … 50 54 fMean = -1; 51 55 fRms = -1; 56 fNumEvents = 0; 52 57 } 53 -
trunk/MagicSoft/Mars/mpedestal/MPedPhotPix.h
r3803 r4384 9 9 { 10 10 private: 11 Float_t fMean; // [phot] mean value of pedestal (should be 0) 12 Float_t fRms; // [phot] rms of mean 11 Float_t fMean; // [phot] mean value of pedestal (should be 0) 12 Float_t fRms; // [phot] rms of mean 13 14 UInt_t fNumEvents; // [n] number of events used to calculate mean (0=n/a) 13 15 14 16 public: … … 17 19 void Clear(Option_t *o=""); 18 20 19 Float_t GetMean() const { return fMean; } 20 Float_t GetRms() const { return fRms; } 21 Float_t GetMean() const { return fMean; } 22 Float_t GetRms() const { return fRms; } 23 UInt_t GetNumEvents() const { return fNumEvents; } 21 24 22 25 //void SetMean(Float_t f) { fMean = f; } 23 26 void SetRms(Float_t f) { fRms = f; } 24 void Set(Float_t m, Float_t r ) { fMean = m; fRms = r; }27 void Set(Float_t m, Float_t r, UInt_t n=1) { fMean = m; fRms = r; fNumEvents=n; } 25 28 26 29 Bool_t IsValid() const { return fRms>=0; } 27 30 28 ClassDef(MPedPhotPix, 1) // Storage Container for Pedestal information of one pixel in units of photons31 ClassDef(MPedPhotPix, 2) // Storage Container for Pedestal information of one pixel in units of photons 29 32 }; 30 33
Note:
See TracChangeset
for help on using the changeset viewer.