Changeset 9342 for trunk/MagicSoft/Mars/msim
- Timestamp:
- 02/15/09 15:52:47 (16 years ago)
- Location:
- trunk/MagicSoft/Mars/msim
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msim/MPhotonEvent.cc
r9301 r9342 113 113 #include <TMarker.h> 114 114 115 #include <MMath.h> 116 117 #include "MArrayF.h" 118 115 119 #include "MLog.h" 116 120 #include "MLogManip.h" … … 213 217 } 214 218 219 // -------------------------------------------------------------------------- 220 // 221 // Return the number of "external" photons, i.e. which are not NightSky 222 // 215 223 Int_t MPhotonEvent::GetNumExternal() const 216 224 { … … 222 230 223 231 return n; 232 } 233 234 // -------------------------------------------------------------------------- 235 // 236 // Return time of first photon, 0 if none in array. 237 // Note: If you want this to be the earliest make sure that the array 238 // is properly sorted. 239 // 240 Float_t MPhotonEvent::GetTimeFirst() const 241 { 242 const MPhotonData *dat=GetFirst(); 243 return dat ? dat->GetTime() : 0; 244 } 245 246 // -------------------------------------------------------------------------- 247 // 248 // Return time of first photon, 0 if none in array. 249 // Note: If you want this to be the latest make sure that the array 250 // is properly sorted. 251 // 252 Float_t MPhotonEvent::GetTimeLast() const 253 { 254 const MPhotonData *dat=GetLast(); 255 return dat ? dat->GetTime() : 0; 256 } 257 258 // -------------------------------------------------------------------------- 259 // 260 // Return the median devian from the median of all arrival times. 261 // The median deviation is calculated using MMath::MedianDev. 262 // It is the half width in which one sigma (~68%) of all times are 263 // contained around the median. 264 // 265 Double_t MPhotonEvent::GetTimeMedianDev() const 266 { 267 const UInt_t n = GetNumPhotons(); 268 269 MArrayF arr(n); 270 for (UInt_t i=0; i<n; i++) 271 arr[i] = operator[](i).GetTime(); 272 273 return MMath::MedianDev(n, arr.GetArray()/*, Double_t &med*/); 224 274 } 225 275 -
trunk/MagicSoft/Mars/msim/MPhotonEvent.h
r9308 r9342 80 80 Int_t GetNumExternal() const; 81 81 82 Float_t GetTimeFirst() const; 83 Float_t GetTimeLast() const; 84 Double_t GetTimeMedianDev() const; 85 82 86 TClonesArray &GetArray() { return fData; } 83 87 const TClonesArray &GetArray() const { return fData; } … … 131 135 { 132 136 private: 133 Float_t fTimeFirst; 134 Float_t fTimeLast; 137 Float_t fTimeFirst; //! Start of (simulated) sampling window 138 Float_t fTimeLast; //! Start of (simulated) sampling window 139 140 Float_t fLength; // Time between first and last photon 141 Float_t fTimeMedDev; // Median deviation 135 142 136 143 // Float_t fOffset; 137 144 // Float_t fWindow; 138 145 139 Int_t fMaxIndex; 146 Int_t fMaxIndex; //! 140 147 141 148 public: … … 147 154 148 155 void SetTime(Float_t first, Float_t last) { fTimeFirst=first; fTimeLast=last; } 156 void SetLength(Float_t len) { fLength=len; } 149 157 void SetMaxIndex(UInt_t idx) { fMaxIndex=idx; } 158 void SetTimeMedDev(Float_t dev) { fTimeMedDev=dev; } 150 159 151 160 // Float_t GetRawTimeFirst() const { return fTimeFirst; } … … 154 163 Float_t GetTimeFirst() const { return fTimeFirst; } 155 164 Float_t GetTimeLast() const { return fTimeLast; } 165 166 Float_t GetLength() const { return fLength; } 167 Float_t GetTimeMedDev() const { return fTimeMedDev; } 156 168 157 169 Int_t GetMaxIndex() const { return fMaxIndex; }
Note:
See TracChangeset
for help on using the changeset viewer.