BLCMDtracker Class Reference

Inheritance diagram for BLCMDtracker:

BLCommand BLManager::TrackingAction BLManager::ZSteppingAction BLCallback BLMinimizeFunction

List of all members.


Detailed Description

class BLCMDtracker implements a tracker that can fit tracks to wire hits and timing in its trackerplanes.

Modes: true tracks the "true" track -- the trackerplane-s with wires report which wire was hit, and the trackerplane-s with timing report the time. fit fits a track to the "true" track -- the trackerplane-s report their conrtibution to chisq. ignore the track is ignored

Public Member Functions

 BLCMDtracker ()
 Constructors.
 BLCMDtracker (BLCMDtracker &r)
virtual G4String commandName ()
 commandName() returns "tracker".
virtual int command (BLArgumentVector &argv, BLArgumentMap &namedArgs)
 command() implements the tracker command.
virtual void defineNamedArgs ()
 defineNamedArgs() defines the named arguments for this command.
virtual G4String getName () const
virtual void setName (G4String _name)
int registerTrackerPlane (TrackerPlaneInstance *plane, const G4String name)
 registerTrackerPlane() registers a BLCMDtrackerplane with this tracker. Returns the plane id #.
void planeHit (int planeID, int wire, double time)
 planeHit() tells the tracker that a plane was hit by the current G4Track being tracked. Called only when mode=BLTRACKER_TRUE. wire and/or time should be zero if this plane does not measure them.
bool delta (int planeID, double deltaPos, double deltaTime, bool validWire, bool validTime)
 delta() tells the tracker of this track's offset from the hit wire, divided by sigma. Called only when mode=BLTRACKER_FIT. Returns true to continue tracking, false to have caller kill the track.
void fitTrack ()
 fitTrack() fits a track to the true track.
void setMode (BLTrackerMode _mode)
 setMode() sets the tracker mode.
virtual void UserZSteppingAction (const G4Track *track)
 virtual void UserZSteppingAction() from BLManager::ZSteppingAction. Handles the true track in mode=true, and handles the reference particle in all modes.
virtual void PreUserTrackingAction (const G4Track *track)
 PreUserTrackingAction() from BLManager::TrackingAction. Initializes stuff.
virtual void PostUserTrackingAction (const G4Track *track)
 PostUserTrackingAction() from BLManager::TrackingAction. Writes the true track in mode=true, only if it hit all planes.
void callback (int type)
 callback() from BLCallback. Constructs NTuples -- must wait until all planes are defined and mode is known (trackermode could follow this command)
G4Track * constructTrack (const std::vector< double > &x)
 constructTrack() will construct a track from the parameters. The caller must delete the track;
virtual double operator() (const std::vector< double > &x)
 operator() from BLMinimizeFunction. Computes the chisq by tracking the trake constructed from the current parameters.
void handlePreviousTracks (const G4String filename)
 handlePreviousTracks() reads a previously-written NTuple contining 'true' tracks, and fits tracks to them.

Static Public Member Functions

static BLCMDtrackerfindTracker (G4String name)
 findTracker() returns a pointer to the named tracker. returns NULL if not found.

Static Public Attributes

static std::vector
< BLCMDtracker * > 
list

Private Attributes

FitParam fitParam
G4String name
G4double trackerZ
G4double reportZ
bool reportOnly
G4double scaleX
G4double scaleXp
G4double scalePtot
G4double scaleT
G4double minPz
G4double tolerance
G4int maxIter
G4int verbose
G4String format
G4String filename
G4int for009
BLTrackerMode mode
std::vector
< TrackerPlaneInstance * > 
plane
std::vector< int > hitWire
std::vector< double > hitTime
double chisq
int ndf
G4ThreeVector truePosition
G4ThreeVector trueMomentum
G4double trueTime
G4int trueTrackID
G4int trueParentID
G4ParticleDefinition * trueDefinition
G4ThreeVector reportPosition
G4ThreeVector reportMomentum
G4double reportTime
G4int trueHits
G4int fitHits
int minHits
G4RotationMatrix rotationMatrix
G4ThreeVector beamPosition
BLRunManagerrunmgr
BLManagermgr
BLNTuplentuple_hit
BLNTuplentuple_fit
BLNTuplefor009_fit
G4bool chisqFailure
G4String trackFields_hit
G4String trackFields_fit

Friends

class TrackerPlaneInstance

Classes

struct  FitParam


Constructor & Destructor Documentation

BLCMDtracker::BLCMDtracker (  ) 

Constructors.

References BLCMDTYPE_DATA, chisq, chisqFailure, filename, FIT_FIELDS, fitHits, for009, for009_fit, format, HIT_FIELDS, maxIter, mgr, minHits, minPz, name, ndf, ntuple_fit, ntuple_hit, BLCommand::registerCommand(), reportOnly, reportTime, reportZ, runmgr, scalePtot, scaleT, scaleX, scaleXp, BLCommand::setDescription(), BLCommand::setSynopsis(), tolerance, trackerZ, trackFields_fit, trackFields_hit, trueDefinition, trueHits, trueParentID, trueTime, trueTrackID, UNDEFINED, and verbose.

Referenced by command().

