CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
TransientTrackBuilder Class Reference

#include <TransientTrackBuilder.h>

Public Member Functions

reco::TransientTrack build (const reco::Track *p) const
 
reco::TransientTrack build (const reco::Track &p) const
 
reco::TransientTrack build (const reco::GsfTrack *p) const
 
reco::TransientTrack build (const reco::GsfTrack &p) const
 
reco::TransientTrack build (const reco::TrackRef *p) const
 
reco::TransientTrack build (const reco::TrackRef &p) const
 
reco::TransientTrack build (const reco::GsfTrackRef *p) const
 
reco::TransientTrack build (const reco::GsfTrackRef &p) const
 
reco::TransientTrack build (const reco::CandidatePtr *p) const
 
reco::TransientTrack build (const reco::CandidatePtr &p) const
 
std::vector< reco::TransientTrackbuild (const edm::Handle< reco::TrackCollection > &trkColl) const
 
std::vector< reco::TransientTrackbuild (const edm::Handle< reco::GsfTrackCollection > &trkColl) const
 
std::vector< reco::TransientTrackbuild (const edm::Handle< edm::View< reco::Track > > &trkColl) const
 
std::vector< reco::TransientTrackbuild (const edm::Handle< reco::TrackCollection > &trkColl, const edm::ValueMap< float > &trackTimes, const edm::ValueMap< float > &trackTimeResos) const
 
std::vector< reco::TransientTrackbuild (const edm::Handle< reco::GsfTrackCollection > &trkColl, const edm::ValueMap< float > &trackTimes, const edm::ValueMap< float > &trackTimeResos) const
 
std::vector< reco::TransientTrackbuild (const edm::Handle< edm::View< reco::Track > > &trkColl, const edm::ValueMap< float > &trackTimes, const edm::ValueMap< float > &trackTimeResos) const
 
std::vector< reco::TransientTrackbuild (const edm::Handle< reco::TrackCollection > &trkColl, const reco::BeamSpot &beamSpot) const
 
std::vector< reco::TransientTrackbuild (const edm::Handle< reco::GsfTrackCollection > &trkColl, const reco::BeamSpot &beamSpot) const
 
std::vector< reco::TransientTrackbuild (const edm::Handle< edm::View< reco::Track > > &trkColl, const reco::BeamSpot &beamSpot) const
 
std::vector< reco::TransientTrackbuild (const edm::Handle< reco::TrackCollection > &trkColl, const reco::BeamSpot &beamSpot, const edm::ValueMap< float > &trackTimes, const edm::ValueMap< float > &trackTimeResos) const
 
std::vector< reco::TransientTrackbuild (const edm::Handle< reco::GsfTrackCollection > &trkColl, const reco::BeamSpot &beamSpot, const edm::ValueMap< float > &trackTimes, const edm::ValueMap< float > &trackTimeResos) const
 
std::vector< reco::TransientTrackbuild (const edm::Handle< edm::View< reco::Track > > &trkColl, const reco::BeamSpot &beamSpot, const edm::ValueMap< float > &trackTimes, const edm::ValueMap< float > &trackTimeResos) const
 
reco::TransientTrack build (const FreeTrajectoryState &fts) const
 
const MagneticFieldfield () const
 
const edm::ESHandle
< GlobalTrackingGeometry
trackingGeometry () const
 
 TransientTrackBuilder (const MagneticField *field, const edm::ESHandle< GlobalTrackingGeometry > &trackingGeometry)
 

Private Attributes

const MagneticFieldtheField
 
edm::ESHandle
< GlobalTrackingGeometry
theTrackingGeometry
 

Detailed Description

Helper class to build TransientTrack from the persistent Track. This is obtained from the eventSetup, as given in the example in the test directory.

Definition at line 16 of file TransientTrackBuilder.h.

Constructor & Destructor Documentation

TransientTrackBuilder::TransientTrackBuilder ( const MagneticField field,
const edm::ESHandle< GlobalTrackingGeometry > &  trackingGeometry 
)
inline

