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

#include <EDepSimSpillTimeFactory.hh>

Inheritance diagram for EDepSim::SpillTimeFactory:
EDepSim::VTimeFactory EDepSim::VPrimaryFactory

Public Member Functions

 SpillTimeFactory (EDepSim::UserPrimaryGeneratorMessenger *parent)
 
virtual ~SpillTimeFactory ()
 
EDepSim::VTimeGeneratorGetGenerator ()
 
void SetSpillTime (double spillTime)
 
void SetBunchCount (int bunchs)
 Set the number of bunchs (and reset the bunch power) in a spill. More...
 
void SetBunchSeparation (double sep)
 
void SetBunchLength (double length)
 
void SetBunchPower (int bunch, double power)
 
void SetNewValue (G4UIcommand *, G4String)
 Handle messages from the UI processor. More...
 
- Public Member Functions inherited from EDepSim::VTimeFactory
 VTimeFactory (G4String name, EDepSim::UserPrimaryGeneratorMessenger *fParent, bool makeDirectory=true)
 
virtual ~VTimeFactory ()
 
- Public Member Functions inherited from EDepSim::VPrimaryFactory
 VPrimaryFactory (G4String subdir, G4String name, EDepSim::UserPrimaryGeneratorMessenger *parent, bool makeDirectory)
 
virtual ~VPrimaryFactory ()
 
G4String GetPath () const
 
G4String GetName () const
 
G4String GetSubDir () const
 

Private Attributes

double fSpillTime
 The start time of the spill. More...
 
double fBunchSeparation
 The bunch separation. More...
 
double fBunchLength
 The bunch length. More...
 
std::vector< double > fBunchPower
 The power in each bunch. More...
 
G4UIcmdWithADoubleAndUnit * fSpillTimeCMD
 
G4UIcmdWithADoubleAndUnit * fBunchSepCMD
 
G4UIcmdWithADoubleAndUnit * fBunchLengthCMD
 
G4UIcmdWithAnInteger * fBunchCountCMD
 
G4UIcommand * fBunchPowerCMD
 

Additional Inherited Members

- Protected Member Functions inherited from EDepSim::VPrimaryFactory
G4String CommandName (G4String cmd)
 Build a command name with the directory prefix. More...
 

Detailed Description

Definition at line 11 of file EDepSimSpillTimeFactory.hh.

Constructor & Destructor Documentation

EDepSim::SpillTimeFactory::SpillTimeFactory ( EDepSim::UserPrimaryGeneratorMessenger parent)

Definition at line 11 of file EDepSimSpillTimeFactory.cc.

