CMS 3D CMS Logo

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

#include <CosmicTrackingRegion.h>

Inheritance diagram for CosmicTrackingRegion:
TrackingRegion

Public Member Functions

std::unique_ptr< HitRZCompatibilitycheckRZ (const DetLayer *layer, const Hit &outerHit, const DetLayer *outerlayer=nullptr, float lr=0, float gz=0, float dr=0, float dz=0) const override
 
void checkTracks (reco::TrackCollection const &tracks, std::vector< bool > &mask) const override
 
std::unique_ptr< TrackingRegionclone () const override
 
 CosmicTrackingRegion (const GlobalVector &dir, const GlobalPoint &vertexPos, float ptMin, float rVertex, float zVertex, float deltaEta, float deltaPhi, const MagneticField &magField, float dummy=0., const MeasurementTrackerEvent *measurementTracker=nullptr)
 
 CosmicTrackingRegion (const GlobalVector &dir, const GlobalPoint &vertexPos, float ptMin, float rVertex, float zVertex, float deltaEta, float deltaPhi, const MagneticField &magField, const MeasurementTrackerEvent *measurementTracker=nullptr)
 
 CosmicTrackingRegion (CosmicTrackingRegion const &rh)
 
TrackingRegion::Hits hits (const SeedingLayerSetsHits::SeedingLayer &layer) const override
 get hits from layer compatible with region constraints More...
 
std::string name () const override
 
 ~CosmicTrackingRegion () override
 
- Public Member Functions inherited from TrackingRegion
std::vector< bool > checkTracks (reco::TrackCollection const &tracks) const
 return a boolean mask over the TrackCollection reflecting the compatibility of each track with the region constraints More...
 
GlobalVector const & direction () const
 the direction around which region is constructed More...
 
Range invPtRange () const
 inverse pt range More...
 
GlobalPoint const & origin () const
 
float originRBound () const
 bounds the particle vertex in the transverse plane More...
 
float originZBound () const
 bounds the particle vertex in the longitudinal plane More...
 
float phiDirection () const
 
virtual std::string print () const
 
float ptMin () const
 minimal pt of interest More...
 
std::unique_ptr< TrackingRegionrestrictedRegion (const GlobalPoint &originPos, const float &originRBound, const float &originZBound) const
 clone region with new vertex position More...
 
 TrackingRegion ()
 
 TrackingRegion (const GlobalVector &direction, const GlobalPoint &originPos, const Range &invPtRange, const float &originRBound, const float &originZBound)
 
GlobalVector const & unitDirection () const
 
virtual ~TrackingRegion ()
 

Private Types

using cacheHitPointer = mayown_ptr< BaseTrackerRecHit >
 
using cacheHits = std::vector< cacheHitPointer >
 

Private Member Functions

template<typename T >
void hits_ (const T &layer, TrackingRegion::Hits &result) const
 

Private Attributes

cacheHits cache
 
const MagneticFieldtheMagneticField_
 
const MeasurementTrackerEventtheMeasurementTracker_
 

Additional Inherited Members

- Public Types inherited from TrackingRegion
typedef SeedingLayerSetsHits::ConstRecHitPointer Hit
 
typedef SeedingLayerSetsHits::Hits Hits
 
typedef PixelRecoRange< float > Range
 

Detailed Description

A concrete implementation of TrackingRegion. Apart of vertex constraint from TrackingRegion in this implementation the region of interest is further constrainted in phi and eta around the direction of the region

Definition at line 23 of file CosmicTrackingRegion.h.

Member Typedef Documentation

◆ cacheHitPointer

Definition at line 110 of file CosmicTrackingRegion.h.

◆ cacheHits

using CosmicTrackingRegion::cacheHits = std::vector<cacheHitPointer>
private

Definition at line 111 of file CosmicTrackingRegion.h.

Constructor & Destructor Documentation

◆ ~CosmicTrackingRegion()

CosmicTrackingRegion::~CosmicTrackingRegion ( )
inlineoverride

