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(). |
BLCMDsetdecay::BLCMDsetdecay | ( | ) |
Constructor.
References BLCMDTYPE_OTHER, BLCommand::registerCommand(), BLCommand::setDescription(), and BLCommand::setSynopsis().
00090 : BLCommand() 00091 { 00092 registerCommand(BLCMDTYPE_OTHER); 00093 setSynopsis("Set lifetime, decay channels, and branching ratios for a particle's decay."); 00094 setDescription("The particle is specified by name as the first " 00095 "positional argument.\n\n" 00096 "The lifetime of the particle can be set, unless it is " 00097 "a short-lived particle (for which lifetime is fixed at 0 -- " 00098 "these are particles like quarks, Zs, and Ws). " 00099 "Units are ns.\n\n" 00100 "Decay channels are specified 'daughter1,daughter2=BR', where " 00101 "the daughter names are separated by commas, and the branching " 00102 "ratio is a value between 0 and 1 (inclusive); the order of " 00103 "daughters does not matter. The sum of all BRs must be 1.0. " 00104 "It is best to use existing channels for the particle, because " 00105 "the code for the decay distribution is retained; new decay " 00106 "channels are given a default phase-space distribution, " 00107 "which is probably valid only for a 2-body decay of a spin 0 " 00108 "particle. New channels are limited to 4 daughters. " 00109 "Note that all desired decay channels must be listed.\n\n" 00110 "Example to force fast decay (0.1 ns) of pi+ to a positron:\n" 00111 " setdecay pi+ lifetime=0.1 e+,nu_e=1.0" 00112 ); 00113 }
G4String BLCMDsetdecay::commandName | ( | ) | [inline, virtual] |
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().
00116 { 00117 int retval = 0; 00118 00119 if(argv.size() < 1) { 00120 printError("setdecay: no decaying particle name."); 00121 retval = 1; 00122 } 00123 if(argv.size() > 1) { 00124 printError("setdecay: too many positional arguments."); 00125 retval = 1; 00126 } 00127 00128 SetDecayInstance *instance = new SetDecayInstance(argv[0]); 00129 00130 BLArgumentMap::iterator i; 00131 BLEvaluator eval; 00132 double totalBR=0.0; 00133 for(i=namedArgs.begin(); i!=namedArgs.end(); ++i) { 00134 G4String name = i->first; 00135 G4String value = i->second; 00136 if(name == "lifetime") { 00137 instance->lifetime = eval.evaluate(value); 00138 if(eval.status() != HepTool::Evaluator::OK) 00139 printError("setdecay: invalid value for lifetime"); 00140 continue; 00141 } 00142 double v = eval.evaluate(value); 00143 if(eval.status() != HepTool::Evaluator::OK) { 00144 printError("setdecay: invalid BR for %s",name.c_str()); 00145 continue; 00146 } 00147 instance->channel.push_back(name); 00148 instance->br.push_back(v); 00149 totalBR += v; 00150 } 00151 if(instance->channel.size() > 0 && fabs(totalBR-1.0) > 1.0e-6) 00152 printError("setdecay: branching ratios do not total to 1"); 00153 00154 print(argv[0],namedArgs); 00155 00156 BLManager::getObject()->registerCallback(instance,0); 00157 00158 return retval; 00159 }
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.