00428                            : BLCommand(), BLManager::TrackingAction(),
00429                                 BLManager::ZSteppingAction(),
00430                                 BLCallback(), BLMinimizeFunction(),
00431                                 plane(), hitWire(), truePosition(), 
00432                                 trueMomentum(), reportPosition(),
00433                                 reportMomentum(), rotationMatrix(),
00434                                 beamPosition()
00435 {
00436         registerCommand(BLCMDTYPE_DATA);
00437         setSynopsis("Defines a tracker.");
00438         setDescription("A tracker consists of several trackerplane-s and can "
00439                 "fit a track to wire hits and times in the trackerplanes. "
00440                 "This is a simple algorithm that does not handle backgrounds "
00441                 "or multiple hits. It assumes "
00442                 "that every track hits each trackerplane at most once. "
00443                 "It is intended "
00444                 "to be used to explore resolutions and the effects of survey "
00445                 "errors. A tracker is a logical combination of its "
00446                 "trackerplanes -- the tracker cannot be placed, but its "
00447                 "trackerplanes must be placed into the system.\n\n"
00448                 "The fitting algorithm used requires that all of its "
00449                 "parameters have comparable scales, so the 'scaleX', "
00450                 "'scaleXp', 'scalePtot', and 'scaleT' arguments should be set "
00451                 "to the approximate sigmas "
00452                 "of the tracker. They should be within a factor of 10 of "
00453                 "the actual values, but closer is better. At the end of "
00454                 "fitting tracks a summary is printed that flags each "
00455                 "parameter with 'RESCALE' if its scale is too different from "
00456                 "its sigma (factor of 5 or more).\n\n"
00457                 "NOTE: if the tracker cannot measure Ptot, then 'scalePtot' "
00458                 "MUST be set to zero. If the tracker cannot measure T, then "
00459                 "scaleT MUST be set to zero. Parameters with zero scales are "
00460                 "held fixed at their true-track values.\n\n"
00461                 "A tracker has 3 modes of operation:\n"
00462                 "   true      Each track of each event is written to a\n"
00463                 "             TrackerHits NTuple if it hits all trackerplanes;\n"
00464                 "             the NTuple includes both the true track values\n"
00465                 "             and the individual wire hits for each trackerplane.\n"
00466                 "   fit       A track is fit to the wire hits from a previous\n"
00467                 "             run, and the fit track is written to a TrackerFit\n"
00468                 "             NTuple (includes true values).\n"
00469                 "   ignore    Any track is ignored.\n\n"
00470                 "See the 'trackermode' command to control the mode of trackers.\n\n"
00471                 "The TrackerHits NTuple written in 'true' mode contains:\n"
00472                 "  true_x, true_y, true_z, true_Px, true_Py, true_Pz, true_t, \n"
00473                 "  true_PDGid, true_EventID, true_TrackID, true_ParentID, \n"
00474                 "  true_Weight, ... plus 1 hit and 1 time per trackerplane.\n"
00475                 "  (the first 12 are the same as a BLTrackFile.)\n\n"
00476                 "The TrackerFit Ntuple written in 'fit' mode contains:\n"
00477                 "  x, y, z, Px, Py, Pz, t, PDGid, EventID, TrackID, ParentID,\n"
00478                 "  Weight, ChisqPerDF, nDF, nHit, nIter, true_x, true_y, true_z, true_Px,\n"
00479                 "  true_Py, true_Pz, true_t.\n"
00480                 "(the first 12 are from the fit and are the same as a "
00481                 "BLTrackFile.)\n\n"
00482                 "The parameters of the fit are: x, y, dxdz, dydz, Ptot, time. "
00483                 "You must ensure that there are at least as many data points "
00484                 "as free parameters (scaleT=0 fixes time; scalePtot=0 fixes "
00485                 "Ptot). Each trackerplane with nonzero wireSpacing provides "
00486                 "a data point; each trackerplane with nonzero sigmaT provides "
00487                 "a data point; trackerplanes that measure both provide two "
00488                 "data points. You must have enough trackerplanes to meet this "
00489                 "requirement, and must set minHits large enough to meet it. "
00490                 "The TrackerFit NTuple has a field nDF that gives the number "
00491                 "of degrees of freedom for the fit, which is defined as "
00492                 "(#DataPoints)-(#FreeParameters); it also has nHit which gives "
00493                 "the number of trackerplane-s hit.\n\n"
00494                 "Note the tracker can simulate survey errors -- see the "
00495                 "'trackerplane' command for details (each plane can have "
00496                 "different errors).\n\n"
00497                 "Both the true and the fit tracks are reported at reportZ, "
00498                 "which defaults to the Z position of the tracker.\n\n"
00499                 "Note that beamlossntuple and newparticlentuple will get many "
00500                 "entries per track when used in mode=fit -- the fit runs the "
00501                 "track many times through the tracker (30-100, up to "
00502                 "maxIter).\n\n"
00503                 "NOTE: the trackermode command must preceed all tracker "
00504                 "commands in the input file, and each tracker command must "
00505                 "preceed all of its trackerplane commands. The trackerZ value "
00506                 "must also preceed all trackerplane-s, but reportZ can be "
00507                 "equal to or anywhere after trackerZ.\n\n"
00508                 "Note that each trackerplane must have a unique name. This "
00509                 "means you should either have a separate trackerplane command "
00510                 "for each one (with unique name), or use the rename= argument "
00511                 "to the place command (again with unique name). If you use "
00512                 "groups for trackerplane-s, use rename=+ in the group."
00513         );
00514 
00515         name = "default";
00516         trackerZ = UNDEFINED;
00517         reportZ = UNDEFINED;
00518         reportOnly = false;
00519         scaleX = 1.0*mm;
00520         scaleXp = 0.001;
00521         scalePtot = 0.0;
00522         scaleT = 0.0;
00523         minPz = 10.0*MeV;
00524         tolerance = 0.01;
00525         maxIter = 200;
00526         verbose = 0;
00527         format = "";
00528         filename = "";
00529         for009 = 0;
00530         chisq = 0.0;
00531         ndf = 0;
00532         trueTime = 0.0;
00533         trueTrackID = -9999;
00534         trueParentID = -9999;
00535         trueDefinition = 0;
00536         reportTime = UNDEFINED;
00537         trueHits = -9999;
00538         fitHits = -9999;
00539         minHits = -1;
00540         runmgr = 0;
00541         mgr = 0;
00542         ntuple_hit = 0;
00543         ntuple_fit = 0;
00544         for009_fit = 0;
00545         chisqFailure = false;
00546         trackFields_hit = HIT_FIELDS;
00547         trackFields_fit = FIT_FIELDS;
00548 }

BLCMDtracker::BLCMDtracker ( BLCMDtracker r  ) 

References BLTRACKER_IGNORE, chisq, chisqFailure, filename, fitHits, for009, for009_fit, format, maxIter, mgr, minHits, minPz, mode, name, ndf, ntuple_fit, ntuple_hit, reportOnly, reportTime, reportZ, runmgr, scalePtot, scaleT, scaleX, scaleXp, tolerance, trackerZ, trackFields_fit, trackFields_hit, trueDefinition, trueHits, trueParentID, trueTime, trueTrackID, UNDEFINED, and verbose.

00550                                           : BLCommand(r), 
00551         BLManager::TrackingAction(r), BLManager::ZSteppingAction(),
00552         BLCallback(r), BLMinimizeFunction(r),
00553         plane(), hitWire(), truePosition(), trueMomentum(), reportPosition(),
00554         reportMomentum(), rotationMatrix(), beamPosition()
00555 {
00556         name = "";
00557         trackerZ = r.trackerZ;
00558         reportZ = r.reportZ;
00559         reportOnly = r.reportOnly;
00560         scaleX = r.scaleX;
00561         scaleXp = r.scaleXp;
00562         scalePtot = r.scalePtot;
00563         scaleT = r.scaleT;
00564         minPz = r.minPz;
00565         tolerance = r.tolerance;
00566         maxIter = r.maxIter;
00567         verbose = r.verbose;
00568         format = r.format;
00569         filename = r.filename;
00570         for009 = r.for009;
00571         mode = BLTRACKER_IGNORE;
00572         chisq = 0.0;
00573         ndf = 0;
00574         trueTime = 0.0;
00575         trueTrackID = -9999;
00576         trueParentID = -9999;
00577         trueDefinition = 0;
00578         reportTime = UNDEFINED;
00579         trueHits = -9999;
00580         fitHits = -9999;
00581         minHits = -1;
00582         runmgr = 0;
00583         mgr = 0;
00584         ntuple_hit = 0;
00585         ntuple_fit = 0;
00586         for009_fit = 0;
00587         chisqFailure = false;
00588         trackFields_hit = r.trackFields_hit;
00589         trackFields_fit = r.trackFields_fit;
00590 }


