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 45 of file TrackerValidationVariables.cc.

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

References SiStripFineDelayHit_cfi::MagneticField.

◆ ~TrackerValidationVariables()

TrackerValidationVariables::~TrackerValidationVariables ( )

Definition at line 52 of file TrackerValidationVariables.cc.

52 {}

Member Function Documentation

◆ fillHitQuantities() [1/2]

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

Definition at line 183 of file TrackerValidationVariables.cc.

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

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(), if(), 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 54 of file TrackerValidationVariables.cc.

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

References cms::cuda::assert(), PV3DBase< T, PVType, FrameType >::barePhi(), SiPixelRawToDigiRegional_cfi::deltaPhi, TrackerValidationVariables::AVHitStruct::eta, Exception, F(), h, SiPixelRecHit::hasBadPixels(), hcalSimParameters_cfi::hb, if(), 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_FULL_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 422 of file TrackerValidationVariables.cc.

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

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 429 of file TrackerValidationVariables.cc.

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

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_FULL_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_FULL_cff::track, MinBiasPDSkim_cfg::trackFilter, 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
mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
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
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
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
TrackerValidationVariables::fillTrackQuantities
void fillTrackQuantities(const edm::Event &, const edm::EventSetup &, std::vector< AVTrackStruct > &v_avtrackout)
Definition: TrackerValidationVariables.cc:422
if
if(0==first)
Definition: CAHitNtupletGeneratorKernelsImpl.h:48
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
HLT_FULL_cff.magneticField
magneticField
Definition: HLT_FULL_cff.py:348
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:97
edm::Handle< reco::TrackCollection >
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
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:55
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:183
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
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
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
TrackerValidationVariables::magneticFieldToken_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
Definition: TrackerValidationVariables.h:124
RadialStripTopology::localPosition
LocalPoint localPosition(float strip) const override=0
DetId::Tracker
Definition: DetId.h:25
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:159
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
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
TrapezoidalPlaneBounds
Definition: TrapezoidalPlaneBounds.h:15
res
Definition: Electron.h:6
hcalSimParameters_cfi.hb
hb
Definition: hcalSimParameters_cfi.py:60
Trajectory::measurements
DataContainer const & measurements() const
Definition: Trajectory.h:178
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
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:245
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
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
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