CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual void makeSeeds (const edm::Handle< edm::View< reco::CaloCluster > > &allBc) const
 
virtual void makeSeeds (const reco::CaloClusterPtr &aBC) const
 
 OutInConversionSeedFinder (const edm::ParameterSet &config)
 
virtual ~OutInConversionSeedFinder ()
 
- Public Member Functions inherited from ConversionSeedFinder
void clear ()
 
 ConversionSeedFinder ()
 
 ConversionSeedFinder (const edm::ParameterSet &config)
 
const MeasurementTrackergetMeasurementTracker () const
 
std::vector< const DetLayer * >
const & 
layerList () const
 
TrajectorySeedCollectionseeds ()
 
virtual void setCandidate (float e, GlobalPoint pos) const
 
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
 
virtual ~ConversionSeedFinder ()
 

Private Types

typedef FreeTrajectoryState FTS
 
typedef TrajectoryStateOnSurface TSOS
 

Private Member Functions

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

Private Attributes

edm::ParameterSet conf_
 
int maxNumberOfOutInSeedsPerBC_
 
int nSeedsPerBC_
 
float the2ndHitdphi_
 
float the2ndHitdzConst_
 
float the2ndHitdznSigma_
 
std::vector
< TrajectoryMeasurement
theFirstMeasurements_
 

Additional Inherited Members

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

Detailed Description

Id:
OutInConversionSeedFinder.h,v 1.8 2008/05/08 20:41:27 nancy Exp
Date:
2008/05/08 20:41:27
Revision:
1.8
Author
Nancy Marinelli, U. of Notre Dame, US

Definition at line 34 of file OutInConversionSeedFinder.h.

Member Typedef Documentation

Definition at line 39 of file OutInConversionSeedFinder.h.

Definition at line 40 of file OutInConversionSeedFinder.h.

Constructor & Destructor Documentation

OutInConversionSeedFinder::OutInConversionSeedFinder ( const edm::ParameterSet config)

Definition at line 26 of file OutInConversionSeedFinder.cc.

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

27 {
28 
29  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder CTOR " << "\n";
30 
31  maxNumberOfOutInSeedsPerBC_ = conf_.getParameter<int>("maxNumOfSeedsOutIn");
32  //the2ndHitdphi_ = 0.01;
33  the2ndHitdphi_ = 0.03;
34  the2ndHitdzConst_ = 5.;
35  the2ndHitdznSigma_ = 2.;
36 
37 
38 
39 }
#define LogDebug(id)
T getParameter(std::string const &) const
tuple conf
Definition: dbtoconf.py:185
OutInConversionSeedFinder::~OutInConversionSeedFinder ( )
virtual

Definition at line 44 of file OutInConversionSeedFinder.cc.

References LogDebug.

44  {
45  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder DTOR " << "\n";
46 
47 }
#define LogDebug(id)

Member Function Documentation

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

Definition at line 378 of file OutInConversionSeedFinder.cc.

References GeomDetEnumerators::barrel, createSeed(), ConversionSeedFinder::getMeasurementTracker(), i, DetLayer::location(), LogDebug, LayerMeasurements::measurements(), Propagator::propagationDirection(), TrajectoryMeasurement::recHit(), mathSSE::sqrt(), GeometricSearchDet::surface(), the2ndHitdphi_, the2ndHitdzConst_, the2ndHitdznSigma_, and ConversionSeedFinder::theLayerList_.

Referenced by startSeed().

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

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