Member Function Documentation

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

commandName() returns "tracker".

Implements BLCommand.

00186 { return "tracker"; }

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

command() implements the tracker command.

Implements BLCommand.

References beamPosition, BLCMDtracker(), BLCMDtracker::FitParam::define(), fitParam, BLCoordinates::getCurrentGlobal(), BLCoordinates::getCurrentRotation(), BLManager::getObject(), BLCommand::handleNamedArgs(), list, name, BLCommand::print(), BLCommand::printError(), BLManager::registerCallback(), BLManager::registerTrackingAction(), BLManager::registerZStep(), reportZ, rotationMatrix, scalePtot, scaleT, scaleX, scaleXp, setName(), trackerZ, and UNDEFINED.

00593 {
00594         if(argv.size() != 1) {
00595                 printError("tracker: Invalid command, must have name");
00596                 return -1;
00597         }
00598 
00599         if(argv[0] == "default") {
00600                 return defaultTracker.handleNamedArgs(namedArgs);
00601         }
00602 
00603         BLCMDtracker *t = new BLCMDtracker(defaultTracker);
00604         t->setName(argv[0]);
00605         int retval = t->handleNamedArgs(namedArgs);
00606 
00607         if(t->trackerZ == UNDEFINED)
00608                 printError("tracker: trackerZ must be defined");
00609         if(t->reportZ == UNDEFINED)
00610                 t->reportZ = t->trackerZ;
00611         if(t->reportZ < t->trackerZ)
00612                 printError("tracker: reportZ must be >= trackerZ");
00613 
00614         // define the fit parameters
00615         t->fitParam.define("x",t->scaleX);
00616         t->fitParam.define("y",t->scaleX);
00617         t->fitParam.define("Xp",t->scaleXp);
00618         t->fitParam.define("Yp",t->scaleXp);
00619         t->fitParam.define("Ptot",t->scalePtot);
00620         t->fitParam.define("t",t->scaleT);
00621 
00622         t->rotationMatrix = *BLCoordinates::getCurrentRotation();
00623         G4ThreeVector tmp(0.0,0.0,t->trackerZ);
00624         BLCoordinates::getCurrentGlobal(tmp,t->beamPosition);
00625 
00626         list.push_back(t);
00627 
00628         t->print(t->name);
00629 
00630         BLManager::getObject()->registerTrackingAction(t);
00631         BLManager::getObject()->registerCallback(t,0);
00632         BLManager::getObject()->registerZStep(t->trackerZ,t,6);
00633         if(t->trackerZ != t->reportZ)
00634                 BLManager::getObject()->registerZStep(t->reportZ,t,6);
00635 
00636         return retval;
00637 }

void BLCMDtracker::defineNamedArgs (  )  [virtual]

defineNamedArgs() defines the named arguments for this command.

Reimplemented from BLCommand.

References BLCommand::argDouble(), BLCommand::argInt(), BLCommand::argString(), filename, for009, format, maxIter, minHits, minPz, reportZ, scalePtot, scaleT, scaleX, scaleXp, tolerance, trackerZ, and verbose.

00640 {
00641         argDouble(trackerZ,"trackerZ","The Z position of the tracker (Centerline, mm).");
00642         argDouble(reportZ,"reportZ","The Z position at which fit tracks are reported (Centerline, mm, default=trackerZ).");
00643         argDouble(scaleX,"scaleX","Scale for X and Y (mm); default=1mm.");
00644         argDouble(scaleXp,"scaleXp","Scale for dxdz and dydz (radians), default=0.001.");
00645         argDouble(scalePtot,"scalePtot","Scale for Ptot (MeV), default=0. Set to 0.0 if tracker cannot determine momentum.",MeV);
00646         argDouble(scaleT,"scaleT","Scale for t (ns), default=0. Set to 0.0 if tracker cannot determine time.",ns);
00647         argDouble(minPz,"minPz","Minimum Pz for valid tracks (default=10 MeV/c)",MeV);
00648         argInt(minHits,"minHits","Minimum number of hits for fitting (# planes).");
00649         argDouble(tolerance,"tolerance","Track fitting tolerance (mm) (default=0.01 mm)");
00650         argInt(maxIter,"maxIter","Maximum iterations during fitting (default=200).");
00651         argInt(verbose,"verbose","0=none, 1=result, 2=iterations, 3=detail, default=0.");
00652         argString(format,"format","Format of output NTuple.");
00653         argString(filename,"filename","Filename of output NTuple.");
00654         argInt(for009,"for009","Set nonzero to also output TrackerFit as FOR009.Dat.");
00655         argString(filename,"file","Synonym for filename.");
00656 }

virtual G4String BLCMDtracker::getName (  )  const [inline, virtual]

Reimplemented from BLCommand.

References name.

Referenced by findTracker(), and registerTrackerPlane().

00194 { return name; }

virtual void BLCMDtracker::setName ( G4String  _name  )  [inline, virtual]

References name.

Referenced by command().

00195 { name = _name; }

BLCMDtracker * BLCMDtracker::findTracker ( G4String  name  )  [static]

findTracker() returns a pointer to the named tracker. returns NULL if not found.

References getName(), and list.

Referenced by BLCMDtrackerplane::command(), and TrackerPlaneInstance::TrackerPlaneInstance().

00659 {
00660         for(unsigned i=0; i<list.size(); ++i) {
00661                 if(name == list[i]->getName()) return list[i];
00662         }
00663         return 0;
00664 }

int BLCMDtracker::registerTrackerPlane ( TrackerPlaneInstance plane,
const G4String  name 
)

registerTrackerPlane() registers a BLCMDtrackerplane with this tracker. Returns the plane id #.

References getName(), hitTime, hitWire, NO_HIT, plane, and trackFields_hit.

Referenced by TrackerPlaneInstance::TrackerPlaneInstance().

00668 {
00669         for(unsigned i=0; i<plane.size(); ++i) {
00670                 if(name == plane[i]->getName()) {
00671                         char tmp[256];
00672                         sprintf(tmp,"trackerplane %s has duplicate name",
00673                                 name.c_str());
00674                         G4Exception("tracker","Duplicate trackerplane-s",
00675                                 FatalException, tmp);
00676                 }
00677         }
00678 
00679         plane.push_back(_plane);
00680         hitWire.push_back(NO_HIT);
00681         hitTime.push_back(0.0);
00682         trackFields_hit += ":";
00683         trackFields_hit += name + "_w:" + name + "_t";
00684         return plane.size()-1;
00685 }

