CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
l1tVertexFinder::Stub Class Reference

#include <Stub.h>

Inheritance diagram for l1tVertexFinder::Stub:
edm::Ref< C, T, F >

Public Member Functions

const TrackingParticlePtr assocTP () const
 
const std::set< TrackingParticlePtr > & assocTPs () const
 
void fillTruth (edm::Handle< TTStubAssMap > mcTruthTTStubHandle, edm::Handle< TTClusterAssMap > mcTruthTTClusterHandle)
 
unsigned int layerId () const
 
float phi () const
 
bool psModule () const
 
float r () const
 
 Stub ()
 
 Stub (const TTStubRef &ttStubRef, const AnalysisSettings &settings, const TrackerGeometry *trackerGeometry, const TrackerTopology *trackerTopology)
 
float z () const
 
 ~Stub ()
 
- Public Member Functions inherited from edm::Ref< C, T, F >
T const * get () const
 Returns C++ pointer to the item. More...
 
bool hasProductCache () const
 Returns true if container referenced by the Ref has been cached. More...
 
ProductID id () const
 Accessor for product ID. More...
 
key_type index () const
 
bool isAvailable () const
 
bool isNonnull () const
 Checks for non-null. More...
 
bool isNull () const
 Checks for null. More...
 
bool isTransient () const
 Checks if this ref is transient (i.e. not persistable). More...
 
key_type key () const
 Accessor for product key. More...
 
bool operator! () const
 Checks for null. More...
 
T const & operator* () const
 Dereference operator. More...
 
T const * operator-> () const
 Member dereference operator. More...
 
EDProductGetter const * productGetter () const
 Accessor for product getter. More...
 
 Ref ()
 Default constructor needed for reading from persistent store. Not for direct use. More...
 
 Ref (Handle< C > const &handle, key_type itemKey, bool setNow=true)
 General purpose constructor from handle. More...
 
 Ref (OrphanHandle< C > const &handle, key_type itemKey, bool setNow=true)
 General purpose constructor from orphan handle. More...
 
 Ref (C const *product, key_type itemKey, bool setNow=true)
 Constructors for ref to object that is not in an event. More...
 
 Ref (TestHandle< C > const &handle, key_type itemKey, bool setNow=true)
 Constructor from test handle. More...
 
 Ref (ProductID const &productID, key_type itemKey, EDProductGetter const *prodGetter)
 
 Ref (ProductID const &iProductID, T const *item, key_type itemKey, C const *)
 Constructor for use in the various X::fillView(...) functions. More...
 
 Ref (ProductID const &iProductID, T const *item, key_type itemKey)
 
 Ref (ProductID const &iProductID, T const *item, key_type itemKey, bool transient)
 
 Ref (ProductID const &iId)
 
 Ref (RefProd< C > const &refProd, key_type itemKey)
 Constructor from RefProd<C> and key. More...
 
 Ref (RefCore const &iRefCore, key_type const &iKey)
 
RefCore const & refCore () const
 
 ~Ref ()
 Destructor. More...
 

Private Member Functions

void setModuleInfo (const TrackerGeometry *trackerGeometry, const TrackerTopology *trackerTopology, const DetId &detId)
 

Private Attributes

TrackingParticlePtr assocTP_
 
std::set< TrackingParticlePtrassocTPs_
 
bool barrel_
 
unsigned int endcapRing_
 
unsigned int idDet_
 
unsigned int layerId_
 
float moduleMaxPhi_
 
float moduleMaxR_
 
float moduleMaxZ_
 
float moduleMinPhi_
 
float moduleMinR_
 
float moduleMinZ_
 
unsigned int nStrips_
 
bool outerModuleAtSmallerR_
 
float phi_
 
bool psModule_
 
float r_
 
float sensorWidth_
 
const AnalysisSettingssettings_
 
float sigmaPar_
 
float sigmaPerp_
 
float stripLength_
 
float stripPitch_
 
float z_
 

Additional Inherited Members

