CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
TrackerValidationVariables Class Reference

#include <TrackerValidationVariables.h>

Classes

struct  AVHitStruct
 
struct  AVTrackStruct
 

Public Member Functions

void fillHitQuantities (const Trajectory *trajectory, std::vector< AVHitStruct > &v_avhitout)
 
void fillHitQuantities (reco::Track const &track, std::vector< AVHitStruct > &v_avhitout)
 
void fillTrackQuantities (const edm::Event &, const edm::EventSetup &, std::vector< AVTrackStruct > &v_avtrackout)
 
void fillTrackQuantities (const edm::Event &event, const edm::EventSetup &eventSetup, std::function< bool(const reco::Track &)> trackFilter, std::vector< AVTrackStruct > &v_avtrackout)
 
 TrackerValidationVariables (const edm::ParameterSet &config, edm::ConsumesCollector &&iC)
 
 ~TrackerValidationVariables ()
 

Private Attributes

edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagneticFieldToken_
 
edm::EDGetTokenT< std::vector< reco::Track > > tracksToken_
 
edm::EDGetTokenT< std::vector< Trajectory > > trajCollectionToken_
 

Detailed Description

Definition at line 22 of file TrackerValidationVariables.h.

Constructor & Destructor Documentation

◆ TrackerValidationVariables()

TrackerValidationVariables::TrackerValidationVariables ( const edm::ParameterSet config,
edm::ConsumesCollector &&  iC 
)

Definition at line 46 of file TrackerValidationVariables.cc.

49  iC.consumes<std::vector<Trajectory>>(edm::InputTag(config.getParameter<std::string>("trajectoryInput")));
50  tracksToken_ = iC.consumes<reco::TrackCollection>(config.getParameter<edm::InputTag>("Tracks"));
51 }

References SiStripFineDelayHit_cfi::MagneticField.

◆ ~TrackerValidationVariables()

TrackerValidationVariables::~TrackerValidationVariables ( )

Definition at line 53 of file TrackerValidationVariables.cc.

53 {}

Member Function Documentation

◆ fillHitQuantities() [1/2]

void TrackerValidationVariables::fillHitQuantities ( const Trajectory trajectory,
std::vector< AVHitStruct > &  v_avhitout 
)

Definition at line 184 of file TrackerValidationVariables.cc.