Definition at line 25 of file CosmicTrackingRegion.h.

25 {}

◆ CosmicTrackingRegion() [1/3]

CosmicTrackingRegion::CosmicTrackingRegion ( const GlobalVector dir,
const GlobalPoint vertexPos,
float  ptMin,
float  rVertex,
float  zVertex,
float  deltaEta,
float  deltaPhi,
const MagneticField magField,
float  dummy = 0.,
const MeasurementTrackerEvent measurementTracker = nullptr 
)
inline

constructor (symmetric eta and phi margins).
dir - the direction around which region is constructed
the initial direction of the momentum of the particle should be in the range
phi of dir +- deltaPhi
eta of dir +- deltaEta

vertexPos - the position of the vertex (origin) of the of the region.
It is a centre of cylinder constraind with rVertex, zVertex. The track of the particle should cross the cylinder
WARNING: in the current implementaion the vertexPos is supposed to be placed on the beam line, i.e. to be of the form (0,0,float)

ptMin - minimal pt of interest
rVertex - radius of the cylinder around beam line where the tracks of interest should point to.
zVertex - half height of the cylinder around the beam line where the tracks of interest should point to.
deltaEta - allowed deviation of the initial direction of particle in eta in respect to direction of the region
deltaPhi - allowed deviation of the initial direction of particle in phi in respect to direction of the region

Definition at line 51 of file CosmicTrackingRegion.h.

61  : TrackingRegionBase(dir, vertexPos, Range(-1 / ptMin, 1 / ptMin), rVertex, zVertex),
63  theMagneticField_(&magField) {}
const MagneticField * theMagneticField_
PixelRecoRange< float > Range
float ptMin() const
minimal pt of interest
const MeasurementTrackerEvent * theMeasurementTracker_
TrackingRegion TrackingRegionBase

◆ CosmicTrackingRegion() [2/3]

CosmicTrackingRegion::CosmicTrackingRegion ( const GlobalVector dir,
const GlobalPoint vertexPos,
float  ptMin,
float  rVertex,
float  zVertex,
float  deltaEta,
float  deltaPhi,
const MagneticField magField,
const MeasurementTrackerEvent measurementTracker = nullptr 
)
inline

Definition at line 65 of file CosmicTrackingRegion.h.

74  : TrackingRegionBase(dir, vertexPos, Range(-1 / ptMin, 1 / ptMin), rVertex, zVertex),
76  theMagneticField_(&magField) {}
const MagneticField * theMagneticField_
PixelRecoRange< float > Range
float ptMin() const
minimal pt of interest
const MeasurementTrackerEvent * theMeasurementTracker_
TrackingRegion TrackingRegionBase

◆ CosmicTrackingRegion() [3/3]

CosmicTrackingRegion::CosmicTrackingRegion ( CosmicTrackingRegion const &  rh)
inline

Definition at line 78 of file CosmicTrackingRegion.h.

79  : TrackingRegionBase(rh),
80  theMeasurementTracker_(rh.theMeasurementTracker_),
81  theMagneticField_(rh.theMagneticField_) {}
const MagneticField * theMagneticField_
const MeasurementTrackerEvent * theMeasurementTracker_
TrackingRegion TrackingRegionBase

Member Function Documentation

◆ checkRZ()

std::unique_ptr<HitRZCompatibility> CosmicTrackingRegion::checkRZ ( const DetLayer layer,
const Hit outerHit,
const DetLayer outerlayer = nullptr,
float  lr = 0,
float  gz = 0,
float  dr = 0,
float  dz = 0 
) const
inlineoverridevirtual

utility to check eta/theta hit compatibility with region constraints and outer hit constraint

Implements TrackingRegion.

Definition at line 85 of file CosmicTrackingRegion.h.

91  {
92  return nullptr;
93  }

◆ checkTracks()

void CosmicTrackingRegion::checkTracks ( reco::TrackCollection const &  tracks,
std::vector< bool > &  mask 
) const
overridevirtual

