CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
OutInConversionSeedFinder Class Reference

#include <OutInConversionSeedFinder.h>

Inheritance diagram for OutInConversionSeedFinder:
ConversionSeedFinder

Public Member Functions

void makeSeeds (const edm::Handle< edm::View< reco::CaloCluster > > &allBc) override
 
virtual void makeSeeds (const reco::CaloClusterPtr &aBC)
 
 OutInConversionSeedFinder (const edm::ParameterSet &config, edm::ConsumesCollector &&iC)
 
 ~OutInConversionSeedFinder () override
 
- Public Member Functions inherited from ConversionSeedFinder
void clear ()
 
 ConversionSeedFinder ()
 
 ConversionSeedFinder (const edm::ParameterSet &config, edm::ConsumesCollector &iC)
 
const MeasurementTrackergetMeasurementTracker () const
 
std::vector< const DetLayer * > const & layerList () const
 
TrajectorySeedCollectionseeds ()
 
virtual void setCandidate (float e, GlobalPoint pos)
 
void setEvent (const edm::Event &e)
 
void setEventSetup (const edm::EventSetup &es)
 Initialize EventSetup objects at each event. More...
 
void setMeasurementTracker (const MeasurementTracker *tracker) const
 
void setNavigationSchool (const NavigationSchool *navigation)
 
virtual ~ConversionSeedFinder ()
 

Private Types

typedef FreeTrajectoryState FTS
 
typedef TrajectoryStateOnSurface TSOS
 

Private Member Functions

void completeSeed (const TrajectoryMeasurement &m1, const FreeTrajectoryState &fts, const Propagator *, int layer)
 
void createSeed (const TrajectoryMeasurement &m1, const TrajectoryMeasurement &m2)
 
FreeTrajectoryState createSeedFTS (const TrajectoryMeasurement &m1, const TrajectoryMeasurement &m2) const
 
void fillClusterSeeds (const reco::CaloClusterPtr &bc)
 
GlobalPoint fixPointRadius (const TrajectoryMeasurement &) const
 
MeasurementEstimatormakeEstimator (const DetLayer *, float dphi) const
 
std::pair< FreeTrajectoryState, bool > makeTrackState (int charge) const
 
void startSeed (const FreeTrajectoryState &)
 

Private Attributes

float bcEcut_
 
float bcEtcut_
 
edm::ParameterSet conf_
 
int maxNumberOfOutInSeedsPerBC_
 
int nSeedsPerBC_
 
float the2ndHitdphi_
 
float the2ndHitdzConst_
 
float the2ndHitdznSigma_
 
std::vector< TrajectoryMeasurementtheFirstMeasurements_
 
bool useEtCut_
 

Additional Inherited Members

- Protected Member Functions inherited from ConversionSeedFinder
void findLayers ()
 
void findLayers (const FreeTrajectoryState &fts)
 
void printLayer (int i) const
 
FreeTrajectoryState trackStateFromClusters (int aCharge, const GlobalPoint &gpOrigine, PropagationDirection dir, float scaleFactor) const
 
- Protected Attributes inherited from ConversionSeedFinder
edm::EDGetTokenT< reco::BeamSpotbeamSpotToken_
 
PropagationDirection dir_
 
edm::EDGetTokenT< MeasurementTrackerEventmeasurementTrkToken_
 
float theBCEnergy_
 
GlobalPoint theBCPosition_
 
reco::BeamSpot theBeamSpot_
 
edm::ESHandle< GeometricSearchTrackertheGeomSearchTracker_
 
std::vector< const DetLayer * > theLayerList_
 
const MeasurementTrackertheMeasurementTracker_
 
std::string theMeasurementTrackerName_
 
edm::ESHandle< MagneticFieldtheMF_
 
const NavigationSchooltheNavigationSchool_ = 0
 
const PropagatorthePropagatorAlongMomentum_
 
const PropagatorthePropagatorOppositeToMomentum_
 
reco::CaloClustertheSC_
 
float theSCenergy_
 
GlobalPoint theSCPosition_
 
TrajectorySeedCollection theSeeds_
 
edm::Handle< MeasurementTrackerEventtheTrackerData_
 
const TrackingGeometrytheTrackerGeom_
 
KFUpdator theUpdator_
 

Detailed Description

Author
Nancy Marinelli, U. of Notre Dame, US

Definition at line 31 of file OutInConversionSeedFinder.h.

Member Typedef Documentation

Definition at line 36 of file OutInConversionSeedFinder.h.

Definition at line 37 of file OutInConversionSeedFinder.h.

Constructor & Destructor Documentation

OutInConversionSeedFinder::OutInConversionSeedFinder ( const edm::ParameterSet config,
edm::ConsumesCollector &&  iC 
)

Definition at line 37 of file OutInConversionSeedFinder.cc.

References bcEcut_, bcEtcut_, conf_, edm::ParameterSet::getParameter(), LogDebug, maxNumberOfOutInSeedsPerBC_, the2ndHitdphi_, the2ndHitdzConst_, the2ndHitdznSigma_, and useEtCut_.

37  : ConversionSeedFinder( conf,iC ), conf_(conf)
38 {
39 
40  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder CTOR " << "\n";
41 
42  maxNumberOfOutInSeedsPerBC_ = conf_.getParameter<int>("maxNumOfSeedsOutIn");
43  bcEtcut_ = conf_.getParameter<double>("bcEtCut");
44  bcEcut_ = conf_.getParameter<double>("bcECut");
45  useEtCut_ = conf_.getParameter<bool>("useEtCut");
46  //the2ndHitdphi_ = 0.01;
47  the2ndHitdphi_ = 0.03;
48  the2ndHitdzConst_ = 5.;
49  the2ndHitdznSigma_ = 2.;
50 
51 
52 
53 }
#define LogDebug(id)
T getParameter(std::string const &) const
OutInConversionSeedFinder::~OutInConversionSeedFinder ( )
override