184  {
185  TrajectoryStateCombiner tsoscomb;
186 
187  const std::vector<TrajectoryMeasurement>& tmColl = trajectory->measurements();
188  for (std::vector<TrajectoryMeasurement>::const_iterator itTraj = tmColl.begin(); itTraj != tmColl.end(); ++itTraj) {
189  if (!itTraj->updatedState().isValid())
190  continue;
191 
192  TrajectoryStateOnSurface tsos = tsoscomb(itTraj->forwardPredictedState(), itTraj->backwardPredictedState());
193  if (!tsos.isValid())
194  continue;
196 
197  if (!hit->isValid() || hit->geographicalId().det() != DetId::Tracker)
198  continue;
199 
200  AVHitStruct hitStruct;
201  const DetId& hit_detId = hit->geographicalId();
202  unsigned int IntRawDetID = (hit_detId.rawId());
203  unsigned int IntSubDetID = (hit_detId.subdetId());
204 
205  if (IntSubDetID == 0)
206  continue;
207 
208  if (IntSubDetID == PixelSubdetector::PixelBarrel || IntSubDetID == PixelSubdetector::PixelEndcap) {
209  const SiPixelRecHit* prechit = dynamic_cast<const SiPixelRecHit*>(
210  hit.get()); //to be used to get the associated cluster and the cluster probability
211  if (prechit->isOnEdge())
212  hitStruct.isOnEdgePixel = true;
213  if (prechit->hasBadPixels())
214  hitStruct.isOtherBadPixel = true;
215  }
216 
217  //first calculate residuals in cartesian coordinates in the local module coordinate system
218 
219  LocalPoint lPHit = hit->localPosition();
220  LocalPoint lPTrk = tsos.localPosition();
221  LocalVector lVTrk = tsos.localDirection();
222 
223  hitStruct.localAlpha = atan2(lVTrk.x(), lVTrk.z()); // wrt. normal tg(alpha)=x/z
224  hitStruct.localBeta = atan2(lVTrk.y(), lVTrk.z()); // wrt. normal tg(beta)= y/z
225 
226  LocalError errHit = hit->localPositionError();
227  // no need to add APE to hitError anymore
228  // AlgebraicROOTObject<2>::SymMatrix mat = asSMatrix<2>(hit->parametersError());
229  // LocalError errHit = LocalError( mat(0,0),mat(0,1),mat(1,1) );
230  LocalError errTrk = tsos.localError().positionError();
231 
232  //check for negative error values: track error can have negative value, if matrix inversion fails (very rare case)
233  //hit error should always give positive values
234  if (errHit.xx() < 0. || errHit.yy() < 0. || errTrk.xx() < 0. || errTrk.yy() < 0.) {
235  edm::LogError("TrackerValidationVariables")
236  << "@SUB=TrackerValidationVariables::fillHitQuantities"
237  << "One of the squared error methods gives negative result"
238  << "\n\terrHit.xx()\terrHit.yy()\terrTrk.xx()\terrTrk.yy()"
239  << "\n\t" << errHit.xx() << "\t" << errHit.yy() << "\t" << errTrk.xx() << "\t" << errTrk.yy();
240  continue;
241  }
242 
243  align::LocalVector res = lPTrk - lPHit;
244 
245  float resXErr = std::sqrt(errHit.xx() + errTrk.xx());
246  float resYErr = std::sqrt(errHit.yy() + errTrk.yy());
247 
248  hitStruct.resX = res.x();
249  hitStruct.resY = res.y();
250  hitStruct.resErrX = resXErr;
251  hitStruct.resErrY = resYErr;
252 
253  // hitStruct.localX = lPhit.x();
254  // hitStruct.localY = lPhit.y();
255  // EM: use predictions for local coordinates
256  hitStruct.localX = lPTrk.x();
257  hitStruct.localY = lPTrk.y();
258 
259  // now calculate residuals taking global orientation of modules and radial topology in TID/TEC into account
260  float resXprime(999.F), resYprime(999.F);
261  float resXatTrkY(999.F);
262  float resXprimeErr(999.F), resYprimeErr(999.F);
263 
264  if (hit->detUnit()) { // is it a single physical module?
265  const GeomDetUnit& detUnit = *(hit->detUnit());
266  float uOrientation(-999.F), vOrientation(-999.F);
267  float resXTopol(999.F), resYTopol(999.F);
268  float resXatTrkYTopol(999.F);
269 
270  const Surface& surface = hit->detUnit()->surface();
271  const BoundPlane& boundplane = hit->detUnit()->surface();
272  const Bounds& bound = boundplane.bounds();
273 
274  float length = 0;
275  float width = 0;
276 
277  LocalPoint lPModule(0., 0., 0.), lUDirection(1., 0., 0.), lVDirection(0., 1., 0.);
278  GlobalPoint gPModule = surface.toGlobal(lPModule), gUDirection = surface.toGlobal(lUDirection),
279  gVDirection = surface.toGlobal(lVDirection);
280 
281  if (IntSubDetID == PixelSubdetector::PixelBarrel || IntSubDetID == StripSubdetector::TIB ||
282  IntSubDetID == StripSubdetector::TOB) {
283  uOrientation = deltaPhi(gUDirection.barePhi(), gPModule.barePhi()) >= 0. ? +1.F : -1.F;
284  vOrientation = gVDirection.z() - gPModule.z() >= 0 ? +1.F : -1.F;
285  resXTopol = res.x();
286  resXatTrkYTopol = res.x();
287  resYTopol = res.y();
288  resXprimeErr = resXErr;
289  resYprimeErr = resYErr;
290 
291  const RectangularPlaneBounds* rectangularBound = dynamic_cast<const RectangularPlaneBounds*>(&bound);
292  if (rectangularBound != nullptr) {
293  hitStruct.inside = rectangularBound->inside(lPTrk);
294  length = rectangularBound->length();
295  width = rectangularBound->width();
296  hitStruct.localXnorm = 2 * hitStruct.localX / width;
297  hitStruct.localYnorm = 2 * hitStruct.localY / length;
298  } else {
299  throw cms::Exception("Geometry Error") << "[TrackerValidationVariables] Cannot cast bounds to "
300  "RectangularPlaneBounds as expected for TPB, TIB and TOB";
301  }
302 
303  } else if (IntSubDetID == PixelSubdetector::PixelEndcap) {
304  uOrientation = gUDirection.perp() - gPModule.perp() >= 0 ? +1.F : -1.F;
305  vOrientation = deltaPhi(gVDirection.barePhi(), gPModule.barePhi()) >= 0. ? +1.F : -1.F;
306  resXTopol = res.x();
307  resXatTrkYTopol = res.x();
308  resYTopol = res.y();
309  resXprimeErr = resXErr;
310  resYprimeErr = resYErr;
311 
312  const RectangularPlaneBounds* rectangularBound = dynamic_cast<const RectangularPlaneBounds*>(&bound);
313  if (rectangularBound != nullptr) {
314  hitStruct.inside = rectangularBound->inside(lPTrk);
315  length = rectangularBound->length();
316  width = rectangularBound->width();
317  hitStruct.localXnorm = 2 * hitStruct.localX / width;
318  hitStruct.localYnorm = 2 * hitStruct.localY / length;
319  } else {
320  throw cms::Exception("Geometry Error")
321  << "[TrackerValidationVariables] Cannot cast bounds to RectangularPlaneBounds as expected for TPE";
322  }
323 
324  } else if (IntSubDetID == StripSubdetector::TID || IntSubDetID == StripSubdetector::TEC) {
325  uOrientation = deltaPhi(gUDirection.barePhi(), gPModule.barePhi()) >= 0. ? +1.F : -1.F;
326  vOrientation = gVDirection.perp() - gPModule.perp() >= 0. ? +1.F : -1.F;
327 
328  if (!dynamic_cast<const RadialStripTopology*>(&detUnit.type().topology()))
329  continue;
330  const RadialStripTopology& topol = dynamic_cast<const RadialStripTopology&>(detUnit.type().topology());
331 
332  MeasurementPoint measHitPos = topol.measurementPosition(lPHit);
333  MeasurementPoint measTrkPos = topol.measurementPosition(lPTrk);
334 
335  MeasurementError measHitErr = topol.measurementError(lPHit, errHit);
336  MeasurementError measTrkErr = topol.measurementError(lPTrk, errTrk);
337 
338  if (measHitErr.uu() < 0. || measHitErr.vv() < 0. || measTrkErr.uu() < 0. || measTrkErr.vv() < 0.) {
339  edm::LogError("TrackerValidationVariables")
340  << "@SUB=TrackerValidationVariables::fillHitQuantities"
341  << "One of the squared error methods gives negative result"
342  << "\n\tmeasHitErr.uu()\tmeasHitErr.vv()\tmeasTrkErr.uu()\tmeasTrkErr.vv()"
343  << "\n\t" << measHitErr.uu() << "\t" << measHitErr.vv() << "\t" << measTrkErr.uu() << "\t"
344  << measTrkErr.vv();
345  continue;
346  }
347 
348  float localStripLengthHit = topol.localStripLength(lPHit);
349  float localStripLengthTrk = topol.localStripLength(lPTrk);
350  float phiHit = topol.stripAngle(measHitPos.x());
351  float phiTrk = topol.stripAngle(measTrkPos.x());
352  float r_0 = topol.originToIntersection();
353 
354  resXTopol = (phiTrk - phiHit) * r_0;
355  // resXTopol = (tan(phiTrk)-tan(phiHit))*r_0;
356 
357  LocalPoint LocalHitPosCor = topol.localPosition(MeasurementPoint(measHitPos.x(), measTrkPos.y()));
358  resXatTrkYTopol = lPTrk.x() - LocalHitPosCor.x();
359 
360  //resYTopol = measTrkPos.y()*localStripLengthTrk - measHitPos.y()*localStripLengthHit;
361  float cosPhiHit(cos(phiHit)), cosPhiTrk(cos(phiTrk)), sinPhiHit(sin(phiHit)), sinPhiTrk(sin(phiTrk));
362  float l_0 = r_0 - topol.detHeight() / 2;
363  resYTopol = measTrkPos.y() * localStripLengthTrk - measHitPos.y() * localStripLengthHit +
364  l_0 * (1 / cosPhiTrk - 1 / cosPhiHit);
365 
366  resXprimeErr = std::sqrt(measHitErr.uu() + measTrkErr.uu()) * topol.angularWidth() * r_0;
367  //resYprimeErr = std::sqrt(measHitErr.vv()*localStripLengthHit*localStripLengthHit + measTrkErr.vv()*localStripLengthTrk*localStripLengthTrk);
368  float helpSummand = l_0 * l_0 * topol.angularWidth() * topol.angularWidth() *
369  (sinPhiHit * sinPhiHit / pow(cosPhiHit, 4) * measHitErr.uu() +
370  sinPhiTrk * sinPhiTrk / pow(cosPhiTrk, 4) * measTrkErr.uu());
371  resYprimeErr = std::sqrt(measHitErr.vv() * localStripLengthHit * localStripLengthHit +
372  measTrkErr.vv() * localStripLengthTrk * localStripLengthTrk + helpSummand);
373 
374  const TrapezoidalPlaneBounds* trapezoidalBound = dynamic_cast<const TrapezoidalPlaneBounds*>(&bound);
375  if (trapezoidalBound != nullptr) {
376  hitStruct.inside = trapezoidalBound->inside(lPTrk);
377  length = trapezoidalBound->length();
378  width = trapezoidalBound->width();
379  //float widthAtHalfLength = trapezoidalBound->widthAtHalfLength();
380 
381  // int yAxisOrientation=trapezoidalBound->yAxisOrientation();
382  // for trapezoidal shape modules, scale with as function of local y coordinate
383  // float widthAtlocalY=width-(1-yAxisOrientation*2*lPTrk.y()/length)*(width-widthAtHalfLength);
384  // hitStruct.localXnorm = 2*hitStruct.localX/widthAtlocalY;
385  hitStruct.localXnorm = 2 * hitStruct.localX / width;
386  hitStruct.localYnorm = 2 * hitStruct.localY / length;
387  } else {
388  throw cms::Exception("Geometry Error") << "[TrackerValidationVariables] Cannot cast bounds to "
389  "TrapezoidalPlaneBounds as expected for TID and TEC";
390  }
391 
392  } else {
393  edm::LogWarning("TrackerValidationVariables") << "@SUB=TrackerValidationVariables::fillHitQuantities"
394  << "No valid tracker subdetector " << IntSubDetID;
395  continue;
396  }
397 
398  resXprime = resXTopol * uOrientation;
399  resXatTrkY = resXatTrkYTopol;
400  resYprime = resYTopol * vOrientation;
401 
402  } else { // not a detUnit, so must be a virtual 2D-Module
403  // FIXME: at present only for det units residuals are calculated and filled in the hitStruct
404  // But in principle this method should also be useable for the gluedDets (2D modules in TIB, TID, TOB, TEC)
405  // In this case, only orientation should be taken into account for primeResiduals, but not the radial topology
406  // At present, default values (999.F) are given out
407  }
408 
409  hitStruct.resXprime = resXprime;
410  hitStruct.resXatTrkY = resXatTrkY;
411  hitStruct.resYprime = resYprime;
412  hitStruct.resXprimeErr = resXprimeErr;
413  hitStruct.resYprimeErr = resYprimeErr;
414 
415  hitStruct.rawDetId = IntRawDetID;
416  hitStruct.phi = tsos.globalDirection().phi();
417  hitStruct.eta = tsos.globalDirection().eta();
418 
419  v_avhitout.push_back(hitStruct);
420  }
421 }

