Changeset 4702 for trunk/MagicSoft/Mars/mimage
- Timestamp:
- 08/23/04 11:41:30 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mimage
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mimage/MImgCleanStd.cc
r4608 r4702 250 250 #include <fstream> // ofstream, SavePrimitive 251 251 252 #include <TEnv.h> 253 252 254 #include <TGFrame.h> // TGFrame 253 255 #include <TGLabel.h> // TGLabel … … 279 281 static const TString gsDefName = "MImgCleanStd"; 280 282 static const TString gsDefTitle = "Task to perform image cleaning"; 283 284 const TString MImgCleanStd::gsNamePedPhotCam="MPedPhotCam"; // default name of the 'MPedPhotCam' container 281 285 282 286 // -------------------------------------------------------------------------- … … 291 295 const char *name, const char *title) 292 296 : fCleaningMethod(kStandard), fCleanLvl1(lvl1), 293 fCleanLvl2(lvl2), fCleanRings(1), fNamePedPhotC ontainer("MPedPhotCam")297 fCleanLvl2(lvl2), fCleanRings(1), fNamePedPhotCam(gsNamePedPhotCam) 294 298 295 299 { … … 499 503 if (!fCam) 500 504 { 501 *fLog << dbginf<< "MGeomCam not found (no geometry information available)... aborting." << endl;505 *fLog << err << "MGeomCam not found (no geometry information available)... aborting." << endl; 502 506 return kFALSE; 503 507 } … … 506 510 if (!fEvt) 507 511 { 508 *fLog << dbginf<< "MCerPhotEvt not found... aborting." << endl;512 *fLog << err << "MCerPhotEvt not found... aborting." << endl; 509 513 return kFALSE; 510 514 } 511 515 512 fPed = (MPedPhotCam*)pList->FindObject(AddSerialNumber(fNamePedPhotC ontainer), "MPedPhotCam");516 fPed = (MPedPhotCam*)pList->FindObject(AddSerialNumber(fNamePedPhotCam), "MPedPhotCam"); 513 517 if (!fPed) 514 518 { 515 *fLog << dbginf<< "MPedPhotCam not found... aborting." << endl;519 *fLog << err << "MPedPhotCam not found... aborting." << endl; 516 520 return kFALSE; 517 521 } 522 523 fTime = (MArrivalTime*)pList->FindObject(AddSerialNumber("MArrivalTime")); 524 if (!fTime && fCleaningMethod==kProbability) 525 *fLog << warn << "MArrivalTime not found... probability cleaning done with signal only!" << endl; 518 526 519 527 fData = (MCameraData*)pList->FindCreateObj(AddSerialNumber("MCameraData")); … … 541 549 fData->CalcCleaningLevelDemocratic(*fEvt, *fPed, *fCam); 542 550 break; 551 /* 552 case kProbability: 553 fData->CalcCleaningProbability(*fEvt, *fPed, *fCam, fTime); 554 break;*/ 555 default: 556 break; 543 557 } 544 558 … … 556 570 // For speed reasons skip the rest of the cleaning if no 557 571 // action will be taken! 558 if (fCleanLvl1<=fCleanLvl2) 559 return kTRUE; 560 572 if (fCleanLvl1>fCleanLvl2) 573 { 561 574 #ifdef DEBUG 562 *fLog << all << "CleanStep 3" << endl;575 *fLog << all << "CleanStep 3" << endl; 563 576 #endif 564 CleanStep3(); 577 CleanStep3(); 578 } 579 580 #ifdef DEBUG 581 *fLog << all << "Calc Islands" << endl; 582 #endif 583 // Takes roughly 10% of the time 584 fEvt->CalcIslands(*fCam); 585 565 586 #ifdef DEBUG 566 587 *fLog << all << "Done." << endl; … … 587 608 case kScaled: 588 609 *fLog << "scaled"; 610 break; 611 case kProbability: 612 *fLog << "probability"; 589 613 break; 590 614 } … … 711 735 out << ");" << endl; 712 736 713 if (fCleaningMethod!=kDemocratic) 714 return; 715 716 out << " " << GetUniqueName() << ".SetMethod(MImgCleanStd::kDemocratic);" << endl; 717 718 if (fCleanRings==1) 719 return; 720 721 out << " " << GetUniqueName() << ".SetCleanRings(" << fCleanRings << ");" << endl; 722 } 737 if (fCleaningMethod!=kStandard) 738 { 739 out << " " << GetUniqueName() << ".SetMethod(MImgCleanStd::k"; 740 switch (fCleaningMethod) 741 { 742 case kScaled: out << "Scaled"; break; 743 case kDemocratic: out << "Democratic"; break; 744 case kProbability: out << "Probability"; break; 745 default: 746 break; 747 } 748 out << ");" << endl; 749 } 750 if (fCleanRings!=1) 751 out << " " << GetUniqueName() << ".SetCleanRings(" << fCleanRings << ");" << endl; 752 753 if (gsNamePedPhotCam!=fNamePedPhotCam) 754 out << " " << GetUniqueName() << ".SetNamePedPhotCam(\"" << fNamePedPhotCam << "\");" << endl; 755 } 756 757 // -------------------------------------------------------------------------- 758 // 759 // Read the setup from a TEnv, eg: 760 // MImgCleanStd.CleanLevel1: 3.0 761 // MImgCleanStd.CleanLevel2: 2.5 762 // MImgCleanStd.CleanMethod: Standard, Scaled, Democratic, Probability 763 // MImgCleanStd.CleanRings: 1 764 // 765 Int_t MImgCleanStd::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 766 { 767 Bool_t rc = kFALSE; 768 if (IsEnvDefined(env, prefix, "CleanRings", print)) 769 { 770 rc = kTRUE; 771 SetCleanRings(GetEnvValue(env, prefix, "CleanRings", fCleanRings)); 772 } 773 if (IsEnvDefined(env, prefix, "CleanLevel1", print)) 774 { 775 rc = kTRUE; 776 fCleanLvl1 = GetEnvValue(env, prefix, "CleanLevel1", fCleanLvl1); 777 } 778 if (IsEnvDefined(env, prefix, "CleanLevel2", print)) 779 { 780 rc = kTRUE; 781 fCleanLvl2 = GetEnvValue(env, prefix, "CleanLevel2", fCleanLvl2); 782 } 783 784 if (IsEnvDefined(env, prefix, "CleanMethod", print)) 785 { 786 rc = kTRUE; 787 TString s = GetEnvValue(env, prefix, "CleanMethod", ""); 788 s.ToLower(); 789 if (s.BeginsWith("standard")) 790 SetMethod(kStandard); 791 if (s.BeginsWith("scaled")) 792 SetMethod(kScaled); 793 if (s.BeginsWith("democratic")) 794 SetMethod(kDemocratic); 795 if (s.BeginsWith("probability")) 796 SetMethod(kProbability); 797 } 798 799 return rc; 800 } -
trunk/MagicSoft/Mars/mimage/MImgCleanStd.h
r4586 r4702 11 11 class MCerPhotEvt; 12 12 class MPedPhotCam; 13 class MArrivalTime; 13 14 class MCameraData; 14 15 … … 21 22 kStandard, 22 23 kScaled, 23 kDemocratic 24 kDemocratic, 25 kProbability 24 26 } CleaningMethod_t; 25 27 26 28 private: 27 const MGeomCam *fCam; //! 28 MCerPhotEvt *fEvt; //! 29 MPedPhotCam *fPed; //! 30 MCameraData *fData; //! 29 static const TString gsNamePedPhotCam; // default name of the 'MPedPhotCam' container 30 31 const MGeomCam *fCam; //! 32 MCerPhotEvt *fEvt; //! 33 MPedPhotCam *fPed; //! 34 MArrivalTime *fTime; //! 35 MCameraData *fData; //! 31 36 32 37 CleaningMethod_t fCleaningMethod; 33 38 34 Float_t fCleanLvl1;35 Float_t fCleanLvl2;39 Float_t fCleanLvl1; 40 Float_t fCleanLvl2; 36 41 37 42 UShort_t fCleanRings; 38 43 39 Float_t fInnerNoise; //! 40 TString fNamePedPhotContainer; // name of the 'MPedPhotCam' container 44 TString fNamePedPhotCam; // name of the 'MPedPhotCam' container 41 45 42 46 43 void CreateGuiElements(MGGroupFrame *f); 44 void StreamPrimitive(ofstream &out) const; 47 void CreateGuiElements(MGGroupFrame *f); 48 void StreamPrimitive(ofstream &out) const; 49 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print); 45 50 46 void 47 void 51 void CleanStep3b(MCerPhotPix &pix); 52 void CleanStep4(UShort_t r, MCerPhotPix &pix); 48 53 49 54 void CleanStep1(); … … 56 61 public: 57 62 MImgCleanStd(const Float_t lvl1=3.0, const Float_t lvl2=2.5, 58 const char *name=NULL, const char *title=NULL);63 const char *name=NULL, const char *title=NULL); 59 64 void Print(Option_t *o="") const; 60 65 … … 67 72 68 73 Bool_t ProcessMessage(Int_t msg, Int_t submsg, Long_t param1, Long_t param2); 69 void SetNamePedPhotC ontainer(const char *name) { fNamePedPhotContainer= name; }74 void SetNamePedPhotCam(const char *name) { fNamePedPhotCam = name; } 70 75 71 76 ClassDef(MImgCleanStd, 2) // task doing the image cleaning -
trunk/MagicSoft/Mars/mimage/Makefile
r3927 r4702 20 20 # 21 21 INCLUDES = -I. -I../mbase -I../mhbase -I../mgeom -I../manalysis \ 22 -I../mgui -I../mmc -I../mpointing -I../mpedestal 22 -I../mgui -I../mmc -I../mpointing -I../mpedestal \ 23 -I../mhist 24 25 # mhist: MHHillas (MHCamera) 26 23 27 24 28 SRCFILES = MImgCleanStd.cc \
Note:
See TracChangeset
for help on using the changeset viewer.