test
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)
 
float distance (const Plane *plane, int index)
 

Static Protected Member Functions

static int sign (float number)
 

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

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 39 of file CachedTrajectory.h.

Member Enumeration Documentation

Enumerator
Ecal 
Hcal 
HO 

Definition at line 56 of file CachedTrajectory.h.

Constructor & Destructor Documentation

CachedTrajectory::CachedTrajectory ( )
private

Definition at line 47 of file CachedTrajectory.cc.

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

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

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 332 of file CachedTrajectory.cc.

References M_PI, and query::result.

Referenced by trajectoryDelta().

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

Definition at line 131 of file CachedTrajectory.h.

References fullTrajectory_, cmsHarvester::index, and position.

Referenced by propagate(), and propagateForward().

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

Definition at line 456 of file CachedTrajectory.cc.

References ecalTrajectory_, getTrajectory(), and LogTrace.

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

Definition at line 476 of file CachedTrajectory.cc.

References getTrajectory(), hcalTrajectory_, and LogTrace.

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

Definition at line 486 of file CachedTrajectory.cc.

References getTrajectory(), hoTrajectory_, and LogTrace.

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

Definition at line 462 of file CachedTrajectory.cc.

References getTrajectory(), LogTrace, and preshowerTrajectory_.

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

Definition at line 468 of file CachedTrajectory.cc.

References ecalTrajectory_.

Referenced by MuonCaloDistanceProducer::fillDistanceMap().

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

Definition at line 482 of file CachedTrajectory.cc.

References hcalTrajectory_.

Referenced by MuonCaloDistanceProducer::fillDistanceMap().

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

Definition at line 492 of file CachedTrajectory.cc.

References hoTrajectory_.

Referenced by MuonCaloDistanceProducer::fillDistanceMap().

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

Definition at line 623 of file CachedTrajectory.cc.

References fullTrajectory_.

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

Definition at line 631 of file CachedTrajectory.cc.

References fullTrajectory_.

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

Definition at line 472 of file CachedTrajectory.cc.

References preshowerTrajectory_.

Referenced by MuonCaloDistanceProducer::fillDistanceMap().

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

Definition at line 114 of file CachedTrajectory.h.

References step_.

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

Definition at line 590 of file CachedTrajectory.cc.

References ecalTrajectory_.

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

Definition at line 606 of file CachedTrajectory.cc.

References hcalTrajectory_.

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

Definition at line 614 of file CachedTrajectory.cc.

References hoTrajectory_.

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

Definition at line 598 of file CachedTrajectory.cc.

References preshowerTrajectory_.

599 {
600  if ( preshowerTrajectory_.empty() )
601  return SteppingHelixStateInfo();
602  else
603  return preshowerTrajectory_.front();
604 }
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 348 of file CachedTrajectory.cc.

References Reference_intrackfit_cff::barrel, Cylinder::build(), newFWLiteAna::build, PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, Reference_intrackfit_cff::endcap, Exception, fullTrajectory_, fullTrajectoryFilled_, i, FiducialVolume::isValid(), SteppingHelixStateInfo::isValid(), LogTrace, bookConverter::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(), z, and PV3DBase< T, PVType, FrameType >::z().

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

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

Definition at line 497 of file CachedTrajectory.cc.

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

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

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

