CMS 3D CMS Logo

Functions
storeTracks.h File Reference
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "DataFormats/TrajectoryState/interface/LocalTrajectoryParameters.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "DataFormats/TrackReco/interface/TrackExtra.h"
#include "DataFormats/Common/interface/OrphanHandle.h"
#include "RecoPixelVertexing/PixelTrackFitting/interface/TracksWithHits.h"
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
#include "Geometry/Records/interface/TrackerTopologyRcd.h"

Go to the source code of this file.

Functions

template<typename Ev , typename TWH >
void storeTracks (Ev &ev, const TWH &tracksWithHits, const TrackerTopology &ttopo)
 

Function Documentation

◆ storeTracks()

template<typename Ev , typename TWH >
void storeTracks ( Ev &  ev,
const TWH &  tracksWithHits,
const TrackerTopology ttopo 
)

Definition at line 20 of file storeTracks.h.

20  {
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 }

References ev, hfClusterShapes_cfi::hits, mps_fire::i, dqmdumpme::k, LogDebug, eostools::move(), nHits, BeamSpotPI::nTracks, FastTrackerRecHitMaskProducer_cfi::recHits, HLT_FULL_cff::track, tracks, and findQualityFiles::v.

Referenced by PixelTrackProducerFromSoA::produce(), and PixelTrackProducer::produce().

edm::RefProd< TrackingRecHitCollection >
mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11724
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
findQualityFiles.v
v
Definition: findQualityFiles.py:179
BeamSpotPI::nTracks
Definition: BeamSpotPayloadInspectorHelper.h:42
edm::Ref< TrackExtraCollection >
LocalTrajectoryParameters
Definition: LocalTrajectoryParameters.h:25
nHits
const caConstants::TupleMultiplicity *__restrict__ const HitsOnGPU *__restrict__ double *__restrict__ float *__restrict__ double *__restrict__ uint32_t nHits
Definition: BrokenLineFitOnGPU.h:27
reco::Track
Definition: Track.h:27
dqmdumpme.k
k
Definition: dqmdumpme.py:60
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
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
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
reco::TrackExtraBase::TrajParams
std::vector< LocalTrajectoryParameters > TrajParams
Definition: TrackExtraBase.h:24
hit
Definition: SiStripHitEffFromCalibTree.cc:88