13  : EDepSim::VTimeFactory("spill",parent),
14  fSpillTime(100*ns),
15  fBunchSeparation(582*ns),
16  fBunchLength(12.4*ns) {
17 
18  fSpillTimeCMD = new G4UIcmdWithADoubleAndUnit(CommandName("start"),this);
19  fSpillTimeCMD->SetGuidance("Set the start time of the spill.");
20  fSpillTimeCMD->SetParameterName("time",false);
21  fSpillTimeCMD->SetUnitCategory("Time");
22 
23  fBunchSepCMD = new G4UIcmdWithADoubleAndUnit(CommandName("bunchSep"),this);
24  fBunchSepCMD->SetGuidance("Set the time between bunch starts.");
25  fBunchSepCMD->SetParameterName("time",false);
26  fBunchSepCMD->SetUnitCategory("Time");
27 
28  fBunchLengthCMD = new G4UIcmdWithADoubleAndUnit(CommandName("bunchLength"),
29  this);
30  fBunchLengthCMD->SetGuidance("Set the length of a bunch.");
31  fBunchLengthCMD->SetParameterName("time",false);
32  fBunchLengthCMD->SetUnitCategory("Time");
33 
34  fBunchCountCMD = new G4UIcmdWithAnInteger(CommandName("bunchCount"),
35  this);
36  fBunchCountCMD->SetGuidance("Set the number of bunchs in a spill. "
37  "Reset bunch power to default.");
38  fBunchCountCMD->SetParameterName("count",false);
39 
40  fBunchPowerCMD = new G4UIcommand(CommandName("bunchPower"),this);
41  fBunchPowerCMD->SetGuidance("Set the power in a bunch "
42  "(bunchs are numbered from ONE)");
43  G4UIparameter* bunchPar = new G4UIparameter('i');
44  bunchPar->SetParameterName("bunch");
45  fBunchPowerCMD->SetParameter(bunchPar);
46  G4UIparameter* powerPar = new G4UIparameter('d');
47  powerPar->SetParameterName("power");
48  fBunchPowerCMD->SetParameter(powerPar);
49 
50  //Initialize the bunchs
51  SetBunchCount(6);
52 
53 }
G4UIcmdWithAnInteger * fBunchCountCMD
double fBunchSeparation
The bunch separation.
G4UIcmdWithADoubleAndUnit * fBunchSepCMD
G4UIcmdWithADoubleAndUnit * fSpillTimeCMD
G4String CommandName(G4String cmd)
Build a command name with the directory prefix.
G4UIcmdWithADoubleAndUnit * fBunchLengthCMD
void SetBunchCount(int bunchs)
Set the number of bunchs (and reset the bunch power) in a spill.
double fSpillTime
The start time of the spill.
QAsciiDict< Entry > ns
double fBunchLength
The bunch length.
EDepSim::SpillTimeFactory::~SpillTimeFactory ( )
virtual

Definition at line 55 of file EDepSimSpillTimeFactory.cc.

55  {
56  delete fSpillTimeCMD;
57  delete fBunchSepCMD;
58  delete fBunchLengthCMD;
59  delete fBunchCountCMD;
60  delete fBunchPowerCMD;
61 }
G4UIcmdWithAnInteger * fBunchCountCMD
G4UIcmdWithADoubleAndUnit * fBunchSepCMD
G4UIcmdWithADoubleAndUnit * fSpillTimeCMD
G4UIcmdWithADoubleAndUnit * fBunchLengthCMD

Member Function Documentation

EDepSim::VTimeGenerator * EDepSim::SpillTimeFactory::GetGenerator ( )
virtual

Return the spill time generator. The spill parameters must be set before this is called.

Implements EDepSim::VTimeFactory.

Definition at line 86 of file EDepSimSpillTimeFactory.cc.

void EDepSim::SpillTimeFactory::SetBunchCount ( int  bunchs)

Set the number of bunchs (and reset the bunch power) in a spill.

Definition at line 92 of file EDepSimSpillTimeFactory.cc.

92  {
93  fBunchPower.resize(bunchs);
95  b != fBunchPower.end();
96  ++b) {
97  *b = 1.0;
98  }
99 }
intermediate_table::iterator iterator
static bool * b
Definition: config.cpp:1043
std::vector< double > fBunchPower
The power in each bunch.
void EDepSim::SpillTimeFactory::SetBunchLength ( double  length)
inline

Set the bunch length. This is the length of a bunch, and determines the end of the bunch with respect to the start. The start of the bunch is determined by the spill time, and the bunch separation. The bunch is modeled as a Gaussian with a sigma set to the Bunch Length.

Definition at line 36 of file EDepSimSpillTimeFactory.hh.

36 {fBunchLength=length;}
double fBunchLength
The bunch length.
void EDepSim::SpillTimeFactory::SetBunchPower ( int  bunch,
double  power 
)

Set the power for a bunch. The bunchs are numbered from ONE, and the nominal (default) power in a bunch is 1.0.

Definition at line 101 of file EDepSimSpillTimeFactory.cc.

101  {
102  if (bunch<1 || (unsigned) bunch > fBunchPower.size()) {
103  EDepSimError("Illegal bunch number: " << bunch);
104  EDepSimError("Invalid bunch structure");
105  }
106  fBunchPower[bunch-1] = power;
107 }
#define EDepSimError(outStream)
Definition: EDepSimLog.hh:503
std::vector< double > fBunchPower
The power in each bunch.
void EDepSim::SpillTimeFactory::SetBunchSeparation ( double  sep)
inline

