Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

TrackEventFitter Class Reference

#include <TrackEventFitter.h>

List of all members.

Public Member Functions

 TrackEventFitter (const std::string &name, ISvcLocator *pSvcLocator)
 Standard constructor.
virtual ~TrackEventFitter ()
 Destructor.
virtual StatusCode initialize ()
 Algorithm initialization.
virtual StatusCode execute ()
 Algorithm execution.
virtual StatusCode finalize ()
 Algorithm finalization.

Private Member Functions

StateseedState (Track &track)
StatusCode registerTracks (Tracks *tracksCont)
 Register the tracks in the Transient event store.

Private Attributes

ITrackFitterm_tracksFitter
 interface to tracks fitter tool
IMeasurementProviderm_measProvider
 measurement provider tool
std::string m_tracksInContainer
 Tracks input container path in TES.
std::string m_tracksOutContainer
 Tracks output container path in TES.
std::string m_fitterName
 The fitter tool name.
bool m_fitUpstream
 Perform the fit upstream/downstream?


Detailed Description

Author:
Eduardo Rodrigues
Date:
2005-05-30

Definition at line 20 of file TrackEventFitter.h.


Constructor & Destructor Documentation

TrackEventFitter::TrackEventFitter const std::string &  name,
ISvcLocator *  pSvcLocator
 

Standard constructor.

Definition at line 31 of file TrackEventFitter.cpp.

References m_fitterName, m_fitUpstream, m_tracksInContainer, and m_tracksOutContainer.

00033   : GaudiAlgorithm ( name , pSvcLocator )
00034   , m_tracksFitter(0)
00035   , m_measProvider(0)
00036 {
00037   declareProperty( "TracksInContainer", 
00038                    m_tracksInContainer = TrackLocation::Default );
00039   declareProperty( "TracksOutContainer", 
00040                    m_tracksOutContainer = "Rec/Track/FitIdeal" );
00041   declareProperty( "FitterName"      , m_fitterName = "KalmanFilter" );
00042   declareProperty( "FitUpstream"     , m_fitUpstream   = false );
00043 }

TrackEventFitter::~TrackEventFitter  )  [virtual]
 

Destructor.

Definition at line 48 of file TrackEventFitter.cpp.

00048 {}; 


Member Function Documentation

StatusCode TrackEventFitter::execute  )  [virtual]
 

Algorithm execution.

Definition at line 88 of file TrackEventFitter.cpp.

References Track::checkFlag(), m_fitUpstream, m_measProvider, m_tracksFitter, m_tracksInContainer, Track::nStates(), registerTracks(), seedState(), Track::setFlag(), and Track::setStatus().

00088                                      {
00089 
00090   debug() << "==> Execute" << endmsg;
00091 
00092   StatusCode sc = StatusCode::SUCCESS;
00093 
00094   debug() << "-> getting input Tracks container ..." << endmsg;
00095   // Retrieve the Tracks container
00096   // -----------------------------
00097   Tracks* tracksCont = get<Tracks>( m_tracksInContainer );
00098 
00099   debug() << "-> creating output Tracks container ..." << endmsg;
00100   // Make container for tracks
00101   // -------------------------
00102   Tracks* tracksNewCont = new Tracks();
00103 
00104   // Loop over the tracks and fit them
00105   // ---------------------------------
00106   //Tracks::const_iterator iTrack = tracksCont -> begin();
00107   Tracks::const_iterator iTrack;
00108   unsigned int nFitFail = 0;
00109 
00110   debug() << "-> tarting loop over input Tracks ..." << endmsg;
00111   for ( iTrack=tracksCont->begin(); iTrack != tracksCont->end(); ++iTrack ) {
00112 
00113     // Make a new track keeping the same key
00114     Track& track = *( (*iTrack) -> cloneWithKey() );
00115 
00116     // check if it is needed to populate the track with measurements
00117     if ( track.checkFlag( TrackKeys::PatRecIDs ) ) {
00118       m_measProvider -> load();    
00119       sc = m_measProvider -> load( track );
00120       if ( sc.isFailure() )
00121         return Error( "Unable to load measurements!", StatusCode::FAILURE); 
00122     }
00123 
00124     // get the seed state
00125     if ( track.nStates() == 0 )
00126       return Error( "Track has no state!", StatusCode::FAILURE);
00127 
00128     State& seed = seedState( track );
00129 
00130     debug() << "#### Fitting Track # " << track.key() << " ####" << endreq;
00131 
00132     if ( m_fitUpstream ) {  // fit upstream from last measurement
00133       //sc = m_tracksFitter -> fitReverse( track );
00134     } 
00135     else {                       // fit downstream from first measurement
00136       sc = m_tracksFitter -> fit( track, seed );
00137     }
00138 
00139     if ( sc.isSuccess() ) {
00140       debug() << "Fitted successfully track # " << track.key() << endreq;
00141       track.setStatus( TrackKeys::Fitted );
00142       // Add the track to the new Tracks container
00143       // -----------------------------------------
00144       tracksNewCont -> add( &track );
00145     }
00146     else {
00147       debug() << "Unable to fit the track # " << track.key() << endreq;
00148       track.setFlag( TrackKeys::Invalid, true );
00149       track.setStatus( TrackKeys::FitFailed );
00150       nFitFail++;
00151     }
00152 
00153   } // loop over input Tracks
00154   
00155   if ( nFitFail == 0 )
00156     info() << "All tracks fitted succesfully." << endreq;
00157   else
00158     info() << "Fitted successfully " << (tracksCont->size()-nFitFail)
00159            << " out of " << tracksCont->size() << endreq;
00160 
00161   // Store the Tracks in the TES
00162   // ---------------------------
00163   sc = registerTracks( tracksNewCont );
00164   if( sc.isFailure() ) return sc;
00165 
00166   return StatusCode::SUCCESS;
00167 }

