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_
 
edm::ESGetToken< GeometricSearchTracker, TrackerRecoGeometryRecordtheGeomSearchTrackerToken_
 
std::vector< const DetLayer * > theLayerList_
 
const MeasurementTrackertheMeasurementTracker_
 
edm::ESGetToken< MeasurementTracker, CkfComponentsRecordtheMeasurementTrackerToken_
 
edm::ESHandle< MagneticFieldtheMF_
 
edm::ESGetToken< MagneticField, IdealMagneticFieldRecordtheMFToken_
 
const NavigationSchooltheNavigationSchool_ = nullptr
 
const PropagatorthePropagatorAlongMomentum_
 
edm::ESGetToken< Propagator, TrackingComponentsRecordthePropagatorAlongMomentumToken_
 
const PropagatorthePropagatorOppositeToMomentum_
 
edm::ESGetToken< Propagator, TrackingComponentsRecordthePropagatorOppositeToMomentumToken_
 
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 29 of file OutInConversionSeedFinder.h.

Member Typedef Documentation

◆ FTS

Definition at line 31 of file OutInConversionSeedFinder.h.

◆ TSOS

Definition at line 32 of file OutInConversionSeedFinder.h.

Constructor & Destructor Documentation

◆ OutInConversionSeedFinder()

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

Definition at line 34 of file OutInConversionSeedFinder.cc.

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

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

◆ ~OutInConversionSeedFinder()

OutInConversionSeedFinder::~OutInConversionSeedFinder ( )
override

Definition at line 49 of file OutInConversionSeedFinder.cc.

References LogDebug.

49  {
50  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder DTOR "
51  << "\n";
52 }
#define LogDebug(id)

Member Function Documentation

◆ completeSeed()

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

Definition at line 373 of file OutInConversionSeedFinder.cc.

References GeomDetEnumerators::barrel, createSeed(), l1ctLayer1_cff::dr, PVValHelper::dz, ConversionSeedFinder::getMeasurementTracker(), mps_fire::i, createfilelist::int, pixelTopology::layer, LogDebug, LayerMeasurements::measurements(), TrackCandidateProducer_cfi::propagator, rpcPointValidation_cfi::recHit, mathSSE::sqrt(), the2ndHitdphi_, the2ndHitdzConst_, the2ndHitdznSigma_, ConversionSeedFinder::theLayerList_, and ConversionSeedFinder::theTrackerData_.

Referenced by startSeed().

