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

Track2TrFitTrackCnv Class Reference

#include <Track2TrFitTrackCnv.h>

List of all members.

Public Member Functions

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

Private Attributes

std::string m_inputTrackName
 Path of the input ("Track") tracks.
std::string m_outputTrackName
 Path of the output ("TrFitTrack") tracks.
DeVelo * m_veloDet
 Pointer to the Velo detector element.
DeSTDetector * m_itTrackerDet
 Pointer to the ST detector element.
DeOTDetector * m_otTrackerDet
 Pointer to the OT detector element.


Detailed Description

Converts a Track to a TrFitTrack

Author:
Eduardo Rodrigues
Date:
13/12/2004

Definition at line 21 of file Track2TrFitTrackCnv.h.


Constructor & Destructor Documentation

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

Standard constructor.

Definition at line 37 of file Track2TrFitTrackCnv.cpp.

References m_inputTrackName, and m_outputTrackName.

00039   : GaudiAlgorithm    ( name , pSvcLocator )
00040   , m_inputTrackName  ( TrackLocation::Default )
00041   , m_outputTrackName ( TrFitTrackLocation::Default )
00042   , m_veloDet(0)
00043   , m_itTrackerDet(0)
00044   , m_otTrackerDet(0)
00045 {
00046   declareProperty( "InputTracks",  m_inputTrackName  );
00047   declareProperty( "OutputTracks", m_outputTrackName );
00048 }

Track2TrFitTrackCnv::~Track2TrFitTrackCnv  )  [virtual]
 

Destructor.

Definition at line 53 of file Track2TrFitTrackCnv.cpp.

00053 {};


Member Function Documentation

StatusCode Track2TrFitTrackCnv::execute  )  [virtual]
 

Algorithm execution.

Definition at line 83 of file Track2TrFitTrackCnv.cpp.

References State::covariance(), str::lhcbIDs(), m_inputTrackName, m_itTrackerDet, m_otTrackerDet, m_outputTrackName, m_veloDet, TrackFunctor::nMeasurements(), State::qOverP(), State::stateVector(), State::tx(), State::ty(), State::x(), State::y(), and State::z().

