CMS 3D CMS Logo

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

#include <TrackerSeedCleaner.h>

Public Types

typedef std::vector< TrajectorySeedtkSeeds
 

Public Member Functions

virtual void clean (const reco::TrackRef &, const RectangularEtaPhiTrackingRegion &region, tkSeeds &)
 the cleaner More...
 
virtual void init (const MuonServiceProxy *service)
 intizialization More...
 
virtual void setEvent (const edm::Event &)
 setEvent More...
 
 TrackerSeedCleaner (const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
 constructor More...
 
virtual ~TrackerSeedCleaner ()
 destructor More...
 

Private Attributes

edm::EDGetTokenT< reco::BeamSpotbeamspotToken_
 
edm::Handle< reco::BeamSpotbsHandle_
 
std::string builderName_
 
bool cleanBySharedHits
 
edm::InputTag theBeamSpotTag
 
const edm::EventtheEvent
 
const MuonServiceProxytheProxyService
 
RedundantSeedCleanertheRedundantCleaner
 
edm::ESHandle< TransientTrackingRecHitBuildertheTTRHBuilder
 
edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecordtheTTRHBuilderToken
 
bool useDirection_Cleaner
 
bool usePt_Cleaner
 

Detailed Description

Seeds Cleaner based on direction

Author
A. Grelli - Purdue University, Pavia University

Definition at line 39 of file TrackerSeedCleaner.h.

Member Typedef Documentation

◆ tkSeeds

Definition at line 41 of file TrackerSeedCleaner.h.

Constructor & Destructor Documentation

◆ TrackerSeedCleaner()

TrackerSeedCleaner::TrackerSeedCleaner ( const edm::ParameterSet pset,
edm::ConsumesCollector iC 
)
inline

constructor

Definition at line 43 of file TrackerSeedCleaner.h.

References beamspotToken_, builderName_, cleanBySharedHits, edm::ConsumesCollector::consumes(), edm::ConsumesCollector::esConsumes(), muonDTDigis_cfi::pset, AlCaHLTBitMon_QueryRunRegistry::string, theBeamSpotTag, theTTRHBuilderToken, useDirection_Cleaner, and usePt_Cleaner.

44  : theProxyService(nullptr), theEvent(nullptr) {
45  builderName_ = pset.getParameter<std::string>("TTRHBuilder");
46  theBeamSpotTag = pset.getParameter<edm::InputTag>("beamSpot");
47  useDirection_Cleaner = pset.getParameter<bool>("directionCleaner");
48  usePt_Cleaner = pset.getParameter<bool>("ptCleaner");
49  cleanBySharedHits = pset.getParameter<bool>("cleanerFromSharedHits");
52  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::InputTag theBeamSpotTag
const edm::Event * theEvent
const MuonServiceProxy * theProxyService
edm::EDGetTokenT< reco::BeamSpot > beamspotToken_
edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > theTTRHBuilderToken

◆ ~TrackerSeedCleaner()

virtual TrackerSeedCleaner::~TrackerSeedCleaner ( )
inlinevirtual

destructor

Definition at line 58 of file TrackerSeedCleaner.h.

58 {}

Member Function Documentation

◆ clean()

void TrackerSeedCleaner::clean ( const reco::TrackRef muR,
const RectangularEtaPhiTrackingRegion region,
tkSeeds seeds 
)
virtual

the cleaner

Definition at line 54 of file TrackerSeedCleaner.cc.

References cms::cuda::bs, srCondWrite_cfg::deltaPhi, generateTowerEtThresholdLUT::etaRange, LogDebug, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), ptMin, rpcPointValidation_cfi::recHit, nano_mu_digi_cff::region, mps_fire::result, fileCollector::seed, HLT_2024v14_cff::seeds, trajectoryStateTransform::transientState(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

56  {
57  // call the shared input cleaner
60 
61  theTTRHBuilder = theProxyService->eventSetup().getHandle(theTTRHBuilderToken);
62 
63  LogDebug("TrackerSeedCleaner") << seeds.size() << " trajectory seeds to the events before cleaning" << endl;
64 
65  //check the validity otherwise vertexing
66  const reco::BeamSpot& bs = *bsHandle_;
67  /*reco track and seeds as arguments. Seeds eta and phi are checked and
68  based on deviation from L2 eta and phi seed is accepted or not*/
69 
70  std::vector<TrajectorySeed> result;
71 
72  TSCBLBuilderNoMaterial tscblBuilder;
73  // PerigeeConversions tspConverter;
74  for (TrajectorySeedCollection::iterator seed = seeds.begin(); seed < seeds.end(); ++seed) {
75  if (seed->nHits() < 2)
76  continue;
77  //get parameters and errors from the seed state
80  seed->startingState(), recHit->surface(), theProxyService->magneticField().product());
81 
82  TrajectoryStateClosestToBeamLine tsAtClosestApproachSeed =
83  tscblBuilder(*state.freeState(), bs); //as in TrackProducerAlgorithms
84  if (!tsAtClosestApproachSeed.isValid())
85  continue;
86  GlobalPoint vSeed1 = tsAtClosestApproachSeed.trackStateAtPCA().position();
87  GlobalVector pSeed = tsAtClosestApproachSeed.trackStateAtPCA().momentum();
88  GlobalPoint vSeed(vSeed1.x() - bs.x0(), vSeed1.y() - bs.y0(), vSeed1.z() - bs.z0());
89 
90  //eta,phi info from seeds
91  double etaSeed = state.globalMomentum().eta();
92  double phiSeed = pSeed.phi();
93 
94  //if the limits are too stringent rescale limits
96  typedef TkTrackingRegionsMargin<float> Margin;
97 
98  Range etaRange = region.etaRange();
99  double etaLimit = (fabs(fabs(etaRange.max()) - fabs(etaRange.mean())) < 0.1)
100  ? 0.1
101  : fabs(fabs(etaRange.max()) - fabs(etaRange.mean()));
102 
103  Margin phiMargin = region.phiMargin();
104  double phiLimit = (phiMargin.right() < 0.1) ? 0.1 : phiMargin.right();
105 
106  double ptSeed = pSeed.perp();
107  double ptMin = (region.ptMin() > 3.5) ? 3.5 : region.ptMin();
108  // Clean
109  bool inEtaRange = etaSeed >= (etaRange.mean() - etaLimit) && etaSeed <= (etaRange.mean() + etaLimit);
110  bool inPhiRange = (fabs(deltaPhi(phiSeed, double(region.direction().phi()))) < phiLimit);
111  // pt cleaner
112  bool inPtRange = ptSeed >= ptMin && ptSeed <= 2 * (muR->pt());
113 
114  // save efficiency don't clean triplets with pt cleaner
115  if (seed->nHits() == 3)
116  inPtRange = true;
117 
118  // use pt and angle cleaners
119  if (inPtRange && usePt_Cleaner && !useDirection_Cleaner) {
120  result.push_back(*seed);
121  LogDebug("TrackerSeedCleaner") << " Keeping the seed : this seed passed pt selection";
122  }
123 
124  // use only angle default option
125  if (inEtaRange && inPhiRange && !usePt_Cleaner && useDirection_Cleaner) {
126  result.push_back(*seed);
127  LogDebug("TrackerSeedCleaner") << " Keeping the seed : this seed passed direction selection";
128  }
129 
130  // use all the cleaners
131  if (inEtaRange && inPhiRange && inPtRange && usePt_Cleaner && useDirection_Cleaner) {
132  result.push_back(*seed);
133  LogDebug("TrackerSeedCleaner") << " Keeping the seed : this seed passed direction and pt selection";
134  }
135 
136  LogDebug("TrackerSeedCleaner") << " eta for current seed " << etaSeed << "\n"
137  << " phi for current seed " << phiSeed << "\n"
138  << " eta for L2 track " << muR->eta() << "\n"
139  << " phi for L2 track " << muR->phi() << "\n";
140  }
141 
142  //the new seeds collection
143  if (!result.empty() && (useDirection_Cleaner || usePt_Cleaner))
144  seeds.swap(result);
145 
146  LogDebug("TrackerSeedCleaner") << seeds.size() << " trajectory seeds to the events after cleaning" << endl;
147 
148  return;
149 }
T perp() const
Definition: PV3DBase.h:69
PixelRecoRange< float > Range
T z() const
Definition: PV3DBase.h:61
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
constexpr float ptMin
void define(std::vector< TrajectorySeed > &)
collection definition
RedundantSeedCleaner * theRedundantCleaner
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
const MuonServiceProxy * theProxyService
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
edm::Handle< reco::BeamSpot > bsHandle_
std::shared_ptr< TrackingRecHit const > RecHitPointer
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
edm::ESHandle< TransientTrackingRecHitBuilder > theTTRHBuilder
edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > theTTRHBuilderToken
#define LogDebug(id)

◆ init()

void TrackerSeedCleaner::init ( const MuonServiceProxy service)
virtual

intizialization

Definition at line 40 of file TrackerSeedCleaner.cc.

References isoTrack_cff::RedundantSeedCleaner.

40  {
42 
44 }
RedundantSeedCleaner * theRedundantCleaner
const MuonServiceProxy * theProxyService

◆ setEvent()

void TrackerSeedCleaner::setEvent ( const edm::Event event)
virtual

setEvent

Definition at line 49 of file TrackerSeedCleaner.cc.

49 { event.getByToken(beamspotToken_, bsHandle_); }
edm::Handle< reco::BeamSpot > bsHandle_
edm::EDGetTokenT< reco::BeamSpot > beamspotToken_

Member Data Documentation

◆ beamspotToken_

edm::EDGetTokenT<reco::BeamSpot> TrackerSeedCleaner::beamspotToken_
private

Definition at line 70 of file TrackerSeedCleaner.h.

Referenced by TrackerSeedCleaner().

◆ bsHandle_

edm::Handle<reco::BeamSpot> TrackerSeedCleaner::bsHandle_
private

Definition at line 69 of file TrackerSeedCleaner.h.

◆ builderName_

std::string TrackerSeedCleaner::builderName_
private

Definition at line 73 of file TrackerSeedCleaner.h.

Referenced by TrackerSeedCleaner().

◆ cleanBySharedHits

bool TrackerSeedCleaner::cleanBySharedHits
private

Definition at line 76 of file TrackerSeedCleaner.h.

Referenced by TrackerSeedCleaner().

◆ theBeamSpotTag

edm::InputTag TrackerSeedCleaner::theBeamSpotTag
private

Definition at line 68 of file TrackerSeedCleaner.h.

Referenced by TrackerSeedCleaner().

◆ theEvent

const edm::Event* TrackerSeedCleaner::theEvent
private

Definition at line 66 of file TrackerSeedCleaner.h.

◆ theProxyService

const MuonServiceProxy* TrackerSeedCleaner::theProxyService
private

Definition at line 65 of file TrackerSeedCleaner.h.

◆ theRedundantCleaner

RedundantSeedCleaner* TrackerSeedCleaner::theRedundantCleaner
private

Definition at line 71 of file TrackerSeedCleaner.h.

◆ theTTRHBuilder

edm::ESHandle<TransientTrackingRecHitBuilder> TrackerSeedCleaner::theTTRHBuilder
private

Definition at line 74 of file TrackerSeedCleaner.h.

◆ theTTRHBuilderToken

edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> TrackerSeedCleaner::theTTRHBuilderToken
private

Definition at line 75 of file TrackerSeedCleaner.h.

Referenced by TrackerSeedCleaner().

◆ useDirection_Cleaner

bool TrackerSeedCleaner::useDirection_Cleaner
private

Definition at line 76 of file TrackerSeedCleaner.h.

Referenced by TrackerSeedCleaner().

◆ usePt_Cleaner

bool TrackerSeedCleaner::usePt_Cleaner
private

Definition at line 76 of file TrackerSeedCleaner.h.

Referenced by TrackerSeedCleaner().