Set the elements of the mask corresponding to the tracks that are compatable with the region. Does not reset the elements corresponding to the tracks that are not compatible.

Implements TrackingRegion.

Definition at line 25 of file CosmicTrackingRegion.cc.

References funct::abs(), cms::cuda::assert(), mps_fire::i, gpuClustering::pixelStatus::mask, ptMin, HLT_2022v15_cff::track, pwdgSkimBPark_cfi::tracks, and x.

25  {
26  const math::XYZPoint regOrigin(origin().x(), origin().y(), origin().z());
27 
28  assert(mask.size() == tracks.size());
29  int i = -1;
30  for (auto const& track : tracks) {
31  i++;
32  if (mask[i])
33  continue;
34 
35  if (track.pt() < ptMin()) {
36  continue;
37  }
38  if (std::abs(track.dxy(regOrigin)) > originRBound()) {
39  continue;
40  }
41  if (std::abs(track.dz(regOrigin)) > originZBound()) {
42  continue;
43  }
44 
45  mask[i] = true;
46  }
47 }
GlobalPoint const & origin() const
assert(be >=bs)
constexpr uint32_t mask
Definition: gpuClustering.h:26
float ptMin() const
minimal pt of interest
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float originRBound() const
bounds the particle vertex in the transverse plane
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
float originZBound() const
bounds the particle vertex in the longitudinal plane

◆ clone()

std::unique_ptr<TrackingRegion> CosmicTrackingRegion::clone ( void  ) const
inlineoverridevirtual

Implements TrackingRegion.

Definition at line 99 of file CosmicTrackingRegion.h.

99 { return std::make_unique<CosmicTrackingRegion>(*this); }

◆ hits()

TrackingRegion::Hits CosmicTrackingRegion::hits ( const SeedingLayerSetsHits::SeedingLayer layer) const
overridevirtual

get hits from layer compatible with region constraints

Implements TrackingRegion.

Definition at line 49 of file CosmicTrackingRegion.cc.

References mps_fire::result.

49  {
51  hits_(layer, result);
52  return result;
53 }
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
SeedingLayerSetsHits::Hits Hits
void hits_(const T &layer, TrackingRegion::Hits &result) const

◆ hits_()

template<typename T >
void CosmicTrackingRegion::hits_ ( const T layer,
TrackingRegion::Hits result 
) const
private

Definition at line 56 of file CosmicTrackingRegion.cc.

References alongMomentum, AnalyticalPropagator_cfi::AnalyticalPropagator, cms::cuda::assert(), Plane::build(), utilities::cache(), GeometricSearchDet::compatibleDets(), funct::cos(), DeadROC_duringRun::dir, PV3DBase< T, PVType, FrameType >::eta(), TrajectoryStateOnSurface::freeState(), TrajectoryStateOnSurface::globalPosition(), trackerHitRTTI::isUndef(), TrajectoryStateOnSurface::isValid(), LogDebug, LayerMeasurements::measurements(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), mps_fire::result, makeMuonMisalignmentScenario::rot, funct::sin(), GeometricSearchDet::surface(), and extraflags_cff::vtx.

