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
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 DeDxDiscriminatorTools::charge(), muonid::findOppositeTrack(), edm::EventSetup::get(), edm::Event::getByToken(), edm::Ref< C, T, F >::isNonnull(), LogTrace, metsig::muon, muonCollectionToken_, oppositeToMomentum, trajectoryStateTransform::persistentState(), edm::OwnVector< T, P >::push_back(), edm::Event::put(), DetId::rawId(), dt_dqm_sourceclient_common_cff::reco, query::result, skipMatchedMuons_, and trackCollectionToken_.

77 {
78  using namespace edm;
79  using namespace reco;
80  using namespace std;
81 
82  // Product
83  std::auto_ptr<TrajectorySeedCollection> result(new TrajectorySeedCollection());
84 
85  edm::ESHandle<MagneticField> magneticField;
86  iSetup.get<IdealMagneticFieldRecord>().get(magneticField);
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(result);
133 
134 }
edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
reco::TrackRef findOppositeTrack(const edm::Handle< reco::TrackCollection > &collection, const reco::Track &muon, double angleMatch=0.01, double momentumMatch=0.05)
edm::EDGetTokenT< edm::View< reco::Muon > > muonCollectionToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
double charge(const std::vector< uint8_t > &Ampls)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
void push_back(D *&d)
Definition: OwnVector.h:274
std::vector< TrajectorySeed > TrajectorySeedCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
tuple result
Definition: query.py:137
#define LogTrace(id)
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:55
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:70

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().