////////////////////////////////////////////////////////////////////////
/// \class RAT::Noise
///
/// \brief Generates noise
///
/// \author P G Jones
/// \author Josh Klein -- contact person
/// \author Gabriel Orebi Gann -- contact person
///
/// REVISION HISTORY:\n
/// 21/03/2012 : P G Jones - New file. Code from Gsim, GOG & JK.
/// 13/05/2015 : W Heintzelman - make ENoiseModel public
/// 09/07/2015 : GDOG - Update noise DB tables, and correct noise to be
/// generated for online, normal+OWL channels only (OWL optional)
///
/// \details Generates noise hits. Noise can either be generated given a
/// detector wide rate or a per channel rate.
///
////////////////////////////////////////////////////////////////////////
#ifndef __RAT_Noise_hh__
#define __RAT_Noise_hh__
#include
namespace RAT
{
namespace DS
{
class MCPMT;
class MCPE;
}
class Noise
{
public:
Noise();
~Noise();
/// This method initializes the settings from the ratdb
void BeginOfRun();
/// Generate noise hits for the MC event
void GenerateNoise();
/// Noise generation models, no-noise, use detector average or per channel rates
enum ENoiseModel { eNoNoise = 0, eAverageNoise = 1, ePerChannelNoise = 2 };
/// Noise table to use for average/individual noise rate
enum ENoiseTable { eRunLevelTable = 0, eIntegratedTable = 1 };
protected:
/// Generate noise based on the available PMT hits.
void GenerateNoiseFromPMTHits(const std::vector& pmtHits);
/// Generate noise hits in a certain time window
void GenerateNoiseInWindow( double windowStart, ///< Start MC time in ns
double windowEnd ); ///< End MC time in ns
/// Generate noise using the detector average rate model
void GenerateAverageNoise( const double windowStart,
const double windowEnd );
/// Generate noise using the per channel rate model
void GeneratePerChannelNoise( const double windowStart,
const double windowEnd );
/// Generate a noise hit on a channel
void GenerateNoiseHit( const int lcn,
const double windowStart,
const double windowEnd );
/// Detect photoelectron at a given PMT and modify hits.
virtual void DetectPhotoelectron( const unsigned int pmtID,
DS::MCPE& photoelectron );
std::vector fChannelRate; ///< Noise rates per channel (lcn)
double fTriggerWindow; ///< Length of the trigger window in ns
double fNoiseRate; ///< Average noise rate in hits per ns
bool fNoiseGroupFlag; ///< True if noise should be generated around groups of hits only
double fNoiseTEarly; ///< Times before a hit group where noise will be added.
double fNoiseTLate; ///< Times after a hit group where noise will be added.
ENoiseModel fNoiseFlag; ///< Noise generation model to use
ENoiseTable fTableFlag; ///< Noise table to use
int fNumChannels; ///< Number of daq channels
double fDefaultWindowStart; ///< Default window start time in ns
double fDefaultWindowEnd; ///< Default window end time in ns
double fAveChanEff; ///< Average channel efficiency
int fOWLnoise; ///< Flag for whether to generate noise on OWLs
};
}// ::RAT
#endif