Changeset 2626 for trunk/MagicSoft/Mars/manalysis
- Timestamp:
- 12/08/03 17:03:08 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/manalysis
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MEventRate.h
r2565 r2626 9 9 { 10 10 private: 11 Double_t fRate; // [Hz] Event rate 11 Double_t fRate; // [Hz] Event rate 12 UInt_t fNumEvents; // Number of events correspoding to this rate 12 13 13 14 public: 14 15 MEventRate(const char *name=NULL, const char *title=NULL); 15 16 16 void SetRate(Double_t r ) { fRate = r; }17 void SetRate(Double_t r, UInt_t n) { fRate = r; fNumEvents = n; } 17 18 Double_t GetRate() const { return fRate; } 19 UInt_t GetNumEvents() const { return fNumEvents; } 18 20 19 21 ClassDef(MEventRate, 1) // Storage Container for the event rate -
trunk/MagicSoft/Mars/manalysis/MEventRateCalc.cc
r2607 r2626 59 59 // 60 60 MEventRateCalc::MEventRateCalc(const char *name, const char *title) 61 : fNumEvents(10000)61 : /*fNumEvents(10000),*/ fTimes(1000) 62 62 { 63 63 fName = name ? name : "MEventRateCalc"; … … 83 83 return kFALSE; 84 84 85 fEvtNumber = 0; 85 //fEvtNumber = 0; 86 87 memset(fTimes.GetArray(), 0, sizeof(Double_t)*fTimes.GetSize()); 86 88 87 89 return kTRUE; … … 91 93 // 92 94 // 93 #include <TSystem.h>94 95 Int_t MEventRateCalc::Process() 95 96 { 96 fTime->Now();97 const ULong_t exec = GetNumExecutions()-1; 97 98 98 const U Long_t exec = GetNumExecutions();99 const UInt_t n = fTimes.GetSize(); 99 100 100 if (fEvtNumber>0) 101 { 102 if (exec<fEvtNumber) 103 return kTRUE; 101 const UInt_t n1 = exec; 102 const UInt_t n2 = exec>=n ? exec+1 : 0; 104 103 105 const Double_t rate = (Double_t)fNumEvents/(*fTime - fEvtTime);104 fTimes[n1%n] = *fTime; 106 105 107 *fLog << inf << "Event Rate [Hz]: " << rate << endl;106 const UInt_t cnt = n1<n2 ? n : n1-n2; 108 107 109 fRate->SetRate(rate); 110 fRate->SetReadyToSave(); 111 } 108 const Double_t rate = (Double_t)cnt/(fTimes[n1%n]-fTimes[n2%n]); 112 109 113 fEvtNumber = exec+fNumEvents; 114 fEvtTime = *fTime; 110 fRate->SetRate(exec>1?rate:0, cnt); 111 fRate->SetReadyToSave(); 112 113 // *fLog << inf << " --- Event Rate [Hz]: " << rate << " (" << cnt << ")" << endl; 115 114 116 115 return kTRUE; -
trunk/MagicSoft/Mars/manalysis/MEventRateCalc.h
r2565 r2626 8 8 #include "MTime.h" 9 9 #endif 10 #ifndef ROOT_TArrayD 11 #include <TArrayD.h> 12 #endif 10 13 11 14 class MEventRate; … … 16 19 MEventRate *fRate; //! 17 20 18 ULong_t fEvtNumber; //!19 MTime fEvtTime; //!21 //ULong_t fEvtNumber; //! 22 //MTime fEvtTime; //! 20 23 21 UInt_t fNumEvents; 24 //UInt_t fNumEvents; 25 26 TArrayD fTimes; //! 27 28 22 29 23 30 Int_t PreProcess(MParList *pList); … … 27 34 MEventRateCalc(const char *name=NULL, const char *title=NULL); 28 35 29 void SetNumEvents(ULong_t num) { fNumEvents = num; }36 void SetNumEvents(ULong_t num) { /*fNumEvents = num;*/ fTimes.Set(num); } 30 37 31 38 ClassDef(MEventRateCalc, 0)// Task to calculate event rates
Note:
See TracChangeset
for help on using the changeset viewer.