- Public Types inherited from edm::Ref< C, T, F >
typedef boost::binary_traits< F >::second_argument_type argument_type
 
typedef T const element_type
 
typedef F finder_type
 
typedef std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
 
typedef C product_type
 for export More...
 
typedef T value_type
 
- Static Public Member Functions inherited from edm::Ref< C, T, F >
static short Class_Version ()
 
static key_type invalidKey ()
 

Detailed Description

Definition at line 37 of file Stub.h.

Constructor & Destructor Documentation

◆ Stub() [1/2]

l1tVertexFinder::Stub::Stub ( )

Definition at line 7 of file Stub.cc.

8  : settings_(nullptr),
9  phi_(0.),
10  r_(0.),
11  z_(0.),
12  idDet_(0),
13  moduleMinR_(0.),
14  moduleMaxR_(0.),
15  moduleMinPhi_(0.),
16  moduleMaxPhi_(0.),
17  moduleMinZ_(0.),
18  moduleMaxZ_(0.),
19  psModule_(false),
20  layerId_(0),
21  endcapRing_(0),
22  barrel_(false),
23  sigmaPerp_(0.),
24  sigmaPar_(0.),
25  stripPitch_(0.),
26  stripLength_(0.),
27  nStrips_(0),
28  sensorWidth_(0.),
29  outerModuleAtSmallerR_(false) {}
unsigned int idDet_
Definition: Stub.h:92
const AnalysisSettings * settings_
Definition: Stub.h:85
float moduleMaxPhi_
Definition: Stub.h:96
float moduleMinPhi_
Definition: Stub.h:95
unsigned int layerId_
Definition: Stub.h:100
unsigned int nStrips_
Definition: Stub.h:107
float moduleMaxR_
Definition: Stub.h:94
float moduleMinZ_
Definition: Stub.h:97
float stripLength_
Definition: Stub.h:106
bool outerModuleAtSmallerR_
Definition: Stub.h:109
float sensorWidth_
Definition: Stub.h:108
unsigned int endcapRing_
Definition: Stub.h:101
float moduleMinR_
Definition: Stub.h:93
float moduleMaxZ_
Definition: Stub.h:98

◆ Stub() [2/2]

l1tVertexFinder::Stub::Stub ( const TTStubRef ttStubRef,
const AnalysisSettings settings,
const TrackerGeometry trackerGeometry,
const TrackerTopology trackerTopology 
)

Definition at line 31 of file Stub.cc.

References funct::abs(), Exception, TrackerGeometry::idToDet(), phi_, r_, setModuleInfo(), settings_, l1tVertexFinder::AlgoSettings::trackerHalfLength(), l1tVertexFinder::AlgoSettings::trackerOuterRadius(), and z_.

35  : TTStubRef(ttStubRef), settings_(&settings) {
36  auto geoDetId = trackerGeometry->idToDet(ttStubRef->clusterRef(0)->getDetId())->geographicalId();
37  auto theGeomDet = trackerGeometry->idToDet(geoDetId);
38  auto measurementPoint = ttStubRef->clusterRef(0)->findAverageLocalCoordinatesCentered();
39  auto pos = theGeomDet->surface().toGlobal(theGeomDet->topology().localPosition(measurementPoint));
40 
41  phi_ = pos.phi();
42  r_ = pos.perp();
43  z_ = pos.z();
44 
45  if (r_ < settings_->trackerInnerRadius() || r_ > settings_->trackerOuterRadius() ||
47  throw cms::Exception(
48  "Stub: Stub found outside assumed tracker volume. Please update tracker dimensions specified in Settings.h!")
49  << " r=" << r_ << " z=" << z_ << " " << ttStubRef->getDetId().subdetId() << std::endl;
50  }
51 
52  // Set info about the module this stub is in
53  this->setModuleInfo(trackerGeometry, trackerTopology, geoDetId);
54  }
double trackerOuterRadius() const
Definition: AlgoSettings.h:90
double trackerHalfLength() const
Definition: AlgoSettings.h:93
const AnalysisSettings * settings_
Definition: Stub.h:85
edm::Ref< DetSetVec, TTStub< Ref_Phase2TrackerDigi_ > > TTStubRef
Definition: Stub.h:29
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void setModuleInfo(const TrackerGeometry *trackerGeometry, const TrackerTopology *trackerTopology, const DetId &detId)
Definition: Stub.cc:90
const TrackerGeomDet * idToDet(DetId) const override