Definition at line 18 of file TransientTrackBuilder.h.

19  : theField(field), theTrackingGeometry(trackingGeometry) {}
const MagneticField * theField
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry

Member Function Documentation

TransientTrack TransientTrackBuilder::build ( const reco::Track p) const

Definition at line 20 of file TransientTrackBuilder.cc.

Referenced by tadqm::TrackAnalyzer::analyze(), HIPTwoBodyDecayAnalyzer::analyzeTrackCollection(), ConversionProducer::buildCollection(), pat::LeptonVertexSignificance::calculate(), PrimaryVertexAssignment::chargedHadronVertex(), reco::JetSignalVertexCompatibilityAlgo::convert(), tadqm::TrackAnalyzer::fillHistosForState(), AlignmentTrackFromVertexSelector::findClosestVertex(), HIPTwoBodyDecayAnalyzer::fitDimuonVertex(), EGammaMvaEleEstimator::IDIsoCombinedMvaValue(), QualityCutsAnalyzer::LoopOverJetTracksAssociation(), OniaVtxReProducer::makeVertices(), EGammaMvaEleEstimatorCSA14::mvaValue(), EGammaMvaEleEstimator::mvaValue(), reco::tau::RecoTauImpactParameterSignificancePlugin::operator()(), PFTrackProducer::produce(), SoftPFMuonTagInfoProducer::produce(), pat::PATMuonProducer::produce(), CSCOverlapsAlignmentAlgorithm::run(), ConvBremPFTrackFinder::runConvBremFinder(), PrimaryVertexResolution::sortTracksByPt(), ImpactParameterAlgorithm::tag(), SoftLepton::tag(), TrackEfficiencyMonitor::testSTATracks(), and TrackEfficiencyMonitor::testTrackerTracks().

20  {
22 }
const MagneticField * theField
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
TransientTrack TransientTrackBuilder::build ( const reco::Track p) const

Definition at line 24 of file TransientTrackBuilder.cc.

24  {
26 }
const MagneticField * theField
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
TransientTrack TransientTrackBuilder::build ( const reco::GsfTrack p) const

Definition at line 28 of file TransientTrackBuilder.cc.

TransientTrack TransientTrackBuilder::build ( const reco::GsfTrack p) const

Definition at line 32 of file TransientTrackBuilder.cc.

TransientTrack TransientTrackBuilder::build ( const reco::TrackRef p) const

Definition at line 49 of file TransientTrackBuilder.cc.

49  {
51 }
const MagneticField * theField
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
TransientTrack TransientTrackBuilder::build ( const reco::TrackRef p) const

Definition at line 53 of file TransientTrackBuilder.cc.

53  {
55 }
const MagneticField * theField
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
TransientTrack TransientTrackBuilder::build ( const reco::GsfTrackRef p) const

Definition at line 57 of file TransientTrackBuilder.cc.

TransientTrack TransientTrackBuilder::build ( const reco::GsfTrackRef p) const

Definition at line 61 of file TransientTrackBuilder.cc.

TransientTrack TransientTrackBuilder::build ( const reco::CandidatePtr p) const

Definition at line 36 of file TransientTrackBuilder.cc.

References edm::Ptr< T >::get().

36  {
37  reco::PFCandidatePtr tryPF(*t);
39  if (tryPF.get() != nullptr && tryPF->isTimeValid()) {
40  return TransientTrack(*t, tryPF->time(), tryPF->timeError(), theField, theTrackingGeometry);
41  } else if (tryPacked.get() != nullptr && tryPacked->timeError() > 0.f) {
42  return TransientTrack(*t, (double)tryPacked->time(), (double)tryPacked->timeError(), theField, theTrackingGeometry);
43  }
45 }
const MagneticField * theField
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
TransientTrack TransientTrackBuilder::build ( const reco::CandidatePtr p) const

Definition at line 47 of file TransientTrackBuilder.cc.

References newFWLiteAna::build.

