Changeset 4649 for trunk/MagicSoft/Mars
- Timestamp:
- 08/17/04 13:37:28 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 4 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r4648 r4649 27 27 with Florian 28 28 29 29 * mcalib/MCalibrationTestPix.[h,cc] 30 * mcalib/MCalibrationTestCam.[h,cc] 31 * mcalib/Makefile 32 * mcalib/CalibLinkDef.h 33 - new container class to store results of MCalibrationTestCalc 34 and MHCalibrationTestCam 35 36 * mcalib/MCalibrationTestCalc,[h,cc] 37 - adapted to use of MCalibrationTestCam 38 30 39 31 40 2004/08/17: Thomas Bretz -
trunk/MagicSoft/Mars/mcalib/CalibLinkDef.h
r4542 r4649 18 18 #pragma link C++ class MCalibrationQEPix+; 19 19 #pragma link C++ class MCalibrationTestCalc+; 20 #pragma link C++ class MCalibrationTestCam+; 21 #pragma link C++ class MCalibrationTestPix+; 20 22 #pragma link C++ class MCalibrationChargeCalc+; 21 23 #pragma link C++ class MCalibrationChargeCam+; -
trunk/MagicSoft/Mars/mcalib/MCalibrationTestCalc.cc
r4570 r4649 64 64 #include "MHCalibrationTestPix.h" 65 65 66 #include "MCalibrationTestCam.h" 67 #include "MCalibrationTestPix.h" 68 66 69 #include "MBadPixelsCam.h" 67 70 #include "MBadPixelsPix.h" … … 85 88 // 86 89 MCalibrationTestCalc::MCalibrationTestCalc(const char *name, const char *title) 87 : fMaxNumBadPixelsCluster(-1), 88 fBadPixels(NULL), fTestCam(NULL), fGeom(NULL) 90 : fBadPixels(NULL), fTestCam(NULL), fCam(NULL), fGeom(NULL) 89 91 { 90 92 … … 112 114 // Containers that are created in case that they are not there. 113 115 // 114 fBadPixels = (MBadPixelsCam*)pList->FindCreateObj( "MBadPixelsCam");116 fBadPixels = (MBadPixelsCam*)pList->FindCreateObj(AddSerialNumber("MBadPixelsCam")); 115 117 if (!fBadPixels) 116 118 { 117 119 *fLog << err << "Could not find or create MBadPixelsCam ... aborting." << endl; 120 return kFALSE; 121 } 122 123 fCam = (MCalibrationTestCam*)pList->FindCreateObj(AddSerialNumber("MCalibrationTestCam")); 124 if (!fCam) 125 { 126 *fLog << err << "Could not find or create MCalibrationTestCam ... aborting." << endl; 118 127 return kFALSE; 119 128 } … … 170 179 { 171 180 172 //if (GetNumExecutions()==0)173 //return kFALSE;181 if (GetNumExecutions()==0) 182 return kFALSE; 174 183 175 184 // … … 184 193 FinalizeCalibratedPhotons(); 185 194 FinalizeNotInterpolated(); 186 CalcMaxNumBadPixelsCluster();195 const Int_t maxbad = CalcMaxNumBadPixelsCluster(); 187 196 188 197 … … 193 202 { 194 203 *fLog << " " << setw(7) << "Not interpolateable Pixels: " 195 << Form("%s%3i%s%3i","Inner: ",f NumUninterpolateable[0],196 " Outer: ",f NumUninterpolateable[1]) << endl;204 << Form("%s%3i%s%3i","Inner: ",fCam->GetNumUninterpolated(0), 205 " Outer: ",fCam->GetNumUninterpolated(1)) << endl; 197 206 *fLog << " " << setw(7) << "Biggest not-interpolateable cluster: " 198 << fMaxNumBadPixelsCluster << endl; 199 } 200 207 << maxbad << endl; 208 } 209 210 fCam->SetNumUninterpolatedInMaxCluster(maxbad); 211 201 212 *fLog << endl; 202 213 SetLogStream(&gLog); … … 251 262 { 252 263 253 MHCalibrationTestPix &pix = (MHCalibrationTestPix&)(*fTestCam)[i]; 264 MHCalibrationTestPix &hist = (MHCalibrationTestPix&)(*fTestCam)[i]; 265 MCalibrationTestPix &pix = (*fCam)[i]; 254 266 // 255 267 // We assume that the pixels have been interpolated so far. 256 268 // The MBadPixelsCam does not give any more information 257 269 // 258 if (pix.IsEmpty()) 259 continue; 260 261 const Double_t nphot = pix.GetMean(); 262 const Int_t aidx = (*fGeom)[i].GetAidx(); 270 if (hist.IsEmpty()) 271 { 272 pix.SetExcluded(); 273 continue; 274 } 275 276 277 const Double_t nphot = hist.GetMean(); 278 const Double_t nphoterr = hist.GetMeanErr(); 279 const Int_t aidx = (*fGeom)[i].GetAidx(); 263 280 264 281 camphotons.Fill(i,nphot); 265 282 camphotons.SetUsed(i); 283 284 pix.SetNumPhotons ( nphot ); 285 pix.SetNumPhotonsErr( nphoterr ); 266 286 267 287 areaphotons [aidx] += nphot; … … 299 319 continue; 300 320 } 301 302 lowlim [aidx] = areaphotons[aidx] - fPhotErrLimit*TMath::Sqrt(areavars[aidx]); 303 upplim [aidx] = areaphotons[aidx] + fPhotErrLimit*TMath::Sqrt(areavars[aidx]); 321 322 const Float_t areamean = areaphotons[aidx]; 323 const Float_t areaerr = TMath::Sqrt(areavars[aidx]); 324 325 MCalibrationTestPix &avpix = fCam->GetAverageArea(aidx); 326 avpix.SetNumPhotons (areamean); 327 avpix.SetNumPhotonsErr(areaerr ); 328 329 lowlim [aidx] = areamean - fPhotErrLimit*areaerr; 330 upplim [aidx] = areamean + fPhotErrLimit*areaerr; 304 331 305 332 TArrayI area(1); … … 338 365 fittedsigma[aidx] = sigma; 339 366 367 avpix.SetNumPhotons (mean ); 368 avpix.SetNumPhotonsErr(sigma); 369 340 370 lowlim [aidx] = mean - fPhotErrLimit*sigma; 341 371 upplim [aidx] = mean + fPhotErrLimit*sigma; … … 361 391 { 362 392 363 MHCalibrationTestPix &pix = (MHCalibrationTestPix&)(*fTestCam)[i]; 364 365 const Int_t aidx = (*fGeom)[i].GetAidx(); 366 const Int_t sector = (*fGeom)[i].GetSector(); 367 const Float_t area = (*fGeom)[i].GetA(); 368 const Double_t nphot = pix.GetMean(); 393 MHCalibrationTestPix &hist = (MHCalibrationTestPix&)(*fTestCam)[i]; 394 MCalibrationTestPix &pix = (*fCam)[i]; 395 396 const Int_t aidx = (*fGeom)[i].GetAidx(); 397 const Int_t sector = (*fGeom)[i].GetSector(); 398 const Double_t nphot = hist.GetMean(); 399 const Double_t nphotpera = nphot / (*fGeom)[i].GetA(); 400 const Double_t nphotperaerr = hist.GetMeanErr()/ (*fGeom)[i].GetA(); 401 402 pix.SetNumPhotonsPerArea ( nphotpera ); 403 pix.SetNumPhotonsPerAreaErr( nphotperaerr ); 369 404 370 405 if ( nphot < lowlim[aidx] || nphot > upplim[aidx] ) … … 376 411 bad.SetUncalibrated( MBadPixelsPix::kDeviatingNumPhots ); 377 412 bad.SetUnsuitable ( MBadPixelsPix::kUnsuitableRun ); 378 continue; 379 } 380 381 areavars [aidx] += nphot*nphot/area/area; 382 areaphotons [aidx] += nphot/area; 413 pix.SetExcluded(); 414 continue; 415 } 416 417 areavars [aidx] += nphotpera*nphotpera; 418 areaphotons [aidx] += nphotpera; 383 419 numareavalid [aidx] ++; 384 420 385 sectorvars [sector] += nphot *nphot/area/area;386 sectorphotons [sector] += nphot /area;421 sectorvars [sector] += nphotpera*nphotpera; 422 sectorphotons [sector] += nphotpera; 387 423 numsectorvalid[sector] ++; 388 424 } … … 392 428 for (UInt_t aidx=0; aidx<nareas; aidx++) 393 429 { 394 430 395 431 if (numareavalid[aidx] == 1) 396 432 areavars[aidx] = 0.; … … 407 443 } 408 444 445 446 MCalibrationTestPix &avpix = fCam->GetAverageArea(aidx); 447 409 448 if (areavars[aidx] < 0. || areaphotons[aidx] <= 0.) 410 449 { … … 413 452 << aidx << " could not be calculated! Mean: " << areaphotons[aidx] 414 453 << " Variance: " << areavars[aidx] << endl; 415 continue; 416 } 417 454 avpix.SetExcluded(); 455 continue; 456 } 457 458 const Float_t areaerr = TMath::Sqrt(areavars[aidx]); 459 460 avpix.SetNumPhotonsPerArea (areaphotons[aidx]); 461 avpix.SetNumPhotonsPerAreaErr(areaerr ); 462 418 463 *fLog << inf << GetDescriptor() << ": Mean number of equiv. Cher. photons " 419 464 << "per area in area idx " << aidx << ": " 420 << Form("%5.3f+-%5.4f [ph/mm^2]",areaphotons[aidx], TMath::Sqrt(areavars[aidx])) << endl;465 << Form("%5.3f+-%5.4f [ph/mm^2]",areaphotons[aidx],areaerr) << endl; 421 466 } 422 467 … … 442 487 } 443 488 489 MCalibrationTestPix &avpix = fCam->GetAverageSector(sector); 490 444 491 if (sectorvars[sector] < 0. || sectorphotons[sector] <= 0.) 445 492 { … … 448 495 << sector << " could not be calculated! Mean: " << sectorphotons[sector] 449 496 << " Variance: " << sectorvars[sector] << endl; 450 continue; 451 } 452 453 497 avpix.SetExcluded(); 498 continue; 499 } 500 501 502 const Float_t sectorerr = TMath::Sqrt(sectorvars[sector]); 503 504 avpix.SetNumPhotonsPerArea (sectorphotons[sector]); 505 avpix.SetNumPhotonsPerAreaErr(sectorerr ); 506 454 507 *fLog << inf << GetDescriptor() << ": Mean number of equiv. Cher. photons " 455 508 << "per area in sector " << sector << ": " 456 << Form("%5.3f+-%5.4f [ph/mm^2]",sectorphotons[sector], TMath::Sqrt(sectorvars[sector])) << endl;509 << Form("%5.3f+-%5.4f [ph/mm^2]",sectorphotons[sector],sectorerr) << endl; 457 510 } 458 511 … … 468 521 { 469 522 470 const TArrayI &arr = fTestCam->GetNotInterpolateablePixels();471 523 const Int_t areas = fGeom->GetNumAreas(); 472 473 524 TArrayI *newarr[areas]; 474 525 … … 476 527 newarr[aidx] = new TArrayI(0); 477 528 478 fNumUninterpolateable.Set(areas); 479 480 for (Int_t i=0; i<arr.GetSize(); i++) 481 { 482 const Int_t id = arr[i]; 483 const Int_t aidx = (*fGeom)[id].GetAidx(); 484 const Int_t size = newarr[aidx]->GetSize(); 485 newarr[aidx]->Set(size+1); 486 newarr[aidx]->AddAt(id,size); 487 fNumUninterpolateable[aidx]++; 529 for (Int_t i=0; i<fCam->GetSize(); i++) 530 { 531 const Int_t aidx = (*fGeom)[i].GetAidx(); 532 if ((*fCam)[i].IsExcluded()) 533 { 534 const Int_t size = newarr[aidx]->GetSize(); 535 newarr[aidx]->Set(size+1); 536 newarr[aidx]->AddAt(i,size); 537 } 488 538 } 489 539 … … 500 550 num++; 501 551 } 552 fCam->SetNumUninterpolated(newarr[aidx]->GetSize(),aidx); 502 553 *fLog << endl; 503 554 } 504 505 506 555 507 556 *fLog << " " << setw(7) << num << " total not interpolateable pixels " << endl; … … 509 558 } 510 559 511 voidMCalibrationTestCalc::CalcMaxNumBadPixelsCluster()560 Int_t MCalibrationTestCalc::CalcMaxNumBadPixelsCluster() 512 561 { 513 562 … … 516 565 517 566 if (size == 0) 518 { 519 fMaxNumBadPixelsCluster = 0; 520 return; 521 } 567 return 0; 522 568 523 569 if (size == 1) 524 { 525 fMaxNumBadPixelsCluster = 1; 526 return; 527 } 570 return 1; 528 571 529 572 TArrayI knownpixels(0); … … 546 589 } 547 590 548 fMaxNumBadPixelsCluster =oldclustersize;591 return oldclustersize; 549 592 550 593 } … … 619 662 } 620 663 621 const Int_t MCalibrationTestCalc::GetNumUninterpolateable(const Int_t aidx) const622 {623 if (aidx < 0)624 return -1;625 626 return aidx > fNumUninterpolateable.GetSize() ? -1 : fNumUninterpolateable[aidx];627 } -
trunk/MagicSoft/Mars/mcalib/MCalibrationTestCalc.h
r4568 r4649 20 20 21 21 class MHCalibrationTestCam; 22 class MCalibrationTestCam; 22 23 class MBadPixelsCam; 23 24 class MGeomCam; … … 30 31 // Variables 31 32 Float_t fPhotErrLimit; // Limit acceptance nr. cal. phots w.r.t. area idx mean (in sigmas) 32 Int_t fMaxNumBadPixelsCluster; // Number of not interpolateable pixels in biggest cluster33 34 TArrayI fNumUninterpolateable; // Number uninterpolated Pixels per area index35 33 36 34 TString fOutputPath; // Path to the output file … … 40 38 MBadPixelsCam *fBadPixels; //! Bad Pixels 41 39 MHCalibrationTestCam *fTestCam; //! Calibrated Photons in the camera 40 MCalibrationTestCam *fCam; //! Storage Calibrated Photons in the camera 42 41 MGeomCam *fGeom; //! Camera geometry 43 42 … … 47 46 void FinalizeNotInterpolated(); 48 47 void FinalizeCalibratedPhotons() const; 49 voidCalcMaxNumBadPixelsCluster();48 Int_t CalcMaxNumBadPixelsCluster(); 50 49 void LoopNeighbours( const TArrayI &arr, TArrayI &known, Int_t &clustersize, const Int_t idx ); 51 50 … … 59 58 MCalibrationTestCalc(const char *name=NULL, const char *title=NULL); 60 59 61 const Int_t GetMaxNumBadPixelsCluster () const { return fMaxNumBadPixelsCluster; }62 const Int_t GetNumUninterpolateable ( const Int_t aidx ) const;63 64 60 void SetOutputFile ( TString file="TestCalibStat.txt" ); 65 61 void SetOutputPath ( TString path="." ); -
trunk/MagicSoft/Mars/mcalib/Makefile
r4542 r4649 43 43 MCalibrationPedCam.cc \ 44 44 MCalibrationTestCalc.cc \ 45 MCalibrationTestCam.cc \ 46 MCalibrationTestPix.cc \ 45 47 MCalibrationChargeCalc.cc \ 46 48 MCalibrationChargeCam.cc \
Note:
See TracChangeset
for help on using the changeset viewer.