Changeset 8689 for trunk/MagicSoft/Mars/mpointing
- Timestamp:
- 08/21/07 23:20:48 (18 years ago)
- Location:
- trunk/MagicSoft/Mars/mpointing
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mpointing/MHSrcPosCam.cc
r8657 r8689 33 33 #include "MHSrcPosCam.h" 34 34 35 #include <TVector2.h> 35 36 #include <TCanvas.h> 36 37 #include <TEllipse.h> … … 57 58 // 58 59 MHSrcPosCam::MHSrcPosCam(Bool_t wobble, const char *name, const char *title) 59 : fTimeEffOn(NULL), fEffOnTime(NULL), fSourcePos(NULL) 60 : fTimeEffOn(NULL), fEffOnTime(NULL), fSourcePos(NULL), 61 fPositions("TVector2", 50000) 60 62 { 61 63 // … … 119 121 120 122 fHist.Reset(); 121 fXY = TVector2();122 fNum = 0;123 123 fTimeLastEffOn = MTime(); 124 124 fConvMm2Deg = geom->GetConvMm2Deg(); 125 fNum = 0; 125 126 126 127 return kTRUE; … … 129 130 // -------------------------------------------------------------------------- 130 131 // 131 // 132 // 132 // All source positions are buffered until the time of the effective on 133 // time time stamp changes. Then the observation time is split into 134 // identical parts and the histogram is filled by these events. The 135 // effective on time time stamp is reset and the buffered source positions 136 // deleted. 137 // 133 138 Bool_t MHSrcPosCam::Fill(const MParContainer *par, const Stat_t w) 134 139 { … … 140 145 } 141 146 142 // if (fName=="MHSrcPosCam") 143 // { 144 fXY += cam->GetXY(); 145 fNum++; 146 147 // Increase array size if necessary 148 if (fNum==fPositions.GetSize()) 149 fPositions.Expand(fNum*2); 150 151 // buffer position into array (could be speed up a little bit more 152 // by using ExpandCreate and memcpy) 153 new (fPositions[fNum++]) TVector2(cam->GetXY()*fConvMm2Deg); 154 155 // Check if there is a new effective on time 147 156 if (fTimeLastEffOn==MTime()) 148 157 fTimeLastEffOn=*fTimeEffOn; … … 151 160 return kTRUE; 152 161 153 fXY *= fConvMm2Deg/fNum; 154 155 fHist.Fill(fXY.X(), fXY.Y(), fEffOnTime->GetVal()); 156 // } 157 // else 158 // fHist.Fill(cam->GetX()*fConvMm2Deg, cam->GetY()*fConvMm2Deg); 159 160 fXY = TVector2(); 161 fNum = 0; 162 // Split the observation time to all buffered events 163 const Double_t scale = fEffOnTime->GetVal()/fNum; 164 165 // Fill histogram from array 166 for (int i=0; i<fNum; i++) 167 { 168 const TVector2 &v = (TVector2&)*fPositions[i]; 169 fHist.Fill(v.X(), v.Y(), scale); 170 } 171 172 // reset time stamp and remove all buffered positions 162 173 fTimeLastEffOn = *fTimeEffOn; 174 fNum = 0; 163 175 164 176 return kTRUE; 165 177 } 166 178 179 // -------------------------------------------------------------------------- 180 // 167 181 void MHSrcPosCam::Paint(Option_t *) 168 182 { … … 172 186 // -------------------------------------------------------------------------- 173 187 // 174 //175 //176 188 void MHSrcPosCam::Draw(Option_t *) 177 189 { -
trunk/MagicSoft/Mars/mpointing/MHSrcPosCam.h
r8388 r8689 14 14 #endif 15 15 16 #ifndef ROOT_T Vector217 #include <T Vector2.h>16 #ifndef ROOT_TClonesArray 17 #include <TClonesArray.h> 18 18 #endif 19 19 … … 25 25 { 26 26 private: 27 TH2D fHist; // 27 TH2D fHist; // Histogram of observation time vs source position 28 28 29 private: 30 MTime fTimeLastEffOn; //! 31 MTime *fTimeEffOn; //! 32 MParameterD *fEffOnTime; //! 33 MPointingPos *fSourcePos; //! 29 MTime fTimeLastEffOn; //! Last time stamp of effective on time 30 MTime *fTimeEffOn; //! Current effective on time 31 MParameterD *fEffOnTime; //! Effective on time 32 MPointingPos *fSourcePos; //! Pointing position of the telescope 34 33 35 TVector2 fXY; //!36 UInt_t fNum; //!37 Double_t fConvMm2Deg; //!34 Double_t fConvMm2Deg; //! Conversion factor from mm to deg 35 TClonesArray fPositions; //! Buffer to store source positions 36 Int_t fNum; //! Position in array 38 37 39 38 public: 40 //MHSrcPosCam(const char *name=NULL, const char *title=NULL);41 39 MHSrcPosCam(Bool_t wobble=kFALSE, const char *name=NULL, const char *title=NULL); 42 40
Note:
See TracChangeset
for help on using the changeset viewer.