◆ ~Stub()

l1tVertexFinder::Stub::~Stub ( )
inline

Definition at line 45 of file Stub.h.

45 {}

Member Function Documentation

◆ assocTP()

const TrackingParticlePtr l1tVertexFinder::Stub::assocTP ( ) const
inline

Definition at line 74 of file Stub.h.

References assocTP_.

74  {
75  return assocTP_;
76  } // If only one TP contributed to both clusters, this tells you which TP it is. Returns nullptr if none.
TrackingParticlePtr assocTP_
Definition: Stub.h:111

◆ assocTPs()

const std::set<TrackingParticlePtr>& l1tVertexFinder::Stub::assocTPs ( ) const
inline

Definition at line 71 of file Stub.h.

References assocTPs_.

71  {
72  return assocTPs_;
73  } // Return TPs associated to this stub. (Whether only TPs contributing to both clusters are returned is determined by "StubMatchStrict" config param.)
std::set< TrackingParticlePtr > assocTPs_
Definition: Stub.h:112

◆ fillTruth()

void l1tVertexFinder::Stub::fillTruth ( edm::Handle< TTStubAssMap mcTruthTTStubHandle,
edm::Handle< TTClusterAssMap mcTruthTTClusterHandle 
)

Definition at line 57 of file Stub.cc.

References assocTP_, assocTPs_, TTStubAssociationMap< T >::findTrackingParticlePtr(), TTClusterAssociationMap< T >::findTrackingParticlePtrs(), TTStubAssociationMap< T >::isGenuine(), edm::Ptr< T >::isNull(), settings_, and l1tVertexFinder::AnalysisSettings::stubMatchStrict().

Referenced by TPStubValueMapProducer::produce().

58  {
59  const TTStubRef& ttStubRef(*this); // Cast to base class
60 
61  //--- Fill assocTP_ info. If both clusters in this stub were produced by the same single tracking particle, find out which one it was.
62 
63  // Require same TP contributed to both clusters.
64  if (mcTruthTTStubHandle->isGenuine(ttStubRef)) {
65  assocTP_ = mcTruthTTStubHandle->findTrackingParticlePtr(ttStubRef);
66  }
67 
68  // Fill assocTPs_ info.
69  if (settings_->stubMatchStrict()) {
70  // We consider only stubs in which this TP contributed to both clusters.
71  if (!assocTP_.isNull())
72  assocTPs_.insert(assocTP_);
73  } else {
74  // We consider stubs in which this TP contributed to either cluster.
75 
76  for (unsigned int iClus = 0; iClus <= 1; iClus++) { // Loop over both clusters that make up stub.
77  const TTClusterRef& ttClusterRef = ttStubRef->clusterRef(iClus);
78 
79  // Now identify all TP's contributing to either cluster in stub.
80  std::vector<edm::Ptr<TrackingParticle>> vecTpPtr =
81  mcTruthTTClusterHandle->findTrackingParticlePtrs(ttClusterRef);
82 
83  for (const edm::Ptr<TrackingParticle>& tpPtr : vecTpPtr) {
84  assocTPs_.insert(tpPtr);
85  }
86  }
87  }
88  }
const TrackingParticlePtr & findTrackingParticlePtr(TTStubRefT< T > aStub) const
Operations.
std::set< TrackingParticlePtr > assocTPs_
Definition: Stub.h:112
const AnalysisSettings * settings_
Definition: Stub.h:85
bool isNull() const
Checks for null.
Definition: Ptr.h:144
bool isGenuine(TTStubRefT< T > aStub) const
MC truth.
TrackingParticlePtr assocTP_
Definition: Stub.h:111
const std::vector< TrackingParticlePtr > & findTrackingParticlePtrs(TTClusterRefT< T > aCluster) const
Get all TPs associated to a cluster.

