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 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 &, std::vector< TrajectorySeed > &)
 generate seed(s) for a track More...
 
virtual ~FastTSGFromIOHit ()
 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::string theCategory
 
edm::ParameterSet theConfig
 
double thePtCut
 
std::vector< edm::InputTagtheSeedCollectionLabels
 
edm::InputTag theSimTrackCollectionLabel
 

Additional Inherited Members

- Public Types inherited from TrackerSeedGenerator
typedef std::vector
< TrajectorySeed
BTSeedCollection
 
typedef std::pair< const
Trajectory *, reco::TrackRef
TrackCand
 
- 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 24 of file FastTSGFromIOHit.h.

Constructor & Destructor Documentation

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

constructor

Definition at line 19 of file FastTSGFromIOHit.cc.

References edm::ParameterSet::getParameter(), theCategory, thePtCut, theSeedCollectionLabels, and theSimTrackCollectionLabel.

19  : theConfig (iConfig)
20 {
21  theCategory = "FastSimulation|Muons||FastTSGFromIOHit";
22 
23  thePtCut = iConfig.getParameter<double>("PtCut");
24 
25  theSeedCollectionLabels = iConfig.getParameter<std::vector<edm::InputTag> >("SeedCollectionLabels");
26 
27  theSimTrackCollectionLabel = iConfig.getParameter<edm::InputTag>("SimTrackCollectionLabel");
28 
29 }
edm::ParameterSet theConfig
edm::InputTag theSimTrackCollectionLabel
std::vector< edm::InputTag > theSeedCollectionLabels
std::string theCategory
FastTSGFromIOHit::~FastTSGFromIOHit ( )
virtual

destructor

Definition at line 31 of file FastTSGFromIOHit.cc.

References LogTrace, and theCategory.

32 {
33 
34  LogTrace(theCategory) << " FastTSGFromIOHit dtor called ";
35 
36 }
#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 107 of file FastTSGFromIOHit.cc.

References SiPixelRawToDigiRegional_cfi::deltaPhi, MuonErrorMatrixValues_cff::etaRange, PixelRecoRange< T >::max(), PixelRecoRange< T >::mean(), CoreSimTrack::momentum(), PtMinSelector_cfg::ptMin, TkTrackingRegionsMargin< T >::right(), and mathSSE::sqrt().

Referenced by trackerSeeds().

111 {
112  // return true;
113  //}
114 
115  // Eta cleaner
116  const PixelRecoRange<float>& etaRange = region.etaRange() ;
117  // return true;
118  //}
119 
120  double etaSeed = theSimTrack.momentum().Eta();
121  double etaLimit = (fabs(fabs(etaRange.max())-fabs(etaRange.mean())) <0.05) ?
122  0.05 : fabs(fabs(etaRange.max()) - fabs(etaRange.mean())) ;
123  bool inEtaRange =
124  etaSeed >= (etaRange.mean() - etaLimit) &&
125  etaSeed <= (etaRange.mean() + etaLimit) ;
126  if ( !inEtaRange ) return false;
127 
128  // Phi cleaner
129  const TkTrackingRegionsMargin<float>& phiMargin = region.phiMargin();
130  double phiSeed = theSimTrack.momentum().Phi();
131  double phiLimit = (phiMargin.right() < 0.05 ) ? 0.05 : phiMargin.right();
132  bool inPhiRange =
133  (fabs(deltaPhi(phiSeed,double(region.direction().phi()))) < phiLimit );
134  if ( !inPhiRange ) return false;
135 
136  // pt cleaner
137  double ptSeed = std::sqrt(theSimTrack.momentum().Perp2());
138  double ptMin = (region.ptMin()>3.5) ? 3.5: region.ptMin();
139  bool inPtRange = ptSeed >= ptMin && ptSeed<= 2*(muRef->pt());
140  return inPtRange;
141 
142 }
T max() const
T sqrt(T t)
Definition: SSEVec.h:48
T mean() const
const math::XYZTLorentzVectorD & momentum() const
particle info...
Definition: CoreSimTrack.h:36
void FastTSGFromIOHit::trackerSeeds ( const TrackCand staMuon,
const TrackingRegion region,
std::vector< TrajectorySeed > &  result 
)

generate seed(s) for a track

Definition at line 38 of file FastTSGFromIOHit.cc.

References clean(), edm::Event::getByLabel(), TrackerSeedGenerator::getEvent(), iseed, TrajectorySeed::recHits(), SiTrackerGSMatchedRecHit2D::simtrackId(), thePtCut, theSeedCollectionLabels, and theSimTrackCollectionLabel.

