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 29 of file OutInConversionSeedFinder.h.

Member Typedef Documentation

Definition at line 31 of file OutInConversionSeedFinder.h.

Definition at line 32 of file OutInConversionSeedFinder.h.

Constructor & Destructor Documentation

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 }
#define LogDebug(id)
T getParameter(std::string const &) const
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

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

Definition at line 370 of file OutInConversionSeedFinder.cc.

References GeomDetEnumerators::barrel, createSeed(), flavorHistoryFilter_cfi::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().

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

Definition at line 421 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().

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

References zMuMuMuonUserData::alpha, ALCARECOTkAlJpsiMuMu_cff::charge, TrajectoryStateOnSurface::charge(), funct::cos(), fixPointRadius(), runTauDisplay::gp, MagneticField::inTesla(), visualization-live-secondInstance_cfg::m, PV3DBase< T, PVType, FrameType >::perp(), phi, PV3DBase< T, PVType, FrameType >::phi(), TrajectoryMeasurement::predictedState(), 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().

477  {
478  GlobalPoint xmeas = fixPointRadius(m1);
479  GlobalPoint xvert = fixPointRadius(m2);
480 
481  float pt = theSCenergy_ * sin(theSCPosition_.theta());
482  float pz = theSCenergy_ * cos(theSCPosition_.theta());
483 
484  // doesn't work at all for endcap, where r is badly measured
485  //float dphidr = (p1.phi()-p2.phi())/(p1.perp()-p2.perp());
486  //int charge = (dphidr > 0.) ? -1 : 1;
487  int charge = m2.predictedState().charge();
488 
489  double BInTesla = theMF_->inTesla(xmeas).z();
490  GlobalVector xdiff = xmeas - xvert;
491 
492  double phi = xdiff.phi();
493  double pxOld = pt * cos(phi);
494  double pyOld = pt * sin(phi);
495  double RadCurv = 100 * pt / (BInTesla * 0.29979);
496  double alpha = asin(0.5 * xdiff.perp() / RadCurv);
497  float ca = cos(charge * alpha);
498  float sa = sin(charge * alpha);
499  double pxNew = ca * pxOld + sa * pyOld;
500  double pyNew = -sa * pxOld + ca * pyOld;
501  GlobalVector pNew(pxNew, pyNew, pz);
502 
503  GlobalTrajectoryParameters gp(xmeas, pNew, charge, &(*theMF_));
504 
506  m(0, 0) = 0.05;
507  m(1, 1) = 0.02;
508  m(2, 2) = 0.007;
509  m(3, 3) = 10.;
510  m(4, 4) = 10.;
511  //std::cout << "OutInConversionSeedFinder::createSeedFTS " << FreeTrajectoryState(gp, CurvilinearTrajectoryError(m)) << "\n";
513 }
TrajectoryStateOnSurface const & predictedState() const
T perp() const
Definition: PV3DBase.h:69
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
GlobalPoint fixPointRadius(const TrajectoryMeasurement &) const
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
T z() const
Definition: PV3DBase.h:61
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_
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
alpha
zGenParticlesMatch = cms.InputTag(""),
void OutInConversionSeedFinder::fillClusterSeeds ( const reco::CaloClusterPtr bc)
private

negative charge state

positive charge state

Definition at line 171 of file OutInConversionSeedFinder.cc.

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

Referenced by makeSeeds().

171  {
172  theFirstMeasurements_.clear();
174 
176  if (makeTrackState(-1).second) {
177  fts = makeTrackState(-1).first;
178  startSeed(fts);
179  }
181 
182  if (makeTrackState(1).second) {
183  fts = makeTrackState(1).first;
184  startSeed(fts);
185  }
186  theFirstMeasurements_.clear();
187 }
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 515 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().

