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 | setName (G4String _name) |
Private Attributes | |
G4double | time |
G4String | name |
G4String | format |
G4String | filename |
G4String | require |
G4String | coordinates |
BLCoordinateType | coordinateType |
BLCMDtimentuple::BLCMDtimentuple | ( | ) |
Default constructor.
References BLCMDTYPE_DATA, BLCOORD_CENTERLINE, coordinates, coordinateType, BLCommand::description, filename, format, BLNTuple::getFormatList(), name, BLCommand::registerCommand(), require, BLCommand::setDescription(), BLCommand::setSynopsis(), and time.
Referenced by command().
00103 : BLCommand() 00104 { 00105 registerCommand(BLCMDTYPE_DATA); 00106 setSynopsis("Construct an NTuple of tracks at a specified time."); 00107 setDescription("A time NTuple generates an NTuple of every track at a\n" 00108 "specified global time.\n" 00109 "It uses a linear interpolation in the step that straddles " 00110 "the required time, so accuracy will suffer for large steps. " 00111 "The NTuple uses centerline coordinates, if available.\n" 00112 "NTuple Variables:\n" 00113 " x,y,z (mm)\n" 00114 " Px,Py,Pz (MeV/c)\n" 00115 " t (ns)\n" 00116 " PDGid (11=e-, 13=mu-, 22=gamma, 211=pi+, 2212=proton, ...)\n" 00117 " EventID (may be inexact above 16,777,215)\n" 00118 " TrackID\n" 00119 " ParentID (0 => primary particle)\n" 00120 " Weight (defaults to 1.0)\n\n" 00121 "Valid Formats (ignore case): "); 00122 description += BLNTuple::getFormatList(); 00123 00124 time = 0.0; 00125 name = ""; 00126 format = ""; 00127 filename = ""; 00128 require = ""; 00129 coordinates = "Centerline"; 00130 coordinateType = BLCOORD_CENTERLINE; 00131 }
BLCMDtimentuple::BLCMDtimentuple | ( | const BLCMDtimentuple & | r | ) |
Copy constructor.
References coordinates, coordinateType, filename, format, name, require, and time.
00133 : BLCommand(r) 00134 { 00135 time = r.time; 00136 name = r.name; 00137 format = r.format; 00138 filename = r.filename; 00139 G4String require; 00140 coordinates = r.coordinates; 00141 coordinateType = r.coordinateType; 00142 }
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(), BLManager::registerBeamStep(), require, setName(), and time.
00149 { 00150 if(argv.size() != 1) { 00151 printError("timentuple: Invalid command, must have name"); 00152 return -1; 00153 } 00154 00155 if(argv[0] == "default") { 00156 return defaultTimeNTuple.handleNamedArgs(namedArgs); 00157 } 00158 00159 BLCMDtimentuple *t = new BLCMDtimentuple(defaultTimeNTuple); 00160 t->setName(argv[0]); 00161 int retval = t->handleNamedArgs(namedArgs); 00162 00163 t->coordinateType = BLCoordinates::getCoordinateType(t->coordinates); 00164 00165 // ascii->bltrackfile format, for accuracy and consistency of output 00166 for(unsigned i=0; i<t->format.size(); ++i) 00167 t->format[i] = tolower(t->format[i]); 00168 if(t->format == "ascii") 00169 t->format = "bltrackfile"; 00170 00171 t->print(argv[0]); 00172 00173 TimeNTuple *tn = new TimeNTuple(t->name,t->time,t->format,t->filename, 00174 t->require,t->coordinateType); 00175 BLManager::getObject()->registerBeamStep(0,tn); 00176 00177 return retval; 00178 }
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.
00181 { 00182 argDouble(time,"time","The global time of the sampling (ns)."); 00183 argString(format,"format","The NTuple format (see above for list)."); 00184 argString(filename,"filename","The filename of the NTuple."); 00185 argString(filename,"file","Synonym for filename."); 00186 argString(require,"require","Expression which must be nonzero to include the track (default=1)",false); 00187 argString(coordinates,"coordinates","Coordinates: global, centerline, or reference (default=c)."); 00188 }
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().
Referenced by BLCMDtimentuple(), and command().