void BLCMDtracker::planeHit ( int  planeID,
int  wire,
double  time 
)

planeHit() tells the tracker that a plane was hit by the current G4Track being tracked. Called only when mode=BLTRACKER_TRUE. wire and/or time should be zero if this plane does not measure them.

References BLTRACKER_TRUE, hitTime, hitWire, mode, name, trueHits, and verbose.

Referenced by TrackerPlaneInstance::UserSteppingAction().

00688 {
00689         assert(mode==BLTRACKER_TRUE);
00690         if(verbose >= 3)
00691                 printf("Tracker %s Plane %d: hit wire %d time %.4f\n",
00692                                                 name.c_str(),planeID,wire,time);
00693         assert(planeID>=0 && planeID<(int)hitWire.size());
00694         hitWire[planeID] = wire;
00695         hitTime[planeID] = time;
00696         ++trueHits;
00697 }

bool BLCMDtracker::delta ( int  planeID,
double  deltaPos,
double  deltaTime,
bool  validWire,
bool  validTime 
)

delta() tells the tracker of this track's offset from the hit wire, divided by sigma. Called only when mode=BLTRACKER_FIT. Returns true to continue tracking, false to have caller kill the track.

References BLTRACKER_FIT, chisq, fitHits, hitWire, mode, name, ndf, reportOnly, and verbose.

Referenced by TrackerPlaneInstance::UserSteppingAction().

00702 {
00703         assert(mode==BLTRACKER_FIT);
00704         if(verbose >= 3)
00705                 printf("Tracker %s Plane %d: deltaWire %.3f deltaTime %.4f\n",
00706                                 name.c_str(),planeID,deltaWire,deltaTime);
00707         assert(planeID>=0 && planeID<(int)hitWire.size());
00708         if(validWire) {
00709                 chisq += deltaWire*deltaWire;
00710                 ++ndf;
00711         }
00712         if(validTime) {
00713                 chisq += deltaTime*deltaTime;
00714                 ++ndf;
00715         }
00716 
00717         if(validWire || validTime) ++fitHits;
00718 
00719         if(planeID == (int)hitWire.size()-1) {
00720                 // kill after last plane, unless reportOnly
00721                 if(verbose >= 2 && !reportOnly)
00722                         printf("TrackerPlane %d: last plane, kill track\n",
00723                                                                 planeID);
00724                 return reportOnly;
00725         }
00726         return true;
00727 }

void BLCMDtracker::fitTrack (  ) 

fitTrack() fits a track to the true track.

References BLNTuple::appendRow(), BEAM, BLTRACKER_FIT, BLTRACKER_IGNORE, chisqFailure, constructTrack(), fitHits, fitParam, for009_fit, FORCE_OFF, BLGlobalField::GetFieldValue(), BLMinimize::getIterations(), BLCMDtracker::FitParam::getNameList(), BLGlobalField::getObject(), BLManager::getObject(), BLRunManager::getObject(), BLManager::getPhysics(), BLMinimize::getSize(), BLManager::getState(), maxIter, mgr, minHits, BLMinimize::minimize(), mode, N_FIT_FIELDS, N_FOR009_FIELDS, name, ndf, NORMAL, ntuple_fit, BLRunManager::processOneTrack(), reportMomentum, reportOnly, reportPosition, reportTime, runmgr, BLCMDtracker::FitParam::scale, scaleX, BLMinimize::setChisqMin(), BLCMDtracker::FitParam::setDelta(), BLPhysics::setDoStochastics(), BLMinimize::setFunc(), BLManager::setPrimaryTrackID(), tolerance, trueDefinition, trueHits, trueMomentum, trueParentID, truePosition, trueTime, trueTrackID, UNDEFINED, BLMinimize::value(), and verbose.

Referenced by handlePreviousTracks().

