Changeset 4887
- Timestamp:
- 09/07/04 18:31:53 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r4885 r4887 44 44 and maybe to secure everything from compiler bugs a bit more 45 45 46 * callisto.cc, star.cc: 47 - do not allow implicit batch-mode 48 49 * showlog.cc: 50 - removed an unused variable 51 52 * manalysis/MEventRateCalc.[h,cc]: 53 - started implementing a corrsponding time 54 55 * manalysis/MParameters.[h,cc], manalysis/AnalysisLinkDef.h: 56 - added MParameterDerr 57 58 * mbadpixels/MHBadPixels.[h,cc]: 59 - removed obsolete fPedPhotCam 60 61 * mbase/MTime.[h,cc]: 62 - added AddMilliSeconds 63 - added SetMean 64 65 46 66 47 67 … … 68 88 - included functions AddCamContent(MArrayD...) and 69 89 SetCamContent(MArrayD... ) 90 70 91 71 92 -
trunk/MagicSoft/Mars/callisto.cc
r4800 r4887 262 262 263 263 TApplication app("Callisto", &argc, argv); 264 if (!gROOT->IsBatch() && !gClient )264 if (!gROOT->IsBatch() && !gClient || gROOT->IsBatch() && !kBatch) 265 265 { 266 266 gLog << err << "Bombing... maybe your DISPLAY variable is not set correctly!" << endl; -
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 -
trunk/MagicSoft/Mars/mbadpixels/MHBadPixels.cc
r4874 r4887 35 35 #include "MBadPixelsCam.h" 36 36 #include "MGeomCam.h" 37 #include "MPedPhotCam.h"38 37 #include "MParList.h" 39 38 #include "MBinning.h" … … 51 50 // 52 51 MHBadPixels::MHBadPixels(const char *name, const char *title) 52 : fNamePedPhotCam("MPedPhotCam") 53 53 { 54 54 fName = name ? name : "MHBadPixels"; … … 67 67 fBadN.SetYTitle("number of bad pixels"); 68 68 69 fNamePedPhotCam = "MPedPhotCamFromData";70 69 } 71 70 … … 79 78 if (!fCam) 80 79 { 81 *fLog << err << "M HBadPixels::SetupFill; MGeomCam not found... aborting." << endl;80 *fLog << err << "MGeomCam not found... aborting." << endl; 82 81 return kFALSE; 83 82 } 84 *fLog << "MHBadPixels::SetupFill; fCam = " << fCam << endl;85 86 83 fPointPos = (MPointingPos*)plist->FindObject("MPointingPos"); 87 84 if (!fPointPos) … … 91 88 } 92 89 93 94 fPedPhot = (MPedPhotCam*)plist->FindObject(AddSerialNumber(fNamePedPhotCam), "MPedPhotCam");95 if (!fPedPhot)96 {97 *fLog << err << AddSerialNumber(fNamePedPhotCam)98 << "[MPedPhotCam] not found... aborting." << endl;99 return kFALSE;100 }101 fPedPhot->InitSize(fCam->GetNumPixels());102 103 90 //---------------------------------------------------- 104 91 // Get Theta Binning … … 106 93 if (!binstheta) 107 94 { 108 *fLog << err << " Object 'BinningTheta'[MBinning] not found... aborting" << endl;95 *fLog << err << "BinningTheta [MBinning] not found... aborting" << endl; 109 96 return kFALSE; 110 97 } 111 98 112 99 // Get binning for pixel number 113 const UInt_t npix1 = fPedPhot->GetSize()+1; 114 115 *fLog << "MHBadPixels::SetupFill; npix1 = " << npix1 << endl; 100 const UInt_t npix1 = fCam->GetNumPixels()+1; 116 101 117 102 MBinning binspix("BinningPixel"); … … 121 106 SetBinning(&fBadId, binstheta, &binspix); 122 107 SetBinning(&fBadN, binstheta, &binspix); 123 124 //----------------------------------------------------125 *fLog << inf << "Name of MPedPhotCam container : " << fNamePedPhotCam126 << endl;127 108 128 109 return kTRUE; … … 141 122 Double_t theta = fPointPos->GetZd(); 142 123 143 const MBadPixelsCam * fBadPixels = (MBadPixelsCam*)par;124 const MBadPixelsCam *badpixels = (MBadPixelsCam*)par; 144 125 145 const UInt_t entries = fPedPhot->GetSize(); 126 const UInt_t entries = badpixels->GetSize(); 127 146 128 UInt_t nb = 0; 147 129 for (UInt_t i=0; i<entries; i++) 148 130 { 149 //*fLog << "MHBadPixels::Fill; i = " << i << endl; 150 151 if ( (*fBadPixels)[i].IsUnsuitable() ) 152 { 153 //*fLog << "MHBadPixels::Fill; (UnSuitable) " << endl; 154 155 fBadId.Fill(theta, i, w); 156 nb++; 157 } 131 if ( (*badpixels)[i].IsUnsuitable() ) 132 { 133 fBadId.Fill(theta, i, w); 134 nb++; 135 } 158 136 } 159 137 fBadN.Fill(theta, nb, w); … … 204 182 pad->Update(); 205 183 } 206 //==========================================================================207 208 209 210 211 212 213 214 215 216 217 -
trunk/MagicSoft/Mars/mbadpixels/MHBadPixels.h
r4841 r4887 18 18 private: 19 19 MGeomCam *fCam; //! 20 MPedPhotCam *fPedPhot; //!21 20 MPointingPos *fPointPos; //! 22 21 … … 37 36 const TH2D *GetBadN() const { return &fBadN; } 38 37 39 TH2 *GetBadIdByName(const TString name) { return &fBadId; }40 TH2 *GetBadNByName(const TString name) { return &fBadN; }41 42 38 void Draw(Option_t* option = ""); 43 39 Bool_t SetupFill(const MParList *plist); -
trunk/MagicSoft/Mars/mbase/MTime.cc
r4732 r4887 563 563 return fin; 564 564 } 565 566 void MTime::AddMilliSeconds(UInt_t ms) 567 { 568 fTime += ms; 569 570 fTime += 11*kHour; 571 fMjd += (Long_t)fTime/kDay; 572 fTime = (Long_t)fTime%kDay; 573 fTime -= 11*kHour; 574 } 575 /* 576 MTime MTime::operator-(const MTime &tm1) 577 { 578 const MTime &tm0 = *this; 579 580 MTime t0 = tm0>tm1 ? tm0 : tm1; 581 const MTime &t1 = tm0>tm1 ? tm1 : tm0; 582 583 if (t0.fNanoSec<t1.fNanoSec) 584 { 585 t0.fNanoSec += 1000000; 586 t0.fTime -= 1; 587 } 588 589 t0.fNanoSec -= t1.fNanoSec; 590 t0.fTime -= t1.fTime; 591 592 if ((Long_t)t0.fTime<-(Long_t)kHour*11) 593 { 594 t0.fTime += kDay; 595 t0.fMjd--; 596 } 597 598 t0.fMjd -= t1.fMjd; 599 600 return t0; 601 } 602 603 void MTime::operator-=(const MTime &t) 604 { 605 *this = *this-t; 606 } 607 608 MTime MTime::operator+(const MTime &t1) 609 { 610 MTime t0 = *this; 611 612 t0.fNanoSec += t1.fNanoSec; 613 614 if (t0.fNanoSec>999999) 615 { 616 t0.fNanoSec -= 1000000; 617 t0.fTime += kDay; 618 } 619 620 t0.fTime += t1.fTime; 621 622 if ((Long_t)t0.fTime>=(Long_t)kHour*13) 623 { 624 t0.fTime -= kDay; 625 t0.fMjd++; 626 } 627 628 t0.fMjd += t1.fMjd; 629 630 return t0; 631 } 632 633 void MTime::operator+=(const MTime &t) 634 { 635 *this = *this+t; 636 } 637 */ 638 639 void MTime::SetMean(const MTime &t0, const MTime &t1) 640 { 641 // This could be an operator+ 642 *this = t0; 643 644 fNanoSec += t1.fNanoSec; 645 646 if (fNanoSec>999999) 647 { 648 fNanoSec -= 1000000; 649 fTime += kDay; 650 } 651 652 fTime += t1.fTime; 653 654 if ((Long_t)fTime>=(Long_t)kHour*13) 655 { 656 fTime -= kDay; 657 fMjd++; 658 } 659 660 fMjd += t1.fMjd; 661 662 // This could be an operator/ 663 if ((Long_t)fTime<0) 664 { 665 fTime += kDay; 666 fMjd--; 667 } 668 669 Int_t reminder = fMjd%2; 670 fMjd /= 2; 671 672 fTime += reminder*kDay; 673 reminder = (Long_t)fTime%2; 674 fTime /= 2; 675 676 fNanoSec += reminder*1000000; 677 fNanoSec /= 2; 678 679 fTime += 11*kHour; 680 fMjd += (Long_t)fTime/kDay; 681 fTime = (Long_t)fTime%kDay; 682 fTime -= 11*kHour; 683 } 684 685 void MTime::SetMean(Double_t t0, Double_t t1) 686 { 687 const Double_t mean = (t0+t1)*(500./kDay); 688 SetMjd(mean); 689 } -
trunk/MagicSoft/Mars/mbase/MTime.h
r4627 r4887 35 35 UInt_t fNanoSec; // [ns] NanoSec part of TimeOfDay (<1000000) 36 36 37 37 38 ULong_t GetTime24() const 38 39 { … … 75 76 void Now(); 76 77 78 // Setter functions 77 79 Bool_t Set(UShort_t y, Byte_t m, Byte_t d, Byte_t h=13, Byte_t min=0, Byte_t s=0, UShort_t ms=0, UInt_t ns=0); 78 80 void Set(const struct timeval &tv); … … 85 87 Bool_t SetMjd(UInt_t mjd, ULong_t ms, UInt_t ns=0); 86 88 void SetMjd(Double_t m); 89 90 // Getter functions 87 91 Double_t GetMjd() const; 88 92 Double_t GetGmst() const; … … 111 115 UInt_t Sec() const { Byte_t h, m, s; GetTime(h,m,s); return s; } 112 116 117 // I/O functions 113 118 istream &ReadBinary(istream &fin); 114 119 115 operator double() const //[s] 116 { 117 return ((Double_t)fMjd*kDay+(Long_t)fTime+fNanoSec/1e6)/1000; 118 } 119 double operator()() const //[s] 120 { 121 return operator double(); 122 } 123 124 bool operator<(const MTime &t) const 125 { 126 if (fMjd<t.fMjd) 127 return true; 128 if (fMjd==t.fMjd && fTime<t.fTime) 129 return true; 130 if (fMjd==t.fMjd && fTime==t.fTime && fNanoSec<t.fNanoSec) 131 return true; 132 return false; 133 } 134 bool operator>(const MTime &t) const 135 { 136 if (fMjd>t.fMjd) 137 return true; 138 if (fMjd==t.fMjd && fTime>t.fTime) 139 return true; 140 if (fMjd==t.fMjd && fTime==t.fTime && fNanoSec>t.fNanoSec) 141 return true; 142 return false; 143 } 144 145 bool operator<=(const MTime &t) const 146 { 147 return !operator>(t); 148 } 149 150 bool operator>=(const MTime &t) const 151 { 152 return !operator<(t); 153 } 154 155 bool operator==(const MTime &t) const 156 { 157 return fNanoSec==t.fNanoSec && fTime==t.fTime && fMjd==t.fMjd; 158 } 159 160 bool operator!=(const MTime &t) const 161 { 162 return fNanoSec!=t.fNanoSec || fTime!=t.fTime || fMjd!=t.fMjd; 163 } 164 165 bool operator!() const 166 { 167 return fNanoSec==0 && (ULong_t)fTime==0 && fMjd==0; 168 } 120 // Conversion functions 121 operator double() const; //[s] 122 double operator()() const; //[s] 123 124 // Calculation functions 125 void AddMilliSeconds(UInt_t ms); 126 void SetMean(const MTime &t0, const MTime &t1); 127 void SetMean(Double_t t0, Double_t t1); 128 /* 129 MTime operator-(const MTime &tm1); 130 void operator-=(const MTime &t); 131 MTime operator+(const MTime &t1); 132 void operator+=(const MTime &t); 133 */ 134 135 // Base comparison operators 136 bool operator<(const MTime &t) const; 137 bool operator>(const MTime &t) const; 138 139 // Derived comparison operators 140 bool operator<=(const MTime &t) const; 141 bool operator>=(const MTime &t) const; 142 bool operator==(const MTime &t) const; 143 bool operator!=(const MTime &t) const; 144 bool operator!() const; 169 145 170 146 ClassDef(MTime, 3) //A generalized MARS time stamp … … 186 162 } 187 163 188 #endif 164 inline MTime::operator double() const //[s] 165 { 166 return ((Double_t)fMjd*kDay+(Long_t)fTime+fNanoSec/1e6)/1000; 167 } 168 169 inline double MTime::operator()() const //[s] 170 { 171 return operator double(); 172 } 173 174 inline bool MTime::operator<(const MTime &t) const 175 { 176 if (fMjd<t.fMjd) 177 return true; 178 if (fMjd==t.fMjd && fTime<t.fTime) 179 return true; 180 if (fMjd==t.fMjd && fTime==t.fTime && fNanoSec<t.fNanoSec) 181 return true; 182 return false; 183 } 184 185 inline bool MTime::operator>(const MTime &t) const 186 { 187 if (fMjd>t.fMjd) 188 return true; 189 if (fMjd==t.fMjd && fTime>t.fTime) 190 return true; 191 if (fMjd==t.fMjd && fTime==t.fTime && fNanoSec>t.fNanoSec) 192 return true; 193 return false; 194 } 195 196 inline bool MTime::operator<=(const MTime &t) const 197 { 198 return !operator>(t); 199 } 200 201 inline bool MTime::operator>=(const MTime &t) const 202 { 203 return !operator<(t); 204 } 205 206 inline bool MTime::operator==(const MTime &t) const 207 { 208 return fNanoSec==t.fNanoSec && fTime==t.fTime && fMjd==t.fMjd; 209 } 210 211 inline bool MTime::operator!=(const MTime &t) const 212 { 213 return fNanoSec!=t.fNanoSec || fTime!=t.fTime || fMjd!=t.fMjd; 214 } 215 216 inline bool MTime::operator!() const 217 { 218 return fNanoSec==0 && (ULong_t)fTime==0 && fMjd==0; 219 } 220 221 #endif -
trunk/MagicSoft/Mars/showlog.cc
r4800 r4887 32 32 { 33 33 static const TRegexp regexp("[][[][0-9]+[m]"); 34 35 int i=0;36 34 37 35 while (1) -
trunk/MagicSoft/Mars/star.cc
r4828 r4887 182 182 183 183 TApplication app("Star", &argc, argv); 184 if (!gROOT->IsBatch() && !gClient )184 if (!gROOT->IsBatch() && !gClient || gROOT->IsBatch() && !kBatch) 185 185 { 186 186 gLog << err << "Bombing... maybe your DISPLAY variable is not set correctly!" << endl;
Note:
See TracChangeset
for help on using the changeset viewer.