Public Member Functions | Private Attributes | List of all members
EDepSim::SpillTimeGenerator Class Reference

#include <EDepSimSpillTimeGenerator.hh>

Inheritance diagram for EDepSim::SpillTimeGenerator:
EDepSim::VTimeGenerator

Public Member Functions

 SpillTimeGenerator (G4String name, double spillTime, double bunchSeparation, double bunchLength, const std::vector< double > &bunchPower)
 
virtual ~SpillTimeGenerator ()
 
double GetTime (const G4LorentzVector &vertex)
 Return the time of the event to be generated. More...
 
virtual bool ForceTime ()
 
- Public Member Functions inherited from EDepSim::VTimeGenerator
 VTimeGenerator (const G4String &name)
 
virtual ~VTimeGenerator ()
 
G4String GetName () const
 Return the name of the generator. More...
 

Private Attributes

double fSpillTime
 The time that the neutrinos are crossing (0,0,0). More...
 
double fBunchSeparation
 The time between bunch starts. More...
 
double fBunchLength
 The length of a bunch. This is the gaussian width of the bunch. More...
 
std::vector< double > fBunchPower
 The power in each bunch. More...
 
double fMaxPower
 The maximum power in a bunch. More...
 

Detailed Description

Definition at line 13 of file EDepSimSpillTimeGenerator.hh.

Constructor & Destructor Documentation

EDepSim::SpillTimeGenerator::SpillTimeGenerator ( G4String  name,
double  spillTime,
double  bunchSeparation,
double  bunchLength,
const std::vector< double > &  bunchPower 
)

Create the generatory. The name is for documentation, the spillTime gives the start time of the first bunch at the center of the EDepSim:: hall, the bunchSeparation is the time between bunch starts, and the bunchLength is the time length of a bunch with respect to it's start time.

Definition at line 9 of file EDepSimSpillTimeGenerator.cc.

13  fBunchSeparation(bunchSeparation), fBunchLength(bunchLength),
14  fBunchPower(bunchPower) {
15  if (fBunchPower.size()<1) fBunchPower.push_back(1.0);
16  fMaxPower = 0.0;
18  b != fBunchPower.end();
19  ++b) {
20  if (fMaxPower<(*b)) fMaxPower = *b;
21  }
22 
23  if (fMaxPower<0.001) {
24  EDepSimError("Spill created without any power in bunchs");
25  }
26 }
static QCString name
Definition: declinfo.cpp:673
intermediate_table::iterator iterator
double fBunchSeparation
The time between bunch starts.
double fBunchLength
The length of a bunch. This is the gaussian width of the bunch.
double fMaxPower
The maximum power in a bunch.
double fSpillTime
The time that the neutrinos are crossing (0,0,0).
#define EDepSimError(outStream)
Definition: EDepSimLog.hh:503
static bool * b
Definition: config.cpp:1043
std::vector< double > fBunchPower
The power in each bunch.
EDepSim::SpillTimeGenerator::~SpillTimeGenerator ( )
virtual

Definition at line 28 of file EDepSimSpillTimeGenerator.cc.

28 {}

Member Function Documentation

bool EDepSim::SpillTimeGenerator::ForceTime ( )
virtual

Flag if the time should be forced. This tells the calling routine that the time returned by this generator should override any times found in the original vertex. This returns true, so that the generated spill time overrides the interaction time.

Implements EDepSim::VTimeGenerator.

Definition at line 54 of file EDepSimSpillTimeGenerator.cc.

54  {
55  return true;
56 }
double EDepSim::SpillTimeGenerator::GetTime ( const G4LorentzVector &  vertex)
virtual

Return the time of the event to be generated.

Implements EDepSim::VTimeGenerator.

Definition at line 30 of file EDepSimSpillTimeGenerator.cc.

30  {
31  // Choose a spill;
32  int spills = fBunchPower.size();
33  int spill = 0;
34  do {
35  spill = int(spills*G4UniformRand());
36  if (spill>=spills) spill=spills-1;
37  if (spill<0) spill = 0;
38  } while (fBunchPower[spill]<fMaxPower*G4UniformRand());
39 
40  // Get the spill start time. This assumes the neutrino wave is traveling
41  // along the positive Z axis.
42  double time = fSpillTime + vtx.z()/c_light + spill*fBunchSeparation;
43 
44  // Adjust the time in the bunch.
45  double truncTime = G4RandGauss::shoot(0.0, 1.0);
46  while (truncTime < -2.0 || truncTime > 2.0) {
47  truncTime = G4RandGauss::shoot(0.0, 1.0);
48  }
49  time += fBunchLength*truncTime;
50 
51  return time;
52 }
double fBunchSeparation
The time between bunch starts.
double fBunchLength
The length of a bunch. This is the gaussian width of the bunch.
double fMaxPower
The maximum power in a bunch.
double fSpillTime
The time that the neutrinos are crossing (0,0,0).
std::vector< double > fBunchPower
The power in each bunch.

Member Data Documentation

double EDepSim::SpillTimeGenerator::fBunchLength
private

The length of a bunch. This is the gaussian width of the bunch.

Definition at line 44 of file EDepSimSpillTimeGenerator.hh.

std::vector<double> EDepSim::SpillTimeGenerator::fBunchPower
private

The power in each bunch.

Definition at line 47 of file EDepSimSpillTimeGenerator.hh.

double EDepSim::SpillTimeGenerator::fBunchSeparation
private

The time between bunch starts.

Definition at line 41 of file EDepSimSpillTimeGenerator.hh.

double EDepSim::SpillTimeGenerator::fMaxPower
private

The maximum power in a bunch.

Definition at line 50 of file EDepSimSpillTimeGenerator.hh.

double EDepSim::SpillTimeGenerator::fSpillTime
private

The time that the neutrinos are crossing (0,0,0).

Definition at line 38 of file EDepSimSpillTimeGenerator.hh.


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