CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TrackInfoProducer Class Reference
Inheritance diagram for TrackInfoProducer:
edm::stream::EDProducer<>

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
 TrackInfoProducer (const edm::ParameterSet &iConfig)
 
 ~TrackInfoProducer () override
 
- Public Member Functions inherited from edm::stream::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
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 32 of file TrackInfoProducer.cc.

Constructor & Destructor Documentation

◆ TrackInfoProducer()

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

Definition at line 49 of file TrackInfoProducer.cc.

51  theAlgo_(iConfig),
52  TrajectoryToken_(consumes<std::vector<Trajectory> >(iConfig.getParameter<edm::InputTag>("cosmicTracks"))),
53  trackCollectionToken_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("cosmicTracks"))),
54  assoMapToken_(consumes<TrajTrackAssociationCollection>(iConfig.getParameter<edm::InputTag>("cosmicTracks"))) {
55  produces<reco::TrackInfoCollection>();
56  produces<reco::TrackInfoTrackAssociationCollection>();
57 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< TrajTrackAssociationCollection > assoMapToken_
edm::EDGetTokenT< std::vector< Trajectory > > TrajectoryToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
TrackInfoProducerAlgorithm theAlgo_
edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_

◆ ~TrackInfoProducer()

TrackInfoProducer::~TrackInfoProducer ( )
inlineoverride

Definition at line 36 of file TrackInfoProducer.cc.

36 {};

Member Function Documentation

◆ produce()

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

Definition at line 59 of file TrackInfoProducer.cc.

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

59  {
60  //
61  // create empty output collections
62  //
63  std::unique_ptr<reco::TrackInfoCollection> outputColl(new reco::TrackInfoCollection);
64 
65  const TrackerGeometry* tracker = &setup.getData(tkGeomToken_);
66 
70 
73  theEvent.getByToken(assoMapToken_, assoMap);
74 
75  //
76  //run the algorithm
77  //
79 
80  edm::LogInfo("TrackInfoProducer") << "Loop on trajectories";
81  std::map<reco::TrackRef, unsigned int> trackid;
82  int i = 0;
83 
84  for (TrajTrackAssociationCollection::const_iterator it = assoMap->begin(); it != assoMap->end(); ++it) {
85  const edm::Ref<std::vector<Trajectory> > traj = it->key;
86  const reco::TrackRef track = it->val;
87  trackid.insert(make_pair(track, i));
88  i++;
89  theAlgo_.run(traj, track, output, tracker);
90  outputColl->push_back(output);
91  }
92 
93  //put everything in the event
95 
96  // if(forwardPredictedStateTag_!="") rTrackInfof = theEvent.put(std::move(outputFwdColl),forwardPredictedStateTag_ );
97  // if(backwardPredictedStateTag_!="") rTrackInfob = theEvent.put(std::move(outputBwdColl),backwardPredictedStateTag_);
98  // if(updatedStateTag_!="") rTrackInfou = theEvent.put(std::move(outputUpdatedColl),updatedStateTag_ );
99  // if(combinedStateTag_!="") rTrackInfoc = theEvent.put(std::move(outputCombinedColl),combinedStateTag_ );
100  rTrackInfo = theEvent.put(std::move(outputColl));
101  std::unique_ptr<reco::TrackInfoTrackAssociationCollection> TIassociationColl(
102  new reco::TrackInfoTrackAssociationCollection(assoMap->refProd().val, rTrackInfo));
103 
104  for (std::map<reco::TrackRef, unsigned int>::iterator ref_iter = trackid.begin(); ref_iter != trackid.end();
105  ++ref_iter) {
106  TIassociationColl->insert(ref_iter->first, edm::Ref<reco::TrackInfoCollection>(rTrackInfo, ref_iter->second));
107  }
108 
109  theEvent.put(std::move(TIassociationColl));
110 }
edm::EDGetTokenT< TrajTrackAssociationCollection > assoMapToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
const ref_type & refProd() const
return ref-prod structure
edm::EDGetTokenT< std::vector< Trajectory > > TrajectoryToken_
key_type key() const
Accessor for product key.
Definition: Ref.h:250
const_iterator end() const
last iterator over the map (read only)
std::vector< TrackInfo > TrackInfoCollection
collection of TrackInfos
Definition: TrackInfoFwd.h:9
Log< level::Info, false > LogInfo
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
TrackInfoProducerAlgorithm theAlgo_
std::vector< Trajectory > TrajectoryCollection
const_iterator begin() const
first iterator over the map (read only)
void run(const edm::Ref< std::vector< Trajectory > > traj_iterator, reco::TrackRef track, reco::TrackInfo &output, const TrackerGeometry *tracker)
edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ assoMapToken_

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

Definition at line 45 of file TrackInfoProducer.cc.

Referenced by produce().

◆ backwardPredictedStateTag_

std::string TrackInfoProducer::backwardPredictedStateTag_
private

Definition at line 46 of file TrackInfoProducer.cc.

◆ combinedStateTag_

std::string TrackInfoProducer::combinedStateTag_
private

Definition at line 46 of file TrackInfoProducer.cc.

◆ forwardPredictedStateTag_

std::string TrackInfoProducer::forwardPredictedStateTag_
private

Definition at line 46 of file TrackInfoProducer.cc.

◆ theAlgo_

TrackInfoProducerAlgorithm TrackInfoProducer::theAlgo_
private

Definition at line 42 of file TrackInfoProducer.cc.

Referenced by produce().

◆ tkGeomToken_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> TrackInfoProducer::tkGeomToken_
private

Definition at line 41 of file TrackInfoProducer.cc.

Referenced by produce().

◆ trackCollectionToken_

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

Definition at line 44 of file TrackInfoProducer.cc.

Referenced by produce().

◆ TrajectoryToken_

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

Definition at line 43 of file TrackInfoProducer.cc.

Referenced by produce().

◆ updatedStateTag_

std::string TrackInfoProducer::updatedStateTag_
private

Definition at line 46 of file TrackInfoProducer.cc.