00083                                         {
00084 
00085   debug() << "==> Execute" << endreq;
00086 
00087   // retrieve the Tracks container
00088   Tracks* inTra = get<Tracks>( m_inputTrackName );
00089   debug() << "- # Tracks = " << inTra -> size() << endreq;
00090 
00091   // create and register the TrFitTracks container
00092   TrFitTracks* outTra = new TrFitTracks();
00093   StatusCode sc = put( outTra, m_outputTrackName );
00094 
00095   Tracks::const_iterator              itSto;
00096   std::vector<LHCbID>::const_iterator itID;
00097 
00098   TrFitTrack*                         trFit;
00099 
00100   debug() << "Processing Tracks ... " << endreq;
00101 
00102   for ( itSto = inTra->begin(); inTra->end() != itSto ; ++itSto) {
00103     // create the TrFitTrack
00104     trFit = new TrFitTrack();
00105     outTra -> insert( trFit, (*itSto)->key() );   // Same key, for associators
00106 
00107     // debugging Track ...
00108     debug()
00109       << "- Track with key # " << (*itSto) -> key() << endreq
00110       << "  * charge        = " << (*itSto) -> charge() << endreq
00111       << "  * is Valid      = " << (*itSto) -> checkFlag( TrackKeys::Valid ) << endreq
00112       << "  * is Unique     = " << (*itSto) -> checkFlag( TrackKeys::Unique ) << endreq
00113       << "  * is Long       = " << (*itSto) -> checkType( TrackKeys::Long ) << endreq
00114       << "  * is Upstream   = " << (*itSto) -> checkType( TrackKeys::Upstream ) << endreq
00115       << "  * is Downstream = " << (*itSto) -> checkType( TrackKeys::Downstream ) << endreq
00116       << "  * is Velo       = " << (*itSto) -> checkType( TrackKeys::Velo ) << endreq
00117       << "  * is Backward   = " << (*itSto) -> checkType( TrackKeys::Backward ) << endreq
00118       << "  * is Ttrack     = " << (*itSto) -> checkType( TrackKeys::Ttrack ) << endreq
00119       << "  * # LHCbIDs     = " << (*itSto) -> lhcbIDs().size() << endreq;
00120 
00121     // set the properties of TrFitTrack
00122     trFit -> setCharge( (*itSto)->charge() );
00123     trFit -> setErrorFlag( (bool) !((*itSto)->checkFlag(TrackKeys::Valid)) );
00124     trFit -> setUnique( (bool) ((*itSto)->checkFlag(TrackKeys::Unique)) );
00125 
00126     if      ( (*itSto)->checkType( TrackKeys::Long ) )       trFit -> setForward(true); // could also be match!
00127     else if ( (*itSto)->checkType( TrackKeys::Upstream ) )   trFit -> setVeloTT( true );
00128     else if ( (*itSto)->checkType( TrackKeys::Downstream ) ) trFit -> setFollow( true ); // could also be ksTrack
00129     else if ( (*itSto)->checkType( TrackKeys::Velo ) )       trFit -> setVelo( true );
00130     else if ( (*itSto)->checkType( TrackKeys::Backward ) )   trFit -> setVeloBack( true );
00131     else if ( (*itSto)->checkType( TrackKeys::Ttrack ) )     trFit -> setSeed( true);
00132 
00133     // look at the "first state"
00134     State& pstate = (*itSto) -> firstState();
00135     TrStateP* trStaP = new TrStateP( pstate.z(), pstate.stateVector(), pstate.covariance() );
00136     // put the created TrStateP in TrFitTrack
00137     trFit -> addState( trStaP );
00138     debug() << "  -> stored physics state at z = " << pstate.z() << " as TrStateP" << endreq
00139             << "    - (x,y,z)     = (" << pstate.x() << ", "
00140             << pstate.y() << ", "
00141             << pstate.z() << ")" << endreq
00142             << "    - tx, ty, Q/P = " << pstate.tx() << ", "
00143             << pstate.ty() << ", "
00144             << pstate.qOverP() << endreq;
00145 
00146     // loop over the LHCbIDs
00147     const std::vector<LHCbID> trStoID = (*itSto) -> lhcbIDs();
00148     for ( itID = trStoID.begin(); itID != trStoID.end(); ++itID) {
00149       // continue according to type ...
00150       if ( (*itID).isOT() ) {
00151         OTChannelID otChID = (*itID).otID();
00152         OTTimes* otTimes = get<OTTimes>( OTTimeLocation::Default );
00153         OTTimes::const_iterator itOTTime;
00154         for ( itOTTime=otTimes->begin() ; otTimes->end()!= itOTTime ; ++itOTTime ) {
00155           if ( otChID == (*itOTTime)->channel() ) {
00156             // create OTClusterOnTrack
00157             int driftAmbiguity = 0;
00158             //driftAmbiguity stored in the LHCbID in the
00159             // spareBits: 11 / 10 for ambiguity = +1 / -1
00160             if      ( (*itID).spareBits() == 2 ) { driftAmbiguity = -1; }
00161             else if ( (*itID).spareBits() == 3 ) { driftAmbiguity =  1; }
00162             OTClusterOnTrack* otCluOnT =
00163               new OTClusterOnTrack( (*itOTTime), driftAmbiguity, m_otTrackerDet );
00164             // add OTClusterOnTrack to the TrFitTrack
00165             trFit -> addMeasurement( otCluOnT );
00166             debug() << "  * LHCbID = " << (*itID).lhcbID()
00167                     << "  (detectorType / spareBits = "
00168                     << (*itID).detectorType() << " / "
00169                     << (*itID).spareBits() << ")" << endreq
00170                     << "  -> stored OTClusterOnTrack at z = "
00171                     << otCluOnT -> z()
00172                           << " , channelID = "
00173                     << (*itOTTime) -> channel().channelID()
00174                     << " , ambiguity = " << otCluOnT -> ambiguity() << endreq;
00175           }
00176         }
00177       }
00178       else if ( (*itID).isST() ) {
00179         ITChannelID itChID = (*itID).stID();
00180         ITClusters* itClus = get<ITClusters>( ITClusterLocation::Default );
00181         ITClusters::const_iterator itITClu;
00182         for ( itITClu=itClus->begin() ; itClus->end()!= itITClu ; ++itITClu ) {
00183           if ( itChID == (*itITClu)->channelID() ) {
00184             // create ITClusterOnTrack
00185             ITClusterOnTrack* itCluOnT =
00186               new ITClusterOnTrack( (*itITClu), m_itTrackerDet );
00187             // add ITClusterOnTrack to the TrFitTrack
00188             trFit -> addMeasurement( itCluOnT );
00189             debug() << "  * LHCbID = " << (*itID).lhcbID()
00190                     << "  (detectorType / spareBits = "
00191                     << (*itID).detectorType() << " / "
00192                     << (*itID).spareBits() << ")" << endreq
00193                     << "  -> stored ITClusterOnTrack at z = "
00194                     << itCluOnT -> z()
00195                           << " , channelID = "
00196                     << (*itITClu) -> channelID().channelID() << endreq;
00197           }
00198         }
00199       }
00200       else if ( (*itID).isVelo() ) {
00201         VeloChannelID veloChID = (*itID).veloID();
00202         VeloClusters* veloClus = get<VeloClusters>( VeloClusterLocation::Default );
00203         VeloClusters::const_iterator itVeloClu;
00204         for ( itVeloClu=veloClus->begin() ; veloClus->end()!= itVeloClu ; ++itVeloClu ) {
00205           if ( veloChID.channelID() == (*itVeloClu)->channelID(0).channelID() ) {
00206             debug() << "  -> VeloChannelID of type R/Phi = "
00207                     << m_veloDet->isRSensor( (*itVeloClu)->sensor() ) << "/"
00208                     << m_veloDet->isPhiSensor( (*itVeloClu)->sensor() ) << endreq
00209                     << "sensor # from velocluster = "
00210                     << (*itVeloClu)->sensor() << endreq
00211                     << "VChID, sensor, veloChannelID.type = "
00212                     <<  veloChID<< " , " << veloChID.sensor() << " , "
00213                     << veloChID.type() << endreq;
00214             //if ( veloChID.isRType() ) {
00215             if ( m_veloDet->isRSensor( (*itVeloClu)->sensor() ) ) {
00216                     debug()
00217                 << "  -> stored as type R(sensorType=1), VChID, veloChannelID.type = "
00218                 <<  veloChID << " , " << veloChID.type() << endreq;
00219               // create VeloRClusterOnTrack
00220               VeloRClusterOnTrack* veloRCluOnT =
00221                 new VeloRClusterOnTrack( (*itVeloClu), m_veloDet );
00222               // add VeloRClusterOnTrack to the TrFitTrack
00223               trFit -> addMeasurement( veloRCluOnT );
00224             }
00225                   else {
00226               debug()
00227                 << "  -> stored as type Phi(sensorType=2), veloChannelID.type = "
00228                 << veloChID.type() << endreq;
00229               // create VeloPhiClusterOnTrack
00230               VeloPhiClusterOnTrack* veloPhiCluOnT =
00231                 new VeloPhiClusterOnTrack( (*itVeloClu), m_veloDet );
00232               // add VeloPhiClusterOnTrack to the TrFitTrack
00233               trFit -> addMeasurement( veloPhiCluOnT );
00234             }
00235           }
00236         }
00237       }
00238     }
00239     // debugging TrFitTrack ...
00240     debug()
00241       << "  -> TrFitTrack stored with key # " << trFit -> key() << endreq
00242       << "    * # states       = " << trFit -> nStates() << endreq
00243       << "    * # measurements = " << trFit -> nMeasurements() << endreq
00244       << "      - # IT         = "
00245       << trFit -> nMeasurements( TrMeasurement::kITClusterOnTrack ) << endreq
00246       << "      - # OT         = "
00247       << trFit -> nMeasurements( TrMeasurement::kOTClusterOnTrack ) << endreq
00248       << "      - # VeloR      = "
00249       << trFit -> nMeasurements( TrMeasurement::kVeloRClusterOnTrack ) << endreq
00250       << "      - # VeloPhi    = "
00251       << trFit -> nMeasurements( TrMeasurement::kVeloPhiClusterOnTrack ) << endreq
00252       << "    * charge         = " << trFit -> charge() << endreq
00253       << "    * error flag     = " << trFit -> errorFlag() << endreq
00254       << "    * is Unique      = " << trFit -> unique() << endreq
00255       << "    * is Long        = " << trFit -> isLong() << endreq
00256       << "    * is Upstream    = " << trFit -> isUpstream() << endreq
00257       << "    * is Downstream  = " << trFit -> isDownstream() << endreq
00258       << "    * is Velotrack   = " << trFit -> isVelotrack() << endreq
00259       << "    * is Backward    = " << trFit -> isBackward() << endreq
00260       << "    * is Ttrack      = " << trFit -> isTtrack() << endreq
00261       << "    * velo           = " << trFit -> velo() << endreq
00262       << "    * seed           = " << trFit -> seed() << endreq
00263       << "    * match          = " << trFit -> match() << endreq
00264       << "    * forward        = " << trFit -> forward() << endreq
00265       << "    * follow         = " << trFit -> follow() << endreq
00266       << "    * veloTT         = " << trFit -> veloTT() << endreq
00267       << "    * veloBack       = " << trFit -> veloBack() << endreq
00268       << "    * ksTrack        = " << trFit -> ksTrack() << endreq;
00269   }
00270   // summary of stored information
00271   //debug() << "-> stored " << outTra -> size() << " TrFitTracks " << endreq;
00272 
00273   return StatusCode::SUCCESS;
00274 }

