21 #include "CLHEP/Units/GlobalPhysicalConstants.h"
22 #include "CLHEP/Geometry/Point3D.h"
23 #include "CLHEP/Geometry/Vector3D.h"
24 #include "CLHEP/Geometry/Transform3D.h"
29 const auto v = position - origin;
36 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder CTOR "
50 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder DTOR "
73 LogDebug(
"OutInConversionSeedFinder") <<
" OutInConversionSeedFinder::makeSeeds() All BC in the event "
75 for (
unsigned i = 0;
i < allBC->size(); ++
i) {
97 LogDebug(
"OutInConversionSeedFinder")
98 <<
" OutInConversionSeedFinder::makeSeeds() Passing the >=1.5 GeV cut BC eta " << theBcEta <<
" phi "
101 if (fabs(theBcEta - theSCEta) < 0.015 &&
reco::deltaPhi(theBcPhi, theSCPhi) < 0.3) {
102 LogDebug(
"OutInConversionSeedFinder")
103 <<
" OutInConversionSeedFinder::makeSeeds() in et and phi range passed to the analysis "
159 float theBcEta = theBCPosition_.
eta();
160 float theBcPhi = theBCPosition_.phi();
166 if (fabs(theBcEta - theSCEta) < 0.015 && fabs(theBcPhi - theSCPhi) < 0.25) {
176 if (stateNeg.second) {
182 if (statePos.second) {
189 std::pair<FreeTrajectoryState, bool>
result;
190 result.second =
false;
199 HepGeom::Point3D<double> radiusBc(gvBcRadius.x(), gvBcRadius.y(), gvBcRadius.z());
200 HepGeom::Point3D<double> momentumWithoutCurvature = radiusBc.unit() *
theBCEnergy_;
208 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::makeTrackState gpOrigine " << gpOrigine.x()
209 <<
" " << gpOrigine.y() <<
" " << gpOrigine.z() <<
" momentumWithoutCurvature "
210 << momentumWithoutCurvature.mag() <<
" curvature " << curvature <<
"\n";
214 float r = gpOrigine.perp();
218 float d =
sqrt(r * r + rho * rho);
219 float u = rho + rho / d / d * (R * R - rho *
rho) -
220 r / d / d *
sqrt((R * R - r * r + 2 * rho * R) * (R * R - r * r + 2 * rho *
R));
223 result.second =
true;
227 double sinAlpha = 0.5 * u /
R;
228 if (sinAlpha > (1. - 10 * DBL_EPSILON))
229 sinAlpha = 1. - 10 * DBL_EPSILON;
230 else if (sinAlpha < -(1. - 10 * DBL_EPSILON))
231 sinAlpha = -(1. - 10 * DBL_EPSILON);
233 double newdphi = charge * asin(sinAlpha);
235 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::makeTrackState charge " << charge <<
" R " << R
236 <<
" u/R " << u / R <<
" asin(0.5*u/R) " << asin(sinAlpha) <<
"\n";
238 HepGeom::Transform3D
rotation = HepGeom::Rotate3D(newdphi, HepGeom::Vector3D<double>(0., 0., 1.));
240 HepGeom::Point3D<double> momentumInTracker = momentumWithoutCurvature.transform(rotation);
241 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::makeTrackState R " << R <<
" r " << r <<
" rho "
242 << rho <<
" d " << d <<
" u " << u <<
" newdphi " << newdphi
243 <<
" momentumInTracker " << momentumInTracker <<
"\n";
245 HepGeom::Point3D<double> hepStartingPoint(gpOrigine.x(), gpOrigine.y(), gpOrigine.z());
247 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::makeTrackState hepStartingPoint "
248 << hepStartingPoint <<
"\n";
250 hepStartingPoint.transform(rotation);
252 GlobalPoint startingPoint(hepStartingPoint.x(), hepStartingPoint.y(), hepStartingPoint.z());
254 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::makeTrackState startingPoint " << startingPoint
256 GlobalVector gvTracker(momentumInTracker.x(), momentumInTracker.y(), momentumInTracker.z());
276 std::vector<const DetLayer*> myLayers =
layerList();
277 if (myLayers.size() > 3) {
278 for (
unsigned int ilayer = myLayers.size() - 1; ilayer >= myLayers.size() - 2; --ilayer) {
292 LogDebug(
"OutInConversionSeedFinder") <<
"OutInSeedFinder::startSeed after TSOS tsos(fts, layer->surface() ) "
307 LogDebug(
"OutInConversionSeedFinder") <<
"OutInSeedFinder::startSeed Layer " << ilayer
312 if (m1.
recHit()->isValid()) {
316 LogDebug(
"OutInConversionSeedFinder")
317 <<
" Valid hit at R " << m1.
recHit()->globalPosition().perp() <<
" Z "
318 << m1.
recHit()->globalPosition().z() <<
" eta " << m1.
recHit()->globalPosition().eta() <<
" phi "
319 << m1.
recHit()->globalPosition().phi() <<
" xyz " << m1.
recHit()->globalPosition() <<
"\n";
323 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::startSeed newfts " << newfts <<
"\n";
324 LogDebug(
"OutInConversionSeedFinder")
325 <<
"OutInConversionSeedFinder::startSeed propagationDirection after switching "
331 if (ilayer == myLayers.size() - 1) {
348 LogDebug(
"OutInConversionSeedFinder")
349 <<
"OutInConversionSeedFinder::makeEstimator Barrel r = " << barrelLayer->
specificSurface().radius() <<
" "
358 LogDebug(
"OutInConversionSeedFinder")
359 <<
"OutInConversionSeedFinder::makeEstimator Endcap r = " << forwardLayer->
specificSurface().innerRadius()
394 float m1dr =
sqrt(m1.
recHit()->localPositionError().yy());
400 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::completeSeed ilayer " << ilayer <<
"\n";
404 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::completeSeed propagationDirection "
406 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::completeSeed pointer to estimator "
407 << newEstimator <<
"\n";
410 std::vector<TrajectoryMeasurement> measurements =
411 theLayerMeasurements_.
measurements(*layer, tsos, *propagator, *newEstimator);
415 for (
unsigned int i = 0;
i < measurements.size(); ++
i) {
416 if (measurements[
i].recHit()->isValid()) {
431 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::createSeed First point errors "
432 << m1.
recHit()->parametersError() <<
"\n";
433 LogDebug(
"OutInConversionSeedFinder") <<
"original cluster FTS " << fts <<
"\n";
456 myHits.
push_back(meas1.recHit()->hit()->clone());
457 myHits.push_back(meas2.recHit()->hit()->clone());
465 LogDebug(
"OutInConversionSeedFinder")
466 <<
"OutInConversionSeedFinder::createSeed new seed from state " << state2.
globalPosition() <<
"\n";
467 LogDebug(
"OutInConversionSeedFinder")
468 <<
"OutInConversionSeedFinder::createSeed new seed ptsod " << ptsod.
parameters().
position() <<
" R "
492 double BInTesla =
theMF_->inTesla(xmeas).z();
496 double pxOld = pt *
cos(phi);
497 double pyOld = pt *
sin(phi);
498 double RadCurv = 100 * pt / (BInTesla * 0.29979);
499 double alpha = asin(0.5 * xdiff.
perp() / RadCurv);
500 float ca =
cos(charge * alpha);
501 float sa =
sin(charge * alpha);
502 double pxNew = ca * pxOld + sa * pyOld;
503 double pyNew = -sa * pxOld + ca * pyOld;
527 float r = p1.
z() *
tan(theta);
constexpr double deltaPhi(double phi1, double phi2)
const Propagator * thePropagatorAlongMomentum_
GlobalPoint theSCPosition_
const math::XYZPoint & position() const
cluster centroid position
std::vector< TrajectoryMeasurement > measurements(const DetLayer &layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
std::vector< const DetLayer * > const & layerList() const
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
const MeasurementTracker * getMeasurementTracker() const
std::pair< FreeTrajectoryState, bool > makeTrackState(int charge) const
TrajectoryStateOnSurface const & predictedState() const
ConstRecHitPointer const & recHit() const
TrackCharge charge() const
const BoundSurface & surface() const final
The surface of the GeometricSearchDet.
virtual Location location() const =0
Which part of the detector (barrel, endcap)
LocalPoint position() const
Local x and y position coordinates.
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
Geom::Theta< T > theta() const
MeasurementEstimator * makeEstimator(const DetLayer *, float dphi) const
GlobalPoint globalPosition() const
virtual PropagationDirection propagationDirection() const final
std::vector< const DetLayer * > theLayerList_
int maxNumberOfOutInSeedsPerBC_
TrackCharge charge() const
reco::BeamSpot theBeamSpot_
TrajectorySeedCollection theSeeds_
GlobalPoint fixPointRadius(const TrajectoryMeasurement &) const
double ptFast(const double energy, const math::XYZPoint &position, const math::XYZPoint &origin)
void fillClusterSeeds(const reco::CaloClusterPtr &bc)
T curvature(T InversePt, const MagneticField &field)
const Propagator * thePropagatorOppositeToMomentum_
constexpr std::array< uint8_t, layerIndexSize > layer
Geom::Theta< T > theta() const
void makeSeeds(const edm::Handle< edm::View< reco::CaloCluster > > &allBc) override
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
Cos< T >::type cos(const T &t)
void createSeed(const TrajectoryMeasurement &m1, const TrajectoryMeasurement &m2)
Tan< T >::type tan(const T &t)
GlobalPoint theBCPosition_
const DetLayer * layer() const
double energy() const
cluster energy
~OutInConversionSeedFinder() override
edm::ESHandle< MagneticField > theMF_
XYZPointD XYZPoint
point in space with cartesian internal representation
void startSeed(const FreeTrajectoryState &)
T getParameter(std::string const &) const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
FreeTrajectoryState trackStateFromClusters(int aCharge, const GlobalPoint &gpOrigine, PropagationDirection dir, float scaleFactor) const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
static int position[264][3]
FreeTrajectoryState createSeedFTS(const TrajectoryMeasurement &m1, const TrajectoryMeasurement &m2) const
virtual const BoundDisk & specificSurface() const final
const Point & position() const
position
void completeSeed(const TrajectoryMeasurement &m1, const FreeTrajectoryState &fts, const Propagator *, int layer)
edm::Handle< MeasurementTrackerEvent > theTrackerData_
const PositionType & position() const
std::vector< TrajectoryMeasurement > theFirstMeasurements_
const LocalTrajectoryParameters & parameters() const
OutInConversionSeedFinder(const edm::ParameterSet &config, edm::ConsumesCollector &&iC)