Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:46:24

0001 #include "AnalysisDataFormats/TrackInfo/interface/TrackInfo.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003 
0004 using namespace reco;
0005 
0006 TrackInfo::TrackInfo(const TrajectorySeed& seed, const TrajectoryInfo& trajstates)
0007     : seed_(seed), trajstates_(trajstates) {}
0008 
0009 const TrajectorySeed& TrackInfo::seed() const { return seed_; }
0010 
0011 const reco::TrackInfo::TrajectoryInfo& TrackInfo::trajStateMap() const { return trajstates_; }
0012 
0013 const RecHitType TrackInfo::type(TrackingRecHitRef hit) const {
0014   TrajectoryInfo::const_iterator states = trajstates_.find(hit);
0015   if (states != trajstates_.end())
0016     return states->second.type();
0017   else
0018     edm::LogError("TrackInfo") << "This rechit does not exist";
0019   return Null;
0020 }
0021 
0022 const PTrajectoryStateOnDet* TrackInfo::stateOnDet(StateType statetype, TrackingRecHitRef hit) const {
0023   TrajectoryInfo::const_iterator states = trajstates_.find(hit);
0024   if (states != trajstates_.end())
0025     return states->second.stateOnDet(statetype);
0026   else
0027     edm::LogError("TrackInfo") << "This rechit does not exist";
0028   return nullptr;
0029 }
0030 
0031 const LocalVector TrackInfo::localTrackMomentum(StateType statetype, TrackingRecHitRef hit) const {
0032   TrajectoryInfo::const_iterator states = trajstates_.find(hit);
0033   if (states != trajstates_.end()) {
0034     const PTrajectoryStateOnDet* state = states->second.stateOnDet(statetype);
0035     if (state != nullptr)
0036       return state->parameters().momentum();
0037   } else
0038     edm::LogError("TrackInfo") << "This rechit does not exist";
0039   return LocalVector(0, 0, 0);
0040 }
0041 
0042 const LocalVector TrackInfo::localTrackMomentumOnMono(StateType statetype, TrackingRecHitRef hit) const {
0043   TrajectoryInfo::const_iterator states = trajstates_.find(hit);
0044   if (states != trajstates_.end())
0045     return states->second.localTrackMomentumOnMono(statetype);
0046   else
0047     edm::LogError("TrackInfo") << "This rechit does not exist";
0048   return LocalVector(0, 0, 0);
0049 }
0050 
0051 const LocalVector TrackInfo::localTrackMomentumOnStereo(StateType statetype, TrackingRecHitRef hit) const {
0052   TrajectoryInfo::const_iterator states = trajstates_.find(hit);
0053   if (states != trajstates_.end())
0054     return states->second.localTrackMomentumOnStereo(statetype);
0055   return LocalVector(0, 0, 0);
0056 }
0057 
0058 const LocalPoint TrackInfo::localTrackPosition(StateType statetype, TrackingRecHitRef hit) const {
0059   TrajectoryInfo::const_iterator states = trajstates_.find(hit);
0060   if (states != trajstates_.end()) {
0061     const PTrajectoryStateOnDet* state = states->second.stateOnDet(statetype);
0062     if (state != nullptr)
0063       return state->parameters().position();
0064   } else
0065     edm::LogError("TrackInfo") << "This rechit does not exist";
0066   return LocalPoint(0, 0, 0);
0067 }
0068 
0069 const LocalPoint TrackInfo::localTrackPositionOnMono(StateType statetype, TrackingRecHitRef hit) const {
0070   TrajectoryInfo::const_iterator states = trajstates_.find(hit);
0071   if (states != trajstates_.end())
0072     return states->second.localTrackPositionOnMono(statetype);
0073   else
0074     edm::LogError("TrackInfo") << "This rechit does not exist";
0075   return LocalPoint(0, 0, 0);
0076 }
0077 
0078 const LocalPoint TrackInfo::localTrackPositionOnStereo(StateType statetype, TrackingRecHitRef hit) const {
0079   TrajectoryInfo::const_iterator states = trajstates_.find(hit);
0080   if (states != trajstates_.end())
0081     return states->second.localTrackPositionOnStereo(statetype);
0082   else
0083     edm::LogError("TrackInfo") << "This rechit does not exist";
0084   return LocalPoint(0, 0, 0);
0085 }