CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
TrackListCombiner Class Reference

#include <TrackListCombiner.h>

Inheritance diagram for TrackListCombiner:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  Tags
 

Public Member Functions

void produce (edm::StreamID, edm::Event &ev, const edm::EventSetup &es) const override
 
 TrackListCombiner (const edm::ParameterSet &ps)
 
 ~TrackListCombiner () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

std::vector< TagstrackProducers
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 17 of file TrackListCombiner.h.

Constructor & Destructor Documentation

◆ TrackListCombiner()

TrackListCombiner::TrackListCombiner ( const edm::ParameterSet ps)
explicit

Definition at line 16 of file TrackListCombiner.cc.

References edm::ParameterSet::getParameter(), dumpMFGeometry_cfg::prod, AlCaHLTBitMon_QueryRunRegistry::string, and HLT_FULL_cff::trackProducers.

16  {
17  for (const std::string& prod : ps.getParameter<vector<string>>("trackProducers")) {
18  trackProducers.emplace_back(consumes<vector<Trajectory>>(prod), consumes<TrajTrackAssociationCollection>(prod));
19  }
20 
21  produces<reco::TrackCollection>();
22  produces<reco::TrackExtraCollection>();
23  produces<TrackingRecHitCollection>();
24  produces<vector<Trajectory>>();
25  produces<TrajTrackAssociationCollection>();
26 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< Tags > trackProducers

◆ ~TrackListCombiner()

TrackListCombiner::~TrackListCombiner ( )
override

Definition at line 29 of file TrackListCombiner.cc.

29 {}

Member Function Documentation

◆ produce()

void TrackListCombiner::produce ( edm::StreamID  ,
edm::Event ev,
const edm::EventSetup es 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 32 of file TrackListCombiner.cc.

References edm::AssociationMap< Tag >::begin(), edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, reco::TrackBase::detachedTripletStep, edm::AssociationMap< Tag >::end(), makeMEIFBenchmarkPlots::ev, hfClusterShapes_cfi::hits, mps_fire::i, reco::Track::innerDetId(), reco::Track::innerMomentum(), reco::Track::innerOk(), reco::Track::innerPosition(), reco::Track::innerStateCovariance(), edm::Ref< C, T, F >::key(), SummaryClient_cfi::labels, LogTrace, reco::TrackBase::lowPtTripletStep, eostools::move(), cms::cuda::nh, nHits, BeamSpotPI::nTracks, reco::Track::outerDetId(), reco::Track::outerMomentum(), reco::Track::outerOk(), reco::Track::outerPosition(), reco::Track::outerStateCovariance(), reco::TrackBase::pixelPairStep, reco::Track::recHit(), reco::Track::recHitsSize(), reco::Track::seedDirection(), reco::Track::seedRef(), reco::TrackBase::setAlgorithm(), edm::AssociationMap< Tag >::size(), L1TCSCTF_cfi::trackProducer, HLT_FULL_cff::trackProducers, and reco::TrackBase::undefAlgorithm.

32  {
33  auto recoTracks = std::make_unique<reco::TrackCollection>();
34  auto recoTrackExtras = std::make_unique<reco::TrackExtraCollection>();
35  auto recoHits = std::make_unique<TrackingRecHitCollection>();
36  auto recoTrajectories = std::make_unique<vector<Trajectory>>();
37  auto recoTrajTrackMap = std::make_unique<TrajTrackAssociationCollection>();
38 
39  LogTrace("MinBiasTracking") << "[TrackListCombiner]";
40 
41  // Go through all track producers
42  int i = 1;
43  for (auto trackProducer = trackProducers.begin(); trackProducer != trackProducers.end(); trackProducer++, i++) {
45  switch (i) {
46  case 1:
48  break;
49  case 2:
51  break;
52  case 3:
54  break;
55  default:
57  }
58 
59  edm::Handle<vector<Trajectory>> theTrajectoryCollection;
61 
62  ev.getByToken(trackProducer->trajectory, theTrajectoryCollection);
63  ev.getByToken(trackProducer->assoMap, theAssoMap);
64 
65 #ifdef EDM_ML_DEBUG
67  labelsForToken(trackProducer->trajectory, labels);
68 
69  LogTrace("MinBiasTracking") << " [TrackListCombiner] " << labels.module << " : " << theAssoMap->size();
70 #endif
71 
72  // The track collection iterators
75  anAssociation = theAssoMap->begin();
76  lastAssociation = theAssoMap->end();
77 
78  // Build the map of correspondance between reco tracks and sim tracks
79  for (; anAssociation != lastAssociation; ++anAssociation) {
80  edm::Ref<vector<Trajectory>> aTrajectoryRef = anAssociation->key;
81  reco::TrackRef aTrackRef = anAssociation->val;
82 
83  // A copy of the track
84  reco::Track aRecoTrack(*aTrackRef);
85 
86  // Set algorithm
87  aRecoTrack.setAlgorithm(algo);
88 
89  recoTracks->push_back(aRecoTrack);
90 
91  // A copy of the hits
92  unsigned nh = aRecoTrack.recHitsSize();
93  for (unsigned ih = 0; ih < nh; ++ih) {
94  TrackingRecHit* hit = aRecoTrack.recHit(ih)->clone();
95  recoHits->push_back(hit);
96  }
97 
98  // A copy of the trajectories
99  recoTrajectories->push_back(*aTrajectoryRef);
100  }
101  }
102 
103  LogTrace("MinBiasTracking") << " [TrackListCombiner] allTracks : " << recoTracks->size() << "|"
104  << recoTrajectories->size();
105 
106  // Save the tracking recHits
107  edm::OrphanHandle<TrackingRecHitCollection> theRecoHits = ev.put(std::move(recoHits));
108 
109  edm::RefProd<TrackingRecHitCollection> theRecoHitsProd(theRecoHits);
110  // Create the track extras and add the references to the rechits
111  unsigned hits = 0;
112  unsigned nTracks = recoTracks->size();
113  recoTrackExtras->reserve(nTracks); // To save some time at push_back
114  for (unsigned index = 0; index < nTracks; ++index) {
115  reco::Track& aTrack = recoTracks->at(index);
116  reco::TrackExtra aTrackExtra(aTrack.outerPosition(),
117  aTrack.outerMomentum(),
118  aTrack.outerOk(),
119  aTrack.innerPosition(),
120  aTrack.innerMomentum(),
121  aTrack.innerOk(),
122  aTrack.outerStateCovariance(),
123  aTrack.outerDetId(),
124  aTrack.innerStateCovariance(),
125  aTrack.innerDetId(),
126  aTrack.seedDirection(),
127  aTrack.seedRef());
128 
129  unsigned nHits = aTrack.recHitsSize();
130  aTrackExtra.setHits(theRecoHitsProd, hits, nHits);
131  hits += nHits;
132 
133  recoTrackExtras->push_back(aTrackExtra);
134  }
135 
136  // Save the track extras
137  edm::OrphanHandle<reco::TrackExtraCollection> theRecoTrackExtras = ev.put(std::move(recoTrackExtras));
138 
139  // Add the reference to the track extra in the tracks
140  for (unsigned index = 0; index < nTracks; ++index) {
141  const reco::TrackExtraRef theTrackExtraRef(theRecoTrackExtras, index);
142  (recoTracks->at(index)).setExtra(theTrackExtraRef);
143  }
144 
145  // Save the tracks
146  edm::OrphanHandle<reco::TrackCollection> theRecoTracks = ev.put(std::move(recoTracks));
147 
148  // Save the trajectories
149  edm::OrphanHandle<vector<Trajectory>> theRecoTrajectories = ev.put(std::move(recoTrajectories));
150 
151  // Create and set the trajectory/track association map
152  for (unsigned index = 0; index < nTracks; ++index) {
153  edm::Ref<vector<Trajectory>> trajRef(theRecoTrajectories, index);
154  edm::Ref<reco::TrackCollection> tkRef(theRecoTracks, index);
155  recoTrajTrackMap->insert(trajRef, tkRef);
156  }
157 
158  // Save the association map
159  ev.put(std::move(recoTrajTrackMap));
160 }
size_t recHitsSize() const
Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits)...
Definition: Track.h:97
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
Definition: Track.h:68
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:62
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:65
const edm::RefToBase< TrajectorySeed > & seedRef() const
Definition: Track.h:155
key_type key() const
Accessor for product key.
Definition: Ref.h:250
TrackAlgorithm
track algorithm
Definition: TrackBase.h:89
#define LogTrace(id)
const_iterator end() const
last iterator over the map (read only)
CovarianceMatrix innerStateCovariance() const
innermost trajectory state curvilinear errors
Definition: Track.h:71
size_type size() const
map size
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
Definition: Track.h:82
uint32_t nh
bool innerOk() const
return true if the innermost hit is valid
Definition: Track.h:53
const PropagationDirection & seedDirection() const
direction of how the hits were sorted in the original seed
Definition: Track.h:148
std::vector< Tags > trackProducers
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
Definition: Track.h:79
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits
const_iterator begin() const
first iterator over the map (read only)
trackProducer
Run2: False; Run1: True.
Definition: L1TCSCTF_cfi.py:12
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
Definition: Track.h:59
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:56
def move(src, dest)
Definition: eostools.py:511
bool outerOk() const
return true if the outermost hit is valid
Definition: Track.h:50
void labelsForToken(EDGetToken iToken, Labels &oLabels) const

Member Data Documentation

◆ trackProducers

std::vector<Tags> TrackListCombiner::trackProducers
private

Definition at line 31 of file TrackListCombiner.h.