434  {
435 
436  //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";
437 
438 
439  FreeTrajectoryState fts = createSeedFTS(m1, m2);
440 
441 
442  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::createSeed First point errors " <<m1.recHit()->parametersError() << "\n";
443  LogDebug("OutInConversionSeedFinder") << "original cluster FTS " << fts <<"\n";
444 
445 
446 
447  //std::cout << "OutInConversionSeedFinder::createSeed propagation dir " << int( thePropagatorOppositeToMomentum_->propagationDirection() ) << "\n";
448  TrajectoryStateOnSurface state1 = thePropagatorOppositeToMomentum_->propagate(fts, m1.recHit()->det()->surface());
449 
450  // LogDebug("OutInConversionSeedFinder") << "hit surface " << h1.det().surface().position() << endl;
451  // LogDebug("OutInConversionSeedFinder") << "prop to " << typeid(h1.det().surface()).name() << endl;
452  // LogDebug("OutInConversionSeedFinder") << "prop to first hit " << state1 << endl;
453  // LogDebug("OutInConversionSeedFinder") << "update to " << h1.globalPosition() << endl;
454 
455  if ( state1.isValid() ) {
456  TrajectoryStateOnSurface updatedState1 = theUpdator_.update(state1, *m1.recHit() );
457 
458  if ( updatedState1.isValid() ) {
459  TrajectoryStateOnSurface state2 = thePropagatorOppositeToMomentum_->propagate(*updatedState1.freeTrajectoryState(), m2.recHit()->det()->surface());
460 
461  if ( state2.isValid() ) {
462 
463  TrajectoryStateOnSurface updatedState2 = theUpdator_.update(state2, *m2.recHit() );
464  TrajectoryMeasurement meas1(state1, updatedState1, m1.recHit() , m1.estimate(), m1.layer());
465  TrajectoryMeasurement meas2(state2, updatedState2, m2.recHit() , m2.estimate(), m2.layer());
466 
468  myHits.push_back(meas1.recHit()->hit()->clone());
469  myHits.push_back(meas2.recHit()->hit()->clone());
470 
471  if ( nSeedsPerBC_ >= maxNumberOfOutInSeedsPerBC_ ) return;
472 
473 
474  PTrajectoryStateOnDet ptsod= trajectoryStateTransform::persistentState(state2, meas2.recHit()->hit()->geographicalId().rawId() );
475 
476  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::createSeed new seed from state " << state2.globalPosition() << "\n";
477  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::createSeed new seed ptsod " << ptsod.parameters().position() << " R "
478  << ptsod.parameters().position().perp() << " phi " << ptsod.parameters().position().phi() << " eta "
479  << ptsod.parameters().position().eta() << "\n";
480 
481 
482 
483  theSeeds_.push_back(TrajectorySeed( ptsod, myHits, oppositeToMomentum ));
484  nSeedsPerBC_++;
485 
486  }
487  }
488  }
489 
490 
491 
492 
493 
494 }
#define LogDebug(id)
T perp() const
Definition: PV3DBase.h:71
LocalPoint position() const
Local x and y position coordinates.
FreeTrajectoryState * freeTrajectoryState(bool withErrors=true) const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
GlobalPoint globalPosition() const
ConstRecHitPointer recHit() const
TrajectorySeedCollection theSeeds_
const Propagator * thePropagatorOppositeToMomentum_
void push_back(D *&d)
Definition: OwnVector.h:273
const DetLayer * layer() const
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:12
T eta() const
Definition: PV3DBase.h:75
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TransientTrackingRecHit &) const
Definition: KFUpdator.cc:10
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 500 of file OutInConversionSeedFinder.cc.

References alpha, DeDxDiscriminatorTools::charge(), TrajectoryStateOnSurface::charge(), funct::cos(), fixPointRadius(), m, PV3DBase< T, PVType, FrameType >::perp(), phi, PV3DBase< T, PVType, FrameType >::phi(), TrajectoryMeasurement::predictedState(), funct::sin(), ConversionSeedFinder::theMF_, ConversionSeedFinder::theSCenergy_, ConversionSeedFinder::theSCPosition_, and PV3DBase< T, PVType, FrameType >::theta().

Referenced by createSeed().

