CMS 3D CMS Logo

MkFitSeedConverter.cc
Go to the documentation of this file.
2 
6 
11 
15 
19 
22 
25 
27 
28 // ROOT
29 #include "Math/SVector.h"
30 #include "Math/SMatrix.h"
31 
32 // mkFit includes
33 #include "LayerNumberConverter.h"
34 #include "Track.h"
35 
37 public:
38  explicit MkFitSeedConverter(edm::ParameterSet const& iConfig);
39  ~MkFitSeedConverter() override = default;
40 
41  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
42 
43 private:
44  void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
45 
47  const TrackerTopology& ttopo,
48  const TransientTrackingRecHitBuilder& ttrhBuilder,
49  const MagneticField& mf,
50  const MkFitGeometry& mkFitGeom) const;
51 
52  using SVector3 = ROOT::Math::SVector<float, 3>;
53  using SMatrixSym33 = ROOT::Math::SMatrix<float, 3, 3, ROOT::Math::MatRepSym<float, 3>>;
54  using SMatrixSym66 = ROOT::Math::SMatrix<float, 6, 6, ROOT::Math::MatRepSym<float, 6>>;
55 
62 };
63 
65  : seedToken_{consumes<edm::View<TrajectorySeed>>(iConfig.getParameter<edm::InputTag>("seeds"))},
66  ttrhBuilderToken_{esConsumes<TransientTrackingRecHitBuilder, TransientRecHitRecord>(
67  iConfig.getParameter<edm::ESInputTag>("ttrhBuilder"))},
68  ttopoToken_{esConsumes<TrackerTopology, TrackerTopologyRcd>()},
69  mkFitGeomToken_{esConsumes<MkFitGeometry, TrackerRecoGeometryRecord>()},
70  mfToken_{esConsumes<MagneticField, IdealMagneticFieldRecord>()},
71  putToken_{produces<MkFitSeedWrapper>()} {}
72 
75 
76  desc.add("seeds", edm::InputTag{"initialStepSeeds"});
77  desc.add("ttrhBuilder", edm::ESInputTag{"", "WithTrackAngle"});
78 
79  descriptions.addWithDefaultLabel(desc);
80 }
81 
83  iEvent.emplace(putToken_,
85  iSetup.getData(ttopoToken_),
86  iSetup.getData(ttrhBuilderToken_),
87  iSetup.getData(mfToken_),
88  iSetup.getData(mkFitGeomToken_)));
89 }
90 
92  const TrackerTopology& ttopo,
93  const TransientTrackingRecHitBuilder& ttrhBuilder,
94  const MagneticField& mf,
95  const MkFitGeometry& mkFitGeom) const {
97  ret.reserve(seeds.size());
98 
99  auto isPlusSide = [&ttopo](const DetId& detid) {
100  return ttopo.side(detid) == static_cast<unsigned>(TrackerDetSide::PosEndcap);
101  };
102 
103  int seed_index = 0;
104  for (const auto& seed : seeds) {
105  auto const& hitRange = seed.recHits();
106  const auto lastRecHit = ttrhBuilder.build(&*(hitRange.end() - 1));
107  const auto tsos = trajectoryStateTransform::transientState(seed.startingState(), lastRecHit->surface(), &mf);
108  const auto& stateGlobal = tsos.globalParameters();
109  const auto& gpos = stateGlobal.position();
110  const auto& gmom = stateGlobal.momentum();
111  SVector3 pos(gpos.x(), gpos.y(), gpos.z());
112  SVector3 mom(gmom.x(), gmom.y(), gmom.z());
113 
114  const auto& cov = tsos.curvilinearError().matrix();
115  SMatrixSym66 err; //fill a sub-matrix, mkfit::TrackState will convert internally
116  for (int i = 0; i < 5; ++i) {
117  for (int j = i; j < 5; ++j) {
118  err.At(i, j) = cov[i][j];
119  }
120  }
121 
122  mkfit::TrackState state(tsos.charge(), pos, mom, err);
123  state.convertFromGlbCurvilinearToCCS();
124  ret.emplace_back(state, 0, seed_index, 0, nullptr);
125  LogTrace("MkFitSeedConverter") << "Inserted seed with index " << seed_index;
126 
127  // Add hits
128  for (auto const& recHit : hitRange) {
130  throw cms::Exception("Assert") << "Encountered a seed with a hit which is not trackerHitRTTI::isFromDet()";
131  }
132  const auto& clusterRef = static_cast<const BaseTrackerRecHit&>(recHit).firstClusterRef();
133  const auto detId = recHit.geographicalId();
134  const auto ilay = mkFitGeom.layerNumberConverter().convertLayerNumber(
135  detId.subdetId(), ttopo.layer(detId), false, ttopo.isStereo(detId), isPlusSide(detId));
136  LogTrace("MkFitSeedConverter") << " addin hit detid " << detId.rawId() << " index " << clusterRef.index()
137  << " ilay " << ilay;
138  ret.back().addHitIdx(clusterRef.index(), ilay, 0); // per-hit chi2 is not known
139  }
140  ++seed_index;
141  }
142  return ret;
143 }
144 
MkFitSeedConverter::ttrhBuilderToken_
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > ttrhBuilderToken_
Definition: MkFitSeedConverter.cc:57
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:543
edm::StreamID
Definition: StreamID.h:30
TrackerTopology::side
unsigned int side(const DetId &id) const
Definition: TrackerTopology.cc:28
MkFitSeedWrapper.h
mps_fire.i
i
Definition: mps_fire.py:428
edm::ESInputTag
Definition: ESInputTag.h:87
GlobalTrajectoryParameters::position
GlobalPoint position() const
Definition: GlobalTrajectoryParameters.h:60
MkFitSeedConverter::putToken_
const edm::EDPutTokenT< MkFitSeedWrapper > putToken_
Definition: MkFitSeedConverter.cc:61
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm::EDPutTokenT< MkFitSeedWrapper >
TrackerTopology
Definition: TrackerTopology.h:16
MkFitSeedConverter::convertSeeds
mkfit::TrackVec convertSeeds(const edm::View< TrajectorySeed > &seeds, const TrackerTopology &ttopo, const TransientTrackingRecHitBuilder &ttrhBuilder, const MagneticField &mf, const MkFitGeometry &mkFitGeom) const
Definition: MkFitSeedConverter.cc:91
TransientRecHitRecord.h
pos
Definition: PixelAliasList.h:18
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TrackerRecoGeometryRecord.h
MkFitSeedConverter::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: MkFitSeedConverter.cc:73
TrackerTopology::layer
unsigned int layer(const DetId &id) const
Definition: TrackerTopology.cc:47
TransientTrackingRecHitBuilder::build
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
MkFitSeedConverter::seedToken_
const edm::EDGetTokenT< edm::View< TrajectorySeed > > seedToken_
Definition: MkFitSeedConverter.cc:56
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
MkFitSeedConverter::mkFitGeomToken_
const edm::ESGetToken< MkFitGeometry, TrackerRecoGeometryRecord > mkFitGeomToken_
Definition: MkFitSeedConverter.cc:59
fileCollector.seed
seed
Definition: fileCollector.py:127
MkFitSeedConverter::SMatrixSym33
ROOT::Math::SMatrix< float, 3, 3, ROOT::Math::MatRepSym< float, 3 > > SMatrixSym33
Definition: MkFitSeedConverter.cc:53
DetId
Definition: DetId.h:17
MakerMacros.h
TrackerTopology.h
MkFitSeedConverter::SVector3
ROOT::Math::SVector< float, 3 > SVector3
Definition: MkFitSeedConverter.cc:52
TrackerTopologyRcd.h
MkFitSeedConverter::SMatrixSym66
ROOT::Math::SMatrix< float, 6, 6, ROOT::Math::MatRepSym< float, 6 > > SMatrixSym66
Definition: MkFitSeedConverter.cc:54
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
TrackerTopology::isStereo
bool isStereo(const DetId &id) const
Definition: TrackerTopology.cc:158
IdealMagneticFieldRecord.h
MkFitGeometry::layerNumberConverter
mkfit::LayerNumberConverter const & layerNumberConverter() const
Definition: MkFitGeometry.h:34
MkFitSeedConverter::ttopoToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken_
Definition: MkFitSeedConverter.cc:58
TrajectorySeed.h
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::View
Definition: CaloClusterFwd.h:14
MkFitGeometry
Definition: MkFitGeometry.h:24
mkfit::TrackVec
std::vector< Track > TrackVec
Definition: MkFitOutputWrapper.h:8
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
trajectoryStateTransform::transientState
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
Definition: TrajectoryStateTransform.cc:35
trackerHitRTTI.h
MkFitSeedConverter
Definition: MkFitSeedConverter.cc:36
trackerHitRTTI::isFromDet
bool isFromDet(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:36
MagneticField.h
TrackerDetSide.h
edm::EventSetup
Definition: EventSetup.h:58
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
OmniClusterRef.h
edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord >
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
TrackerDetSide::PosEndcap
BaseTrackerRecHit.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
DetachedQuadStep_cff.seeds
seeds
Definition: DetachedQuadStep_cff.py:195
MkFitSeedConverter::mfToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > mfToken_
Definition: MkFitSeedConverter.cc:60
MkFitSeedConverter::MkFitSeedConverter
MkFitSeedConverter(edm::ParameterSet const &iConfig)
Definition: MkFitSeedConverter.cc:64
RunInfoPI::state
state
Definition: RunInfoPayloadInspectoHelper.h:16
MkFitSeedConverter::~MkFitSeedConverter
~MkFitSeedConverter() override=default
Exception
Definition: hltDiff.cc:245
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrajectoryStateTransform.h
TransientTrackingRecHitBuilder.h
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
TrajectoryStateOnSurface::globalParameters
const GlobalTrajectoryParameters & globalParameters() const
Definition: TrajectoryStateOnSurface.h:64
ParameterSet.h
MkFitSeedConverter::produce
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
Definition: MkFitSeedConverter.cc:82
EDProducer.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::Event
Definition: Event.h:73
MagneticField
Definition: MagneticField.h:19
TransientTrackingRecHitBuilder
Definition: TransientTrackingRecHitBuilder.h:6
edm::InputTag
Definition: InputTag.h:15
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:87
MkFitGeometry.h