◆ layerId()

unsigned int l1tVertexFinder::Stub::layerId ( ) const
inline

Definition at line 66 of file Stub.h.

References layerId_.

66 { return layerId_; }
unsigned int layerId_
Definition: Stub.h:100

◆ phi()

float l1tVertexFinder::Stub::phi ( void  ) const
inline

Definition at line 57 of file Stub.h.

References phi_.

Referenced by Particle.Particle::__str__(), datamodel.Object::DeltaR(), datamodel.Object::p4(), and ntupleDataFormat.Track::phiPull().

57 { return phi_; }

◆ psModule()

bool l1tVertexFinder::Stub::psModule ( ) const
inline

Definition at line 64 of file Stub.h.

References psModule_.

64 { return psModule_; }

◆ r()

float l1tVertexFinder::Stub::r ( ) const
inline

Definition at line 58 of file Stub.h.

References r_.

58 { return r_; }

◆ setModuleInfo()

void l1tVertexFinder::Stub::setModuleInfo ( const TrackerGeometry trackerGeometry,
const TrackerTopology trackerTopology,
const DetId detId 
)
private

Definition at line 90 of file Stub.cc.

References barrel_, Surface::bounds(), hcalRecHitTable_cff::detId, endcapRing_, TrackerGeometry::getDetectorType(), idDet_, TrackerGeometry::idToDetUnit(), TrackerTopology::layer(), layerId_, SiStripPI::max, SiStripPI::min, moduleMaxPhi_, moduleMaxR_, moduleMaxZ_, moduleMinPhi_, moduleMinR_, moduleMinZ_, PixelTopology::nrows(), nStrips_, outerModuleAtSmallerR_, TrackerTopology::partnerDetId(), PV3DBase< T, PVType, FrameType >::perp(), TrackerGeometry::Ph2PSP, PV3DBase< T, PVType, FrameType >::phi(), PixelTopology::pitch(), GeomDet::position(), psModule_, HLT_2024v14_cff::R0, sensorWidth_, TrackerTopology::side(), sigmaPar_, sigmaPerp_, mathSSE::sqrt(), stripLength_, stripPitch_, GeomDet::surface(), StripSubdetector::TIB, TrackerTopology::tidRing(), TrackerTopology::tidWheel(), StripSubdetector::TOB, unit(), PV3DBase< T, PVType, FrameType >::z(), and Z0.

Referenced by Stub().