StatusCode Track2TrFitTrackCnv::finalize  )  [virtual]
 

Algorithm finalization.

Definition at line 279 of file Track2TrFitTrackCnv.cpp.

00280 {
00281   debug() << "==> Finalize" << endreq;
00282 
00283   //if( m_associator ) toolSvc()->releaseTool( m_associator );
00284 
00285   // Force the finalization of the base class
00286   //-----------------------------------------
00287   return GaudiAlgorithm::finalize();
00288 }

StatusCode Track2TrFitTrackCnv::initialize  )  [virtual]
 

Algorithm initialization.

Definition at line 58 of file Track2TrFitTrackCnv.cpp.

References m_itTrackerDet, m_otTrackerDet, and m_veloDet.

00059 {
00060   // Force the initialization of the base class
00061   //-------------------------------------------
00062   StatusCode sc = GaudiAlgorithm::initialize() ;
00063   if ( sc.isFailure() )
00064     return Error( "Base class \"GaudiAlgorithm\" was not initialized properly!" );
00065 
00066   debug() << "==> Initialize" << endreq;
00067 
00068   // Retrieve the Velo Geometry
00069   m_veloDet = getDet<DeVelo>( "/dd/Structure/LHCb/Velo" );
00070 
00071   // Retrieve the ST Geometry
00072   m_itTrackerDet = getDet<DeSTDetector>( DeSTDetectorLocation::Default );
00073 
00074   // Retrieve the OT Geometry
00075   m_otTrackerDet = getDet<DeOTDetector>( "/dd/Structure/LHCb/OT" );
00076 
00077   return StatusCode::SUCCESS;
00078 }


