Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
nutools
old
EventGeneratorBase
GENIE
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
"
14
TIMESHIFTREG3
(
evgb
,EvtTimeFlat,
evgb::EvtTimeFlat
)
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
26
EvtTimeFlat::~EvtTimeFlat
() { ; }
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
41
double
EvtTimeFlat::TimeOffset
()
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
evgb::EvtTimeShiftI::fRndmGen
TRandom * fRndmGen
Definition:
EvtTimeShiftI.h:68
string
std::string string
Definition:
nybbler.cc:12
evgb::EvtTimeFlat
Flat time distribution.
Definition:
EvtTimeFlat.h:22
EvtTimeFlat.h
evgb::EvtTimeFlat::Config
virtual void Config(const std::string &config)
Definition:
EvtTimeFlat.cxx:28
evgb::EvtTimeShiftI
interface for event time distribution
Definition:
EvtTimeShiftI.h:29
evgb::EvtTimeFlat::PrintConfig
virtual void PrintConfig(bool verbose=true)
provide a means of printing the configuration
Definition:
EvtTimeFlat.cxx:52
evgb::EvtTimeFlat::~EvtTimeFlat
virtual ~EvtTimeFlat()
Definition:
EvtTimeFlat.cxx:26
evgb::EvtTimeFlat::fDuration
double fDuration
duration (in ns)
Definition:
EvtTimeFlat.h:55
config
static Config * config
Definition:
config.cpp:1054
evgb::EvtTimeFlat::TimeOffset
virtual double TimeOffset()
Definition:
EvtTimeFlat.cxx:41
evgb::EvtTimeFlat::fGlobalOffset
double fGlobalOffset
always displaced by this (in ns)
Definition:
EvtTimeFlat.h:56
EvtTimeShiftFactory.h
A class for generating concrete EvtTimeShiftI derived classes based on the factory pattern...
evgb::EvtTimeFlat::EvtTimeFlat
EvtTimeFlat(const std::string &config)
Definition:
EvtTimeFlat.cxx:20
evgb
Physics generators for neutrinos, cosmic rays, and others.
Definition:
CRYHelper.cxx:33
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
TIMESHIFTREG3
#define TIMESHIFTREG3(_ns, _name, _fqname)
Definition:
EvtTimeShiftFactory.h:134
Generated by
1.8.11