Changeset 4887 for trunk/MagicSoft/Mars/manalysis
- Timestamp:
- 09/07/04 18:31:53 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/manalysis
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h
r4841 r4887 40 40 #pragma link C++ class MParameterI+; 41 41 #pragma link C++ class MParameterD+; 42 #pragma link C++ class MParameterDerr+; 42 43 //#pragma link C++ class MParameters+; 43 44 -
trunk/MagicSoft/Mars/manalysis/MEventRateCalc.cc
r4833 r4887 88 88 const TString MEventRateCalc::gsNameEventRate = "MEventRate"; 89 89 const TString MEventRateCalc::gsNameTimeDiff = "MTimeDiff"; 90 const TString MEventRateCalc::gsNameTimeRate = "MTimeRate"; 90 91 91 92 const Int_t MEventRateCalc::gsNumEvents = 1000; … … 96 97 // 97 98 MEventRateCalc::MEventRateCalc(const char *name, const char *title) 98 : fNameTime(gsNameTime), fNameEventRate(gsNameEventRate), 99 fNameTimeDiff(gsNameTimeDiff), fTimes(gsNumEvents) 99 : fNameEventRate(gsNameEventRate), fNameTime(gsNameTime), 100 fNameTimeRate(gsNameTimeRate), fNameTimeDiff(gsNameTimeDiff), 101 fTimes(gsNumEvents) 100 102 { 101 103 fName = name ? name : gsDefName.Data(); … … 118 120 if (!fTime) 119 121 { 120 *fLog << err << "MTimenot found... aborting." << endl;122 *fLog << err << AddSerialNumber(fNameTime) << " [MTime] not found... aborting." << endl; 121 123 return kFALSE; 122 124 } … … 124 126 fRate = (MEventRate*)pList->FindCreateObj("MEventRate", AddSerialNumber(fNameEventRate)); 125 127 if (!fRate) 128 return kFALSE; 129 130 fTimeRate = (MTime*)pList->FindCreateObj("MTime", AddSerialNumber(fNameTimeRate)); 131 if (!fTimeRate) 126 132 return kFALSE; 127 133 … … 145 151 const ULong_t exec = GetNumExecutions()-1; 146 152 153 // Calculate the rate 147 154 const UInt_t n = fTimes.GetSize(); 148 155 156 // Get the positon in the ring-buffer 149 157 const UInt_t n1 = exec; 150 158 const UInt_t n2 = exec>=n ? exec+1 : 0; 151 159 160 // Store the current event time 152 161 fTimes[n1%n] = *fTime; 153 162 163 // Get the number of events 154 164 const UInt_t cnt = n1<n2 ? n : n1-n2; 155 165 166 // Calculate the rate 156 167 const Double_t rate = (Double_t)cnt/(fTimes[n1%n]-fTimes[n2%n]); 157 168 169 // Store the time difference between two consecutive events 170 fTimeDiff->SetVal(exec==0 ? -1 : fTimes[n1%n] - fTimes[(n1+n-1)%n]); 171 fTimeDiff->SetReadyToSave(); 172 173 // Store the rate 158 174 fRate->SetRate(exec>1?rate:0, cnt); 159 175 fRate->SetReadyToSave(); 160 176 161 fTimeDiff->SetVal(exec==0 ? -1 : fTimes[n1%n] - fTimes[(n1+n-1)%n]);162 fTime Diff->SetReadyToSave();177 // Store the corresponding time 178 fTimeRate->SetMean(fTimes[n1%n], fTimes[n2%n]); 163 179 164 180 return kTRUE; -
trunk/MagicSoft/Mars/manalysis/MEventRateCalc.h
r4833 r4887 19 19 static const TString gsDefTitle; //! Default title of container 20 20 21 static const TString gsNameEventRate; //! default name of rate container 21 22 static const TString gsNameTime; //! Default name of time container 22 static const TString gsNameEventRate; //! default name of rate container23 23 static const TString gsNameTimeDiff; //! default name of time-diff container 24 static const TString gsNameTimeRate; //! default name of time-rate container 24 25 25 26 static const Int_t gsNumEvents; //! Default number of events … … 27 28 28 29 MTime *fTime; //! pointer to event time 30 MTime *fTimeRate; //! pointer to time of event rate 29 31 MEventRate *fRate; //! pointer to rate storage container 30 32 MParameterD *fTimeDiff; //! Difference of time between two consecutive events 31 33 34 TString fNameEventRate; // name of event rate container 32 35 TString fNameTime; // name of time container 33 TString fName EventRate; // name of event rate container36 TString fNameTimeRate; // name of event rate time container 34 37 TString fNameTimeDiff; // name of time-diff container 35 38 36 39 TArrayD fTimes; //! internal array to store the last n event times 37 38 40 39 41 Int_t PreProcess(MParList *pList); … … 48 50 void SetNumEvents(ULong_t num) { fTimes.Set(num); } 49 51 52 void SetNameEventRate(const char *name) { fNameEventRate = name; } 50 53 void SetNameTime(const char *name) { fNameTime = name; } 51 void SetNameEventRate(const char *name) { fNameEventRate = name; }52 54 void SetNameTimeDiff(const char *name) { fNameTimeDiff = name; } 55 void SetNameTimeRate(const char *name) { fNameTimeRate = name; } 53 56 54 57 ClassDef(MEventRateCalc, 1)// Task to calculate event rates -
trunk/MagicSoft/Mars/manalysis/MParameters.cc
r2173 r4887 18 18 ! Author(s): Thomas Bretz 03/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 320 ! Copyright: MAGIC Software Development, 2000-2004 21 21 ! 22 22 ! … … 42 42 ClassImp(MParameterD); 43 43 ClassImp(MParameterI); 44 ClassImp(MParameterDerr); 44 45 //ClassImp(MParameter); 45 46 … … 60 61 // Default constructor. 61 62 // 63 MParameterDerr::MParameterDerr(const char *name, const char *title) 64 { 65 fName = name ? name : "MParameterDerr"; 66 fTitle = title ? title : "Storgare container for general parameters (double) and its error"; 67 } 68 69 // -------------------------------------------------------------------------- 70 // 71 // Default constructor. 72 // 62 73 MParameterI::MParameterI(const char *name, const char *title) 63 74 { -
trunk/MagicSoft/Mars/manalysis/MParameters.h
r1951 r4887 18 18 19 19 ClassDef(MParameterD, 1) // Container to hold a generalized parameters (double) 20 }; 21 22 class MParameterDerr : public MParContainer 23 { 24 private: 25 Double_t fVal; 26 Double_t fErr; 27 28 public: 29 MParameterDerr(const char *name=NULL, const char *title=NULL); 30 31 void SetVal(Double_t v, Double_t e) { fVal = v; fErr = e; } 32 Double_t GetVal() const { return fVal; } 33 Double_t GetErr() const { return fErr; } 34 35 ClassDef(MParameterDerr, 1) // Container to hold a generalized parameters (double) and its Error 20 36 }; 21 37
Note:
See TracChangeset
for help on using the changeset viewer.