515  {
516  GlobalPoint p1 = m1.recHit()->globalPosition();
517  GlobalPoint p2;
518  if (m1.layer()->location() == GeomDetEnumerators::barrel) {
519  p2 = p1;
520  } else {
521  float z = p1.z();
522  float phi = p1.phi();
523  float theta = theSCPosition_.theta();
524  float r = p1.z() * tan(theta);
525  p2 = GlobalPoint(r * cos(phi), r * sin(phi), z);
526  // LogDebug("OutInConversionSeedFinder") << "fixing point radius " << p2 << " from " << p1 << endl;
527  }
528  return p2;
529 }
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:66
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Geom::Theta< T > theta() const
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
T z() const
Definition: PV3DBase.h:61
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 338 of file OutInConversionSeedFinder.cc.

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

Referenced by startSeed().

338  {
339  //std::cout << "OutInConversionSeedFinder::makeEstimator " << "\n";
340 
341  MeasurementEstimator* newEstimator = nullptr;
342 
343  if (layer->location() == GeomDetEnumerators::barrel) {
344  const BarrelDetLayer* barrelLayer = dynamic_cast<const BarrelDetLayer*>(layer);
345  LogDebug("OutInConversionSeedFinder")
346  << "OutInConversionSeedFinder::makeEstimator Barrel r = " << barrelLayer->specificSurface().radius() << " "
347  << "\n";
348  float r = barrelLayer->specificSurface().radius();
349  float zrange = 15. * (1. - r / theBCPosition_.perp());
350  newEstimator = new ConversionBarrelEstimator(-dphi, dphi, -zrange, zrange);
351  }
352 
353  if (layer->location() == GeomDetEnumerators::endcap) {
354  const ForwardDetLayer* forwardLayer = dynamic_cast<const ForwardDetLayer*>(layer);
355  LogDebug("OutInConversionSeedFinder")
356  << "OutInConversionSeedFinder::makeEstimator Endcap r = " << forwardLayer->specificSurface().innerRadius()
357  << " R " << forwardLayer->specificSurface().outerRadius() << " Z "
358  << forwardLayer->specificSurface().position().z() << "\n";
359 
360  float zc = fabs(theBCPosition_.z());
361  float z = fabs(forwardLayer->surface().position().z());
362 
363  float rrange = 15. * theBCPosition_.perp() * (zc - z) / (zc * zc - 15. * zc);
364  newEstimator = new ConversionForwardEstimator(-dphi, dphi, rrange);
365  }
366 
367  return newEstimator;
368 }
#define LogDebug(id)
T perp() const
Definition: PV3DBase.h:69
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:61
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 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_.

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 }
#define LogDebug(id)
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:153
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
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:148
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
T eta() const
Definition: PV3DBase.h:73
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
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:73
std::pair< FreeTrajectoryState, bool > OutInConversionSeedFinder::makeTrackState ( int  charge) const
private

Definition at line 189 of file OutInConversionSeedFinder.cc.

References 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().

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

Definition at line 269 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().