376  {
377  //std::cout << "OutInConversionSeedFinder::completeSeed ilayer " << ilayer << "\n";
378 
379  MeasurementEstimator* newEstimator = nullptr;
380  const DetLayer* layer = theLayerList_[ilayer];
381 
382  if (layer->location() == GeomDetEnumerators::barrel) {
383  // z error for 2nd hit is 2 sigma quadded with 5 cm
384  LogDebug("OutInConversionSeedFinder") << " Barrel OutInConversionSeedFinder::completeSeed " << the2ndHitdznSigma_
385  << " " << the2ndHitdzConst_ << " " << the2ndHitdphi_ << "\n";
386  float dz = sqrt(the2ndHitdznSigma_ * the2ndHitdznSigma_ * m1.recHit()->globalPositionError().czz() +
389  } else {
390  LogDebug("OutInConversionSeedFinder") << " EndCap OutInConversionSeedFinder::completeSeed " << the2ndHitdznSigma_
391  << " " << the2ndHitdzConst_ << " " << the2ndHitdphi_ << "\n";
392  // z error for 2nd hit is 2sigma quadded with 5 cm
393  //float m1dr = m1.recHit().globalPositionError().rerr(m1.recHit().globalPosition());
394  float m1dr = sqrt(m1.recHit()->localPositionError().yy());
396  // LogDebug("OutInConversionSeedFinder") << "second hit forward dr " << dr << " this hit " << m1dr << endl;
398  }
399 
400  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::completeSeed ilayer " << ilayer << "\n";
401 
402  // Get the measurements consistent with the FTS and the Estimator
403  TSOS tsos(fts, layer->surface());
404  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::completeSeed propagationDirection "
405  << int(propagator->propagationDirection()) << "\n";
406  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::completeSeed pointer to estimator "
407  << newEstimator << "\n";
408 
409  LayerMeasurements theLayerMeasurements_(*this->getMeasurementTracker(), *theTrackerData_);
410  std::vector<TrajectoryMeasurement> measurements =
411  theLayerMeasurements_.measurements(*layer, tsos, *propagator, *newEstimator);
412  //std::cout << "OutInConversionSeedFinder::completeSeed Found " << measurements.size() << " second hits " << "\n";
413  delete newEstimator;
414 
415  for (unsigned int i = 0; i < measurements.size(); ++i) {
416  if (measurements[i].recHit()->isValid()) {
417  createSeed(m1, measurements[i]);
418  }
419  }
420 
421  //LogDebug("OutInConversionSeedFinder") << "COMPLETED " << theSeeds_.size() << " SEEDS " << "\n";
422 }
std::vector< const DetLayer * > theLayerList_
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
T sqrt(T t)
Definition: SSEVec.h:19
void createSeed(const TrajectoryMeasurement &m1, const TrajectoryMeasurement &m2)
const MeasurementTracker * getMeasurementTracker() const
edm::Handle< MeasurementTrackerEvent > theTrackerData_
#define LogDebug(id)

◆ createSeed()

void OutInConversionSeedFinder::createSeed ( const TrajectoryMeasurement m1,
const TrajectoryMeasurement m2 
)
private

Definition at line 424 of file OutInConversionSeedFinder.cc.

References createSeedFTS(), PV3DBase< T, PVType, FrameType >::eta(), TrajectoryStateOnSurface::freeTrajectoryState(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), LogDebug, callgraph::m2, 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(), ConversionSeedFinder::thePropagatorOppositeToMomentum_, ConversionSeedFinder::theSeeds_, ConversionSeedFinder::theUpdator_, and KFUpdator::update().

Referenced by completeSeed().

424  {
425  //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";
426 
428 
429  //std::cout << "OutInConversionSeedFinder::createSeed First point errors " <<m1.recHit()->parametersError() << "\n";
430  // std::cout << "original cluster FTS " << fts <<"\n";
431  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::createSeed First point errors "
432  << m1.recHit()->parametersError() << "\n";
433  LogDebug("OutInConversionSeedFinder") << "original cluster FTS " << fts << "\n";
434 
435  //std::cout << "OutInConversionSeedFinder::createSeed propagation dir " << int( thePropagatorOppositeToMomentum_->propagationDirection() ) << "\n";
436  TrajectoryStateOnSurface state1 = thePropagatorOppositeToMomentum_->propagate(fts, m1.recHit()->det()->surface());
437 
438  // LogDebug("OutInConversionSeedFinder") << "hit surface " << h1.det().surface().position() << endl;
439  // LogDebug("OutInConversionSeedFinder") << "prop to " << typeid(h1.det().surface()).name() << endl;
440  // LogDebug("OutInConversionSeedFinder") << "prop to first hit " << state1 << endl;
441  // LogDebug("OutInConversionSeedFinder") << "update to " << h1.globalPosition() << endl;
442 
443  if (state1.isValid()) {
444  TrajectoryStateOnSurface updatedState1 = theUpdator_.update(state1, *m1.recHit());
445 
446  if (updatedState1.isValid()) {
448  *updatedState1.freeTrajectoryState(), m2.recHit()->det()->surface());
449 
450  if (state2.isValid()) {
451  TrajectoryStateOnSurface updatedState2 = theUpdator_.update(state2, *m2.recHit());
452  TrajectoryMeasurement meas1(state1, updatedState1, m1.recHit(), m1.estimate(), m1.layer());
453  TrajectoryMeasurement meas2(state2, updatedState2, m2.recHit(), m2.estimate(), m2.layer());
454 
456  myHits.push_back(meas1.recHit()->hit()->clone());
457  myHits.push_back(meas2.recHit()->hit()->clone());
458 
460  return;
461 
462  PTrajectoryStateOnDet ptsod =
463  trajectoryStateTransform::persistentState(state2, meas2.recHit()->hit()->geographicalId().rawId());
464 
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 "
469  << ptsod.parameters().position().perp() << " phi " << ptsod.parameters().position().phi() << " eta "
470  << ptsod.parameters().position().eta() << "\n";
471 
472  theSeeds_.push_back(TrajectorySeed(ptsod, myHits, oppositeToMomentum));
473  nSeedsPerBC_++;
474  }
475  }
476  }
477 }
T perp() const
Definition: PV3DBase.h:69
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
T eta() const
Definition: PV3DBase.h:73
FreeTrajectoryState createSeedFTS(const TrajectoryMeasurement &m1, const TrajectoryMeasurement &m2) const
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
TrajectorySeedCollection theSeeds_
const Propagator * thePropagatorOppositeToMomentum_
void push_back(D *&d)
Definition: OwnVector.h:326
GlobalPoint globalPosition() const
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
Definition: KFUpdator.cc:177
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
const LocalTrajectoryParameters & parameters() const
LocalPoint position() const
Local x and y position coordinates.
#define LogDebug(id)

