CMS 3D CMS Logo

Stub.cc
Go to the documentation of this file.
2 
3 namespace l1tVertexFinder {
4 
5  //=== Store useful info about this stub.
6 
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) {}
30 
31  Stub::Stub(const TTStubRef& ttStubRef,
32  const AnalysisSettings& settings,
33  const TrackerGeometry* trackerGeometry,
34  const TrackerTopology* trackerTopology)
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  }
55 
56  //=== Note which tracking particle(s), if any, produced this stub.
57  void Stub::fillTruth(edm::Handle<TTStubAssMap> mcTruthTTStubHandle,
58  edm::Handle<TTClusterAssMap> mcTruthTTClusterHandle) {
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  }
89 
90  void Stub::setModuleInfo(const TrackerGeometry* trackerGeometry,
91  const TrackerTopology* trackerTopology,
92  const DetId& detId) {
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
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  }
152 
153 } // end namespace l1tVertexFinder
GeomDet::position
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
l1tVertexFinder
Definition: AlgoSettings.h:10
TrackerGeometry::idToDet
const TrackerGeomDet * idToDet(DetId) const override
Definition: TrackerGeometry.cc:193
TrackerTopology::side
unsigned int side(const DetId &id) const
Definition: TrackerTopology.cc:28
Bounds::width
virtual float width() const =0
l1tVertexFinder::AnalysisSettings
Definition: AnalysisSettings.h:15
funct::false
false
Definition: Factorize.h:29
GeomDet
Definition: GeomDet.h:27
l1tVertexFinder::Stub::phi_
float phi_
Definition: Stub.h:87
l1tVertexFinder::Stub::moduleMinPhi_
float moduleMinPhi_
Definition: Stub.h:95
l1tVertexFinder::Stub::psModule_
bool psModule_
Definition: Stub.h:99
min
T min(T a, T b)
Definition: MathUtil.h:58
TrackerTopology
Definition: TrackerTopology.h:16
pos
Definition: PixelAliasList.h:18
PixelTopology::pitch
virtual std::pair< float, float > pitch() const =0
l1tVertexFinder::Stub::fillTruth
void fillTruth(edm::Handle< TTStubAssMap > mcTruthTTStubHandle, edm::Handle< TTClusterAssMap > mcTruthTTClusterHandle)
Definition: Stub.cc:57
l1tVertexFinder::Stub::moduleMaxPhi_
float moduleMaxPhi_
Definition: Stub.h:96
l1tVertexFinder::Stub::sigmaPerp_
float sigmaPerp_
Definition: Stub.h:103
Bounds
Definition: Bounds.h:18
TrackerTopology::layer
unsigned int layer(const DetId &id) const
Definition: TrackerTopology.cc:47
l1tVertexFinder::Stub::assocTPs_
std::set< TrackingParticlePtr > assocTPs_
Definition: Stub.h:112
TrackerGeometry::getDetectorType
ModuleType getDetectorType(DetId) const
Definition: TrackerGeometry.cc:247
l1tVertexFinder::Stub::barrel_
bool barrel_
Definition: Stub.h:102
edm::Handle
Definition: AssociativeIterator.h:50
l1tVertexFinder::Stub::idDet_
unsigned int idDet_
Definition: Stub.h:92
l1tVertexFinder::Stub::settings_
const AnalysisSettings * settings_
Definition: Stub.h:85
TrackerTopology::tidRing
unsigned int tidRing(const DetId &id) const
Definition: TrackerTopology.h:218
edm::Ref
Definition: AssociativeIterator.h:58
TrackerTopology::tidWheel
unsigned int tidWheel(const DetId &id) const
Definition: TrackerTopology.h:201
TrackerGeometry::idToDetUnit
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: TrackerGeometry.cc:183
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
DetId
Definition: DetId.h:17
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
l1tVertexFinder::Stub::layerId_
unsigned int layerId_
Definition: Stub.h:100
PixelGeomDetUnit
Definition: PixelGeomDetUnit.h:15
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
Surface::bounds
const Bounds & bounds() const
Definition: Surface.h:87
TrackerTopology::partnerDetId
DetId partnerDetId(const DetId &id) const
Definition: TrackerTopology.cc:233
StripSubdetector::TIB
static constexpr auto TIB
Definition: StripSubdetector.h:16
PixelTopology
Definition: PixelTopology.h:10
l1tVertexFinder::Stub::moduleMaxR_
float moduleMaxR_
Definition: Stub.h:94
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
l1tVertexFinder::Stub::moduleMinZ_
float moduleMinZ_
Definition: Stub.h:97
l1tVertexFinder::Stub::Stub
Stub()
Definition: Stub.cc:7
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
l1tVertexFinder::Stub::stripLength_
float stripLength_
Definition: Stub.h:106
l1tVertexFinder::Stub::sigmaPar_
float sigmaPar_
Definition: Stub.h:104
l1tVertexFinder::Stub::stripPitch_
float stripPitch_
Definition: Stub.h:105
l1tVertexFinder::Stub::nStrips_
unsigned int nStrips_
Definition: Stub.h:107
unit
Basic3DVector unit() const
Definition: Basic3DVectorLD.h:162
edm::Ptr< TrackingParticle >
l1tVertexFinder::Stub::sensorWidth_
float sensorWidth_
Definition: Stub.h:108
l1tVertexFinder::AnalysisSettings::stubMatchStrict
bool stubMatchStrict() const
Definition: AnalysisSettings.h:51
l1tVertexFinder::Stub::setModuleInfo
void setModuleInfo(const TrackerGeometry *trackerGeometry, const TrackerTopology *trackerTopology, const DetId &detId)
Definition: Stub.cc:90
l1tVertexFinder::Stub::endcapRing_
unsigned int endcapRing_
Definition: Stub.h:101
l1tVertexFinder::AlgoSettings::trackerOuterRadius
double trackerOuterRadius() const
Definition: AlgoSettings.h:75
Exception
Definition: hltDiff.cc:245
l1tVertexFinder::AlgoSettings::trackerHalfLength
double trackerHalfLength() const
Definition: AlgoSettings.h:78
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
l1tVertexFinder::Stub::r_
float r_
Definition: Stub.h:88
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
l1tVertexFinder::Stub::outerModuleAtSmallerR_
bool outerModuleAtSmallerR_
Definition: Stub.h:109
HLT_FULL_cff.R0
R0
Definition: HLT_FULL_cff.py:8652
l1tVertexFinder::Stub::moduleMaxZ_
float moduleMaxZ_
Definition: Stub.h:98
PixelTopology::nrows
virtual int nrows() const =0
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
edm::Ptr::isNull
bool isNull() const
Checks for null.
Definition: Ptr.h:142
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
l1tVertexFinder::Stub::assocTP_
TrackingParticlePtr assocTP_
Definition: Stub.h:111
Z0
static const double Z0
Definition: CastorGeometryData.h:32
l1tVertexFinder::Stub::moduleMinR_
float moduleMinR_
Definition: Stub.h:93
TrackerGeometry::ModuleType::Ph2PSP
l1tVertexFinder::Stub::z_
float z_
Definition: Stub.h:89
TrackerGeometry
Definition: TrackerGeometry.h:14
Stub.h