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 |
G4int | referenceParticle |
BLCoordinateType | coordinateType |
BLCMDtimentuple::BLCMDtimentuple | ( | ) |
Default constructor.
References BLCMDTYPE_DATA, BLCOORD_CENTERLINE, coordinates, coordinateType, filename, format, name, referenceParticle, BLCommand::registerCommand(), require, BLCommand::setDescription(), BLCommand::setSynopsis(), and time.
Referenced by command().
00107 : BLCommand() 00108 { 00109 registerCommand(BLCMDTYPE_DATA); 00110 setSynopsis("Construct an NTuple of tracks at a specified time."); 00111 setDescription("A time NTuple generates an NTuple of every track at a\n" 00112 "specified global time.\n" 00113 "It uses a linear interpolation in the step that straddles " 00114 "the required time, so accuracy will suffer for large steps. " 00115 "The NTuple uses centerline coordinates, if available.\n\n" 00116 "The standard NTuple fields are:\n" 00117 " x,y,z (mm)\n" 00118 " Px,Py,Pz (MeV/c)\n" 00119 " t (ns)\n" 00120 " PDGid (11=e-, 13=mu-, 22=gamma, 211=pi+, 2212=proton, ...)\n" 00121 " EventID (may be inexact above 16,777,215)\n" 00122 " TrackID\n" 00123 " ParentID (0 => primary particle)\n" 00124 " Weight (defaults to 1.0)\n\n" 00125 "The following additional fields are appended for " 00126 "format=Extended, format=asciiExtended, and " 00127 "format=rootExtended:\n" 00128 " Bx, By, Bz (Tesla)\n" 00129 " Ex, Ey, Ez (Megavolts/meter)\n" 00130 " ProperTime (ns)\n" 00131 " PathLength (mm)\n" 00132 " PolX, PolY, PolZ (polarization)\n" 00133 " InitialKE (MeV when track was created)\n\n" 00134 "Valid Formats (ignore case): "); 00135 00136 time = 0.0; 00137 name = ""; 00138 format = ""; 00139 filename = ""; 00140 require = ""; 00141 coordinates = "Centerline"; 00142 referenceParticle = 0; 00143 coordinateType = BLCOORD_CENTERLINE; 00144 }
BLCMDtimentuple::BLCMDtimentuple | ( | const BLCMDtimentuple & | r | ) |
Copy constructor.
References coordinates, coordinateType, filename, format, name, referenceParticle, require, and time.
00146 : BLCommand(r) 00147 { 00148 time = r.time; 00149 name = r.name; 00150 format = r.format; 00151 filename = r.filename; 00152 G4String require; 00153 coordinates = r.coordinates; 00154 referenceParticle = r.referenceParticle; 00155 coordinateType = r.coordinateType; 00156 }
G4String BLCMDtimentuple::commandName | ( | ) | [inline, virtual] |
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(), referenceParticle, BLManager::registerBeamStep(), BLManager::registerReferenceParticleStep(), require, setName(), and time.
00163 { 00164 if(argv.size() != 1) { 00165 printError("timentuple: Invalid command, must have name"); 00166 return -1; 00167 } 00168 00169 if(argv[0] == "default") { 00170 return handleNamedArgs(namedArgs); 00171 } 00172 00173 BLCMDtimentuple *t = new BLCMDtimentuple(defaultTimeNTuple); 00174 t->setName(argv[0]); 00175 int retval = t->handleNamedArgs(namedArgs); 00176 00177 t->coordinateType = BLCoordinates::getCoordinateType(t->coordinates); 00178 00179 // ascii->bltrackfile format, for accuracy and consistency of output 00180 for(unsigned i=0; i<t->format.size(); ++i) 00181 t->format[i] = tolower(t->format[i]); 00182 if(t->format == "ascii") 00183 t->format = "bltrackfile"; 00184 00185 t->print(argv[0]); 00186 00187 TimeNTuple *tn = new TimeNTuple(t->name,t->time,t->format,t->filename, 00188 t->require,t->coordinateType); 00189 BLManager::getObject()->registerBeamStep(0,tn); 00190 if(t->referenceParticle != 0) 00191 BLManager::getObject()->registerReferenceParticleStep(0,tn); 00192 00193 return retval; 00194 }
void BLCMDtimentuple::defineNamedArgs | ( | ) | [virtual] |
defineNamedArgs() defines the named arguments for the command.
Reimplemented from BLCommand.
References BLCommand::argDouble(), BLCommand::argInt(), BLCommand::argString(), coordinates, filename, format, referenceParticle, require, and time.
00197 { 00198 argDouble(time,"time","The global time of the sampling (ns)."); 00199 argString(format,"format","The NTuple format (see above for list)."); 00200 argString(filename,"filename","The filename of the NTuple."); 00201 argString(filename,"file","Synonym for filename."); 00202 argString(require,"require","Expression which must be nonzero to include the track (default=1)",false); 00203 argString(coordinates,"coordinates","Coordinates: global, centerline, or reference (default=c)."); 00204 argInt(referenceParticle,"referenceParticle","Set to 1 to include the Reference Particle."); 00205 }
void BLCMDtimentuple::help | ( | bool | detailed | ) | [inline, virtual] |
help() prints help text.
Reimplemented from BLCommand.
References BLCommand::description, BLTrackNTuple::getFormatList(), and BLCommand::help().
00073 { 00074 if(description[description.size()-2] == ':') 00075 description += BLTrackNTuple::getFormatList(); 00076 BLCommand::help(detailed); 00077 }
void BLCMDtimentuple::setName | ( | G4String | _name | ) | [inline] |
G4double BLCMDtimentuple::time [private] |
Referenced by BLCMDtimentuple(), command(), and defineNamedArgs().
G4String BLCMDtimentuple::name [private] |
Referenced by BLCMDtimentuple(), command(), and setName().
G4String BLCMDtimentuple::format [private] |
Referenced by BLCMDtimentuple(), command(), and defineNamedArgs().
G4String BLCMDtimentuple::filename [private] |
Referenced by BLCMDtimentuple(), command(), and defineNamedArgs().
G4String BLCMDtimentuple::require [private] |
Referenced by BLCMDtimentuple(), command(), and defineNamedArgs().
G4String BLCMDtimentuple::coordinates [private] |
Referenced by BLCMDtimentuple(), command(), and defineNamedArgs().
G4int BLCMDtimentuple::referenceParticle [private] |
Referenced by BLCMDtimentuple(), command(), and defineNamedArgs().
Referenced by BLCMDtimentuple(), and command().