67 auto const & trajParams = track.
extra()->trajParams();
68 auto const & residuals = track.
extra()->residuals();
74 if(!
hit->isValid())
continue;
77 const DetId & hit_detId =
hit->geographicalId();
78 auto IntRawDetID = hit_detId.
rawId();
79 auto IntSubDetID = hit_detId.
subdetId();
81 if(IntSubDetID == 0)
continue;
83 auto lPTrk = trajParams[
h].position();
84 auto lVTrk = trajParams[
h].direction();
86 auto gtrkdirup=
hit->surface()->toGlobal(lVTrk);
89 hitStruct.
phi = gtrkdirup.phi();
90 hitStruct.
eta = gtrkdirup.eta();
93 hitStruct.
localAlpha = std::atan2(lVTrk.x(), lVTrk.z());
94 hitStruct.
localBeta = std::atan2(lVTrk.y(), lVTrk.z());
96 hitStruct.
resX = residuals.residualX(
h);
97 hitStruct.
resY = residuals.residualY(
h);
104 hitStruct.
localX = lPTrk.x();
105 hitStruct.
localY = lPTrk.y();
108 float resXprime(999.
F), resYprime(999.
F);
109 float resXatTrkY(999.
F);
110 float resXprimeErr(999.
F), resYprimeErr(999.
F);
113 float uOrientation(-999.
F), vOrientation(-999.
F);
114 float resXTopol(999.
F), resYTopol(999.
F);
115 float resXatTrkYTopol(999.
F);
117 const Surface& surface =
hit->detUnit()->surface();
119 const Bounds& bound = boundplane.bounds();
124 LocalPoint lPModule(0.,0.,0.), lUDirection(1.,0.,0.), lVDirection(0.,1.,0.);
126 gUDirection = surface.
toGlobal(lUDirection),
127 gVDirection = surface.
toGlobal(lVDirection);
135 uOrientation = gUDirection.
perp() - gPModule.
perp() >= 0 ? +1.F : -1.F;
136 vOrientation =
deltaPhi(gVDirection.barePhi(),gPModule.
barePhi()) >= 0. ? +1.
F : -1.
F;
138 uOrientation =
deltaPhi(gUDirection.barePhi(),gPModule.
barePhi()) >= 0. ? +1.
F : -1.
F;
139 vOrientation = gVDirection.z() - gPModule.
z() >= 0 ? +1.F : -1.F;
142 resXTopol = hitStruct.
resX;
143 resXatTrkYTopol = hitStruct.
resX;
144 resYTopol = hitStruct.
resY;
145 resXprimeErr = hitStruct.
resErrX;
146 resYprimeErr = hitStruct.
resErrY;
149 if (rectangularBound!=
NULL) {
151 length = rectangularBound->
length();
152 width = rectangularBound->
width();
157 <<
"[TrackerValidationVariables] Cannot cast bounds to RectangularPlaneBounds as expected for TPE";
164 edm::LogWarning(
"TrackerValidationVariables") <<
"@SUB=TrackerValidationVariables::fillHitQuantities" 165 <<
"No valid tracker subdetector " << IntSubDetID;
169 resXprime = resXTopol*uOrientation;
170 resXatTrkY = resXatTrkYTopol;
171 resYprime = resYTopol*vOrientation;
187 v_avhitout.push_back(hitStruct);
198 const std::vector<TrajectoryMeasurement> &tmColl = trajectory->
measurements();
199 for(std::vector<TrajectoryMeasurement>::const_iterator itTraj = tmColl.begin();
200 itTraj != tmColl.end();
203 if (!itTraj->updatedState().isValid())
continue;
209 if(!hit->isValid() || hit->geographicalId().det() !=
DetId::Tracker)
continue;
212 const DetId& hit_detId = hit->geographicalId();
213 unsigned int IntRawDetID = (hit_detId.
rawId());
214 unsigned int IntSubDetID = (hit_detId.
subdetId());
216 if(IntSubDetID == 0)
continue;
227 LocalError errHit = hit->localPositionError();
235 if(errHit.xx()<0. || errHit.yy()<0. || errTrk.
xx()<0. || errTrk.
yy()<0.){
236 edm::LogError(
"TrackerValidationVariables") <<
"@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()
240 <<
"\t" << errHit.yy()
241 <<
"\t" << errTrk.
xx()
242 <<
"\t" << errTrk.
yy();
248 float resXErr =
std::sqrt( errHit.xx() + errTrk.
xx() );
249 float resYErr =
std::sqrt( errHit.yy() + errTrk.
yy() );
251 hitStruct.
resX = res.
x();
252 hitStruct.
resY = res.
y();
263 float resXprime(999.
F), resYprime(999.
F);
264 float resXatTrkY(999.
F);
265 float resXprimeErr(999.
F), resYprimeErr(999.
F);
269 float uOrientation(-999.
F), vOrientation(-999.
F);
270 float resXTopol(999.
F), resYTopol(999.
F);
271 float resXatTrkYTopol(999.
F);
273 const Surface& surface = hit->detUnit()->surface();
274 const BoundPlane& boundplane = hit->detUnit()->surface();
275 const Bounds& bound = boundplane.bounds();
280 LocalPoint lPModule(0.,0.,0.), lUDirection(1.,0.,0.), lVDirection(0.,1.,0.);
282 gUDirection = surface.
toGlobal(lUDirection),
283 gVDirection = surface.
toGlobal(lVDirection);
289 uOrientation =
deltaPhi(gUDirection.barePhi(),gPModule.
barePhi()) >= 0. ? +1.
F : -1.
F;
290 vOrientation = gVDirection.z() - gPModule.
z() >= 0 ? +1.F : -1.F;
292 resXatTrkYTopol = res.
x();
294 resXprimeErr = resXErr;
295 resYprimeErr = resYErr;
298 if (rectangularBound!=
NULL) {
300 length = rectangularBound->
length();
301 width = rectangularBound->
width();
306 <<
"[TrackerValidationVariables] Cannot cast bounds to RectangularPlaneBounds as expected for TPB, TIB and TOB";
311 uOrientation = gUDirection.perp() - gPModule.
perp() >= 0 ? +1.F : -1.F;
312 vOrientation =
deltaPhi(gVDirection.barePhi(),gPModule.
barePhi()) >= 0. ? +1.
F : -1.
F;
314 resXatTrkYTopol = res.
x();
316 resXprimeErr = resXErr;
317 resYprimeErr = resYErr;
320 if (rectangularBound!=
NULL) {
322 length = rectangularBound->
length();
323 width = rectangularBound->
width();
328 <<
"[TrackerValidationVariables] Cannot cast bounds to RectangularPlaneBounds as expected for TPE";
334 uOrientation =
deltaPhi(gUDirection.barePhi(),gPModule.
barePhi()) >= 0. ? +1.
F : -1.
F;
335 vOrientation = gVDirection.perp() - gPModule.
perp() >= 0. ? +1.F : -1.F;
337 if (!dynamic_cast<const RadialStripTopology*>(&detUnit.
type().
topology()))
continue;
346 if (measHitErr.
uu()<0. ||
347 measHitErr.
vv()<0. ||
348 measTrkErr.
uu()<0. ||
350 edm::LogError(
"TrackerValidationVariables") <<
"@SUB=TrackerValidationVariables::fillHitQuantities" 351 <<
"One of the squared error methods gives negative result" 352 <<
"\n\tmeasHitErr.uu()\tmeasHitErr.vv()\tmeasTrkErr.uu()\tmeasTrkErr.vv()" 353 <<
"\n\t" << measHitErr.
uu()
354 <<
"\t" << measHitErr.
vv()
355 <<
"\t" << measTrkErr.
uu()
356 <<
"\t" << measTrkErr.
vv();
366 resXTopol = (phiTrk-phiHit)*r_0;
370 resXatTrkYTopol = lPTrk.
x() - LocalHitPosCor.
x();
374 float cosPhiHit(
cos(phiHit)), cosPhiTrk(
cos(phiTrk)),
375 sinPhiHit(
sin(phiHit)), sinPhiTrk(
sin(phiTrk));
377 resYTopol = measTrkPos.
y()*localStripLengthTrk - measHitPos.
y()*localStripLengthHit + l_0*(1/cosPhiTrk - 1/cosPhiHit);
382 + sinPhiTrk*sinPhiTrk/
pow(cosPhiTrk,4)*measTrkErr.
uu() );
383 resYprimeErr =
std::sqrt(measHitErr.
vv()*localStripLengthHit*localStripLengthHit
384 + measTrkErr.
vv()*localStripLengthTrk*localStripLengthTrk + helpSummand );
388 if (trapezoidalBound!=
NULL) {
389 hitStruct.
inside = trapezoidalBound->inside(lPTrk);
390 length = trapezoidalBound->length();
391 width = trapezoidalBound->width();
402 <<
"[TrackerValidationVariables] Cannot cast bounds to TrapezoidalPlaneBounds as expected for TID and TEC";
406 edm::LogWarning(
"TrackerValidationVariables") <<
"@SUB=TrackerValidationVariables::fillHitQuantities" 407 <<
"No valid tracker subdetector " << IntSubDetID;
411 resXprime = resXTopol*uOrientation;
412 resXatTrkY = resXatTrkYTopol;
413 resYprime = resYTopol*vOrientation;
432 v_avhitout.push_back(hitStruct);
439 std::vector<AVTrackStruct> & v_avtrackout)
451 std::vector<AVTrackStruct> & v_avtrackout)
459 auto const &
tracks = *tracksH;
460 auto ntrk =
tracks.size();
461 LogDebug(
"TrackerValidationVariables") <<
"Track collection size " << ntrk;
466 bool yesTraj = trajsH.
isValid();
467 std::vector<Trajectory>
const * trajs =
nullptr;
468 if (yesTraj) trajs = &(*trajsH);
469 if (yesTraj) assert (trajs->size()==
tracks.size());
472 for (
unsigned int i=0;
i<ntrk; ++
i) {
474 if (yesTraj) trajectory = &(*trajs)[
i];
476 if (!trackFilter(
track))
continue;
480 trackStruct.
p =
track.p();
492 double theLocalMagFieldInInverseGeV = magneticField->
inInverseGeV(gPoint).
z();
493 trackStruct.
kappa = -
track.charge()*theLocalMagFieldInInverseGeV/
track.pt();
503 v_avtrackout.push_back(trackStruct);
TrackerValidationVariables()
virtual const Topology & topology() const =0
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
T getParameter(std::string const &) const
virtual float angularWidth() const =0
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
const TrackExtraRef & extra() const
reference to "extra" object
virtual const GeomDetType & type() const
virtual float originToIntersection() const =0
size_t recHitsSize() const
Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits)...
LocalVector localDirection() const
LocalPoint localPosition() const
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
std::vector< Track > TrackCollection
collection of Tracks
void fillHitQuantities(const Trajectory *trajectory, std::vector< AVHitStruct > &v_avhitout)
std::vector< AVHitStruct > hits
LocalError positionError() const
LocalPoint localPosition(float strip) const override=0
uint32_t rawId() const
get the raw id
virtual bool inside(const Local2DPoint &p) const
float localStripLength(const LocalPoint &) const override=0
DataContainer const & measurements() const
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
edm::EDGetTokenT< std::vector< Trajectory > > trajCollectionToken_
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
float stripAngle(float strip) const override=0
Cos< T >::type cos(const T &t)
~TrackerValidationVariables()
const LocalTrajectoryError & localError() const
virtual float width() const
Width along local X.
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
MeasurementError measurementError(const LocalPoint &, const LocalError &) const override=0
virtual float detHeight() const =0
MeasurementPoint measurementPosition(const LocalPoint &) const override=0
void fillTrackQuantities(const edm::Event &, const edm::EventSetup &, std::vector< AVTrackStruct > &v_avtrackout)
virtual float length() const
Lenght along local Y.
edm::EDGetTokenT< std::vector< reco::Track > > tracksToken_
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Power< A, B >::type pow(const A &a, const B &b)
GlobalVector globalDirection() const