92  {
93  idDet_ = detId();
94 
95  // Get min & max (r,phi,z) coordinates of the centre of the two sensors containing this stub.
96  const GeomDetUnit* det0 = trackerGeometry->idToDetUnit(detId);
97  const GeomDetUnit* det1 = trackerGeometry->idToDetUnit(trackerTopology->partnerDetId(detId));
98 
99  float R0 = det0->position().perp();
100  float R1 = det1->position().perp();
101  float PHI0 = det0->position().phi();
102  float PHI1 = det1->position().phi();
103  float Z0 = det0->position().z();
104  float Z1 = det1->position().z();
105  moduleMinR_ = std::min(R0, R1);
106  moduleMaxR_ = std::max(R0, R1);
107  moduleMinPhi_ = std::min(PHI0, PHI1);
108  moduleMaxPhi_ = std::max(PHI0, PHI1);
109  moduleMinZ_ = std::min(Z0, Z1);
110  moduleMaxZ_ = std::max(Z0, Z1);
111 
112  // Note if module is PS or 2S, and whether in barrel or endcap.
113  psModule_ =
114  trackerGeometry->getDetectorType(detId) ==
116  Ph2PSP; // From https://github.com/cms-sw/cmssw/blob/CMSSW_8_1_X/Geometry/TrackerGeometryBuilder/README.md
117  barrel_ = detId.subdetId() == StripSubdetector::TOB || detId.subdetId() == StripSubdetector::TIB;
118 
119  // Encode layer ID.
120  if (barrel_) {
121  layerId_ = trackerTopology->layer(detId); // barrel layer 1-6 encoded as 1-6
122  } else {
123  // layerId_ = 10*detId.iSide() + detId.iDisk(); // endcap layer 1-5 encoded as 11-15 (endcap A) or 21-25 (endcapB)
124  // EJC This seems to give the same encoding
125  layerId_ = 10 * trackerTopology->side(detId) + trackerTopology->tidWheel(detId);
126  }
127 
128  // Note module ring in endcap
129  // endcapRing_ = barrel_ ? 0 : detId.iRing();
130  endcapRing_ = barrel_ ? 0 : trackerTopology->tidRing(detId);
131 
132  // Get sensor strip or pixel pitch using innermost sensor of pair.
133 
134  const PixelGeomDetUnit* unit = reinterpret_cast<const PixelGeomDetUnit*>(det0);
135  const PixelTopology& topo = unit->specificTopology();
136  const Bounds& bounds = det0->surface().bounds();
137 
138  std::pair<float, float> pitch = topo.pitch();
139  stripPitch_ = pitch.first; // Strip pitch (or pixel pitch along shortest axis)
140  stripLength_ = pitch.second; // Strip length (or pixel pitch along longest axis)
141  nStrips_ = topo.nrows(); // No. of strips in sensor
142  sensorWidth_ = bounds.width(); // Width of sensitive region of sensor (= stripPitch * nStrips).
143 
144  outerModuleAtSmallerR_ = false;
145  if (barrel_ && det0->position().perp() > det1->position().perp()) {
146  outerModuleAtSmallerR_ = true;
147  }
148 
149  sigmaPerp_ = stripPitch_ / sqrt(12.); // resolution perpendicular to strip (or to longest pixel axis)
150  sigmaPar_ = stripLength_ / sqrt(12.); // resolution parallel to strip (or to longest pixel axis)
151  }
T perp() const
Definition: PV3DBase.h:69
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
T z() const
Definition: PV3DBase.h:61
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
unsigned int tidWheel(const DetId &id) const
virtual int nrows() const =0
unsigned int idDet_
Definition: Stub.h:92
float moduleMaxPhi_
Definition: Stub.h:96
float moduleMinPhi_
Definition: Stub.h:95
unsigned int side(const DetId &id) const
unsigned int layerId_
Definition: Stub.h:100
unsigned int layer(const DetId &id) const
ModuleType getDetectorType(DetId) const
T sqrt(T t)
Definition: SSEVec.h:23
unsigned int nStrips_
Definition: Stub.h:107
float moduleMaxR_
Definition: Stub.h:94
DetId partnerDetId(const DetId &id) const
static constexpr auto TOB
Basic3DVector unit() const
float moduleMinZ_
Definition: Stub.h:97
float stripLength_
Definition: Stub.h:106
static constexpr auto TIB
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
static const double Z0
bool outerModuleAtSmallerR_
Definition: Stub.h:109
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
float sensorWidth_
Definition: Stub.h:108
unsigned int endcapRing_
Definition: Stub.h:101
float moduleMinR_
Definition: Stub.h:93
unsigned int tidRing(const DetId &id) const
float moduleMaxZ_
Definition: Stub.h:98
Definition: Bounds.h:18
virtual std::pair< float, float > pitch() const =0
const Bounds & bounds() const
Definition: Surface.h:87

◆ z()

float l1tVertexFinder::Stub::z ( ) const
inline

Definition at line 59 of file Stub.h.

References z_.

Referenced by geometryXMLparser.Alignable::pos(), and ntupleDataFormat._HitObject::r3D().

59 { return z_; }

Member Data Documentation

◆ assocTP_

TrackingParticlePtr l1tVertexFinder::Stub::assocTP_
private

Definition at line 111 of file Stub.h.

