7 #include "CLHEP/Units/SystemOfUnits.h" 
   10 #include "CLHEP/Random/RandFlat.h" 
   11 #include "CLHEP/Random/RandGaussZiggurat.h" 
   12 #include "CLHEP/Random/RandomEngine.h" 
   21                                          CLHEP::HepRandomEngine *elecNoiseRndmEngine )
 
   41                                                         unsigned long nsamplings, CLHEP::HepRandomEngine* rndmEngine) {
 
   48   maxLTOverNoiseAmp.resize(nsamplings);
 
   55   for (
unsigned int i = 0; 
i < nsamplings; ++
i) {
 
   57     index += nbinsinperiod;
 
   58     if ( 
index  > maxindex ) {
 
   67                                    unsigned int firstbinfastsignal,
 
   68                                    const unsigned int& binsinwindow )
 
   74   double max = -99999.0;
 
   75   unsigned int lastslowbinplusone = firstbinslowsignal + binsinwindow;
 
   77   while( firstbinslowsignal < lastslowbinplusone ) {
 
   81     if ( 
max<totalsig ) 
max = totalsig;
 
   89                                                  CLHEP::HepRandomEngine* rndmEngine)
 
  110   double timeOfNextPulse;
 
  111   unsigned int binindex;
 
  117   for (
unsigned int i(0); 
i < 
nbins; ++
i) {
 
  122   timeOfNextPulse = 0.5 * fastPeriod;
 
  124     binindex = 
static_cast<unsigned int>(timeOfNextPulse*invbinwidth);
 
  125     if (binindex >= 
nbins) 
break;
 
  126     m_tmpArray[binindex] += CLHEP::RandGaussZiggurat::shoot(rndmEngine, 0., 1.);
 
  127     timeOfNextPulse += fastPeriod;
 
  131   for (
unsigned int i(0); 
i < 
nbins; ++
i) {
 
  134     for (
unsigned int j(
i); j < 
limit; ++j) {
 
  141   for (
unsigned int i(0); 
i < 
nbins; ++
i) {
 
  147   timeOfNextPulse = 0.5 * slowPeriod;
 
  149     binindex = 
static_cast<unsigned int>(timeOfNextPulse*invbinwidth);
 
  150     if (binindex >= 
nbins) 
break;
 
  151     m_tmpArray[binindex] += CLHEP::RandGaussZiggurat::shoot(rndmEngine, 0., 1.);
 
  152     timeOfNextPulse += slowPeriod;
 
  156   for (
unsigned int i(0); 
i < 
nbins; ++
i) {
 
  159     for (
unsigned int j(
i); j < 
limit; ++j) {
 
  184   for ( ;noiseshapebins>0;--noiseshapebins) {
 
  198                                               const double& noiseamplitude,
 
  199                                               CLHEP::HepRandomEngine *rndmEngine) {
 
  211   static const unsigned int n_slowperiodic_shift = 26;
 
  212   static const int slowperiodic_constshift       = -2;
 
  213   static const double slowperiodic_shift_prob_comul[n_slowperiodic_shift] =
 
  214     {0.08, 0.16, 0.24, 0.32, 0.40, 0.48, 0.56, 0.64, 0.66, 0.68,
 
  215      0.70, 0.72, 0.74, 0.76, 0.78, 0.80, 0.82, 0.84, 0.86, 0.88,
 
  216      0.90, 0.92, 0.94, 0.96, 0.98, 1.00};
 
  219   const unsigned int nsignalbins(
signal.size());
 
  223   int offset_slowperiodic(CLHEP::RandFlat::shootInt(rndmEngine,
 
  225                                                     - nsignalbins-n_slowperiodic_shift
 
  226                                                     - slowperiodic_constshift));
 
  229   offset_slowperiodic -= slowperiodic_constshift;
 
  231   const double rand(CLHEP::RandFlat::shoot(rndmEngine, 0., 1.));
 
  232   for (
unsigned int i(0); 
i < n_slowperiodic_shift; ++
i) {
 
  233     if ( 
rand < slowperiodic_shift_prob_comul[
i] ) {
 
  234       offset_slowperiodic -= 
i;
 
  240   if (offset_slowperiodic<0)
 
  244   for ( 
unsigned int i(0); 
i<nsignalbins; ++
i) {
 
  282   if ( time_ns<0 || time_ns > 32 ) 
return 0;
 
  285   for (
unsigned int i(6); 
i>=4; --
i) {