CMS 3D CMS Logo

storeTracks.h
Go to the documentation of this file.
1 #ifndef RecoPixelVertexingPixelTrackFittingStoreTracks_H
2 #define RecoPixelVertexingPixelTrackFittingStoreTracks_H
3 
8 
15 
18 
19 template <typename Ev, typename TWH>
20 void storeTracks(Ev& ev, const TWH& tracksWithHits, const TrackerTopology& ttopo) {
21  auto tracks = std::make_unique<reco::TrackCollection>();
22  auto recHits = std::make_unique<TrackingRecHitCollection>();
23  auto trackExtras = std::make_unique<reco::TrackExtraCollection>();
24 
25  int cc = 0, nTracks = tracksWithHits.size();
26 
27  trackExtras->resize(nTracks);
28  tracks->reserve(nTracks);
29  recHits->reserve(4 * nTracks);
30 
31  for (int i = 0; i < nTracks; i++) {
32  reco::Track* track = tracksWithHits[i].first;
33  const auto& hits = tracksWithHits[i].second;
34 
35  for (unsigned int k = 0; k < hits.size(); k++) {
36  auto* hit = hits[k]->clone(); // need to clone (at least if from SoA)
37  track->appendHitPattern(*hit, ttopo);
38  recHits->push_back(hit);
39  }
40  tracks->push_back(*track);
41  delete track;
42  }
43 
44  LogDebug("TrackProducer") << "put the collection of TrackingRecHit in the event"
45  << "\n";
47 
49  for (int k = 0; k < nTracks; k++) {
50  auto& aTrackExtra = (*trackExtras)[k];
51 
52  //fill the TrackExtra with TrackingRecHitRef
53  unsigned int nHits = (*tracks)[k].numberOfValidHits();
54  aTrackExtra.setHits(hitCollProd, cc, nHits);
55  cc += nHits;
56  AlgebraicVector5 v = AlgebraicVector5(0, 0, 0, 0, 0);
59  aTrackExtra.setTrajParams(std::move(trajParams), std::move(chi2s));
60  }
61 
62  LogDebug("TrackProducer") << "put the collection of TrackExtra in the event"
63  << "\n";
65 
66  for (int k = 0; k < nTracks; k++) {
67  const reco::TrackExtraRef theTrackExtraRef(ohTE, k);
68  (*tracks)[k].setExtra(theTrackExtraRef);
69  }
70 
71  ev.put(std::move(tracks));
72 }
73 
74 #endif
edm::RefProd< TrackingRecHitCollection >
TrackExtra.h
mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11724
MessageLogger.h
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
ESHandle.h
TrackerTopology
Definition: TrackerTopology.h:16
findQualityFiles.v
v
Definition: findQualityFiles.py:179
BeamSpotPI::nTracks
Definition: BeamSpotPayloadInspectorHelper.h:42
edm::Ref< TrackExtraCollection >
LocalTrajectoryParameters
Definition: LocalTrajectoryParameters.h:25
LocalTrajectoryParameters.h
TrackerTopology.h
TrackerTopologyRcd.h
Track.h
TrackFwd.h
nHits
const caConstants::TupleMultiplicity *__restrict__ const HitsOnGPU *__restrict__ double *__restrict__ float *__restrict__ double *__restrict__ uint32_t nHits
Definition: BrokenLineFitOnGPU.h:27
OrphanHandle.h
reco::Track
Definition: Track.h:27
dqmdumpme.k
k
Definition: dqmdumpme.py:60
HTXS::TWH
Definition: HiggsTemplateCrossSections.h:28
TracksWithHits.h
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
Event.h
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:176
AlgebraicVector5
ROOT::Math::SVector< double, 5 > AlgebraicVector5
Definition: AlgebraicROOTObjects.h:14
cc
storeTracks
void storeTracks(Ev &ev, const TWH &tracksWithHits, const TrackerTopology &ttopo)
Definition: storeTracks.h:20
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::OrphanHandle
Definition: EDProductfwd.h:39
reco::TrackExtraBase::Chi2sFive
std::vector< unsigned char > Chi2sFive
Definition: TrackExtraBase.h:25
ev
bool ev
Definition: Hydjet2Hadronizer.cc:97
EventSetup.h
reco::TrackExtraBase::TrajParams
std::vector< LocalTrajectoryParameters > TrajParams
Definition: TrackExtraBase.h:24
hit
Definition: SiStripHitEffFromCalibTree.cc:88