Member Data Documentation

std::string Track2TrFitTrackCnv::m_inputTrackName [private]
 

Path of the input ("Track") tracks.

Definition at line 37 of file Track2TrFitTrackCnv.h.

Referenced by execute(), and Track2TrFitTrackCnv().

DeSTDetector* Track2TrFitTrackCnv::m_itTrackerDet [private]
 

Pointer to the ST detector element.

Definition at line 42 of file Track2TrFitTrackCnv.h.

Referenced by execute(), and initialize().

DeOTDetector* Track2TrFitTrackCnv::m_otTrackerDet [private]
 

Pointer to the OT detector element.

Definition at line 43 of file Track2TrFitTrackCnv.h.

Referenced by execute(), and initialize().

std::string Track2TrFitTrackCnv::m_outputTrackName [private]
 

Path of the output ("TrFitTrack") tracks.

Definition at line 38 of file Track2TrFitTrackCnv.h.

Referenced by execute(), and Track2TrFitTrackCnv().

DeVelo* Track2TrFitTrackCnv::m_veloDet [private]
 

Pointer to the Velo detector element.

Definition at line 41 of file Track2TrFitTrackCnv.h.

Referenced by execute(), and initialize().


The documentation for this class was generated from the following files:
Generated on Fri May 27 13:59:44 2005 for New Track Event Model by doxygen 1.4.1