LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
EvtTimeFlat.cxx
Go to the documentation of this file.
1 
12 #include "EvtTimeFlat.h"
13 #include "EvtTimeShiftFactory.h"
15 
16 #include <iostream>
17 
18 namespace evgb {
19 
20  EvtTimeFlat::EvtTimeFlat(const std::string& config)
21  : EvtTimeShiftI(config)
22  , fDuration(6 * 84 * 1e9/53.103e6)
23  , fGlobalOffset(0)
24  { Config(config); }
25 
27 
28  void EvtTimeFlat::Config(const std::string& config)
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  }
40 
42  {
43  return fRndmGen->Uniform(fDuration);
44  }
45 
46  double EvtTimeFlat::TimeOffset(std::vector<double> /* v */)
47  {
48  // flat ... doesn't need additional parameter so ignore them
49  return TimeOffset();
50  }
51 
52  void EvtTimeFlat::PrintConfig(bool /* verbose */)
53  {
54  std::cout << "EvtTimeFlat config: "
55  << " GlobalOffset " << fGlobalOffset << " ns"
56  << ", Duration " << fDuration << " ns"
57  << std::endl;
58  }
59 
60 } // namespace evgb
Flat time distribution.
Definition: EvtTimeFlat.h:22
virtual void Config(const std::string &config)
Definition: EvtTimeFlat.cxx:28
interface for event time distribution
Definition: EvtTimeShiftI.h:29
virtual void PrintConfig(bool verbose=true)
provide a means of printing the configuration
Definition: EvtTimeFlat.cxx:52
virtual ~EvtTimeFlat()
Definition: EvtTimeFlat.cxx:26
double fDuration
duration (in ns)
Definition: EvtTimeFlat.h:55
virtual double TimeOffset()
Definition: EvtTimeFlat.cxx:41
double fGlobalOffset
always displaced by this (in ns)
Definition: EvtTimeFlat.h:56
A class for generating concrete EvtTimeShiftI derived classes based on the factory pattern...
EvtTimeFlat(const std::string &config)
Definition: EvtTimeFlat.cxx:20
Physics generators for neutrinos, cosmic rays, and others.
Definition: CRYHelper.cxx:33
#define TIMESHIFTREG3(_ns, _name, _fqname)