BLCMDtimentuple Class Reference

Inheritance diagram for BLCMDtimentuple:

BLCommand

List of all members.


Detailed Description

class BLCMDtimentuple - implements a time NTuple Each command of this class generates an NTuple of the beam at a specified global time.

This is a "perfect" detector in that it does not perturb the beam at all, and intrinsically has the resolution of a float (it measures position and momentum and time).

The userSteppingAction() for the timentuple is called for every volume, and checks if the step brackets the time specified; if so it linearly interpolates to the specified time and enters the result into the NTuple.

Note that if a BLCoordinates instance is linked into the track, its centerline coordinates are used; otherwise global coordinates are used.

Public Member Functions

 BLCMDtimentuple ()
 Default constructor.
virtual ~BLCMDtimentuple ()
 Destructor.
 BLCMDtimentuple (const BLCMDtimentuple &r)
 Copy constructor.
G4String commandName ()
 commandName() returns "timentuple".
int command (BLArgumentVector &argv, BLArgumentMap &namedArgs)
 command() implements the timentuple command.
void defineNamedArgs ()
 defineNamedArgs() defines the named arguments for the command.
void help (bool detailed)
 help() prints help text.
void setName (G4String _name)

Private Attributes

G4double time
G4String name
G4String format
G4String filename
G4String require
G4String coordinates
BLCoordinateType coordinateType


Constructor & Destructor Documentation

BLCMDtimentuple::BLCMDtimentuple (  ) 

Default constructor.

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

Referenced by command().

00106                                  : BLCommand()
00107 {
00108         registerCommand(BLCMDTYPE_DATA);
00109         setSynopsis("Construct an NTuple of tracks at a specified time.");
00110         setDescription("A time NTuple generates an NTuple of every track at a\n"
00111                 "specified global time.\n"
00112                 "It uses a linear interpolation in the step that straddles "
00113                 "the required time, so accuracy will suffer for large steps. "
00114                 "The NTuple uses centerline coordinates, if available.\n\n"
00115                 "The standard NTuple fields are:\n"
00116                 "    x,y,z (mm)\n"
00117                 "    Px,Py,Pz (MeV/c)\n"
00118                 "    t (ns)\n"
00119                 "    PDGid (11=e-, 13=mu-, 22=gamma, 211=pi+, 2212=proton, ...)\n"
00120                 "    EventID (may be inexact above 16,777,215)\n"
00121                 "    TrackID\n"
00122                 "    ParentID (0 => primary particle)\n"
00123                 "    Weight (defaults to 1.0)\n\n"
00124                 "The following additional fields are appended for "
00125                 "format=Extended, format=asciiExtended, and "
00126                 "format=rootExtended:\n"
00127                 "    Bx, By, Bz (Tesla)\n"
00128                 "    Ex, Ey, Ez (Megavolts/meter)\n"
00129                 "    ProperTime (ns)\n"
00130                 "    PathLength (mm)\n"
00131                 "    PolX, PolY, PolZ (polarization)\n"
00132                 "    InitialKE (MeV when track was created)\n\n"
00133                 "Valid Formats (ignore case): ");
00134         
00135         time = 0.0;
00136         name = "";
00137         format = "";
00138         filename = "";
00139         require = "";
00140         coordinates = "Centerline";
00141         coordinateType = BLCOORD_CENTERLINE;
00142 }

BLCMDtimentuple::~BLCMDtimentuple (  )  [virtual]

Destructor.

00156 {
00157 }

BLCMDtimentuple::BLCMDtimentuple ( const BLCMDtimentuple r  ) 

Copy constructor.

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

00144                                                          : BLCommand(r)
00145 {
00146         time = r.time;
00147         name = r.name;
00148         format = r.format;
00149         filename = r.filename;
00150         G4String require;
00151         coordinates = r.coordinates;
00152         coordinateType = r.coordinateType;
00153 }


Member Function Documentation

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

commandName() returns "timentuple".

Implements BLCommand.

00063 { return "timentuple"; }

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

command() implements the timentuple command.

Implements BLCommand.

References BLCMDtimentuple(), coordinates, coordinateType, filename, format, BLCoordinates::getCoordinateType(), BLManager::getObject(), BLCommand::handleNamedArgs(), name, BLCommand::print(), BLCommand::printError(), BLManager::registerBeamStep(), require, setName(), and time.

00160 {
00161         if(argv.size() != 1) {
00162                 printError("timentuple: Invalid command, must have name");
00163                 return -1;
00164         }
00165 
00166         if(argv[0] == "default") {
00167                 return handleNamedArgs(namedArgs);
00168         }
00169 
00170         BLCMDtimentuple *t = new BLCMDtimentuple(defaultTimeNTuple);
00171         t->setName(argv[0]);
00172         int retval = t->handleNamedArgs(namedArgs);
00173 
00174         t->coordinateType = BLCoordinates::getCoordinateType(t->coordinates);
00175 
00176         // ascii->bltrackfile format, for accuracy and consistency of output
00177         for(unsigned i=0; i<t->format.size(); ++i)
00178                 t->format[i] = tolower(t->format[i]);
00179         if(t->format == "ascii")
00180                 t->format = "bltrackfile";
00181 
00182         t->print(argv[0]);
00183 
00184         TimeNTuple *tn = new TimeNTuple(t->name,t->time,t->format,t->filename,
00185                                                 t->require,t->coordinateType);
00186         BLManager::getObject()->registerBeamStep(0,tn);
00187 
00188         return retval;
00189 }

void BLCMDtimentuple::defineNamedArgs (  )  [virtual]

defineNamedArgs() defines the named arguments for the command.

Reimplemented from BLCommand.

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

00192 {
00193         argDouble(time,"time","The global time of the sampling (ns).");
00194         argString(format,"format","The NTuple format (see above for list).");
00195         argString(filename,"filename","The filename of the NTuple.");
00196         argString(filename,"file","Synonym for filename.");
00197         argString(require,"require","Expression which must be nonzero to include the track (default=1)",false);
00198         argString(coordinates,"coordinates","Coordinates: global, centerline, or reference (default=c).");
00199 }

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

help() prints help text.

Reimplemented from BLCommand.

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

00072                                  {
00073                 if(description[description.size()-2] == ':')
00074                         description += BLTrackNTuple::getFormatList(); 
00075                 BLCommand::help(detailed);
00076         }

void BLCMDtimentuple::setName ( G4String  _name  )  [inline]

References name.

Referenced by command().

00078 { name = _name; }


Member Data Documentation

G4double BLCMDtimentuple::time [private]

G4String BLCMDtimentuple::name [private]

Referenced by BLCMDtimentuple(), command(), and setName().

G4String BLCMDtimentuple::format [private]

G4String BLCMDtimentuple::filename [private]

G4String BLCMDtimentuple::require [private]

G4String BLCMDtimentuple::coordinates [private]

Referenced by BLCMDtimentuple(), and command().


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