test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
TrajectorySeedFromMuonProducer Class Reference
Inheritance diagram for TrajectorySeedFromMuonProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 TrajectorySeedFromMuonProducer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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 & 
itemsToGetFromEvent () 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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::InputTag muonCollectionTag_
 
edm::EDGetTokenT< edm::View
< reco::Muon > > 
muonCollectionToken_
 
bool skipMatchedMuons_
 
edm::InputTag trackCollectionTag_
 
edm::EDGetTokenT
< reco::TrackCollection
trackCollectionToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Detailed Description

Definition at line 47 of file TrajectorySeedFromMuonProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 63 of file TrajectorySeedFromMuonProducer.cc.

References edm::ParameterSet::getParameter(), muonCollectionTag_, muonCollectionToken_, skipMatchedMuons_, trackCollectionTag_, and trackCollectionToken_.

64 {
65  muonCollectionTag_ = iConfig.getParameter<edm::InputTag>("muonCollectionTag");
66  trackCollectionTag_ = iConfig.getParameter<edm::InputTag>("trackCollectionTag");
67  skipMatchedMuons_ = iConfig.getParameter<bool>("skipMatchedMuons");
68 
69  muonCollectionToken_ = consumes<edm::View<reco::Muon> >(muonCollectionTag_);
70  trackCollectionToken_ = consumes<reco::TrackCollection> (trackCollectionTag_);
71 
72  produces<TrajectorySeedCollection>();
73 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
edm::EDGetTokenT< edm::View< reco::Muon > > muonCollectionToken_

Member Function Documentation

void TrajectorySeedFromMuonProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 76 of file TrajectorySeedFromMuonProducer.cc.

References RecoTauCleanerPlugins::charge, muonid::findOppositeTrack(), edm::EventSetup::get(), edm::Event::getByToken(), edm::Ref< C, T, F >::isNonnull(), LogTrace, HLT_25ns10e33_v2_cff::magneticField, eostools::move(), metsig::muon, muonCollectionToken_, oppositeToMomentum, trajectoryStateTransform::persistentState(), edm::OwnVector< T, P >::push_back(), edm::Event::put(), DetId::rawId(), dt_dqm_sourceclient_common_cff::reco, mps_fire::result, skipMatchedMuons_, and trackCollectionToken_.

77 {
78  using namespace edm;
79  using namespace reco;
80  using namespace std;
81 
82  // Product
83  auto result = std::make_unique<TrajectorySeedCollection>();
84 
87 
88  edm::ESHandle<TrackerGeometry> trackerGeometry;
89  iSetup.get<TrackerDigiGeometryRecord>().get(trackerGeometry);
90 
91 
92 
93  edm::Handle<edm::View<Muon> > muonCollectionHandle;
94  iEvent.getByToken(muonCollectionToken_, muonCollectionHandle);
95 
96  edm::Handle<reco::TrackCollection> trackCollectionHandle;
97  iEvent.getByToken(trackCollectionToken_, trackCollectionHandle);
98 
99  // Loop over the muon track
100  for (edm::View<Muon>::const_iterator muon = muonCollectionHandle->begin(); muon != muonCollectionHandle->end(); ++muon) {
101  // muon must have a tracker track
102  if( muon->innerTrack().isNull() ) continue;
103  edm::RefToBase<reco::Track> track(muon->innerTrack());
104  // check if there is a back-to-back track
105  if( skipMatchedMuons_ &&
106  muonid::findOppositeTrack(trackCollectionHandle, *track).isNonnull() ) continue;
107  if( (!track->innerOk()) || (!track->recHit(0)->isValid())) continue;
108  GlobalPoint innerPosition(track->innerPosition().x(), track->innerPosition().y(), track->innerPosition().z());
109  GlobalVector innerMomentum(track->innerMomentum().x(), track->innerMomentum().y(), track->innerMomentum().z());
110  int charge = track->charge();
111  const reco::Track::CovarianceMatrix innerStateCovariance = track->innerStateCovariance();
112  DetId innerDetId = DetId(track->innerDetId());
113  // Construct the information necessary to make a TrajectoryStateOnSurface
114  GlobalTrajectoryParameters globalTrajParams(innerPosition, innerMomentum, charge, &(*magneticField));
115  CurvilinearTrajectoryError curviError(innerStateCovariance);
116  FreeTrajectoryState tracker_state(globalTrajParams, curviError);
117  LogTrace("MuonIdentification") << "Track Inner FTS: "<<tracker_state;
118 
119  TrajectoryStateOnSurface tracker_tsos = TrajectoryStateOnSurface(globalTrajParams, curviError, trackerGeometry->idToDet(innerDetId)->surface());
120 
121  // Make Hits, push back the innermost Hit
123  trackHits.push_back(track->recHit(0)->clone() );
124 
125  // Make TrajectorySeed
126  PTrajectoryStateOnDet const & PTraj = trajectoryStateTransform::persistentState(tracker_tsos, innerDetId.rawId());
127  TrajectorySeed trajectorySeed(PTraj, trackHits, oppositeToMomentum);
128  LogTrace("MuonIdentification")<<"Trajectory Seed Direction: "<< trajectorySeed.direction()<<endl;
129  result->push_back(trajectorySeed);
130  }
131 
132  iEvent.put(std::move(result));
133 
134 }
edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
reco::TrackRef findOppositeTrack(const edm::Handle< reco::TrackCollection > &collection, const reco::Track &muon, double angleMatch=0.01, double momentumMatch=0.05)
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
edm::EDGetTokenT< edm::View< reco::Muon > > muonCollectionToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
tuple result
Definition: mps_fire.py:84
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
void push_back(D *&d)
Definition: OwnVector.h:290
def move
Definition: eostools.py:510
#define LogTrace(id)
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:56
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:77

Member Data Documentation

edm::InputTag TrajectorySeedFromMuonProducer::muonCollectionTag_
private

Definition at line 55 of file TrajectorySeedFromMuonProducer.cc.

Referenced by TrajectorySeedFromMuonProducer().

edm::EDGetTokenT<edm::View<reco::Muon> > TrajectorySeedFromMuonProducer::muonCollectionToken_
private

Definition at line 57 of file TrajectorySeedFromMuonProducer.cc.

Referenced by produce(), and TrajectorySeedFromMuonProducer().

bool TrajectorySeedFromMuonProducer::skipMatchedMuons_
private

Definition at line 59 of file TrajectorySeedFromMuonProducer.cc.

Referenced by produce(), and TrajectorySeedFromMuonProducer().

edm::InputTag TrajectorySeedFromMuonProducer::trackCollectionTag_
private

Definition at line 56 of file TrajectorySeedFromMuonProducer.cc.

Referenced by TrajectorySeedFromMuonProducer().

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

Definition at line 58 of file TrajectorySeedFromMuonProducer.cc.

Referenced by produce(), and TrajectorySeedFromMuonProducer().