47 { return this->build(&t); }
reco::TransientTrack build(const reco::Track *p) const
vector< TransientTrack > TransientTrackBuilder::build ( const edm::Handle< reco::TrackCollection > &  trkColl) const

Definition at line 65 of file TransientTrackBuilder.cc.

References mps_fire::i.

65  {
66  vector<TransientTrack> ttVect;
67  ttVect.reserve((*trkColl).size());
68  for (unsigned int i = 0; i < (*trkColl).size(); i++) {
69  ttVect.push_back(TransientTrack(TrackRef(trkColl, i), theField, theTrackingGeometry));
70  }
71  return ttVect;
72 }
const MagneticField * theField
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
vector< TransientTrack > TransientTrackBuilder::build ( const edm::Handle< reco::GsfTrackCollection > &  trkColl) const

Definition at line 74 of file TransientTrackBuilder.cc.

References mps_fire::i.

74  {
75  vector<TransientTrack> ttVect;
76  ttVect.reserve((*trkColl).size());
77  for (unsigned int i = 0; i < (*trkColl).size(); i++) {
78  ttVect.push_back(TransientTrack(new GsfTransientTrack(GsfTrackRef(trkColl, i), theField, theTrackingGeometry)));
79  }
80  return ttVect;
81 }
edm::Ref< GsfTrackCollection > GsfTrackRef
persistent reference to a GsfTrack
Definition: GsfTrackFwd.h:13
const MagneticField * theField
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
vector< TransientTrack > TransientTrackBuilder::build ( const edm::Handle< edm::View< reco::Track > > &  trkColl) const

Definition at line 83 of file TransientTrackBuilder.cc.

References mps_fire::i.

83  {
84  vector<TransientTrack> ttVect;
85  ttVect.reserve((*trkColl).size());
86  for (unsigned int i = 0; i < (*trkColl).size(); i++) {
87  const Track* trk = &(*trkColl)[i];
88  const GsfTrack* gsfTrack = dynamic_cast<const GsfTrack*>(trk);
89  if (gsfTrack) {
90  ttVect.push_back(TransientTrack(
91  new GsfTransientTrack(RefToBase<Track>(trkColl, i).castTo<GsfTrackRef>(), theField, theTrackingGeometry)));
92  } else { // gsf
93  ttVect.push_back(TransientTrack(RefToBase<Track>(trkColl, i).castTo<TrackRef>(), theField, theTrackingGeometry));
94  }
95  }
96  return ttVect;
97 }
const MagneticField * theField
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
vector< TransientTrack > TransientTrackBuilder::build ( const edm::Handle< reco::TrackCollection > &  trkColl,
const edm::ValueMap< float > &  trackTimes,
const edm::ValueMap< float > &  trackTimeResos 
) const

Definition at line 99 of file TransientTrackBuilder.cc.

References alignCSCRings::e, mps_fire::i, and edm::isNotFinite().

101  {
102  vector<TransientTrack> ttVect;
103  ttVect.reserve((*trkColl).size());
104  for (unsigned int i = 0; i < (*trkColl).size(); i++) {
105  TrackRef ref(trkColl, i);
106  double time = trackTimes[ref];
107  double timeReso = trackTimeResos[ref];
108  timeReso =
109  (timeReso > 1e-6 ? timeReso : defaultInvalidTrackReso); // make the error much larger than the BS time width
110  if (edm::isNotFinite(time)) {
111  time = 0.0;
112  timeReso = defaultInvalidTrackReso;
113  }
114  ttVect.push_back(TransientTrack(ref, time, timeReso, theField, theTrackingGeometry));
115  }
116  return ttVect;
117 }
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
const MagneticField * theField
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
vector< TransientTrack > TransientTrackBuilder::build ( const edm::Handle< reco::GsfTrackCollection > &  trkColl,
const edm::ValueMap< float > &  trackTimes,
const edm::ValueMap< float > &  trackTimeResos 
) const

Definition at line 119 of file TransientTrackBuilder.cc.

References alignCSCRings::e, mps_fire::i, and edm::isNotFinite().

