Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

AlgFitTrackSA Class Reference

#include <AlgFitTrackSA.h>

Inheritance diagram for AlgFitTrackSA:

AlgBase List of all members.

Public Member Functions

 AlgFitTrackSA ()
 ~AlgFitTrackSA ()
virtual void RunAlg (AlgConfig &ac, CandHandle &ch, CandContext &cx)

Private Member Functions

NtpFitSA DoFit (const AlgConfig &ac, const TrackContext &trackContext)

Private Attributes

TrackFilterfFilter
TrackSegmentMakerfSegmentMaker
TrackEstimatorfEstimator
SwimSwimmerfSwimmer

Detailed Description

AlgFitTrackSA - iterative least squares track fitter. This package provides an iterative least squares track fitter (as described in NuMI-301 note). It works on candidate tracks produced by a track finding (or track fitting) package.

This fitter can be added to the job path by inserting "FitTrackSAListModule::Reco" job module.

Fit results are not saved in the standard ntuple, but can be saved in a NtpFitSA by adding the following job path (or adding to an existing path):

Ntuple record has its own output file so needs its own output module j.Path.Create("Ntp", "NtpFitSAModule::Reco " // create NtpStRecord "Output::Put ");

j.Path("Ntp").Mod("Output").Cmd("DefineStream NtpFitSA NtpFitSARecord"); j.Path("Ntp").Mod("Output").Set("Streams=NtpFitSA"); j.Path("Ntp").Mod("Output").Set("FileName=ntpSA.root");

Author:
Sergei avva@fnal.gov

Definition at line 41 of file AlgFitTrackSA.h.


Constructor & Destructor Documentation

AlgFitTrackSA::AlgFitTrackSA  ) 
 

Definition at line 60 of file AlgFitTrackSA.cxx.

00060                              :
00061     fFilter(0), fSegmentMaker(0), 
00062     fEstimator(0), fSwimmer(0)
00063 {
00064     TracerSA trace("AlgFitTrackSA::AlgFitTrackSA()");
00065 }

AlgFitTrackSA::~AlgFitTrackSA  ) 
 

Definition at line 68 of file AlgFitTrackSA.cxx.

References fEstimator, fSegmentMaker, and fSwimmer.

00069 {
00070     TracerSA trace("AlgFitTrackSA::~AlgFitTrackSA()");        
00071     delete fSegmentMaker; fSegmentMaker = 0;
00072     delete fEstimator; fEstimator = 0;
00073     delete fSwimmer; fSwimmer = 0;
00074 }


Member Function Documentation

NtpFitSA AlgFitTrackSA::DoFit const AlgConfig ac,
const TrackContext trackContext
[private]
 

main fitting method

Definition at line 140 of file AlgFitTrackSA.cxx.

References fEstimator, FitContext::fState, fSwimmer, FitStateFactory::GetFitState(), FitStateFactory::Instance(), FitContext::Iterate(), FitContext::MakeNtpFitSA(), FitContext::SetCpu(), and timer().

Referenced by RunAlg().

00141 {
00142     TracerSA trace("AlgFitTrackSA::DoFit(const TrackContext& )");
00143         
00144     FitContext fit(ac, trackContext, fEstimator, fSwimmer);
00145 
00146     FitStateFactory& fitStateFactory = FitStateFactory::Instance();
00147     
00148     // Start timer
00149     TStopwatch timer;
00150     timer.Start();
00151     
00152     // main loop -> iterate until fit goes into "Final" state
00153     while ( fit.fState != fitStateFactory.GetFitState("Final") ) {
00154         fit.Iterate();
00155     }
00156     
00157     fit.Iterate();    
00158     
00159     // stop timer and save cputime
00160     timer.Stop();
00161     fit.SetCpu(timer.CpuTime());
00162     
00163     return fit.MakeNtpFitSA();
00164 }

void AlgFitTrackSA::RunAlg AlgConfig ac,
CandHandle ch,
CandContext candTrackContext
[virtual]
 

