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().

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

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.

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


Member Function Documentation

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

commandName() returns "tracker".

Implements BLCommand.

00190 { 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.

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

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.

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

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

Reimplemented from BLCommand.

References name.

Referenced by findTracker(), and registerTrackerPlane().

00198 { return name; }

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

References name.

Referenced by command().

00199 { 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().

00663 {
00664         for(unsigned i=0; i<list.size(); ++i) {
00665                 if(name == list[i]->getName()) return list[i];
00666         }
00667         return 0;
00668 }

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().

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

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().

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

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().

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

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().

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

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

setMode() sets the tracker mode.

References mode.

00225 { 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.

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

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.

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

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.

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

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.

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

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()().

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

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.

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

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.

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


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