Ignore:
Timestamp:
09/23/19 18:17:17 (5 years ago)
Author:
tbretz
Message:
Added some longer comments on the meaning of some variables, the valid range must be aligned with the pulse width, not Xminand Xmax of the pulse. The pulse is now shifted such that a photon with t=0 (w.r.t. to the simulation sampling window) gets sampled fully into the window
File:
1 edited

Legend:

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

    r19623 r19664  
    297297    // FIXME: Should we use a higher sampling here?
    298298
     299    // Start end end of sampling window (in ns, converted to samples)
     300    // The sampling window starts at start+pulsewidth to have a potential
     301    // previous pulse in the widdow. The trigger should then be at
     302    // start+pulsewidth+triggerpos
    299303    const Double_t start = fStat->GetTimeFirst()*freq;
    300304    const Double_t end   = fStat->GetTimeLast() *freq;
    301305
     306    // Length of the simulated window (in units of samples)
     307    // nlen = (last-first)+roi+pulsewidth
    302308    const UInt_t   nlen  = TMath::CeilNint(end-start);
    303309
     
    313319    }
    314320
    315     const Double_t pl = fSpline->GetXmin()*freq;
    316     const Double_t pr = fSpline->GetXmax()*freq;
     321    const Double_t pw = fSpline->GetXmax()-fSpline->GetXmin(); // [samples] Width of pulse
    317322
    318323    // Init the arrays and set the range which will contain valid data
     324    // FIXME: There must be some contingency for all the time offsets...
     325    // otherwise, we might loose late triggers!!!!!
    319326    fCamera->Init(npix, nlen);
    320     fCamera->SetValidRange(TMath::FloorNint(pr), TMath::CeilNint(nlen+pl));
     327    fCamera->SetValidRange(TMath::FloorNint(pw), nlen);
    321328
    322329    Double_t timeoffset[npix];
    323 
    324330
    325331    // Add electronic noise to empty channels
     
    504510        const Double_t gain = (*fGain)[idx].GetPedestal();
    505511
     512        // The "-GetXmin" ensures that a photon at t=0 does not get sampled
     513        // before the sampling window!
    506514        // === FIXME === FIXME === FIXME === Frequency!!!!
    507         (*fCamera)[idx].AddPulse(*fSpline, t, ph.GetWeight()*gain);
     515        (*fCamera)[idx].AddPulse(*fSpline, t - fSpline->GetXmin(), ph.GetWeight()*gain);
    508516    }
    509517
Note: See TracChangeset for help on using the changeset viewer.