21 #include "CLHEP/Units/GlobalPhysicalConstants.h"
22 #include "CLHEP/Geometry/Point3D.h"
23 #include "CLHEP/Geometry/Vector3D.h"
24 #include "CLHEP/Geometry/Transform3D.h"
31 const auto v = position - origin;
40 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder CTOR " <<
"\n";
59 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder DTOR " <<
"\n";
88 reco::CaloClusterCollection::const_iterator bcItr;
89 LogDebug(
"OutInConversionSeedFinder") <<
" OutInConversionSeedFinder::makeSeeds() All BC in the event " <<
"\n";
90 for (
unsigned i = 0;
i < allBC->size(); ++
i ) {
113 LogDebug(
"OutInConversionSeedFinder") <<
" OutInConversionSeedFinder::makeSeeds() Passing the >=1.5 GeV cut BC eta " << theBcEta <<
" phi " << theBcPhi <<
" BC energy " <<
theBCEnergy_ <<
"\n";
115 if ( fabs(theBcEta-theSCEta) < 0.015 &&
reco::deltaPhi(theBcPhi,theSCPhi) < 0.3 ) {
116 LogDebug(
"OutInConversionSeedFinder") <<
" OutInConversionSeedFinder::makeSeeds() in et and phi range passed to the analysis " <<
"\n";
180 float theBcEta= theBCPosition_.
eta();
181 float theBcPhi= theBCPosition_.phi();
186 if ( fabs(theBcEta-theSCEta) < 0.015 && fabs(theBcPhi-theSCPhi) < 0.25 ) {
220 std::pair<FreeTrajectoryState,bool>
result;
232 HepGeom::Point3D<double> radiusBc(gvBcRadius.x(),gvBcRadius.y(),gvBcRadius.z()) ;
233 HepGeom::Point3D<double> momentumWithoutCurvature = radiusBc.unit() *
theBCEnergy_ ;
239 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::makeTrackState gpOrigine " << gpOrigine.x() <<
" " << gpOrigine.y() <<
" " << gpOrigine.z() <<
" momentumWithoutCurvature " << momentumWithoutCurvature.mag() <<
" curvature " << curvature <<
"\n";
243 float r = gpOrigine.perp();
247 float d =
sqrt(r*r+rho*rho);
248 float u = rho + rho/d/d*(R*R-rho*
rho) - r/d/d*
sqrt((R*R-r*r+2*rho*R)*(R*R-r*r+2*rho*
R));
250 if ( u <=R ) result.second=
true;
252 double sinAlpha = 0.5*u/
R;
253 if ( sinAlpha>(1.-10*DBL_EPSILON) ) sinAlpha = 1.-10*DBL_EPSILON;
254 else if ( sinAlpha<-(1.-10*DBL_EPSILON) ) sinAlpha = -(1.-10*DBL_EPSILON);
256 double newdphi = charge * asin( sinAlpha) ;
258 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::makeTrackState charge " << charge <<
" R " << R <<
" u/R " << u/R <<
" asin(0.5*u/R) " << asin(sinAlpha) <<
"\n";
260 HepGeom::Transform3D
rotation = HepGeom::Rotate3D(newdphi, HepGeom::Vector3D<double> (0., 0. ,1.));
263 HepGeom::Point3D<double> momentumInTracker = momentumWithoutCurvature.transform(rotation) ;
264 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::makeTrackState R " << R <<
" r " << r <<
" rho " << rho <<
" d " << d <<
" u " << u <<
" newdphi " << newdphi <<
" momentumInTracker " << momentumInTracker <<
"\n";
266 HepGeom::Point3D<double> hepStartingPoint(gpOrigine.x(), gpOrigine.y(), gpOrigine.z()) ;
268 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::makeTrackState hepStartingPoint " << hepStartingPoint <<
"\n";
270 hepStartingPoint.transform(rotation);
272 GlobalPoint startingPoint(hepStartingPoint.x(), hepStartingPoint.y(), hepStartingPoint.z());
274 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::makeTrackState startingPoint " << startingPoint <<
" calo position " <<
theBCPosition_ <<
"\n";
275 GlobalVector gvTracker(momentumInTracker.x(), momentumInTracker.y(), momentumInTracker.z());
279 m(0,0) = 0.1;
m(1,1) = 0.1 ;
m(2,2) = 0.1 ;
280 m(3,3) = 0.1 ;
m(4,4) = 0.1;
296 std::vector<const DetLayer*> myLayers=
layerList();
297 if ( myLayers.size() > 3 ) {
299 for(
unsigned int ilayer = myLayers.size()-1; ilayer >= myLayers.size()-2; --ilayer) {
300 const DetLayer * layer = myLayers[ilayer];
315 LogDebug(
"OutInConversionSeedFinder") <<
"OutInSeedFinder::startSeed after TSOS tsos(fts, layer->surface() ) " <<
"\n";
327 LogDebug(
"OutInConversionSeedFinder") <<
"OutInSeedFinder::startSeed Layer " << ilayer <<
" theFirstMeasurements_.size " <<
theFirstMeasurements_.size() <<
"\n";
331 if(m1.
recHit()->isValid()) {
336 LogDebug(
"OutInConversionSeedFinder") <<
" Valid hit at R " << m1.
recHit()->globalPosition().perp() <<
" Z " << m1.
recHit()->globalPosition().z() <<
" eta " << m1.
recHit()->globalPosition().eta() <<
" phi " << m1.
recHit()->globalPosition().phi() <<
" xyz " << m1.
recHit()->globalPosition() <<
"\n";
341 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::startSeed newfts " << newfts <<
"\n";
348 if(ilayer == myLayers.size()-1) {
373 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::makeEstimator Barrel r = " << barrelLayer->
specificSurface().radius() <<
" " <<
"\n";
384 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::makeEstimator Endcap r = " << forwardLayer->
specificSurface().innerRadius() <<
" R " << forwardLayer->
specificSurface().outerRadius() <<
" Z " << forwardLayer->
specificSurface().position().z() <<
"\n";
404 const Propagator* propagator,
int ilayer)
const {
424 float m1dr =
sqrt(m1.
recHit()->localPositionError().yy());
432 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::completeSeed ilayer " << ilayer <<
"\n";
436 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::completeSeed propagationDirection " << int(propagator->
propagationDirection() ) <<
"\n";
437 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::completeSeed pointer to estimator " << newEstimator <<
"\n";
440 std::vector<TrajectoryMeasurement> measurements = theLayerMeasurements_.
measurements( *layer, tsos, *propagator, *newEstimator);
444 for(
unsigned int i = 0;
i < measurements.size(); ++
i) {
445 if( measurements[
i].recHit()->isValid() ) {
468 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::createSeed First point errors " <<m1.
recHit()->parametersError() <<
"\n";
469 LogDebug(
"OutInConversionSeedFinder") <<
"original cluster FTS " << fts <<
"\n";
484 if ( updatedState1.
isValid() ) {
494 myHits.
push_back(meas1.recHit()->hit()->clone());
495 myHits.push_back(meas2.recHit()->hit()->clone());
502 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::createSeed new seed from state " << state2.
globalPosition() <<
"\n";
503 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::createSeed new seed ptsod " << ptsod.
parameters().
position() <<
" R "
545 double BInTesla =
theMF_->inTesla(xmeas).z();
549 double pxOld = pt*
cos(phi);
550 double pyOld = pt*
sin(phi);
551 double RadCurv = 100*pt/(BInTesla*0.29979);
552 double alpha = asin(0.5*xdiff.
perp()/RadCurv);
553 float ca =
cos(charge*alpha);
554 float sa =
sin(charge*alpha);
555 double pxNew = ca*pxOld + sa*pyOld;
556 double pyNew = -sa*pxOld + ca*pyOld;
562 m(0,0) = 0.05;
m(1,1) = 0.02 ;
m(2,2) = 0.007 ;
563 m(3,3) = 10. ;
m(4,4) = 10. ;
582 float r = p1.
z() *
tan(theta);
const Propagator * thePropagatorAlongMomentum_
T getParameter(std::string const &) const
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.
void fillClusterSeeds(const reco::CaloClusterPtr &bc) const
const MeasurementTracker * getMeasurementTracker() const
std::pair< FreeTrajectoryState, bool > makeTrackState(int charge) const
TrajectoryStateOnSurface const & predictedState() const
ConstRecHitPointer const & recHit() const
TrackCharge charge() const
virtual Location location() const =0
Which part of the detector (barrel, endcap)
LocalPoint position() const
Local x and y position coordinates.
void createSeed(const TrajectoryMeasurement &m1, const TrajectoryMeasurement &m2) const
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
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
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)
static int position[TOTALCHAMBERS][3]
virtual PropagationDirection propagationDirection() const GCC11_FINAL
const Propagator * thePropagatorOppositeToMomentum_
Geom::Theta< T > theta() const
U second(std::pair< T, U > const &p)
T curvature(T InversePt, const edm::EventSetup &iSetup)
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
virtual const BoundSurface & surface() const GCC11_FINAL
The surface of the GeometricSearchDet.
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
GlobalPoint theBCPosition_
const DetLayer * layer() const
std::vector< const DetLayer * > theLayerList_
virtual void makeSeeds(const edm::Handle< edm::View< reco::CaloCluster > > &allBc) const
double energy() const
cluster energy
double deltaPhi(double phi1, double phi2)
edm::ESHandle< MagneticField > theMF_
XYZPointD XYZPoint
point in space with cartesian internal representation
virtual ~OutInConversionSeedFinder()
FreeTrajectoryState trackStateFromClusters(int aCharge, const GlobalPoint &gpOrigine, PropagationDirection dir, float scaleFactor) const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
virtual const BoundDisk & specificSurface() const GCC11_FINAL
FreeTrajectoryState createSeedFTS(const TrajectoryMeasurement &m1, const TrajectoryMeasurement &m2) const
const Point & position() const
position
edm::Handle< MeasurementTrackerEvent > theTrackerData_
void completeSeed(const TrajectoryMeasurement &m1, FreeTrajectoryState &fts, const Propagator *, int layer) const
const PositionType & position() const
virtual const BoundCylinder & specificSurface() const GCC11_FINAL
Extension of the interface.
void startSeed(const FreeTrajectoryState &) const
std::vector< TrajectoryMeasurement > theFirstMeasurements_
const LocalTrajectoryParameters & parameters() const
OutInConversionSeedFinder(const edm::ParameterSet &config, edm::ConsumesCollector &&iC)