◆ createSeedFTS()

FreeTrajectoryState OutInConversionSeedFinder::createSeedFTS ( const TrajectoryMeasurement m1,
const TrajectoryMeasurement m2 
) const
private

Definition at line 479 of file OutInConversionSeedFinder.cc.

References alpha, ALCARECOTkAlJpsiMuMu_cff::charge, funct::cos(), fixPointRadius(), runTauDisplay::gp, MagneticField::inTesla(), visualization-live-secondInstance_cfg::m, callgraph::m2, PV3DBase< T, PVType, FrameType >::perp(), phi, PV3DBase< T, PVType, FrameType >::phi(), DiDispStaMuonMonitor_cfi::pt, funct::sin(), ConversionSeedFinder::theMF_, ConversionSeedFinder::theSCenergy_, ConversionSeedFinder::theSCPosition_, PV3DBase< T, PVType, FrameType >::theta(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by createSeed().

480  {
481  GlobalPoint xmeas = fixPointRadius(m1);
482  GlobalPoint xvert = fixPointRadius(m2);
483 
484  float pt = theSCenergy_ * sin(theSCPosition_.theta());
485  float pz = theSCenergy_ * cos(theSCPosition_.theta());
486 
487  // doesn't work at all for endcap, where r is badly measured
488  //float dphidr = (p1.phi()-p2.phi())/(p1.perp()-p2.perp());
489  //int charge = (dphidr > 0.) ? -1 : 1;
490  int charge = m2.predictedState().charge();
491 
492  double BInTesla = theMF_->inTesla(xmeas).z();
493  GlobalVector xdiff = xmeas - xvert;
494 
495  double phi = xdiff.phi();
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;
504  GlobalVector pNew(pxNew, pyNew, pz);
505 
506  GlobalTrajectoryParameters gp(xmeas, pNew, charge, &(*theMF_));
507 
509  m(0, 0) = 0.05;
510  m(1, 1) = 0.02;
511  m(2, 2) = 0.007;
512  m(3, 3) = 10.;
513  m(4, 4) = 10.;
514  //std::cout << "OutInConversionSeedFinder::createSeedFTS " << FreeTrajectoryState(gp, CurvilinearTrajectoryError(m)) << "\n";
516 }
float alpha
Definition: AMPTWrapper.h:105
T perp() const
Definition: PV3DBase.h:69
T z() const
Definition: PV3DBase.h:61
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
GlobalPoint fixPointRadius(const TrajectoryMeasurement &) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
edm::ESHandle< MagneticField > theMF_
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72

◆ fillClusterSeeds()

void OutInConversionSeedFinder::fillClusterSeeds ( const reco::CaloClusterPtr bc)
private

negative charge state

positive charge state

Definition at line 171 of file OutInConversionSeedFinder.cc.

References makeTrackState(), startSeed(), and theFirstMeasurements_.

Referenced by makeSeeds().

171  {
172  theFirstMeasurements_.clear();
173 
175  auto const stateNeg = makeTrackState(-1);
176  if (stateNeg.second) {
177  startSeed(stateNeg.first);
178  }
180 
181  auto const statePos = makeTrackState(1);
182  if (statePos.second) {
183  startSeed(statePos.first);
184  }
185  theFirstMeasurements_.clear();
186 }
void startSeed(const FreeTrajectoryState &)
std::pair< FreeTrajectoryState, bool > makeTrackState(int charge) const
std::vector< TrajectoryMeasurement > theFirstMeasurements_

◆ fixPointRadius()

GlobalPoint OutInConversionSeedFinder::fixPointRadius ( const TrajectoryMeasurement m1) const
private

Definition at line 518 of file OutInConversionSeedFinder.cc.

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

Referenced by createSeedFTS().

518  {
519  GlobalPoint p1 = m1.recHit()->globalPosition();
520  GlobalPoint p2;
521  if (m1.layer()->location() == GeomDetEnumerators::barrel) {
522  p2 = p1;
523  } else {
524  float z = p1.z();
525  float phi = p1.phi();
526  float theta = theSCPosition_.theta();
527  float r = p1.z() * tan(theta);
528  p2 = GlobalPoint(r * cos(phi), r * sin(phi), z);
529  // LogDebug("OutInConversionSeedFinder") << "fixing point radius " << p2 << " from " << p1 << endl;
530  }
531  return p2;
532 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Geom::Theta< T > theta() const
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72

◆ makeEstimator()

MeasurementEstimator * OutInConversionSeedFinder::makeEstimator ( const DetLayer layer,
float  dphi 
) const
private

Definition at line 341 of file OutInConversionSeedFinder.cc.

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

Referenced by startSeed().

341  {
342  //std::cout << "OutInConversionSeedFinder::makeEstimator " << "\n";
343 
344  MeasurementEstimator* newEstimator = nullptr;
345 
346  if (layer->location() == GeomDetEnumerators::barrel) {
347  const BarrelDetLayer* barrelLayer = dynamic_cast<const BarrelDetLayer*>(layer);
348  LogDebug("OutInConversionSeedFinder")
349  << "OutInConversionSeedFinder::makeEstimator Barrel r = " << barrelLayer->specificSurface().radius() << " "
350  << "\n";
351  float r = barrelLayer->specificSurface().radius();
352  float zrange = 15. * (1. - r / theBCPosition_.perp());
353  newEstimator = new ConversionBarrelEstimator(-dphi, dphi, -zrange, zrange);
354  }
355 
356  if (layer->location() == GeomDetEnumerators::endcap) {
357  const ForwardDetLayer* forwardLayer = dynamic_cast<const ForwardDetLayer*>(layer);
358  LogDebug("OutInConversionSeedFinder")
359  << "OutInConversionSeedFinder::makeEstimator Endcap r = " << forwardLayer->specificSurface().innerRadius()
360  << " R " << forwardLayer->specificSurface().outerRadius() << " Z "
361  << forwardLayer->specificSurface().position().z() << "\n";
362 
363  float zc = fabs(theBCPosition_.z());
364  float z = fabs(forwardLayer->surface().position().z());
365 
366  float rrange = 15. * theBCPosition_.perp() * (zc - z) / (zc * zc - 15. * zc);
367  newEstimator = new ConversionForwardEstimator(-dphi, dphi, rrange);
368  }
369 
370  return newEstimator;
371 }
T perp() const
Definition: PV3DBase.h:69
const BoundSurface & surface() const final
The surface of the GeometricSearchDet.
T z() const
Definition: PV3DBase.h:61
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
const PositionType & position() const
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
virtual const BoundDisk & specificSurface() const final
#define LogDebug(id)

◆ makeSeeds() [1/2]

void OutInConversionSeedFinder::makeSeeds ( const edm::Handle< edm::View< reco::CaloCluster > > &  allBc)
overridevirtual

Implements ConversionSeedFinder.

Definition at line 54 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_.

Referenced by ConversionTrackCandidateProducer::buildCollections().

54  {
55  theSeeds_.clear();
56 
57  // std::cout << " OutInConversionSeedFinder::makeSeeds() " << "\n";
58 
59  // debug
60  // std::cout << " OutInConversionSeedFinder::makeSeeds() SC position " << theSCPosition_.x() << " " << theSCPosition_.y() << " " << theSCPosition_.z() << "\n";
61  // std::cout << " SC eta " << theSCPosition_.eta() << " SC phi " << theSCPosition_.phi() << "\n";
62  // std::cout << " OutInConversionSeedFinder::makeSeeds() SC energy " << theSCenergy_ << "\n";
63  //
64 
65  findLayers();
66 
67  // std::cout << " Check Calo cluster collection size " << allBC->size() << "\n";
68 
69  float theSCPhi = theSCPosition_.phi();
70  float theSCEta = theSCPosition_.eta();
71 
72  // Loop over the Calo Clusters in the event looking for seeds
73  LogDebug("OutInConversionSeedFinder") << " OutInConversionSeedFinder::makeSeeds() All BC in the event "
74  << "\n";
75  for (unsigned i = 0; i < allBC->size(); ++i) {
76  nSeedsPerBC_ = 0;
77 
78  const reco::CaloCluster& theBC = allBC->at(i);
79  const math::XYZPoint& rawBCpos = theBC.position();
80 
81  theBCPosition_ = GlobalPoint(rawBCpos.x(), rawBCpos.y(), rawBCpos.z());
82  float theBcEta = theBCPosition_.eta();
83  float theBcPhi = theBCPosition_.phi();
84  // float dPhi= theBcPhi-theSCPhi;
85  theBCEnergy_ = theBC.energy();
86 
87  float EtOrECut = bcEcut_;
88  if (useEtCut_) {
89  theBCEnergy_ = ptFast(theBCEnergy_, rawBCpos, math::XYZPoint(0, 0, 0));
90  EtOrECut = bcEtcut_;
91  }
92 
93  if (theBCEnergy_ < EtOrECut)
94  continue;
95  // std::cout << " OutInConversionSeedFinder::makeSeeds() BC eta " << theBcEta << " phi " << theBcPhi << " BC transverse energy " << theBCEnergy_ << " dPhi " << fabs(theBcPhi-theSCPhi) << " dEta " << fabs(theBcEta-theSCEta) << "\n";
96 
97  LogDebug("OutInConversionSeedFinder")
98  << " OutInConversionSeedFinder::makeSeeds() Passing the >=1.5 GeV cut BC eta " << theBcEta << " phi "
99  << theBcPhi << " BC energy " << theBCEnergy_ << "\n";
100 
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 "
104  << "\n";
105  fillClusterSeeds(allBC->ptrAt(i));
106  }
107  }
108 
109  // std::cout << "Built vector of seeds of size " << theSeeds_.size() << "\n" ;
110 
112  /*
113  int nSeed=0;
114  for ( std::vector<TrajectorySeed>::const_iterator iSeed= theSeeds_.begin(); iSeed != theSeeds_.end(); ++iSeed) {
115  nSeed++;
116  PTrajectoryStateOnDet ptsod=iSeed->startingState();
117  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" ;
118 
119 
120  DetId tmpId = DetId( iSeed->startingState().detId());
121  const GeomDet* tmpDet = this->getMeasurementTracker()->geomTracker()->idToDet( tmpId );
122  GlobalVector gv = tmpDet->surface().toGlobal( iSeed->startingState().parameters().momentum() );
123 
124  LogDebug("OutInConversionSeedFinder") << "seed perp,phi,eta : "
125  << gv.perp() << " , "
126  << gv.phi() << " , "
127  << gv.eta() << "\n" ; ;
128 
129 
130 
131 
132  TrajectorySeed::range hitRange = iSeed->recHits();
133  for (TrajectorySeed::const_iterator ihit = hitRange.first; ihit != hitRange.second; ihit++) {
134 
135  if ( ihit->isValid() ) {
136 
137  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" ;
138 
139  }
140  }
141  }
142 
143  */
144 }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:154
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
T eta() const
Definition: PV3DBase.h:73
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:149
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
#define LogDebug(id)

◆ makeSeeds() [2/2]

void OutInConversionSeedFinder::makeSeeds ( const reco::CaloClusterPtr aBC)
virtual

Definition at line 146 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_.

146  {
147  theSeeds_.clear();
148 
149  findLayers();
150 
151  float theSCPhi = theSCPosition_.phi();
152  float theSCEta = theSCPosition_.eta();
153 
154  nSeedsPerBC_ = 0;
155 
156  // theBCEnergy_=aBC->energy();
157  theBCEnergy_ = ptFast(aBC->energy(), aBC->position(), math::XYZPoint(0, 0, 0));
158  theBCPosition_ = GlobalPoint(aBC->position().x(), aBC->position().y(), aBC->position().z());
159  float theBcEta = theBCPosition_.eta();
160  float theBcPhi = theBCPosition_.phi();
161  // float dPhi= theBcPhi-theSCPhi;
162 
163  if (theBCEnergy_ < bcEtcut_)
164  return;
165 
166  if (fabs(theBcEta - theSCEta) < 0.015 && fabs(theBcPhi - theSCPhi) < 0.25) {
167  fillClusterSeeds(aBC);
168  }
169 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
T eta() const
Definition: PV3DBase.h:73
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

◆ makeTrackState()

std::pair< FreeTrajectoryState, bool > OutInConversionSeedFinder::makeTrackState ( int  charge) const
private

Definition at line 188 of file OutInConversionSeedFinder.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, PixelRecoUtilities::curvature(), ztail::d, MagneticField::inTesla(), LogDebug, visualization-live-secondInstance_cfg::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().

188  {
189  std::pair<FreeTrajectoryState, bool> result;
190  result.second = false;
191 
192  //std::cout << " OutInConversionSeedFinder:makeTrackState " << "\n";
193 
194  // Old GlobalPoint gpOrigine(theBCPosition_.x()*0.3, theBCPosition_.y()*0.3, theBCPosition_.z()*0.3) ;
195  // GlobalPoint gpOrigine(0.,0.,0.);
196 
198  GlobalVector gvBcRadius = theBCPosition_ - gpOrigine;
199  HepGeom::Point3D<double> radiusBc(gvBcRadius.x(), gvBcRadius.y(), gvBcRadius.z());
200  HepGeom::Point3D<double> momentumWithoutCurvature = radiusBc.unit() * theBCEnergy_;
201 
202  // compute momentum direction at calo
203  double curvature = theMF_->inTesla(theBCPosition_).z() * c_light * 1.e-3 / momentumWithoutCurvature.perp();
204  curvature /= 100.; // in cm-1 !!
205  if (curvature == 0)
206  return result;
207 
208  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState gpOrigine " << gpOrigine.x()
209  << " " << gpOrigine.y() << " " << gpOrigine.z() << " momentumWithoutCurvature "
210  << momentumWithoutCurvature.mag() << " curvature " << curvature << "\n";
211 
212  // define rotation angle
213  float R = theBCPosition_.perp();
214  float r = gpOrigine.perp();
215  float rho = 1. / curvature;
216  // from the formula for the intersection of two circles
217  // turns out to be about 2/3 of the deflection of the old formula
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));
221  //float u = rho + rho/d/d*(R*R-rho*rho) ;
222  if (u <= R)
223  result.second = true;
224  else
225  return result;
226 
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);
232 
233  double newdphi = charge * asin(sinAlpha);
234 
235  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState charge " << charge << " R " << R
236  << " u/R " << u / R << " asin(0.5*u/R) " << asin(sinAlpha) << "\n";
237 
238  HepGeom::Transform3D rotation = HepGeom::Rotate3D(newdphi, HepGeom::Vector3D<double>(0., 0., 1.));
239 
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";
244 
245  HepGeom::Point3D<double> hepStartingPoint(gpOrigine.x(), gpOrigine.y(), gpOrigine.z());
246 
247  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState hepStartingPoint "
248  << hepStartingPoint << "\n";
249 
250  hepStartingPoint.transform(rotation);
251 
252  GlobalPoint startingPoint(hepStartingPoint.x(), hepStartingPoint.y(), hepStartingPoint.z());
253 
254  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState startingPoint " << startingPoint
255  << " calo position " << theBCPosition_ << "\n";
256  GlobalVector gvTracker(momentumInTracker.x(), momentumInTracker.y(), momentumInTracker.z());
257  GlobalTrajectoryParameters gtp(startingPoint, gvTracker, charge, &(*theMF_));
258  // error matrix
260  m(0, 0) = 0.1;
261  m(1, 1) = 0.1;
262  m(2, 2) = 0.1;
263  m(3, 3) = 0.1;
264  m(4, 4) = 0.1;
265 
266  // std::cout << "OutInConversionSeedFinder::makeTrackState " << FreeTrajectoryState(gtp, CurvilinearTrajectoryError(m) ) << "\n";
267 
269  return result;
270 }
T perp() const
Definition: PV3DBase.h:69
const Point & position() const
position
Definition: BeamSpot.h:59
T z() const
Definition: PV3DBase.h:61
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
T curvature(T InversePt, const MagneticField &field)
T sqrt(T t)
Definition: SSEVec.h:19
d
Definition: ztail.py:151
edm::ESHandle< MagneticField > theMF_
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
#define LogDebug(id)