501  {
502 
503  //std::cout << "OutInConversionSeedFinder::createSeedFTS " << "\n";
504 
505  GlobalPoint xmeas = fixPointRadius(m1);
506  GlobalPoint xvert = fixPointRadius(m2);
507 
508 
509  float pt = theSCenergy_ * sin(theSCPosition_.theta());
510  float pz = theSCenergy_ * cos(theSCPosition_.theta());
511 
512 
513 
514  // doesn't work at all for endcap, where r is badly measured
515  //float dphidr = (p1.phi()-p2.phi())/(p1.perp()-p2.perp());
516  //int charge = (dphidr > 0.) ? -1 : 1;
517  int charge = m2.predictedState().charge();
518 
519  double BInTesla = theMF_->inTesla(xmeas).z();
520  GlobalVector xdiff = xmeas -xvert;
521 
522  double phi= xdiff.phi();
523  double pxOld = pt*cos(phi);
524  double pyOld = pt*sin(phi);
525  double RadCurv = 100*pt/(BInTesla*0.29979);
526  double alpha = asin(0.5*xdiff.perp()/RadCurv);
527  float ca = cos(charge*alpha);
528  float sa = sin(charge*alpha);
529  double pxNew = ca*pxOld + sa*pyOld;
530  double pyNew = -sa*pxOld + ca*pyOld;
531  GlobalVector pNew(pxNew, pyNew, pz);
532 
533  GlobalTrajectoryParameters gp(xmeas, pNew, charge, &(*theMF_) );
534 
536  m(0,0) = 0.05; m(1,1) = 0.02 ; m(2,2) = 0.007 ;
537  m(3,3) = 10. ; m(4,4) = 10. ;
539 
540 
541 }
float alpha
Definition: AMPTWrapper.h:95
T perp() const
Definition: PV3DBase.h:71
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
double charge(const std::vector< uint8_t > &Ampls)
GlobalPoint fixPointRadius(const TrajectoryMeasurement &) const
Geom::Theta< T > theta() const
Definition: PV3DBase.h:74
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
TrajectoryStateOnSurface predictedState() const
edm::ESHandle< MagneticField > theMF_
Definition: DDAxes.h:10
void OutInConversionSeedFinder::fillClusterSeeds ( const reco::CaloClusterPtr bc) const
private

negative charge state

positive charge state

Definition at line 173 of file OutInConversionSeedFinder.cc.

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

Referenced by makeSeeds().

173  {
174 
175 
176  theFirstMeasurements_.clear();
177  FreeTrajectoryState fts;
178 
180  if ( makeTrackState(-1).second ) {
181  fts = makeTrackState(-1).first;
182  startSeed(fts);
183  }
185 
186  if ( makeTrackState(1).second ) {
187  fts = makeTrackState(1).first;
188  startSeed(fts);
189  }
190  theFirstMeasurements_.clear();
191 }
std::pair< FreeTrajectoryState, bool > makeTrackState(int charge) const
U second(std::pair< T, U > const &p)
void startSeed(const FreeTrajectoryState &) const
std::vector< TrajectoryMeasurement > theFirstMeasurements_
GlobalPoint OutInConversionSeedFinder::fixPointRadius ( const TrajectoryMeasurement m1) const
private