00782 {
00783         mode = BLTRACKER_FIT;
00784         if(verbose >= 3)
00785                 printf("Tracker %s fitTrack() entered\n",name.c_str());
00786 
00787         if(!runmgr) runmgr = BLRunManager::getObject();
00788         if(!mgr) mgr = BLManager::getObject();
00789 
00790         if(mgr->getState() != BEAM) return;
00791         if(trueHits < minHits) {
00792                 if(verbose >= 3)
00793                         printf("Tracker %s fitTrack FAILED trueHits=%d < %d\n",
00794                                 name.c_str(),trueHits,minHits);
00795                 return;
00796         }
00797 
00798         mgr->getPhysics()->setDoStochastics(FORCE_OFF,true);
00799         
00800         G4ThreeVector trueReportPosition = reportPosition;
00801         G4ThreeVector trueReportMomentum = reportMomentum;
00802         G4double trueReportTime = reportTime;
00803 
00804         BLMinimize min((verbose>=2 ? 2 : 0));
00805         min.setFunc(*this,fitParam.scale,fitParam.getNameList());
00806         min.setChisqMin(0.05);
00807 
00808         // this code must match the parameter definitions in command()
00809         // initial values come from the true track.
00810         std::vector<double> x;
00811         x.push_back(truePosition[0]);
00812         x.push_back(truePosition[1]);
00813         x.push_back(trueMomentum[0]/trueMomentum[2]);
00814         x.push_back(trueMomentum[1]/trueMomentum[2]);
00815         x.push_back(trueMomentum.mag());
00816         x.push_back(trueTime);
00817 
00818         chisqFailure = false;
00819 
00820         int status = min.minimize(x,(scaleX>0.0? tolerance/scaleX : tolerance),
00821                                                                 maxIter);
00822 
00823         if(chisqFailure)
00824                 status = GSL_EFAILED;
00825 
00826         // try again if large chisq
00827         if(status==0 && min.value()>3.0 && min.getIterations()<maxIter/2) {
00828                 if(verbose>0) printf("Tracker %s fitTrack Try Again\n",
00829                                                                 name.c_str());
00830                 status = min.minimize(x,
00831                         (scaleX>0.0 ? tolerance/scaleX : tolerance),maxIter);
00832                 if(chisqFailure)
00833                         status = GSL_EFAILED;
00834         }
00835 
00836         if(verbose > 0 && status == 0) {
00837                 printf("%s fitTrack chisq=%.3f size=%.3f iter=%d\n",
00838                         name.c_str(),min.value(),min.getSize(),
00839                         min.getIterations());
00840                 printf("   true x,y,dxdz,dydz,Ptot,t: %7.1f %7.1f %7.4f %.4f %7.1f %9.3f\n",
00841                         truePosition[0],truePosition[1], trueMomentum[0]/trueMomentum[2],
00842                         trueMomentum[1]/trueMomentum[2],trueMomentum.mag(),
00843                         trueTime);
00844                 printf("   fit  x,y,dxdz,dydz,Ptot,t: %7.1f %7.1f %7.4f %.4f %7.1f %9.3f\n",
00845                         x[0],x[1],x[2],x[3],x[4],x[5]);
00846         } else if(verbose > 0) {
00847                 printf("%s fitTrack FAILED\n",name.c_str());
00848         }
00849 
00850         if(status == 0 && ntuple_fit != 0) {
00851                 // update the summary -- code must match param defs in command()
00852                 fitParam.setDelta("x",x[0]-truePosition[0]);
00853                 fitParam.setDelta("y",x[1]-truePosition[1]);
00854                 fitParam.setDelta("Xp",x[2]-trueMomentum[0]/trueMomentum[2]);
00855                 fitParam.setDelta("Yp",x[3]-trueMomentum[1]/trueMomentum[2]);
00856                 fitParam.setDelta("Ptot",x[4]-trueMomentum.mag());
00857                 fitParam.setDelta("t",x[5]-trueTime);
00858 
00859 //printf("fitTrack() is tracking the fit track\n");
00860 //verbose=3;
00861 //mgr->setSteppingVerbose(3);
00862                 // need to re-track the fitted track to z=reportZ
00863                 reportOnly = true;
00864                 G4Track *track = constructTrack(x);
00865                 trueTrackID += 10000;
00866                 BLManager::getObject()->setPrimaryTrackID(trueTrackID,
00867                                                                 trueParentID);
00868                 BLRunManager::getObject()->processOneTrack(track);
00869                 trueTrackID -= 10000;
00870                 delete track;
00871                 reportOnly = false;
00872 //mgr->setSteppingVerbose(0);
00873 //verbose=0;
00874 
00875                 if(reportTime != UNDEFINED) {
00876 //printf("fitTrack() reported OK\n");
00877                         // this code must agree with the field names in 
00878                         // trackFields_fit and FOR009_FIELDS
00879                         float data[N_FIT_FIELDS];
00880 #if N_FIT_FIELDS!=23
00881 #error N_FIT_FIELDS!=23
00882 #endif
00883 
00884                         data[0] = reportPosition[0]/mm;
00885                         data[1] = reportPosition[1]/mm;
00886                         data[2] = reportPosition[2]/mm;
00887                         data[3] = reportMomentum[0]/MeV;
00888                         data[4] = reportMomentum[1]/MeV;
00889                         data[5] = reportMomentum[2]/MeV;
00890                         data[6] = reportTime/ns;
00891                         data[7] = trueDefinition->GetPDGEncoding();
00892                         data[8] = runmgr->GetCurrentEvent()->GetEventID();
00893                         data[9] = trueTrackID+10000;
00894                         data[10] = trueParentID;
00895                         data[11] = 1.0;
00896                         data[12] = min.value();
00897                         data[13] = ndf;
00898                         data[14] = fitHits;
00899                         data[15] = min.getIterations();
00900                         data[16] = trueReportPosition[0]/mm;
00901                         data[17] = trueReportPosition[1]/mm;
00902                         data[18] = trueReportPosition[2]/mm;
00903                         data[19] = trueReportMomentum[0]/MeV;
00904                         data[20] = trueReportMomentum[1]/MeV;
00905                         data[21] = trueReportMomentum[2]/MeV;
00906                         data[22] = trueReportTime/ns;
00907                         ntuple_fit->appendRow(data,N_FIT_FIELDS);
00908                         if(for009_fit != 0) {
00909 #if N_FOR009_FIELDS!=18
00910 #error N_FOR009_FIELDS!=18
00911 #endif
00912                                 G4double point[4], field[6];
00913                                 point[0] = reportPosition[0];
00914                                 point[1] = reportPosition[1];
00915                                 point[2] = reportPosition[2];
00916                                 point[3] = reportTime;
00917                                 BLGlobalField::getObject()->GetFieldValue(point,
00918                                                                         field);
00919                                 data[12] = field[0]/tesla;              // Bx
00920                                 data[13] = field[1]/tesla;              // By
00921                                 data[14] = field[2]/tesla;              // Bz
00922                                 data[15] = field[3]/(megavolt/meter);   // Ex
00923                                 data[16] = field[4]/(megavolt/meter);   // Ey
00924                                 data[17] = field[5]/(megavolt/meter);   // Ez
00925                                 for009_fit->appendRow(data,N_FOR009_FIELDS);
00926                         }
00927                 } else {
00928 //printf("fitTrack() -- track has reportTime==UNDEFINED\n");
00929                 }
00930         }
00931 
00932         mgr->getPhysics()->setDoStochastics(NORMAL,true);
00933 
00934         mode = BLTRACKER_IGNORE;
00935         trueHits = -9999;
00936 
00937         if(verbose >= 3)
00938                 printf("%s fitTrack() returns; status=%d\n",name.c_str(),status);
00939 }

void BLCMDtracker::setMode ( BLTrackerMode  _mode  )  [inline]

setMode() sets the tracker mode.

References mode.

00221 { mode = _mode; }

void BLCMDtracker::UserZSteppingAction ( const G4Track *  track  )  [virtual]

virtual void UserZSteppingAction() from BLManager::ZSteppingAction. Handles the true track in mode=true, and handles the reference particle in all modes.

Implements BLManager::ZSteppingAction.

References BLNTuple::appendRow(), BLCOORD_CENTERLINE, BLTRACKER_TRUE, for009_fit, BLCoordinates::getCoords(), BLManager::getExternalParentID(), BLManager::getExternalTrackID(), BLGlobalField::GetFieldValue(), BLGlobalField::getObject(), BLManager::getObject(), BLCoordinates::getRotation(), BLCoordinates::isValid(), minHits, minPz, mode, name, REFERENCE, reportMomentum, reportOnly, reportPosition, reportTime, reportZ, trackerZ, trueDefinition, trueHits, trueMomentum, trueParentID, truePosition, trueTime, trueTrackID, UNDEFINED, and verbose.

