CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Friends
CachedTrajectory Class Reference

#include <CachedTrajectory.h>

Public Member Functions

const std::vector
< SteppingHelixStateInfo > & 
getEcalTrajectory () const
 
const std::vector
< SteppingHelixStateInfo > & 
getHcalTrajectory () const
 
const std::vector
< SteppingHelixStateInfo > & 
getHOTrajectory () const
 
const std::vector
< SteppingHelixStateInfo > & 
getPreshowerTrajectory () const
 

Protected Member Functions

std::pair< float, float > delta (const double &theta1, const double &theta2, const double &phi1, const double &phi2) dso_internal
 
float distance (const Plane *plane, int index) dso_internal
 

Static Protected Member Functions

static int sign (float number) dso_internal
 

Protected Attributes

std::vector
< SteppingHelixStateInfo
ecalTrajectory_
 
std::deque
< SteppingHelixStateInfo
fullTrajectory_
 
bool fullTrajectoryFilled_
 
std::vector
< SteppingHelixStateInfo
hcalTrajectory_
 
float HOmaxRho_
 
float HOmaxZ_
 
std::vector
< SteppingHelixStateInfo
hoTrajectory_
 
float maxRho_
 
float maxZ_
 
float minRho_
 
float minZ_
 
std::vector
< SteppingHelixStateInfo
preshowerTrajectory_
 
const Propagatorpropagator_
 
SteppingHelixStateInfo stateAtIP_
 
float step_
 
std::vector< GlobalPointwideEcalTrajectory_
 
std::vector< GlobalPointwideHcalTrajectory_
 
std::vector< GlobalPointwideHOTrajectory_
 

Private Types

enum  TrajectorType { IpToEcal, IpToHcal, IpToHO, FullTrajectory }
 
enum  WideTrajectoryType { Ecal, Hcal, HO }
 

Private Member Functions

 CachedTrajectory ()
 
void findEcalTrajectory (const FiducialVolume &) dso_internal
 
void findHcalTrajectory (const FiducialVolume &) dso_internal
 
void findHOTrajectory (const FiducialVolume &) dso_internal
 
void findPreshowerTrajectory (const FiducialVolume &) dso_internal
 
SteppingHelixStateInfo getInnerState () dso_internal
 
SteppingHelixStateInfo getOuterState () dso_internal
 
float getPropagationStep () const dso_internal
 
SteppingHelixStateInfo getStateAtEcal () dso_internal
 
SteppingHelixStateInfo getStateAtHcal () dso_internal
 
SteppingHelixStateInfo getStateAtHO () dso_internal
 
SteppingHelixStateInfo getStateAtPreshower () dso_internal
 
void getTrajectory (std::vector< SteppingHelixStateInfo > &, const FiducialVolume &, int steps=4) dso_internal
 
std::vector< GlobalPoint > * getWideTrajectory (const std::vector< SteppingHelixStateInfo > &, WideTrajectoryType) dso_internal
 
void propagate (SteppingHelixStateInfo &state, const Plane &plane) dso_internal
 
void propagate (SteppingHelixStateInfo &state, const Cylinder &cylinder) dso_internal
 
TrajectoryStateOnSurface propagate (const Plane *plane) dso_internal
 get fast to a given DetId surface using cached trajectory More...
 
bool propagateAll (const SteppingHelixStateInfo &initialState) dso_internal
 propagate through the whole detector, returns true if successful More...
 
void propagateForward (SteppingHelixStateInfo &state, float distance) dso_internal
 
void reset_trajectory () dso_internal
 
void setMaxDetectorLength (float l=2200.) dso_internal
 
void setMaxDetectorRadius (float r=800.) dso_internal
 
void setMaxHOLength (float l=2200.) dso_internal
 
void setMaxHORadius (float r=800.) dso_internal
 
void setMinDetectorLength (float l=0.) dso_internal
 
void setMinDetectorRadius (float r=0.) dso_internal
 
void setPropagationStep (float s=20.)
 
void setPropagator (const Propagator *ptr) dso_internal
 
void setStateAtIP (const SteppingHelixStateInfo &state) dso_internal
 
std::pair< float, float > trajectoryDelta (TrajectorType) dso_internal
 

Friends

std::vector
< SteppingHelixStateInfo
propagateThoughFromIP (const SteppingHelixStateInfo &state, const Propagator *ptr, const FiducialVolume &volume, int nsteps, float step, float minR, float minZ, float maxR, float maxZ)
 
class TrackDetectorAssociator
 

Detailed Description

Definition at line 40 of file CachedTrajectory.h.

Member Enumeration Documentation

Enumerator
Ecal 
Hcal 
HO 

Definition at line 57 of file CachedTrajectory.h.

Constructor & Destructor Documentation

CachedTrajectory::CachedTrajectory ( )
private

Definition at line 48 of file CachedTrajectory.cc.

References reset_trajectory(), setMaxDetectorLength(), setMaxDetectorRadius(), setMinDetectorLength(), setMinDetectorRadius(), and setPropagationStep().

48  :propagator_(0){
55 }
void setMaxDetectorLength(float l=2200.) dso_internal
void setMinDetectorRadius(float r=0.) dso_internal
void reset_trajectory() dso_internal
const Propagator * propagator_
void setPropagationStep(float s=20.)
void setMinDetectorLength(float l=0.) dso_internal
void setMaxDetectorRadius(float r=800.) dso_internal

Member Function Documentation

std::pair< float, float > CachedTrajectory::delta ( const double &  theta1,
const double &  theta2,
const double &  phi1,
const double &  phi2 
)
protected

Definition at line 333 of file CachedTrajectory.cc.

References M_PI, and query::result.

Referenced by trajectoryDelta().

337 {
338  std::pair<float,float> result(theta2 - theta1, phi2 - phi1 );
339  // this won't work for loopers, since deltaPhi cannot be larger than Pi.
340  if ( fabs(result.second) > 2*M_PI-fabs(result.second) ) {
341  if (result.second>0)
342  result.second -= 2*M_PI;
343  else
344  result.second += 2*M_PI;
345  }
346  return result;
347 }
tuple result
Definition: query.py:137
#define M_PI
Definition: BFit3D.cc:3
float CachedTrajectory::distance ( const Plane plane,
int  index 
)
inlineprotected

Definition at line 132 of file CachedTrajectory.h.

References fullTrajectory_, getHLTprescales::index, and position.

Referenced by propagate(), and propagateForward().

132  {
133  if (index<0 || fullTrajectory_.empty() || (unsigned int)index >= fullTrajectory_.size()) return 0;
134  return plane->localZ(fullTrajectory_[index].position());
135  }
float localZ(const GlobalPoint &gp) const
Definition: Plane.h:49
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
std::deque< SteppingHelixStateInfo > fullTrajectory_
void CachedTrajectory::findEcalTrajectory ( const FiducialVolume volume)
private

