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  for (int i = 0; i < nTracks; i++) {
28  reco::Track* track = tracksWithHits[i].first;
29  const auto& hits = tracksWithHits[i].second;
30 
31  for (unsigned int k = 0; k < hits.size(); k++) {
32  auto* hit = hits[k]->clone();
33 
34  track->appendHitPattern(*hit, ttopo);
35  recHits->push_back(hit);
36  }
37  tracks->push_back(*track);
38  delete track;
39  }
40 
41  LogDebug("TrackProducer") << "put the collection of TrackingRecHit in the event"
42  << "\n";
44 
46  for (int k = 0; k < nTracks; k++) {
47  reco::TrackExtra theTrackExtra{};
48 
49  //fill the TrackExtra with TrackingRecHitRef
50  unsigned int nHits = tracks->at(k).numberOfValidHits();
51  theTrackExtra.setHits(hitCollProd, cc, nHits);
52  cc += nHits;
53  AlgebraicVector5 v = AlgebraicVector5(0, 0, 0, 0, 0);
56  theTrackExtra.setTrajParams(std::move(trajParams), std::move(chi2s));
57  trackExtras->push_back(theTrackExtra);
58  }
59 
60  LogDebug("TrackProducer") << "put the collection of TrackExtra in the event"
61  << "\n";
63 
64  for (int k = 0; k < nTracks; k++) {
65  const reco::TrackExtraRef theTrackExtraRef(ohTE, k);
66  (tracks->at(k)).setExtra(theTrackExtraRef);
67  }
68 
69  ev.put(std::move(tracks));
70 }
71 
72 #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:11713
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
reco::TrackExtra
Definition: TrackExtra.h:26
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:159
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:95
EventSetup.h
reco::TrackExtraBase::TrajParams
std::vector< LocalTrajectoryParameters > TrajParams
Definition: TrackExtraBase.h:24
hit
Definition: SiStripHitEffFromCalibTree.cc:88