CMS 3D CMS Logo

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

#include <TrackInfoProducer.h>

Inheritance diagram for TrackInfoProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
 TrackInfoProducer (const edm::ParameterSet &iConfig)
 
 ~TrackInfoProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::EDGetTokenT< TrajTrackAssociationCollectionassoMapToken_
 
std::string backwardPredictedStateTag_
 
std::string combinedStateTag_
 
std::string forwardPredictedStateTag_
 
TrackInfoProducerAlgorithm theAlgo_
 
edm::EDGetTokenT< reco::TrackCollectiontrackCollectionToken_
 
edm::EDGetTokenT< std::vector< Trajectory > > TrajectoryToken_
 
std::string updatedStateTag_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 25 of file TrackInfoProducer.h.

Constructor & Destructor Documentation

◆ TrackInfoProducer()

TrackInfoProducer::TrackInfoProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 11 of file TrackInfoProducer.cc.

12  : theAlgo_(iConfig),
13  TrajectoryToken_(consumes<std::vector<Trajectory> >(iConfig.getParameter<edm::InputTag>("cosmicTracks"))),
14  trackCollectionToken_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("cosmicTracks"))),
15  assoMapToken_(consumes<TrajTrackAssociationCollection>(iConfig.getParameter<edm::InputTag>("cosmicTracks"))) {
16  produces<reco::TrackInfoCollection>();
17  produces<reco::TrackInfoTrackAssociationCollection>();
18 }

◆ ~TrackInfoProducer()

TrackInfoProducer::~TrackInfoProducer ( )
inlineoverride

Definition at line 30 of file TrackInfoProducer.h.

30 {};

Member Function Documentation

◆ produce()

