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 BLCMDtracker * | findTracker (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 |
BLRunManager * | runmgr |
BLManager * | mgr |
BLNTuple * | ntuple_hit |
BLNTuple * | ntuple_fit |
BLNTuple * | for009_fit |
G4bool | chisqFailure |
G4String | trackFields_hit |
G4String | trackFields_fit |
Friends | |
class | TrackerPlaneInstance |
Classes | |
struct | FitParam |
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 "NOTE: the trackerplane-s of a tracker MUST be placed in the " 00462 "order that particles will hit them; the code does not sort " 00463 "them. Usually this means that each place command of a " 00464 "trackerplane must have a larger z value than the previous " 00465 "place command. They must also come after the trackerZ value " 00466 "of the tracker command.\n\n" 00467 "A tracker has 3 modes of operation:\n" 00468 " true Each track of each event is written to a\n" 00469 " TrackerHits NTuple if it hits all trackerplanes;\n" 00470 " the NTuple includes both the true track values\n" 00471 " and the individual wire hits for each trackerplane.\n" 00472 " fit A track is fit to the wire hits from a previous\n" 00473 " run, and the fit track is written to a TrackerFit\n" 00474 " NTuple (includes true values).\n" 00475 " ignore Any track is ignored.\n\n" 00476 "See the 'trackermode' command to control the mode of trackers.\n\n" 00477 "The TrackerHits NTuple written in 'true' mode contains:\n" 00478 " true_x, true_y, true_z, true_Px, true_Py, true_Pz, true_t, \n" 00479 " true_PDGid, true_EventID, true_TrackID, true_ParentID, \n" 00480 " true_Weight, ... plus 1 hit and 1 time per trackerplane.\n" 00481 " (the first 12 are the same as a BLTrackFile.)\n\n" 00482 "The TrackerFit Ntuple written in 'fit' mode contains:\n" 00483 " x, y, z, Px, Py, Pz, t, PDGid, EventID, TrackID, ParentID,\n" 00484 " Weight, ChisqPerDF, nDF, nHit, nIter, true_x, true_y, true_z, true_Px,\n" 00485 " true_Py, true_Pz, true_t.\n" 00486 "(the first 12 are from the fit and are the same as a " 00487 "BLTrackFile.)\n\n" 00488 "The parameters of the fit are: x, y, dxdz, dydz, Ptot, time. " 00489 "You must ensure that there are at least as many data points " 00490 "as free parameters (scaleT=0 fixes time; scalePtot=0 fixes " 00491 "Ptot). Each trackerplane with nonzero wireSpacing provides " 00492 "a data point; each trackerplane with nonzero sigmaT provides " 00493 "a data point; trackerplanes that measure both provide two " 00494 "data points. You must have enough trackerplanes to meet this " 00495 "requirement, and must set minHits large enough to meet it. " 00496 "The TrackerFit NTuple has a field nDF that gives the number " 00497 "of degrees of freedom for the fit, which is defined as " 00498 "(#DataPoints)-(#FreeParameters); it also has nHit which gives " 00499 "the number of trackerplane-s hit.\n\n" 00500 "Note the tracker can simulate survey errors -- see the " 00501 "'trackerplane' command for details (each plane can have " 00502 "different errors).\n\n" 00503 "Both the true and the fit tracks are reported at reportZ, " 00504 "which defaults to the Z position of the tracker.\n\n" 00505 "Note that beamlossntuple and newparticlentuple will get many " 00506 "entries per track when used in mode=fit -- the fit runs the " 00507 "track many times through the tracker (30-100, up to " 00508 "maxIter).\n\n" 00509 "NOTE: the trackermode command must preceed all tracker " 00510 "commands in the input file, and each tracker command must " 00511 "preceed all of its trackerplane commands. The trackerZ value " 00512 "must also preceed all trackerplane-s, but reportZ can be " 00513 "equal to or anywhere after trackerZ.\n\n" 00514 "Note that each trackerplane must have a unique name. This " 00515 "means you should either have a separate trackerplane command " 00516 "for each one (with unique name), or use the rename= argument " 00517 "to the place command (again with unique name). If you use " 00518 "groups for trackerplane-s, use rename=+ in the group.\n\n" 00519 "NOTE: This command does not work properly in collective " 00520 "tracking mode." 00521 ); 00522 00523 name = "default"; 00524 trackerZ = UNDEFINED; 00525 reportZ = UNDEFINED; 00526 reportOnly = false; 00527 scaleX = 1.0*mm; 00528 scaleXp = 0.001; 00529 scalePtot = 0.0; 00530 scaleT = 0.0; 00531 minPz = 10.0*MeV; 00532 tolerance = 0.01; 00533 maxIter = 200; 00534 verbose = 0; 00535 format = ""; 00536 filename = ""; 00537 for009 = 0; 00538 chisq = 0.0; 00539 ndf = 0; 00540 trueTime = 0.0; 00541 trueTrackID = -9999; 00542 trueParentID = -9999; 00543 trueDefinition = 0; 00544 reportTime = UNDEFINED; 00545 trueHits = -9999; 00546 fitHits = -9999; 00547 minHits = -1; 00548 runmgr = 0; 00549 mgr = 0; 00550 ntuple_hit = 0; 00551 ntuple_fit = 0; 00552 for009_fit = 0; 00553 chisqFailure = false; 00554 trackFields_hit = HIT_FIELDS; 00555 trackFields_fit = FIT_FIELDS; 00556 }
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.
00558 : BLCommand(r), 00559 BLManager::TrackingAction(r), BLManager::ZSteppingAction(), 00560 BLCallback(r), BLMinimizeFunction(r), 00561 plane(), hitWire(), truePosition(), trueMomentum(), reportPosition(), 00562 reportMomentum(), rotationMatrix(), beamPosition() 00563 { 00564 name = ""; 00565 trackerZ = r.trackerZ; 00566 reportZ = r.reportZ; 00567 reportOnly = r.reportOnly; 00568 scaleX = r.scaleX; 00569 scaleXp = r.scaleXp; 00570 scalePtot = r.scalePtot; 00571 scaleT = r.scaleT; 00572 minPz = r.minPz; 00573 tolerance = r.tolerance; 00574 maxIter = r.maxIter; 00575 verbose = r.verbose; 00576 format = r.format; 00577 filename = r.filename; 00578 for009 = r.for009; 00579 mode = BLTRACKER_IGNORE; 00580 chisq = 0.0; 00581 ndf = 0; 00582 trueTime = 0.0; 00583 trueTrackID = -9999; 00584 trueParentID = -9999; 00585 trueDefinition = 0; 00586 reportTime = UNDEFINED; 00587 trueHits = -9999; 00588 fitHits = -9999; 00589 minHits = -1; 00590 runmgr = 0; 00591 mgr = 0; 00592 ntuple_hit = 0; 00593 ntuple_fit = 0; 00594 for009_fit = 0; 00595 chisqFailure = false; 00596 trackFields_hit = r.trackFields_hit; 00597 trackFields_fit = r.trackFields_fit; 00598 }
virtual G4String BLCMDtracker::commandName | ( | ) | [inline, virtual] |
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.
00601 { 00602 if(argv.size() != 1) { 00603 printError("tracker: Invalid command, must have name"); 00604 return -1; 00605 } 00606 00607 if(argv[0] == "default") { 00608 return handleNamedArgs(namedArgs); 00609 } 00610 00611 BLCMDtracker *t = new BLCMDtracker(defaultTracker); 00612 t->setName(argv[0]); 00613 int retval = t->handleNamedArgs(namedArgs); 00614 00615 if(t->trackerZ == UNDEFINED) 00616 printError("tracker: trackerZ must be defined"); 00617 if(t->reportZ == UNDEFINED) 00618 t->reportZ = t->trackerZ; 00619 if(t->reportZ < t->trackerZ) 00620 printError("tracker: reportZ must be >= trackerZ"); 00621 00622 // define the fit parameters 00623 t->fitParam.define("x",t->scaleX); 00624 t->fitParam.define("y",t->scaleX); 00625 t->fitParam.define("Xp",t->scaleXp); 00626 t->fitParam.define("Yp",t->scaleXp); 00627 t->fitParam.define("Ptot",t->scalePtot); 00628 t->fitParam.define("t",t->scaleT); 00629 00630 t->rotationMatrix = *BLCoordinates::getCurrentRotation(); 00631 G4ThreeVector tmp(0.0,0.0,t->trackerZ); 00632 BLCoordinates::getCurrentGlobal(tmp,t->beamPosition); 00633 00634 list.push_back(t); 00635 00636 t->print(t->name); 00637 00638 BLManager::getObject()->registerTrackingAction(t); 00639 BLManager::getObject()->registerCallback(t,0); 00640 BLManager::getObject()->registerZStep(t->trackerZ,t,6); 00641 if(t->trackerZ != t->reportZ) 00642 BLManager::getObject()->registerZStep(t->reportZ,t,6); 00643 00644 return retval; 00645 }
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.
00648 { 00649 argDouble(trackerZ,"trackerZ","The Z position of the tracker (Centerline, mm)."); 00650 argDouble(reportZ,"reportZ","The Z position at which fit tracks are reported (Centerline, mm, default=trackerZ)."); 00651 argDouble(scaleX,"scaleX","Scale for X and Y (mm); default=1mm."); 00652 argDouble(scaleXp,"scaleXp","Scale for dxdz and dydz (radians), default=0.001."); 00653 argDouble(scalePtot,"scalePtot","Scale for Ptot (MeV), default=0. Set to 0.0 if tracker cannot determine momentum.",MeV); 00654 argDouble(scaleT,"scaleT","Scale for t (ns), default=0. Set to 0.0 if tracker cannot determine time.",ns); 00655 argDouble(minPz,"minPz","Minimum Pz for valid tracks (default=10 MeV/c)",MeV); 00656 argInt(minHits,"minHits","Minimum number of hits for fitting (# planes)."); 00657 argDouble(tolerance,"tolerance","Track fitting tolerance (mm) (default=0.01 mm)"); 00658 argInt(maxIter,"maxIter","Maximum iterations during fitting (default=200)."); 00659 argInt(verbose,"verbose","0=none, 1=result, 2=iterations, 3=detail, default=0."); 00660 argString(format,"format","Format of output NTuple."); 00661 argString(filename,"filename","Filename of output NTuple."); 00662 argInt(for009,"for009","Set nonzero to also output TrackerFit as FOR009.Dat."); 00663 argString(filename,"file","Synonym for filename."); 00664 }
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] |
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().
00667 { 00668 for(unsigned i=0; i<list.size(); ++i) { 00669 if(name == list[i]->getName()) return list[i]; 00670 } 00671 return 0; 00672 }
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().
00676 { 00677 for(unsigned i=0; i<plane.size(); ++i) { 00678 if(name == plane[i]->getName()) { 00679 char tmp[256]; 00680 sprintf(tmp,"trackerplane %s has duplicate name", 00681 name.c_str()); 00682 G4Exception("tracker","Duplicate trackerplane-s", 00683 FatalException, tmp); 00684 } 00685 } 00686 00687 plane.push_back(_plane); 00688 hitWire.push_back(NO_HIT); 00689 hitTime.push_back(0.0); 00690 trackFields_hit += ":"; 00691 trackFields_hit += name + "_w:" + name + "_t"; 00692 return plane.size()-1; 00693 }
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 BLAssert, BLTRACKER_TRUE, hitTime, hitWire, mode, name, trueHits, and verbose.
Referenced by TrackerPlaneInstance::UserSteppingAction().
00696 { 00697 BLAssert(mode==BLTRACKER_TRUE); 00698 if(verbose >= 3) 00699 printf("Tracker %s Plane %d: hit wire %d time %.4f\n", 00700 name.c_str(),planeID,wire,time); 00701 BLAssert(planeID>=0 && planeID<(int)hitWire.size()); 00702 hitWire[planeID] = wire; 00703 hitTime[planeID] = time; 00704 ++trueHits; 00705 }
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 BLAssert, BLTRACKER_FIT, chisq, fitHits, hitWire, mode, name, ndf, reportOnly, and verbose.
Referenced by TrackerPlaneInstance::UserSteppingAction().
00710 { 00711 BLAssert(mode==BLTRACKER_FIT); 00712 if(verbose >= 3) 00713 printf("Tracker %s Plane %d: deltaWire %.3f deltaTime %.4f\n", 00714 name.c_str(),planeID,deltaWire,deltaTime); 00715 BLAssert(planeID>=0 && planeID<(int)hitWire.size()); 00716 if(validWire) { 00717 chisq += deltaWire*deltaWire; 00718 ++ndf; 00719 } 00720 if(validTime) { 00721 chisq += deltaTime*deltaTime; 00722 ++ndf; 00723 } 00724 00725 if(validWire || validTime) ++fitHits; 00726 00727 if(planeID == (int)hitWire.size()-1) { 00728 // kill after last plane, unless reportOnly 00729 if(verbose >= 2 && !reportOnly) 00730 printf("TrackerPlane %d: last plane, kill track\n", 00731 planeID); 00732 return reportOnly; 00733 } 00734 return true; 00735 }
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().
00793 { 00794 mode = BLTRACKER_FIT; 00795 if(verbose >= 3) 00796 printf("Tracker %s fitTrack() entered\n",name.c_str()); 00797 00798 if(!runmgr) runmgr = BLRunManager::getObject(); 00799 if(!mgr) mgr = BLManager::getObject(); 00800 00801 if(mgr->getState() != BEAM) return; 00802 if(trueHits < minHits) { 00803 if(verbose >= 3) 00804 printf("Tracker %s fitTrack FAILED trueHits=%d < %d\n", 00805 name.c_str(),trueHits,minHits); 00806 return; 00807 } 00808 00809 mgr->getPhysics()->setDoStochastics(FORCE_OFF,0); 00810 00811 G4ThreeVector trueReportPosition = reportPosition; 00812 G4ThreeVector trueReportMomentum = reportMomentum; 00813 G4double trueReportTime = reportTime; 00814 00815 BLMinimize min((verbose>=2 ? 2 : 0)); 00816 min.setFunc(*this,fitParam.scale,fitParam.getNameList()); 00817 min.setChisqMin(0.05); 00818 00819 // this code must match the parameter definitions in command() 00820 // initial values come from the true track. 00821 std::vector<double> x; 00822 x.push_back(truePosition[0]); 00823 x.push_back(truePosition[1]); 00824 x.push_back(trueMomentum[0]/trueMomentum[2]); 00825 x.push_back(trueMomentum[1]/trueMomentum[2]); 00826 x.push_back(trueMomentum.mag()); 00827 x.push_back(trueTime); 00828 00829 chisqFailure = false; 00830 00831 int status = min.minimize(x,(scaleX>0.0? tolerance/scaleX : tolerance), 00832 maxIter); 00833 00834 if(chisqFailure) 00835 status = GSL_EFAILED; 00836 00837 // try again if large chisq 00838 if(status==0 && min.value()>3.0 && min.getIterations()<maxIter/2) { 00839 if(verbose>0) printf("Tracker %s fitTrack Try Again\n", 00840 name.c_str()); 00841 status = min.minimize(x, 00842 (scaleX>0.0 ? tolerance/scaleX : tolerance),maxIter); 00843 if(chisqFailure) 00844 status = GSL_EFAILED; 00845 } 00846 00847 if(verbose > 0 && status == 0) { 00848 printf("%s fitTrack chisq=%.3f size=%.3f iter=%d\n", 00849 name.c_str(),min.value(),min.getSize(), 00850 min.getIterations()); 00851 printf(" true x,y,dxdz,dydz,Ptot,t: %7.1f %7.1f %7.4f %.4f %7.1f %9.3f\n", 00852 truePosition[0],truePosition[1], trueMomentum[0]/trueMomentum[2], 00853 trueMomentum[1]/trueMomentum[2],trueMomentum.mag(), 00854 trueTime); 00855 printf(" fit x,y,dxdz,dydz,Ptot,t: %7.1f %7.1f %7.4f %.4f %7.1f %9.3f\n", 00856 x[0],x[1],x[2],x[3],x[4],x[5]); 00857 } else if(verbose > 0) { 00858 printf("%s fitTrack FAILED\n",name.c_str()); 00859 } 00860 00861 if(status == 0 && ntuple_fit != 0) { 00862 // update the summary -- code must match param defs in command() 00863 fitParam.setDelta("x",x[0]-truePosition[0]); 00864 fitParam.setDelta("y",x[1]-truePosition[1]); 00865 fitParam.setDelta("Xp",x[2]-trueMomentum[0]/trueMomentum[2]); 00866 fitParam.setDelta("Yp",x[3]-trueMomentum[1]/trueMomentum[2]); 00867 fitParam.setDelta("Ptot",x[4]-trueMomentum.mag()); 00868 fitParam.setDelta("t",x[5]-trueTime); 00869 00870 //printf("fitTrack() is tracking the fit track\n"); 00871 //verbose=3; 00872 //mgr->setSteppingVerbose(3); 00873 // need to re-track the fitted track to z=reportZ 00874 reportOnly = true; 00875 G4Track *track = constructTrack(x); 00876 trueTrackID += 10000; 00877 BLManager::getObject()->setPrimaryTrackID(trueTrackID, 00878 trueParentID); 00879 BLRunManager::getObject()->processOneTrack(track); 00880 trueTrackID -= 10000; 00881 delete track; 00882 reportOnly = false; 00883 //mgr->setSteppingVerbose(0); 00884 //verbose=0; 00885 00886 if(reportTime != UNDEFINED) { 00887 //printf("fitTrack() reported OK\n"); 00888 // this code must agree with the field names in 00889 // trackFields_fit and FOR009_FIELDS 00890 double data[N_FIT_FIELDS]; 00891 #if N_FIT_FIELDS!=23 00892 #error N_FIT_FIELDS!=23 00893 #endif 00894 00895 data[0] = reportPosition[0]/mm; 00896 data[1] = reportPosition[1]/mm; 00897 data[2] = reportPosition[2]/mm; 00898 data[3] = reportMomentum[0]/MeV; 00899 data[4] = reportMomentum[1]/MeV; 00900 data[5] = reportMomentum[2]/MeV; 00901 data[6] = reportTime/ns; 00902 data[7] = trueDefinition->GetPDGEncoding(); 00903 data[8] = runmgr->GetCurrentEvent()->GetEventID(); 00904 data[9] = trueTrackID+10000; 00905 data[10] = trueParentID; 00906 data[11] = 1.0; 00907 data[12] = min.value(); 00908 data[13] = ndf; 00909 data[14] = fitHits; 00910 data[15] = min.getIterations(); 00911 data[16] = trueReportPosition[0]/mm; 00912 data[17] = trueReportPosition[1]/mm; 00913 data[18] = trueReportPosition[2]/mm; 00914 data[19] = trueReportMomentum[0]/MeV; 00915 data[20] = trueReportMomentum[1]/MeV; 00916 data[21] = trueReportMomentum[2]/MeV; 00917 data[22] = trueReportTime/ns; 00918 ntuple_fit->appendRow(data,N_FIT_FIELDS); 00919 if(for009_fit != 0) { 00920 #if N_FOR009_FIELDS!=18 00921 #error N_FOR009_FIELDS!=18 00922 #endif 00923 G4double point[4], field[6]; 00924 point[0] = reportPosition[0]; 00925 point[1] = reportPosition[1]; 00926 point[2] = reportPosition[2]; 00927 point[3] = reportTime; 00928 BLGlobalField::getObject()->GetFieldValue(point, 00929 field); 00930 data[12] = field[0]/tesla; // Bx 00931 data[13] = field[1]/tesla; // By 00932 data[14] = field[2]/tesla; // Bz 00933 data[15] = field[3]/(megavolt/meter); // Ex 00934 data[16] = field[4]/(megavolt/meter); // Ey 00935 data[17] = field[5]/(megavolt/meter); // Ez 00936 for009_fit->appendRow(data,N_FOR009_FIELDS); 00937 } 00938 } else { 00939 //printf("fitTrack() -- track has reportTime==UNDEFINED\n"); 00940 } 00941 } 00942 00943 mgr->getPhysics()->setDoStochastics(NORMAL,0); 00944 00945 mode = BLTRACKER_IGNORE; 00946 trueHits = -9999; 00947 00948 if(verbose >= 3) 00949 printf("%s fitTrack() returns; status=%d\n",name.c_str(),status); 00950 }
void BLCMDtracker::setMode | ( | BLTrackerMode | _mode | ) | [inline] |
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.
00953 { 00954 // get Centerline position and momentum 00955 BLCoordinates *coord = (BLCoordinates *)track->GetUserInformation(); 00956 if(coord && !coord->isValid()) coord = 0; 00957 G4ThreeVector pos; 00958 G4ThreeVector momentum = track->GetMomentum(); 00959 if(coord) { 00960 coord->getCoords(BLCOORD_CENTERLINE,pos); 00961 momentum = coord->getRotation() * momentum; 00962 } 00963 00964 if(BLManager::getObject()->getState() == REFERENCE) { 00965 if(fabs(pos[2]-trackerZ) > 0.010*mm && 00966 fabs(pos[2]-reportZ) > 0.010*mm) { 00967 if(verbose >= 3) printf("tracker %s ZStep ignored\n", 00968 name.c_str()); 00969 return; 00970 } 00971 } else if(reportOnly) { 00972 if(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 if(mode == BLTRACKER_TRUE) { 00978 if(fabs(pos[2]-trackerZ) > 0.010*mm && 00979 fabs(pos[2]-reportZ) > 0.010*mm) { 00980 if(verbose >= 3) printf("tracker %s ZStep ignored\n", 00981 name.c_str()); 00982 return; 00983 } 00984 } else { 00985 if(verbose >= 3) printf("tracker %s ZStep ignored\n", 00986 name.c_str()); 00987 return; 00988 } 00989 00990 // here if Reference particle at either trackerZ or reportZ, 00991 // reportOnly at reportZ, or true particle at either trackerZ or reportZ 00992 00993 if(momentum[2] < minPz) { 00994 if(verbose >= 3) 00995 printf("tracker %s setTrueTrack() -- Pz < %.3f\n", 00996 name.c_str(),minPz); 00997 return; 00998 } 00999 01000 if(fabs(pos[2]-trackerZ) < 0.010*mm) { 01001 if(verbose >= 3) 01002 printf("tracker %s setTrueTrack() z=%.3f minHits=%d\n", 01003 name.c_str(),pos[2],minHits); 01004 truePosition = pos; 01005 trueMomentum = momentum; 01006 trueTime = track->GetGlobalTime(); 01007 trueTrackID = BLManager::getObject()->getExternalTrackID(track); 01008 trueParentID = BLManager::getObject()->getExternalParentID(track); 01009 trueDefinition = track->GetDefinition(); 01010 trueHits = 0; 01011 } 01012 if(fabs(pos[2]-reportZ) < 0.010*mm) { 01013 if(trueTrackID != BLManager::getObject()->getExternalTrackID(track) || 01014 trueParentID != BLManager::getObject()->getExternalParentID(track) || 01015 trueDefinition != track->GetDefinition()) { 01016 if(verbose >= 3) 01017 printf("tracker %s ZStep wrong track: " 01018 "%d,%d %d,%d %08lX,%08lX\n", 01019 name.c_str(),trueTrackID,track->GetTrackID(), 01020 trueParentID,track->GetParentID(), 01021 (long)trueDefinition,(long)track->GetDefinition()); 01022 return; 01023 } 01024 if(verbose >= 3) 01025 printf("tracker %s setReportTrack() z=%.3f\n", 01026 name.c_str(),pos[2]); 01027 reportPosition = pos; 01028 reportMomentum = momentum; 01029 reportTime = track->GetGlobalTime(); 01030 if(reportOnly) { 01031 if(verbose >= 3) 01032 printf("tracker %s reportOnly killing track\n", 01033 name.c_str()); 01034 ((G4Track *)track)->SetTrackStatus(fStopAndKill); 01035 } 01036 } 01037 01038 if(BLManager::getObject()->getState() != REFERENCE) return; 01039 if(for009_fit == 0 || reportTime == UNDEFINED) return; 01040 01041 // here to append the reference to for009_fit 01042 01043 // this code must agree with the field names in for009Track_fit 01044 G4double point[4], field[6]; 01045 point[0] = reportPosition[0]; 01046 point[1] = reportPosition[1]; 01047 point[2] = reportPosition[2]; 01048 point[3] = reportTime; 01049 BLGlobalField::getObject()->GetFieldValue(point,field); 01050 double data[18]; 01051 data[0] = reportPosition[0]/mm; 01052 data[1] = reportPosition[1]/mm; 01053 data[2] = reportPosition[2]/mm; 01054 data[3] = reportMomentum[0]/MeV; 01055 data[4] = reportMomentum[1]/MeV; 01056 data[5] = reportMomentum[2]/MeV; 01057 data[6] = reportTime/ns; 01058 data[7] = track->GetDefinition()->GetPDGEncoding(); 01059 data[8] = -1; // EventID 01060 data[9] = 1; // TrackID 01061 data[10] = 0; // ParentID 01062 data[11] = 1.0; // Weight 01063 data[12] = field[0]/tesla; // Bx 01064 data[13] = field[1]/tesla; // By 01065 data[14] = field[2]/tesla; // Bz 01066 data[15] = field[3]/(megavolt/meter); // Ex 01067 data[16] = field[4]/(megavolt/meter); // Ey 01068 data[17] = field[5]/(megavolt/meter); // Ez 01069 for009_fit->appendRow(data,18); 01070 }
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, BLRunManager::getObject(), BLManager::getObject(), BLManager::getState(), hitTime, hitWire, mode, ndf, NO_HIT, plane, reportTime, trueHits, and UNDEFINED.
01073 { 01074 BLManagerState state = BLManager::getObject()->getState(); 01075 if(state != BEAM) return; 01076 01077 if(BLRunManager::getObject()->getCollectiveMode()) 01078 G4Exception("tracker command","Collective mode error", 01079 FatalException, 01080 "Does not work in collective tracking mode"); 01081 01082 for(unsigned i=0; i<plane.size(); ++i) { 01083 switch(mode) { 01084 case BLTRACKER_TRUE: 01085 plane[i]->setTrueMode(); 01086 hitWire[i] = NO_HIT; 01087 hitTime[i] = 0.0; 01088 break; 01089 case BLTRACKER_FIT: 01090 plane[i]->setFitMode(hitWire[i],hitTime[i]); 01091 break; 01092 case BLTRACKER_IGNORE: 01093 plane[i]->setIgnoreMode(); 01094 break; 01095 } 01096 } 01097 01098 // reportTime is used as a flag to indicate that the report variables 01099 // are set for this track 01100 reportTime = UNDEFINED; 01101 01102 switch(mode) { 01103 case BLTRACKER_TRUE: 01104 trueHits = 0; 01105 break; 01106 case BLTRACKER_FIT: 01107 fitHits = 0; 01108 chisq = 0.0; 01109 ndf = 0; 01110 break; 01111 case BLTRACKER_IGNORE: 01112 break; 01113 } 01114 }
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.
01117 { 01118 BLManagerState state = BLManager::getObject()->getState(); 01119 if(state != BEAM) return; 01120 01121 if(mode == BLTRACKER_TRUE && reportTime != UNDEFINED && 01122 ntuple_hit != 0 && trueHits >= minHits) { 01123 if(!runmgr) runmgr = BLRunManager::getObject(); 01124 static double *data=0; 01125 static unsigned ndata=0; 01126 if(ndata < N_HIT_FIELDS+2*hitWire.size()) { 01127 if(data) free(data); 01128 ndata = N_HIT_FIELDS+2*hitWire.size(); 01129 data = new double[ndata]; 01130 } 01131 // this code must agree with the field names in trackFields_hit 01132 data[0] = truePosition[0]/mm; 01133 data[1] = truePosition[1]/mm; 01134 data[2] = truePosition[2]/mm; 01135 data[3] = trueMomentum[0]/MeV; 01136 data[4] = trueMomentum[1]/MeV; 01137 data[5] = trueMomentum[2]/MeV; 01138 data[6] = trueTime/ns; 01139 data[7] = trueDefinition->GetPDGEncoding(); 01140 data[8] = runmgr->GetCurrentEvent()->GetEventID(); 01141 data[9] = trueTrackID; 01142 data[10] = trueParentID; 01143 data[11] = 1.0; 01144 data[12] = reportPosition[0]/mm; 01145 data[13] = reportPosition[1]/mm; 01146 data[14] = reportPosition[2]/mm; 01147 data[15] = reportMomentum[0]/MeV; 01148 data[16] = reportMomentum[1]/MeV; 01149 data[17] = reportMomentum[2]/MeV; 01150 data[18] = reportTime/ns; 01151 int j=N_HIT_FIELDS; 01152 for(unsigned i=0; i<hitWire.size(); ++i) { 01153 data[j++] = hitWire[i]; 01154 data[j++] = hitTime[i]; 01155 } 01156 ntuple_hit->appendRow(data,N_HIT_FIELDS+2*hitWire.size()); 01157 } 01158 01159 if(mode == BLTRACKER_FIT) { 01160 // update ndf for fitted parameters 01161 for(unsigned i=0; i<fitParam.scale.size(); ++i) { 01162 if(fitParam.scale[i] > 0.0) 01163 --ndf; 01164 } 01165 if(ndf < 0) ndf = 0; 01166 } 01167 01168 for(unsigned i=0; i<plane.size(); ++i) { 01169 plane[i]->setIgnoreMode(); 01170 } 01171 }
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.
01174 { 01175 // had to wait until all trackerplane-s are registered 01176 // and mode is known 01177 G4String m = trackermodeInstance.getMode(); 01178 if(m == "true" || m == "both") { 01179 ntuple_hit = BLNTuple::create(format,"TrackerHits",name, 01180 trackFields_hit,filename); 01181 } else if(m == "fit" || m == "both") { 01182 ntuple_fit = BLNTuple::create(format,"TrackerFit",name, 01183 trackFields_fit,filename); 01184 if(for009) for009_fit = BLNTuple::create("for009","TrackerFit",name, 01185 FOR009_FIELDS,filename); 01186 } else { 01187 G4Exception("tracker","Invalid mode",FatalException,m.c_str()); 01188 } 01189 01190 if(minHits < 0) minHits = hitWire.size(); 01191 }
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()().
00738 { 00739 G4ThreeVector pos(x[0],x[1],0.0); 00740 G4double dxdz = x[2]; 00741 G4double dydz = x[3]; 00742 G4double Ptot = x[4]; 00743 G4double time = x[5]; 00744 G4double mass = trueDefinition->GetPDGMass(); 00745 G4double ke = sqrt(Ptot*Ptot+mass*mass) - mass; 00746 G4double norm = sqrt(1.0+dxdz*dxdz+dydz*dydz); 00747 G4ThreeVector dir(dxdz/norm,dydz/norm,1.0/norm); 00748 00749 // convert to centerline coordinates 00750 dir = rotationMatrix * dir; 00751 pos = rotationMatrix * pos + beamPosition; 00752 00753 G4DynamicParticle *particle = 00754 new G4DynamicParticle(trueDefinition,dir,ke); 00755 G4Track *track = new G4Track(particle,time,pos); 00756 track->SetTrackID(trueTrackID+10000); 00757 track->SetParentID(trueParentID); 00758 track->SetGlobalTime(time); 00759 00760 return track; 00761 }
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.
00764 { 00765 if(chisqFailure) return 0.0; // short-circuit iterations in BLMinimize 00766 00767 mode = BLTRACKER_FIT; 00768 00769 G4Track *track = constructTrack(x); 00770 00771 BLManager::getObject()->setPrimaryTrackID(trueTrackID+10000, 00772 trueParentID); 00773 BLRunManager::getObject()->processOneTrack(track); 00774 00775 delete track; 00776 00777 if(verbose >= 3) 00778 printf("%s tracking chisq=%.4f ndf=%d fitHits=%d trueHits=%d\n", 00779 name.c_str(),chisq,ndf,fitHits,trueHits); 00780 00781 if(fitHits < minHits || fitHits < trueHits) { 00782 chisqFailure = true; 00783 if(verbose >= 3) 00784 printf("%s too few hits -- minimization short-circuited\n", 00785 name.c_str()); 00786 return 0.0; // will short-circuit iteration in BLMinimize 00787 } 00788 00789 return (ndf>0 ? chisq/ndf : chisq); 00790 }
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.
01194 { 01195 printf("==================== Begin Fitting Tracker %s ======================\n",name.c_str()); 01196 01197 BLNTuple *in = BLNTuple::read(format, "TrackerHits", name, 01198 trackFields_hit, file); 01199 if(!in) { 01200 printError("tracker::handlePreviousTracks cannot open NTuple"); 01201 return; 01202 } 01203 if(in->getNData() != N_HIT_FIELDS+2*(int)hitWire.size()) { 01204 in->close(); 01205 printError("tracker::handlePreviousTracks NTuple wrong # fields"); 01206 return; 01207 } 01208 01209 if(!runmgr) runmgr = BLRunManager::getObject(); 01210 if(!mgr) mgr = BLManager::getObject(); 01211 runmgr->beginRun(); 01212 mgr->setState(BEAM); 01213 01214 // this code must agree with the field names in trackFields_hit 01215 static double *data=0; 01216 static unsigned ndata=0; 01217 if(ndata < N_HIT_FIELDS+2*hitWire.size()) { 01218 if(data) free(data); 01219 ndata = N_HIT_FIELDS+2*hitWire.size(); 01220 data = new double[ndata]; 01221 } 01222 while(in->readRow(data,ndata)) { 01223 int eventID = (int)data[8]; 01224 if(eventID < 0) continue; // skip fitting reference particle 01225 truePosition[0] = data[0]*mm; 01226 truePosition[1] = data[1]*mm; 01227 truePosition[2] = data[2]*mm; 01228 trueMomentum[0] = data[3]*MeV; 01229 trueMomentum[1] = data[4]*MeV; 01230 trueMomentum[2] = data[5]*MeV; 01231 trueTime = data[6]*ns; 01232 trueDefinition = G4ParticleTable::GetParticleTable()->FindParticle((int)data[7]); 01233 trueTrackID = (int)data[9]; 01234 trueParentID = (int)data[10]; 01235 reportPosition[0] = data[12]*mm; 01236 reportPosition[1] = data[13]*mm; 01237 reportPosition[2] = data[14]*mm; 01238 reportMomentum[0] = data[15]*MeV; 01239 reportMomentum[1] = data[16]*MeV; 01240 reportMomentum[2] = data[17]*MeV; 01241 reportTime = data[18]*ns; 01242 trueHits = 0; 01243 int j=N_HIT_FIELDS; 01244 for(unsigned i=0; i<hitWire.size(); ++i) { 01245 hitWire[i] = (int)data[j++]; 01246 hitTime[i] = data[j++]; 01247 if(hitWire[i] != NO_HIT) ++trueHits; 01248 } 01249 if(trueHits < minHits) continue; 01250 mgr->setEventID(eventID); 01251 runmgr->beginEvent(eventID); 01252 fitTrack(); 01253 runmgr->endEvent(); 01254 } 01255 01256 runmgr->endRun(); 01257 in->close(); 01258 01259 fitParam.printSummary(); 01260 }
friend class TrackerPlaneInstance [friend] |
FitParam BLCMDtracker::fitParam [private] |
Referenced by command(), fitTrack(), handlePreviousTracks(), and PostUserTrackingAction().
G4String BLCMDtracker::name [private] |
Referenced by BLCMDtracker(), callback(), command(), delta(), fitTrack(), getName(), handlePreviousTracks(), operator()(), planeHit(), setName(), and UserZSteppingAction().
G4double BLCMDtracker::trackerZ [private] |
Referenced by BLCMDtracker(), command(), defineNamedArgs(), and UserZSteppingAction().
G4double BLCMDtracker::reportZ [private] |
Referenced by BLCMDtracker(), command(), defineNamedArgs(), and UserZSteppingAction().
bool BLCMDtracker::reportOnly [private] |
Referenced by BLCMDtracker(), delta(), fitTrack(), and UserZSteppingAction().
G4double BLCMDtracker::scaleX [private] |
Referenced by BLCMDtracker(), command(), defineNamedArgs(), and fitTrack().
G4double BLCMDtracker::scaleXp [private] |
Referenced by BLCMDtracker(), command(), and defineNamedArgs().
G4double BLCMDtracker::scalePtot [private] |
Referenced by BLCMDtracker(), command(), and defineNamedArgs().
G4double BLCMDtracker::scaleT [private] |
Referenced by BLCMDtracker(), command(), and defineNamedArgs().
G4double BLCMDtracker::minPz [private] |
Referenced by BLCMDtracker(), defineNamedArgs(), and UserZSteppingAction().
G4double BLCMDtracker::tolerance [private] |
Referenced by BLCMDtracker(), defineNamedArgs(), and fitTrack().
G4int BLCMDtracker::maxIter [private] |
Referenced by BLCMDtracker(), defineNamedArgs(), and fitTrack().
G4int BLCMDtracker::verbose [private] |
G4String BLCMDtracker::format [private] |
Referenced by BLCMDtracker(), callback(), defineNamedArgs(), and handlePreviousTracks().
G4String BLCMDtracker::filename [private] |
Referenced by BLCMDtracker(), callback(), and defineNamedArgs().
G4int BLCMDtracker::for009 [private] |
Referenced by BLCMDtracker(), callback(), and defineNamedArgs().
BLTrackerMode BLCMDtracker::mode [private] |
Referenced by BLCMDtracker(), delta(), fitTrack(), operator()(), planeHit(), PostUserTrackingAction(), PreUserTrackingAction(), setMode(), and UserZSteppingAction().
std::vector<TrackerPlaneInstance*> BLCMDtracker::plane [private] |
Referenced by PostUserTrackingAction(), PreUserTrackingAction(), and registerTrackerPlane().
std::vector<int> BLCMDtracker::hitWire [private] |
Referenced by callback(), delta(), handlePreviousTracks(), planeHit(), PostUserTrackingAction(), PreUserTrackingAction(), and registerTrackerPlane().
std::vector<double> BLCMDtracker::hitTime [private] |
Referenced by handlePreviousTracks(), planeHit(), PostUserTrackingAction(), PreUserTrackingAction(), and registerTrackerPlane().
double BLCMDtracker::chisq [private] |
Referenced by BLCMDtracker(), delta(), operator()(), and PreUserTrackingAction().
int BLCMDtracker::ndf [private] |
Referenced by BLCMDtracker(), delta(), fitTrack(), operator()(), PostUserTrackingAction(), and PreUserTrackingAction().
G4ThreeVector BLCMDtracker::truePosition [private] |
Referenced by fitTrack(), handlePreviousTracks(), PostUserTrackingAction(), and UserZSteppingAction().
G4ThreeVector BLCMDtracker::trueMomentum [private] |
Referenced by fitTrack(), handlePreviousTracks(), PostUserTrackingAction(), and UserZSteppingAction().
G4double BLCMDtracker::trueTime [private] |
Referenced by BLCMDtracker(), fitTrack(), handlePreviousTracks(), PostUserTrackingAction(), and UserZSteppingAction().
G4int BLCMDtracker::trueTrackID [private] |
Referenced by BLCMDtracker(), constructTrack(), fitTrack(), handlePreviousTracks(), operator()(), PostUserTrackingAction(), and UserZSteppingAction().
G4int BLCMDtracker::trueParentID [private] |
Referenced by BLCMDtracker(), constructTrack(), fitTrack(), handlePreviousTracks(), operator()(), PostUserTrackingAction(), and UserZSteppingAction().
G4ParticleDefinition* BLCMDtracker::trueDefinition [private] |
Referenced by BLCMDtracker(), constructTrack(), fitTrack(), handlePreviousTracks(), PostUserTrackingAction(), and UserZSteppingAction().
G4ThreeVector BLCMDtracker::reportPosition [private] |
Referenced by fitTrack(), handlePreviousTracks(), PostUserTrackingAction(), and UserZSteppingAction().
G4ThreeVector BLCMDtracker::reportMomentum [private] |
Referenced by fitTrack(), handlePreviousTracks(), PostUserTrackingAction(), and UserZSteppingAction().
G4double BLCMDtracker::reportTime [private] |
Referenced by BLCMDtracker(), fitTrack(), handlePreviousTracks(), PostUserTrackingAction(), PreUserTrackingAction(), and UserZSteppingAction().
G4int BLCMDtracker::trueHits [private] |
G4int BLCMDtracker::fitHits [private] |
Referenced by BLCMDtracker(), delta(), fitTrack(), operator()(), and PreUserTrackingAction().
int BLCMDtracker::minHits [private] |
Referenced by BLCMDtracker(), callback(), defineNamedArgs(), fitTrack(), handlePreviousTracks(), operator()(), PostUserTrackingAction(), and UserZSteppingAction().
G4RotationMatrix BLCMDtracker::rotationMatrix [private] |
Referenced by command(), and constructTrack().
G4ThreeVector BLCMDtracker::beamPosition [private] |
Referenced by command(), and constructTrack().
BLRunManager* BLCMDtracker::runmgr [private] |
Referenced by BLCMDtracker(), fitTrack(), handlePreviousTracks(), and PostUserTrackingAction().
BLManager* BLCMDtracker::mgr [private] |
Referenced by BLCMDtracker(), fitTrack(), and handlePreviousTracks().
BLNTuple* BLCMDtracker::ntuple_hit [private] |
Referenced by BLCMDtracker(), callback(), and PostUserTrackingAction().
BLNTuple* BLCMDtracker::ntuple_fit [private] |
Referenced by BLCMDtracker(), callback(), and fitTrack().
BLNTuple* BLCMDtracker::for009_fit [private] |
Referenced by BLCMDtracker(), callback(), fitTrack(), and UserZSteppingAction().
G4bool BLCMDtracker::chisqFailure [private] |
Referenced by BLCMDtracker(), fitTrack(), and operator()().
G4String BLCMDtracker::trackFields_hit [private] |
Referenced by BLCMDtracker(), callback(), handlePreviousTracks(), and registerTrackerPlane().
G4String BLCMDtracker::trackFields_fit [private] |
Referenced by BLCMDtracker(), and callback().
std::vector< BLCMDtracker * > BLCMDtracker::list [static] |