Definition at line 457 of file CachedTrajectory.cc.

References ecalTrajectory_, getTrajectory(), and LogTrace.

457  {
458  LogTrace("TrackAssociator") << "getting trajectory in ECAL";
459  getTrajectory(ecalTrajectory_, volume, 4 );
460  LogTrace("TrackAssociator") << "# of points in ECAL trajectory:" << ecalTrajectory_.size();
461 }
std::vector< SteppingHelixStateInfo > ecalTrajectory_
#define LogTrace(id)
void getTrajectory(std::vector< SteppingHelixStateInfo > &, const FiducialVolume &, int steps=4) dso_internal
void CachedTrajectory::findHcalTrajectory ( const FiducialVolume volume)
private

Definition at line 477 of file CachedTrajectory.cc.

References getTrajectory(), hcalTrajectory_, and LogTrace.

477  {
478  LogTrace("TrackAssociator") << "getting trajectory in HCAL";
479  getTrajectory(hcalTrajectory_, volume, 4 ); // more steps to account for different depth
480  LogTrace("TrackAssociator") << "# of points in HCAL trajectory:" << hcalTrajectory_.size();
481 }
#define LogTrace(id)
void getTrajectory(std::vector< SteppingHelixStateInfo > &, const FiducialVolume &, int steps=4) dso_internal
std::vector< SteppingHelixStateInfo > hcalTrajectory_
void CachedTrajectory::findHOTrajectory ( const FiducialVolume volume)
private

Definition at line 487 of file CachedTrajectory.cc.

References getTrajectory(), hoTrajectory_, and LogTrace.

487  {
488  LogTrace("TrackAssociator") << "getting trajectory in HO";
489  getTrajectory(hoTrajectory_, volume, 2 );
490  LogTrace("TrackAssociator") << "# of points in HO trajectory:" << hoTrajectory_.size();
491 }
std::vector< SteppingHelixStateInfo > hoTrajectory_
#define LogTrace(id)
void getTrajectory(std::vector< SteppingHelixStateInfo > &, const FiducialVolume &, int steps=4) dso_internal
void CachedTrajectory::findPreshowerTrajectory ( const FiducialVolume volume)
private

Definition at line 463 of file CachedTrajectory.cc.

References getTrajectory(), LogTrace, and preshowerTrajectory_.

463  {
464  LogTrace("TrackAssociator") << "getting trajectory in Preshower";
465  getTrajectory(preshowerTrajectory_, volume, 2 );
466  LogTrace("TrackAssociator") << "# of points in Preshower trajectory:" << preshowerTrajectory_.size();
467 }
std::vector< SteppingHelixStateInfo > preshowerTrajectory_
#define LogTrace(id)
void getTrajectory(std::vector< SteppingHelixStateInfo > &, const FiducialVolume &, int steps=4) dso_internal
const std::vector< SteppingHelixStateInfo > & CachedTrajectory::getEcalTrajectory ( ) const

Definition at line 469 of file CachedTrajectory.cc.

References ecalTrajectory_.

469  {
470  return ecalTrajectory_;
471 }
std::vector< SteppingHelixStateInfo > ecalTrajectory_
const std::vector< SteppingHelixStateInfo > & CachedTrajectory::getHcalTrajectory ( ) const

Definition at line 483 of file CachedTrajectory.cc.

References hcalTrajectory_.

483  {
484  return hcalTrajectory_;
485 }
std::vector< SteppingHelixStateInfo > hcalTrajectory_
const std::vector< SteppingHelixStateInfo > & CachedTrajectory::getHOTrajectory ( ) const

Definition at line 493 of file CachedTrajectory.cc.

References hoTrajectory_.

493  {
494  return hoTrajectory_;
495 }
std::vector< SteppingHelixStateInfo > hoTrajectory_
SteppingHelixStateInfo CachedTrajectory::getInnerState ( )
private

Definition at line 624 of file CachedTrajectory.cc.

References fullTrajectory_.

624  {
625  if(fullTrajectory_.empty() )
626  return SteppingHelixStateInfo();
627  else
628  return fullTrajectory_.front();
629 }
std::deque< SteppingHelixStateInfo > fullTrajectory_
SteppingHelixStateInfo CachedTrajectory::getOuterState ( )
private

Definition at line 632 of file CachedTrajectory.cc.

References fullTrajectory_.

632  {
633  if(fullTrajectory_.empty() )
634  return SteppingHelixStateInfo();
635  else
636  return fullTrajectory_.back();
637 }
std::deque< SteppingHelixStateInfo > fullTrajectory_
const std::vector< SteppingHelixStateInfo > & CachedTrajectory::getPreshowerTrajectory ( ) const

Definition at line 473 of file CachedTrajectory.cc.

References preshowerTrajectory_.

473  {
474  return preshowerTrajectory_;
475 }
std::vector< SteppingHelixStateInfo > preshowerTrajectory_
float CachedTrajectory::getPropagationStep ( ) const
inlineprivate

Definition at line 115 of file CachedTrajectory.h.

References step_.

115 { return step_;}
SteppingHelixStateInfo CachedTrajectory::getStateAtEcal ( )
private

Definition at line 591 of file CachedTrajectory.cc.

References ecalTrajectory_.

592 {
593  if ( ecalTrajectory_.empty() )
594  return SteppingHelixStateInfo();
595  else
596  return ecalTrajectory_.front();
597 }
std::vector< SteppingHelixStateInfo > ecalTrajectory_
SteppingHelixStateInfo CachedTrajectory::getStateAtHcal ( )
private

Definition at line 607 of file CachedTrajectory.cc.

References hcalTrajectory_.

608 {
609  if ( hcalTrajectory_.empty() )
610  return SteppingHelixStateInfo();
611  else
612  return hcalTrajectory_.front();
613 }
std::vector< SteppingHelixStateInfo > hcalTrajectory_
SteppingHelixStateInfo CachedTrajectory::getStateAtHO ( )
private

Definition at line 615 of file CachedTrajectory.cc.

References hoTrajectory_.

616 {
617  if ( hoTrajectory_.empty() )
618  return SteppingHelixStateInfo();
619  else
620  return hoTrajectory_.front();
621 }
std::vector< SteppingHelixStateInfo > hoTrajectory_
SteppingHelixStateInfo CachedTrajectory::getStateAtPreshower ( )
private

Definition at line 599 of file CachedTrajectory.cc.

References preshowerTrajectory_.

600 {
601  if ( preshowerTrajectory_.empty() )
602  return SteppingHelixStateInfo();
603  else
604  return preshowerTrajectory_.front();
605 }
std::vector< SteppingHelixStateInfo > preshowerTrajectory_
void CachedTrajectory::getTrajectory ( std::vector< SteppingHelixStateInfo > &  trajectory,
const FiducialVolume volume,
int  steps = 4 
)
private

