#include <TrFitTrack2TrackCnv.h>
Public Member Functions | |
TrFitTrack2TrackCnv (const std::string &name, ISvcLocator *pSvcLocator) | |
Standard constructor. | |
virtual | ~TrFitTrack2TrackCnv () |
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 ("TrFitTrack") tracks. | |
std::string | m_outputTrackName |
Path of the output ("Track") tracks. |
Definition at line 17 of file TrFitTrack2TrackCnv.h.
|
Standard constructor.
Definition at line 37 of file TrFitTrack2TrackCnv.cpp. References m_inputTrackName, and m_outputTrackName. 00039 : GaudiAlgorithm ( name , pSvcLocator ) 00040 , m_inputTrackName ( TrFitTrackLocation::Default ) 00041 , m_outputTrackName ( TrackLocation::Default ) 00042 { 00043 declareProperty( "InputTracks" , m_inputTrackName ); 00044 declareProperty( "OutputTracks", m_outputTrackName ); 00045 }
|
|
Destructor.
Definition at line 50 of file TrFitTrack2TrackCnv.cpp. 00050 {};
|
|
Algorithm execution.
Definition at line 71 of file TrFitTrack2TrackCnv.cpp. References LHCbID::channelID(), Track::clone(), LHCbID::detectorType(), LHCbID::lhcbID(), m_inputTrackName, m_outputTrackName, TrackFunctor::nMeasurements(), State::setCovariance(), LHCbID::setSpareBits(), State::setState(), and LHCbID::spareBits(). 00071 { 00072 00073 debug() << "==> Execute" << endreq; 00074 00075 // retrieve the TrFitTracks container 00076 TrFitTracks* inTra = get<TrFitTracks>( m_inputTrackName ); 00077 debug() << "- # TrFitTracks = " << inTra -> size() << endreq; 00078 00079 // create and register the Tracks container 00080 Tracks* outTra = new Tracks(); 00081 StatusCode sc = eventSvc() -> registerObject( m_outputTrackName, outTra ); 00082 if( sc.isFailure() ) { 00083 delete outTra; 00084 error() << "Unable to register the output container " 00085 << m_outputTrackName << ". Status is " << sc << endreq; 00086 return sc ; 00087 } 00088 else { 00089 debug() << "Output container " << m_outputTrackName 00090 << " registered" << endreq; 00091 } 00092 00093 TrStateP* trStaP; 00094 TrStateL* trStaL; 00095 TrState* trSta; 00096 OTClusterOnTrack* myOt; 00097 ITClusterOnTrack* myIt; 00098 VeloRClusterOnTrack* myRV; 00099 VeloPhiClusterOnTrack* myPV; 00100 TrFitTracks::const_iterator itF; 00101 TrStates::const_iterator itS; 00102 TrTrack::TrMeasurements::const_iterator itM; 00103 00104 Track* trSto; 00105 LHCbID myID; 00106 std::vector<LHCbID> myIDs; 00107 00108 debug() << "Processing TrFitTracks ... " << endreq; 00109 00110 for ( itF = inTra->begin() ; inTra->end() != itF ; ++itF ) { 00111 // create the Track 00112 trSto = new Track(); 00113 outTra -> insert( trSto, (*itF)->key() ); // Same key, for associators 00114 00115 // debugging TrFitTrack ... 00116 debug() 00117 << "- TrFitTrack with key # " << (*itF) -> key() << endreq 00118 << " * # states = " << (*itF) -> nStates() << endreq 00119 << " * # measurements = " << (*itF) -> nMeasurements() << endreq 00120 << " - # IT = " << (*itF) -> nMeasurements( TrMeasurement::kITClusterOnTrack ) << endreq 00121 << " - # OT = " << (*itF) -> nMeasurements( TrMeasurement::kOTClusterOnTrack ) << endreq 00122 << " - # VeloR = " << (*itF) -> nMeasurements( TrMeasurement::kVeloRClusterOnTrack ) << endreq 00123 << " - # VeloPhi = " << (*itF) -> nMeasurements( TrMeasurement::kVeloPhiClusterOnTrack ) << endreq 00124 << " * charge = " << (*itF) -> charge() << endreq 00125 << " * error flag = " << (*itF) -> errorFlag() << endreq 00126 << " * is Unique = " << (*itF) -> unique() << endreq 00127 << " * is Long = " << (*itF) -> isLong() << endreq 00128 << " * is Upstream = " << (*itF) -> isUpstream() << endreq 00129 << " * is Downstream = " << (*itF) -> isDownstream() << endreq 00130 << " * is Velotrack = " << (*itF) -> isVelotrack() << endreq 00131 << " * is Backward = " << (*itF) -> isBackward() << endreq 00132 << " * is Ttrack = " << (*itF) -> isTtrack() << endreq 00133 << " * velo = " << (*itF) -> velo() << endreq 00134 << " * seed = " << (*itF) -> seed() << endreq 00135 << " * match = " << (*itF) -> match() << endreq 00136 << " * forward = " << (*itF) -> forward() << endreq 00137 << " * follow = " << (*itF) -> follow() << endreq 00138 << " * veloTT = " << (*itF) -> veloTT() << endreq 00139 << " * veloBack = " << (*itF) -> veloBack() << endreq 00140 << " * ksTrack = " << (*itF) -> ksTrack() << endreq; 00141 00142 // set the properties of Track 00143 // (the charge is calculated from Q/P of the first state) 00144 if ( (bool) (!(*itF)->errorFlag()) ) trSto -> setFlag( TrackKeys::Valid, true ); 00145 if ( (bool) (*itF)->unique() ) trSto -> setFlag( TrackKeys::Unique, true ); 00146 00147 if ( (*itF)->isLong() ) trSto -> setType( TrackKeys::Long ); 00148 else if ( (*itF)->isUpstream() ) trSto -> setType( TrackKeys::Upstream ); 00149 else if ( (*itF)->isDownstream() ) trSto -> setType( TrackKeys::Downstream ); 00150 else if ( (*itF)->isVelotrack() ) trSto -> setType( TrackKeys::Velo ); 00151 else if ( (*itF)->isBackward() ) trSto -> setType( TrackKeys::Backward ); 00152 else if ( (*itF)->isTtrack() ) trSto -> setType( TrackKeys::Ttrack ); 00153 00154 if ( (*itF)->ksTrack() ) trSto -> setHistory( TrackKeys::TrKshort ); 00155 00156 // debugging Track ... 00157 debug() 00158 << " -> Track stored with key # " << trSto -> key() << endreq 00159 << " * is Valid = " 00160 << trSto -> checkFlag( TrackKeys::Valid ) << endreq 00161 << " * is Unique = " 00162 << trSto -> checkFlag( TrackKeys::Unique ) << endreq 00163 << " * is Long = " 00164 << trSto -> checkType( TrackKeys::Long ) << endreq 00165 << " * is Upstream = " 00166 << trSto -> checkType( TrackKeys::Upstream ) << endreq 00167 << " * is Downstream = " 00168 << trSto -> checkType( TrackKeys::Downstream ) << endreq 00169 << " * is Velo = " 00170 << trSto -> checkType( TrackKeys::Velo ) << endreq 00171 << " * is Backward = " 00172 << trSto -> checkType( TrackKeys::Backward ) << endreq 00173 << " * is Ttrack = " 00174 << trSto -> checkType( TrackKeys::Ttrack ) << endreq; 00175 00176 // print out the states in TrFitTrack 00177 unsigned ist = 0; 00178 for ( itS = (*itF)->beginS() ; (*itF)->endS() != itS; itS++ ) { 00179 trSta = (*itS)->clone(); 00180 trStaP = dynamic_cast<TrStateP*>(trSta); 00181 trStaL = dynamic_cast<TrStateL*>(trSta); 00182 if ( 0 != trStaP ) { 00183 debug() << " * TrStateP # " << ist++ << endreq 00184 << " - (x,y,z) = (" << trStaP -> x() << ", " 00185 << trStaP -> y() << ", " 00186 << trStaP -> z() << ")" << endreq 00187 << " - tx, ty, Q/P = " << trStaP -> tx() << ", " 00188 << trStaP -> ty() << ", " 00189 << trStaP -> qDivP() << endreq; 00190 } 00191 else if ( 0 != trStaL ) { 00192 debug() << " * TrStateL # " << ist++ << endreq 00193 << " - (x,y,z) = (" << trStaL -> x() << ", " 00194 << trStaL -> y() << ", " 00195 << trStaL -> z() << ")" << endreq 00196 << " - tx, ty = " << trStaL -> tx() << ", " 00197 << trStaL -> ty() << endreq; 00198 } 00199 else { 00200 verbose() << " * unknown state at z =" << trSta -> z() << "!" << endreq; 00201 delete trSta; 00202 } 00203 } 00204 00205 // store the state closest to the nominal IP as the "first state" 00206 trSta = (*itF) -> closestState(0.); 00207 trStaP = dynamic_cast<TrStateP*>(trSta); 00208 trStaL = dynamic_cast<TrStateL*>(trSta); 00209 if ( 0 != trStaP ) { 00210 State& pstate = trSto -> firstState(); 00211 pstate.setState( trStaP->x(), trStaP->y(), trStaP->z(), 00212 trStaP->tx(), trStaP->ty(), trStaP->qDivP() ); 00213 pstate.setCovariance( trStaP->stateCov() ); 00214 debug() << " -> stored TrStateP at z = " << trStaP -> z() 00215 << " as first state" << endreq; 00216 } 00217 else if ( 0 != trStaL ) { 00218 verbose() << " -> no first state stored!" << endreq; 00219 } 00220 debug() << " -> track charge = " << trSto -> charge() << endreq; 00221 00222 // print out the measurements in TrFitTrack 00223 myIDs.clear(); 00224 for ( itM = (*itF)->beginM() ; (*itF)->endM() != itM ; itM++ ) { 00225 if ( TrMeasurement::kOTClusterOnTrack == (*itM)->measType()) { 00226 // old event model stored the following OT measurement properties: 00227 // cluster <- OTTime 00228 // ambiguity <- from pattern recognition algorithms 00229 // z <- calculated from the detector element, 00230 // OTTime and drift ambiguity 00231 // residual <- from track fit 00232 // errorResidual <- from track fit 00233 // -> only needs to be stored: OTTime and drift ambiguity 00234 myOt = dynamic_cast<OTClusterOnTrack*>(*itM); 00235 OTTime* otTime = myOt -> time(); 00236 myID = LHCbID( otTime -> channel() ); 00237 int amb = myOt -> ambiguity(); 00238 // spareBits: 11 / 10 for ambiguity = +1 / -1 00239 if ( amb != 0 ) { 00240 ( amb < 0 ) ? myID.setSpareBits( 2 ) : myID.setSpareBits( 3 ); 00241 } 00242 else { 00243 myID.setSpareBits( 0 ); 00244 } 00245 myIDs.push_back( myID ); 00246 debug() << " * OTCluster at z = " << myOt -> z() 00247 << " , channelID = " << otTime -> channel().channelID() 00248 << " , ambiguity = " << amb << endreq 00249 << " -> stored as LHCbID = " << myID.lhcbID() 00250 << " (detectorType / spareBits = " 00251 << myID.detectorType() << " / " 00252 << myID.spareBits() << ")" << endreq; 00253 } 00254 else if ( TrMeasurement::kITClusterOnTrack == (*itM)->measType() ) { 00255 // old event model stored the following IT measurement properties: 00256 // cluster <- ITCluster 00257 // z <- calculated from the detector element 00258 // and the ITCluster 00259 // residual <- from track fit 00260 // errorResidual <- from track fit 00261 // -> only needs to be stored: ITCluster 00262 myIt = dynamic_cast<ITClusterOnTrack*>(*itM); 00263 ITCluster* itClu = myIt -> cluster(); 00264 myID = LHCbID( itClu -> channelID() ); 00265 myIDs.push_back( myID ); 00266 debug() << " * ITCluster at z = " << myIt -> z() 00267 << " , channelID = " 00268 << itClu -> channelID().channelID() << endreq 00269 << " -> stored as LHCbID = " << myID.lhcbID() 00270 << " (detectorType / spareBits = " 00271 << myID.detectorType() << " / " 00272 << myID.spareBits() << ")" << endreq; 00273 } 00274 else if ( TrMeasurement::kVeloRClusterOnTrack == (*itM)->measType() ) { 00275 // old event model stored the following Velo-R measurement properties: 00276 // cluster <- VeloCluster 00277 // z <- calculated from the detector element 00278 // and the VeloCluster 00279 // residual <- from track fit 00280 // errorResidual <- from track fit 00281 // -> only needs to be stored: VeloCluster 00282 myRV = dynamic_cast<VeloRClusterOnTrack*>(*itM); 00283 VeloCluster* veloClu = myRV -> cluster(); 00284 debug() << " -> VeloChannelID of type " 00285 << veloClu->channelID(0).type() << endreq; 00286 myID = LHCbID( veloClu -> channelID( 0 ) ); 00287 myIDs.push_back( myID ); 00288 debug() << " * R Velo Cluster at z = " << myRV -> z() 00289 << " , channelID = " 00290 << veloClu -> channelID(0).channelID() << endreq 00291 << " -> stored as LHCbID = " << myID.lhcbID() 00292 << " (detectorType / spareBits = " 00293 << myID.detectorType() << " / " 00294 << myID.spareBits() << ")" << endreq; 00295 } 00296 else if ( TrMeasurement::kVeloPhiClusterOnTrack == (*itM)->measType() ) { 00297 // old event model stored the following Velo-Phi measurement properties: 00298 // cluster <- VeloCluster 00299 // z <- calculated from the det. elem. and VeloCluster 00300 // residual <- from track fit 00301 // errorResidual <- from track fit 00302 // -> only needs to be stored: VeloCluster 00303 myPV = dynamic_cast<VeloPhiClusterOnTrack*>(*itM); 00304 VeloCluster* veloClu = myPV -> cluster(); 00305 myID = LHCbID( veloClu -> channelID(0) ); 00306 debug() << " -> VeloChannelID of type " 00307 << veloClu->channelID(0).type() << endreq; 00308 myIDs.push_back( myID ); 00309 debug() << " * Phi Velo Cluster at z = " << myPV -> z() 00310 << " , channelID = " 00311 << veloClu -> channelID(0).channelID() << endreq 00312 << " -> stored as LHCbID = " << myID.lhcbID() 00313 << " (detectorType / spareBits = " 00314 << myID.detectorType() << " / " 00315 << myID.spareBits() << ")" << endreq; 00316 } 00317 } 00318 // store all the measurements as LHCbIDs 00319 trSto -> setLhcbIDs( myIDs ); 00320 debug() << " -> # LHCbIDs stored = " << myIDs.size() << endreq; 00321 } 00322 // summary of stored information 00323 debug() << "-> stored " << outTra -> size() << " Tracks " << endreq; 00324 00325 return StatusCode::SUCCESS; 00326 };
|
|
Algorithm finalization.
Definition at line 331 of file TrFitTrack2TrackCnv.cpp. 00331 { 00332 00333 debug() << "==> Finalize" << endreq; 00334 00335 // Force the finalization of the base class 00336 //----------------------------------------- 00337 return GaudiAlgorithm::finalize(); 00338 }
|
|
Algorithm initialization.
Definition at line 55 of file TrFitTrack2TrackCnv.cpp. 00055 { 00056 00057 // Force the initialization of the base class 00058 //------------------------------------------- 00059 StatusCode sc = GaudiAlgorithm::initialize() ; 00060 if ( sc.isFailure() ) 00061 return Error( "Base class \"GaudiAlgorithm\" was not initialized properly!" ); 00062 00063 debug() << "==> Initialize" << endreq; 00064 00065 return StatusCode::SUCCESS; 00066 };
|
|
Path of the input ("TrFitTrack") tracks.
Definition at line 33 of file TrFitTrack2TrackCnv.h. Referenced by execute(), and TrFitTrack2TrackCnv(). |
|
Path of the output ("Track") tracks.
Definition at line 34 of file TrFitTrack2TrackCnv.h. Referenced by execute(), and TrFitTrack2TrackCnv(). |