00942 {
00943         // get Centerline position and momentum
00944         BLCoordinates *coord = (BLCoordinates *)track->GetUserInformation();
00945         if(coord && !coord->isValid()) coord = 0;
00946         G4ThreeVector pos;
00947         G4ThreeVector momentum = track->GetMomentum();
00948         if(coord) {
00949                 coord->getCoords(BLCOORD_CENTERLINE,pos);
00950                 momentum = coord->getRotation() * momentum;
00951         }
00952 
00953         if(BLManager::getObject()->getState() == REFERENCE) {
00954                 if(fabs(pos[2]-trackerZ) > 0.010*mm &&
00955                    fabs(pos[2]-reportZ) > 0.010*mm) {
00956                         if(verbose >= 3) printf("tracker %s ZStep ignored\n",
00957                                                         name.c_str());
00958                         return;
00959                 }
00960         } else if(reportOnly) {
00961                 if(fabs(pos[2]-reportZ) > 0.010*mm) {
00962                         if(verbose >= 3) printf("tracker %s ZStep ignored\n",
00963                                                         name.c_str());
00964                         return;
00965                 }
00966         } else if(mode == BLTRACKER_TRUE) {
00967                 if(fabs(pos[2]-trackerZ) > 0.010*mm &&
00968                    fabs(pos[2]-reportZ) > 0.010*mm) {
00969                         if(verbose >= 3) printf("tracker %s ZStep ignored\n",
00970                                                         name.c_str());
00971                         return;
00972                 }
00973         } else {
00974                 if(verbose >= 3) printf("tracker %s ZStep ignored\n",
00975                                                 name.c_str());
00976                 return;
00977         }
00978 
00979         // here if Reference particle at either trackerZ or reportZ,
00980         // reportOnly at reportZ, or true particle at either trackerZ or reportZ
00981 
00982         if(momentum[2] < minPz) {
00983                 if(verbose >= 3)
00984                         printf("tracker %s setTrueTrack() -- Pz < %.3f\n",
00985                                         name.c_str(),minPz);
00986                 return;
00987         }
00988 
00989         if(fabs(pos[2]-trackerZ) < 0.010*mm) {
00990                 if(verbose >= 3)
00991                         printf("tracker %s setTrueTrack() z=%.3f minHits=%d\n",
00992                                                 name.c_str(),pos[2],minHits);
00993                 truePosition = pos;
00994                 trueMomentum = momentum;
00995                 trueTime = track->GetGlobalTime();
00996                 trueTrackID = BLManager::getObject()->getExternalTrackID(track);
00997                 trueParentID = BLManager::getObject()->getExternalParentID(track);
00998                 trueDefinition = track->GetDefinition();
00999                 trueHits = 0;
01000         }
01001         if(fabs(pos[2]-reportZ) < 0.010*mm) {
01002                 if(trueTrackID != BLManager::getObject()->getExternalTrackID(track) ||
01003                    trueParentID != BLManager::getObject()->getExternalParentID(track) ||
01004                    trueDefinition != track->GetDefinition()) {
01005                         if(verbose >= 3) 
01006                                 printf("tracker %s ZStep wrong track: "
01007                                 "%d,%d %d,%d %08lX,%08lX\n",
01008                                 name.c_str(),trueTrackID,track->GetTrackID(),
01009                                 trueParentID,track->GetParentID(),
01010                                 (long)trueDefinition,(long)track->GetDefinition());
01011                         return;
01012                 }
01013                 if(verbose >= 3)
01014                         printf("tracker %s setReportTrack() z=%.3f\n",
01015                                                         name.c_str(),pos[2]);
01016                 reportPosition = pos;
01017                 reportMomentum = momentum;
01018                 reportTime = track->GetGlobalTime();
01019                 if(reportOnly) {
01020                         if(verbose >= 3)
01021                                 printf("tracker %s reportOnly killing track\n",
01022                                                         name.c_str());
01023                         ((G4Track *)track)->SetTrackStatus(fStopAndKill);
01024                 }
01025         }
01026 
01027         if(BLManager::getObject()->getState() != REFERENCE) return;
01028         if(for009_fit == 0 || reportTime == UNDEFINED) return;
01029 
01030         // here to append the reference to for009_fit
01031 
01032         // this code must agree with the field names in for009Track_fit
01033         G4double point[4], field[6];
01034         point[0] = reportPosition[0];
01035         point[1] = reportPosition[1];
01036         point[2] = reportPosition[2];
01037         point[3] = reportTime;
01038         BLGlobalField::getObject()->GetFieldValue(point,field);
01039         float data[18];
01040         data[0] = reportPosition[0]/mm;
01041         data[1] = reportPosition[1]/mm;
01042         data[2] = reportPosition[2]/mm;
01043         data[3] = reportMomentum[0]/MeV;
01044         data[4] = reportMomentum[1]/MeV;
01045         data[5] = reportMomentum[2]/MeV;
01046         data[6] = reportTime/ns;
01047         data[7] = track->GetDefinition()->GetPDGEncoding();
01048         data[8] = -1;           // EventID
01049         data[9] = 1;            // TrackID
01050         data[10] = 0;           // ParentID
01051         data[11] = 1.0;         // Weight
01052         data[12] = field[0]/tesla;              // Bx
01053         data[13] = field[1]/tesla;              // By
01054         data[14] = field[2]/tesla;              // Bz
01055         data[15] = field[3]/(megavolt/meter);   // Ex
01056         data[16] = field[4]/(megavolt/meter);   // Ey
01057         data[17] = field[5]/(megavolt/meter);   // Ez
01058         for009_fit->appendRow(data,18);
01059 }

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

PreUserTrackingAction() from BLManager::TrackingAction. Initializes stuff.

Implements BLManager::TrackingAction.

References BEAM, BLTRACKER_FIT, BLTRACKER_IGNORE, BLTRACKER_TRUE, chisq, fitHits, BLManager::getObject(), BLManager::getState(), hitTime, hitWire, mode, ndf, NO_HIT, plane, reportTime, trueHits, and UNDEFINED.

01062 {
01063         BLManagerState state = BLManager::getObject()->getState();
01064         if(state != BEAM) return;
01065 
01066         for(unsigned i=0; i<plane.size(); ++i) {
01067                 switch(mode) {
01068                 case BLTRACKER_TRUE:
01069                         plane[i]->setTrueMode();
01070                         hitWire[i] = NO_HIT;
01071                         hitTime[i] = 0.0;
01072                         break;
01073                 case BLTRACKER_FIT:
01074                         plane[i]->setFitMode(hitWire[i],hitTime[i]);
01075                         break;
01076                 case BLTRACKER_IGNORE:
01077                         plane[i]->setIgnoreMode();
01078                         break;
01079                 }
01080         }
01081 
01082         // reportTime is used as a flag to indicate that the report variables
01083         // are set for this track
01084         reportTime = UNDEFINED;
01085 
01086         switch(mode) {
01087         case BLTRACKER_TRUE:
01088                 trueHits = 0;
01089                 break;
01090         case BLTRACKER_FIT:
01091                 fitHits = 0;
01092                 chisq = 0.0;
01093                 ndf = 0;
01094                 break;
01095         case BLTRACKER_IGNORE:
01096                 break;
01097         }
01098 }

void BLCMDtracker::PostUserTrackingAction ( const G4Track *  track  )  [virtual]

PostUserTrackingAction() from BLManager::TrackingAction. Writes the true track in mode=true, only if it hit all planes.

Implements BLManager::TrackingAction.