121  {
122  vector<TransientTrack> ttVect;
123  ttVect.reserve((*trkColl).size());
124  for (unsigned int i = 0; i < (*trkColl).size(); i++) {
125  GsfTrackRef ref(trkColl, i);
126  double time = trackTimes[ref];
127  double timeReso = trackTimeResos[ref];
128  timeReso =
129  (timeReso > 1e-6 ? timeReso : defaultInvalidTrackReso); // make the error much larger than the BS time width
130  if (edm::isNotFinite(time)) {
131  time = 0.0;
132  timeReso = defaultInvalidTrackReso;
133  }
134  ttVect.push_back(TransientTrack(new GsfTransientTrack(ref, time, timeReso, theField, theTrackingGeometry)));
135  }
136  return ttVect;
137 }
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
const MagneticField * theField
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
vector< TransientTrack > TransientTrackBuilder::build ( const edm::Handle< edm::View< reco::Track > > &  trkColl,
const edm::ValueMap< float > &  trackTimes,
const edm::ValueMap< float > &  trackTimeResos 
) const

Definition at line 139 of file TransientTrackBuilder.cc.

References alignCSCRings::e, mps_fire::i, and edm::isNotFinite().

141  {
142  vector<TransientTrack> ttVect;
143  ttVect.reserve((*trkColl).size());
144  for (unsigned int i = 0; i < (*trkColl).size(); i++) {
145  const Track* trk = &(*trkColl)[i];
146  const GsfTrack* gsfTrack = dynamic_cast<const GsfTrack*>(trk);
147  if (gsfTrack) {
148  GsfTrackRef ref = RefToBase<Track>(trkColl, i).castTo<GsfTrackRef>();
149  double time = trackTimes[ref];
150  double timeReso = trackTimeResos[ref];
151  timeReso =
152  (timeReso > 1e-6 ? timeReso : defaultInvalidTrackReso); // make the error much larger than the BS time width
153  if (edm::isNotFinite(time)) {
154  time = 0.0;
155  timeReso = defaultInvalidTrackReso;
156  }
157  ttVect.push_back(TransientTrack(new GsfTransientTrack(
158  RefToBase<Track>(trkColl, i).castTo<GsfTrackRef>(), time, timeReso, theField, theTrackingGeometry)));
159  } else { // gsf
160  TrackRef ref = RefToBase<Track>(trkColl, i).castTo<TrackRef>();
161  double time = trackTimes[ref];
162  double timeReso = trackTimeResos[ref];
163  timeReso =
164  (timeReso > 1e-6 ? timeReso : defaultInvalidTrackReso); // make the error much larger than the BS time width
165  if (edm::isNotFinite(time)) {
166  time = 0.0;
167  timeReso = defaultInvalidTrackReso;
168  }
169  ttVect.push_back(TransientTrack(
170  RefToBase<Track>(trkColl, i).castTo<TrackRef>(), time, timeReso, theField, theTrackingGeometry));
171  }
172  }
173  return ttVect;
174 }
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
const MagneticField * theField
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
vector< TransientTrack > TransientTrackBuilder::build ( const edm::Handle< reco::TrackCollection > &  trkColl,
const reco::BeamSpot beamSpot 
) const

Definition at line 176 of file TransientTrackBuilder.cc.

References newFWLiteAna::build, and mps_fire::i.

177  {
178  vector<TransientTrack> ttVect = build(trkColl);
179  for (unsigned int i = 0; i < ttVect.size(); i++) {
180  ttVect[i].setBeamSpot(beamSpot);
181  }
182  return ttVect;
183 }
reco::TransientTrack build(const reco::Track *p) const
vector< TransientTrack > TransientTrackBuilder::build ( const edm::Handle< reco::GsfTrackCollection > &  trkColl,
const reco::BeamSpot beamSpot 
) const

Definition at line 185 of file TransientTrackBuilder.cc.

References newFWLiteAna::build, and mps_fire::i.