Definition at line 58 of file OutInConversionSeedFinder.cc.

References LogDebug.

58  {
59  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder DTOR " << "\n";
60 
61 }
#define LogDebug(id)

Member Function Documentation

void OutInConversionSeedFinder::completeSeed ( const TrajectoryMeasurement m1,
const FreeTrajectoryState fts,
const Propagator propagator,
int  layer 
)
private

Definition at line 400 of file OutInConversionSeedFinder.cc.

References GeomDetEnumerators::barrel, createSeed(), runTauDisplay::dr, PVValHelper::dz, ConversionSeedFinder::getMeasurementTracker(), mps_fire::i, createfilelist::int, DetLayer::location(), LogDebug, LayerMeasurements::measurements(), Propagator::propagationDirection(), rpcPointValidation_cfi::recHit, TrajectoryMeasurement::recHit(), mathSSE::sqrt(), GeometricSearchDet::surface(), the2ndHitdphi_, the2ndHitdzConst_, the2ndHitdznSigma_, ConversionSeedFinder::theLayerList_, and ConversionSeedFinder::theTrackerData_.

Referenced by startSeed().

402  {
403 
404  //std::cout << "OutInConversionSeedFinder::completeSeed ilayer " << ilayer << "\n";
405 
406  MeasurementEstimator * newEstimator=nullptr;
407  const DetLayer * layer = theLayerList_[ilayer];
408 
409 
410  if ( layer->location() == GeomDetEnumerators::barrel ) {
411  // z error for 2nd hit is 2 sigma quadded with 5 cm
412  LogDebug("OutInConversionSeedFinder") << " Barrel OutInConversionSeedFinder::completeSeed " << the2ndHitdznSigma_ << " " << the2ndHitdzConst_ << " " << the2ndHitdphi_ << "\n";
413  float dz = sqrt(the2ndHitdznSigma_*the2ndHitdznSigma_*m1.recHit()->globalPositionError().czz()
415  newEstimator =
416  new ConversionBarrelEstimator(-the2ndHitdphi_, the2ndHitdphi_, -dz, dz);
417  }
418  else {
419  LogDebug("OutInConversionSeedFinder") << " EndCap OutInConversionSeedFinder::completeSeed " << the2ndHitdznSigma_ << " " << the2ndHitdzConst_ << " " << the2ndHitdphi_ << "\n";
420  // z error for 2nd hit is 2sigma quadded with 5 cm
421  //float m1dr = m1.recHit().globalPositionError().rerr(m1.recHit().globalPosition());
422  float m1dr = sqrt(m1.recHit()->localPositionError().yy());
423  float dr = sqrt(the2ndHitdznSigma_*the2ndHitdznSigma_*m1dr*m1dr
425  // LogDebug("OutInConversionSeedFinder") << "second hit forward dr " << dr << " this hit " << m1dr << endl;
426  newEstimator =
427  new ConversionForwardEstimator(-the2ndHitdphi_, the2ndHitdphi_, dr);
428  }
429 
430  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::completeSeed ilayer " << ilayer << "\n";
431 
432  // Get the measurements consistent with the FTS and the Estimator
433  TSOS tsos(fts, layer->surface() );
434  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::completeSeed propagationDirection " << int(propagator->propagationDirection() ) << "\n";
435  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::completeSeed pointer to estimator " << newEstimator << "\n";
436 
437  LayerMeasurements theLayerMeasurements_( *this->getMeasurementTracker(), *theTrackerData_ );
438  std::vector<TrajectoryMeasurement> measurements = theLayerMeasurements_.measurements( *layer, tsos, *propagator, *newEstimator);
439  //std::cout << "OutInConversionSeedFinder::completeSeed Found " << measurements.size() << " second hits " << "\n";
440  delete newEstimator;
441 
442  for(unsigned int i = 0; i < measurements.size(); ++i) {
443  if( measurements[i].recHit()->isValid() ) {
444  createSeed(m1, measurements[i]);
445  }
446  }
447 
448 
449 
450  //LogDebug("OutInConversionSeedFinder") << "COMPLETED " << theSeeds_.size() << " SEEDS " << "\n";
451 }
#define LogDebug(id)
const MeasurementTracker * getMeasurementTracker() const
ConstRecHitPointer const & recHit() const
virtual Location location() const =0
Which part of the detector (barrel, endcap)
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:151
T sqrt(T t)
Definition: SSEVec.h:18
void createSeed(const TrajectoryMeasurement &m1, const TrajectoryMeasurement &m2)
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
std::vector< const DetLayer * > theLayerList_
edm::Handle< MeasurementTrackerEvent > theTrackerData_
void OutInConversionSeedFinder::createSeed ( const TrajectoryMeasurement m1,
const TrajectoryMeasurement m2 
)
private

Definition at line 455 of file OutInConversionSeedFinder.cc.

References createSeedFTS(), TrajectoryMeasurement::estimate(), PV3DBase< T, PVType, FrameType >::eta(), TrajectoryStateOnSurface::freeTrajectoryState(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), TrajectoryMeasurement::layer(), LogDebug, maxNumberOfOutInSeedsPerBC_, nSeedsPerBC_, oppositeToMomentum, PTrajectoryStateOnDet::parameters(), PV3DBase< T, PVType, FrameType >::perp(), trajectoryStateTransform::persistentState(), PV3DBase< T, PVType, FrameType >::phi(), LocalTrajectoryParameters::position(), Propagator::propagate(), edm::OwnVector< T, P >::push_back(), TrajectoryMeasurement::recHit(), ConversionSeedFinder::thePropagatorOppositeToMomentum_, ConversionSeedFinder::theSeeds_, ConversionSeedFinder::theUpdator_, and KFUpdator::update().

Referenced by completeSeed().

456  {
457 
458  //std::cout << "OutInConversionSeedFinder::createSeed from hit1 " << m1.recHit()->globalPosition() << " r1 " << m1.recHit()->globalPosition().perp() << " and hit2 " << m2.recHit()->globalPosition() << " r2 " << m2.recHit()->globalPosition().perp() << "\n";
459 
460 
461  FreeTrajectoryState fts = createSeedFTS(m1, m2);
462 
463 
464  //std::cout << "OutInConversionSeedFinder::createSeed First point errors " <<m1.recHit()->parametersError() << "\n";
465  // std::cout << "original cluster FTS " << fts <<"\n";
466  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::createSeed First point errors " <<m1.recHit()->parametersError() << "\n";
467  LogDebug("OutInConversionSeedFinder") << "original cluster FTS " << fts <<"\n";
468 
469 
470 
471  //std::cout << "OutInConversionSeedFinder::createSeed propagation dir " << int( thePropagatorOppositeToMomentum_->propagationDirection() ) << "\n";
472  TrajectoryStateOnSurface state1 = thePropagatorOppositeToMomentum_->propagate(fts, m1.recHit()->det()->surface());
473 
474  // LogDebug("OutInConversionSeedFinder") << "hit surface " << h1.det().surface().position() << endl;
475  // LogDebug("OutInConversionSeedFinder") << "prop to " << typeid(h1.det().surface()).name() << endl;
476  // LogDebug("OutInConversionSeedFinder") << "prop to first hit " << state1 << endl;
477  // LogDebug("OutInConversionSeedFinder") << "update to " << h1.globalPosition() << endl;
478 
479  if ( state1.isValid() ) {
480  TrajectoryStateOnSurface updatedState1 = theUpdator_.update(state1, *m1.recHit() );
481 
482  if ( updatedState1.isValid() ) {
483  TrajectoryStateOnSurface state2 = thePropagatorOppositeToMomentum_->propagate(*updatedState1.freeTrajectoryState(), m2.recHit()->det()->surface());
484 
485  if ( state2.isValid() ) {
486 
487  TrajectoryStateOnSurface updatedState2 = theUpdator_.update(state2, *m2.recHit() );
488  TrajectoryMeasurement meas1(state1, updatedState1, m1.recHit() , m1.estimate(), m1.layer());
489  TrajectoryMeasurement meas2(state2, updatedState2, m2.recHit() , m2.estimate(), m2.layer());
490 
492  myHits.push_back(meas1.recHit()->hit()->clone());
493  myHits.push_back(meas2.recHit()->hit()->clone());
494 
495  if ( nSeedsPerBC_ >= maxNumberOfOutInSeedsPerBC_ ) return;
496 
497 
498  PTrajectoryStateOnDet ptsod= trajectoryStateTransform::persistentState(state2, meas2.recHit()->hit()->geographicalId().rawId() );
499 
500  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::createSeed new seed from state " << state2.globalPosition() << "\n";
501  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::createSeed new seed ptsod " << ptsod.parameters().position() << " R "
502  << ptsod.parameters().position().perp() << " phi " << ptsod.parameters().position().phi() << " eta "
503  << ptsod.parameters().position().eta() << "\n";
504 
505 
506 
507  theSeeds_.push_back(TrajectorySeed( ptsod, myHits, oppositeToMomentum ));
508  nSeedsPerBC_++;
509 
510  }
511  }
512  }
513 
514 
515 
516 
517 
518 }
#define LogDebug(id)
T perp() const
Definition: PV3DBase.h:72
ConstRecHitPointer const & recHit() const
LocalPoint position() const
Local x and y position coordinates.
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
GlobalPoint globalPosition() const
TrajectorySeedCollection theSeeds_
const Propagator * thePropagatorOppositeToMomentum_
void push_back(D *&d)
Definition: OwnVector.h:290
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
Definition: KFUpdator.cc:169
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
const DetLayer * layer() const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
T eta() const
Definition: PV3DBase.h:76
FreeTrajectoryState createSeedFTS(const TrajectoryMeasurement &m1, const TrajectoryMeasurement &m2) const
const LocalTrajectoryParameters & parameters() const
FreeTrajectoryState OutInConversionSeedFinder::createSeedFTS ( const TrajectoryMeasurement m1,
const TrajectoryMeasurement m2 
) const
private

Definition at line 524 of file OutInConversionSeedFinder.cc.

References alpha, ALCARECOTkAlJpsiMuMu_cff::charge, TrajectoryStateOnSurface::charge(), funct::cos(), fixPointRadius(), runTauDisplay::gp, MagneticField::inTesla(), funct::m, PV3DBase< T, PVType, FrameType >::perp(), phi, PV3DBase< T, PVType, FrameType >::phi(), TrajectoryMeasurement::predictedState(), EnergyCorrector::pt, funct::sin(), ConversionSeedFinder::theMF_, ConversionSeedFinder::theSCenergy_, ConversionSeedFinder::theSCPosition_, PV3DBase< T, PVType, FrameType >::theta(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by createSeed().

525  {
526 
527 
528 
529  GlobalPoint xmeas = fixPointRadius(m1);
530  GlobalPoint xvert = fixPointRadius(m2);
531 
532 
533  float pt = theSCenergy_ * sin(theSCPosition_.theta());
534  float pz = theSCenergy_ * cos(theSCPosition_.theta());
535 
536 
537 
538  // doesn't work at all for endcap, where r is badly measured
539  //float dphidr = (p1.phi()-p2.phi())/(p1.perp()-p2.perp());
540  //int charge = (dphidr > 0.) ? -1 : 1;
541  int charge = m2.predictedState().charge();
542 
543  double BInTesla = theMF_->inTesla(xmeas).z();
544  GlobalVector xdiff = xmeas -xvert;
545 
546  double phi= xdiff.phi();
547  double pxOld = pt*cos(phi);
548  double pyOld = pt*sin(phi);
549  double RadCurv = 100*pt/(BInTesla*0.29979);
550  double alpha = asin(0.5*xdiff.perp()/RadCurv);
551  float ca = cos(charge*alpha);
552  float sa = sin(charge*alpha);
553  double pxNew = ca*pxOld + sa*pyOld;
554  double pyNew = -sa*pxOld + ca*pyOld;
555  GlobalVector pNew(pxNew, pyNew, pz);
556 
557  GlobalTrajectoryParameters gp(xmeas, pNew, charge, &(*theMF_) );
558 
560  m(0,0) = 0.05; m(1,1) = 0.02 ; m(2,2) = 0.007 ;
561  m(3,3) = 10. ; m(4,4) = 10. ;
562  //std::cout << "OutInConversionSeedFinder::createSeedFTS " << FreeTrajectoryState(gp, CurvilinearTrajectoryError(m)) << "\n";
564 
565 
566 }
float alpha
Definition: AMPTWrapper.h:95
TrajectoryStateOnSurface const & predictedState() const
T perp() const
Definition: PV3DBase.h:72
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
GlobalPoint fixPointRadius(const TrajectoryMeasurement &) const
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
edm::ESHandle< MagneticField > theMF_
void OutInConversionSeedFinder::fillClusterSeeds ( const reco::CaloClusterPtr bc)
private

negative charge state

positive charge state

Definition at line 194 of file OutInConversionSeedFinder.cc.

References makeTrackState(), edm::second(), startSeed(), and theFirstMeasurements_.

Referenced by makeSeeds().

194  {
195 
196 
197  theFirstMeasurements_.clear();
198  FreeTrajectoryState fts;
199 
201  if ( makeTrackState(-1).second ) {
202  fts = makeTrackState(-1).first;
203  startSeed(fts);
204  }
206 
207  if ( makeTrackState(1).second ) {
208  fts = makeTrackState(1).first;
209  startSeed(fts);
210  }
211  theFirstMeasurements_.clear();
212 }
std::pair< FreeTrajectoryState, bool > makeTrackState(int charge) const
U second(std::pair< T, U > const &p)
void startSeed(const FreeTrajectoryState &)
std::vector< TrajectoryMeasurement > theFirstMeasurements_
GlobalPoint OutInConversionSeedFinder::fixPointRadius ( const TrajectoryMeasurement m1) const
private

Definition at line 571 of file OutInConversionSeedFinder.cc.

References GeomDetEnumerators::barrel, funct::cos(), TrajectoryMeasurement::layer(), DetLayer::location(), p1, p2, phi, PV3DBase< T, PVType, FrameType >::phi(), alignCSCRings::r, TrajectoryMeasurement::recHit(), funct::sin(), funct::tan(), ConversionSeedFinder::theSCPosition_, PV3DBase< T, PVType, FrameType >::theta(), theta(), z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by createSeedFTS().

571  {
572  GlobalPoint p1 = m1.recHit()->globalPosition();
573  GlobalPoint p2;
574  if(m1.layer()->location() == GeomDetEnumerators::barrel) {
575  p2 = p1;
576  } else {
577  float z = p1.z();
578  float phi = p1.phi();
579  float theta = theSCPosition_.theta();
580  float r = p1.z() * tan(theta);
581  p2 = GlobalPoint(r*cos(phi), r*sin(phi), z);
582  // LogDebug("OutInConversionSeedFinder") << "fixing point radius " << p2 << " from " << p1 << endl;
583  }
584  return p2;
585 }
ConstRecHitPointer const & recHit() const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
virtual Location location() const =0
Which part of the detector (barrel, endcap)
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Geom::Theta< T > theta() const
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
const DetLayer * layer() const
double p2[4]
Definition: TauolaWrapper.h:90
double p1[4]
Definition: TauolaWrapper.h:89
MeasurementEstimator * OutInConversionSeedFinder::makeEstimator ( const DetLayer layer,
float  dphi 
) const
private

Definition at line 362 of file OutInConversionSeedFinder.cc.

References GeomDetEnumerators::barrel, GeomDetEnumerators::endcap, DetLayer::location(), LogDebug, PV3DBase< T, PVType, FrameType >::perp(), GloballyPositioned< T >::position(), alignCSCRings::r, ForwardDetLayer::specificSurface(), BarrelDetLayer::specificSurface(), ForwardDetLayer::surface(), ConversionSeedFinder::theBCPosition_, z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by startSeed().

362  {
363 
364  //std::cout << "OutInConversionSeedFinder::makeEstimator " << "\n";
365 
366  MeasurementEstimator * newEstimator=nullptr;
367 
368  if (layer->location() == GeomDetEnumerators::barrel ) {
369 
370  const BarrelDetLayer * barrelLayer = dynamic_cast<const BarrelDetLayer*>(layer);
371  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeEstimator Barrel r = " << barrelLayer->specificSurface().radius() << " " << "\n";
372  float r = barrelLayer->specificSurface().radius();
373  float zrange = 15.* (1.-r/theBCPosition_.perp());
374  newEstimator = new ConversionBarrelEstimator(-dphi, dphi, -zrange, zrange);
375  }
376 
377 
378 
379  if (layer->location() == GeomDetEnumerators::endcap ) {
380 
381  const ForwardDetLayer * forwardLayer = dynamic_cast<const ForwardDetLayer*>(layer);
382  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeEstimator Endcap r = " << forwardLayer->specificSurface().innerRadius() << " R " << forwardLayer->specificSurface().outerRadius() << " Z " << forwardLayer->specificSurface().position().z() << "\n";
383 
384  float zc = fabs(theBCPosition_.z());
385  float z = fabs(forwardLayer->surface().position().z());
386 
387  float rrange = 15. * theBCPosition_.perp() * (zc - z) / (zc*zc - 15.*zc);
388  newEstimator = new ConversionForwardEstimator(-dphi, dphi, rrange);
389  }
390 
391 
392 
393 
394  return newEstimator;
395 }
#define LogDebug(id)
T perp() const
Definition: PV3DBase.h:72
virtual Location location() const =0
Which part of the detector (barrel, endcap)
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
T z() const
Definition: PV3DBase.h:64
virtual const BoundDisk & specificSurface() const final
const BoundSurface & surface() const final
The surface of the GeometricSearchDet.
const PositionType & position() const
void OutInConversionSeedFinder::makeSeeds ( const edm::Handle< edm::View< reco::CaloCluster > > &  allBc)
overridevirtual

Implements ConversionSeedFinder.

Definition at line 65 of file OutInConversionSeedFinder.cc.

References bcEcut_, bcEtcut_, reco::deltaPhi(), reco::CaloCluster::energy(), PV3DBase< T, PVType, FrameType >::eta(), fillClusterSeeds(), ConversionSeedFinder::findLayers(), mps_fire::i, LogDebug, nSeedsPerBC_, PV3DBase< T, PVType, FrameType >::phi(), reco::CaloCluster::position(), ptFast(), ConversionSeedFinder::theBCEnergy_, ConversionSeedFinder::theBCPosition_, ConversionSeedFinder::theSCPosition_, ConversionSeedFinder::theSeeds_, and useEtCut_.

65  {
66 
67  theSeeds_.clear();
68 
69  // std::cout << " OutInConversionSeedFinder::makeSeeds() " << "\n";
70 
71  // debug
72  // std::cout << " OutInConversionSeedFinder::makeSeeds() SC position " << theSCPosition_.x() << " " << theSCPosition_.y() << " " << theSCPosition_.z() << "\n";
73  // std::cout << " SC eta " << theSCPosition_.eta() << " SC phi " << theSCPosition_.phi() << "\n";
74  // std::cout << " OutInConversionSeedFinder::makeSeeds() SC energy " << theSCenergy_ << "\n";
75  //
76 
77  findLayers();
78 
79 
80  // std::cout << " Check Calo cluster collection size " << allBC->size() << "\n";
81 
82  float theSCPhi=theSCPosition_.phi();
83  float theSCEta=theSCPosition_.eta();
84 
85 
86 
87  // Loop over the Calo Clusters in the event looking for seeds
88  LogDebug("OutInConversionSeedFinder") << " OutInConversionSeedFinder::makeSeeds() All BC in the event " << "\n";
89  for (unsigned i = 0; i < allBC->size(); ++i ) {
90 
91  nSeedsPerBC_=0;
92 
93  const reco::CaloCluster& theBC = allBC->at(i);
94  const math::XYZPoint& rawBCpos = theBC.position();
95 
96  theBCPosition_ = GlobalPoint( rawBCpos.x(), rawBCpos.y(), rawBCpos.z() ) ;
97  float theBcEta= theBCPosition_.eta();
98  float theBcPhi= theBCPosition_.phi();
99  // float dPhi= theBcPhi-theSCPhi;
100  theBCEnergy_=theBC.energy();
101 
102  float EtOrECut = bcEcut_;
103  if ( useEtCut_ ) {
105  EtOrECut = bcEtcut_;
106  }
107 
108  if ( theBCEnergy_ < EtOrECut ) continue;
109  // std::cout << " OutInConversionSeedFinder::makeSeeds() BC eta " << theBcEta << " phi " << theBcPhi << " BC transverse energy " << theBCEnergy_ << " dPhi " << fabs(theBcPhi-theSCPhi) << " dEta " << fabs(theBcEta-theSCEta) << "\n";
110 
111  LogDebug("OutInConversionSeedFinder") << " OutInConversionSeedFinder::makeSeeds() Passing the >=1.5 GeV cut BC eta " << theBcEta << " phi " << theBcPhi << " BC energy " << theBCEnergy_ << "\n";
112 
113  if ( fabs(theBcEta-theSCEta) < 0.015 && reco::deltaPhi(theBcPhi,theSCPhi) < 0.3 ) {
114  LogDebug("OutInConversionSeedFinder") << " OutInConversionSeedFinder::makeSeeds() in et and phi range passed to the analysis " << "\n";
115  fillClusterSeeds( allBC->ptrAt(i) );
116  }
117 
118 
119  }
120 
121 
122  // std::cout << "Built vector of seeds of size " << theSeeds_.size() << "\n" ;
123 
125  /*
126  int nSeed=0;
127  for ( std::vector<TrajectorySeed>::const_iterator iSeed= theSeeds_.begin(); iSeed != theSeeds_.end(); ++iSeed) {
128  nSeed++;
129  PTrajectoryStateOnDet ptsod=iSeed->startingState();
130  LogDebug("OutInConversionSeedFinder") << nSeed << ") Direction " << iSeed->direction() << " Num of hits " << iSeed->nHits() << " starting state position " << ptsod.parameters().position() << " R " << ptsod.parameters().position().perp() << " phi " << ptsod.parameters().position().phi() << " eta " << ptsod.parameters().position().eta() << "\n" ;
131 
132 
133  DetId tmpId = DetId( iSeed->startingState().detId());
134  const GeomDet* tmpDet = this->getMeasurementTracker()->geomTracker()->idToDet( tmpId );
135  GlobalVector gv = tmpDet->surface().toGlobal( iSeed->startingState().parameters().momentum() );
136 
137  LogDebug("OutInConversionSeedFinder") << "seed perp,phi,eta : "
138  << gv.perp() << " , "
139  << gv.phi() << " , "
140  << gv.eta() << "\n" ; ;
141 
142 
143 
144 
145  TrajectorySeed::range hitRange = iSeed->recHits();
146  for (TrajectorySeed::const_iterator ihit = hitRange.first; ihit != hitRange.second; ihit++) {
147 
148  if ( ihit->isValid() ) {
149 
150  LogDebug("OutInConversionSeedFinder") << " Valid hit global position " << this->getMeasurementTracker()->geomTracker()->idToDet((ihit)->geographicalId())->surface().toGlobal((ihit)->localPosition()) << " R " << this->getMeasurementTracker()->geomTracker()->idToDet((ihit)->geographicalId())->surface().toGlobal((ihit)->localPosition()).perp() << " phi " << this->getMeasurementTracker()->geomTracker()->idToDet((ihit)->geographicalId())->surface().toGlobal((ihit)->localPosition()).phi() << " eta " << this->getMeasurementTracker()->geomTracker()->idToDet((ihit)->geographicalId())->surface().toGlobal((ihit)->localPosition()).eta() << "\n" ;
151 
152  }
153  }
154  }
155 
156  */
157 
158 
159 
160 }
#define LogDebug(id)
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:22
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:131
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
TrajectorySeedCollection theSeeds_
double ptFast(const double energy, const math::XYZPoint &position, const math::XYZPoint &origin)
void fillClusterSeeds(const reco::CaloClusterPtr &bc)
double energy() const
cluster energy
Definition: CaloCluster.h:126
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
T eta() const
Definition: PV3DBase.h:76
void OutInConversionSeedFinder::makeSeeds ( const reco::CaloClusterPtr aBC)
virtual

Definition at line 164 of file OutInConversionSeedFinder.cc.

References bcEtcut_, PV3DBase< T, PVType, FrameType >::eta(), fillClusterSeeds(), ConversionSeedFinder::findLayers(), nSeedsPerBC_, PV3DBase< T, PVType, FrameType >::phi(), ptFast(), ConversionSeedFinder::theBCEnergy_, ConversionSeedFinder::theBCPosition_, ConversionSeedFinder::theSCPosition_, and ConversionSeedFinder::theSeeds_.

164  {
165 
166  theSeeds_.clear();
167 
168  findLayers();
169 
170  float theSCPhi=theSCPosition_.phi();
171  float theSCEta=theSCPosition_.eta();
172 
173  nSeedsPerBC_=0;
174 
175  // theBCEnergy_=aBC->energy();
176  theBCEnergy_= ptFast(aBC->energy(),aBC->position(),math::XYZPoint(0,0,0));
177  theBCPosition_ = GlobalPoint(aBC->position().x(), aBC->position().y(), aBC->position().z() ) ;
178  float theBcEta= theBCPosition_.eta();
179  float theBcPhi= theBCPosition_.phi();
180  // float dPhi= theBcPhi-theSCPhi;
181 
182  if ( theBCEnergy_ < bcEtcut_ ) return;
183 
184  if ( fabs(theBcEta-theSCEta) < 0.015 && fabs(theBcPhi-theSCPhi) < 0.25 ) {
185  fillClusterSeeds( aBC);
186  }
187 
188 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
TrajectorySeedCollection theSeeds_
double ptFast(const double energy, const math::XYZPoint &position, const math::XYZPoint &origin)
void fillClusterSeeds(const reco::CaloClusterPtr &bc)
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
T eta() const
Definition: PV3DBase.h:76
std::pair< FreeTrajectoryState, bool > OutInConversionSeedFinder::makeTrackState ( int  charge) const
private

Definition at line 216 of file OutInConversionSeedFinder.cc.

References PixelRecoUtilities::curvature(), edmIntegrityCheck::d, MagneticField::inTesla(), LogDebug, funct::m, PV3DBase< T, PVType, FrameType >::perp(), reco::BeamSpot::position(), dttmaxenums::R, alignCSCRings::r, mps_fire::result, rho, idealTransformation::rotation, mathSSE::sqrt(), ConversionSeedFinder::theBCEnergy_, ConversionSeedFinder::theBCPosition_, ConversionSeedFinder::theBeamSpot_, ConversionSeedFinder::theMF_, and PV3DBase< T, PVType, FrameType >::z().

Referenced by fillClusterSeeds().

216  {
217 
218  std::pair<FreeTrajectoryState,bool> result;
219  result.second=false;
220 
221 
222  //std::cout << " OutInConversionSeedFinder:makeTrackState " << "\n";
223 
224 
225  // Old GlobalPoint gpOrigine(theBCPosition_.x()*0.3, theBCPosition_.y()*0.3, theBCPosition_.z()*0.3) ;
226  // GlobalPoint gpOrigine(0.,0.,0.);
227 
229  GlobalVector gvBcRadius = theBCPosition_ - gpOrigine ;
230  HepGeom::Point3D<double> radiusBc(gvBcRadius.x(),gvBcRadius.y(),gvBcRadius.z()) ;
231  HepGeom::Point3D<double> momentumWithoutCurvature = radiusBc.unit() * theBCEnergy_ ;
232 
233  // compute momentum direction at calo
234  double curvature = theMF_->inTesla(theBCPosition_).z() * c_light * 1.e-3 / momentumWithoutCurvature.perp() ;
235  curvature /= 100. ; // in cm-1 !!
236 
237  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState gpOrigine " << gpOrigine.x() << " " << gpOrigine.y() << " " << gpOrigine.z() << " momentumWithoutCurvature " << momentumWithoutCurvature.mag() << " curvature " << curvature << "\n";
238 
239  // define rotation angle
240  float R = theBCPosition_.perp();
241  float r = gpOrigine.perp();
242  float rho = 1./curvature;
243  // from the formula for the intersection of two circles
244  // turns out to be about 2/3 of the deflection of the old formula
245  float d = sqrt(r*r+rho*rho);
246  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));
247  //float u = rho + rho/d/d*(R*R-rho*rho) ;
248  if ( u <=R ) result.second=true;
249 
250  double sinAlpha = 0.5*u/R;
251  if ( sinAlpha>(1.-10*DBL_EPSILON) ) sinAlpha = 1.-10*DBL_EPSILON;
252  else if ( sinAlpha<-(1.-10*DBL_EPSILON) ) sinAlpha = -(1.-10*DBL_EPSILON);
253 
254  double newdphi = charge * asin( sinAlpha) ;
255 
256  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState charge " << charge << " R " << R << " u/R " << u/R << " asin(0.5*u/R) " << asin(sinAlpha) << "\n";
257 
258  HepGeom::Transform3D rotation = HepGeom::Rotate3D(newdphi, HepGeom::Vector3D<double> (0., 0. ,1.));
259 
260 
261  HepGeom::Point3D<double> momentumInTracker = momentumWithoutCurvature.transform(rotation) ;
262  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState R " << R << " r " << r << " rho " << rho << " d " << d << " u " << u << " newdphi " << newdphi << " momentumInTracker " << momentumInTracker << "\n";
263 
264  HepGeom::Point3D<double> hepStartingPoint(gpOrigine.x(), gpOrigine.y(), gpOrigine.z()) ;
265 
266  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState hepStartingPoint " << hepStartingPoint << "\n";
267 
268  hepStartingPoint.transform(rotation);
269 
270  GlobalPoint startingPoint(hepStartingPoint.x(), hepStartingPoint.y(), hepStartingPoint.z());
271 
272  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState startingPoint " << startingPoint << " calo position " << theBCPosition_ << "\n";
273  GlobalVector gvTracker(momentumInTracker.x(), momentumInTracker.y(), momentumInTracker.z());
274  GlobalTrajectoryParameters gtp(startingPoint, gvTracker, charge, &(*theMF_) );
275  // error matrix
277  m(0,0) = 0.1; m(1,1) = 0.1 ; m(2,2) = 0.1 ;
278  m(3,3) = 0.1 ; m(4,4) = 0.1;
279 
280  // std::cout << "OutInConversionSeedFinder::makeTrackState " << FreeTrajectoryState(gtp, CurvilinearTrajectoryError(m) ) << "\n";
281 
282  result.first= FreeTrajectoryState(gtp, CurvilinearTrajectoryError(m) ) ;
283  return result;
284 
285 }
#define LogDebug(id)
T perp() const
Definition: PV3DBase.h:72
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
T curvature(T InversePt, const edm::EventSetup &iSetup)
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
edm::ESHandle< MagneticField > theMF_
const Point & position() const
position
Definition: BeamSpot.h:62
void OutInConversionSeedFinder::startSeed ( const FreeTrajectoryState fts)
private

Definition at line 288 of file OutInConversionSeedFinder.cc.

References alongMomentum, FreeTrajectoryState::charge(), completeSeed(), ConversionSeedFinder::getMeasurementTracker(), mps_fire::i, createfilelist::int, ConversionSeedFinder::layerList(), LogDebug, makeEstimator(), LayerMeasurements::measurements(), Propagator::propagationDirection(), TrajectoryMeasurement::recHit(), GeometricSearchDet::surface(), theFirstMeasurements_, ConversionSeedFinder::thePropagatorAlongMomentum_, ConversionSeedFinder::thePropagatorOppositeToMomentum_, ConversionSeedFinder::theTrackerData_, and ConversionSeedFinder::trackStateFromClusters().

Referenced by fillClusterSeeds().

288  {
289 
290 
291  // std::cout << "OutInConversionSeedFinder::startSeed layer list " << this->layerList().size() << "\n";
292  //std::cout << "OutInConversionSeedFinder::startSeed fts " << fts << "\n";
293 
294  std::vector<const DetLayer*> myLayers=layerList();
295  if ( myLayers.size() > 3 ) {
296 
297  for(unsigned int ilayer = myLayers.size()-1; ilayer >= myLayers.size()-2; --ilayer) {
298  const DetLayer * layer = myLayers[ilayer];
299 
300 
301  // allow the z of the hit to be within a straight line from a vertex
302  // of +-15 cm to the cluster
303  // float dphi = 0.015;
304  float dphi = 0.030;
305 
306  MeasurementEstimator * newEstimator = makeEstimator(layer, dphi);
307 
308 
309  //std::cout << "OutInSeedFinder::startSeed propagationDirection " << int(thePropagatorAlongMomentum_->propagationDirection() ) << "\n";
310 
311  TSOS tsos(fts, layer->surface() );
312 
313  LogDebug("OutInConversionSeedFinder") << "OutInSeedFinder::startSeed after TSOS tsos(fts, layer->surface() ) " << "\n";
314 
315  LayerMeasurements theLayerMeasurements_( *this->getMeasurementTracker(), *theTrackerData_ );
316  theFirstMeasurements_ = theLayerMeasurements_.measurements( *layer, tsos, *thePropagatorAlongMomentum_, *newEstimator);
317 
318  //std::cout << "OutInSeedFinder::startSeed after theFirstMeasurements_ " << theFirstMeasurements_.size() << "\n";
319 
320  if(theFirstMeasurements_.size() > 1) // always a dummy returned, too
321  LogDebug("OutInConversionSeedFinder") << " Found " << theFirstMeasurements_.size()-1 << " 1st hits in seed" << "\n";
322 
323  delete newEstimator;
324 
325  LogDebug("OutInConversionSeedFinder") << "OutInSeedFinder::startSeed Layer " << ilayer << " theFirstMeasurements_.size " << theFirstMeasurements_.size() << "\n";
326 
327  for(unsigned int i = 0; i < theFirstMeasurements_.size(); ++i) {
329  if(m1.recHit()->isValid()) {
330 
331  // update the fts to start from this point. much better than starting from
332  // extrapolated point along the line
333  GlobalPoint hitPoint = m1.recHit()->globalPosition();
334  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";
335 
336 
337  FreeTrajectoryState newfts = trackStateFromClusters(fts.charge(), hitPoint, alongMomentum, 0.8);
338  //std::cout << "OutInConversionSeedFinder::startSeed newfts " << newfts << "\n";
339  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::startSeed newfts " << newfts << "\n";
340  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::startSeed propagationDirection after switching " << int(thePropagatorOppositeToMomentum_->propagationDirection() ) << "\n";
341  // std::cout << "OutInConversionSeedFinder::startSeed propagationDirection after switching " << int(thePropagatorOppositeToMomentum_->propagationDirection() ) << "\n";
342 
343 
344  completeSeed(m1, newfts, thePropagatorOppositeToMomentum_, ilayer-1);
345  // skip a layer, if you haven't already skipped the first layer
346  if(ilayer == myLayers.size()-1) {
347  completeSeed(m1, newfts, thePropagatorOppositeToMomentum_, ilayer-2);
348  }
349  }
350  }
351 
352  } // loop over layers
353  }
354 
355 
356 
357 
358 }
#define LogDebug(id)
const Propagator * thePropagatorAlongMomentum_
std::vector< const DetLayer * > const & layerList() const
const MeasurementTracker * getMeasurementTracker() const
ConstRecHitPointer const & recHit() const
MeasurementEstimator * makeEstimator(const DetLayer *, float dphi) const
TrackCharge charge() const
const Propagator * thePropagatorOppositeToMomentum_
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:151
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
FreeTrajectoryState trackStateFromClusters(int aCharge, const GlobalPoint &gpOrigine, PropagationDirection dir, float scaleFactor) const
void completeSeed(const TrajectoryMeasurement &m1, const FreeTrajectoryState &fts, const Propagator *, int layer)
edm::Handle< MeasurementTrackerEvent > theTrackerData_
std::vector< TrajectoryMeasurement > theFirstMeasurements_

Member Data Documentation

float OutInConversionSeedFinder::bcEcut_
private

Definition at line 82 of file OutInConversionSeedFinder.h.

Referenced by makeSeeds(), and OutInConversionSeedFinder().

float OutInConversionSeedFinder::bcEtcut_
private

Definition at line 81 of file OutInConversionSeedFinder.h.

Referenced by makeSeeds(), and OutInConversionSeedFinder().

edm::ParameterSet OutInConversionSeedFinder::conf_
private

Definition at line 54 of file OutInConversionSeedFinder.h.

Referenced by OutInConversionSeedFinder().

int OutInConversionSeedFinder::maxNumberOfOutInSeedsPerBC_
private

Definition at line 80 of file OutInConversionSeedFinder.h.

Referenced by createSeed(), and OutInConversionSeedFinder().

int OutInConversionSeedFinder::nSeedsPerBC_
private

Definition at line 79 of file OutInConversionSeedFinder.h.

Referenced by createSeed(), and makeSeeds().

float OutInConversionSeedFinder::the2ndHitdphi_
private

Definition at line 75 of file OutInConversionSeedFinder.h.

Referenced by completeSeed(), and OutInConversionSeedFinder().

float OutInConversionSeedFinder::the2ndHitdzConst_
private

Definition at line 76 of file OutInConversionSeedFinder.h.

Referenced by completeSeed(), and OutInConversionSeedFinder().

float OutInConversionSeedFinder::the2ndHitdznSigma_
private

Definition at line 77 of file OutInConversionSeedFinder.h.

Referenced by completeSeed(), and OutInConversionSeedFinder().

std::vector<TrajectoryMeasurement> OutInConversionSeedFinder::theFirstMeasurements_
private

Definition at line 78 of file OutInConversionSeedFinder.h.

Referenced by fillClusterSeeds(), and startSeed().

bool OutInConversionSeedFinder::useEtCut_
private

Definition at line 83 of file OutInConversionSeedFinder.h.

Referenced by makeSeeds(), and OutInConversionSeedFinder().