23 #include "edm4hep/TrackState.h"
25 namespace ActsExamples {
32 static_cast<Acts::PdgParticle>(from.getPDG()),
45 to.
setDirection(from.getMomentum()[0], from.getMomentum()[1],
46 from.getMomentum()[2]);
49 from.getMomentum()[1],
50 from.getMomentum()[2]) *
57 edm4hep::MutableMCParticle to) {
60 to.setPDG(from.
pdg());
64 to.setMomentum({
static_cast<float>(from.
fourMomentum().x()),
75 const auto mass = from.getMCParticle().getMass();
112 edm4hep::MutableSimTrackerHit to,
119 if (particleMapper) {
120 to.setMCParticle(particleMapper(from.
particleId()));
123 if (geometryMapper) {
125 to.setCellID(geometryMapper(from.
geometryId()));
149 const edm4hep::TrackerHitPlane& from,
150 const edm4hep::TrackerHitCollection* fromClusters,
Cluster* toCluster,
157 auto pos = from.getPosition();
158 auto cov = from.getCovMatrix();
177 if (fromClusters !=
nullptr) {
178 for (
const auto objectId : from.getRawHits()) {
179 const auto&
c = fromClusters->at(objectId.index);
185 static_cast<unsigned int>(
c.getType()),
186 static_cast<unsigned int>(
c.getQuality())};
188 double activation =
c.getTime();
191 toCluster->
channels.push_back(cell);
199 edm4hep::MutableTrackerHitPlane to,
201 edm4hep::TrackerHitCollection& toClusters,
206 m.sourceLink().template get<IndexSourceLink>().geometryId();
208 if (geometryMapper) {
210 to.setCellID(geometryMapper(geoId));
213 auto parameters = (
m.expander() *
m.parameters()).eval();
224 (
m.expander() *
m.covariance() *
m.expander().transpose()).eval();
235 for (
const auto&
c : fromCluster->
channels) {
236 auto toChannel = toClusters.create();
237 to.addToRawHits(toChannel.getObjectID());
244 toChannel.setType(
c.bin[0]);
245 toChannel.setQuality(
c.bin[1]);
246 toChannel.setTime(
c.activation);
255 edm4hep::MutableTrack to, std::size_t fromIndex,
262 std::vector<ParticleHitCount> particleHitCount;
273 multiTrajectory.visitBackwards(fromIndex, [&](
const auto&
state) {
275 auto typeFlags =
state.typeFlags();
280 edm4hep::TrackState trackState;
293 trackState.D0 = converted.
values[0];
294 trackState.Z0 = converted.
values[1];
295 trackState.phi = converted.
values[2];
296 trackState.tanLambda = converted.
values[3];
297 trackState.omega = converted.
values[4];
298 trackState.time = converted.
values[5];
302 auto center = converted.
surface->center(gctx);
303 trackState.referencePoint.x = center.x();
304 trackState.referencePoint.y = center.y();
305 trackState.referencePoint.z = center.z();
310 trackState.covMatrix = {
311 static_cast<float>(
c(0, 0)), static_cast<float>(
c(1, 0)),
312 static_cast<float>(
c(1, 1)), static_cast<float>(
c(2, 0)),
313 static_cast<float>(
c(2, 1)), static_cast<float>(
c(2, 2)),
314 static_cast<float>(
c(3, 0)), static_cast<float>(
c(3, 1)),
315 static_cast<float>(
c(3, 2)), static_cast<float>(
c(3, 3)),
316 static_cast<float>(
c(4, 0)), static_cast<float>(
c(4, 1)),
317 static_cast<float>(
c(4, 2)), static_cast<float>(
c(4, 3)),
318 static_cast<float>(
c(4, 4))};
321 to.addToTrackStates(trackState);