BLCMDnewparticlentuple Class Reference

Inheritance diagram for BLCMDnewparticlentuple:

BLCommand BLManager::TrackingAction

List of all members.


Detailed Description

class BLCMDnewparticlentuple - NTuple for tracks where they are created.

Public Member Functions

 BLCMDnewparticlentuple ()
 BLCMDnewparticlentuple (BLCMDnewparticlentuple &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
BLTrackNTuplentuple

Constructor & Destructor Documentation

BLCMDnewparticlentuple::BLCMDnewparticlentuple (  ) 

References BLCMDTYPE_DATA, BLCOORD_CENTERLINE, coordinates, coordinateType, filename, format, name, ntuple, BLCommand::registerCommand(), require, BLCommand::setDescription(), and BLCommand::setSynopsis().

Referenced by command().

00068                                                : BLCommand(),
00069                                                 BLManager::TrackingAction()
00070 {
00071         registerCommand(BLCMDTYPE_DATA);
00072         setSynopsis("NTuple containing particle tracks when created.");
00073         setDescription("Note that initial beam particles are included, unless "
00074                 "require is set to 'ParentID>0'.\n\n"
00075                 "The standard NTuple fields are:\n"
00076                 "    x,y,z (mm)\n"
00077                 "    Px,Py,Pz (MeV/c)\n"
00078                 "    t (ns)\n"
00079                 "    PDGid (11=e-, 13=mu-, 22=gamma, 211=pi+, 2212=proton, ...)\n"
00080                 "    EventID (may be inexact above 16,777,215)\n"
00081                 "    TrackID\n"
00082                 "    ParentID (0 => primary particle)\n"
00083                 "    Weight (defaults to 1.0)\n\n"
00084                 "The following additional fields are appended for "
00085                 "format=Extended, format=asciiExtended, and "
00086                 "format=rootExtended:\n"
00087                 "    Bx, By, Bz (Tesla)\n"
00088                 "    Ex, Ey, Ez (Megavolts/meter)\n"
00089                 "    ProperTime (ns)\n"
00090                 "    PathLength (mm)\n"
00091                 "    PolX, PolY, PolZ (polarization)\n"
00092                 "    InitialKE (MeV when track was created)\n\n"
00093                 "Valid Formats (ignore case): ");
00094 
00095         name = "";
00096         format = "";
00097         filename = "";
00098         require = "";
00099         coordinates = "Centerline";
00100         coordinateType = BLCOORD_CENTERLINE;
00101         ntuple = 0;
00102 }

BLCMDnewparticlentuple::BLCMDnewparticlentuple ( BLCMDnewparticlentuple r  ) 

References coordinates, coordinateType, filename, format, name, ntuple, and require.

00104                                                                         : BLCommand(r), 
00105                                                 BLManager::TrackingAction(r)
00106 {
00107         name = r.name;
00108         format = r.format;
00109         filename = r.filename;
00110         require = r.require;
00111         coordinates = r.coordinates;
00112         coordinateType = r.coordinateType;
00113         ntuple = 0;
00114 }


Member Function Documentation

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

Implements BLCommand.

00045 { return "newparticlentuple"; }

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

Implements BLCommand.

References BLCMDnewparticlentuple(), coordinates, coordinateType, BLTrackNTuple::create(), filename, format, BLCoordinates::getCoordinateType(), BLManager::getObject(), BLCommand::handleNamedArgs(), name, ntuple, BLCommand::print(), BLCommand::printError(), BLManager::registerTrackingAction(), and require.

00117 {
00118         if(argv.size() != 1) {
00119                 printError("Invalid newparticlentuple command -- need name");
00120                 return -1;
00121         }
00122 
00123         if(argv[0] == "default") {
00124                 return handleNamedArgs(namedArgs);
00125         }
00126 
00127         BLCMDnewparticlentuple *t = new BLCMDnewparticlentuple(defaultNewParticleNTuple);
00128         int retval = t->handleNamedArgs(namedArgs);
00129 
00130         // ascii->bltrackfile format, for accuracy and consistency of output
00131         for(unsigned i=0; i<t->format.size(); ++i)
00132                 t->format[i] = tolower(t->format[i]);
00133         if(t->format == "ascii")
00134                 t->format = "bltrackfile";
00135 
00136         t->name = argv[0];
00137         t->coordinateType = BLCoordinates::getCoordinateType(t->coordinates);
00138 
00139         t->ntuple = BLTrackNTuple::create(t->format,"NTuple",t->name,
00140                         t->filename,t->coordinateType,t->require);
00141 
00142         t->print(argv[0]);
00143 
00144         BLManager::getObject()->registerTrackingAction(t);
00145 
00146         return retval;
00147 }

void BLCMDnewparticlentuple::defineNamedArgs (  )  [virtual]

Reimplemented from BLCommand.

References BLCommand::argString(), coordinates, filename, format, and require.

00150 {
00151         argString(format,"format","The NTuple format (see above for list).");
00152         argString(filename,"filename","The filename for the NTuple.");
00153         argString(filename,"file","Synonym for filename.");
00154         argString(require,"require","Expression which must be nonzero to include the track (default=1)",false);
00155         argString(coordinates,"coordinates","Coordinates: global, centerline, or reference (default=c).");
00156 }

void BLCMDnewparticlentuple::help ( bool  detailed  )  [inline, virtual]

help() prints help text.

Reimplemented from BLCommand.

References BLCommand::description, BLTrackNTuple::getFormatList(), and BLCommand::help().

00052                                  {
00053                 if(description[description.size()-2] == ':')
00054                         description += BLTrackNTuple::getFormatList(); 
00055                 BLCommand::help(detailed);
00056         }

void BLCMDnewparticlentuple::PreUserTrackingAction ( const G4Track *  track  )  [virtual]

PreUserTrackingAction() from BLManager::TrackingAction.

Implements BLManager::TrackingAction.

References BLTrackNTuple::appendTrack(), BEAM, BLCOORD_REFERENCE, coordinateType, BLManager::getObject(), BLManager::getState(), and ntuple.

00159 {
00160         // only use reference coordinates when they are valid
00161         BLManagerState state = BLManager::getObject()->getState();
00162         if(coordinateType == BLCOORD_REFERENCE && state != BEAM) return;
00163 
00164         ntuple->appendTrack(track);
00165 }

void BLCMDnewparticlentuple::PostUserTrackingAction ( const G4Track *  track  )  [inline, virtual]


Member Data Documentation

G4String BLCMDnewparticlentuple::name [private]

Referenced by BLCMDnewparticlentuple(), and command().

G4String BLCMDnewparticlentuple::format [private]

G4String BLCMDnewparticlentuple::require [private]


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