CMS 3D CMS Logo

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

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
 TrajectorySeedFromMuonProducer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagneticFieldToken_
 
edm::InputTag muonCollectionTag_
 
edm::EDGetTokenT< edm::View< reco::Muon > > muonCollectionToken_
 
bool skipMatchedMuons_
 
edm::InputTag trackCollectionTag_
 
edm::EDGetTokenT< reco::TrackCollectiontrackCollectionToken_
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtrackerGeometryToken_
 

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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 48 of file TrajectorySeedFromMuonProducer.cc.

Constructor & Destructor Documentation

◆ TrajectorySeedFromMuonProducer()

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

Definition at line 63 of file TrajectorySeedFromMuonProducer.cc.

63  {
64  muonCollectionTag_ = iConfig.getParameter<edm::InputTag>("muonCollectionTag");
65  trackCollectionTag_ = iConfig.getParameter<edm::InputTag>("trackCollectionTag");
66  skipMatchedMuons_ = iConfig.getParameter<bool>("skipMatchedMuons");
67 
68  muonCollectionToken_ = consumes<edm::View<reco::Muon> >(muonCollectionTag_);
69  trackCollectionToken_ = consumes<reco::TrackCollection>(trackCollectionTag_);
70  magneticFieldToken_ = esConsumes<MagneticField, IdealMagneticFieldRecord>();
71  trackerGeometryToken_ = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>();
72 
73  produces<TrajectorySeedCollection>();
74 }

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

Member Function Documentation

◆ produce()

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

Definition at line 76 of file TrajectorySeedFromMuonProducer.cc.

76  {
77  using namespace edm;
78  using namespace reco;
79  using namespace std;
80 
81  // Product
82  auto result = std::make_unique<TrajectorySeedCollection>();
83 
85 
87 
88  edm::Handle<edm::View<Muon> > muonCollectionHandle;
89  iEvent.getByToken(muonCollectionToken_, muonCollectionHandle);
90 
91  edm::Handle<reco::TrackCollection> trackCollectionHandle;
92  iEvent.getByToken(trackCollectionToken_, trackCollectionHandle);
93 
94  // Loop over the muon track
95  for (edm::View<Muon>::const_iterator muon = muonCollectionHandle->begin(); muon != muonCollectionHandle->end();
96  ++muon) {
97  // muon must have a tracker track
98  if (muon->innerTrack().isNull())
99  continue;
100  edm::RefToBase<reco::Track> track(muon->innerTrack());
101  // check if there is a back-to-back track
102  if (skipMatchedMuons_ && muonid::findOppositeTrack(trackCollectionHandle, *track).isNonnull())
103  continue;
104  if ((!track->innerOk()) || (!track->recHit(0)->isValid()))
105  continue;
106  GlobalPoint innerPosition(track->innerPosition().x(), track->innerPosition().y(), track->innerPosition().z());
107  GlobalVector innerMomentum(track->innerMomentum().x(), track->innerMomentum().y(), track->innerMomentum().z());
108  int charge = track->charge();
109  const reco::Track::CovarianceMatrix innerStateCovariance = track->innerStateCovariance();
110  DetId innerDetId = DetId(track->innerDetId());
111  // Construct the information necessary to make a TrajectoryStateOnSurface
112  GlobalTrajectoryParameters globalTrajParams(innerPosition, innerMomentum, charge, &(*magneticField));
113  CurvilinearTrajectoryError curviError(innerStateCovariance);
114  FreeTrajectoryState tracker_state(globalTrajParams, curviError);
115  LogTrace("MuonIdentification") << "Track Inner FTS: " << tracker_state;
116 
117  TrajectoryStateOnSurface tracker_tsos =
118  TrajectoryStateOnSurface(globalTrajParams, curviError, trackerGeometry->idToDet(innerDetId)->surface());
119 
120  // Make Hits, push back the innermost Hit
122  trackHits.push_back(track->recHit(0)->clone());
123 
124  // Make TrajectorySeed
125  PTrajectoryStateOnDet const& PTraj = trajectoryStateTransform::persistentState(tracker_tsos, innerDetId.rawId());
126  TrajectorySeed trajectorySeed(PTraj, trackHits, oppositeToMomentum);
127  LogTrace("MuonIdentification") << "Trajectory Seed Direction: " << trajectorySeed.direction() << endl;
128  result->push_back(trajectorySeed);
129  }
130 
131  iEvent.put(std::move(result));
132 }

References ALCARECOTkAlJpsiMuMu_cff::charge, muonid::findOppositeTrack(), edm::EventSetup::getHandle(), TrackerGeometry::idToDet(), iEvent, edm::Ref< C, T, F >::isNonnull(), LogTrace, HLT_FULL_cff::magneticField, magneticFieldToken_, eostools::move(), HLT_FULL_cff::muon, muonCollectionToken_, oppositeToMomentum, trajectoryStateTransform::persistentState(), edm::OwnVector< T, P >::push_back(), DetId::rawId(), mps_fire::result, skipMatchedMuons_, GeomDet::surface(), HLT_FULL_cff::track, trackCollectionToken_, and trackerGeometryToken_.