Set the bunch separation. This is the time between the start of successive bunches.

Definition at line 30 of file EDepSimSpillTimeFactory.hh.

30 {fBunchSeparation=sep;}
double fBunchSeparation
The bunch separation.
void EDepSim::SpillTimeFactory::SetNewValue ( G4UIcommand *  command,
G4String  newValue 
)
virtual

Handle messages from the UI processor.

Reimplemented from EDepSim::VPrimaryFactory.

Definition at line 63 of file EDepSimSpillTimeFactory.cc.

64  {
65  if (command == fSpillTimeCMD) {
66  SetSpillTime(fSpillTimeCMD->GetNewDoubleValue(newValue));
67  }
68  else if (command == fBunchSepCMD) {
69  SetBunchSeparation(fBunchSepCMD->GetNewDoubleValue(newValue));
70  }
71  else if (command == fBunchLengthCMD) {
72  SetBunchLength(fBunchLengthCMD->GetNewDoubleValue(newValue));
73  }
74  else if (command == fBunchCountCMD) {
75  SetBunchCount(fBunchCountCMD->GetNewIntValue(newValue));
76  }
77  else if (command == fBunchPowerCMD) {
78  std::istringstream input((char*)newValue.c_str());
79  int bunch;
80  double power;
81  input >> bunch >> power;
82  SetBunchPower(bunch,power);
83  }
84 }
int command
G4UIcmdWithAnInteger * fBunchCountCMD
G4UIcmdWithADoubleAndUnit * fBunchSepCMD
void SetSpillTime(double spillTime)
static int input(void)
Definition: code.cpp:15695
G4UIcmdWithADoubleAndUnit * fSpillTimeCMD
G4UIcmdWithADoubleAndUnit * fBunchLengthCMD
void SetBunchCount(int bunchs)
Set the number of bunchs (and reset the bunch power) in a spill.
void SetBunchPower(int bunch, double power)
void EDepSim::SpillTimeFactory::SetSpillTime ( double  spillTime)
inline

Set the spill time. The spill time is the offset of start of the first bunch with respect to zero. This is the time that the bunch will cross the center of the EDepSim:: hall.

Definition at line 23 of file EDepSimSpillTimeFactory.hh.

23 {fSpillTime=spillTime;}
double fSpillTime
The start time of the spill.

Member Data Documentation

G4UIcmdWithAnInteger* EDepSim::SpillTimeFactory::fBunchCountCMD
private

Definition at line 61 of file EDepSimSpillTimeFactory.hh.

double EDepSim::SpillTimeFactory::fBunchLength
private

The bunch length.

Definition at line 53 of file EDepSimSpillTimeFactory.hh.

G4UIcmdWithADoubleAndUnit* EDepSim::SpillTimeFactory::fBunchLengthCMD
private

Definition at line 60 of file EDepSimSpillTimeFactory.hh.

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

The power in each bunch.

Definition at line 56 of file EDepSimSpillTimeFactory.hh.

G4UIcommand* EDepSim::SpillTimeFactory::fBunchPowerCMD
private

Definition at line 62 of file EDepSimSpillTimeFactory.hh.

double EDepSim::SpillTimeFactory::fBunchSeparation
private

The bunch separation.

Definition at line 50 of file EDepSimSpillTimeFactory.hh.

G4UIcmdWithADoubleAndUnit* EDepSim::SpillTimeFactory::fBunchSepCMD
private

Definition at line 59 of file EDepSimSpillTimeFactory.hh.

double EDepSim::SpillTimeFactory::fSpillTime
private

The start time of the spill.

Definition at line 47 of file EDepSimSpillTimeFactory.hh.

G4UIcmdWithADoubleAndUnit* EDepSim::SpillTimeFactory::fSpillTimeCMD
private

Definition at line 58 of file EDepSimSpillTimeFactory.hh.


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