get a set of points representing the trajectory between two cylinders of radius R1 and R2 and length L1 and L2. Parameter steps defines maximal number of steps in the detector.

Definition at line 349 of file CachedTrajectory.cc.

References Reference_intrackfit_cff::barrel, Plane::build(), newFWLiteAna::build, PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, Reference_intrackfit_cff::endcap, edm::hlt::Exception, fullTrajectory_, fullTrajectoryFilled_, i, FiducialVolume::isValid(), SteppingHelixStateInfo::isValid(), LogTrace, max(), FiducialVolume::maxR(), FiducialVolume::maxZ(), FiducialVolume::minR(), FiducialVolume::minZ(), SteppingHelixStateInfo::momentum(), PV3DBase< T, PVType, FrameType >::perp(), SteppingHelixStateInfo::position(), position, propagate(), propagateForward(), relval_parameters_module::step, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by findEcalTrajectory(), findHcalTrajectory(), findHOTrajectory(), findPreshowerTrajectory(), and propagateThoughFromIP().

352 {
353  if ( ! fullTrajectoryFilled_ ) throw cms::Exception("FatalError") << "trajectory is not defined yet. Please use propagateAll first.";
354  if ( fullTrajectory_.empty() ) {
355  LogTrace("TrackAssociator") << "Trajectory is empty. Move on";
356  return;
357  }
358  if ( ! volume.isValid() ) {
359  LogTrace("TrackAssociator") << "no trajectory is expected to be found since the fiducial volume is not valid";
360  return;
361  }
362  double step = std::max(volume.maxR()-volume.minR(),volume.maxZ()-volume.minZ())/steps;
363 
364  int closestPointOnLeft = -1;
365 
366  // check whether the trajectory crossed the region
367  if ( !
368  ( ( fullTrajectory_.front().position().perp() < volume.maxR() && fabs(fullTrajectory_.front().position().z()) < volume.maxZ() ) &&
369  ( fullTrajectory_.back().position().perp() > volume.minR() || fabs(fullTrajectory_.back().position().z()) > volume.minZ() ) ))
370  {
371  LogTrace("TrackAssociator") << "Track didn't cross the region (R1,R2,L1,L2): " << volume.minR() << ", " << volume.maxR() <<
372  ", " << volume.minZ() << ", " << volume.maxZ();
373  return;
374  }
375 
376  // get distance along momentum to the surface.
377 
378  // the following code can be made faster, but it'll hardly be a significant improvement
379  // simplifications:
380  // 1) direct loop over stored trajectory points instead of some sort
381  // of fast root search (Newton method)
382  // 2) propagate from the closest point outside the region with the
383  // requested step ignoring stored trajectory points.
384  double dZ(-1.);
385  double dR(-1.);
386  int firstPointInside(-1);
387  for(unsigned int i=0; i<fullTrajectory_.size(); i++) {
388  // LogTrace("TrackAssociator") << "Trajectory info (i,perp,r1,r2,z,z1,z2): " << i << ", " << fullTrajectory_[i].position().perp() <<
389  // ", " << volume.minR() << ", " << volume.maxR() << ", " << fullTrajectory_[i].position().z() << ", " << volume.minZ() << ", " <<
390  // volume.maxZ() << ", " << closestPointOnLeft;
391  dR = fullTrajectory_[i].position().perp()-volume.minR();
392  dZ = fabs(fullTrajectory_[i].position().z()) - volume.minZ();
393  if ( dR> 0 || dZ >0 )
394  {
395  if (i>0) {
396  firstPointInside = i;
397  closestPointOnLeft = i - 1;
398  } else {
399  firstPointInside = 0;
400  closestPointOnLeft = 0;
401  }
402  break;
403  }
404  }
405  if (closestPointOnLeft == -1) throw cms::Exception("FatalError") << "This shouls never happen - internal logic error";
406 
407  SteppingHelixStateInfo currentState(fullTrajectory_[closestPointOnLeft]);
408  if ( currentState.position().x()*currentState.momentum().x() +
409  currentState.position().y()*currentState.momentum().y() +
410  currentState.position().z()*currentState.momentum().z() < 0 )
411  step = -step;
412 
413  // propagate to the inner surface of the active volume
414 
415  if (firstPointInside != closestPointOnLeft) {
416  if ( dR > 0 ) {
417  Cylinder::CylinderPointer barrel = Cylinder::build( volume.minR(), Cylinder::PositionType (0, 0, 0), Cylinder::RotationType () );
418  propagate(currentState, *barrel);
419  } else {
421  currentState.position().z()>0?volume.minZ():-volume.minZ()),
422  Plane::RotationType () );
423  propagate(currentState, *endcap);
424  }
425  if ( currentState.isValid() ) trajectory.push_back(currentState);
426  } else
427  LogTrace("TrackAssociator") << "Weird message\n";
428 
429  while (currentState.isValid() &&
430  currentState.position().perp() < volume.maxR() &&
431  fabs(currentState.position().z()) < volume.maxZ() )
432  {
433  propagateForward(currentState,step);
434  if (! currentState.isValid() ) {
435  LogTrace("TrackAssociator") << "Failed to propagate the track; moving on\n";
436  break;
437  }
438  // LogTrace("TrackAssociator") << "New state (perp, z): " << currentState.position().perp() << ", " << currentState.position().z();
439  //if ( ( currentState.position().perp() < volume.maxR() && fabs(currentState.position().z()) < volume.maxZ() ) &&
440  // ( currentState.position().perp()-volume.minR() > 0 || fabs(currentState.position().z()) - volume.minZ() >0 ) )
441  trajectory.push_back(currentState);
442  }
443 }
TkRotation< Scalar > RotationType
Definition: Definitions.h:29
int i
Definition: DBlmapReader.cc:9
bool isValid() const
check whether the volume is properly defined
double maxZ(bool withTolerance=true) const
void propagateForward(SteppingHelixStateInfo &state, float distance) dso_internal
double minZ(bool withTolerance=true) const
float float float z
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
Point3DBase< Scalar, GlobalTag > PositionType
Definition: Definitions.h:30
const T & max(const T &a, const T &b)
static PlanePointer build(Args &&...args)
Definition: Plane.h:36
#define LogTrace(id)
double minR(bool withTolerance=true) const
std::deque< SteppingHelixStateInfo > fullTrajectory_
void propagate(SteppingHelixStateInfo &state, const Plane &plane) dso_internal
double maxR(bool withTolerance=true) const
std::vector< GlobalPoint > * CachedTrajectory::getWideTrajectory ( const std::vector< SteppingHelixStateInfo > &  states,
WideTrajectoryType  wideTrajectoryType 
)
private

Definition at line 498 of file CachedTrajectory.cc.