Member Data Documentation

◆ magneticFieldToken_

edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> TrajectorySeedFromMuonProducer::magneticFieldToken_
private

Definition at line 58 of file TrajectorySeedFromMuonProducer.cc.

Referenced by produce(), and TrajectorySeedFromMuonProducer().

◆ muonCollectionTag_

edm::InputTag TrajectorySeedFromMuonProducer::muonCollectionTag_
private

Definition at line 54 of file TrajectorySeedFromMuonProducer.cc.

Referenced by TrajectorySeedFromMuonProducer().

◆ muonCollectionToken_

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

Definition at line 56 of file TrajectorySeedFromMuonProducer.cc.

Referenced by produce(), and TrajectorySeedFromMuonProducer().

◆ skipMatchedMuons_

bool TrajectorySeedFromMuonProducer::skipMatchedMuons_
private

Definition at line 60 of file TrajectorySeedFromMuonProducer.cc.

Referenced by produce(), and TrajectorySeedFromMuonProducer().

◆ trackCollectionTag_

edm::InputTag TrajectorySeedFromMuonProducer::trackCollectionTag_
private

Definition at line 55 of file TrajectorySeedFromMuonProducer.cc.

Referenced by TrajectorySeedFromMuonProducer().

◆ trackCollectionToken_

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

Definition at line 57 of file TrajectorySeedFromMuonProducer.cc.

Referenced by produce(), and TrajectorySeedFromMuonProducer().

◆ trackerGeometryToken_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> TrajectorySeedFromMuonProducer::trackerGeometryToken_
private

Definition at line 59 of file TrajectorySeedFromMuonProducer.cc.

Referenced by produce(), and TrajectorySeedFromMuonProducer().

Vector3DBase
Definition: Vector3DBase.h:8
TrackerGeometry::idToDet
const TrackerGeomDet * idToDet(DetId) const override
Definition: TrackerGeometry.cc:193
TrajectorySeedFromMuonProducer::muonCollectionTag_
edm::InputTag muonCollectionTag_
Definition: TrajectorySeedFromMuonProducer.cc:54
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11776
muon
Definition: MuonCocktails.h:17
edm
HLT enums.
Definition: AlignableModifier.h:19
trajectoryStateTransform::persistentState
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
Definition: TrajectoryStateTransform.cc:14
oppositeToMomentum
Definition: PropagationDirection.h:4
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
HLT_FULL_cff.magneticField
magneticField
Definition: HLT_FULL_cff.py:348
edm::Handle
Definition: AssociativeIterator.h:50
TrajectorySeedFromMuonProducer::trackCollectionTag_
edm::InputTag trackCollectionTag_
Definition: TrajectorySeedFromMuonProducer.cc:55
DetId
Definition: DetId.h:17
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
TrajectorySeedFromMuonProducer::trackCollectionToken_
edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
Definition: TrajectorySeedFromMuonProducer.cc:57
TrajectorySeedFromMuonProducer::muonCollectionToken_
edm::EDGetTokenT< edm::View< reco::Muon > > muonCollectionToken_
Definition: TrajectorySeedFromMuonProducer.cc:56
CurvilinearTrajectoryError
Definition: CurvilinearTrajectoryError.h:27
HLT_FULL_cff.muon
muon
Definition: HLT_FULL_cff.py:11773
edm::ESHandle< MagneticField >
GlobalTrajectoryParameters
Definition: GlobalTrajectoryParameters.h:15
Point3DBase< float, GlobalTag >
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
TrajectorySeedFromMuonProducer::magneticFieldToken_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
Definition: TrajectorySeedFromMuonProducer.cc:58
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
TrajectorySeedFromMuonProducer::trackerGeometryToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
Definition: TrajectorySeedFromMuonProducer.cc:59
TrajectorySeedFromMuonProducer::skipMatchedMuons_
bool skipMatchedMuons_
Definition: TrajectorySeedFromMuonProducer.cc:60
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
TrajectorySeed
Definition: TrajectorySeed.h:18
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::RefToBase< reco::Track >
edm::OwnVector::push_back
void push_back(D *&d)
Definition: OwnVector.h:326
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
mps_fire.result
result
Definition: mps_fire.py:311
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
PTrajectoryStateOnDet
Definition: PTrajectoryStateOnDet.h:10
muonid::findOppositeTrack
reco::TrackRef findOppositeTrack(const edm::Handle< reco::TrackCollection > &collection, const reco::Track &muon, double angleMatch=0.01, double momentumMatch=0.05)
Definition: MuonCosmicsId.cc:28
reco::TrackBase::CovarianceMatrix
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:74
edm::InputTag
Definition: InputTag.h:15
edm::OwnVector< TrackingRecHit >