References RadialStripTopology::angularWidth(), PV3DBase< T, PVType, FrameType >::barePhi(), funct::cos(), SiPixelRawToDigiRegional_cfi::deltaPhi, RadialStripTopology::detHeight(), TrackerValidationVariables::AVHitStruct::eta, PV3DBase< T, PVType, FrameType >::eta(), Exception, F(), TrajectoryStateOnSurface::globalDirection(), SiPixelRecHit::hasBadPixels(), RectangularPlaneBounds::inside(), TrackerValidationVariables::AVHitStruct::inside, SiPixelRecHit::isOnEdge(), TrackerValidationVariables::AVHitStruct::isOnEdgePixel, TrackerValidationVariables::AVHitStruct::isOtherBadPixel, TrajectoryStateOnSurface::isValid(), RectangularPlaneBounds::length(), TrackerValidationVariables::AVHitStruct::localAlpha, TrackerValidationVariables::AVHitStruct::localBeta, TrajectoryStateOnSurface::localDirection(), TrajectoryStateOnSurface::localError(), RadialStripTopology::localPosition(), TrajectoryStateOnSurface::localPosition(), RadialStripTopology::localStripLength(), TrackerValidationVariables::AVHitStruct::localX, TrackerValidationVariables::AVHitStruct::localXnorm, TrackerValidationVariables::AVHitStruct::localY, TrackerValidationVariables::AVHitStruct::localYnorm, RadialStripTopology::measurementError(), RadialStripTopology::measurementPosition(), Trajectory::measurements(), RadialStripTopology::originToIntersection(), PV3DBase< T, PVType, FrameType >::perp(), TrackerValidationVariables::AVHitStruct::phi, PV3DBase< T, PVType, FrameType >::phi(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, LocalTrajectoryError::positionError(), funct::pow(), TrackerValidationVariables::AVHitStruct::rawDetId, DetId::rawId(), TrackerValidationVariables::AVHitStruct::resErrX, TrackerValidationVariables::AVHitStruct::resErrY, TrackerValidationVariables::AVHitStruct::resX, TrackerValidationVariables::AVHitStruct::resXatTrkY, TrackerValidationVariables::AVHitStruct::resXprime, TrackerValidationVariables::AVHitStruct::resXprimeErr, TrackerValidationVariables::AVHitStruct::resY, TrackerValidationVariables::AVHitStruct::resYprime, TrackerValidationVariables::AVHitStruct::resYprimeErr, funct::sin(), mathSSE::sqrt(), RadialStripTopology::stripAngle(), DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, Surface::toGlobal(), GeomDetType::topology(), DetId::Tracker, GeomDet::type(), MeasurementError::uu(), MeasurementError::vv(), RectangularPlaneBounds::width(), ApeEstimator_cff::width, PV2DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), PV2DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::y(), LocalError::yy(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by fillTrackQuantities().

◆ fillHitQuantities() [2/2]

void TrackerValidationVariables::fillHitQuantities ( reco::Track const &  track,
std::vector< AVHitStruct > &  v_avhitout 
)

Definition at line 55 of file TrackerValidationVariables.cc.

55  {
56  auto const& trajParams = track.extra()->trajParams();
57  auto const& residuals = track.extra()->residuals();
58 
59  assert(trajParams.size() == track.recHitsSize());
60  auto hb = track.recHitsBegin();
61  for (unsigned int h = 0; h < track.recHitsSize(); h++) {
62  auto hit = *(hb + h);
63  if (!hit->isValid())
64  continue;
65 
66  AVHitStruct hitStruct;
67  const DetId& hit_detId = hit->geographicalId();
68  auto IntRawDetID = hit_detId.rawId();
69  auto IntSubDetID = hit_detId.subdetId();
70 
71  if (IntSubDetID == 0)
72  continue;
73 
74  if (IntSubDetID == PixelSubdetector::PixelBarrel || IntSubDetID == PixelSubdetector::PixelEndcap) {
75  const SiPixelRecHit* prechit = dynamic_cast<const SiPixelRecHit*>(
76  hit); //to be used to get the associated cluster and the cluster probability
77  if (prechit->isOnEdge())
78  hitStruct.isOnEdgePixel = true;
79  if (prechit->hasBadPixels())
80  hitStruct.isOtherBadPixel = true;
81  }
82 
83  auto lPTrk = trajParams[h].position(); // update state
84  auto lVTrk = trajParams[h].direction();
85 
86  auto gtrkdirup = hit->surface()->toGlobal(lVTrk);
87 
88  hitStruct.rawDetId = IntRawDetID;
89  hitStruct.phi = gtrkdirup.phi(); // direction, not position
90  hitStruct.eta = gtrkdirup.eta(); // same
91 
92  hitStruct.localAlpha = std::atan2(lVTrk.x(), lVTrk.z()); // wrt. normal tg(alpha)=x/z
93  hitStruct.localBeta = std::atan2(lVTrk.y(), lVTrk.z()); // wrt. normal tg(beta)= y/z
94 
95  hitStruct.resX = residuals.residualX(h);
96  hitStruct.resY = residuals.residualY(h);
97  hitStruct.resErrX = hitStruct.resX / residuals.pullX(h); // for backward compatibility....
98  hitStruct.resErrY = hitStruct.resY / residuals.pullY(h);
99 
100  // hitStruct.localX = lPhit.x();
101  // hitStruct.localY = lPhit.y();
102  // EM: use predictions for local coordinates
103  hitStruct.localX = lPTrk.x();
104  hitStruct.localY = lPTrk.y();
105 
106  // now calculate residuals taking global orientation of modules and radial topology in TID/TEC into account
107  float resXprime(999.F), resYprime(999.F);
108  float resXatTrkY(999.F);
109  float resXprimeErr(999.F), resYprimeErr(999.F);
110 
111  if (hit->detUnit()) { // is it a single physical module?
112  float uOrientation(-999.F), vOrientation(-999.F);
113  float resXTopol(999.F), resYTopol(999.F);
114  float resXatTrkYTopol(999.F);
115 
116  const Surface& surface = hit->detUnit()->surface();
117  const BoundPlane& boundplane = hit->detUnit()->surface();
118  const Bounds& bound = boundplane.bounds();
119 
120  float length = 0;
121  float width = 0;
122 
123  LocalPoint lPModule(0., 0., 0.), lUDirection(1., 0., 0.), lVDirection(0., 1., 0.);
124  GlobalPoint gPModule = surface.toGlobal(lPModule), gUDirection = surface.toGlobal(lUDirection),
125  gVDirection = surface.toGlobal(lVDirection);
126 
127  if (IntSubDetID == PixelSubdetector::PixelBarrel || IntSubDetID == PixelSubdetector::PixelEndcap ||
128  IntSubDetID == StripSubdetector::TIB || IntSubDetID == StripSubdetector::TOB) {
129  if (IntSubDetID == PixelSubdetector::PixelEndcap) {
130  uOrientation = gUDirection.perp() - gPModule.perp() >= 0 ? +1.F : -1.F;
131  vOrientation = deltaPhi(gVDirection.barePhi(), gPModule.barePhi()) >= 0. ? +1.F : -1.F;
132  } else {
133  uOrientation = deltaPhi(gUDirection.barePhi(), gPModule.barePhi()) >= 0. ? +1.F : -1.F;
134  vOrientation = gVDirection.z() - gPModule.z() >= 0 ? +1.F : -1.F;
135  }
136 
137  resXTopol = hitStruct.resX;
138  resXatTrkYTopol = hitStruct.resX;
139  resYTopol = hitStruct.resY;
140  resXprimeErr = hitStruct.resErrX;
141  resYprimeErr = hitStruct.resErrY;
142 
143  const RectangularPlaneBounds* rectangularBound = dynamic_cast<const RectangularPlaneBounds*>(&bound);
144  if (rectangularBound != nullptr) {
145  hitStruct.inside = rectangularBound->inside(lPTrk);
146  length = rectangularBound->length();
147  width = rectangularBound->width();
148  hitStruct.localXnorm = 2 * hitStruct.localX / width;
149  hitStruct.localYnorm = 2 * hitStruct.localY / length;
150  } else {
151  throw cms::Exception("Geometry Error")
152  << "[TrackerValidationVariables] Cannot cast bounds to RectangularPlaneBounds as expected for TPE";
153  }
154 
155  } else if (IntSubDetID == StripSubdetector::TID || IntSubDetID == StripSubdetector::TEC) {
156  // not possible to compute precisely as with Trajectory
157  } else {
158  edm::LogWarning("TrackerValidationVariables") << "@SUB=TrackerValidationVariables::fillHitQuantities"
159  << "No valid tracker subdetector " << IntSubDetID;
160  continue;
161  }
162 
163  resXprime = resXTopol * uOrientation;
164  resXatTrkY = resXatTrkYTopol;
165  resYprime = resYTopol * vOrientation;
166 
167  } else { // not a detUnit, so must be a virtual 2D-Module
168  // FIXME: at present only for det units residuals are calculated and filled in the hitStruct
169  // But in principle this method should also be useable for the gluedDets (2D modules in TIB, TID, TOB, TEC)
170  // In this case, only orientation should be taken into account for primeResiduals, but not the radial topology
171  // At present, default values (999.F) are given out
172  }
173 
174  hitStruct.resXprime = resXprime;
175  hitStruct.resXatTrkY = resXatTrkY;
176  hitStruct.resYprime = resYprime;
177  hitStruct.resXprimeErr = resXprimeErr;
178  hitStruct.resYprimeErr = resYprimeErr;
179 
180  v_avhitout.push_back(hitStruct);
181  }
182 }

References cms::cuda::assert(), PV3DBase< T, PVType, FrameType >::barePhi(), SiPixelRawToDigiRegional_cfi::deltaPhi, TrackerValidationVariables::AVHitStruct::eta, Exception, F(), h, SiPixelRecHit::hasBadPixels(), hcalSimParameters_cfi::hb, RectangularPlaneBounds::inside(), TrackerValidationVariables::AVHitStruct::inside, SiPixelRecHit::isOnEdge(), TrackerValidationVariables::AVHitStruct::isOnEdgePixel, TrackerValidationVariables::AVHitStruct::isOtherBadPixel, RectangularPlaneBounds::length(), TrackerValidationVariables::AVHitStruct::localAlpha, TrackerValidationVariables::AVHitStruct::localBeta, TrackerValidationVariables::AVHitStruct::localX, TrackerValidationVariables::AVHitStruct::localXnorm, TrackerValidationVariables::AVHitStruct::localY, TrackerValidationVariables::AVHitStruct::localYnorm, PV3DBase< T, PVType, FrameType >::perp(), TrackerValidationVariables::AVHitStruct::phi, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, TrackerValidationVariables::AVHitStruct::rawDetId, DetId::rawId(), TrackerValidationVariables::AVHitStruct::resErrX, TrackerValidationVariables::AVHitStruct::resErrY, TrackerValidationVariables::AVHitStruct::resX, TrackerValidationVariables::AVHitStruct::resXatTrkY, TrackerValidationVariables::AVHitStruct::resXprime, TrackerValidationVariables::AVHitStruct::resXprimeErr, TrackerValidationVariables::AVHitStruct::resY, TrackerValidationVariables::AVHitStruct::resYprime, TrackerValidationVariables::AVHitStruct::resYprimeErr, DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, Surface::toGlobal(), HLT_2018_cff::track, RectangularPlaneBounds::width(), ApeEstimator_cff::width, and PV3DBase< T, PVType, FrameType >::z().

◆ fillTrackQuantities() [1/2]

void TrackerValidationVariables::fillTrackQuantities ( const edm::Event event,
const edm::EventSetup eventSetup,
std::vector< AVTrackStruct > &  v_avtrackout 
)

Definition at line 423 of file TrackerValidationVariables.cc.

425  {
427  event, eventSetup, [](const reco::Track&) -> bool { return true; }, v_avtrackout);
428 }

