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

FitStateInitial.cxx

Go to the documentation of this file.
00001 //_____________________________________________________________________________
00009 
00010 #include <string>
00011 
00012 #include "MessageService/MsgService.h"
00013 
00014 #include "CandFitTrackSA/ConstFT.h"
00015 #include "CandFitTrackSA/FitContext.h"
00016 #include "CandFitTrackSA/FitStateFactory.h"
00017 #include "CandFitTrackSA/FitStateInitial.h"
00018 #include "CandFitTrackSA/TrackEstimator.h"
00019 
00020 CVSID("$Id: FitStateInitial.cxx,v 1.2 2006/02/04 21:47:35 avva Exp $");
00021 
00022 using namespace ConstFT;
00023 
00024 // The ID of class Line
00025 static const std::string INITIAL_FIT_STATE = "Initial";
00026 
00027 // Create an anonymous namespace
00028 // to make the function invisible from other modules
00029 namespace {
00030 
00031 FitState* CreateInitialFS() { return new FitStateInitial; }
00032 
00033 // register block
00034 bool registered = FitStateFactory::Instance().RegisterFitState(
00035                                         INITIAL_FIT_STATE, CreateInitialFS);
00036 }  // namespace
00037 
00038 
00042 const std::string& FitStateInitial::Name() const
00043 {
00044     return INITIAL_FIT_STATE;
00045 }    
00046 
00047 
00048 void FitStateInitial::Iterate(FitContext& context) const
00049 {
00050     // apply the maximum mask that still leaves 
00051     // enough hits ( > fNHitsInViewMin ) to fit in
00052     // both U and V
00053     context.fData.SetUHitUse( context.fConvergenceMaster.GetMaskUCur() );
00054     context.fData.SetVHitUse( context.fConvergenceMaster.GetMaskVCur() );
00055 
00056     // get an inital rough estimate of the track parameters
00057     context.fCurrentFit = context.fEstimator->EstimateTrackParams(context);
00058 
00059     //
00060     context.SetLastGoodFitParams(context.fCurrentFit);
00061     
00062     // set initial number of planes to fit
00063     // context.fNPlanesToFit = context.fConvergenceMaster.GetNPlanesCur();
00064     
00065     // set input track parameters     
00066     context.fNPlanesFit = context.fData.SetInitial(context.fCurrentFit, 
00067                 context.fConvergenceMaster.GetNPlanesCur(), *context.fSwimmer);
00068                                     //context.fNPlanesToFit, *context.fSwimmer);
00069                                         
00070     // bad failure - stop iterations
00071     if ( context.fNPlanesFit < context.fConvergenceMaster.GetNPlanesMin() ){
00072         context.SetState(FitStateFactory::Instance().GetFitState("Final"));
00073         context.Print();
00074         MSG("FitTrackSA",Msg::kInfo) << "Switched from Initial to Final\n";
00075         return;        
00076     }
00077         
00078     // perform iteration
00079     context.fMatCalc.Solve(context.fData);
00080     context.fCurrentFit = context.fMatCalc.GetTrackOut();
00081     
00082     //context.SetLastGoodFitParams(context.fCurrentFit);
00083     //context.fLastGoodFit.SetNPlanes(context.fNPlanesFit);
00084     
00085     context.SetState(FitStateFactory::Instance().GetFitState("Iterating"));
00086     context.Print();
00087     MSG("FitTrackSA",Msg::kInfo) << "Switched from Initial to Iterating\n";
00088     return;
00089 
00090 }
00091 

Generated on Mon Feb 15 11:06:43 2010 for loon by  doxygen 1.3.9.1