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_OTHER, BLCommand::registerCommand(), BLCommand::setDescription(), and BLCommand::setSynopsis().

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

BLCMDsetdecay::~BLCMDsetdecay (  )  [inline]

Destructor.

00050 { }


Member Function Documentation

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

commandName() returns "setdecay"

Implements BLCommand.

00053 { 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().

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

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.

00060 { }


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