CMS 3D CMS Logo

FastTSGFromIOHit.cc
Go to the documentation of this file.
2 
17 
19  theCategory = "FastSimulation|Muons||FastTSGFromIOHit";
20 
21  thePtCut = iConfig.getParameter<double>("PtCut");
22 
23  simTracksTk = iC.consumes<edm::SimTrackContainer>(iConfig.getParameter<edm::InputTag>("SimTrackCollectionLabel"));
24  const auto& seedLabels = iConfig.getParameter<std::vector<edm::InputTag> >("SeedCollectionLabels");
25  for (const auto& seedLabel : seedLabels) {
26  seedsTks.push_back(iC.consumes<TrajectorySeedCollection>(seedLabel));
27  }
28 }
29 
30 FastTSGFromIOHit::~FastTSGFromIOHit() { LogTrace(theCategory) << " FastTSGFromIOHit dtor called "; }
31 
33  const TrackingRegion& region,
34  const TrackerTopology* tTopo,
35  std::vector<TrajectorySeed>& result) {
36  // Make a ref to l2 muon
37  reco::TrackRef muRef(staMuon.second);
38 
39  // Cut on muons with low momenta
40  if (muRef->pt() < thePtCut || muRef->innerMomentum().Rho() < thePtCut || muRef->innerMomentum().R() < 2.5) {
41  return;
42  }
43 
44  // Retrieve the Monte Carlo truth (SimTracks)
47 
48  // Retrieve Seed collection
49  std::vector<edm::Handle<TrajectorySeedCollection> > seedCollections;
50  seedCollections.resize(seedsTks.size());
51  for (unsigned iSeed = 0; iSeed < seedsTks.size(); iSeed++) {
52  getEvent()->getByToken(seedsTks[iSeed], seedCollections[iSeed]);
53  }
54 
55  // cast the tracking region
56  const RectangularEtaPhiTrackingRegion& regionRef = dynamic_cast<const RectangularEtaPhiTrackingRegion&>(region);
57 
58  // select and store seeds
59  std::set<unsigned> simTrackIds;
60  for (const auto& seeds : seedCollections) {
61  for (const auto& seed : *seeds) {
62  // Find the simtrack corresponding to the seed
63  int simTrackId = static_cast<FastTrackerRecHit const&>(*seed.recHits().begin()).simTrackId(0);
64  const SimTrack& simTrack = (*simTracks)[simTrackId];
65 
66  // skip if simTrack already associated to a seed
67  if (simTrackIds.find(simTrackId) != simTrackIds.end()) {
68  continue;
69  }
70  simTrackIds.insert(simTrackId);
71 
72  // filter seed
73  if (!clean(muRef, regionRef, &seed, simTrack)) {
74  continue;
75  }
76 
77  // store results
78  result.push_back(L3MuonTrajectorySeed(seed, muRef));
79  }
80  }
81 }
82 
85  const TrajectorySeed* aSeed,
86  const SimTrack& theSimTrack) {
87  // Eta cleaner
88  const PixelRecoRange<float>& etaRange = region.etaRange();
89 
90  double etaSeed = theSimTrack.momentum().Eta();
91  double etaLimit = (fabs(fabs(etaRange.max()) - fabs(etaRange.mean())) < 0.05)
92  ? 0.05
93  : fabs(fabs(etaRange.max()) - fabs(etaRange.mean()));
94  bool inEtaRange = etaSeed >= (etaRange.mean() - etaLimit) && etaSeed <= (etaRange.mean() + etaLimit);
95  if (!inEtaRange) {
96  return false;
97  }
98 
99  // Phi cleaner
100  const TkTrackingRegionsMargin<float>& phiMargin = region.phiMargin();
101  double phiSeed = theSimTrack.momentum().Phi();
102  double phiLimit = (phiMargin.right() < 0.05) ? 0.05 : phiMargin.right();
103  bool inPhiRange = (fabs(deltaPhi(phiSeed, double(region.direction().phi()))) < phiLimit);
104  if (!inPhiRange) {
105  return false;
106  }
107 
108  // pt cleaner
109  double ptSeed = std::sqrt(theSimTrack.momentum().Perp2());
110  double ptMin = (region.ptMin() > 3.5) ? 3.5 : region.ptMin();
111  bool inPtRange = ptSeed >= ptMin && ptSeed <= 2 * (muRef->pt());
112  if (!inPtRange) {
113  return false;
114  }
115  return true;
116 }
TrackerSeedGenerator::TrackCand
std::pair< const Trajectory *, reco::TrackRef > TrackCand
Definition: TrackerSeedGenerator.h:30
CoreSimTrack::momentum
const math::XYZTLorentzVectorD & momentum() const
Definition: CoreSimTrack.h:19
cscDigiValidation_cfi.simTrack
simTrack
Definition: cscDigiValidation_cfi.py:29
MessageLogger.h
RectangularEtaPhiTrackingRegion
Definition: RectangularEtaPhiTrackingRegion.h:25
TrajectorySeedCollection
std::vector< TrajectorySeed > TrajectorySeedCollection
Definition: TrajectorySeedCollection.h:6
generateTowerEtThresholdLUT.etaRange
etaRange
Definition: generateTowerEtThresholdLUT.py:55
FastTSGFromIOHit::trackerSeeds
void trackerSeeds(const TrackCand &, const TrackingRegion &, const TrackerTopology *tTopo, std::vector< TrajectorySeed > &) override
generate seed(s) for a track
Definition: FastTSGFromIOHit.cc:32
deltaPhi.h
TrackerTopology
Definition: TrackerTopology.h:16
ptMin
constexpr float ptMin
Definition: PhotonIDValueMapProducer.cc:155
TrackCandidateProducer_cfi.simTracks
simTracks
Definition: TrackCandidateProducer_cfi.py:15
FastTSGFromIOHit::theCategory
std::string theCategory
Definition: FastTSGFromIOHit.h:46
edm::Handle< edm::SimTrackContainer >
FastTSGFromIOHit::simTracksTk
edm::EDGetTokenT< edm::SimTrackContainer > simTracksTk
Definition: FastTSGFromIOHit.h:48
edm::Ref< TrackCollection >
fileCollector.seed
seed
Definition: fileCollector.py:127
seedmultiplicitymonitor_cfi.seedCollections
seedCollections
Definition: seedmultiplicitymonitor_cfi.py:5
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
FastTSGFromIOHit::thePtCut
double thePtCut
Definition: FastTSGFromIOHit.h:50
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:535
L3MuonTrajectorySeed.h
TrackerSeedGenerator::getEvent
const edm::Event * getEvent() const
Definition: TrackerSeedGenerator.h:41
FastTSGFromIOHit::clean
bool clean(reco::TrackRef muRef, const RectangularEtaPhiTrackingRegion &region, const BasicTrajectorySeed *aSeed, const SimTrack &theSimTrack)
Definition: FastTSGFromIOHit.cc:83
InitialStep_cff.seeds
seeds
Definition: InitialStep_cff.py:231
PixelRecoRange< float >
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88271
RectangularEtaPhiTrackingRegion.h
FastTSGFromIOHit::seedsTks
std::vector< edm::EDGetTokenT< TrajectorySeedCollection > > seedsTks
Definition: FastTSGFromIOHit.h:49
TkTrackingRegionsMargin< float >
FastTSGFromIOHit::~FastTSGFromIOHit
~FastTSGFromIOHit() override
destructor
Definition: FastTSGFromIOHit.cc:30
TkTrackingRegionsMargin::right
const T & right() const
Definition: TkTrackingRegionsMargin.h:19
FastTSGFromIOHit::FastTSGFromIOHit
FastTSGFromIOHit(const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
constructor
Definition: FastTSGFromIOHit.cc:18
edm::SimTrackContainer
std::vector< SimTrack > SimTrackContainer
Definition: SimTrackContainer.h:12
SimTrack
Definition: SimTrack.h:9
FastTSGFromIOHit.h
TrajectorySeed
Definition: TrajectorySeed.h:18
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrackingRegion
Definition: TrackingRegion.h:41
FastTrackerRecHit.h
mps_fire.result
result
Definition: mps_fire.py:311
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
L3MuonTrajectorySeed
Definition: L3MuonTrajectorySeed.h:16
SimTrackContainer.h
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45