269  {
270  // std::cout << "OutInConversionSeedFinder::startSeed layer list " << this->layerList().size() << "\n";
271  //std::cout << "OutInConversionSeedFinder::startSeed fts " << fts << "\n";
272 
273  std::vector<const DetLayer*> myLayers = layerList();
274  if (myLayers.size() > 3) {
275  for (unsigned int ilayer = myLayers.size() - 1; ilayer >= myLayers.size() - 2; --ilayer) {
276  const DetLayer* layer = myLayers[ilayer];
277 
278  // allow the z of the hit to be within a straight line from a vertex
279  // of +-15 cm to the cluster
280  // float dphi = 0.015;
281  float dphi = 0.030;
282 
283  MeasurementEstimator* newEstimator = makeEstimator(layer, dphi);
284 
285  //std::cout << "OutInSeedFinder::startSeed propagationDirection " << int(thePropagatorAlongMomentum_->propagationDirection() ) << "\n";
286 
287  TSOS tsos(fts, layer->surface());
288 
289  LogDebug("OutInConversionSeedFinder") << "OutInSeedFinder::startSeed after TSOS tsos(fts, layer->surface() ) "
290  << "\n";
291 
292  LayerMeasurements theLayerMeasurements_(*this->getMeasurementTracker(), *theTrackerData_);
294  theLayerMeasurements_.measurements(*layer, tsos, *thePropagatorAlongMomentum_, *newEstimator);
295 
296  //std::cout << "OutInSeedFinder::startSeed after theFirstMeasurements_ " << theFirstMeasurements_.size() << "\n";
297 
298  if (theFirstMeasurements_.size() > 1) // always a dummy returned, too
299  LogDebug("OutInConversionSeedFinder") << " Found " << theFirstMeasurements_.size() - 1 << " 1st hits in seed"
300  << "\n";
301 
302  delete newEstimator;
303 
304  LogDebug("OutInConversionSeedFinder") << "OutInSeedFinder::startSeed Layer " << ilayer
305  << " theFirstMeasurements_.size " << theFirstMeasurements_.size() << "\n";
306 
307  for (unsigned int i = 0; i < theFirstMeasurements_.size(); ++i) {
309  if (m1.recHit()->isValid()) {
310  // update the fts to start from this point. much better than starting from
311  // extrapolated point along the line
312  GlobalPoint hitPoint = m1.recHit()->globalPosition();
313  LogDebug("OutInConversionSeedFinder")
314  << " Valid hit at R " << m1.recHit()->globalPosition().perp() << " Z "
315  << m1.recHit()->globalPosition().z() << " eta " << m1.recHit()->globalPosition().eta() << " phi "
316  << m1.recHit()->globalPosition().phi() << " xyz " << m1.recHit()->globalPosition() << "\n";
317 
318  FreeTrajectoryState newfts = trackStateFromClusters(fts.charge(), hitPoint, alongMomentum, 0.8);
319  //std::cout << "OutInConversionSeedFinder::startSeed newfts " << newfts << "\n";
320  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::startSeed newfts " << newfts << "\n";
321  LogDebug("OutInConversionSeedFinder")
322  << "OutInConversionSeedFinder::startSeed propagationDirection after switching "
324  // std::cout << "OutInConversionSeedFinder::startSeed propagationDirection after switching " << int(thePropagatorOppositeToMomentum_->propagationDirection() ) << "\n";
325 
326  completeSeed(m1, newfts, thePropagatorOppositeToMomentum_, ilayer - 1);
327  // skip a layer, if you haven't already skipped the first layer
328  if (ilayer == myLayers.size() - 1) {
329  completeSeed(m1, newfts, thePropagatorOppositeToMomentum_, ilayer - 2);
330  }
331  }
332  }
333 
334  } // loop over layers
335  }
336 }
#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:139
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 64 of file OutInConversionSeedFinder.h.

Referenced by makeSeeds(), and OutInConversionSeedFinder().

float OutInConversionSeedFinder::bcEtcut_
private

Definition at line 63 of file OutInConversionSeedFinder.h.

Referenced by makeSeeds(), and OutInConversionSeedFinder().

edm::ParameterSet OutInConversionSeedFinder::conf_
private

Definition at line 43 of file OutInConversionSeedFinder.h.

Referenced by OutInConversionSeedFinder().

int OutInConversionSeedFinder::maxNumberOfOutInSeedsPerBC_
private

Definition at line 62 of file OutInConversionSeedFinder.h.

Referenced by createSeed(), and OutInConversionSeedFinder().

int OutInConversionSeedFinder::nSeedsPerBC_
private

Definition at line 61 of file OutInConversionSeedFinder.h.

Referenced by createSeed(), and makeSeeds().

float OutInConversionSeedFinder::the2ndHitdphi_
private

Definition at line 57 of file OutInConversionSeedFinder.h.

Referenced by completeSeed(), and OutInConversionSeedFinder().

float OutInConversionSeedFinder::the2ndHitdzConst_
private

Definition at line 58 of file OutInConversionSeedFinder.h.

Referenced by completeSeed(), and OutInConversionSeedFinder().

float OutInConversionSeedFinder::the2ndHitdznSigma_
private

Definition at line 59 of file OutInConversionSeedFinder.h.

Referenced by completeSeed(), and OutInConversionSeedFinder().

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

Definition at line 60 of file OutInConversionSeedFinder.h.

Referenced by fillClusterSeeds(), and startSeed().

bool OutInConversionSeedFinder::useEtCut_
private

Definition at line 65 of file OutInConversionSeedFinder.h.

Referenced by makeSeeds(), and OutInConversionSeedFinder().