Changeset 2585 for trunk/MagicSoft/Mars
- Timestamp:
- 12/01/03 19:49:00 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2584 r2585 73 73 * mfilter/MFilterList.cc: 74 74 - added class description 75 76 * mfilter/FilterLinkDef.h, mfilter/Makefile: 77 - removed obsolete MFAntiFilter (for a replacement see 78 class-description of MFilterList) 79 80 * mfilter/MFRandomSplit.[h,cc]: 81 - fixed missing manipulators in fLog stream 82 - reset values in constructor which are out of range 83 - changed output in PostProcess according to the style in MHillasCalc etc. 84 - changed nonsense derivement from MF to MFilter 75 85 76 86 -
trunk/MagicSoft/Mars/mfilter/FilterLinkDef.h
r2574 r2585 25 25 #pragma link C++ class MFEnergySlope+; 26 26 #pragma link C++ class MFRandomSplit+; 27 #pragma link C++ class MFAntiFilter+;28 27 29 28 #endif -
trunk/MagicSoft/Mars/mfilter/MFRandomSplit.cc
r2574 r2585 16 16 ! 17 17 ! 18 ! Author(s): Wolfgang Wittek 18 ! Author(s): Wolfgang Wittek, 11/2003 <mailto:wittek@mppmu.mpg.de> 19 19 ! 20 20 ! Copyright: MAGIC Software Development, 2000-2003 … … 24 24 25 25 ///////////////////////////////////////////////////////////////////////////// 26 // // 27 // MFRandomSplit // 28 // // 29 // A filter which gives fResult = kTRUE with the probability fProb // 30 // // 31 // // 26 // 27 // MFRandomSplit 28 // 29 // A filter which gives fResult = kTRUE with the probability fProb 30 // 32 31 ///////////////////////////////////////////////////////////////////////////// 33 32 #include "MFRandomSplit.h" … … 50 49 // 51 50 MFRandomSplit::MFRandomSplit(Double_t f, const char *name, const char *title) 51 : fProb(f) 52 52 { 53 fName = name ? name : "MFRandomSplit";54 fTitle = title ? title : "Filter for random splitting";53 fName = name ? name : "MFRandomSplit"; 54 fTitle = title ? title : "Filter for random splitting"; 55 55 56 fProb = f; 57 if (fProb <= 0.0) 58 *fLog << "MFRandomSplit : fProb is less than 0" << endl; 56 if (fProb < 0) 57 { 58 *fLog << warn << "WARNING - MFRandomSplit::MFRandomSplit: Probability less than 0... set to 0." << endl; 59 fProb = 0; 60 } 59 61 60 if (fProb > 1.0) 61 *fLog << "MFRandomSplit : fProb is greater than 1" << endl; 62 if (fProb > 1) 63 { 64 *fLog << warn << "WARNING - MFRandomSplit::MFRandomSplit: Probability greater than 1... set to 1." << endl; 65 fProb = 1; 66 } 62 67 } 63 68 64 69 // -------------------------------------------------------------------------- 65 70 // 66 // Preprocess 67 // 71 // PreProcess. Set fNumSelectedEvts=0 68 72 // 69 73 Int_t MFRandomSplit::PreProcess(MParList *pList) 70 74 { 71 fNumSelectedEvts = 0; 72 73 return kTRUE; 75 fNumSelectedEvts = 0; 76 return kTRUE; 74 77 } 75 78 76 79 // -------------------------------------------------------------------------- 77 80 // 78 // Select events randomly according to the probability fProb 81 // Select events randomly according to the probability fProb. Count all 82 // selected events 79 83 // 80 84 Int_t MFRandomSplit::Process() 81 85 { 82 fResult = gRandom->Uniform() < fProb;86 fResult = gRandom->Uniform() < fProb; 83 87 84 if (!fResult)85 return kTRUE;88 if (fResult) 89 fNumSelectedEvts++; 86 90 87 fNumSelectedEvts++; 88 89 return kTRUE; 91 return kTRUE; 90 92 } 91 93 … … 93 95 // -------------------------------------------------------------------------- 94 96 // 95 // PostProcess 97 // PostProcess. Prints execution statistics 96 98 // 97 99 Int_t MFRandomSplit::PostProcess() 98 100 { 99 *fLog << "MFRandomSplit::PostProcess; " << fNumSelectedEvts100 << " were selected out of " << GetNumExecutions() << endl;101 if (GetNumExecutions()==0) 102 return kTRUE; 101 103 102 return kTRUE; 104 *fLog << inf << endl; 105 *fLog << GetDescriptor() << " execution statistics:" << endl; 106 *fLog << dec << setfill(' '); 107 *fLog << " " << setw(7) << fNumSelectedEvts << " ("; 108 *fLog << setw(3) << (int)(100.*fNumSelectedEvts/GetNumExecutions()); 109 *fLog << "%) selected - out of " << GetNumExecutions() << endl; 110 *fLog << endl; 111 112 return kTRUE; 103 113 } 104 105 //============================================================================106 107 108 109 110 111 112 113 114 115 116 117 -
trunk/MagicSoft/Mars/mfilter/MFRandomSplit.h
r2574 r2585 7 7 ///////////////////////////////////////////////////////////////////////////// 8 8 9 #ifndef MARS_MF10 #include "MF.h"11 #endif12 13 9 #ifndef MARS_MFilter 14 10 #include "MFilter.h" … … 17 13 class MParList; 18 14 19 class MFRandomSplit : public MF 15 class MFRandomSplit : public MFilter 20 16 { 21 17 private: 18 Int_t fNumSelectedEvts; 19 Double_t fProb; // probability with which the result should be kTRUE 22 20 23 Int_t fNumSelectedEvts; 24 Double_t fProb; // probability with which the result should be kTRUE 25 26 Bool_t fResult; // Result returned by IsExpressionTrue 21 Bool_t fResult; // Result returned by IsExpressionTrue 27 22 28 23 Int_t PreProcess(MParList *pList); -
trunk/MagicSoft/Mars/mfilter/Makefile
r2574 r2585 49 49 MFCT1SelFinal.cc \ 50 50 MFEnergySlope.cc \ 51 MFRandomSplit.cc \ 52 MFAntiFilter.cc 51 MFRandomSplit.cc 53 52 54 53 SRCS = $(SRCFILES)
Note:
See TracChangeset
for help on using the changeset viewer.