void TrackInfoProducer::produce ( edm::Event theEvent,
const edm::EventSetup setup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 20 of file TrackInfoProducer.cc.

20  {
21  //
22  // create empty output collections
23  //
24 
25  std::unique_ptr<reco::TrackInfoCollection> outputColl(new reco::TrackInfoCollection);
26 
30 
32  setup.get<TrackerDigiGeometryRecord>().get(tkgeom);
33  const TrackerGeometry* tracker = &(*tkgeom);
34 
37  theEvent.getByToken(assoMapToken_, assoMap);
38 
39  //
40  //run the algorithm
41  //
43 
44  edm::LogInfo("TrackInfoProducer") << "Loop on trajectories";
45  std::map<reco::TrackRef, unsigned int> trackid;
46  int i = 0;
47 
48  for (TrajTrackAssociationCollection::const_iterator it = assoMap->begin(); it != assoMap->end(); ++it) {
49  const edm::Ref<std::vector<Trajectory> > traj = it->key;
50  const reco::TrackRef track = it->val;
51  trackid.insert(make_pair(track, i));
52  i++;
53  theAlgo_.run(traj, track, output, tracker);
54  outputColl->push_back(output);
55  }
56 
57  //put everything in the event
59 
60  // if(forwardPredictedStateTag_!="") rTrackInfof = theEvent.put(std::move(outputFwdColl),forwardPredictedStateTag_ );
61  // if(backwardPredictedStateTag_!="") rTrackInfob = theEvent.put(std::move(outputBwdColl),backwardPredictedStateTag_);
62  // if(updatedStateTag_!="") rTrackInfou = theEvent.put(std::move(outputUpdatedColl),updatedStateTag_ );
63  // if(combinedStateTag_!="") rTrackInfoc = theEvent.put(std::move(outputCombinedColl),combinedStateTag_ );
64  rTrackInfo = theEvent.put(std::move(outputColl));
65  std::unique_ptr<reco::TrackInfoTrackAssociationCollection> TIassociationColl(
66  new reco::TrackInfoTrackAssociationCollection(assoMap->refProd().val, rTrackInfo));
67 
68  for (std::map<reco::TrackRef, unsigned int>::iterator ref_iter = trackid.begin(); ref_iter != trackid.end();
69  ++ref_iter) {
70  TIassociationColl->insert(ref_iter->first, edm::Ref<reco::TrackInfoCollection>(rTrackInfo, ref_iter->second));
71  }
72 
73  theEvent.put(std::move(TIassociationColl));
74 }

References assoMapToken_, edm::AssociationMap< Tag >::begin(), edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, edm::AssociationMap< Tag >::end(), get, edm::Event::getByToken(), mps_fire::i, edm::Ref< C, T, F >::key(), eostools::move(), convertSQLitetoXML_cfg::output, HLT_2018_cff::outputColl, edm::Event::put(), edm::AssociationMap< Tag >::refProd(), TrackInfoProducerAlgorithm::run(), singleTopDQM_cfi::setup, theAlgo_, HLT_2018_cff::track, duplicaterechits_cfi::trackCollection, trackCollectionToken_, PbPb_ZMuSkimMuonDPG_cff::tracker, and TrajectoryToken_.

Member Data Documentation

◆ assoMapToken_

edm::EDGetTokenT<TrajTrackAssociationCollection> TrackInfoProducer::assoMapToken_
private

Definition at line 38 of file TrackInfoProducer.h.

Referenced by produce().

◆ backwardPredictedStateTag_

std::string TrackInfoProducer::backwardPredictedStateTag_
private

Definition at line 39 of file TrackInfoProducer.h.

◆ combinedStateTag_

std::string TrackInfoProducer::combinedStateTag_
private

Definition at line 39 of file TrackInfoProducer.h.

◆ forwardPredictedStateTag_

std::string TrackInfoProducer::forwardPredictedStateTag_
private

Definition at line 39 of file TrackInfoProducer.h.

◆ theAlgo_

TrackInfoProducerAlgorithm TrackInfoProducer::theAlgo_
private

Definition at line 35 of file TrackInfoProducer.h.

Referenced by produce().

◆ trackCollectionToken_

edm::EDGetTokenT<reco::TrackCollection> TrackInfoProducer::trackCollectionToken_
private

Definition at line 37 of file TrackInfoProducer.h.

Referenced by produce().

◆ TrajectoryToken_

edm::EDGetTokenT<std::vector<Trajectory> > TrackInfoProducer::TrajectoryToken_
private

Definition at line 36 of file TrackInfoProducer.h.

Referenced by produce().

◆ updatedStateTag_

std::string TrackInfoProducer::updatedStateTag_
private

Definition at line 39 of file TrackInfoProducer.h.

mps_fire.i
i
Definition: mps_fire.py:355
TrackInfoProducer::TrajectoryToken_
edm::EDGetTokenT< std::vector< Trajectory > > TrajectoryToken_
Definition: TrackInfoProducer.h:36
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
reco::TrackInfo
Definition: TrackInfo.h:23
edm::LogInfo
Definition: MessageLogger.h:254
edm::Handle
Definition: AssociativeIterator.h:50
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
edm::Ref
Definition: AssociativeIterator.h:58
TrackInfoProducer::assoMapToken_
edm::EDGetTokenT< TrajTrackAssociationCollection > assoMapToken_
Definition: TrackInfoProducer.h:38
edm::AssociationMap::end
const_iterator end() const
last iterator over the map (read only)
Definition: AssociationMap.h:171
TrackInfoProducer::theAlgo_
TrackInfoProducerAlgorithm theAlgo_
Definition: TrackInfoProducer.h:35
edm::AssociationMap::refProd
const ref_type & refProd() const
return ref-prod structure
Definition: AssociationMap.h:217
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
edm::ESHandle< TrackerGeometry >
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator
friend struct const_iterator
Definition: AssociationMap.h:274
HLT_2018_cff.outputColl
outputColl
Definition: HLT_2018_cff.py:78853
duplicaterechits_cfi.trackCollection
trackCollection
Definition: duplicaterechits_cfi.py:4
edm::AssociationMap
Definition: AssociationMap.h:48
reco::TrackInfoCollection
std::vector< TrackInfo > TrackInfoCollection
collection of TrackInfos
Definition: TrackInfoFwd.h:9
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:132
TrackInfoProducer::trackCollectionToken_
edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
Definition: TrackInfoProducer.h:37
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::OrphanHandle
Definition: EDProductfwd.h:39
TrackInfoProducerAlgorithm::run
void run(const edm::Ref< std::vector< Trajectory > > traj_iterator, reco::TrackRef track, reco::TrackInfo &output, const TrackerGeometry *tracker)
Definition: TrackInfoProducerAlgorithm.cc:16
edm::AssociationMap::begin
const_iterator begin() const
first iterator over the map (read only)
Definition: AssociationMap.h:169
edm::Ref::key
key_type key() const
Accessor for product key.
Definition: Ref.h:250
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:126
TrajectoryCollection
std::vector< Trajectory > TrajectoryCollection
Definition: TrajectoryToSeedMap.h:17
edm::InputTag
Definition: InputTag.h:15
TrackerGeometry
Definition: TrackerGeometry.h:14