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_
 
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.7 2008/02/15 16:47:15 nancy Exp
Date:
2008/02/15 16:47:15
Revision:
1.7
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 30 of file OutInConversionSeedFinder.cc.

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

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

Definition at line 48 of file OutInConversionSeedFinder.cc.

References LogDebug.

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

Member Function Documentation

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

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

384  {
385 
386  //std::cout << "OutInConversionSeedFinder::completeSeed ilayer " << ilayer << "\n";
387 
388  MeasurementEstimator * newEstimator=0;
389  const DetLayer * layer = theLayerList_[ilayer];
390 
391 
392  if ( layer->location() == GeomDetEnumerators::barrel ) {
393  // z error for 2nd hit is 2 sigma quadded with 5 cm
394  LogDebug("OutInConversionSeedFinder") << " Barrel OutInConversionSeedFinder::completeSeed " << the2ndHitdznSigma_ << " " << the2ndHitdzConst_ << " " << the2ndHitdphi_ << "\n";
395  float dz = sqrt(the2ndHitdznSigma_*the2ndHitdznSigma_*m1.recHit()->globalPositionError().czz()
397  newEstimator =
398  new ConversionBarrelEstimator(-the2ndHitdphi_, the2ndHitdphi_, -dz, dz);
399  }
400  else {
401  LogDebug("OutInConversionSeedFinder") << " EndCap OutInConversionSeedFinder::completeSeed " << the2ndHitdznSigma_ << " " << the2ndHitdzConst_ << " " << the2ndHitdphi_ << "\n";
402  // z error for 2nd hit is 2sigma quadded with 5 cm
403  //float m1dr = m1.recHit().globalPositionError().rerr(m1.recHit().globalPosition());
404  float m1dr = sqrt(m1.recHit()->localPositionError().yy());
405  float dr = sqrt(the2ndHitdznSigma_*the2ndHitdznSigma_*m1dr*m1dr
407  // LogDebug("OutInConversionSeedFinder") << "second hit forward dr " << dr << " this hit " << m1dr << endl;
408  newEstimator =
409  new ConversionForwardEstimator(-the2ndHitdphi_, the2ndHitdphi_, dr);
410  }
411 
412  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::completeSeed ilayer " << ilayer << "\n";
413 
414  // Get the measurements consistent with the FTS and the Estimator
415  TSOS tsos(fts, layer->surface() );
416  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::completeSeed propagationDirection " << int(propagator->propagationDirection() ) << "\n";
417  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::completeSeed pointer to estimator " << newEstimator << "\n";
418 
419  LayerMeasurements theLayerMeasurements_(this->getMeasurementTracker() );
420  std::vector<TrajectoryMeasurement> measurements = theLayerMeasurements_.measurements( *layer, tsos, *propagator, *newEstimator);
421  //std::cout << "OutInConversionSeedFinder::completeSeed Found " << measurements.size() << " second hits " << "\n";
422  delete newEstimator;
423 
424  for(unsigned int i = 0; i < measurements.size(); ++i) {
425  if( measurements[i].recHit()->isValid() ) {
426  createSeed(m1, measurements[i]);
427  }
428  }
429 
430 
431 
432  //LogDebug("OutInConversionSeedFinder") << "COMPLETED " << theSeeds_.size() << " SEEDS " << "\n";
433 }
#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:28
std::vector< const DetLayer * > theLayerList_
void OutInConversionSeedFinder::createSeed ( const TrajectoryMeasurement m1,
const TrajectoryMeasurement m2 
) const
private

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

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

506  {
507 
508  //std::cout << "OutInConversionSeedFinder::createSeedFTS " << "\n";
509 
510  GlobalPoint xmeas = fixPointRadius(m1);
511  GlobalPoint xvert = fixPointRadius(m2);
512 
513 
514  float pt = theSCenergy_ * sin(theSCPosition_.theta());
515  float pz = theSCenergy_ * cos(theSCPosition_.theta());
516 
517 
518 
519  // doesn't work at all for endcap, where r is badly measured
520  //float dphidr = (p1.phi()-p2.phi())/(p1.perp()-p2.perp());
521  //int charge = (dphidr > 0.) ? -1 : 1;
522  int charge = m2.predictedState().charge();
523 
524  double BInTesla = theMF_->inTesla(xmeas).z();
525  GlobalVector xdiff = xmeas -xvert;
526 
527  double phi= xdiff.phi();
528  double pxOld = pt*cos(phi);
529  double pyOld = pt*sin(phi);
530  double RadCurv = 100*pt/(BInTesla*0.29979);
531  double alpha = asin(0.5*xdiff.perp()/RadCurv);
532  float ca = cos(charge*alpha);
533  float sa = sin(charge*alpha);
534  double pxNew = ca*pxOld + sa*pyOld;
535  double pyNew = -sa*pxOld + ca*pyOld;
536  GlobalVector pNew(pxNew, pyNew, pz);
537 
538  GlobalTrajectoryParameters gp(xmeas, pNew, charge, &(*theMF_) );
539 
541  m(0,0) = 0.05; m(1,1) = 0.02 ; m(2,2) = 0.007 ;
542  m(3,3) = 10. ; m(4,4) = 10. ;
544 
545 
546 }
float alpha
Definition: AMPTWrapper.h:95
T perp() const
Definition: PV3DBase.h:66
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:63
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:69
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 177 of file OutInConversionSeedFinder.cc.

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

Referenced by makeSeeds().

177  {
178 
179 
180  theFirstMeasurements_.clear();
181  FreeTrajectoryState fts;
182 
184  if ( makeTrackState(-1).second ) {
185  fts = makeTrackState(-1).first;
186  startSeed(fts);
187  }
189 
190  if ( makeTrackState(1).second ) {
191  fts = makeTrackState(1).first;
192  startSeed(fts);
193  }
194  theFirstMeasurements_.clear();
195 }
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 551 of file OutInConversionSeedFinder.cc.

References GeomDetEnumerators::barrel, funct::cos(), TrajectoryMeasurement::layer(), DetLayer::location(), p1, p2, phi, PV3DBase< T, PVType, FrameType >::phi(), csvReporter::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().

551  {
552  GlobalPoint p1 = m1.recHit()->globalPosition();
553  GlobalPoint p2;
554  if(m1.layer()->location() == GeomDetEnumerators::barrel) {
555  p2 = p1;
556  } else {
557  float z = p1.z();
558  float phi = p1.phi();
559  float theta = theSCPosition_.theta();
560  float r = p1.z() * tan(theta);
561  p2 = GlobalPoint(r*cos(phi), r*sin(phi), z);
562  // LogDebug("OutInConversionSeedFinder") << "fixing point radius " << p2 << " from " << p1 << endl;
563  }
564  return p2;
565 }
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:63
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:69
T z() const
Definition: PV3DBase.h:58
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 344 of file OutInConversionSeedFinder.cc.

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

Referenced by startSeed().

344  {
345 
346  //std::cout << "OutInConversionSeedFinder::makeEstimator " << "\n";
347 
348  MeasurementEstimator * newEstimator=0;
349 
350  if (layer->location() == GeomDetEnumerators::barrel ) {
351 
352  const BarrelDetLayer * barrelLayer = dynamic_cast<const BarrelDetLayer*>(layer);
353  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeEstimator Barrel r = " << barrelLayer->specificSurface().radius() << " " << "\n";
354  float r = barrelLayer->specificSurface().radius();
355  float zrange = 15.* (1.-r/theBCPosition_.perp());
356  newEstimator = new ConversionBarrelEstimator(-dphi, dphi, -zrange, zrange);
357  }
358 
359 
360 
361  if (layer->location() == GeomDetEnumerators::endcap ) {
362 
363  const ForwardDetLayer * forwardLayer = dynamic_cast<const ForwardDetLayer*>(layer);
364  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeEstimator Endcap r = " << forwardLayer->specificSurface().innerRadius() << " R " << forwardLayer->specificSurface().outerRadius() << " Z " << forwardLayer->specificSurface().position().z() << "\n";
365 
366  float zc = fabs(theBCPosition_.z());
367  float z = fabs(forwardLayer->surface().position().z());
368 
369  float rrange = 15. * theBCPosition_.perp() * (zc - z) / (zc*zc - 15.*zc);
370  newEstimator = new ConversionForwardEstimator(-dphi, dphi, rrange);
371  }
372 
373 
374 
375 
376  return newEstimator;
377 }
#define LogDebug(id)
T perp() const
Definition: PV3DBase.h:66
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:58
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.cc:10
float innerRadius() const
The inner radius of the disk.
Definition: BoundDisk.cc:6
const PositionType & position() const
void OutInConversionSeedFinder::makeSeeds ( const edm::Handle< edm::View< reco::CaloCluster > > &  allBc) const
virtual

Implements ConversionSeedFinder.

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

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

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

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

Definition at line 199 of file OutInConversionSeedFinder.cc.

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

Referenced by fillClusterSeeds().

199  {
200 
201  std::pair<FreeTrajectoryState,bool> result;
202  result.second=false;
203 
204 
205  //std::cout << " OutInConversionSeedFinder:makeTrackState " << "\n";
206 
207 
208  // Old GlobalPoint gpOrigine(theBCPosition_.x()*0.3, theBCPosition_.y()*0.3, theBCPosition_.z()*0.3) ;
209  // GlobalPoint gpOrigine(0.,0.,0.);
210 
212  GlobalVector gvBcRadius = theBCPosition_ - gpOrigine ;
213  HepGeom::Point3D<double> radiusBc(gvBcRadius.x(),gvBcRadius.y(),gvBcRadius.z()) ;
214  HepGeom::Point3D<double> momentumWithoutCurvature = radiusBc.unit() * theBCEnergy_ ;
215 
216  // compute momentum direction at calo
217  double curvature = theMF_->inTesla(theBCPosition_).z() * c_light * 1.e-3 / momentumWithoutCurvature.perp() ;
218  curvature /= 100. ; // in cm-1 !!
219 
220  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState gpOrigine " << gpOrigine.x() << " " << gpOrigine.y() << " " << gpOrigine.z() << " momentumWithoutCurvature " << momentumWithoutCurvature.mag() << " curvature " << curvature << "\n";
221 
222  // define rotation angle
223  float R = theBCPosition_.perp();
224  float r = gpOrigine.perp();
225  float rho = 1./curvature;
226  // from the formula for the intersection of two circles
227  // turns out to be about 2/3 of the deflection of the old formula
228  float d = sqrt(r*r+rho*rho);
229  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));
230  //float u = rho + rho/d/d*(R*R-rho*rho) ;
231  if ( u <=R ) result.second=true;
232 
233  double sinAlpha = 0.5*u/R;
234  if ( sinAlpha>(1.-10*DBL_EPSILON) ) sinAlpha = 1.-10*DBL_EPSILON;
235  else if ( sinAlpha<-(1.-10*DBL_EPSILON) ) sinAlpha = -(1.-10*DBL_EPSILON);
236 
237  double newdphi = charge * asin( sinAlpha) ;
238 
239  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState charge " << charge << " R " << R << " u/R " << u/R << " asin(0.5*u/R) " << asin(sinAlpha) << "\n";
240 
241  HepGeom::Transform3D rotation = HepGeom::Rotate3D(newdphi, HepGeom::Vector3D<double> (0., 0. ,1.));
242 
243 
244  HepGeom::Point3D<double> momentumInTracker = momentumWithoutCurvature.transform(rotation) ;
245  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState R " << R << " r " << r << " rho " << rho << " d " << d << " u " << u << " newdphi " << newdphi << " momentumInTracker " << momentumInTracker << "\n";
246 
247  HepGeom::Point3D<double> hepStartingPoint(gpOrigine.x(), gpOrigine.y(), gpOrigine.z()) ;
248 
249  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState hepStartingPoint " << hepStartingPoint << "\n";
250 
251  hepStartingPoint.transform(rotation);
252 
253  GlobalPoint startingPoint(hepStartingPoint.x(), hepStartingPoint.y(), hepStartingPoint.z());
254 
255  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState startingPoint " << startingPoint << " 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; m(1,1) = 0.1 ; m(2,2) = 0.1 ;
261  m(3,3) = 0.1 ; 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 
268 }
#define LogDebug(id)
T perp() const
Definition: PV3DBase.h:66
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:28
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 271 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().