References BLNTuple::appendRow(), BEAM, BLTRACKER_FIT, BLTRACKER_TRUE, fitParam, BLRunManager::getObject(), BLManager::getObject(), BLManager::getState(), hitTime, hitWire, minHits, mode, N_HIT_FIELDS, ndf, ntuple_hit, plane, reportMomentum, reportPosition, reportTime, runmgr, BLCMDtracker::FitParam::scale, trueDefinition, trueHits, trueMomentum, trueParentID, truePosition, trueTime, trueTrackID, and UNDEFINED.

01101 {
01102         BLManagerState state = BLManager::getObject()->getState();
01103         if(state != BEAM) return;
01104 
01105         if(mode == BLTRACKER_TRUE && reportTime != UNDEFINED &&
01106            ntuple_hit != 0 && trueHits >= minHits) {
01107                 if(!runmgr) runmgr = BLRunManager::getObject();
01108                 static float *data=0;
01109                 static unsigned ndata=0;
01110                 if(ndata < N_HIT_FIELDS+2*hitWire.size()) {
01111                         if(data) free(data);
01112                         ndata = N_HIT_FIELDS+2*hitWire.size();
01113                         data = new float[ndata];
01114                 }
01115                 // this code must agree with the field names in trackFields_hit
01116                 data[0] = truePosition[0]/mm;
01117                 data[1] = truePosition[1]/mm;
01118                 data[2] = truePosition[2]/mm;
01119                 data[3] = trueMomentum[0]/MeV;
01120                 data[4] = trueMomentum[1]/MeV;
01121                 data[5] = trueMomentum[2]/MeV;
01122                 data[6] = trueTime/ns;
01123                 data[7] = trueDefinition->GetPDGEncoding();
01124                 data[8] = runmgr->GetCurrentEvent()->GetEventID();
01125                 data[9] = trueTrackID;
01126                 data[10] = trueParentID;
01127                 data[11] = 1.0;
01128                 data[12] = reportPosition[0]/mm;
01129                 data[13] = reportPosition[1]/mm;
01130                 data[14] = reportPosition[2]/mm;
01131                 data[15] = reportMomentum[0]/MeV;
01132                 data[16] = reportMomentum[1]/MeV;
01133                 data[17] = reportMomentum[2]/MeV;
01134                 data[18] = reportTime/ns;
01135                 int j=N_HIT_FIELDS;
01136                 for(unsigned i=0; i<hitWire.size(); ++i) {
01137                         data[j++] = hitWire[i];
01138                         data[j++] = hitTime[i];
01139                 }
01140                 ntuple_hit->appendRow(data,N_HIT_FIELDS+2*hitWire.size());
01141         }
01142 
01143         if(mode == BLTRACKER_FIT) {
01144                 // update ndf for fitted parameters
01145                 for(unsigned i=0; i<fitParam.scale.size(); ++i) {
01146                         if(fitParam.scale[i] > 0.0)
01147                                 --ndf;
01148                 }
01149                 if(ndf < 0) ndf = 0;
01150         }
01151 
01152         for(unsigned i=0; i<plane.size(); ++i) {
01153                 plane[i]->setIgnoreMode();
01154         }
01155 }

void BLCMDtracker::callback ( int  type  )  [virtual]

callback() from BLCallback. Constructs NTuples -- must wait until all planes are defined and mode is known (trackermode could follow this command)

Reimplemented from BLCallback.

References BLNTuple::create(), filename, for009, FOR009_FIELDS, for009_fit, format, BLCMDtrackermode::getMode(), hitWire, minHits, name, ntuple_fit, ntuple_hit, trackFields_fit, and trackFields_hit.

01158 {
01159         // had to wait until all trackerplane-s are registered
01160         // and mode is known
01161         G4String m = trackermodeInstance.getMode();
01162         if(m == "true" || m == "both") {
01163             ntuple_hit = BLNTuple::create(format,"TrackerHits",name,
01164                                                 trackFields_hit,filename);
01165         } else if(m == "fit" || m == "both") {
01166             ntuple_fit = BLNTuple::create(format,"TrackerFit",name,
01167                                                 trackFields_fit,filename);
01168            if(for009) for009_fit = BLNTuple::create("for009","TrackerFit",name,
01169                                                 FOR009_FIELDS,filename);
01170         } else {
01171                 G4Exception("tracker","Invalid mode",FatalException,m.c_str());
01172         }
01173 
01174         if(minHits < 0) minHits = hitWire.size();
01175 }

G4Track * BLCMDtracker::constructTrack ( const std::vector< double > &  x  ) 

constructTrack() will construct a track from the parameters. The caller must delete the track;

References beamPosition, rotationMatrix, trueDefinition, trueParentID, and trueTrackID.

Referenced by fitTrack(), and operator()().

00730 {
00731         G4ThreeVector pos(x[0],x[1],0.0);
00732         G4double dxdz = x[2];
00733         G4double dydz = x[3];
00734         G4double Ptot = x[4];
00735         G4double time = x[5];
00736         G4double mass = trueDefinition->GetPDGMass();
00737         G4double ke = sqrt(Ptot*Ptot+mass*mass) - mass;
00738         G4double norm = sqrt(1.0+dxdz*dxdz+dydz*dydz);
00739         G4ThreeVector dir(dxdz/norm,dydz/norm,1.0/norm);
00740 
00741         // convert to centerline coordinates
00742         dir = rotationMatrix * dir;
00743         pos = rotationMatrix * pos + beamPosition;
00744 
00745         G4DynamicParticle *particle =
00746                                 new G4DynamicParticle(trueDefinition,dir,ke);
00747         G4Track *track = new G4Track(particle,time,pos);
00748         track->SetTrackID(trueTrackID+10000);
00749         track->SetParentID(trueParentID);
00750         track->SetGlobalTime(time);
00751 
00752         return track;
00753 }

double BLCMDtracker::operator() ( const std::vector< double > &  x  )  [virtual]

operator() from BLMinimizeFunction. Computes the chisq by tracking the trake constructed from the current parameters.

Implements BLMinimizeFunction.

References BLTRACKER_FIT, chisq, chisqFailure, constructTrack(), fitHits, BLRunManager::getObject(), BLManager::getObject(), minHits, mode, name, ndf, BLRunManager::processOneTrack(), BLManager::setPrimaryTrackID(), trueHits, trueParentID, trueTrackID, and verbose.

00756 {
00757         if(chisqFailure) return 0.0; // short-circuit iterations in BLMinimize
00758 
00759         mode = BLTRACKER_FIT;
00760 
00761         G4Track *track = constructTrack(x);
00762 
00763         BLManager::getObject()->setPrimaryTrackID(trueTrackID+10000,
00764                                                                 trueParentID);
00765         BLRunManager::getObject()->processOneTrack(track);
00766 
00767         delete track;
00768 
00769         if(verbose >= 3)
00770                 printf("%s tracking chisq=%.4f ndf=%d  fitHits=%d trueHits=%d\n",
00771                                         name.c_str(),chisq,ndf,fitHits,trueHits);
00772 
00773         if(fitHits < minHits || fitHits < trueHits) {
00774                 chisqFailure = true;
00775                 return 0.0; // will short-circuit iteration in BLMinimize
00776         }
00777 
00778         return (ndf>0 ? chisq/ndf : chisq);
00779 }

