CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
FastTSGFromIOHit Class Reference

#include <FastTSGFromIOHit.h>

Inheritance diagram for FastTSGFromIOHit:
TrackerSeedGenerator

Public Member Functions

 FastTSGFromIOHit (const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
 constructor More...
 
void trackerSeeds (const TrackCand &, const TrackingRegion &, const TrackerTopology *tTopo, std::vector< TrajectorySeed > &) override
 generate seed(s) for a track More...
 
 ~FastTSGFromIOHit () override
 destructor More...
 
- Public Member Functions inherited from TrackerSeedGenerator
const edm::EventgetEvent () const
 
virtual void init (const MuonServiceProxy *service)
 
virtual void setEvent (const edm::Event &)
 
 TrackerSeedGenerator ()
 
virtual void trackerSeeds (const TrackCand &, const TrackingRegion &, const TrackerTopology *, BTSeedCollection &)
 
virtual ~TrackerSeedGenerator ()
 destructor More...
 

Private Member Functions

bool clean (reco::TrackRef muRef, const RectangularEtaPhiTrackingRegion &region, const BasicTrajectorySeed *aSeed, const SimTrack &theSimTrack)
 

Private Attributes

std::vector< edm::EDGetTokenT< TrajectorySeedCollection > > seedsTks
 
edm::EDGetTokenT< edm::SimTrackContainersimTracksTk
 
std::string theCategory
 
double thePtCut
 

Additional Inherited Members

- Public Types inherited from TrackerSeedGenerator
typedef std::vector< TrajectorySeedBTSeedCollection
 
typedef std::pair< const Trajectory *, reco::TrackRefTrackCand
 
- Protected Attributes inherited from TrackerSeedGenerator
const edm::EventtheEvent
 
const MuonServiceProxytheProxyService
 

Detailed Description

Emulate TSGFromIOHit in RecoMuon

Author
Adam Everett - Purdue University

Tracker Seed Generator by propagating and updating a standAlone muon to the first pixel hits in tracker system

Emulate TSGFromIOHit in RecoMuon

Author
Adam Everett - Purdue University

Definition at line 25 of file FastTSGFromIOHit.h.

Constructor & Destructor Documentation

FastTSGFromIOHit::FastTSGFromIOHit ( const edm::ParameterSet pset,
edm::ConsumesCollector iC 
)

constructor

Definition at line 18 of file FastTSGFromIOHit.cc.

References edm::ConsumesCollector::consumes(), edm::ParameterSet::getParameter(), seedsTks, simTracksTk, theCategory, and thePtCut.

19 {
20 
21  theCategory = "FastSimulation|Muons||FastTSGFromIOHit";
22 
23  thePtCut = iConfig.getParameter<double>("PtCut");
24 
25  simTracksTk = iC.consumes<edm::SimTrackContainer>(iConfig.getParameter<edm::InputTag>("SimTrackCollectionLabel"));
26  const auto & seedLabels = iConfig.getParameter<std::vector<edm::InputTag> >("SeedCollectionLabels");
27  for(const auto & seedLabel : seedLabels)
28  {
29  seedsTks.push_back(iC.consumes<TrajectorySeedCollection>(seedLabel));
30  }
31 
32 }
std::vector< edm::EDGetTokenT< TrajectorySeedCollection > > seedsTks
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< TrajectorySeed > TrajectorySeedCollection
std::string theCategory
edm::EDGetTokenT< edm::SimTrackContainer > simTracksTk
std::vector< SimTrack > SimTrackContainer
FastTSGFromIOHit::~FastTSGFromIOHit ( )
override

destructor

Definition at line 34 of file FastTSGFromIOHit.cc.

References LogTrace, and theCategory.

35 {
36 
37  LogTrace(theCategory) << " FastTSGFromIOHit dtor called ";
38 
39 }
#define LogTrace(id)
std::string theCategory

Member Function Documentation

bool FastTSGFromIOHit::clean ( reco::TrackRef  muRef,
const RectangularEtaPhiTrackingRegion region,
const BasicTrajectorySeed aSeed,
const SimTrack theSimTrack 
)
private

Definition at line 101 of file FastTSGFromIOHit.cc.

References hiPixelPairStep_cff::deltaPhi, TrackingRegion::direction(), MuonErrorMatrixValues_cff::etaRange, RectangularEtaPhiTrackingRegion::etaRange(), PixelRecoRange< T >::max(), PixelRecoRange< T >::mean(), CoreSimTrack::momentum(), PV3DBase< T, PVType, FrameType >::phi(), RectangularEtaPhiTrackingRegion::phiMargin(), TrackingRegion::ptMin(), ptMin, TkTrackingRegionsMargin< T >::right(), and mathSSE::sqrt().

Referenced by trackerSeeds().

105 {
106 
107  // Eta cleaner
108  const PixelRecoRange<float>& etaRange = region.etaRange() ;
109 
110  double etaSeed = theSimTrack.momentum().Eta();
111  double etaLimit = (fabs(fabs(etaRange.max())-fabs(etaRange.mean())) <0.05) ?
112  0.05 : fabs(fabs(etaRange.max()) - fabs(etaRange.mean())) ;
113  bool inEtaRange =
114  etaSeed >= (etaRange.mean() - etaLimit) &&
115  etaSeed <= (etaRange.mean() + etaLimit) ;
116  if ( !inEtaRange )
117  {
118  return false;
119  }
120 
121  // Phi cleaner
122  const TkTrackingRegionsMargin<float>& phiMargin = region.phiMargin();
123  double phiSeed = theSimTrack.momentum().Phi();
124  double phiLimit = (phiMargin.right() < 0.05 ) ? 0.05 : phiMargin.right();
125  bool inPhiRange =
126  (fabs(deltaPhi(phiSeed,double(region.direction().phi()))) < phiLimit );
127  if ( !inPhiRange )
128  {
129  return false;
130  }
131 
132  // pt cleaner
133  double ptSeed = std::sqrt(theSimTrack.momentum().Perp2());
134  double ptMin = (region.ptMin()>3.5) ? 3.5: region.ptMin();
135  bool inPtRange = ptSeed >= ptMin && ptSeed<= 2*(muRef->pt());
136  if ( !inPtRange )
137  {
138  return false;
139  }
140  return true;
141 
142 }
T max() const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
GlobalVector const & direction() const
the direction around which region is constructed
T sqrt(T t)
Definition: SSEVec.h:18
T mean() const
float ptMin() const
minimal pt of interest
const math::XYZTLorentzVectorD & momentum() const
Definition: CoreSimTrack.h:19
const Range & etaRange() const
allowed eta range [eta_min, eta_max] interval
void FastTSGFromIOHit::trackerSeeds ( const TrackCand staMuon,
const TrackingRegion region,
const TrackerTopology tTopo,
std::vector< TrajectorySeed > &  result 
)
override

generate seed(s) for a track

Definition at line 41 of file FastTSGFromIOHit.cc.

References clean(), edm::Event::getByToken(), TrackerSeedGenerator::getEvent(), SurveyInfoScenario_cff::seed, HiRegitMuonMixedTripletStep_cff::seedCollections, seedsTks, muonSimHitMatcherPSet::simTrack, FastTrackerRecHit::simTrackId(), tkConvValidator_cfi::simTracks, simTracksTk, and thePtCut.

42 {
43  // Make a ref to l2 muon
44  reco::TrackRef muRef(staMuon.second);
45 
46  // Cut on muons with low momenta
47  if ( muRef->pt() < thePtCut
48  || muRef->innerMomentum().Rho() < thePtCut
49  || muRef->innerMomentum().R() < 2.5 )
50  {
51  return;
52  }
53 
54  // Retrieve the Monte Carlo truth (SimTracks)
56  getEvent()->getByToken(simTracksTk,simTracks);
57 
58  // Retrieve Seed collection
59  std::vector<edm::Handle<TrajectorySeedCollection> > seedCollections;
60  seedCollections.resize(seedsTks.size());
61  for ( unsigned iSeed = 0 ; iSeed < seedsTks.size() ; iSeed++)
62  {
63  getEvent()->getByToken(seedsTks[iSeed],seedCollections[iSeed]);
64  }
65 
66  // cast the tracking region
67  const RectangularEtaPhiTrackingRegion & regionRef = dynamic_cast<const RectangularEtaPhiTrackingRegion & > (region);
68 
69  // select and store seeds
70  std::set<unsigned> simTrackIds;
71  for ( const auto & seeds : seedCollections)
72  {
73  for ( const auto & seed : *seeds)
74  {
75  // Find the simtrack corresponding to the seed
76  TrajectorySeed::range recHitRange = seed.recHits();
77  const FastTrackerRecHit * firstRecHit = (const FastTrackerRecHit*) (&(*(recHitRange.first)));
78  int simTrackId = firstRecHit->simTrackId(0);
79  const SimTrack & simTrack = (*simTracks)[simTrackId];
80 
81  // skip if simTrack already associated to a seed
82  if( simTrackIds.find(simTrackId) != simTrackIds.end() )
83  {
84  continue;
85  }
86  simTrackIds.insert(simTrackId);
87 
88  // filter seed
89  if( !clean(muRef,regionRef,&seed,simTrack) )
90  {
91  continue;
92  }
93 
94  // store results
95  result.push_back(L3MuonTrajectorySeed(seed,muRef));
96  }
97  }
98 }
std::vector< edm::EDGetTokenT< TrajectorySeedCollection > > seedsTks
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
const edm::Event * getEvent() const
virtual int32_t simTrackId(size_t i) const
std::pair< const_iterator, const_iterator > range
bool clean(reco::TrackRef muRef, const RectangularEtaPhiTrackingRegion &region, const BasicTrajectorySeed *aSeed, const SimTrack &theSimTrack)
edm::EDGetTokenT< edm::SimTrackContainer > simTracksTk

Member Data Documentation

std::vector<edm::EDGetTokenT<TrajectorySeedCollection> > FastTSGFromIOHit::seedsTks
private

Definition at line 47 of file FastTSGFromIOHit.h.

Referenced by FastTSGFromIOHit(), and trackerSeeds().

edm::EDGetTokenT<edm::SimTrackContainer> FastTSGFromIOHit::simTracksTk
private

Definition at line 46 of file FastTSGFromIOHit.h.

Referenced by FastTSGFromIOHit(), and trackerSeeds().

std::string FastTSGFromIOHit::theCategory
private

Definition at line 44 of file FastTSGFromIOHit.h.

Referenced by FastTSGFromIOHit(), and ~FastTSGFromIOHit().

double FastTSGFromIOHit::thePtCut
private

Definition at line 48 of file FastTSGFromIOHit.h.

Referenced by FastTSGFromIOHit(), and trackerSeeds().