79 {
80  if( const SteppingHelixPropagator* shp = dynamic_cast<const SteppingHelixPropagator*>(propagator_) )
81  {
82  try {
83  shp->propagate(state, plane, state);
84  }
85  catch(cms::Exception &ex){
86  edm::LogWarning("TrackAssociator") <<
87  "Caught exception " << ex.category() << ": " << ex.explainSelf();
88  edm::LogWarning("TrackAssociator") << "An exception is caught during the track propagation\n"
89  << state.momentum().x() << ", " << state.momentum().y() << ", " << state.momentum().z();
90  state = SteppingHelixStateInfo();
91  }
92  }
93  else
94  {
96  state.getFreeState( fts );
97  TrajectoryStateOnSurface stateOnSurface = propagator_->propagate(fts, plane);
98  state = SteppingHelixStateInfo( *(stateOnSurface.freeState()) );
99  }
100 }
virtual FreeTrajectoryState propagate(const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const final
Definition: Propagator.h:119
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 const * freeState(bool withErrors=true) const
T z() const
Definition: PV3DBase.h:64
T x() const
Definition: PV3DBase.h:62
void CachedTrajectory::propagate ( SteppingHelixStateInfo state,
const Cylinder cylinder 
)
private

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

103 {
104  if( const SteppingHelixPropagator* shp = dynamic_cast<const SteppingHelixPropagator*>(propagator_) )
105  {
106  try {
107  shp->propagate(state, cylinder,state);
108  }
109  catch(cms::Exception &ex){
110  edm::LogWarning("TrackAssociator") <<
111  "Caught exception " << ex.category() << ": " << ex.explainSelf();
112  edm::LogWarning("TrackAssociator") << "An exception is caught during the track propagation\n"
113  << state.momentum().x() << ", " << state.momentum().y() << ", " << state.momentum().z();
114  state = SteppingHelixStateInfo();
115  }
116  }
117  else
118  {
120  state.getFreeState( fts );
121  TrajectoryStateOnSurface stateOnSurface = propagator_->propagate(fts, cylinder);
122  state = SteppingHelixStateInfo( *(stateOnSurface.freeState()) );
123  }
124 }
virtual FreeTrajectoryState propagate(const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const final
Definition: Propagator.h:119
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 const * freeState(bool withErrors=true) const
T z() const
Definition: PV3DBase.h:64
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 195 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(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

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

propagate through the whole detector, returns true if successful

Definition at line 126 of file CachedTrajectory.cc.

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

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

Definition at line 56 of file CachedTrajectory.cc.

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

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

Definition at line 444 of file CachedTrajectory.cc.

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

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

444  {
445  fullTrajectory_.clear();
446  ecalTrajectory_.clear();
447  hcalTrajectory_.clear();
448  hoTrajectory_.clear();
449  preshowerTrajectory_.clear();
450  wideEcalTrajectory_.clear();
451  wideHcalTrajectory_.clear();
452  wideHOTrajectory_.clear();
453  fullTrajectoryFilled_ = false;
454 }
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 107 of file CachedTrajectory.h.

References prof2calltree::l, and maxZ_.

Referenced by CachedTrajectory(), and propagateThoughFromIP().

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

Definition at line 106 of file CachedTrajectory.h.

References maxRho_, and alignCSCRings::r.

Referenced by CachedTrajectory(), and propagateThoughFromIP().

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

Definition at line 109 of file CachedTrajectory.h.

References HOmaxZ_, and prof2calltree::l.

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

Definition at line 108 of file CachedTrajectory.h.

References HOmaxRho_, and alignCSCRings::r.

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

Definition at line 111 of file CachedTrajectory.h.

References prof2calltree::l, and minZ_.

Referenced by CachedTrajectory(), and propagateThoughFromIP().

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

Definition at line 110 of file CachedTrajectory.h.

References minRho_, and alignCSCRings::r.

Referenced by CachedTrajectory(), and propagateThoughFromIP().

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

Definition at line 113 of file CachedTrajectory.h.

References alignCSCRings::s, and step_.

Referenced by CachedTrajectory(), and propagateThoughFromIP().

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

Definition at line 74 of file CachedTrajectory.h.

References propagator_.

Referenced by propagateThoughFromIP().

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

Definition at line 75 of file CachedTrajectory.h.

References stateAtIP_.

Referenced by propagateThoughFromIP().

75 { stateAtIP_ = state; }
SteppingHelixStateInfo stateAtIP_
static int CachedTrajectory::sign ( float  number)
inlinestaticprotected

Definition at line 118 of file CachedTrajectory.h.

References contentValuesFiles::number.

Referenced by propagate().

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

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

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

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

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

Definition at line 48 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 146 of file CachedTrajectory.h.

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

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

Definition at line 152 of file CachedTrajectory.h.

Referenced by setMaxHORadius().

float CachedTrajectory::HOmaxZ_
protected

Definition at line 153 of file CachedTrajectory.h.

Referenced by setMaxHOLength().

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

Definition at line 150 of file CachedTrajectory.h.

Referenced by propagateAll(), and setMaxDetectorRadius().

float CachedTrajectory::maxZ_
protected

Definition at line 151 of file CachedTrajectory.h.

Referenced by propagateAll(), and setMaxDetectorLength().

float CachedTrajectory::minRho_
protected

Definition at line 154 of file CachedTrajectory.h.

Referenced by propagateAll(), and setMinDetectorRadius().

float CachedTrajectory::minZ_
protected

Definition at line 155 of file CachedTrajectory.h.

Referenced by propagateAll(), and setMinDetectorLength().

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

Definition at line 148 of file CachedTrajectory.h.

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

SteppingHelixStateInfo CachedTrajectory::stateAtIP_
protected

Definition at line 144 of file CachedTrajectory.h.

Referenced by setStateAtIP(), and trajectoryDelta().

float CachedTrajectory::step_
protected

Definition at line 156 of file CachedTrajectory.h.

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

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

Definition at line 141 of file CachedTrajectory.h.

Referenced by getWideTrajectory(), and reset_trajectory().

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

Definition at line 142 of file CachedTrajectory.h.

Referenced by getWideTrajectory(), and reset_trajectory().

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

Definition at line 143 of file CachedTrajectory.h.

Referenced by getWideTrajectory(), and reset_trajectory().