CMS 3D CMS Logo

ParametersDefinerForTP.cc
Go to the documentation of this file.
11 
13  : bsToken_(iC.consumes(beamspot)), mfToken_(iC.esConsumes()) {}
14 
16 
18  const edm::EventSetup &iSetup,
19  const Charge charge,
20  const Point &vtx,
21  const LorentzVector &lv) const {
22  // to add a new implementation for cosmic. For the moment, it is just as for
23  // the base class:
24 
25  using namespace edm;
26 
27  auto const &bs = iEvent.get(bsToken_);
28  auto const &mf = iSetup.getData(mfToken_);
29 
31 
32  FreeTrajectoryState ftsAtProduction(
33  GlobalPoint(vtx.x(), vtx.y(), vtx.z()), GlobalVector(lv.x(), lv.y(), lv.z()), TrackCharge(charge), &mf);
34 
35  TSCBLBuilderNoMaterial tscblBuilder;
36  TrajectoryStateClosestToBeamLine tsAtClosestApproach =
37  tscblBuilder(ftsAtProduction, bs); // as in TrackProducerAlgorithm
38  if (tsAtClosestApproach.isValid()) {
39  GlobalVector p = tsAtClosestApproach.trackStateAtPCA().momentum();
40  momentum = TrackingParticle::Vector(p.x(), p.y(), p.z());
41  }
42  return momentum;
43 }
44 
46  const edm::EventSetup &iSetup,
47  const Charge charge,
48  const Point &vtx,
49  const LorentzVector &lv) const {
50  // to add a new implementation for cosmic. For the moment, it is just as for
51  // the base class:
52  using namespace edm;
53 
54  auto const &bs = iEvent.get(bsToken_);
55  auto const &mf = iSetup.getData(mfToken_);
56 
58 
59  FreeTrajectoryState ftsAtProduction(
60  GlobalPoint(vtx.x(), vtx.y(), vtx.z()), GlobalVector(lv.x(), lv.y(), lv.z()), TrackCharge(charge), &mf);
61 
62  TSCBLBuilderNoMaterial tscblBuilder;
63  TrajectoryStateClosestToBeamLine tsAtClosestApproach =
64  tscblBuilder(ftsAtProduction, bs); // as in TrackProducerAlgorithm
65  if (tsAtClosestApproach.isValid()) {
66  GlobalPoint v = tsAtClosestApproach.trackStateAtPCA().position();
67  vertex = TrackingParticle::Point(v.x(), v.y(), v.z());
68  } else {
69  // to preserve old behaviour
70  // would be better to flag this somehow to allow ignoring in downstream
71  vertex = TrackingParticle::Point(bs.x0(), bs.y0(), bs.z0());
72  }
73  return vertex;
74 }
75 
76 std::tuple<TrackingParticle::Vector, TrackingParticle::Point> ParametersDefinerForTP::momentumAndVertex(
77  const edm::Event &iEvent,
78  const edm::EventSetup &iSetup,
79  const Charge charge,
80  const Point &vtx,
81  const LorentzVector &lv) const {
82  using namespace edm;
83 
84  auto const &bs = iEvent.get(bsToken_);
85  auto const &mf = iSetup.getData(mfToken_);
86 
87  TrackingParticle::Point vertex(bs.x0(), bs.y0(), bs.z0());
89 
90  FreeTrajectoryState ftsAtProduction(
91  GlobalPoint(vtx.x(), vtx.y(), vtx.z()), GlobalVector(lv.x(), lv.y(), lv.z()), TrackCharge(charge), &mf);
92 
93  TSCBLBuilderNoMaterial tscblBuilder;
94  TrajectoryStateClosestToBeamLine tsAtClosestApproach =
95  tscblBuilder(ftsAtProduction, bs); // as in TrackProducerAlgorithm
96  if (tsAtClosestApproach.isValid()) {
97  GlobalPoint v = tsAtClosestApproach.trackStateAtPCA().position();
98  vertex = TrackingParticle::Point(v.x(), v.y(), v.z());
99  GlobalVector p = tsAtClosestApproach.trackStateAtPCA().momentum();
100  momentum = TrackingParticle::Vector(p.x(), p.y(), p.z());
101  ;
102  }
103 
104  return std::make_tuple(momentum, vertex);
105 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
virtual ~ParametersDefinerForTP()
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
math::XYZTLorentzVectorD LorentzVector
Lorentz vector.
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
ParametersDefinerForTP(const edm::InputTag &beamspot, edm::ConsumesCollector iC)
GlobalPoint position() const
math::XYZPointD Point
point in the space
int TrackCharge
Definition: TrackCharge.h:4
int iEvent
Definition: GenABIO.cc:224
GlobalVector momentum() const
virtual TrackingParticle::Vector momentum(const edm::Event &iEvent, const edm::EventSetup &iSetup, const Charge ch, const Point &vtx, const LorentzVector &lv) const
int Charge
electric charge type
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > mfToken_
virtual TrackingParticle::Point vertex(const edm::Event &iEvent, const edm::EventSetup &iSetup, const Charge ch, const Point &vtx, const LorentzVector &lv) const
HLT enums.
Structure Point Contains parameters of Gaussian fits to DMRs.
math::XYZVectorD Vector
point in the space
virtual std::tuple< TrackingParticle::Vector, TrackingParticle::Point > momentumAndVertex(const edm::Event &iEvent, const edm::EventSetup &iSetup, const TrackingParticleRef &tpr) const
Global3DVector GlobalVector
Definition: GlobalVector.h:10