38  {
39 
40  // Retrieve the Monte Carlo truth (SimTracks)
43 
44  // Retrieve Seed collection
45  unsigned seedCollections = theSeedCollectionLabels.size();
46  std::vector<edm::Handle<edm::View<TrajectorySeed> > > theSeeds;
47  theSeeds.resize(seedCollections);
48  unsigned seed_size = 0;
49  for ( unsigned iseed=0; iseed<seedCollections; ++iseed ) {
50  getEvent()->getByLabel(theSeedCollectionLabels[iseed], theSeeds[iseed]);
51  seed_size += theSeeds[iseed]->size();
52  }
53 
54  // Make a ref to l2 muon
55  reco::TrackRef muRef(staMuon.second);
56 
57  // Cut on muons with low momenta
58  if ( muRef->pt() < thePtCut
59  || muRef->innerMomentum().Rho() < thePtCut
60  || muRef->innerMomentum().R() < 2.5 ) return;
61 
62  // Copy the collection of seeds (ahem, this is time consuming!)
63  std::vector<TrajectorySeed> tkSeeds;
64  std::set<unsigned> tkIds;
65  tkSeeds.reserve(seed_size);
66  for ( unsigned iseed=0; iseed<seedCollections; ++iseed ) {
67  edm::Handle<edm::View<TrajectorySeed> > aSeedCollection = theSeeds[iseed];
68  unsigned nSeeds = aSeedCollection->size();
69  for (unsigned seednr = 0; seednr < nSeeds; ++seednr) {
70 
71  // The seed
72  const BasicTrajectorySeed* aSeed = &((*aSeedCollection)[seednr]);
73 
74  // Find the first hit of the Seed
75  TrajectorySeed::range theSeedingRecHitRange = aSeed->recHits();
76  const SiTrackerGSMatchedRecHit2D * theFirstSeedingRecHit =
77  (const SiTrackerGSMatchedRecHit2D*) (&(*(theSeedingRecHitRange.first)));
78 
79  // The SimTrack id associated to that recHit
80  int simTrackId = theFirstSeedingRecHit->simtrackId();
81 
82  // Track already associated to a seed
83  std::set<unsigned>::iterator tkId = tkIds.find(simTrackId);
84  if( tkId != tkIds.end() ) continue;
85 
86  const SimTrack& theSimTrack = (*theSimTracks)[simTrackId];
87 
88  const RectangularEtaPhiTrackingRegion & regionRef = dynamic_cast<const RectangularEtaPhiTrackingRegion & > (region);
89 
90  if( clean(muRef,regionRef,aSeed,theSimTrack) ) tkSeeds.push_back(*aSeed);
91  tkIds.insert(simTrackId);
92 
93  } // End loop on seeds
94 
95  } // End loop on seed collections
96 
97  // Now create the Muon Trajectory Seed
98  unsigned int is=0;
99  unsigned int isMax=tkSeeds.size();
100  for (;is!=isMax;++is){
101  result.push_back( L3MuonTrajectorySeed(tkSeeds[is], muRef));
102  } // End of tk seed loop
103 
104 }
edm::InputTag theSimTrackCollectionLabel
std::vector< edm::InputTag > theSeedCollectionLabels
const edm::Event * getEvent() const
tuple result
Definition: query.py:137
std::pair< const_iterator, const_iterator > range
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
int iseed
Definition: AMPTWrapper.h:124
range recHits() const
bool clean(reco::TrackRef muRef, const RectangularEtaPhiTrackingRegion &region, const BasicTrajectorySeed *aSeed, const SimTrack &theSimTrack)

Member Data Documentation

std::string FastTSGFromIOHit::theCategory
private

Definition at line 43 of file FastTSGFromIOHit.h.

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

edm::ParameterSet FastTSGFromIOHit::theConfig
private

Definition at line 44 of file FastTSGFromIOHit.h.

double FastTSGFromIOHit::thePtCut
private

Definition at line 47 of file FastTSGFromIOHit.h.

Referenced by FastTSGFromIOHit(), and trackerSeeds().

std::vector<edm::InputTag> FastTSGFromIOHit::theSeedCollectionLabels
private

Definition at line 46 of file FastTSGFromIOHit.h.

Referenced by FastTSGFromIOHit(), and trackerSeeds().

edm::InputTag FastTSGFromIOHit::theSimTrackCollectionLabel
private

Definition at line 45 of file FastTSGFromIOHit.h.

Referenced by FastTSGFromIOHit(), and trackerSeeds().