Changeset 2617
- Timestamp:
- 12/07/03 15:00:13 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2612 r2617 9 9 - added some new member function 10 10 - fixed wrong calculations 11 - moved all stand-alone operators into class 11 12 12 13 * mhist/MHPixVsTime.cc, mhist/MHVsTime.cc: 13 14 - fixed MTime handling 15 16 * Makefile.rules: 17 - removed obsolete $(HEADERS) from rule for $(LIB) 18 - added $(CINT)LinkDef.h for rule for $(CINT)Cint.cc 19 20 * mbase/BaseLinkDef.h: 21 - added operator<<(ostream&, MTime&) 22 23 * mmain/MOnlineDump.cc: 24 - fixed a small bug using MTime 14 25 15 26 -
trunk/MagicSoft/Mars/Makefile.rules
r2492 r2617 1 1 2 $(LIB): $(OBJS) $( HEADERS) $(CINT)Cint.o2 $(LIB): $(OBJS) $(CINT)Cint.o 3 3 @echo " - Building Library lib$(LIB)" 4 4 $(AR) $(LIB) *.o 5 5 @echo " " 6 6 7 $(CINT)Cint.cc: $(HEADERS) 7 $(CINT)Cint.cc: $(HEADERS) $(CINT)LinkDef.h 8 8 @echo " - Generating dictionary $(CINT)Cint.cc" 9 9 -
trunk/MagicSoft/Mars/mbase/BaseLinkDef.h
r2604 r2617 50 50 51 51 #pragma link C++ class MTime+; 52 #pragma link C++ function operator<<(ostream&, const MTime&); 52 53 53 54 #pragma link C++ class MArgs+; -
trunk/MagicSoft/Mars/mbase/MTime.h
r2612 r2617 22 22 class MTime : public MParContainer 23 23 { 24 friend bool operator==(MTime &t1, MTime &t2);25 friend bool operator!=(MTime &t1, MTime &t2);26 friend bool operator< (MTime &t1, MTime &t2);27 friend bool operator> (MTime &t1, MTime &t2);28 //friend bool operator<=(MTime &t1, MTime &t2);29 //friend bool operator>=(MTime &t1, MTime &t2);30 31 24 private: 32 25 static const UInt_t kHour; // [ms] one hour 33 26 static const UInt_t kDay; // [ms] one day 34 27 35 36 37 28 UInt_t fMjd; // [d] Day in the century (Day of sun rise) 29 TTime fTime; // [ms] Time of Day (-11h<=x<13h) 30 UInt_t fNanoSec; // [ns] NanoSec part of TimeOfDay (<1000000) 38 31 39 40 41 42 43 44 32 ULong_t GetTime24() const 33 { 34 return (Long_t)fTime<0 ? (Long_t)fTime+kDay : (ULong_t)fTime; 35 } 36 void Init(const char *name, const char *title) 37 { 45 38 fName = name ? name : "MTime"; 46 39 fTitle = title ? title : "Generalized time stamp"; 47 40 } 48 41 49 42 public: … … 111 104 } 112 105 106 bool operator<(const MTime &t) const 107 { 108 if (fMjd<t.fMjd) 109 return true; 110 if (fMjd==t.fMjd && fTime<t.fTime) 111 return true; 112 if (fMjd==t.fMjd && fTime==t.fTime && fNanoSec<t.fNanoSec) 113 return true; 114 return false; 115 } 116 bool operator>(const MTime &t) const 117 { 118 if (fMjd>t.fMjd) 119 return true; 120 if (fMjd==t.fMjd && fTime>t.fTime) 121 return true; 122 if (fMjd==t.fMjd && fTime==t.fTime && fNanoSec>t.fNanoSec) 123 return true; 124 return false; 125 } 126 127 bool operator<=(const MTime &t) const 128 { 129 return !operator>(t); 130 } 131 132 bool operator>=(const MTime &t) const 133 { 134 return !operator<(t); 135 } 136 137 bool operator==(const MTime &t) const 138 { 139 return fNanoSec==t.fNanoSec && fTime==t.fTime && fMjd==t.fMjd; 140 } 141 142 bool operator!=(const MTime &t) const 143 { 144 return fNanoSec!=t.fNanoSec || fTime!=t.fTime || fMjd!=t.fMjd; 145 } 146 147 bool operator!() const 148 { 149 return fNanoSec==0 && (ULong_t)fTime==0 && fMjd==0; 150 } 151 113 152 ClassDef(MTime, 3) //A generalized MARS time stamp 114 153 }; 115 154 116 inline bool operator<(MTime &t1, MTime &t2) 117 { 118 if (t1.fMjd<t2.fMjd) 119 return true; 120 if (t1.fMjd==t2.fMjd && t1.fTime<t2.fTime) 121 return true; 122 if (t1.fMjd==t2.fMjd && t1.fTime==t2.fTime && t1.fNanoSec<t2.fNanoSec) 123 return true; 124 return false; 125 } 126 127 inline bool operator>(MTime &t1, MTime &t2) 128 { 129 if (t1.fMjd>t2.fMjd) 130 return true; 131 if (t1.fMjd==t2.fMjd && t1.fTime>t2.fTime) 132 return true; 133 if (t1.fMjd==t2.fMjd && t1.fTime==t2.fTime && t1.fNanoSec>t2.fNanoSec) 134 return true; 135 return false; 136 } 137 138 inline bool operator<=(MTime &t1, MTime &t2) 139 { 140 return !(t1>t2); 141 } 142 143 inline bool operator>=(MTime &t1, MTime &t2) 144 { 145 return !(t1<t2); 146 } 147 148 inline bool operator==(MTime &t1, MTime &t2) 149 { 150 return t1.fNanoSec==t2.fNanoSec && t1.fTime==t2.fTime && t1.fMjd==t2.fMjd; 151 } 152 153 inline bool operator!=(MTime &t1, MTime &t2) 154 { 155 return t1.fNanoSec!=t2.fNanoSec || t1.fTime!=t2.fTime || t1.fMjd!=t2.fMjd; 156 } 157 158 inline ostream &operator<<(ostream &out, MTime &t) 155 inline ostream &operator<<(ostream &out, const MTime &t) 159 156 { 160 157 out << t.GetString(); -
trunk/MagicSoft/Mars/mmain/MOnlineDump.cc
r2604 r2617 38 38 Bool_t set = kFALSE; 39 39 40 if ( *fEvtTime==0)40 if (!*fEvtTime) 41 41 { 42 42 fEvtTime->Now(); … … 51 51 52 52 if (evts>0 && sec>0 && fDisplay) 53 fDisplay->SetStatusLine2(Form("Trigger Rate: %.1fHz / Event Rate: %.1fHz", evts/sec, fRate->GetRate())); 53 fDisplay->SetStatusLine2(Form("%sTrigger Rate: %.1fHz / Event Rate: %.1fHz", 54 (set?"Arb. ":""), evts/sec, fRate->GetRate())); 54 55 55 56 if (set)
Note:
See TracChangeset
for help on using the changeset viewer.