271  {
272 
273 
274  // std::cout << "OutInConversionSeedFinder::startSeed layer list " << this->layerList().size() << "\n";
275  //std::cout << "OutInConversionSeedFinder::startSeed fts " << fts << "\n";
276 
277  std::vector<const DetLayer*> myLayers=layerList();
278  if ( myLayers.size() > 3 ) {
279 
280  for(unsigned int ilayer = myLayers.size()-1; ilayer >= myLayers.size()-2; --ilayer) {
281  const DetLayer * layer = myLayers[ilayer];
282 
283 
284  // allow the z of the hit to be within a straight line from a vertex
285  // of +-15 cm to the cluster
286  // float dphi = 0.015;
287  float dphi = 0.030;
288 
289  MeasurementEstimator * newEstimator = makeEstimator(layer, dphi);
290 
291 
292  //std::cout << "OutInSeedFinder::startSeed propagationDirection " << int(thePropagatorAlongMomentum_->propagationDirection() ) << "\n";
293 
294  TSOS tsos(fts, layer->surface() );
295 
296  LogDebug("OutInConversionSeedFinder") << "OutInSeedFinder::startSeed after TSOS tsos(fts, layer->surface() ) " << "\n";
297 
298  LayerMeasurements theLayerMeasurements_(this->getMeasurementTracker() );
299  theFirstMeasurements_ = theLayerMeasurements_.measurements( *layer, tsos, *thePropagatorAlongMomentum_, *newEstimator);
300 
301  //std::cout << "OutInSeedFinder::startSeed after theFirstMeasurements_ " << theFirstMeasurements_.size() << "\n";
302 
303  if(theFirstMeasurements_.size() > 1) // always a dummy returned, too
304  LogDebug("OutInConversionSeedFinder") << " Found " << theFirstMeasurements_.size()-1 << " 1st hits in seed" << "\n";
305 
306  delete newEstimator;
307 
308  LogDebug("OutInConversionSeedFinder") << "OutInSeedFinder::startSeed Layer " << ilayer << " theFirstMeasurements_.size " << theFirstMeasurements_.size() << "\n";
309 
310  for(unsigned int i = 0; i < theFirstMeasurements_.size(); ++i) {
312  if(m1.recHit()->isValid()) {
313 
314  // update the fts to start from this point. much better than starting from
315  // extrapolated point along the line
316  GlobalPoint hitPoint = m1.recHit()->globalPosition();
317  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";
318 
319 
320  FreeTrajectoryState newfts = trackStateFromClusters(fts.charge(), hitPoint, alongMomentum, 0.8);
321  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::startSeed newfts " << newfts << "\n";
322  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::startSeed propagationDirection after switching " << int(thePropagatorOppositeToMomentum_->propagationDirection() ) << "\n";
323  // std::cout << "OutInConversionSeedFinder::startSeed propagationDirection after switching " << int(thePropagatorOppositeToMomentum_->propagationDirection() ) << "\n";
324 
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 
337 
338 
339 
340 }
#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().