◆ startSeed()

void OutInConversionSeedFinder::startSeed ( const FreeTrajectoryState fts)
private

Definition at line 272 of file OutInConversionSeedFinder.cc.

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

Referenced by fillClusterSeeds().

272  {
273  // std::cout << "OutInConversionSeedFinder::startSeed layer list " << this->layerList().size() << "\n";
274  //std::cout << "OutInConversionSeedFinder::startSeed fts " << fts << "\n";
275 
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) {
279  const DetLayer* layer = myLayers[ilayer];
280 
281  // allow the z of the hit to be within a straight line from a vertex
282  // of +-15 cm to the cluster
283  // float dphi = 0.015;
284  float dphi = 0.030;
285 
286  MeasurementEstimator* newEstimator = makeEstimator(layer, dphi);
287 
288  //std::cout << "OutInSeedFinder::startSeed propagationDirection " << int(thePropagatorAlongMomentum_->propagationDirection() ) << "\n";
289 
290  TSOS tsos(fts, layer->surface());
291 
292  LogDebug("OutInConversionSeedFinder") << "OutInSeedFinder::startSeed after TSOS tsos(fts, layer->surface() ) "
293  << "\n";
294 
295  LayerMeasurements theLayerMeasurements_(*this->getMeasurementTracker(), *theTrackerData_);
297  theLayerMeasurements_.measurements(*layer, tsos, *thePropagatorAlongMomentum_, *newEstimator);
298 
299  //std::cout << "OutInSeedFinder::startSeed after theFirstMeasurements_ " << theFirstMeasurements_.size() << "\n";
300 
301  if (theFirstMeasurements_.size() > 1) // always a dummy returned, too
302  LogDebug("OutInConversionSeedFinder") << " Found " << theFirstMeasurements_.size() - 1 << " 1st hits in seed"
303  << "\n";
304 
305  delete newEstimator;
306 
307  LogDebug("OutInConversionSeedFinder") << "OutInSeedFinder::startSeed Layer " << ilayer
308  << " theFirstMeasurements_.size " << theFirstMeasurements_.size() << "\n";
309 
310  for (unsigned int i = 0; i < theFirstMeasurements_.size(); ++i) {
312  if (m1.recHit()->isValid()) {
313  // update the fts to start from this point. much better than starting from
314  // extrapolated point along the line
315  GlobalPoint hitPoint = m1.recHit()->globalPosition();
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";
320 
321  FreeTrajectoryState newfts = trackStateFromClusters(fts.charge(), hitPoint, alongMomentum, 0.8);
322  //std::cout << "OutInConversionSeedFinder::startSeed newfts " << newfts << "\n";
323  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::startSeed newfts " << newfts << "\n";
324  LogDebug("OutInConversionSeedFinder")
325  << "OutInConversionSeedFinder::startSeed propagationDirection after switching "
327  // std::cout << "OutInConversionSeedFinder::startSeed propagationDirection after switching " << int(thePropagatorOppositeToMomentum_->propagationDirection() ) << "\n";
328 
329  completeSeed(m1, newfts, thePropagatorOppositeToMomentum_, ilayer - 1);
330  // skip a layer, if you haven't already skipped the first layer
331  if (ilayer == myLayers.size() - 1) {
332  completeSeed(m1, newfts, thePropagatorOppositeToMomentum_, ilayer - 2);
333  }
334  }
335  }
336 
337  } // loop over layers
338  }
339 }
const Propagator * thePropagatorAlongMomentum_
MeasurementEstimator * makeEstimator(const DetLayer *, float dphi) const
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
const Propagator * thePropagatorOppositeToMomentum_
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
TrackCharge charge() const
std::vector< const DetLayer * > const & layerList() const
const MeasurementTracker * getMeasurementTracker() const
void completeSeed(const TrajectoryMeasurement &m1, const FreeTrajectoryState &fts, const Propagator *, int layer)
edm::Handle< MeasurementTrackerEvent > theTrackerData_
std::vector< TrajectoryMeasurement > theFirstMeasurements_
FreeTrajectoryState trackStateFromClusters(int aCharge, const GlobalPoint &gpOrigine, PropagationDirection dir, float scaleFactor) const
#define LogDebug(id)

