19 #include "CLHEP/Units/GlobalPhysicalConstants.h"
20 #include "CLHEP/Geometry/Point3D.h"
21 #include "CLHEP/Geometry/Vector3D.h"
22 #include "CLHEP/Geometry/Transform3D.h"
29 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder CTOR " <<
"\n";
45 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder DTOR " <<
"\n";
74 reco::CaloClusterCollection::const_iterator bcItr;
75 LogDebug(
"OutInConversionSeedFinder") <<
" OutInConversionSeedFinder::makeSeeds() All BC in the event " <<
"\n";
76 for (
unsigned i = 0;
i < allBC->size(); ++
i ) {
91 LogDebug(
"OutInConversionSeedFinder") <<
" OutInConversionSeedFinder::makeSeeds() Passing the >=1.5 GeV cut BC eta " << theBcEta <<
" phi " << theBcPhi <<
" BC energy " <<
theBCEnergy_ <<
"\n";
93 if ( fabs(theBcEta-theSCEta) < 0.015 && fabs(theBcPhi-theSCPhi) < 0.3 ) {
94 LogDebug(
"OutInConversionSeedFinder") <<
" OutInConversionSeedFinder::makeSeeds() in et and phi range passed to the analysis " <<
"\n";
163 if ( fabs(theBcEta-theSCEta) < 0.015 && fabs(theBcPhi-theSCPhi) < 0.25 ) {
197 std::pair<FreeTrajectoryState,bool>
result;
209 HepGeom::Point3D<double> radiusBc(gvBcRadius.x(),gvBcRadius.y(),gvBcRadius.z()) ;
210 HepGeom::Point3D<double> momentumWithoutCurvature = radiusBc.unit() *
theBCEnergy_ ;
216 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::makeTrackState gpOrigine " << gpOrigine.x() <<
" " << gpOrigine.y() <<
" " << gpOrigine.z() <<
" momentumWithoutCurvature " << momentumWithoutCurvature.mag() <<
" curvature " << curvature <<
"\n";
220 float r = gpOrigine.perp();
224 float d =
sqrt(r*r+rho*rho);
225 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));
227 if ( u <=R ) result.second=
true;
229 double sinAlpha = 0.5*u/
R;
230 if ( sinAlpha>(1.-10*DBL_EPSILON) ) sinAlpha = 1.-10*DBL_EPSILON;
231 else if ( sinAlpha<-(1.-10*DBL_EPSILON) ) sinAlpha = -(1.-10*DBL_EPSILON);
233 double newdphi = charge * asin( sinAlpha) ;
235 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::makeTrackState charge " << charge <<
" R " << R <<
" u/R " << u/R <<
" asin(0.5*u/R) " << asin(sinAlpha) <<
"\n";
237 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 " << rho <<
" d " << d <<
" u " << u <<
" newdphi " << newdphi <<
" momentumInTracker " << momentumInTracker <<
"\n";
243 HepGeom::Point3D<double> hepStartingPoint(gpOrigine.x(), gpOrigine.y(), gpOrigine.z()) ;
245 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::makeTrackState hepStartingPoint " << hepStartingPoint <<
"\n";
247 hepStartingPoint.transform(rotation);
249 GlobalPoint startingPoint(hepStartingPoint.x(), hepStartingPoint.y(), hepStartingPoint.z());
251 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::makeTrackState startingPoint " << startingPoint <<
" calo position " <<
theBCPosition_ <<
"\n";
252 GlobalVector gvTracker(momentumInTracker.x(), momentumInTracker.y(), momentumInTracker.z());
256 m(0,0) = 0.1;
m(1,1) = 0.1 ;
m(2,2) = 0.1 ;
257 m(3,3) = 0.1 ;
m(4,4) = 0.1;
273 std::vector<const DetLayer*> myLayers=
layerList();
274 if ( myLayers.size() > 3 ) {
276 for(
unsigned int ilayer = myLayers.size()-1; ilayer >= myLayers.size()-2; --ilayer) {
277 const DetLayer * layer = myLayers[ilayer];
292 LogDebug(
"OutInConversionSeedFinder") <<
"OutInSeedFinder::startSeed after TSOS tsos(fts, layer->surface() ) " <<
"\n";
304 LogDebug(
"OutInConversionSeedFinder") <<
"OutInSeedFinder::startSeed Layer " << ilayer <<
" theFirstMeasurements_.size " <<
theFirstMeasurements_.size() <<
"\n";
308 if(m1.
recHit()->isValid()) {
313 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";
317 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::startSeed newfts " << newfts <<
"\n";
324 if(ilayer == myLayers.size()-1) {
349 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::makeEstimator Barrel r = " << barrelLayer->
specificSurface().
radius() <<
" " <<
"\n";
400 float m1dr =
sqrt(m1.
recHit()->localPositionError().yy());
408 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::completeSeed ilayer " << ilayer <<
"\n";
412 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::completeSeed propagationDirection " << int(propagator->
propagationDirection() ) <<
"\n";
413 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::completeSeed pointer to estimator " << newEstimator <<
"\n";
416 std::vector<TrajectoryMeasurement> measurements = theLayerMeasurements_.
measurements( *layer, tsos, *propagator, *newEstimator);
420 for(
unsigned int i = 0;
i < measurements.size(); ++
i) {
421 if( measurements[
i].recHit()->isValid() ) {
442 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::createSeed First point errors " <<m1.
recHit()->parametersError() <<
"\n";
443 LogDebug(
"OutInConversionSeedFinder") <<
"original cluster FTS " << fts <<
"\n";
458 if ( updatedState1.
isValid() ) {
468 myHits.
push_back(meas1.recHit()->hit()->clone());
469 myHits.push_back(meas2.recHit()->hit()->clone());
476 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::createSeed new seed from state " << state2.
globalPosition() <<
"\n";
477 LogDebug(
"OutInConversionSeedFinder") <<
"OutInConversionSeedFinder::createSeed new seed ptsod " << ptsod.
parameters().
position() <<
" R "
519 double BInTesla =
theMF_->inTesla(xmeas).z();
523 double pxOld = pt*
cos(phi);
524 double pyOld = pt*
sin(phi);
525 double RadCurv = 100*pt/(BInTesla*0.29979);
526 double alpha = asin(0.5*xdiff.
perp()/RadCurv);
527 float ca =
cos(charge*alpha);
528 float sa =
sin(charge*alpha);
529 double pxNew = ca*pxOld + sa*pyOld;
530 double pyNew = -sa*pxOld + ca*pyOld;
536 m(0,0) = 0.05;
m(1,1) = 0.02 ;
m(2,2) = 0.007 ;
537 m(3,3) = 10. ;
m(4,4) = 10. ;
555 float r = p1.
z() *
tan(theta);
const Propagator * thePropagatorAlongMomentum_
T getParameter(std::string const &) const
GlobalPoint theSCPosition_
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
virtual PropagationDirection propagationDirection() 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
FreeTrajectoryState * freeTrajectoryState(bool withErrors=true) const
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
virtual const BoundSurface & surface() const
The surface of the GeometricSearchDet.
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
OutInConversionSeedFinder(const edm::ParameterSet &config)
ConstRecHitPointer recHit() 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
const Propagator * thePropagatorOppositeToMomentum_
Geom::Theta< T > theta() const
U second(std::pair< T, U > const &p)
T curvature(T InversePt, const edm::EventSetup &iSetup)
Scalar radius() const
Radius of the cylinder.
virtual const BoundDisk & specificSurface() const
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
TrajectoryStateOnSurface predictedState() const
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
edm::ESHandle< MagneticField > theMF_
virtual const BoundCylinder & specificSurface() const
Extension of the interface.
virtual ~OutInConversionSeedFinder()
FreeTrajectoryState trackStateFromClusters(int aCharge, const GlobalPoint &gpOrigine, PropagationDirection dir, float scaleFactor) const
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TransientTrackingRecHit &) const
FreeTrajectoryState createSeedFTS(const TrajectoryMeasurement &m1, const TrajectoryMeasurement &m2) const
float outerRadius() const
The outer radius of the disk.
float innerRadius() const
The inner radius of the disk.
const Point & position() const
position
void completeSeed(const TrajectoryMeasurement &m1, FreeTrajectoryState &fts, const Propagator *, int layer) const
const PositionType & position() const
void startSeed(const FreeTrajectoryState &) const
std::vector< TrajectoryMeasurement > theFirstMeasurements_
const LocalTrajectoryParameters & parameters() const