References funct::cos(), Ecal, Hcal, HO, getHLTprescales::index, LogTrace, M_PI, M_PI_2, phi, funct::pow(), dttmaxenums::r32, LocalError::rotate(), idealTransformation::rotation, LocalError::scale(), funct::sin(), mathSSE::sqrt(), evf::utils::state, filterCSVwithJSON::target, Surface::toGlobal(), wideEcalTrajectory_, wideHcalTrajectory_, wideHOTrajectory_, LocalError::xx(), LocalError::xy(), create_public_lumi_plots::xy, LocalError::yy(), and PV3DBase< T, PVType, FrameType >::z().

499  {
500  std::vector<GlobalPoint>* wideTrajectory = 0;
501  switch (wideTrajectoryType) {
502  case Ecal:
503  LogTrace("TrackAssociator") << "Filling ellipses in Ecal trajectory";
504  wideTrajectory = &wideEcalTrajectory_;
505  break;
506  case Hcal:
507  LogTrace("TrackAssociator") << "Filling ellipses in Hcal trajectory";
508  wideTrajectory = &wideHcalTrajectory_;
509  break;
510  case HO:
511  LogTrace("TrackAssociator") << "Filling ellipses in HO trajectory";
512  wideTrajectory = &wideHOTrajectory_;
513  break;
514  }
515  if(!wideTrajectory) return 0;
516 
517  for(std::vector<SteppingHelixStateInfo>::const_iterator state= states.begin();
518  state != states.end(); state++) {
519  // defined a normal plane wrt the particle trajectory direction
520  // let's hope that I computed the rotation matrix correctly.
521  GlobalVector vector(state->momentum().unit());
522  float r21 = 0;
523  float r22 = vector.z()/sqrt(1-pow(vector.x(),2));
524  float r23 = -vector.y()/sqrt(1-pow(vector.x(),2));
525  float r31 = vector.x();
526  float r32 = vector.y();
527  float r33 = vector.z();
528  float r11 = r22*r33-r23*r32;
529  float r12 = r23*r31;
530  float r13 = -r22*r31;
531 
532  Plane::RotationType rotation(r11, r12, r13,
533  r21, r22, r23,
534  r31, r32, r33);
535  Plane* target = new Plane(state->position(), rotation);
536 
537  TrajectoryStateOnSurface tsos = state->getStateOnSurface(*target);
538 
539  if (!tsos.isValid()) {
540  LogTrace("TrackAssociator") << "[getWideTrajectory] TSOS not valid";
541  continue;
542  }
543  if (!tsos.hasError()) {
544  LogTrace("TrackAssociator") << "[getWideTrajectory] TSOS does not have Errors";
545  continue;
546  }
547  LocalError localErr = tsos.localError().positionError();
548  localErr.scale(2); // get the 2 sigma ellipse
549  float xx = localErr.xx();
550  float xy = localErr.xy();
551  float yy = localErr.yy();
552 
553  float denom = yy - xx;
554  float phi = 0.;
555  if(xy == 0 && denom==0) phi = M_PI_4;
556  else phi = 0.5 * atan2(2.*xy,denom); // angle of MAJOR axis
557  // Unrotate the error ellipse to get the semimajor and minor axes. Then place points on
558  // the endpoints of semiminor an seminajor axes on original(rotated) error ellipse.
559  LocalError rotErr = localErr.rotate(-phi); // xy covariance of rotErr should be zero
560  float semi1 = sqrt(rotErr.xx());
561  float semi2 = sqrt(rotErr.yy());
562 
563  // Just use one point if the ellipse is small
564  // if(semi1 < 0.1 && semi2 < 0.1) {
565  // LogTrace("TrackAssociator") << "[getWideTrajectory] Error ellipse is small, using one trajectory point";
566  // wideTrajectory->push_back(state->position());
567  // continue;
568  // }
569 
570  Local2DPoint bounds[4];
571  bounds[0] = Local2DPoint(semi1*cos(phi), semi1*sin(phi));
572  bounds[1] = Local2DPoint(semi1*cos(phi+M_PI), semi1*sin(phi+M_PI));
573  phi += M_PI_2; // add pi/2 for the semi2 axis
574  bounds[2] = Local2DPoint(semi2*cos(phi), semi2*sin(phi));
575  bounds[3] = Local2DPoint(semi2*cos(phi+M_PI), semi2*sin(phi+M_PI));
576 
577  // LogTrace("TrackAssociator") << "Axes " << semi1 <<","<< semi2 <<" phi "<< phi;
578  // LogTrace("TrackAssociator") << "Local error ellipse: " << bounds[0] << bounds[1] << bounds[2] << bounds[3];
579 
580  wideTrajectory->push_back(state->position());
581  for(int index=0; index<4; ++index)
582  wideTrajectory->push_back(target->toGlobal(bounds[index]));
583 
584  //LogTrace("TrackAssociator") <<"Global error ellipse: (" << target->toGlobal(bounds[0]) <<","<< target->toGlobal(bounds[1])
585  // <<","<< target->toGlobal(bounds[2]) <<","<< target->toGlobal(bounds[3]) <<","<<state->position() <<")";
586  }
587 
588  return wideTrajectory;
589 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
float xx() const
Definition: LocalError.h:24
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
#define M_PI_2
std::vector< GlobalPoint > wideHcalTrajectory_
Definition: Plane.h:17
std::vector< GlobalPoint > wideEcalTrajectory_
std::vector< GlobalPoint > wideHOTrajectory_
float xy() const
Definition: LocalError.h:25
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
#define LogTrace(id)
#define M_PI
Definition: BFit3D.cc:3
char state
Definition: procUtils.cc:75
Point2DBase< float, LocalTag > Local2DPoint
Definition: LocalPoint.h:8
LocalError rotate(float x, float y) const
Return a new LocalError, rotated by an angle defined by the direction (x,y)
Definition: LocalError.h:39
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
LocalError scale(float s) const
Definition: LocalError.h:33
Definition: DDAxes.h:10
void CachedTrajectory::propagate ( SteppingHelixStateInfo state,
const Plane plane 
)
private

Definition at line 79 of file CachedTrajectory.cc.

References cms::Exception::category(), cms::Exception::explainSelf(), TrajectoryStateOnSurface::freeState(), SteppingHelixStateInfo::getFreeState(), SteppingHelixStateInfo::momentum(), Propagator::propagate(), propagator_, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by getTrajectory(), and propagateForward().

80 {
81  if( const SteppingHelixPropagator* shp = dynamic_cast<const SteppingHelixPropagator*>(propagator_) )
82  {
83  try {
84  state = shp->propagate(state, plane);
85  }
86  catch(cms::Exception &ex){
87  edm::LogWarning("TrackAssociator") <<
88  "Caught exception " << ex.category() << ": " << ex.explainSelf();
89  edm::LogWarning("TrackAssociator") << "An exception is caught during the track propagation\n"
90  << state.momentum().x() << ", " << state.momentum().y() << ", " << state.momentum().z();
91  state = SteppingHelixStateInfo();
92  }
93  }
94  else
95  {
97  state.getFreeState( fts );
98  TrajectoryStateOnSurface stateOnSurface = propagator_->propagate(fts, plane);
99  state = SteppingHelixStateInfo( *(stateOnSurface.freeState()) );
100  }
101 }
const Propagator * propagator_
virtual std::string explainSelf() const
Definition: Exception.cc:146
void getFreeState(FreeTrajectoryState &fts) const
convert internal structure into the fts
T y() const
Definition: PV3DBase.h:63
std::string const & category() const
Definition: Exception.cc:183
GlobalVector momentum() const
FreeTrajectoryState * freeState(bool withErrors=true) const
T z() const
Definition: PV3DBase.h:64
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:12
T x() const
Definition: PV3DBase.h:62
void CachedTrajectory::propagate ( SteppingHelixStateInfo state,
const Cylinder cylinder 
)
private

Definition at line 103 of file CachedTrajectory.cc.

References cms::Exception::category(), cms::Exception::explainSelf(), TrajectoryStateOnSurface::freeState(), SteppingHelixStateInfo::getFreeState(), SteppingHelixStateInfo::momentum(), Propagator::propagate(), propagator_, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

104 {
105  if( const SteppingHelixPropagator* shp = dynamic_cast<const SteppingHelixPropagator*>(propagator_) )
106  {
107  try {
108  state = shp->propagate(state, cylinder);
109  }
110  catch(cms::Exception &ex){
111  edm::LogWarning("TrackAssociator") <<
112  "Caught exception " << ex.category() << ": " << ex.explainSelf();
113  edm::LogWarning("TrackAssociator") << "An exception is caught during the track propagation\n"
114  << state.momentum().x() << ", " << state.momentum().y() << ", " << state.momentum().z();
115  state = SteppingHelixStateInfo();
116  }
117  }
118  else
119  {
121  state.getFreeState( fts );
122  TrajectoryStateOnSurface stateOnSurface = propagator_->propagate(fts, cylinder);
123  state = SteppingHelixStateInfo( *(stateOnSurface.freeState()) );
124  }
125 }
const Propagator * propagator_
virtual std::string explainSelf() const
Definition: Exception.cc:146
void getFreeState(FreeTrajectoryState &fts) const
convert internal structure into the fts
T y() const
Definition: PV3DBase.h:63
std::string const & category() const
Definition: Exception.cc:183
GlobalVector momentum() const
FreeTrajectoryState * freeState(bool withErrors=true) const
T z() const
Definition: PV3DBase.h:64
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:12
T x() const
Definition: PV3DBase.h:62
TrajectoryStateOnSurface CachedTrajectory::propagate ( const Plane plane)
private

get fast to a given DetId surface using cached trajectory

Definition at line 196 of file CachedTrajectory.cc.

References cms::Exception::category(), distance(), PV3DBase< T, PVType, FrameType >::eta(), cms::Exception::explainSelf(), fullTrajectory_, SteppingHelixStateInfo::getStateOnSurface(), LogTrace, SteppingHelixStateInfo::momentum(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), GloballyPositioned< T >::position(), Propagator::propagate(), propagator_, sign(), evf::utils::state, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

197 {
198  // TimerStack timers(TimerStack::Disableable);
199  // timers.benchmark("CachedTrajectory::propagate::benchmark");
200  // timers.push("CachedTrajectory::propagate",TimerStack::FastMonitoring);
201  // timers.push("CachedTrajectory::propagate::findClosestPoint",TimerStack::FastMonitoring);
202 
203  // Assume that all points along the trajectory are equally spread out.
204  // For simplication assume that the trajectory is just a straight
205  // line and find a point closest to the target plane. Propagate to
206  // the plane from the point.
207 
208  const float matchingDistance = 1;
209  // find the closest point to the plane
210  int leftIndex = 0;
211  int rightIndex = fullTrajectory_.size()-1;
212  int closestPointOnLeft = 0;
213 
214  // check whether the trajectory crossed the plane (signs should be different)
215  if ( sign( distance(plane, leftIndex) ) * sign( distance(plane, rightIndex) ) != -1 ) {
216  LogTrace("TrackAssociator") << "Track didn't cross the plane:\n\tleft distance: "<<distance(plane, leftIndex)
217  <<"\n\tright distance: " << distance(plane, rightIndex);
218  return TrajectoryStateOnSurface();
219  }
220 
221  while (leftIndex + 1 < rightIndex) {
222  closestPointOnLeft = int((leftIndex+rightIndex)/2);
223  float dist = distance(plane,closestPointOnLeft);
224  // LogTrace("TrackAssociator") << "Closest point on left: " << closestPointOnLeft << "\n"
225  // << "Distance to the plane: " << dist;
226  if (fabs(dist)<matchingDistance) {
227  // found close match, verify that we are on the left side
228  if (closestPointOnLeft>0 && sign( distance(plane, closestPointOnLeft-1) ) * dist == -1)
229  closestPointOnLeft--;
230  break;
231  }
232 
233  // check where is the plane
234  if (sign( distance(plane, leftIndex) * dist ) == -1)
235  rightIndex = closestPointOnLeft;
236  else
237  leftIndex = closestPointOnLeft;
238 
239  // LogTrace("TrackAssociator") << "Distance on left: " << distance(plane, leftIndex) << "\n"
240  // << "Distance to closest point: " << distance(plane, closestPointOnLeft) << "\n"
241  // << "Left index: " << leftIndex << "\n"
242  // << "Right index: " << rightIndex;
243 
244  }
245  LogTrace("TrackAssociator") << "closestPointOnLeft: " << closestPointOnLeft
246  << "\n\ttrajectory point (z,R,eta,phi): "
247  << fullTrajectory_[closestPointOnLeft].position().z() << ", "
248  << fullTrajectory_[closestPointOnLeft].position().perp() << " , "
249  << fullTrajectory_[closestPointOnLeft].position().eta() << " , "
250  << fullTrajectory_[closestPointOnLeft].position().phi()
251  << "\n\tplane center (z,R,eta,phi): "
252  << plane->position().z() << ", "
253  << plane->position().perp() << " , "
254  << plane->position().eta() << " , "
255  << plane->position().phi();
256 
257  // propagate to the plane
258  // timers.pop_and_push("CachedTrajectory::propagate::localPropagation",TimerStack::FastMonitoring);
259  if (const SteppingHelixPropagator* shp = dynamic_cast<const SteppingHelixPropagator*>(propagator_))
260  {
262  try {
263  state = shp->propagate(fullTrajectory_[closestPointOnLeft], *plane);
264  }
265  catch(cms::Exception &ex){
266  edm::LogWarning("TrackAssociator") <<
267  "Caught exception " << ex.category() << ": " << ex.explainSelf();
268  edm::LogWarning("TrackAssociator") << "An exception is caught during the track propagation\n"
269  << state.momentum().x() << ", " << state.momentum().y() << ", " << state.momentum().z();
270  return TrajectoryStateOnSurface();
271  }
272  return state.getStateOnSurface(*plane);
273  }
274  else
275  {
277  fullTrajectory_[closestPointOnLeft].getFreeState(fts);
278  return propagator_->propagate(fts, *plane);
279  }
280 }
T perp() const
Definition: PV3DBase.h:72
const Propagator * propagator_
virtual std::string explainSelf() const
Definition: Exception.cc:146
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
std::string const & category() const
Definition: Exception.cc:183
GlobalVector momentum() const
TrajectoryStateOnSurface getStateOnSurface(const Surface &surf, bool returnTangentPlane=false) const
T z() const
Definition: PV3DBase.h:64
#define LogTrace(id)
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:12
float distance(const Plane *plane, int index) dso_internal
std::deque< SteppingHelixStateInfo > fullTrajectory_
char state
Definition: procUtils.cc:75
T eta() const
Definition: PV3DBase.h:76
T x() const
Definition: PV3DBase.h:62
const PositionType & position() const
static int sign(float number) dso_internal
bool CachedTrajectory::propagateAll ( const SteppingHelixStateInfo initialState)
private

propagate through the whole detector, returns true if successful

Definition at line 127 of file CachedTrajectory.cc.

References edm::hlt::Exception, fullTrajectory_, fullTrajectoryFilled_, SteppingHelixStateInfo::isValid(), LogTrace, PV3DBase< T, PVType, FrameType >::mag(), maxRho_, maxZ_, minRho_, minZ_, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), SteppingHelixStateInfo::position(), propagateForward(), propagator_, reset_trajectory(), step_, and PV3DBase< T, PVType, FrameType >::z().

