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

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 PixelTrackProducer::produce(), and PixelTrackProducerFromSoA::produce().

edm::RefProd< TrackingRecHitCollection >
mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
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
reco::TrackExtra
Definition: TrackExtra.h:26
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:159
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:95
reco::TrackExtraBase::TrajParams
std::vector< LocalTrajectoryParameters > TrajParams
Definition: TrackExtraBase.h:24
hit
Definition: SiStripHitEffFromCalibTree.cc:88