EvtTimeShiftI.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file EvtTimeShiftI.h
3 /// \class evgb::EvtTimeShiftI
4 /// \brief interface for event time distribution
5 ///
6 /// Specific implementations of this class when are used to
7 /// generate appropriate times relative to the t0 of a 'record'
8 /// (spill/snarl/trigger...).
9 ///
10 /// Concrete instances of this interface must be configurable
11 /// from a string.
12 ///
13 /// \author Robert Hatcher <rhatcher \at fnal.gov>
14 /// Fermi National Accelerator Laboratory
15 ///
16 /// \created 2015-06-22
17 /// \version $Id: EvtTimeShiftI.h,v 1.1 2015/06/30 18:01:24 rhatcher Exp $
18 ////////////////////////////////////////////////////////////////////////
19 
20 #ifndef SIMB_EVTTIMEDISTI_H
21 #define SIMB_EVTTIMEDISTI_H
22 
23 #include <string>
24 #include <vector>
25 #include "TRandom.h" // ROOT's random # base class
26 
27 namespace evgb {
28 
29  class EvtTimeShiftI {
30 
31  public:
32 
34  virtual ~EvtTimeShiftI();
35 
36  //
37  // define the EvtTimeShiftI interface:
38  //
39 
40  /// each schema must take a string that configures it
41  /// it is up to the individual model to parse said string
42  /// and extract parameters
43  virtual void Config(const std::string& config ) = 0;
44 
45  /// return time (in nanoseconds) for an interaction/event
46  /// within a record/spill/snarl
47  ///
48  /// version taking array might be used for relative batch fractions
49  /// that vary on a record-by-record basis
50  virtual double TimeOffset() = 0;
51  virtual double TimeOffset(std::vector<double> v) = 0;
52 
53  /// provide a means of printing the configuration
54  virtual void PrintConfig(bool verbose=true) = 0;
55 
56 
57  ///
58  /// Allow users some control over random # sequences
59  /// An "owned" object is expected to be deleted by the EvtTimeShift obj
60  ///
61  TRandom* GetRandomGenerator() const { return fRndmGen; }
62  bool IsRandomGeneratorOwned() const { return fIsOwned; }
63 
64  void SetRandomGenerator(TRandom* gen, bool isOwned);
65 
66  protected:
67 
68  TRandom* fRndmGen;
69  bool fIsOwned;
70 
71  };
72 
73 } // namespace evgb
74 
75 #endif //SIMB_EVTTIMEDISTI_H
void SetRandomGenerator(TRandom *gen, bool isOwned)
std::string string
Definition: nybbler.cc:12
virtual void Config(const std::string &config)=0
interface for event time distribution
Definition: EvtTimeShiftI.h:29
static Config * config
Definition: config.cpp:1054
virtual void PrintConfig(bool verbose=true)=0
provide a means of printing the configuration
verbose
Definition: train.py:477
TRandom * GetRandomGenerator() const
Definition: EvtTimeShiftI.h:61
EvtTimeShiftI(const std::string &config)
virtual double TimeOffset()=0
Physics generators for neutrinos, cosmic rays, and others.
Definition: CRYHelper.cxx:33
bool IsRandomGeneratorOwned() const
Definition: EvtTimeShiftI.h:62