Referenced by propagateThoughFromIP().

128 {
129  if ( fullTrajectoryFilled_ ) {
130  edm::LogWarning("TrackAssociator") << "Reseting all trajectories. Please call reset_trajectory() explicitely to avoid this message";
132  }
133 
134 // TimerStack timers(TimerStack::Disableable);
135 
137  if (propagator_==0) throw cms::Exception("FatalError") << "Track propagator is not defined\n";
138  SteppingHelixStateInfo currentState(initialState);
139  fullTrajectory_.push_back(currentState);
140 
141  while (currentState.position().perp()<maxRho_ && fabs(currentState.position().z())<maxZ_ ){
142  LogTrace("TrackAssociator") << "[propagateAll] Propagate outward from (rho, r, z, phi) (" <<
143  currentState.position().perp() << ", " << currentState.position().mag() << ", " <<
144  currentState.position().z() << ", " << currentState.position().phi() << ")";
145  propagateForward(currentState,step_);
146  if (! currentState.isValid() ) {
147  LogTrace("TrackAssociator") << "Failed to propagate the track; moving on\n";
148  break;
149  }
150  LogTrace("TrackAssociator") << "\treached (rho, r, z, phi) (" <<
151  currentState.position().perp() << ", " << currentState.position().mag() << ", " <<
152  currentState.position().z() << ", " << currentState.position().phi() << ")";
153  fullTrajectory_.push_back(currentState);
154  }
155 
156 
157  SteppingHelixStateInfo currentState2(initialState);
158  SteppingHelixStateInfo previousState;
159  while (currentState2.position().perp()>minRho_ || fabs(currentState2.position().z())>minZ_) {
160  previousState=currentState2;
161  propagateForward(currentState2,-step_);
162  if (! currentState2.isValid() ) {
163  LogTrace("TrackAssociator") << "Failed to propagate the track; moving on\n";
164  break;
165  }
166  if(previousState.position().perp()- currentState2.position().perp() < 0) {
167  LogTrace("TrackAssociator") << "Error: TrackAssociator has propogated the particle past the point of closest approach to IP" << std::endl;
168  break;
169  }
170  LogTrace("TrackAssociator") << "[propagateAll] Propagated inward from (rho, r, z, phi) (" <<
171  previousState.position().perp() << ", " << previousState.position().mag() << ", " <<
172  previousState.position().z() << "," << previousState.position().phi() << ") to (" <<
173  currentState2.position().perp() << ", " << currentState2.position().mag() << ", " <<
174  currentState2.position().z() << ", " << currentState2.position().phi() << ")";
175  fullTrajectory_.push_front(currentState2);
176  }
177 
178 
179 
180 
181  // LogTrace("TrackAssociator") << "fullTrajectory_ has " << fullTrajectory_.size() << " states with (R, z):\n";
182  // for(unsigned int i=0; i<fullTrajectory_.size(); i++) {
183  // LogTrace("TrackAssociator") << "state " << i << ": (" << fullTrajectory_[i].position().perp() << ", "
184  // << fullTrajectory_[i].position().z() << ")\n";
185  // }
186 
187 
188 
189 
190 
191  LogTrace("TrackAssociator") << "Done with the track propagation in the detector. Number of steps: " << fullTrajectory_.size();
192  fullTrajectoryFilled_ = true;
193  return ! fullTrajectory_.empty();
194 }
T perp() const
Definition: PV3DBase.h:72
void reset_trajectory() dso_internal
const Propagator * propagator_
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
void propagateForward(SteppingHelixStateInfo &state, float distance) dso_internal
T mag() const
Definition: PV3DBase.h:67
GlobalPoint position() const
T phi() const
Definition: Phi.h:41
T z() const
Definition: PV3DBase.h:64
#define LogTrace(id)
std::deque< SteppingHelixStateInfo > fullTrajectory_
void CachedTrajectory::propagateForward ( SteppingHelixStateInfo state,
float  distance 
)
private

