Changeset 3490 for trunk/MagicSoft
- Timestamp:
- 03/12/04 17:56:20 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3488 r3490 19 19 -*-*- END OF LINE -*-*- 20 20 21 2004/03/12: Thomas Bretz 22 23 * merpp.cc: 24 - added 'force' option 25 26 * manalysis/MCerPhotAnal2.cc: 27 - extract pedestal and pedestal rms from lo-gain if hi-gain not 28 above a certain athreshold 29 30 * mastro/MAstroCatalog.[h,c]: 31 - added text argument to DrawStar 32 33 * mbase/MStatusDisplay.cc: 34 - some small changes to output of SaveAsPS 35 36 * mfilter/MFCosmics.cc: 37 - changed output of filter statistics 38 39 * mbadpixels/MBadPixelsTreat.[h,cc]: 40 - fixed some problems with the code - now it should work like 41 expected 42 - added a new member function to be able to change the number 43 of required neighbors 44 45 21 46 22 47 2004/03/12: Wolfgang Wittek … … 28 53 - include MObservatory.h 29 54 - call member function Rotationangle() of MObservatory 55 30 56 31 57 -
trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.cc
r3476 r3490 34 34 // an existing MBadPixelsCam. 35 35 // 36 // It check if there are enough neighbors to calculate the mean 37 // If not, unmap the pixel. The minimum number of good neighbors 38 // should be set using SetNumMinNeighbors 39 // 36 40 // Input Containers: 37 41 // MCerPhotEvt … … 79 83 // 80 84 MBadPixelsTreat::MBadPixelsTreat(const char *name, const char *title) 81 : fFlags(0) 85 : fFlags(0), fNumMinNeighbors(3) 82 86 { 83 87 fName = name ? name : gsDefName.Data(); … … 147 151 for (UShort_t i=0; i<entries; i++) 148 152 { 153 MCerPhotPix *pix = fEvt->GetPixById(i); 154 149 155 // 150 156 // Check whether pixel with idx i is blind 151 157 // 152 if ( !(*fBadPixels)[i].IsBad())158 if (pix && (*fBadPixels)[i].IsOK()) 153 159 continue; 154 160 … … 157 163 // create a new entry for this pixel in MCerPhotEvt 158 164 // 159 MCerPhotPix *pix = fEvt->GetPixById(i);160 165 if (!pix) 166 { 161 167 pix = fEvt->AddPixel(i, 0, 0); 168 (*fBadPixels)[i].SetUnsuitable(MBadPixelsPix::kUnsuitableEvt); 169 } 162 170 163 171 // … … 193 201 // Do not use blind neighbors 194 202 // 195 if ( !(*fBadPixels)[i].IsBad())203 if ((*fBadPixels)[i].IsBad()) 196 204 continue; 197 205 … … 254 262 // Check whether pixel with idx i is blind 255 263 // 256 if ( !(*fBadPixels)[i].IsBad())264 if ((*fBadPixels)[i].IsOK()) 257 265 continue; 258 266 … … 290 298 // Do not use blind neighbors 291 299 // 292 if ( !(*fBadPixels)[i].IsBad())300 if ((*fBadPixels)[i].IsBad()) 293 301 continue; 294 302 … … 302 310 //The error is calculated as the quadratic sum of the errors 303 311 // 304 ped[i] += (nratio*nppix.GetMean());312 ped[i] += nratio*nppix.GetMean(); 305 313 rms[i] += nratio*Pow2(nppix.GetRms()); 306 314 … … 310 318 // Check if there are enough neighbors to calculate the mean 311 319 // If not, unmap the pixel. The minimum number of good neighbors 312 // should be 3313 if (num < 3)320 // should be fNumMinNeighbors 321 if (num < fNumMinNeighbors) 314 322 { 315 323 MCerPhotPix *pix =fEvt->GetPixById(i); … … 350 358 // Create arrays 351 359 // 352 Double_t *nphot = new Double_t[entries];353 Double_t *perr = new Double_t[entries];354 Double_t *ped = new Double_t[entries];355 Double_t *pedrms = new Double_t[entries];360 TArrayD nphot(entries); 361 TArrayD perr(entries); 362 TArrayD ped(entries); 363 TArrayD pedrms(entries); 356 364 357 365 // … … 360 368 for (UShort_t i=0; i<entries; i++) 361 369 { 370 MCerPhotPix *pix = fEvt->GetPixById(i); 371 362 372 // 363 373 // Check whether pixel with idx i is blind 364 374 // 365 if ( (*fBadPixels)[i].IsBad())375 if (pix && (*fBadPixels)[i].IsOK()) 366 376 continue; 367 377 … … 370 380 // create a new entry for this pixel in MCerPhotEvt 371 381 // 372 const MCerPhotPix *pix = fEvt->GetPixById(i);373 382 if (!pix) 383 { 374 384 pix = fEvt->AddPixel(i, 0, 0); 385 (*fBadPixels)[i].SetUnsuitable(MBadPixelsPix::kUnsuitableEvt); 386 } 375 387 376 388 // … … 395 407 const Double_t ratio = fGeomCam->GetPixRatio(i); 396 408 397 nphot[i] *= ratio; 398 ped[i] *= ratio; 399 perr[i] *= Pow2(ratio); 400 pedrms[i] *= Pow2(pedrms[i]); 409 if (nucp) 410 { 411 nphot[i] *= ratio; 412 perr[i] *= ratio; 413 ped[i] *= ratio; 414 pedrms[i] *= ratio; 415 } 401 416 402 417 // … … 411 426 // Do not use blind neighbors 412 427 // 413 if ((*fBadPixels)[ i].IsBad())428 if ((*fBadPixels)[nidx].IsBad()) 414 429 continue; 415 430 … … 428 443 429 444 // 430 // The error is calculated as the quadratic sum of the errors445 // The error is calculated as the quadratic sum of the errors 431 446 // 447 nphot[i] += nratio*evtpix->GetNumPhotons(); 432 448 ped[i] += nratio*nppix.GetMean(); 433 nphot[i] += nratio*evtpix->GetNumPhotons(); 434 perr[i] += Pow2(nratio*evtpix->GetErrorPhot()); 435 pedrms[i] += Pow2(nratio*nppix.GetRms()); 449 perr[i] += nratio*Pow2(evtpix->GetErrorPhot()); 450 pedrms[i] += nratio*Pow2(nppix.GetRms()); 436 451 437 452 num++; 453 } 454 455 if (num<2) 456 { 457 pix->SetPixelUnmapped(); 458 nphot[i] = 0; 459 ped[i] = 0; 460 perr[i] = 0; 461 pedrms[i] = 0; 462 continue; 438 463 } 439 464 … … 443 468 nphot[i] /= num*ratio; 444 469 ped[i] /= num*ratio; 445 perr[i] = TMath::Sqrt(perr[i]/ num)*ratio;446 pedrms[i] = TMath::Sqrt(pedrms[i]/ num)*ratio;470 perr[i] = TMath::Sqrt(perr[i]/(num*ratio)); 471 pedrms[i] = TMath::Sqrt(pedrms[i]/(num*ratio)); 447 472 448 473 } … … 457 482 // Do not use blind neighbors 458 483 // 459 if ((*fBadPixels)[i].Is Bad())484 if ((*fBadPixels)[i].IsOK()) 460 485 continue; 461 486 … … 466 491 (*fPedPhot)[i].Set(ped[i], pedrms[i]); 467 492 } 468 469 //470 // Delete the intermediat arrays471 //472 delete nphot;473 delete perr;474 delete ped;475 delete pedrms;476 493 } 477 494 -
trunk/MagicSoft/Mars/mbadpixels/MBadPixelsTreat.h
r3476 r3490 20 20 21 21 Byte_t fFlags; // flag for the method which is used 22 Byte_t fNumMinNeighbors; 23 22 24 23 25 enum … … 50 52 b ? SETBIT(fFlags, kUseCentralPixel) : CLRBIT(fFlags, kUseCentralPixel); 51 53 } 54 void SetNumMinNeighbors(UShort_t num) { fNumMinNeighbors=num; } 52 55 53 56
Note:
See TracChangeset
for help on using the changeset viewer.