Referenced by TrackerOfflineValidation::analyze().

◆ fillTrackQuantities() [2/2]

void TrackerValidationVariables::fillTrackQuantities ( const edm::Event event,
const edm::EventSetup eventSetup,
std::function< bool(const reco::Track &)>  trackFilter,
std::vector< AVTrackStruct > &  v_avtrackout 
)

Definition at line 430 of file TrackerValidationVariables.cc.

433  {
435 
437  event.getByToken(tracksToken_, tracksH);
438  if (!tracksH.isValid())
439  return;
440  auto const& tracks = *tracksH;
441  auto ntrk = tracks.size();
442  LogDebug("TrackerValidationVariables") << "Track collection size " << ntrk;
443 
445  event.getByToken(trajCollectionToken_, trajsH);
446  bool yesTraj = trajsH.isValid();
447  std::vector<Trajectory> const* trajs = nullptr;
448  if (yesTraj)
449  trajs = &(*trajsH);
450  if (yesTraj)
451  assert(trajs->size() == tracks.size());
452 
453  Trajectory const* trajectory = nullptr;
454  for (unsigned int i = 0; i < ntrk; ++i) {
455  auto const& track = tracks[i];
456  if (yesTraj)
457  trajectory = &(*trajs)[i];
458 
459  if (!trackFilter(track))
460  continue;
461 
462  AVTrackStruct trackStruct;
463 
464  trackStruct.p = track.p();
465  trackStruct.pt = track.pt();
466  trackStruct.ptError = track.ptError();
467  trackStruct.px = track.px();
468  trackStruct.py = track.py();
469  trackStruct.pz = track.pz();
470  trackStruct.eta = track.eta();
471  trackStruct.phi = track.phi();
472  trackStruct.chi2 = track.chi2();
473  trackStruct.chi2Prob = TMath::Prob(track.chi2(), track.ndof());
474  trackStruct.normchi2 = track.normalizedChi2();
475  GlobalPoint gPoint(track.vx(), track.vy(), track.vz());
476  double theLocalMagFieldInInverseGeV = magneticField.inInverseGeV(gPoint).z();
477  trackStruct.kappa = -track.charge() * theLocalMagFieldInInverseGeV / track.pt();
478  trackStruct.charge = track.charge();
479  trackStruct.d0 = track.d0();
480  trackStruct.dz = track.dz();
481  trackStruct.numberOfValidHits = track.numberOfValidHits();
482  trackStruct.numberOfLostHits = track.numberOfLostHits();
483  if (trajectory)
484  fillHitQuantities(trajectory, trackStruct.hits);
485  else
486  fillHitQuantities(track, trackStruct.hits);
487 
488  v_avtrackout.push_back(trackStruct);
489  }
490 }