StatusCode TrackEventFitter::finalize  )  [virtual]
 

Algorithm finalization.

Definition at line 172 of file TrackEventFitter.cpp.

00172                                       {
00173 
00174   debug() << "==> Finalize" << endmsg;
00175 
00176   return GaudiAlgorithm::finalize();  // must be called after all other actions
00177 }

StatusCode TrackEventFitter::initialize  )  [virtual]
 

Algorithm initialization.

Definition at line 53 of file TrackEventFitter.cpp.

References m_fitterName, m_fitUpstream, m_measProvider, m_tracksFitter, m_tracksInContainer, and m_tracksOutContainer.

00053                                         {
00054   StatusCode sc = GaudiAlgorithm::initialize(); // must be executed first
00055   if ( sc.isFailure() ) return sc;  // error printed already by GaudiAlgorithm
00056 
00057   debug() << "==> Initialize" << endmsg;
00058 
00059   m_tracksFitter = tool<ITrackFitter>( m_fitterName, "Fitter", this );
00060 
00061   m_measProvider = tool<IMeasurementProvider>( "MeasurementProvider",
00062                                                "MeasProvider", this );
00063 
00064   // Print out the user-defined settings
00065   // -----------------------------------
00066   std::string fitType;
00067   if ( m_fitUpstream ) fitType = "upstream";
00068   else                 fitType = "downstream";
00069 
00070   info()
00071     << " " << endreq
00072     << "================ TrackEventFitter Settings ================"
00073     << endreq
00074     << "  Tracks input container   : " << m_tracksInContainer << endreq
00075     << "  Tracks output container  : " << m_tracksOutContainer << endreq
00076     << "  Fitter name              : " << m_fitterName << endreq
00077     << "  Fit type                 : " << fitType << endreq
00078     << "==========================================================="
00079     << endreq
00080     << " " << endreq;
00081 
00082   return StatusCode::SUCCESS;
00083 };

StatusCode TrackEventFitter::registerTracks Tracks tracksCont  )  [private]
 

Register the tracks in the Transient event store.

Definition at line 193 of file TrackEventFitter.cpp.

References m_tracksOutContainer.

Referenced by execute().

00194 {
00195   StatusCode sc = put( tracksCont, m_tracksOutContainer );
00196 
00197   if ( sc.isFailure() )
00198     error() << "Unable to register the output container at "
00199             << m_tracksOutContainer << ". Status is " << sc << endreq;
00200 
00201   debug() << "Tracks container stored in the TES" << endreq;
00202 
00203   return StatusCode::SUCCESS;
00204 }

State & TrackEventFitter::seedState Track track  )  [private]
 

Get a seed State from the Track (State with highest/lowest z in case of upstream/downstream fitting)

Definition at line 182 of file TrackEventFitter.cpp.

References m_fitUpstream.

Referenced by execute().

00183 {
00184   if ( m_fitUpstream )  // fit upstream
00185     return *( *(track.states().end()-1) );
00186   else                  // fit downstream
00187     return track.firstState();
00188 }


Member Data Documentation

std::string TrackEventFitter::m_fitterName [private]
 

The fitter tool name.

Definition at line 56 of file TrackEventFitter.h.

Referenced by initialize(), and TrackEventFitter().

bool TrackEventFitter::m_fitUpstream [private]
 

Perform the fit upstream/downstream?

Definition at line 59 of file TrackEventFitter.h.

Referenced by execute(), initialize(), seedState(), and TrackEventFitter().

IMeasurementProvider* TrackEventFitter::m_measProvider [private]
 

measurement provider tool

Definition at line 45 of file TrackEventFitter.h.

Referenced by execute(), and initialize().

ITrackFitter* TrackEventFitter::m_tracksFitter [private]
 

interface to tracks fitter tool

Definition at line 42 of file TrackEventFitter.h.

Referenced by execute(), and initialize().

std::string TrackEventFitter::m_tracksInContainer [private]
 

Tracks input container path in TES.

Definition at line 50 of file TrackEventFitter.h.

Referenced by execute(), initialize(), and TrackEventFitter().

std::string TrackEventFitter::m_tracksOutContainer [private]
 

Tracks output container path in TES.

Definition at line 53 of file TrackEventFitter.h.

Referenced by initialize(), registerTracks(), and TrackEventFitter().


The documentation for this class was generated from the following files:
Generated on Mon Jul 4 13:54:47 2005 for New Track Event Model by doxygen 1.4.1