56  {
57  //get and name collections
58  //++++++++++++++++++++++++
59 
60  //detector layer
61  const DetLayer* detLayer = layer.detLayer();
62  LogDebug("CosmicTrackingRegion") << "Looking at hits on subdet/layer " << layer.name();
63  EtaPhiMeasurementEstimator est(0.3, 0.3);
64 
65  //region
66  const GlobalPoint vtx = origin();
68  LogDebug("CosmicTrackingRegion") << "The initial region characteristics are:"
69  << "\n"
70  << " Origin = " << origin() << "\n"
71  << " Direction = " << direction() << "\n"
72  << " Eta = " << origin().eta() << "\n"
73  << " Phi = " << origin().phi();
74 
75  //trajectory state on surface
76  float phi = dir.phi();
77  Surface::RotationType rot(sin(phi), -cos(phi), 0, 0, 0, -1, cos(phi), sin(phi), 0);
78 
81  TrajectoryStateOnSurface tsos(fts, *surface);
82  LogDebug("CosmicTrackingRegion") << "The state used to find measurement with the measurement tracker is:\n" << tsos;
83 
84  //propagator
86 
87  //propagation verification (debug)
88  //++++++++++++++++++++++++++++++++
89 
90  //creation of the state
91  TrajectoryStateOnSurface stateOnLayer = prop.propagate(*tsos.freeState(), detLayer->surface());
92 
93  //verification of the state
94  if (stateOnLayer.isValid()) {
95  LogDebug("CosmicTrackingRegion") << "The initial state propagates to the layer surface: \n"
96  << stateOnLayer << "R = " << stateOnLayer.globalPosition().perp() << "\n"
97  << "Eta = " << stateOnLayer.globalPosition().eta() << "\n"
98  << "Phi = " << stateOnLayer.globalPosition().phi();
99 
100  } else {
101  LogDebug("CosmicTrackingRegion") << "The initial state does not propagate to the layer surface.";
102  }
103 
104  //number of compatible dets
106  vector<DetWithState> compatDets = detLayer->compatibleDets(tsos, prop, est);
107  LogDebug("CosmicTrackingRegion") << "Compatible dets = " << compatDets.size();
108 
109  //get hits
110  //++++++++
111 
112  //measurement tracker (find hits)
114  vector<TrajectoryMeasurement> meas = lm.measurements(*detLayer, tsos, prop, est);
115  LogDebug("CosmicTrackingRegion") << "Number of Trajectory measurements = " << meas.size()
116  << " but the last one is always an invalid hit, by construction.";
117 
118  //trajectory measurement
119 
120  // std::cout <<"CRegion b " << cache.size() << std::endl;
121 
122  // waiting for a migration at LayerMeasurements level and at seed builder level
123  for (auto const& im : meas) {
124  if (!im.recHit()->isValid())
125  continue;
126  assert(!trackerHitRTTI::isUndef(*im.recHit()->hit()));
127  auto ptrHit = (BaseTrackerRecHit*)(im.recHit()->hit()->clone());
128  cache.emplace_back(ptrHit);
129  result.emplace_back(ptrHit);
130  }
131 
132  // std::cout <<"CRegion a " << cache.size() << std::endl;
133 }
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
T perp() const
Definition: PV3DBase.h:69
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
GlobalPoint const & origin() const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T eta() const
Definition: PV3DBase.h:73
assert(be >=bs)
static PlanePointer build(Args &&... args)
Definition: Plane.h:33
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
GlobalPoint globalPosition() const
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
const MagneticField * theMagneticField_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
GlobalVector const & direction() const
the direction around which region is constructed
bool isUndef(TrackingRecHit const &hit)
const MeasurementTrackerEvent * theMeasurementTracker_
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
std::vector< TrajectoryMeasurement > measurements(const DetLayer &layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
#define LogDebug(id)

◆ name()

std::string CosmicTrackingRegion::name ( void  ) const
inlineoverridevirtual

Reimplemented from TrackingRegion.

Definition at line 101 of file CosmicTrackingRegion.h.

Referenced by config.CFG::__str__(), and validation.Sample::digest().

101 { return "CosmicTrackingRegion"; }

Member Data Documentation

◆ cache

cacheHits CosmicTrackingRegion::cache
mutableprivate

Definition at line 116 of file CosmicTrackingRegion.h.

◆ theMagneticField_

const MagneticField* CosmicTrackingRegion::theMagneticField_
private

Definition at line 108 of file CosmicTrackingRegion.h.

◆ theMeasurementTracker_

const MeasurementTrackerEvent* CosmicTrackingRegion::theMeasurementTracker_
private

Definition at line 107 of file CosmicTrackingRegion.h.