Definition at line 546 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(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by createSeedFTS().

546  {
547  GlobalPoint p1 = m1.recHit()->globalPosition();
548  GlobalPoint p2;
549  if(m1.layer()->location() == GeomDetEnumerators::barrel) {
550  p2 = p1;
551  } else {
552  float z = p1.z();
553  float phi = p1.phi();
554  float theta = theSCPosition_.theta();
555  float r = p1.z() * tan(theta);
556  p2 = GlobalPoint(r*cos(phi), r*sin(phi), z);
557  // LogDebug("OutInConversionSeedFinder") << "fixing point radius " << p2 << " from " << p1 << endl;
558  }
559  return p2;
560 }
virtual Location location() const =0
Which part of the detector (barrel, endcap)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Geom::Theta< T > theta() const
ConstRecHitPointer recHit() const
double double double z
Geom::Theta< T > theta() const
Definition: PV3DBase.h:74
T z() const
Definition: PV3DBase.h:63
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
Definition: DDAxes.h:10
MeasurementEstimator * OutInConversionSeedFinder::makeEstimator ( const DetLayer layer,
float  dphi 
) const
private

Definition at line 340 of file OutInConversionSeedFinder.cc.

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

Referenced by startSeed().

340  {
341 
342  //std::cout << "OutInConversionSeedFinder::makeEstimator " << "\n";
343 
344  MeasurementEstimator * newEstimator=0;
345 
346  if (layer->location() == GeomDetEnumerators::barrel ) {
347 
348  const BarrelDetLayer * barrelLayer = dynamic_cast<const BarrelDetLayer*>(layer);
349  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeEstimator Barrel r = " << barrelLayer->specificSurface().radius() << " " << "\n";
350  float r = barrelLayer->specificSurface().radius();
351  float zrange = 15.* (1.-r/theBCPosition_.perp());
352  newEstimator = new ConversionBarrelEstimator(-dphi, dphi, -zrange, zrange);
353  }
354 
355 
356 
357  if (layer->location() == GeomDetEnumerators::endcap ) {
358 
359  const ForwardDetLayer * forwardLayer = dynamic_cast<const ForwardDetLayer*>(layer);
360  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeEstimator Endcap r = " << forwardLayer->specificSurface().innerRadius() << " R " << forwardLayer->specificSurface().outerRadius() << " Z " << forwardLayer->specificSurface().position().z() << "\n";
361 
362  float zc = fabs(theBCPosition_.z());
363  float z = fabs(forwardLayer->surface().position().z());
364 
365  float rrange = 15. * theBCPosition_.perp() * (zc - z) / (zc*zc - 15.*zc);
366  newEstimator = new ConversionForwardEstimator(-dphi, dphi, rrange);
367  }
368 
369 
370 
371 
372  return newEstimator;
373 }
#define LogDebug(id)
T perp() const
Definition: PV3DBase.h:71
virtual Location location() const =0
Which part of the detector (barrel, endcap)
virtual const BoundSurface & surface() const
The surface of the GeometricSearchDet.
double double double z
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:55
T z() const
Definition: PV3DBase.h:63
virtual const BoundDisk & specificSurface() const
virtual const BoundCylinder & specificSurface() const
Extension of the interface.
float outerRadius() const
The outer radius of the disk.
Definition: BoundDisk.h:75
float innerRadius() const
The inner radius of the disk.
Definition: BoundDisk.h:72
const PositionType & position() const
void OutInConversionSeedFinder::makeSeeds ( const edm::Handle< edm::View< reco::CaloCluster > > &  allBc) const
virtual

Implements ConversionSeedFinder.

Definition at line 51 of file OutInConversionSeedFinder.cc.

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

Referenced by ConversionTrackCandidateProducer::buildCollections().

51  {
52 
53  theSeeds_.clear();
54 
55  // std::cout << " OutInConversionSeedFinder::makeSeeds() " << "\n";
56 
57  // debug
58  // std::cout << " OutInConversionSeedFinder::makeSeeds() SC position " << theSCPosition_.x() << " " << theSCPosition_.y() << " " << theSCPosition_.z() << "\n";
59  // std::cout << " SC eta " << theSCPosition_.eta() << " SC phi " << theSCPosition_.phi() << "\n";
60  // std::cout << " OutInConversionSeedFinder::makeSeeds() SC energy " << theSCenergy_ << "\n";
61  //
62 
63  findLayers();
64 
65 
66  // std::cout << " Check Calo cluster collection size " << allBC->size() << "\n";
67 
68  float theSCPhi=theSCPosition_.phi();
69  float theSCEta=theSCPosition_.eta();
70 
71 
72 
73  // Loop over the Calo Clusters in the event looking for seeds
74  reco::CaloClusterCollection::const_iterator bcItr;
75  LogDebug("OutInConversionSeedFinder") << " OutInConversionSeedFinder::makeSeeds() All BC in the event " << "\n";
76  for (unsigned i = 0; i < allBC->size(); ++i ) {
77 
78  //for(bcItr = allBC.begin(); bcItr != allBC.end(); bcItr++) {
79  nSeedsPerBC_=0;
80 
81  theBCEnergy_=allBC->ptrAt(i)->energy();
82  theBCPosition_ = GlobalPoint(allBC->ptrAt(i)->position().x(), allBC->ptrAt(i)->position().y(), allBC->ptrAt(i)->position().z() ) ;
83  float theBcEta= theBCPosition_.eta();
84  float theBcPhi= theBCPosition_.phi();
85  // float dPhi= theBcPhi-theSCPhi;
86 
87  // std::cout << " OutInConversionSeedFinder::makeSeeds() BC eta " << theBcEta << " phi " << theBcPhi << " BC energy " << theBCEnergy_ << " dPhi " << fabs(theBcPhi-theSCPhi) << " dEta " << fabs(theBcEta-theSCEta) << "\n";
88 
89  if ( theBCEnergy_ < 1.5 ) continue;
90 
91  LogDebug("OutInConversionSeedFinder") << " OutInConversionSeedFinder::makeSeeds() Passing the >=1.5 GeV cut BC eta " << theBcEta << " phi " << theBcPhi << " BC energy " << theBCEnergy_ << "\n";
92 
93  if ( fabs(theBcEta-theSCEta) < 0.015 && fabs(theBcPhi-theSCPhi) < 0.3 ) {
94  LogDebug("OutInConversionSeedFinder") << " OutInConversionSeedFinder::makeSeeds() in et and phi range passed to the analysis " << "\n";
95  fillClusterSeeds( allBC->ptrAt(i) );
96  }
97 
98 
99  }
100 
101 
102  // std::cout << "Built vector of seeds of size " << theSeeds_.size() << "\n" ;
103 
105  /*
106  int nSeed=0;
107  for ( std::vector<TrajectorySeed>::const_iterator iSeed= theSeeds_.begin(); iSeed != theSeeds_.end(); ++iSeed) {
108  nSeed++;
109  PTrajectoryStateOnDet ptsod=iSeed->startingState();
110  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" ;
111 
112 
113  DetId tmpId = DetId( iSeed->startingState().detId());
114  const GeomDet* tmpDet = this->getMeasurementTracker()->geomTracker()->idToDet( tmpId );
115  GlobalVector gv = tmpDet->surface().toGlobal( iSeed->startingState().parameters().momentum() );
116 
117  LogDebug("OutInConversionSeedFinder") << "seed perp,phi,eta : "
118  << gv.perp() << " , "
119  << gv.phi() << " , "
120  << gv.eta() << "\n" ; ;
121 
122 
123 
124 
125  TrajectorySeed::range hitRange = iSeed->recHits();
126  for (TrajectorySeed::const_iterator ihit = hitRange.first; ihit != hitRange.second; ihit++) {
127 
128  if ( ihit->isValid() ) {
129 
130  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" ;
131 
132  }
133  }
134  }
135 
136  */
137 
138 
139 
140 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
void fillClusterSeeds(const reco::CaloClusterPtr &bc) const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
TrajectorySeedCollection theSeeds_
T eta() const
Definition: PV3DBase.h:75
void OutInConversionSeedFinder::makeSeeds ( const reco::CaloClusterPtr aBC) const
virtual

Definition at line 144 of file OutInConversionSeedFinder.cc.

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

144  {
145 
146  theSeeds_.clear();
147 
148  findLayers();
149 
150  float theSCPhi=theSCPosition_.phi();
151  float theSCEta=theSCPosition_.eta();
152 
153  nSeedsPerBC_=0;
154 
155  theBCEnergy_=aBC->energy();
156  theBCPosition_ = GlobalPoint(aBC->position().x(), aBC->position().y(), aBC->position().z() ) ;
157  float theBcEta= theBCPosition_.eta();
158  float theBcPhi= theBCPosition_.phi();
159  // float dPhi= theBcPhi-theSCPhi;
160 
161  if ( theBCEnergy_ < 1.5 ) return;
162 
163  if ( fabs(theBcEta-theSCEta) < 0.015 && fabs(theBcPhi-theSCPhi) < 0.25 ) {
164  fillClusterSeeds( aBC);
165  }
166 
167 }
void fillClusterSeeds(const reco::CaloClusterPtr &bc) const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
TrajectorySeedCollection theSeeds_
T eta() const
Definition: PV3DBase.h:75
std::pair< FreeTrajectoryState, bool > OutInConversionSeedFinder::makeTrackState ( int  charge) const
private

Definition at line 195 of file OutInConversionSeedFinder.cc.

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

Referenced by fillClusterSeeds().

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

Definition at line 267 of file OutInConversionSeedFinder.cc.

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

Referenced by fillClusterSeeds().

267  {
268 
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 
276  for(unsigned int ilayer = myLayers.size()-1; ilayer >= myLayers.size()-2; --ilayer) {
277  const DetLayer * layer = myLayers[ilayer];
278 
279 
280  // allow the z of the hit to be within a straight line from a vertex
281  // of +-15 cm to the cluster
282  // float dphi = 0.015;
283  float dphi = 0.030;
284 
285  MeasurementEstimator * newEstimator = makeEstimator(layer, dphi);
286 
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() ) " << "\n";
293 
294  LayerMeasurements theLayerMeasurements_(this->getMeasurementTracker() );
295  theFirstMeasurements_ = theLayerMeasurements_.measurements( *layer, tsos, *thePropagatorAlongMomentum_, *newEstimator);
296 
297  //std::cout << "OutInSeedFinder::startSeed after theFirstMeasurements_ " << theFirstMeasurements_.size() << "\n";
298 
299  if(theFirstMeasurements_.size() > 1) // always a dummy returned, too
300  LogDebug("OutInConversionSeedFinder") << " Found " << theFirstMeasurements_.size()-1 << " 1st hits in seed" << "\n";
301 
302  delete newEstimator;
303 
304  LogDebug("OutInConversionSeedFinder") << "OutInSeedFinder::startSeed Layer " << ilayer << " theFirstMeasurements_.size " << theFirstMeasurements_.size() << "\n";
305 
306  for(unsigned int i = 0; i < theFirstMeasurements_.size(); ++i) {
308  if(m1.recHit()->isValid()) {
309 
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") << " 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";
314 
315 
316  FreeTrajectoryState newfts = trackStateFromClusters(fts.charge(), hitPoint, alongMomentum, 0.8);
317  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::startSeed newfts " << newfts << "\n";
318  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::startSeed propagationDirection after switching " << int(thePropagatorOppositeToMomentum_->propagationDirection() ) << "\n";
319  // std::cout << "OutInConversionSeedFinder::startSeed propagationDirection after switching " << int(thePropagatorOppositeToMomentum_->propagationDirection() ) << "\n";
320 
321 
322  completeSeed(m1, newfts, thePropagatorOppositeToMomentum_, ilayer-1);
323  // skip a layer, if you haven't already skipped the first layer
324  if(ilayer == myLayers.size()-1) {
325  completeSeed(m1, newfts, thePropagatorOppositeToMomentum_, ilayer-2);
326  }
327  }
328  }
329 
330  } // loop over layers
331  }
332 
333 
334 
335 
336 }
#define LogDebug(id)
const Propagator * thePropagatorAlongMomentum_
std::vector< const DetLayer * > const & layerList() const
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
int i
Definition: DBlmapReader.cc:9
const MeasurementTracker * getMeasurementTracker() const
virtual PropagationDirection propagationDirection() const
Definition: Propagator.h:143
MeasurementEstimator * makeEstimator(const DetLayer *, float dphi) const
ConstRecHitPointer recHit() const
TrackCharge charge() const
const Propagator * thePropagatorOppositeToMomentum_
FreeTrajectoryState trackStateFromClusters(int aCharge, const GlobalPoint &gpOrigine, PropagationDirection dir, float scaleFactor) const
void completeSeed(const TrajectoryMeasurement &m1, FreeTrajectoryState &fts, const Propagator *, int layer) const
std::vector< TrajectoryMeasurement > theFirstMeasurements_

