LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
evgb::EvtTimeFlat Class Reference

Flat time distribution. More...

#include "EvtTimeFlat.h"

Inheritance diagram for evgb::EvtTimeFlat:
evgb::EvtTimeShiftI

Public Member Functions

 EvtTimeFlat (const std::string &config)
 
virtual ~EvtTimeFlat ()
 
virtual void Config (const std::string &config)
 
virtual double TimeOffset ()
 
virtual double TimeOffset (std::vector< double > v)
 
virtual void PrintConfig (bool verbose=true)
 provide a means of printing the configuration More...
 
void SetDuration (double val)
 specific methods for this variant More...
 
double GetDuration () const
 
void SetGlobalOffset (double val)
 
double GetGlobalOffset () const
 
TRandom * GetRandomGenerator () const
 
bool IsRandomGeneratorOwned () const
 
void SetRandomGenerator (TRandom *gen, bool isOwned)
 

Protected Attributes

TRandom * fRndmGen
 
bool fIsOwned
 

Private Attributes

double fDuration
 duration (in ns) More...
 
double fGlobalOffset
 always displaced by this (in ns) More...
 

Detailed Description

Flat time distribution.

Author
Robert Hatcher <rhatcher fnal.gov> Fermi National Accelerator Laboratory

2015-06-22

Version
Id
EvtTimeFlat.h,v 1.1 2015/06/30 18:01:24 rhatcher Exp

Definition at line 22 of file EvtTimeFlat.h.

Constructor & Destructor Documentation

evgb::EvtTimeFlat::EvtTimeFlat ( const std::string &  config)

Definition at line 20 of file EvtTimeFlat.cxx.

References Config().

21  : EvtTimeShiftI(config)
22  , fDuration(6 * 84 * 1e9/53.103e6)
23  , fGlobalOffset(0)
24  { Config(config); }
virtual void Config(const std::string &config)
Definition: EvtTimeFlat.cxx:28
double fDuration
duration (in ns)
Definition: EvtTimeFlat.h:55
EvtTimeShiftI(const std::string &config)
double fGlobalOffset
always displaced by this (in ns)
Definition: EvtTimeFlat.h:56
evgb::EvtTimeFlat::~EvtTimeFlat ( )
virtual

Definition at line 26 of file EvtTimeFlat.cxx.

26 { ; }

Member Function Documentation

void evgb::EvtTimeFlat::Config ( const std::string &  config)
virtual

each schema must take a string that configures it it is up to the individual model to parse said string and extract parameters

Implements evgb::EvtTimeShiftI.

Definition at line 28 of file EvtTimeFlat.cxx.

References fDuration, fGlobalOffset, and PrintConfig().

Referenced by EvtTimeFlat().

29  {
30  // parse config string
31  if ( config != "" ) {
32  // for now just assume a single number is the duration
33  // optional 2nd arg is global offset
34  int nf = sscanf(config.c_str(),"%lf %lf",&fDuration,&fGlobalOffset);
35  std::cout << "EvtTimeFlat::Config() read " << nf
36  << " values" << std::endl;
37  }
38  PrintConfig();
39  }
virtual void PrintConfig(bool verbose=true)
provide a means of printing the configuration
Definition: EvtTimeFlat.cxx:52
double fDuration
duration (in ns)
Definition: EvtTimeFlat.h:55
double fGlobalOffset
always displaced by this (in ns)
Definition: EvtTimeFlat.h:56
double evgb::EvtTimeFlat::GetDuration ( ) const
inline

Definition at line 49 of file EvtTimeFlat.h.

References fDuration.

49 { return fDuration; }
double fDuration
duration (in ns)
Definition: EvtTimeFlat.h:55
double evgb::EvtTimeFlat::GetGlobalOffset ( ) const
inline

Definition at line 51 of file EvtTimeFlat.h.

References fGlobalOffset.

51 { return fGlobalOffset; }
double fGlobalOffset
always displaced by this (in ns)
Definition: EvtTimeFlat.h:56
TRandom* evgb::EvtTimeShiftI::GetRandomGenerator ( ) const
inlineinherited

