CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< TrajTrackAssociationCollection
assoMapToken_
 
std::string backwardPredictedStateTag_
 
std::string combinedStateTag_
 
std::string forwardPredictedStateTag_
 
TrackInfoProducerAlgorithm theAlgo_
 
edm::ESGetToken
< TrackerGeometry,
TrackerDigiGeometryRecord
tkGeomToken_
 
edm::EDGetTokenT
< reco::TrackCollection
trackCollectionToken_
 
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 ( 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 }
edm::EDGetTokenT< TrajTrackAssociationCollection > assoMapToken_
edm::EDGetTokenT< std::vector< Trajectory > > TrajectoryToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
TrackInfoProducerAlgorithm theAlgo_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
TrackInfoProducer::~TrackInfoProducer ( )
inlineoverride

Definition at line 36 of file TrackInfoProducer.cc.

36 {};

Member Function Documentation

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

Definition at line 59 of file TrackInfoProducer.cc.

References assoMapToken_, edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, edm::Event::getByToken(), edm::EventSetup::getData(), mps_fire::i, edm::Ref< C, T, F >::key(), eostools::move(), convertSQLitetoXML_cfg::output, HLT_FULL_cff::outputColl, edm::Event::put(), TrackInfoProducerAlgorithm::run(), theAlgo_, tkGeomToken_, HLT_FULL_cff::track, HLT_FULL_cff::trackCollection, trackCollectionToken_, 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 
71  theEvent.getByToken(TrajectoryToken_, TrajectoryCollection);
72  theEvent.getByToken(trackCollectionToken_, trackCollection);
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
key_type key() const
Accessor for product key.
Definition: Ref.h:250
edm::EDGetTokenT< std::vector< Trajectory > > TrajectoryToken_
bool getData(T &iHolder) const
Definition: EventSetup.h:128
def move
Definition: eostools.py:511
std::vector< TrackInfo > TrackInfoCollection
collection of TrackInfos
Definition: TrackInfoFwd.h:9
Log< level::Info, false > LogInfo
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
TrackInfoProducerAlgorithm theAlgo_
tuple trackCollection
std::vector< Trajectory > TrajectoryCollection
void run(const edm::Ref< std::vector< Trajectory > > traj_iterator, reco::TrackRef track, reco::TrackInfo &output, const TrackerGeometry *tracker)
edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_

Member Data Documentation

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

Definition at line 45 of file TrackInfoProducer.cc.

Referenced by produce().

std::string TrackInfoProducer::backwardPredictedStateTag_
private

Definition at line 46 of file TrackInfoProducer.cc.

std::string TrackInfoProducer::combinedStateTag_
private

Definition at line 46 of file TrackInfoProducer.cc.

std::string TrackInfoProducer::forwardPredictedStateTag_
private

Definition at line 46 of file TrackInfoProducer.cc.

TrackInfoProducerAlgorithm TrackInfoProducer::theAlgo_
private

Definition at line 42 of file TrackInfoProducer.cc.

Referenced by produce().

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

Definition at line 41 of file TrackInfoProducer.cc.

Referenced by produce().

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

Definition at line 44 of file TrackInfoProducer.cc.

Referenced by produce().

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

Definition at line 43 of file TrackInfoProducer.cc.

Referenced by produce().

std::string TrackInfoProducer::updatedStateTag_
private

Definition at line 46 of file TrackInfoProducer.cc.