BLCMDsetdecay Class Reference

Inheritance diagram for BLCMDsetdecay:

BLCommand

List of all members.


Detailed Description

class BLCMDsetdecay -- implement the setdecay command

Public Member Functions

 BLCMDsetdecay ()
 Constructor.
 ~BLCMDsetdecay ()
 Destructor.
G4String commandName ()
 commandName() returns "setdecay"
int command (BLArgumentVector &argv, BLArgumentMap &namedArgs)
 command() executes the command associated with this element.
void defineNamedArgs ()
 defineNamedArgs() defines the named arguments for the command. Because arg names can be decay modes, this is handled in command().

Constructor & Destructor Documentation

BLCMDsetdecay::BLCMDsetdecay (  ) 

Constructor.

References BLCMDTYPE_PHYSICS, BLCommand::registerCommand(), BLCommand::setDescription(), and BLCommand::setSynopsis().

00093                              : BLCommand()
00094 {
00095         registerCommand(BLCMDTYPE_PHYSICS);
00096         setSynopsis("Set lifetime, decay channels, and branching ratios for a particle's decay.");
00097         setDescription("The particle is specified by name as the first "
00098                 "positional argument.\n\n"
00099                 "The lifetime of the particle can be set, unless it is "
00100                 "a short-lived particle (for which lifetime is fixed at 0 -- "
00101                 "these are particles like quarks, Zs, and Ws). "
00102                 "Units are ns.\n\n"
00103                 "Decay channels are specified 'daughter1,daughter2=BR', where "
00104                 "the daughter names are separated by commas, and the branching "
00105                 "ratio is a value between 0 and 1 (inclusive); the order of "
00106                 "daughters does not matter. The sum of all BRs must be 1.0. "
00107                 "It is best to use existing channels for the particle, because "
00108                 "the code for the decay distribution is retained; new decay "
00109                 "channels are given a default phase-space distribution, "
00110                 "which is probably valid only for a 2-body decay of a spin 0 "
00111                 "particle. New channels are limited to 4 daughters. "
00112                 "Note that all desired decay channels must be listed.\n\n"
00113                 "Example to force fast decay (0.1 ns) of pi+ to a positron:\n"
00114                 "    setdecay pi+ lifetime=0.1 e+,nu_e=1.0"
00115                 );
00116 }

BLCMDsetdecay::~BLCMDsetdecay (  )  [inline]

Destructor.

00052 { }


Member Function Documentation

G4String BLCMDsetdecay::commandName (  )  [inline, virtual]

commandName() returns "setdecay"

Implements BLCommand.

00055 { return "setdecay"; }

int BLCMDsetdecay::command ( BLArgumentVector argv,
BLArgumentMap namedArgs 
) [virtual]

command() executes the command associated with this element.

Implements BLCommand.

References SetDecayInstance::br, SetDecayInstance::channel, BLEvaluator::evaluate(), BLManager::getObject(), SetDecayInstance::lifetime, BLCommand::print(), BLCommand::printError(), and BLManager::registerCallback().

00119 {
00120         int retval = 0;
00121 
00122         if(argv.size() < 1) {
00123                 printError("setdecay: no decaying particle name.");
00124                 retval = 1;
00125         }
00126         if(argv.size() > 1) {
00127                 printError("setdecay: too many positional arguments.");
00128                 retval = 1;
00129         }
00130 
00131         SetDecayInstance *instance = new SetDecayInstance(argv[0]);
00132 
00133         BLArgumentMap::iterator i;
00134         BLEvaluator eval;
00135         double totalBR=0.0;
00136         for(i=namedArgs.begin(); i!=namedArgs.end(); ++i) {
00137                 G4String name = i->first;
00138                 G4String value = i->second;
00139                 if(name == "lifetime") {
00140                         instance->lifetime = eval.evaluate(value);
00141                         if(eval.status() != HepTool::Evaluator::OK)
00142                             printError("setdecay: invalid value for lifetime");
00143                         continue;
00144                 }
00145                 double v = eval.evaluate(value);
00146                 if(eval.status() != HepTool::Evaluator::OK) {
00147                         printError("setdecay: invalid BR for %s",name.c_str());
00148                         continue;
00149                 }
00150                 instance->channel.push_back(name);
00151                 instance->br.push_back(v);
00152                 totalBR += v;
00153         }
00154         if(instance->channel.size() > 0 && fabs(totalBR-1.0) > 1.0e-6)
00155                 printError("setdecay: branching ratios do not total to 1");
00156 
00157         print(argv[0],namedArgs);
00158 
00159         BLManager::getObject()->registerCallback(instance,0);
00160 
00161         return retval;
00162 }

void BLCMDsetdecay::defineNamedArgs (  )  [inline, virtual]

defineNamedArgs() defines the named arguments for the command. Because arg names can be decay modes, this is handled in command().

Reimplemented from BLCommand.

00062 { }


The documentation for this class was generated from the following file:
g4beamline