Allow users some control over random # sequences An "owned" object is expected to be deleted by the EvtTimeShift obj

Definition at line 61 of file EvtTimeShiftI.h.

References evgb::EvtTimeShiftI::fRndmGen.

61 { return fRndmGen; }
bool evgb::EvtTimeShiftI::IsRandomGeneratorOwned ( ) const
inlineinherited
void evgb::EvtTimeFlat::PrintConfig ( bool  verbose = true)
virtual

provide a means of printing the configuration

Implements evgb::EvtTimeShiftI.

Definition at line 52 of file EvtTimeFlat.cxx.

References fDuration, and fGlobalOffset.

Referenced by Config().

53  {
54  std::cout << "EvtTimeFlat config: "
55  << " GlobalOffset " << fGlobalOffset << " ns"
56  << ", Duration " << fDuration << " ns"
57  << std::endl;
58  }
double fDuration
duration (in ns)
Definition: EvtTimeFlat.h:55
double fGlobalOffset
always displaced by this (in ns)
Definition: EvtTimeFlat.h:56
void evgb::EvtTimeFlat::SetDuration ( double  val)
inline

specific methods for this variant

Definition at line 48 of file EvtTimeFlat.h.

References fDuration.

48 { fDuration=val; }
double fDuration
duration (in ns)
Definition: EvtTimeFlat.h:55
void evgb::EvtTimeFlat::SetGlobalOffset ( double  val)
inline

Definition at line 50 of file EvtTimeFlat.h.

References fGlobalOffset.

50 { fGlobalOffset=val; }
double fGlobalOffset
always displaced by this (in ns)
Definition: EvtTimeFlat.h:56
void evgb::EvtTimeShiftI::SetRandomGenerator ( TRandom *  gen,
bool  isOwned 
)
inherited

Definition at line 28 of file EvtTimeShiftI.cxx.

References evgb::EvtTimeShiftI::fIsOwned, and evgb::EvtTimeShiftI::fRndmGen.

Referenced by evgb::EvtTimeShiftI::IsRandomGeneratorOwned().

29  {
30  // deal with what we might already have
31  if ( fIsOwned ) { delete fRndmGen; fRndmGen = 0; fIsOwned = false; }
32 
33  fRndmGen = gen;
34  fIsOwned = isOwned;
35  }
double evgb::EvtTimeFlat::TimeOffset ( )
virtual

return time within a 'record' in nanoseconds version taking array might be used for relative batch fractions that vary on a record-by-record basis

Implements evgb::EvtTimeShiftI.

Definition at line 41 of file EvtTimeFlat.cxx.

References fDuration, and evgb::EvtTimeShiftI::fRndmGen.

Referenced by TimeOffset().

42  {
43  return fRndmGen->Uniform(fDuration);
44  }
double fDuration
duration (in ns)
Definition: EvtTimeFlat.h:55
double evgb::EvtTimeFlat::TimeOffset ( std::vector< double >  v)
virtual

Implements evgb::EvtTimeShiftI.

Definition at line 46 of file EvtTimeFlat.cxx.

References TimeOffset().

47  {
48  // flat ... doesn't need additional parameter so ignore them
49  return TimeOffset();
50  }
virtual double TimeOffset()
Definition: EvtTimeFlat.cxx:41

Member Data Documentation

double evgb::EvtTimeFlat::fDuration
private

duration (in ns)

Definition at line 55 of file EvtTimeFlat.h.

Referenced by Config(), GetDuration(), PrintConfig(), SetDuration(), and TimeOffset().

double evgb::EvtTimeFlat::fGlobalOffset
private

always displaced by this (in ns)

Definition at line 56 of file EvtTimeFlat.h.

Referenced by Config(), GetGlobalOffset(), PrintConfig(), and SetGlobalOffset().

bool evgb::EvtTimeShiftI::fIsOwned
protectedinherited

The documentation for this class was generated from the following files: