Ignore:
Timestamp:
09/23/19 18:11:51 (5 years ago)
Author:
tbretz
Message:
last is the number of samples converted to nanoseconds, the conversion was wrong -- fixed. Renamed ns to win for a better readability. The pulse spline x-axis is samples, not nano-seconds, added the conversion factor. Added a longer comment about the calculation.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/msimcamera/MSimGeomCam.cc

    r9425 r19663  
    184184    // We add an additional sample at the end to support a possible shift
    185185    // of the start time of the first event by 0 to 1 sample.
    186     const Int_t   ns   = fHeader->GetNumSamplesHiGain()+1;
    187 
     186    const Float_t  win  = (fHeader->GetNumSamplesHiGain()+1)/freq;
     187
     188    // First and last photon in event (in nano-seconds)
    188189    const Float_t first = cnt>0 ? fEvt->GetTimeFirst() :  0;
    189     const Float_t last  = cnt>0 ? fEvt->GetTimeLast()  : ns*freq;
     190    const Float_t last  = cnt>0 ? fEvt->GetTimeLast()  : win;
    190191
    191192    // Length (ns), Pulse position (Units ns)
    192193    const Float_t pp   = fPulsePos ? fPulsePos->GetVal() : 0;
    193     const Float_t pw   = fPulse    ? fPulse->GetWidth()  : 0;
     194    const Float_t pw   = fPulse    ? fPulse->GetWidth()/freq : 0;
     195
     196    // If the trigger is ssupposed to be at position (pp),
     197    // then we have to start our sampling pp before
     198    // the first photon (first-pp). To have the tail
     199    // of a possible previous pulse at the beginning
     200    // of the window properly samples, we have to start
     201    // sampling (pw) nanoseconds earlier,
     202    // thus at: first-pw-pp
     203    //
     204    // The last possible readout window starts pp before
     205    // the last photon and lasts for a width corresponding
     206    // to the number of samples (win). The last pulse
     207    // that should be reaosnable added to the readout
     208    // window is the one which comes at the end.
    194209
    195210    fStat->SetTimeMedDev(fEvt->GetTimeMedianDev());
    196     fStat->SetTime(first-pp-pw, last-pp+pw + ns*freq);
     211    fStat->SetTime(first-pp-pw, last-pp + win);
    197212    fStat->SetLength(last-first);
    198213    fStat->SetMaxIndex(fGeom->GetNumPixels()-1);
Note: See TracChangeset for help on using the changeset viewer.