Member Data Documentation

edm::ParameterSet OutInConversionSeedFinder::conf_
private

Definition at line 57 of file OutInConversionSeedFinder.h.

Referenced by OutInConversionSeedFinder().

int OutInConversionSeedFinder::maxNumberOfOutInSeedsPerBC_
private

Definition at line 83 of file OutInConversionSeedFinder.h.

Referenced by createSeed(), and OutInConversionSeedFinder().

int OutInConversionSeedFinder::nSeedsPerBC_
mutableprivate

Definition at line 82 of file OutInConversionSeedFinder.h.

Referenced by createSeed(), and makeSeeds().

float OutInConversionSeedFinder::the2ndHitdphi_
private

Definition at line 78 of file OutInConversionSeedFinder.h.

Referenced by completeSeed(), and OutInConversionSeedFinder().

float OutInConversionSeedFinder::the2ndHitdzConst_
private

Definition at line 79 of file OutInConversionSeedFinder.h.

Referenced by completeSeed(), and OutInConversionSeedFinder().

float OutInConversionSeedFinder::the2ndHitdznSigma_
private

Definition at line 80 of file OutInConversionSeedFinder.h.

Referenced by completeSeed(), and OutInConversionSeedFinder().

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

Definition at line 81 of file OutInConversionSeedFinder.h.

Referenced by fillClusterSeeds(), and startSeed().