References cms::cuda::assert(), TrackerValidationVariables::AVTrackStruct::charge, TrackerValidationVariables::AVTrackStruct::chi2, TrackerValidationVariables::AVTrackStruct::chi2Prob, TrackerValidationVariables::AVTrackStruct::d0, TrackerValidationVariables::AVTrackStruct::dz, TrackerValidationVariables::AVTrackStruct::eta, fillHitQuantities(), edm::EventSetup::getData(), TrackerValidationVariables::AVTrackStruct::hits, mps_fire::i, edm::HandleBase::isValid(), TrackerValidationVariables::AVTrackStruct::kappa, LogDebug, HLT_2018_cff::magneticField, magneticFieldToken_, TrackerValidationVariables::AVTrackStruct::normchi2, TrackerValidationVariables::AVTrackStruct::numberOfLostHits, TrackerValidationVariables::AVTrackStruct::numberOfValidHits, TrackerValidationVariables::AVTrackStruct::p, TrackerValidationVariables::AVTrackStruct::phi, TrackerValidationVariables::AVTrackStruct::pt, TrackerValidationVariables::AVTrackStruct::ptError, TrackerValidationVariables::AVTrackStruct::px, TrackerValidationVariables::AVTrackStruct::py, TrackerValidationVariables::AVTrackStruct::pz, HLT_2018_cff::track, MinBiasPDSkim_cfg::trackFilter, PDWG_EXOHSCP_cff::tracks, tracksToken_, and trajCollectionToken_.

