EvtTimeFlat.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file EvtTimeFlat.cxx
3 /// \brief Flat time distribution
4 ///
5 /// \version $Id: EvtTimeFlat.cxx,v 1.1 2015/06/30 18:01:24 rhatcher Exp $
6 /// \author Robert Hatcher <rhatcher \at fnal.gov>
7 /// Fermi National Accelerator Laboratory
8 ///
9 /// \update 2015-06-22 initial version
10 ////////////////////////////////////////////////////////////////////////
11 
12 #include "EvtTimeFlat.h"
13 #include "EvtTimeShiftFactory.h"
15 
16 #include <iostream>
17 
18 namespace evgb {
19 
21  : EvtTimeShiftI(config)
22  , fDuration(6 * 84 * 1e9/53.103e6)
23  , fGlobalOffset(0)
24  { Config(config); }
25 
27 
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
std::string string
Definition: nybbler.cc:12
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
static Config * config
Definition: config.cpp:1054
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
QTextStream & endl(QTextStream &s)
#define TIMESHIFTREG3(_ns, _name, _fqname)