Referenced by assocTP(), and fillTruth().

◆ assocTPs_

std::set<TrackingParticlePtr> l1tVertexFinder::Stub::assocTPs_
private

Definition at line 112 of file Stub.h.

Referenced by assocTPs(), and fillTruth().

◆ barrel_

bool l1tVertexFinder::Stub::barrel_
private

Definition at line 102 of file Stub.h.

Referenced by setModuleInfo().

◆ endcapRing_

unsigned int l1tVertexFinder::Stub::endcapRing_
private

Definition at line 101 of file Stub.h.

Referenced by setModuleInfo().

◆ idDet_

unsigned int l1tVertexFinder::Stub::idDet_
private

Definition at line 92 of file Stub.h.

Referenced by setModuleInfo().

◆ layerId_

unsigned int l1tVertexFinder::Stub::layerId_
private

Definition at line 100 of file Stub.h.

Referenced by layerId(), and setModuleInfo().

◆ moduleMaxPhi_

float l1tVertexFinder::Stub::moduleMaxPhi_
private

Definition at line 96 of file Stub.h.

Referenced by setModuleInfo().

◆ moduleMaxR_

float l1tVertexFinder::Stub::moduleMaxR_
private

Definition at line 94 of file Stub.h.

Referenced by setModuleInfo().

◆ moduleMaxZ_

float l1tVertexFinder::Stub::moduleMaxZ_
private

Definition at line 98 of file Stub.h.

Referenced by setModuleInfo().

◆ moduleMinPhi_

float l1tVertexFinder::Stub::moduleMinPhi_
private

Definition at line 95 of file Stub.h.

Referenced by setModuleInfo().

◆ moduleMinR_

float l1tVertexFinder::Stub::moduleMinR_
private

Definition at line 93 of file Stub.h.

Referenced by setModuleInfo().

◆ moduleMinZ_

float l1tVertexFinder::Stub::moduleMinZ_
private

Definition at line 97 of file Stub.h.

Referenced by setModuleInfo().

◆ nStrips_

unsigned int l1tVertexFinder::Stub::nStrips_
private

Definition at line 107 of file Stub.h.

Referenced by setModuleInfo().

◆ outerModuleAtSmallerR_

bool l1tVertexFinder::Stub::outerModuleAtSmallerR_
private

Definition at line 109 of file Stub.h.

Referenced by setModuleInfo().

◆ phi_

float l1tVertexFinder::Stub::phi_
private

Definition at line 87 of file Stub.h.

Referenced by phi(), and Stub().

◆ psModule_

bool l1tVertexFinder::Stub::psModule_
private

Definition at line 99 of file Stub.h.

Referenced by psModule(), and setModuleInfo().

◆ r_

float l1tVertexFinder::Stub::r_
private

Definition at line 88 of file Stub.h.

Referenced by r(), and Stub().

◆ sensorWidth_

float l1tVertexFinder::Stub::sensorWidth_
private

Definition at line 108 of file Stub.h.

Referenced by setModuleInfo().

◆ settings_

const AnalysisSettings* l1tVertexFinder::Stub::settings_
private

Definition at line 85 of file Stub.h.

Referenced by fillTruth(), and Stub().

◆ sigmaPar_

float l1tVertexFinder::Stub::sigmaPar_
private

Definition at line 104 of file Stub.h.

Referenced by setModuleInfo().

◆ sigmaPerp_

float l1tVertexFinder::Stub::sigmaPerp_
private

Definition at line 103 of file Stub.h.

Referenced by setModuleInfo().

◆ stripLength_

float l1tVertexFinder::Stub::stripLength_
private

Definition at line 106 of file Stub.h.

Referenced by setModuleInfo().

◆ stripPitch_

float l1tVertexFinder::Stub::stripPitch_
private

Definition at line 105 of file Stub.h.

Referenced by setModuleInfo().

◆ z_

float l1tVertexFinder::Stub::z_
private

Definition at line 89 of file Stub.h.

Referenced by Stub(), and z().