Member Data Documentation

◆ bcEcut_

float OutInConversionSeedFinder::bcEcut_
private

Definition at line 64 of file OutInConversionSeedFinder.h.

Referenced by makeSeeds(), and OutInConversionSeedFinder().

◆ bcEtcut_

float OutInConversionSeedFinder::bcEtcut_
private

Definition at line 63 of file OutInConversionSeedFinder.h.

Referenced by makeSeeds(), and OutInConversionSeedFinder().

◆ conf_

edm::ParameterSet OutInConversionSeedFinder::conf_
private

Definition at line 43 of file OutInConversionSeedFinder.h.

Referenced by OutInConversionSeedFinder().

◆ maxNumberOfOutInSeedsPerBC_

int OutInConversionSeedFinder::maxNumberOfOutInSeedsPerBC_
private

Definition at line 62 of file OutInConversionSeedFinder.h.

Referenced by createSeed(), and OutInConversionSeedFinder().

◆ nSeedsPerBC_

int OutInConversionSeedFinder::nSeedsPerBC_
private

Definition at line 61 of file OutInConversionSeedFinder.h.

Referenced by createSeed(), and makeSeeds().

◆ the2ndHitdphi_

float OutInConversionSeedFinder::the2ndHitdphi_
private

Definition at line 57 of file OutInConversionSeedFinder.h.

Referenced by completeSeed(), and OutInConversionSeedFinder().

◆ the2ndHitdzConst_

float OutInConversionSeedFinder::the2ndHitdzConst_
private

Definition at line 58 of file OutInConversionSeedFinder.h.

Referenced by completeSeed(), and OutInConversionSeedFinder().

◆ the2ndHitdznSigma_

float OutInConversionSeedFinder::the2ndHitdznSigma_
private

Definition at line 59 of file OutInConversionSeedFinder.h.

Referenced by completeSeed(), and OutInConversionSeedFinder().

◆ theFirstMeasurements_

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

Definition at line 60 of file OutInConversionSeedFinder.h.

Referenced by fillClusterSeeds(), and startSeed().

◆ useEtCut_

bool OutInConversionSeedFinder::useEtCut_
private

Definition at line 65 of file OutInConversionSeedFinder.h.

Referenced by makeSeeds(), and OutInConversionSeedFinder().