Member Data Documentation

◆ magneticFieldToken_

edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> TrackerValidationVariables::magneticFieldToken_
private

Definition at line 124 of file TrackerValidationVariables.h.

Referenced by fillTrackQuantities().

◆ tracksToken_

edm::EDGetTokenT<std::vector<reco::Track> > TrackerValidationVariables::tracksToken_
private

Definition at line 123 of file TrackerValidationVariables.h.

Referenced by fillTrackQuantities().

◆ trajCollectionToken_

edm::EDGetTokenT<std::vector<Trajectory> > TrackerValidationVariables::trajCollectionToken_
private

Definition at line 122 of file TrackerValidationVariables.h.

Referenced by fillTrackQuantities().

Vector3DBase< float, LocalTag >
RadialStripTopology
Definition: RadialStripTopology.h:28
TrajectoryStateOnSurface::globalDirection
GlobalVector globalDirection() const
Definition: TrajectoryStateOnSurface.h:67
Point2DBase
Definition: Point2DBase.h:9
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition: mps_fire.py:355
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
GeomDet
Definition: GeomDet.h:27
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
LocalTrajectoryError::positionError
LocalError positionError() const
Definition: LocalTrajectoryError.h:81
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
HLT_2018_cff.magneticField
magneticField
Definition: HLT_2018_cff.py:348
GeomDet::type
virtual const GeomDetType & type() const
Definition: GeomDet.cc:69
RadialStripTopology::measurementError
MeasurementError measurementError(const LocalPoint &, const LocalError &) const override=0
h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: L1TUtmAlgorithmRcd.h:4
TrackerValidationVariables::fillTrackQuantities
void fillTrackQuantities(const edm::Event &, const edm::EventSetup &, std::vector< AVTrackStruct > &v_avtrackout)
Definition: TrackerValidationVariables.cc:423
Bounds
Definition: Bounds.h:18
cms::cuda::assert
assert(be >=bs)
Surface
Definition: Surface.h:36
RectangularPlaneBounds::width
float width() const override
Width along local X.
Definition: RectangularPlaneBounds.h:22
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:86
edm::Handle< reco::TrackCollection >
SiPixelRecHit
Our base class.
Definition: SiPixelRecHit.h:23
F
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
hit::x
double x
Definition: SiStripHitEffFromCalibTree.cc:89
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
config
Definition: config.py:1
DetId
Definition: DetId.h:17
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
LocalError::xx
float xx() const
Definition: LocalError.h:22
TrajectoryStateOnSurface::localDirection
LocalVector localDirection() const
Definition: TrajectoryStateOnSurface.h:76
MeasurementError
Definition: MeasurementError.h:8
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
Surface::toGlobal
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
reco::Track
Definition: Track.h:27
RectangularPlaneBounds::inside
bool inside(const Local2DPoint &p) const override
Definition: RectangularPlaneBounds.h:29
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:49
StripSubdetector::TIB
static constexpr auto TIB
Definition: StripSubdetector.h:16
h
TrackerValidationVariables::fillHitQuantities
void fillHitQuantities(const Trajectory *trajectory, std::vector< AVHitStruct > &v_avhitout)
Definition: TrackerValidationVariables.cc:184
Point3DBase< float, LocalTag >
RadialStripTopology::angularWidth
virtual float angularWidth() const =0
RadialStripTopology::measurementPosition
MeasurementPoint measurementPosition(const LocalPoint &) const override=0
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
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
MeasurementPoint
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
Definition: MeasurementPoint.h:12
TrajectoryStateCombiner
Definition: TrajectoryStateCombiner.h:13
TrajectoryStateOnSurface::localPosition
LocalPoint localPosition() const
Definition: TrajectoryStateOnSurface.h:74
RectangularPlaneBounds::length
float length() const override
Lenght along local Y.
Definition: RectangularPlaneBounds.h:20
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
TrackerValidationVariables::magneticFieldToken_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
Definition: TrackerValidationVariables.h:124
edm::LogError
Definition: MessageLogger.h:183
RadialStripTopology::localPosition
LocalPoint localPosition(float strip) const override=0
DetId::Tracker
Definition: DetId.h:25
PV3DBase::barePhi
T barePhi() const
Definition: PV3DBase.h:65
LocalError
Definition: LocalError.h:12
PV2DBase::y
T y() const
Definition: PV2DBase.h:44
RadialStripTopology::detHeight
virtual float detHeight() const =0
PV2DBase::x
T x() const
Definition: PV2DBase.h:43
RadialStripTopology::originToIntersection
virtual float originToIntersection() const =0
PV3DBase::eta
T eta() const
Definition: PV3DBase.h:73
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
TrackingRecHit::ConstRecHitPointer
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
Definition: TrackingRecHit.h:25
TrapezoidalPlaneBounds
Definition: TrapezoidalPlaneBounds.h:15
res
Definition: Electron.h:6
hcalSimParameters_cfi.hb
hb
Definition: hcalSimParameters_cfi.py:57
Trajectory::measurements
DataContainer const & measurements() const
Definition: Trajectory.h:178
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:113
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
RectangularPlaneBounds
Definition: RectangularPlaneBounds.h:12
StripSubdetector::TEC
static constexpr auto TEC
Definition: StripSubdetector.h:19
TrackerValidationVariables::tracksToken_
edm::EDGetTokenT< std::vector< reco::Track > > tracksToken_
Definition: TrackerValidationVariables.h:123
Trajectory
Definition: Trajectory.h:38
Exception
Definition: hltDiff.cc:246
GeomDetType::topology
virtual const Topology & topology() const =0
BoundPlane
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
TrackerValidationVariables::trajCollectionToken_
edm::EDGetTokenT< std::vector< Trajectory > > trajCollectionToken_
Definition: TrackerValidationVariables.h:122
RadialStripTopology::stripAngle
float stripAngle(float strip) const override=0
MeasurementError::vv
float vv() const
Definition: MeasurementError.h:16
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
MeasurementError::uu
float uu() const
Definition: MeasurementError.h:14
MinBiasPDSkim_cfg.trackFilter
trackFilter
Definition: MinBiasPDSkim_cfg.py:243
RadialStripTopology::localStripLength
float localStripLength(const LocalPoint &) const override=0
SiStripFineDelayHit_cfi.MagneticField
MagneticField
Definition: SiStripFineDelayHit_cfi.py:7
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
event
Definition: event.py:1
TrajectoryStateOnSurface::localError
const LocalTrajectoryError & localError() const
Definition: TrajectoryStateOnSurface.h:77
MagneticField
Definition: MagneticField.h:19
LocalError::yy
float yy() const
Definition: LocalError.h:24
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
SiPixelRecHit::hasBadPixels
bool hasBadPixels() const
Definition: SiPixelRecHit.h:99
edm::InputTag
Definition: InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
StripSubdetector::TID
static constexpr auto TID
Definition: StripSubdetector.h:17
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
hit
Definition: SiStripHitEffFromCalibTree.cc:88
SiPixelRecHit::isOnEdge
bool isOnEdge() const
Definition: SiPixelRecHit.h:97