The "main" method of the algorithm (also the only public method)

Implements AlgBase.

Definition at line 79 of file AlgFitTrackSA.cxx.

References CandFitTrackSAHandle::AddNtpFitSA(), TrackEstimator::Config(), TrackSegmentMaker::Config(), TrackFilter::Config(), DoFit(), fEstimator, fFilter, fSegmentMaker, fSwimmer, Registry::GetCharString(), TrackFilterFactory::GetTrackFilter(), TrackContext::GetVldContext(), TrackFilterFactory::Instance(), TrackSegmentMaker::MakeSegments(), MSG, and TrackFilter::Pass().

00081 {
00082     TracerSA trace("AlgFitTrackSA::RunAlg(AlgConfig& , CandHandle& , CandContext& )");
00083 
00084     CandFitTrackSAHandle& cftsah = (CandFitTrackSAHandle&) ch;
00085     TrackContext trackContext(candTrackContext);
00086 
00087     // todo on first call
00088     static Bool_t first = kTRUE;
00089     if ( first ) {
00090         first = kFALSE;
00091         // create filter, segment maker, estimator and swimmer
00092         // and configure them
00093         
00094         // TrackFilter 
00095         const char* filterName = ac.GetCharString("TrackFilter");
00096         fFilter = TrackFilterFactory::Instance().GetTrackFilter(filterName);
00097         fFilter->Config(ac); 
00098         
00099         // Segment Maker
00100         fSegmentMaker = new TrackSegmentMakerDummy();
00101         fSegmentMaker->Config(ac); 
00102         
00103         // TrackExtimator        
00104         fEstimator = new TrackEstimatorFixed();
00105         fEstimator->Config(ac);
00106         
00107         // Swimmer
00108         fSwimmer = new SwimSwimmer(trackContext.GetVldContext());
00109     }
00110             
00111     // check if the track passes filter (return otherwise)
00112     // (don't really have to configure fiter every time)
00113     if ( ! fFilter->Pass(trackContext) ) {
00114         MSG("FitTrackSA",Msg::kVerbose) 
00115            << "Track failed cuts, skipping." << "\n";
00116         return;
00117     }
00118     
00119     // split track into segments
00120     vector<TrackContext> segments;
00121     Int_t status = fSegmentMaker->MakeSegments(trackContext, segments);
00122     assert( status == 0 && "Couldn't make segments!" );
00123     
00124     // loop over track segments and fit each one
00125     typedef vector<TrackContext>::const_iterator TCItr;
00126     for ( TCItr it = segments.begin(); it != segments.end(); ++it) {
00127         NtpFitSA ntp = DoFit(ac, *it);
00128         // Add ntuple to CandFitTrackSA 
00129         cftsah.AddNtpFitSA(ntp);
00130     }
00131  
00132     // that's all
00133     return;   
00134 }


Member Data Documentation

TrackEstimator* AlgFitTrackSA::fEstimator [private]
 

Initial estimation of the track parameters

Definition at line 70 of file AlgFitTrackSA.h.

Referenced by DoFit(), RunAlg(), and ~AlgFitTrackSA().

TrackFilter* AlgFitTrackSA::fFilter [private]
 

Determine if want to use this track for fitting

Definition at line 60 of file AlgFitTrackSA.h.

Referenced by RunAlg().

TrackSegmentMaker* AlgFitTrackSA::fSegmentMaker [private]
 

(Optionally) split track into segments

Definition at line 65 of file AlgFitTrackSA.h.

Referenced by RunAlg(), and ~AlgFitTrackSA().

SwimSwimmer* AlgFitTrackSA::fSwimmer [private]
 

Particle swimmer

Definition at line 75 of file AlgFitTrackSA.h.

Referenced by DoFit(), RunAlg(), and ~AlgFitTrackSA().


The documentation for this class was generated from the following files:
Generated on Sat Nov 21 22:49:18 2009 for loon by  doxygen 1.3.9.1