Public Member Functions | |
BLCMDbeamlossntuple () | |
BLCMDbeamlossntuple (BLCMDbeamlossntuple &r) | |
G4String | commandName () |
int | command (BLArgumentVector &argv, BLArgumentMap &namedArgs) |
void | defineNamedArgs () |
void | help (bool detailed) |
help() prints help text. | |
void | PreUserTrackingAction (const G4Track *track) |
PreUserTrackingAction() from BLManager::TrackingAction. | |
void | PostUserTrackingAction (const G4Track *track) |
PostUserTrackingAction() from BLManager::TrackingAction. | |
Private Attributes | |
G4String | name |
G4String | format |
G4String | filename |
G4String | require |
G4String | coordinates |
BLCoordinateType | coordinateType |
BLTrackNTuple * | ntuple |
BLCMDbeamlossntuple::BLCMDbeamlossntuple | ( | ) |
References BLCMDTYPE_DATA, BLCOORD_CENTERLINE, coordinates, coordinateType, filename, format, name, ntuple, BLCommand::registerCommand(), require, BLCommand::setDescription(), and BLCommand::setSynopsis().
Referenced by command().
00067 : BLCommand(), BLManager::TrackingAction() 00068 { 00069 registerCommand(BLCMDTYPE_DATA); 00070 setSynopsis("NTuple containing particle tracks when lost."); 00071 setDescription("The NTuple contains the usual track data:\n\n" 00072 "The standard NTuple fields are:\n" 00073 " x,y,z (mm)\n" 00074 " Px,Py,Pz (MeV/c)\n" 00075 " t (ns)\n" 00076 " PDGid (11=e-, 13=mu-, 22=gamma, 211=pi+, 2212=proton, ...)\n" 00077 " EventID (may be inexact above 16,777,215)\n" 00078 " TrackID\n" 00079 " ParentID (0 => primary particle)\n" 00080 " Weight (defaults to 1.0)\n\n" 00081 "The following additional fields are appended for " 00082 "format=Extended, format=asciiExtended, and " 00083 "format=rootExtended:\n" 00084 " Bx, By, Bz (Tesla)\n" 00085 " Ex, Ey, Ez (Megavolts/meter)\n" 00086 " ProperTime (ns)\n" 00087 " PathLength (mm)\n" 00088 " PolX, PolY, PolZ (polarization)\n" 00089 " InitialKE (MeV when track was created)\n\n" 00090 "Valid Formats (ignore case): "); 00091 00092 name = ""; 00093 format = ""; 00094 filename = ""; 00095 require = ""; 00096 coordinates = "Centerline"; 00097 coordinateType = BLCOORD_CENTERLINE; 00098 ntuple = 0; 00099 }
BLCMDbeamlossntuple::BLCMDbeamlossntuple | ( | BLCMDbeamlossntuple & | r | ) |
References coordinates, coordinateType, filename, format, name, ntuple, and require.
00101 : BLCommand(r), 00102 BLManager::TrackingAction(r) 00103 { 00104 name = r.name; 00105 format = r.format; 00106 filename = r.filename; 00107 require = r.require; 00108 coordinates = r.coordinates; 00109 coordinateType = r.coordinateType; 00110 ntuple = 0; 00111 }
G4String BLCMDbeamlossntuple::commandName | ( | ) | [inline, virtual] |
int BLCMDbeamlossntuple::command | ( | BLArgumentVector & | argv, | |
BLArgumentMap & | namedArgs | |||
) | [virtual] |
Implements BLCommand.
References BLCMDbeamlossntuple(), coordinates, coordinateType, BLTrackNTuple::create(), filename, format, BLCoordinates::getCoordinateType(), BLManager::getObject(), BLCommand::handleNamedArgs(), name, ntuple, BLCommand::print(), BLCommand::printError(), BLManager::registerTrackingAction(), and require.
00114 { 00115 if(argv.size() != 1) { 00116 printError("Invalid beamlossntuple command -- need name"); 00117 return -1; 00118 } 00119 00120 if(argv[0] == "default") { 00121 return handleNamedArgs(namedArgs); 00122 } 00123 00124 BLCMDbeamlossntuple *t = new BLCMDbeamlossntuple(defaultBeamLossNTuple); 00125 int retval = t->handleNamedArgs(namedArgs); 00126 00127 // ascii->bltrackfile format, for accuracy and consistency of output 00128 for(unsigned i=0; i<t->format.size(); ++i) 00129 t->format[i] = tolower(t->format[i]); 00130 if(t->format == "ascii") 00131 t->format = "bltrackfile"; 00132 00133 t->name = argv[0]; 00134 t->coordinateType = BLCoordinates::getCoordinateType(t->coordinates); 00135 00136 t->ntuple = BLTrackNTuple::create(t->format,"NTuple",t->name, 00137 t->filename,t->coordinateType,t->require); 00138 00139 t->print(argv[0]); 00140 00141 BLManager::getObject()->registerTrackingAction(t); 00142 00143 return retval; 00144 }
void BLCMDbeamlossntuple::defineNamedArgs | ( | ) | [virtual] |
Reimplemented from BLCommand.
References BLCommand::argString(), coordinates, filename, format, and require.
00147 { 00148 argString(format,"format","The NTuple format (see above for list)."); 00149 argString(filename,"filename","The filename for the NTuple."); 00150 argString(filename,"file","Synonym for filename."); 00151 argString(require,"require","Expression which must be nonzero to include the track (default=1)",false); 00152 argString(coordinates,"coordinates","Coordinates: global, centerline, or reference (default=c)."); 00153 }
void BLCMDbeamlossntuple::help | ( | bool | detailed | ) | [inline, virtual] |
help() prints help text.
Reimplemented from BLCommand.
References BLCommand::description, BLTrackNTuple::getFormatList(), and BLCommand::help().
00051 { 00052 if(description[description.size()-2] == ':') 00053 description += BLTrackNTuple::getFormatList(); 00054 BLCommand::help(detailed); 00055 }
void BLCMDbeamlossntuple::PreUserTrackingAction | ( | const G4Track * | track | ) | [inline, virtual] |
void BLCMDbeamlossntuple::PostUserTrackingAction | ( | const G4Track * | track | ) | [virtual] |
PostUserTrackingAction() from BLManager::TrackingAction.
Implements BLManager::TrackingAction.
References BLTrackNTuple::appendTrack(), BEAM, BLCOORD_REFERENCE, coordinateType, BLManager::getObject(), BLManager::getState(), and ntuple.
00156 { 00157 // omit tracks that were not tracked or were suspended 00158 if(track->GetCurrentStepNumber() <= 0 || 00159 track->GetTrackStatus() == fSuspend) 00160 return; 00161 00162 // only use reference coordinates when they are valid 00163 BLManagerState state = BLManager::getObject()->getState(); 00164 if(coordinateType == BLCOORD_REFERENCE && state != BEAM) return; 00165 00166 ntuple->appendTrack(track); 00167 }
G4String BLCMDbeamlossntuple::name [private] |
Referenced by BLCMDbeamlossntuple(), and command().
G4String BLCMDbeamlossntuple::format [private] |
Referenced by BLCMDbeamlossntuple(), command(), and defineNamedArgs().
G4String BLCMDbeamlossntuple::filename [private] |
Referenced by BLCMDbeamlossntuple(), command(), and defineNamedArgs().
G4String BLCMDbeamlossntuple::require [private] |
Referenced by BLCMDbeamlossntuple(), command(), and defineNamedArgs().
G4String BLCMDbeamlossntuple::coordinates [private] |
Referenced by BLCMDbeamlossntuple(), command(), and defineNamedArgs().
Referenced by BLCMDbeamlossntuple(), command(), and PostUserTrackingAction().
BLTrackNTuple* BLCMDbeamlossntuple::ntuple [private] |
Referenced by BLCMDbeamlossntuple(), command(), and PostUserTrackingAction().