186  {
187  vector<TransientTrack> ttVect = build(trkColl);
188  for (unsigned int i = 0; i < ttVect.size(); i++) {
189  ttVect[i].setBeamSpot(beamSpot);
190  }
191  return ttVect;
192 }
reco::TransientTrack build(const reco::Track *p) const
vector< TransientTrack > TransientTrackBuilder::build ( const edm::Handle< edm::View< reco::Track > > &  trkColl,
const reco::BeamSpot beamSpot 
) const

Definition at line 194 of file TransientTrackBuilder.cc.

References newFWLiteAna::build, and mps_fire::i.

195  {
196  vector<TransientTrack> ttVect = build(trkColl);
197  for (unsigned int i = 0; i < ttVect.size(); i++) {
198  ttVect[i].setBeamSpot(beamSpot);
199  }
200  return ttVect;
201 }
reco::TransientTrack build(const reco::Track *p) const
vector< TransientTrack > TransientTrackBuilder::build ( const edm::Handle< reco::TrackCollection > &  trkColl,
const reco::BeamSpot beamSpot,
const edm::ValueMap< float > &  trackTimes,
const edm::ValueMap< float > &  trackTimeResos 
) const

Definition at line 203 of file TransientTrackBuilder.cc.

References newFWLiteAna::build, and mps_fire::i.

206  {
207  vector<TransientTrack> ttVect = build(trkColl, trackTimes, trackTimeResos);
208  for (unsigned int i = 0; i < ttVect.size(); i++) {
209  ttVect[i].setBeamSpot(beamSpot);
210  }
211  return ttVect;
212 }
reco::TransientTrack build(const reco::Track *p) const
vector< TransientTrack > TransientTrackBuilder::build ( const edm::Handle< reco::GsfTrackCollection > &  trkColl,
const reco::BeamSpot beamSpot,
const edm::ValueMap< float > &  trackTimes,
const edm::ValueMap< float > &  trackTimeResos 
) const

Definition at line 214 of file TransientTrackBuilder.cc.

References newFWLiteAna::build, and mps_fire::i.

217  {
218  vector<TransientTrack> ttVect = build(trkColl, trackTimes, trackTimeResos);
219  for (unsigned int i = 0; i < ttVect.size(); i++) {
220  ttVect[i].setBeamSpot(beamSpot);
221  }
222  return ttVect;
223 }
reco::TransientTrack build(const reco::Track *p) const
vector< TransientTrack > TransientTrackBuilder::build ( const edm::Handle< edm::View< reco::Track > > &  trkColl,
const reco::BeamSpot beamSpot,
const edm::ValueMap< float > &  trackTimes,
const edm::ValueMap< float > &  trackTimeResos 
) const

Definition at line 225 of file TransientTrackBuilder.cc.

References newFWLiteAna::build, and mps_fire::i.

228  {
229  vector<TransientTrack> ttVect = build(trkColl, trackTimes, trackTimeResos);
230  for (unsigned int i = 0; i < ttVect.size(); i++) {
231  ttVect[i].setBeamSpot(beamSpot);
232  }
233  return ttVect;
234 }
reco::TransientTrack build(const reco::Track *p) const
TransientTrack TransientTrackBuilder::build ( const FreeTrajectoryState fts) const
const MagneticField* TransientTrackBuilder::field ( ) const
inline

Definition at line 70 of file TransientTrackBuilder.h.

References theField.

70 { return theField; }
const MagneticField * theField
const edm::ESHandle<GlobalTrackingGeometry> TransientTrackBuilder::trackingGeometry ( ) const
inline

Definition at line 71 of file TransientTrackBuilder.h.

References theTrackingGeometry.

71 { return theTrackingGeometry; }
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry

Member Data Documentation

const MagneticField* TransientTrackBuilder::theField
private

Definition at line 74 of file TransientTrackBuilder.h.

Referenced by field().

edm::ESHandle<GlobalTrackingGeometry> TransientTrackBuilder::theTrackingGeometry
private

Definition at line 75 of file TransientTrackBuilder.h.

Referenced by trackingGeometry().