void BLCMDtracker::handlePreviousTracks ( const G4String  filename  ) 

handlePreviousTracks() reads a previously-written NTuple contining 'true' tracks, and fits tracks to them.

References BEAM, BLRunManager::beginEvent(), BLRunManager::beginRun(), BLRunManager::endEvent(), BLRunManager::endRun(), fitParam, fitTrack(), format, BLManager::getObject(), BLRunManager::getObject(), hitTime, hitWire, BLCommand::in, mgr, minHits, N_HIT_FIELDS, name, NO_HIT, BLCommand::printError(), BLCMDtracker::FitParam::printSummary(), BLNTuple::read(), reportMomentum, reportPosition, reportTime, runmgr, BLManager::setEventID(), BLManager::setState(), trackFields_hit, trueDefinition, trueHits, trueMomentum, trueParentID, truePosition, trueTime, and trueTrackID.

01178 {
01179         printf("==================== Begin Fitting Tracker %s ======================\n",name.c_str());
01180 
01181         BLNTuple *in = BLNTuple::read(format, "TrackerHits", name,
01182                                                         trackFields_hit, file);
01183         if(!in) {
01184                 printError("tracker::handlePreviousTracks cannot open NTuple");
01185                 return;
01186         }
01187         if(in->getNData() != N_HIT_FIELDS+2*(int)hitWire.size()) {
01188                 in->close();
01189                 printError("tracker::handlePreviousTracks NTuple wrong # fields");
01190                 return;
01191         }
01192 
01193         if(!runmgr) runmgr = BLRunManager::getObject();
01194         if(!mgr) mgr = BLManager::getObject();
01195         runmgr->beginRun();
01196         mgr->setState(BEAM);
01197 
01198         // this code must agree with the field names in trackFields_hit
01199         static float *data=0;
01200         static unsigned ndata=0;
01201         if(ndata < N_HIT_FIELDS+2*hitWire.size()) {
01202                 if(data) free(data);
01203                 ndata = N_HIT_FIELDS+2*hitWire.size();
01204                 data = new float[ndata];
01205         }
01206         while(in->readRow(data,ndata)) {
01207                 int eventID = (int)data[8];
01208                 if(eventID < 0) continue; // skip fitting reference particle
01209                 truePosition[0] = data[0]*mm;
01210                 truePosition[1] = data[1]*mm;
01211                 truePosition[2] = data[2]*mm;
01212                 trueMomentum[0] = data[3]*MeV;
01213                 trueMomentum[1] = data[4]*MeV;
01214                 trueMomentum[2] = data[5]*MeV;
01215                 trueTime = data[6]*ns;
01216                 trueDefinition = G4ParticleTable::GetParticleTable()->FindParticle((int)data[7]);
01217                 trueTrackID = (int)data[9];
01218                 trueParentID = (int)data[10];
01219                 reportPosition[0] = data[12]*mm;
01220                 reportPosition[1] = data[13]*mm;
01221                 reportPosition[2] = data[14]*mm;
01222                 reportMomentum[0] = data[15]*MeV;
01223                 reportMomentum[1] = data[16]*MeV;
01224                 reportMomentum[2] = data[17]*MeV;
01225                 reportTime = data[18]*ns;
01226                 trueHits = 0;
01227                 int j=N_HIT_FIELDS;
01228                 for(unsigned i=0; i<hitWire.size(); ++i) {
01229                         hitWire[i] = (int)data[j++];
01230                         hitTime[i] = data[j++];
01231                         if(hitWire[i] != NO_HIT) ++trueHits;
01232                 }
01233                 if(trueHits < minHits) continue;
01234                 mgr->setEventID(eventID);
01235                 runmgr->beginEvent(eventID);
01236                 fitTrack();
01237                 runmgr->endEvent();
01238         }
01239 
01240         runmgr->endRun();
01241         in->close();
01242 
01243         fitParam.printSummary();
01244 }


Friends And Related Function Documentation

friend class TrackerPlaneInstance [friend]


Member Data Documentation

G4String BLCMDtracker::name [private]

G4double BLCMDtracker::trackerZ [private]

G4double BLCMDtracker::reportZ [private]

bool BLCMDtracker::reportOnly [private]

G4double BLCMDtracker::scaleX [private]

G4double BLCMDtracker::scaleXp [private]

G4double BLCMDtracker::scalePtot [private]

G4double BLCMDtracker::scaleT [private]

G4double BLCMDtracker::minPz [private]

G4double BLCMDtracker::tolerance [private]

G4int BLCMDtracker::maxIter [private]

G4int BLCMDtracker::verbose [private]

G4String BLCMDtracker::format [private]

G4String BLCMDtracker::filename [private]

G4int BLCMDtracker::for009 [private]

std::vector<TrackerPlaneInstance*> BLCMDtracker::plane [private]

std::vector<int> BLCMDtracker::hitWire [private]

std::vector<double> BLCMDtracker::hitTime [private]

double BLCMDtracker::chisq [private]

int BLCMDtracker::ndf [private]

G4ThreeVector BLCMDtracker::truePosition [private]

G4ThreeVector BLCMDtracker::trueMomentum [private]

G4double BLCMDtracker::trueTime [private]

G4int BLCMDtracker::trueTrackID [private]

G4int BLCMDtracker::trueParentID [private]

G4ParticleDefinition* BLCMDtracker::trueDefinition [private]

G4ThreeVector BLCMDtracker::reportPosition [private]

G4ThreeVector BLCMDtracker::reportMomentum [private]

G4double BLCMDtracker::reportTime [private]

G4int BLCMDtracker::trueHits [private]

G4int BLCMDtracker::fitHits [private]

int BLCMDtracker::minHits [private]

G4RotationMatrix BLCMDtracker::rotationMatrix [private]

Referenced by command(), and constructTrack().

G4ThreeVector BLCMDtracker::beamPosition [private]

Referenced by command(), and constructTrack().

Referenced by BLCMDtracker(), callback(), and fitTrack().

G4bool BLCMDtracker::chisqFailure [private]

Referenced by BLCMDtracker(), fitTrack(), and operator()().

G4String BLCMDtracker::trackFields_hit [private]

G4String BLCMDtracker::trackFields_fit [private]

Referenced by BLCMDtracker(), and callback().

std::vector< BLCMDtracker * > BLCMDtracker::list [static]


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