Definition at line 57 of file CachedTrajectory.cc.

References Plane::build(), distance(), SteppingHelixStateInfo::momentum(), SteppingHelixStateInfo::position(), funct::pow(), propagate(), dttmaxenums::r32, idealTransformation::rotation, mathSSE::sqrt(), filterCSVwithJSON::target, Vector3DBase< T, FrameTag >::unit(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by getTrajectory(), and propagateAll().

58 {
59  // defined a normal plane wrt the particle trajectory direction
60  // let's hope that I computed the rotation matrix correctly.
61  GlobalVector vector(state.momentum().unit());
62  float r21 = 0;
63  float r22 = vector.z()/sqrt(1-pow(vector.x(),2));
64  float r23 = -vector.y()/sqrt(1-pow(vector.x(),2));
65  float r31 = vector.x();
66  float r32 = vector.y();
67  float r33 = vector.z();
68  float r11 = r22*r33-r23*r32;
69  float r12 = r23*r31;
70  float r13 = -r22*r31;
71 
72  Surface::RotationType rotation(r11, r12, r13,
73  r21, r22, r23,
74  r31, r32, r33);
76  propagate(state, *target);
77 }
GlobalVector momentum() const
GlobalPoint position() const
T sqrt(T t)
Definition: SSEVec.h:48
static PlanePointer build(Args &&...args)
Definition: Plane.h:36
T z() const
Definition: PV3DBase.h:64
Vector3DBase unit() const
Definition: Vector3DBase.h:57
float distance(const Plane *plane, int index) dso_internal
void propagate(SteppingHelixStateInfo &state, const Plane &plane) dso_internal
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void CachedTrajectory::reset_trajectory ( )
private

Definition at line 445 of file CachedTrajectory.cc.

References ecalTrajectory_, fullTrajectory_, fullTrajectoryFilled_, hcalTrajectory_, hoTrajectory_, preshowerTrajectory_, wideEcalTrajectory_, wideHcalTrajectory_, and wideHOTrajectory_.

Referenced by CachedTrajectory(), propagateAll(), and propagateThoughFromIP().

445  {
446  fullTrajectory_.clear();
447  ecalTrajectory_.clear();
448  hcalTrajectory_.clear();
449  hoTrajectory_.clear();
450  preshowerTrajectory_.clear();
451  wideEcalTrajectory_.clear();
452  wideHcalTrajectory_.clear();
453  wideHOTrajectory_.clear();
454  fullTrajectoryFilled_ = false;
455 }
std::vector< SteppingHelixStateInfo > ecalTrajectory_
std::vector< GlobalPoint > wideHcalTrajectory_
std::vector< GlobalPoint > wideEcalTrajectory_
std::vector< SteppingHelixStateInfo > hoTrajectory_
std::vector< GlobalPoint > wideHOTrajectory_
std::vector< SteppingHelixStateInfo > preshowerTrajectory_
std::deque< SteppingHelixStateInfo > fullTrajectory_
std::vector< SteppingHelixStateInfo > hcalTrajectory_
void CachedTrajectory::setMaxDetectorLength ( float  l = 2200.)
inlineprivate

Definition at line 108 of file CachedTrajectory.h.

References prof2calltree::l, and maxZ_.

Referenced by CachedTrajectory(), and propagateThoughFromIP().

108 { maxZ_ = l/2.;}
void CachedTrajectory::setMaxDetectorRadius ( float  r = 800.)
inlineprivate

Definition at line 107 of file CachedTrajectory.h.

References maxRho_, and alignCSCRings::r.

Referenced by CachedTrajectory(), and propagateThoughFromIP().

void CachedTrajectory::setMaxHOLength ( float  l = 2200.)
inlineprivate

Definition at line 110 of file CachedTrajectory.h.

References HOmaxZ_, and prof2calltree::l.

110 { HOmaxZ_ = l/2.;}
void CachedTrajectory::setMaxHORadius ( float  r = 800.)
inlineprivate

Definition at line 109 of file CachedTrajectory.h.

References HOmaxRho_, and alignCSCRings::r.

void CachedTrajectory::setMinDetectorLength ( float  l = 0.)
inlineprivate

Definition at line 112 of file CachedTrajectory.h.

References prof2calltree::l, and minZ_.

Referenced by CachedTrajectory(), and propagateThoughFromIP().

112 { minZ_ = l/2.;}
void CachedTrajectory::setMinDetectorRadius ( float  r = 0.)
inlineprivate

Definition at line 111 of file CachedTrajectory.h.

References minRho_, and alignCSCRings::r.

Referenced by CachedTrajectory(), and propagateThoughFromIP().

void CachedTrajectory::setPropagationStep ( float  s = 20.)
inlineprivate

Definition at line 114 of file CachedTrajectory.h.

References alignCSCRings::s, and step_.

Referenced by CachedTrajectory(), and propagateThoughFromIP().

114 { step_ = s;}
void CachedTrajectory::setPropagator ( const Propagator ptr)
inlineprivate

Definition at line 75 of file CachedTrajectory.h.

References propagator_.

Referenced by propagateThoughFromIP().

75 { propagator_ = ptr; }
const Propagator * propagator_
void CachedTrajectory::setStateAtIP ( const SteppingHelixStateInfo state)
inlineprivate

Definition at line 76 of file CachedTrajectory.h.

References evf::utils::state, and stateAtIP_.

Referenced by propagateThoughFromIP().

76 { stateAtIP_ = state; }
SteppingHelixStateInfo stateAtIP_
char state
Definition: procUtils.cc:75
static int CachedTrajectory::sign ( float  number)
inlinestaticprotected

Definition at line 119 of file CachedTrajectory.h.

Referenced by propagate().

119  {
120  if (number ==0) return 0;
121  if (number > 0)
122  return 1;
123  else
124  return -1;
125  }
std::pair< float, float > CachedTrajectory::trajectoryDelta ( TrajectorType  trajectoryType)
private

calculate trajectory change (Theta,Phi) delta = final - original

Definition at line 282 of file CachedTrajectory.cc.

References delta(), ecalTrajectory_, FullTrajectory, fullTrajectory_, hcalTrajectory_, hoTrajectory_, IpToEcal, IpToHcal, IpToHO, SteppingHelixStateInfo::isValid(), SteppingHelixStateInfo::momentum(), PV3DBase< T, PVType, FrameType >::phi(), query::result, stateAtIP_, and PV3DBase< T, PVType, FrameType >::theta().

283 {
284  // MEaning of trajectory change depends on its usage. In most cases we measure
285  // change in a trajectory as difference between final track position and initial
286  // direction. In some cases such as change of trajectory in the muon detector we
287  // might want to compare theta-phi of two points or even find local maximum and
288  // mimimum. In general it's not essential what defenition of the trajectory change
289  // is used since we use these numbers only as a rough estimate on how much wider
290  // we should make the preselection region.
291  std::pair<float,float> result(0,0);
292  if ( ! stateAtIP_.isValid() ) {
293  edm::LogWarning("TrackAssociator") << "State at IP is not known set. Cannot estimate trajectory change. " <<
294  "Trajectory change is not taken into account in matching";
295  return result;
296  }
297  switch (trajectoryType) {
298  case IpToEcal:
299  if ( ecalTrajectory_.empty() )
300  edm::LogWarning("TrackAssociator") << "ECAL trajector is empty. Cannot estimate trajectory change. " <<
301  "Trajectory change is not taken into account in matching";
302  else return delta( stateAtIP_.momentum().theta(), ecalTrajectory_.front().position().theta(),
303  stateAtIP_.momentum().phi(), ecalTrajectory_.front().position().phi() );
304  break;
305  case IpToHcal:
306  if ( hcalTrajectory_.empty() )
307  edm::LogWarning("TrackAssociator") << "HCAL trajector is empty. Cannot estimate trajectory change. " <<
308  "Trajectory change is not taken into account in matching";
309  else return delta( stateAtIP_.momentum().theta(), hcalTrajectory_.front().position().theta(),
310  stateAtIP_.momentum().phi(), hcalTrajectory_.front().position().phi() );
311  break;
312  case IpToHO:
313  if ( hoTrajectory_.empty() )
314  edm::LogWarning("TrackAssociator") << "HO trajector is empty. Cannot estimate trajectory change. " <<
315  "Trajectory change is not taken into account in matching";
316  else return delta( stateAtIP_.momentum().theta(), hoTrajectory_.front().position().theta(),
317  stateAtIP_.momentum().phi(), hoTrajectory_.front().position().phi() );
318  break;
319  case FullTrajectory:
320  if ( fullTrajectory_.empty() )
321  edm::LogWarning("TrackAssociator") << "Full trajector is empty. Cannot estimate trajectory change. " <<
322  "Trajectory change is not taken into account in matching";
323  else return delta( stateAtIP_.momentum().theta(), fullTrajectory_.back().position().theta(),
324  stateAtIP_.momentum().phi(), fullTrajectory_.back().position().phi() );
325  break;
326  default:
327  edm::LogWarning("TrackAssociator") << "Unkown or not supported trajector type. Cannot estimate trajectory change. " <<
328  "Trajectory change is not taken into account in matching";
329  }
330  return result;
331 }
SteppingHelixStateInfo stateAtIP_
std::vector< SteppingHelixStateInfo > ecalTrajectory_
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
GlobalVector momentum() const
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
std::vector< SteppingHelixStateInfo > hoTrajectory_
tuple result
Definition: query.py:137
std::deque< SteppingHelixStateInfo > fullTrajectory_
std::pair< float, float > delta(const double &theta1, const double &theta2, const double &phi1, const double &phi2) dso_internal
std::vector< SteppingHelixStateInfo > hcalTrajectory_

Friends And Related Function Documentation

std::vector<SteppingHelixStateInfo> propagateThoughFromIP ( const SteppingHelixStateInfo state,
const Propagator ptr,
const FiducialVolume volume,
int  nsteps,
float  step,
float  minR,
float  minZ,
float  maxR,
float  maxZ 
)
friend

Definition at line 20 of file CachedTrajectory.cc.

22  {
23  CachedTrajectory neckLace;
24  neckLace.setStateAtIP(state);
25  neckLace.reset_trajectory();
26  neckLace.setPropagator(prop);
27  neckLace.setPropagationStep(0.1);
28  neckLace.setMinDetectorRadius(minR);
29  neckLace.setMinDetectorLength(minZ*2.);
30  neckLace.setMaxDetectorRadius(maxR);
31  neckLace.setMaxDetectorLength(maxZ*2.);
32 
33  // Propagate track
34  bool isPropagationSuccessful = neckLace.propagateAll(state);
35 
36  if (!isPropagationSuccessful)
37  return std::vector<SteppingHelixStateInfo> () ;
38 
39  std::vector<SteppingHelixStateInfo> complicatePoints;
40  neckLace.getTrajectory(complicatePoints, volume, nsteps);
41 
42  return complicatePoints;
43 
44 }
void setMaxDetectorLength(float l=2200.) dso_internal
void setMinDetectorRadius(float r=0.) dso_internal
void reset_trajectory() dso_internal
void setPropagationStep(float s=20.)
void setPropagator(const Propagator *ptr) dso_internal
void getTrajectory(std::vector< SteppingHelixStateInfo > &, const FiducialVolume &, int steps=4) dso_internal
bool propagateAll(const SteppingHelixStateInfo &initialState) dso_internal
propagate through the whole detector, returns true if successful
void setStateAtIP(const SteppingHelixStateInfo &state) dso_internal
void setMinDetectorLength(float l=0.) dso_internal
void setMaxDetectorRadius(float r=800.) dso_internal
friend class TrackDetectorAssociator
friend

Definition at line 49 of file CachedTrajectory.h.

Member Data Documentation

std::vector<SteppingHelixStateInfo> CachedTrajectory::ecalTrajectory_
protected
std::deque<SteppingHelixStateInfo> CachedTrajectory::fullTrajectory_
protected
bool CachedTrajectory::fullTrajectoryFilled_
protected

Definition at line 147 of file CachedTrajectory.h.

Referenced by getTrajectory(), propagateAll(), and reset_trajectory().

std::vector<SteppingHelixStateInfo> CachedTrajectory::hcalTrajectory_
protected
float CachedTrajectory::HOmaxRho_
protected

Definition at line 153 of file CachedTrajectory.h.

Referenced by setMaxHORadius().

float CachedTrajectory::HOmaxZ_
protected

Definition at line 154 of file CachedTrajectory.h.

Referenced by setMaxHOLength().

std::vector<SteppingHelixStateInfo> CachedTrajectory::hoTrajectory_
protected
float CachedTrajectory::maxRho_
protected

Definition at line 151 of file CachedTrajectory.h.

Referenced by propagateAll(), and setMaxDetectorRadius().

float CachedTrajectory::maxZ_
protected

Definition at line 152 of file CachedTrajectory.h.

Referenced by propagateAll(), and setMaxDetectorLength().

float CachedTrajectory::minRho_
protected

Definition at line 155 of file CachedTrajectory.h.

Referenced by propagateAll(), and setMinDetectorRadius().

float CachedTrajectory::minZ_
protected

Definition at line 156 of file CachedTrajectory.h.

Referenced by propagateAll(), and setMinDetectorLength().

std::vector<SteppingHelixStateInfo> CachedTrajectory::preshowerTrajectory_
protected
const Propagator* CachedTrajectory::propagator_
protected

Definition at line 149 of file CachedTrajectory.h.

Referenced by propagate(), propagateAll(), and setPropagator().

SteppingHelixStateInfo CachedTrajectory::stateAtIP_
protected

Definition at line 145 of file CachedTrajectory.h.

Referenced by setStateAtIP(), and trajectoryDelta().

float CachedTrajectory::step_
protected

Definition at line 157 of file CachedTrajectory.h.

Referenced by getPropagationStep(), propagateAll(), and setPropagationStep().

std::vector<GlobalPoint> CachedTrajectory::wideEcalTrajectory_
protected

Definition at line 142 of file CachedTrajectory.h.

Referenced by getWideTrajectory(), and reset_trajectory().

std::vector<GlobalPoint> CachedTrajectory::wideHcalTrajectory_
protected

Definition at line 143 of file CachedTrajectory.h.

Referenced by getWideTrajectory(), and reset_trajectory().

std::vector<GlobalPoint> CachedTrajectory::wideHOTrajectory_
protected

Definition at line 144 of file CachedTrajectory.h.

Referenced by getWideTrajectory(), and reset_trajectory().