CMS 3D CMS Logo

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

#include <HICTrajectoryBuilder.h>

Inheritance diagram for HICTrajectoryBuilder:
BaseCkfTrajectoryBuilder TrajectoryBuilder

Public Types

typedef std::vector
< TempTrajectory
TempTrajectoryContainer
 
typedef std::vector< TrajectoryTrajectoryContainer
 
- Public Types inherited from BaseCkfTrajectoryBuilder
typedef std::vector
< TempTrajectory
TempTrajectoryContainer
 
typedef std::vector< TrajectoryTrajectoryContainer
 
typedef
TrajectoryContainer::iterator 
TrajectoryIterator
 
- Public Types inherited from TrajectoryBuilder
typedef std::vector< TrajectoryTrajectoryContainer
 
typedef
TrajectoryContainer::iterator 
TrajectoryIterator
 

Public Member Functions

 HICTrajectoryBuilder (const edm::ParameterSet &conf, const edm::EventSetup &es, const TrajectoryStateUpdator *updator, const Propagator *propagatorAlong, const Propagator *propagatorOpposite, const Chi2MeasurementEstimatorBase *estimator, const TransientTrackingRecHitBuilder *RecHitBuilder, const MeasurementTracker *measurementTracker, const TrajectoryFilter *filter)
 
virtual void setEvent (const edm::Event &event) const
 set Event for the internal MeasurementTracker data member More...
 
virtual void settracker (const MeasurementTracker *measurementTracker)
 
virtual TrajectoryContainer trajectories (const TrajectorySeed &seed) const
 trajectories building starting from a seed More...
 
 ~HICTrajectoryBuilder ()
 
- Public Member Functions inherited from BaseCkfTrajectoryBuilder
 BaseCkfTrajectoryBuilder (const edm::ParameterSet &conf, const TrajectoryStateUpdator *updator, const Propagator *propagatorAlong, const Propagator *propagatorOpposite, const Chi2MeasurementEstimatorBase *estimator, const TransientTrackingRecHitBuilder *RecHitBuilder, const MeasurementTracker *measurementTracker, const TrajectoryFilter *filter, const TrajectoryFilter *inOutFilter=0)
 
virtual void setDebugger (CkfDebugger *dbg) const
 
virtual void unset () const
 
virtual ~BaseCkfTrajectoryBuilder ()
 
- Public Member Functions inherited from TrajectoryBuilder
virtual void rebuildSeedingRegion (const TrajectorySeed &, TrajectoryContainer &result) const
 
virtual void trajectories (const TrajectorySeed &seed, TrajectoryContainer &out) const
 
virtual ~TrajectoryBuilder ()
 

Protected Types

typedef TrajectoryMeasurement TM
 
typedef TrajectoryStateOnSurface TSOS
 
- Protected Types inherited from BaseCkfTrajectoryBuilder
typedef FreeTrajectoryState FTS
 
typedef std::pair< TSOS,
std::vector< const DetLayer * > > 
StateAndLayers
 
typedef TrajectoryMeasurement TM
 
typedef TrajectoryStateOnSurface TSOS
 

Private Member Functions

void addToResult (TempTrajectory &traj, TrajectoryContainer &result) const
 
TempTrajectory createStartingTrajectory (const TrajectorySeed &seed) const
 
std::vector
< TrajectoryMeasurement
findCompatibleMeasurements (const TempTrajectory &traj) const
 
void limitedCandidates (TempTrajectory &startingTraj, TrajectoryContainer &result) const
 
bool qualityFilter (const TempTrajectory &traj) const
 
std::vector
< TrajectoryMeasurement
seedMeasurements (const TrajectorySeed &seed) const
 
bool toBeContinued (const TempTrajectory &traj) const
 
bool updateTrajectory (TempTrajectory &traj, const TM &tm) const
 

Private Attributes

edm::ESHandle
< GlobalTrackingGeometry
globTkGeomHandle
 
bool theAlwaysUseInvalidHits
 
const PropagatortheBackwardPropagator
 
const
Chi2MeasurementEstimatorBase
theEstimator
 
edm::ESHandle< TrajectoryFittertheFitterTrack
 
const PropagatortheForwardPropagator
 
cms::HICConsttheHICConst
 
bool theIntermediateCleaning
 
const LayerMeasurementstheLayerMeasurements
 
float theLostHitPenalty
 
int theMaxCand
 
int theMaxConsecLostHit
 
TrajectoryFiltertheMaxHitsCondition
 
int theMaxLostHit
 
const MeasurementTrackertheMeasurementTracker
 
int theMinimumNumberOfHits
 
TrajectoryFiltertheMinPtCondition
 
const PropagatorthePropagatorAlong
 
const PropagatorthePropagatorOpposite
 
edm::ESHandle< PropagatorthePropagatorTrack
 
edm::ESHandle< TrajectorySmoothertheSmootherTrack
 
const
TransientTrackingRecHitBuilder
theTTRHBuilder
 
const TrajectoryStateUpdatortheUpdator
 

Additional Inherited Members

- Protected Member Functions inherited from BaseCkfTrajectoryBuilder
void addToResult (TempTrajectory &traj, TrajectoryContainer &result, bool inOut=false) const
 
void addToResult (TempTrajectory &traj, TempTrajectoryContainer &result, bool inOut=false) const
 
virtual bool analyzeMeasurementsDebugger (Trajectory &traj, std::vector< TrajectoryMeasurement > meas, const MeasurementTracker *theMeasurementTracker, const Propagator *theForwardPropagator, const Chi2MeasurementEstimatorBase *theEstimator, const TransientTrackingRecHitBuilder *theTTRHBuilder) const
 
virtual bool analyzeMeasurementsDebugger (TempTrajectory &traj, std::vector< TrajectoryMeasurement > meas, const MeasurementTracker *theMeasurementTracker, const Propagator *theForwardPropagator, const Chi2MeasurementEstimatorBase *theEstimator, const TransientTrackingRecHitBuilder *theTTRHBuilder) const
 
TempTrajectory createStartingTrajectory (const TrajectorySeed &seed) const
 
virtual void fillSeedHistoDebugger (std::vector< TrajectoryMeasurement >::iterator begin, std::vector< TrajectoryMeasurement >::iterator end) const
 
StateAndLayers findStateAndLayers (const TempTrajectory &traj) const
 
bool qualityFilter (const TempTrajectory &traj, bool inOut=false) const
 
bool toBeContinued (TempTrajectory &traj, bool inOut=false) const
 
- Protected Attributes inherited from BaseCkfTrajectoryBuilder
const PropagatortheBackwardPropagator
 
const
Chi2MeasurementEstimatorBase
theEstimator
 
const PropagatortheForwardPropagator
 
const LayerMeasurementstheLayerMeasurements
 
const MeasurementTrackertheMeasurementTracker
 
const PropagatorthePropagatorAlong
 
const PropagatorthePropagatorOpposite
 
const
TransientTrackingRecHitBuilder
theTTRHBuilder
 
const TrajectoryStateUpdatortheUpdator
 

Detailed Description

Definition at line 40 of file HICTrajectoryBuilder.h.

Member Typedef Documentation

Definition at line 49 of file HICTrajectoryBuilder.h.

Definition at line 44 of file HICTrajectoryBuilder.h.

Definition at line 48 of file HICTrajectoryBuilder.h.

Definition at line 43 of file HICTrajectoryBuilder.h.

Constructor & Destructor Documentation

HICTrajectoryBuilder::HICTrajectoryBuilder ( const edm::ParameterSet conf,
const edm::EventSetup es,
const TrajectoryStateUpdator updator,
const Propagator propagatorAlong,
const Propagator propagatorOpposite,
const Chi2MeasurementEstimatorBase estimator,
const TransientTrackingRecHitBuilder RecHitBuilder,
const MeasurementTracker measurementTracker,
const TrajectoryFilter filter 
)

Definition at line 46 of file HICTrajectoryBuilder.cc.

References gather_cfg::cout, edm::EventSetup::get(), globTkGeomHandle, theAlwaysUseInvalidHits, theFitterTrack, theIntermediateCleaning, theLostHitPenalty, theMaxCand, theMaxConsecLostHit, theMaxLostHit, theMinimumNumberOfHits, thePropagatorTrack, and theSmootherTrack.

54  :
55 
57  updator, propagatorAlong,propagatorOpposite,
58  estimator, RecHitBuilder, measurementTracker,filter),
59  theUpdator(updator),thePropagatorAlong(propagatorAlong),
60  thePropagatorOpposite(propagatorOpposite),theEstimator(estimator),
61  theTTRHBuilder(RecHitBuilder),theMeasurementTracker(measurementTracker),
64 {
65  theMaxCand = 1;
66  theMaxLostHit = 0;
68  theLostHitPenalty = 0.;
73 // es1.get<TrackingComponentsRecord>().get("KFFitterForRefitInsideOut",theFitterTrack);
74 // es1.get<TrackingComponentsRecord>().get("KFSmootherForRefitInsideOut",theSmootherTrack);
75  es1.get<TrajectoryFitter::Record>().get("KFFitterForRefitInsideOut",theFitterTrack);
76  es1.get<TrajectoryFitter::Record>().get("KFSmootherForRefitInsideOut",theSmootherTrack);
77  es1.get<TrackingComponentsRecord>().get("SmartPropagatorAny",thePropagatorTrack);
78 
79 #ifdef DEBUG
80  cout<<" HICTrajectoryBuilder::contructor "<<endl;
81 #endif
82 }
edm::ESHandle< Propagator > thePropagatorTrack
const Propagator * thePropagatorOpposite
const MeasurementTracker * theMeasurementTracker
BaseCkfTrajectoryBuilder(const edm::ParameterSet &conf, const TrajectoryStateUpdator *updator, const Propagator *propagatorAlong, const Propagator *propagatorOpposite, const Chi2MeasurementEstimatorBase *estimator, const TransientTrackingRecHitBuilder *RecHitBuilder, const MeasurementTracker *measurementTracker, const TrajectoryFilter *filter, const TrajectoryFilter *inOutFilter=0)
const Chi2MeasurementEstimatorBase * theEstimator
edm::ESHandle< GlobalTrackingGeometry > globTkGeomHandle
const TransientTrackingRecHitBuilder * theTTRHBuilder
const LayerMeasurements * theLayerMeasurements
const Propagator * thePropagatorAlong
const Propagator * theForwardPropagator
const TrajectoryStateUpdator * theUpdator
const Propagator * theBackwardPropagator
edm::ESHandle< TrajectorySmoother > theSmootherTrack
tuple cout
Definition: gather_cfg.py:121
edm::ESHandle< TrajectoryFitter > theFitterTrack
HICTrajectoryBuilder::~HICTrajectoryBuilder ( )

Definition at line 84 of file HICTrajectoryBuilder.cc.

References theLayerMeasurements.

85 {
86  delete theLayerMeasurements;
87 // delete theMinPtCondition;
88 // delete theMaxHitsCondition;
89 }
const LayerMeasurements * theLayerMeasurements

Member Function Documentation

void HICTrajectoryBuilder::addToResult ( TempTrajectory traj,
TrajectoryContainer result 
) const
private

Definition at line 418 of file HICTrajectoryBuilder.cc.

References TempTrajectory::toTrajectory().

Referenced by limitedCandidates().

420 {
421  Trajectory traj = tmptraj.toTrajectory();
422  result.push_back( traj);
423 }
Trajectory toTrajectory() const
Convert to a standard Trajectory.
tuple result
Definition: query.py:137
TempTrajectory HICTrajectoryBuilder::createStartingTrajectory ( const TrajectorySeed seed) const
private

Definition at line 128 of file HICTrajectoryBuilder.cc.

References gather_cfg::cout, TrajectorySeed::direction(), i, oppositeToMomentum, TempTrajectory::push(), query::result, seedMeasurements(), theBackwardPropagator, and theForwardPropagator.

Referenced by trajectories().

129 {
130 #ifdef DEBUG
131  cout<<" HICTrajectoryBuilder::createStartingTrajectory "<<seed.direction()<<endl;
132 #endif
134  theForwardPropagator = &(*thePropagatorOpposite);
135  theBackwardPropagator = &(*thePropagatorAlong);
136 
137  std::vector<TM> seedMeas = seedMeasurements(seed);
138 
139 #ifdef DEBUG
140  std::cout<<" Size of seed "<<seedMeas.size()<<endl;
141 #endif
142  if ( !seedMeas.empty()) {
143 #ifdef DEBUG
144  std::cout<<" TempTrajectory "<<std::endl;
145 #endif
146  for (std::vector<TM>::const_iterator i=seedMeas.begin(); i!=seedMeas.end(); i++){
147 
148  result.push(*i);
149 
150 
151  }
152  }
153 
154  return result;
155 
156 }
PropagationDirection direction() const
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: query.py:137
const Propagator * theForwardPropagator
std::vector< TrajectoryMeasurement > seedMeasurements(const TrajectorySeed &seed) const
const Propagator * theBackwardPropagator
tuple cout
Definition: gather_cfg.py:121
std::vector< TrajectoryMeasurement > HICTrajectoryBuilder::findCompatibleMeasurements ( const TempTrajectory traj) const
private

Definition at line 528 of file HICTrajectoryBuilder.cc.

References abs, accept(), GeomDetEnumerators::barrel, GlobalTrajectoryParameters::charge(), HICMeasurementEstimator::chooseCuts(), HICTrajectoryCorrector::correct(), gather_cfg::cout, TempTrajectory::direction(), GeomDetEnumerators::endcap, HICMeasurementEstimator::estimate(), TrajectoryMeasurement::estimate(), first, TrajectoryStateOnSurface::freeTrajectoryState(), cmsutils::bqueue< T >::front(), HICMeasurementEstimator::getField(), TrajectoryStateOnSurface::isValid(), TempTrajectory::lastLayer(), Trajectory::lastMeasurement(), TempTrajectory::lastMeasurement(), TrajectoryMeasurement::layer(), DetLayer::location(), LayerMeasurements::measurements(), Trajectory::measurements(), TempTrajectory::measurements(), GlobalTrajectoryParameters::momentum(), DetLayer::nextLayers(), FreeTrajectoryState::parameters(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), GeomDetEnumerators::PixelEndcap, GlobalTrajectoryParameters::position(), TrajectoryMeasurement::predictedState(), TrajectoryMeasurement::recHit(), query::result, HICMeasurementEstimator::setCuts(), python.multivaluedict::sort(), GeomDetEnumerators::TEC, theEstimator, theForwardPropagator, theHICConst, theLayerMeasurements, GeomDetEnumerators::TID, tmp, TempTrajectory::toTrajectory(), TrajectoryMeasurement::updatedState(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by limitedCandidates().

529 {
530  //cout<<" HICTrajectoryBuilder::FindCompatibleMeasurement start "<<traj.empty()<<endl;
531  vector<TM> result;
532  // int invalidHits = 0;
533  int theLowMult = 1;
534 
535  TSOS currentState( traj.lastMeasurement().updatedState());
536 
537  vector<const DetLayer*> nl =
538  traj.lastLayer()->nextLayers( *currentState.freeState(), traj.direction());
539 #ifdef DEBUG
540  std::cout<<" Number of layers "<<nl.size()<<std::endl;
541 #endif
542 
543  if (nl.empty()) return result;
544 
545  int seedLayerCode = dynamic_cast<HICMeasurementEstimator*>(const_cast<Chi2MeasurementEstimatorBase*>(theEstimator))->
546  getDetectorCode(traj.measurements().front().layer());
547 #ifdef DEBUG
548  std::cout<<"findCompatibleMeasurements Point 0 "<<seedLayerCode<<std::endl;
549 #endif
550 
551  int currentLayerCode = dynamic_cast<HICMeasurementEstimator*>(const_cast<Chi2MeasurementEstimatorBase*>(theEstimator))->
552  getDetectorCode(traj.lastLayer());
553 #ifdef DEBUG
554  std::cout<<"findCompatibleMeasurements Point 1 "<<currentLayerCode<<std::endl;
555 #endif
556  for (vector<const DetLayer*>::iterator il = nl.begin();
557  il != nl.end(); il++) {
558 
559  int nextLayerCode = dynamic_cast<HICMeasurementEstimator*>(const_cast<Chi2MeasurementEstimatorBase*>(theEstimator))->
560  getDetectorCode((*il));
561 #ifdef DEBUG
562  std::cout<<"findCompatibleMeasurements Point 2 "<<nextLayerCode<<std::endl;
563 #endif
564 
565  if( traj.lastLayer()->location() == GeomDetEnumerators::endcap && (**il).location() == GeomDetEnumerators::barrel )
566  {
567  if( abs(seedLayerCode) > 100 && abs(seedLayerCode) < 108 )
568  {
569  if( (**il).subDetector() == GeomDetEnumerators::PixelEndcap ) continue;
570  } // 100-108
571  else
572  {
573  if(theLowMult == 0 )
574  {
575  if( nextLayerCode == 0 ) continue;
576  }
577  if( (**il).subDetector() == GeomDetEnumerators::TID || (**il).subDetector() == GeomDetEnumerators::TEC) continue;
578  } // 100-108
579  } // barrel and endcap
580 
581  if( currentLayerCode == 101 && nextLayerCode < 100 ) {
582  continue;
583  } // currentLayer-nextLayer
584 #ifdef DEBUG
585  std::cout<<" findCompatibleMeasurements Point 3 "<<nextLayerCode<<std::endl;
586 #endif
587 
588  Trajectory traj0 = traj.toTrajectory();
589 
590  vector<double> theCut = dynamic_cast<HICMeasurementEstimator*>(const_cast<Chi2MeasurementEstimatorBase*>(theEstimator))->setCuts(traj0,(*il));
591 
592  // Choose Win
593  int icut = 1;
595 #ifdef DEBUG
596  std::cout<<" findCompatibleMeasurements::current state : "<<
597  " charge "<< currentState.freeTrajectoryState()->parameters().charge()<<
598  " pt "<<currentState.freeTrajectoryState()->parameters().momentum().perp()<<
599  " pz "<<currentState.freeTrajectoryState()->parameters().momentum().z()<<
600  " r "<<currentState.freeTrajectoryState()->parameters().position().perp()<<
601  " phi "<<currentState.freeTrajectoryState()->parameters().position().phi()<<
602  " z "<<currentState.freeTrajectoryState()->parameters().position().z()<<
603  endl;
604 #endif
605  const MagneticField * mf = dynamic_cast<HICMeasurementEstimator*>(const_cast<Chi2MeasurementEstimatorBase*>(theEstimator))->getField();
606  vector<TM> tmp0;
607 
608 //
609 // We must check the charge of the high pt track after first step
610 //
611 
612 /*
613  if(abs(currentLayerCode) > 100&&traj0.measurements().size()>1) {
614  HICMuonPropagator hmp(mf);
615 #ifdef DEBUG
616  std::cout<<" findCompatibleMeasurements::HICMuonPropagator::for forward::start "<<std::endl;
617 #endif
618  tmp0 =
619  theLayerMeasurements->measurements((**il), currentState, hmp, *theEstimator);
620  for( vector<TM>::iterator itm = tmp0.begin(); itm != tmp0.end(); itm++ )
621  {
622  TM tm = (*itm);
623  TSOS predictedState = tm.predictedState();
624  TM::ConstRecHitPointer hit = tm.recHit();
625  TSOS updateState = traj0.lastMeasurement().updatedState();
626 #ifdef DEBUG
627  std::cout<<" findCompatibleMeasurements::Size of trajectory "<<traj0.measurements().size()<<
628  " valid updated state "<< updateState.isValid()<<" Predicted state is valid "
629  <<predictedState.isValid()<<
630  " charge "<< predictedState.freeTrajectoryState()->parameters().charge()<<
631  " pt "<<predictedState.freeTrajectoryState()->parameters().momentum().perp()<<
632  " pz "<<predictedState.freeTrajectoryState()->parameters().momentum().z()<<
633  " r "<<predictedState.freeTrajectoryState()->parameters().position().perp()<<
634  " phi "<<predictedState.freeTrajectoryState()->parameters().position().phi()<<
635  " z "<<predictedState.freeTrajectoryState()->parameters().position().z()<<
636  std::endl;
637 #endif
638  }
639 #ifdef DEBUG
640  std::cout<<" findCompatibleMeasurements::HICMuonPropagator::for forward::end "<<std::endl;
641 #endif
642  }
643 */
644  tmp0 = theLayerMeasurements->measurements((**il), currentState, *theForwardPropagator, *theEstimator);
645 
646 #ifdef DEBUG
647  std::cout<<" findCompatibleMeasurements Point 6 "<<theCut[0]<<" "<<theCut[1]<<std::endl;
648  std::cout<<" findCompatibleMeasurements Point 7 "<<traj0.measurements().size()<<std::endl;
649 #endif
650 //
651 // ========================= Choose Cut and filter =================================
652 //
653  vector<TM> tmp;
654  icut = 2;
656 #ifdef DEBUG
657  std::cout<<" findCompatibleMeasurements Point 8 "<<theCut[0]<<" "<<theCut[1]<<" Size of candidates "<<tmp0.size()<<std::endl;
658 #endif
659  int numtmp = 0;
660  for( vector<TM>::iterator itm = tmp0.begin(); itm != tmp0.end(); itm++ )
661  {
662  TM tm = (*itm);
663  TSOS predictedState = tm.predictedState();
664  TM::ConstRecHitPointer hit = tm.recHit();
665  TSOS updateState = traj0.lastMeasurement().updatedState();
666 //
667 // If track is not valid - stop with this hit
668 //
669  if(!(*hit).isValid()) {
670 #ifdef DEBUG
671  cout<<" findCompatibleMeasurements::hit is not valid "<<endl;
672 #endif
673  continue;
674  }
675 
676 #ifdef DEBUG
677  std::cout<<" findCompatibleMeasurements::Size of trajectory "<<traj0.measurements().size()
678  <<" Number of TM "<< numtmp<<
679  " valid updated state "<< updateState.isValid()<<" Predicted state is valid "
680  <<predictedState.isValid()<<
681  " charge "<< predictedState.freeTrajectoryState()->parameters().charge()<<
682  " pt "<<predictedState.freeTrajectoryState()->parameters().momentum().perp()<<
683  " pz "<<predictedState.freeTrajectoryState()->parameters().momentum().z()<<
684  " r "<<predictedState.freeTrajectoryState()->parameters().position().perp()<<
685  " phi "<<predictedState.freeTrajectoryState()->parameters().position().phi()<<
686  " z "<<predictedState.freeTrajectoryState()->parameters().position().z()<<
687  std::endl;
688 #endif
689 
690  if( traj0.measurements().size() == 1 )
691  {
692 #ifdef DEBUG
693  std::cout<<" findCompatibleMeasurements::start corrector "<<std::endl;
694 #endif
695  HICTrajectoryCorrector theCorrector(mf,theHICConst);
696 #ifdef DEBUG
697  std::cout<<" findCompatibleMeasurements::corrector::initialized "<<std::endl;
698 #endif
699  TSOS predictedState0 = theCorrector.correct( (*traj0.lastMeasurement().updatedState().freeTrajectoryState()),
700  (*(predictedState.freeTrajectoryState())),
701  hit->det() );
702 #ifdef DEBUG
703  std::cout<<" findCompatibleMeasurements::end corrector "<<std::endl;
704 #endif
705  if(predictedState0.isValid())
706  {
707 #ifdef DEBUG
708  std::cout<<" Accept the corrected state "<<numtmp<<" Hit Valid "<<(*hit).isValid()<<std::endl;
709 #endif
710  predictedState = predictedState0;
711 
712  if((*hit).isValid())
713  {
714 #ifdef DEBUG
715  std::cout<<" findCompatibleMeasurements::end corrector::hit valid "<<std::endl;
716 #endif
717  bool accept= true;
718  accept = (dynamic_cast<HICMeasurementEstimator*>(const_cast<Chi2MeasurementEstimatorBase*>(theEstimator))->estimate(predictedState,*hit)).first;
719 
720  if(!accept) {
721 #ifdef DEBUG
722  std::cout<<" findCompatibleMeasurements::failed after the first step "<<numtmp<<std::endl;
723 #endif
724  numtmp++;
725  continue;
726  } // accept
727 #ifdef DEBUG
728  std::cout<<" findCompatibleMeasurements::estimate at the first step is ok "<<numtmp<<std::endl;
729 #endif
730 // Add trajectory measurements
731  tmp.push_back(TM(predictedState, updateState, hit, tm.estimate(), tm.layer()));
732 #ifdef DEBUG
733  std::cout<<" findCompatibleMeasurements::fill estimate "<<numtmp<<std::endl;
734 #endif
735  } // Hit Valid
736 
737  } // predicted state is valid
738  } // first step
739  else
740  {
741 // tmp.push_back(TM(predictedState, updateState, hit, tm.estimate(), tm.layer()));
742 #ifdef DEBUG
743  std::cout<<" findCompatibleMeasurements::Add TM to collection::Predicted state is valid "<<predictedState.isValid()<<" Hit is valid "<<(*hit).isValid()<<std::endl;
744 #endif
745  if( predictedState.isValid() && (*hit).isValid() ) tmp.push_back(*itm);
746  }
747  numtmp++;
748 
749  } // tm
750 #ifdef DEBUG
751  std::cout<<" findCompatibleMeasurements::point 9 "<<std::endl;
752 #endif
753  if ( !tmp.empty()) {
754  if ( result.empty() ) result = tmp;
755  else {
756  // keep one dummy TM at the end, skip the others
757  result.insert( result.end(), tmp.begin(), tmp.end());
758  }
759  }
760  // std::cout<<" Results size "<<result.size()<<std::endl;
761  } // next layers
762 
763  // sort the final result, keep dummy measurements at the end
764  if ( result.size() > 1) {
765  sort( result.begin(), result.end(), TrajMeasLessEstim());
766  }
767 #ifdef DEBUG
768  std::cout<<" findCompatibleMeasurements::point 10 "<<std::endl;
769 #endif
770  return result;
771 }
std::vector< TrajectoryMeasurement > measurements(const DetLayer &layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
T perp() const
Definition: PV3DBase.h:71
virtual Location location() const =0
Which part of the detector (barrel, endcap)
const GlobalTrajectoryParameters & parameters() const
FreeTrajectoryState * freeTrajectoryState(bool withErrors=true) const
const DataContainer & measurements() const
virtual std::vector< const DetLayer * > nextLayers(NavigationDirection direction) const
Definition: DetLayer.cc:35
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
#define abs(x)
Definition: mlp_lapack.h:159
virtual std::vector< double > setCuts(Trajectory &traj, const DetLayer *theCurrentLayer)
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:22
const Chi2MeasurementEstimatorBase * theEstimator
const TrajectoryMeasurement & lastMeasurement() const
PropagationDirection direction() const
DataContainer const & measurements() const
Definition: Trajectory.h:203
Trajectory toTrajectory() const
Convert to a standard Trajectory.
const MagneticField * getField()
TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:181
const LayerMeasurements * theLayerMeasurements
T z() const
Definition: PV3DBase.h:63
tuple result
Definition: query.py:137
const DetLayer * layer() const
TrajectoryStateOnSurface updatedState() const
cms::HICConst * theHICConst
bool first
Definition: L1TdeRCT.cc:94
const Propagator * theForwardPropagator
TrajectoryMeasurement TM
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
tuple cout
Definition: gather_cfg.py:121
virtual std::pair< bool, double > estimate(const TrajectoryStateOnSurface &, const TransientTrackingRecHit &) const
const DetLayer * lastLayer() const
Redundant method, returns the layer of lastMeasurement() .
void HICTrajectoryBuilder::limitedCandidates ( TempTrajectory startingTraj,
TrajectoryContainer result 
) const
private

Definition at line 159 of file HICTrajectoryBuilder.cc.

References addToResult(), gather_cfg::cout, findCompatibleMeasurements(), TempTrajectory::measurements(), qualityFilter(), HICMeasurementEstimator::setSign(), cmsutils::bqueue< T >::size(), theEstimator, theMaxCand, toBeContinued(), and updateTrajectory().

Referenced by trajectories().

161 {
162  TempTrajectoryContainer candidates; // = TrajectoryContainer();
163  TempTrajectoryContainer newCand; // = TrajectoryContainer();
164  candidates.push_back( startingTraj);
165 // Add the additional stuff
166 #ifdef DEBUG
167  cout<<" HICTrajectoryBuilder::limitedCandidates "<<candidates.size()<<endl;
168 #endif
169 
170  int theIniSign = 1;
171  dynamic_cast<HICMeasurementEstimator*>(const_cast<Chi2MeasurementEstimatorBase*>(theEstimator))->setSign(theIniSign);
172 #ifdef DEBUG
173  cout<<" Number of measurements "<<startingTraj.measurements().size()<<endl;
174 #endif
175 //
176 // Calculate the number of final trajectories. Allow no more then 4.
177 //
178 
179  int numtraj = 0;
180 
181  while ( !candidates.empty()) {
182 #ifdef DEBUG
183  cout<<" HICTrajectoryBuilder::limitedCandidates::cycle "<<candidates.size()<<endl;
184 #endif
185  newCand.clear();
186 
187  for (TempTrajectoryContainer::iterator traj=candidates.begin();
188  traj!=candidates.end(); traj++) {
189 #ifdef DEBUG
190  cout<< " Before findCompatibleMeasurements "<<endl;
191 #endif
192  std::vector<TM> meas = findCompatibleMeasurements(*traj);
193 #ifdef DEBUG
194  cout<< " After findCompatibleMeasurements "<<meas.size()<<endl;
195 #endif
196 
197  if ( meas.empty()) {
198 #ifdef DEBUG
199  cout<<": Measurements empty : "<<endl;
200 #endif
201  if ( qualityFilter( *traj)) {addToResult( *traj, result); numtraj++;}
202  }
203  else {
204 #ifdef DEBUG
205  cout<<" : Update trajectoris : "<<endl;
206 #endif
207  for( std::vector<TM>::const_iterator itm = meas.begin();
208  itm != meas.end(); itm++) {
209  TempTrajectory newTraj = *traj;
210  bool good = updateTrajectory( newTraj, *itm);
211  if(good)
212  {
213  if ( toBeContinued(newTraj)) {
214  newCand.push_back(newTraj);
215 #ifdef DEBUG
216  cout<<": toBeContinued : increase "<<newCand.size()<<" maximal size "<<theMaxCand<<endl;
217 #endif
218  }
219  else {
220 #ifdef DEBUG
221  cout<<": good TM : to be stored :"<<endl;
222 #endif
223  if ( qualityFilter(newTraj)) {addToResult( newTraj, result); numtraj++;}
225  }
226  } // good
227  else
228  {
229 #ifdef DEBUG
230  cout<<": bad TM : to be stored :"<<endl;
231 #endif
232  if ( qualityFilter( *traj)) {addToResult( *traj, result);numtraj++;}
233  }
234  } //meas
235  }
236 
237 // if ((int)newCand.size() > theMaxCand) {
238 // sort( newCand.begin(), newCand.end(), TrajCandLess<TempTrajectory>(theLostHitPenalty));
239 // newCand.erase( newCand.begin()+theMaxCand, newCand.end());
240 // }
241 
242  if(numtraj > 4) break;
243  } // trajectories
244  if(numtraj > 4) break;
245  candidates.swap(newCand);
246  }
247 
248 #ifdef DEBUG
249  std::cout<<" qualityFilter::Number of trajectories "<<numtraj<<std::endl;
250 #endif
251 
252 }
bool qualityFilter(const TempTrajectory &traj) const
std::vector< TempTrajectory > TempTrajectoryContainer
const DataContainer & measurements() const
bool toBeContinued(const TempTrajectory &traj) const
const Chi2MeasurementEstimatorBase * theEstimator
std::vector< TrajectoryMeasurement > findCompatibleMeasurements(const TempTrajectory &traj) const
tuple result
Definition: query.py:137
virtual void setSign(int &i)
void addToResult(TempTrajectory &traj, TrajectoryContainer &result) const
bool updateTrajectory(TempTrajectory &traj, const TM &tm) const
tuple cout
Definition: gather_cfg.py:121
size_type size() const
Definition: bqueue.h:146
bool HICTrajectoryBuilder::qualityFilter ( const TempTrajectory traj) const
private

Definition at line 282 of file HICTrajectoryBuilder.cc.

References alongMomentum, FreeTrajectoryState::charge(), TempTrajectory::chiSquared(), gather_cfg::cout, Trajectory::direction(), Trajectory::firstMeasurement(), TempTrajectory::foundHits(), TrajectoryStateOnSurface::freeState(), TrajectoryStateOnSurface::freeTrajectoryState(), insideOut, TrajectoryStateClosestToBeamLine::isValid(), TrajectoryStateOnSurface::isValid(), Trajectory::lastMeasurement(), makeMuonMisalignmentScenario::matrix, Trajectory::measurements(), FreeTrajectoryState::momentum(), outsideIn, PV3DBase< T, PVType, FrameType >::perp(), GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, pos, FreeTrajectoryState::position(), Trajectory::recHits(), theFitterTrack, theHICConst, theMinimumNumberOfHits, TempTrajectory::toTrajectory(), TrajectoryStateClosestToBeamLine::trackStateAtPCA(), trajectories(), TrajectoryMeasurement::updatedState(), v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and cms::HICConst::zvert.

Referenced by limitedCandidates().

283 {
284 #ifdef DEBUG
285  cout << "qualityFilter called for trajectory with "
286  << traj.foundHits() << " found hits and Chi2 = "
287  << traj.chiSquared() << endl;
288 #endif
289  if ( traj.foundHits() < theMinimumNumberOfHits) {
290  return false;
291  }
292 
293  Trajectory traj0 = traj.toTrajectory();
294 // Check the number of pixels
295  const Trajectory::DataContainer tms = traj0.measurements();
296  int ipix = 0;
297  for( Trajectory::DataContainer::const_iterator itm = tms.begin(); itm != tms.end(); itm++) {
298  if((*itm).layer()->subDetector() == GeomDetEnumerators::PixelEndcap || (*itm).layer()->subDetector() == GeomDetEnumerators::PixelBarrel) ipix++;
299  }
300 
301 #ifdef DEBUG
302  cout<<" Number of pixels "<<ipix<<endl;
303 #endif
304 
305  if(ipix < 1) return false;
306 
307 //
308 // Refit the trajectory
309 //
310 
312  matrix(2,2) = 0.001;
313  matrix(3,3) = 0.001;
314 
316  0.1,
317  0.,
318  0.,
319  0.,
320  matrix
321  );
322 
323  enum RefitDirection{insideOut,outsideIn,undetermined};
324 
325  Trajectory::ConstRecHitContainer recHitsForReFit = traj0.recHits();
326 
327 #ifdef DEBUG
328  cout<<" Take recHits for reFit "<<endl;
329 #endif
330 
331 
332  PTrajectoryStateOnDet garbage1;
334 // TrajectoryStateOnSurface firstTSOS = traj0.firstMeasurement().updatedState();
335 
337  Trajectory::ConstRecHitContainer newRecHitsForReFit;
338  for(Trajectory::ConstRecHitContainer::const_iterator it=recHitsForReFit.end()-1; it!=recHitsForReFit.begin()-1; it--){
339 // cout<<" RecHIT is valid "<<(*it)->isValid()<<endl;
340  if((*it)->isValid()) {
341 // cout<<(*it)->globalPosition()<<endl;
342  newRecHitsForReFit.push_back(*it);
343  }
344 // else{cout<<" Invalid! "<<endl;
345 // }
346  }
347 
348 
349 
350 
351 #ifdef DEBUG
352  cout<<" Take firstTSOS "<<firstTSOS.isValid()<<endl;
353  if(firstTSOS.isValid()) cout<<firstTSOS.freeTrajectoryState()->charge()<<" "<<firstTSOS.freeTrajectoryState()->position()<<" "<<firstTSOS.freeTrajectoryState()->momentum()<<endl;
354 #endif
355 
356 // PropagationDirection propDir = oppositeToMomentum;
358  TrajectorySeed seed(garbage1,garbage2,propDir);
359  vector<Trajectory> trajectories = theFitterTrack->fit(seed,newRecHitsForReFit,firstTSOS);
360 
361  // vector<Trajectory> trajectories = theFitterTrack->fit(seed,recHitsForReFit,firstTSOS);
362  // vector<Trajectory> trajectories = theFitterTrack->fit(seed,recHitsForReFit);
363  // vector<Trajectory> trajectories = theFitterTrack->fit(traj0);
364 
365 #ifdef DEBUG
366  cout<<" fit Trajectory "<<endl;
367 #endif
368 
369 
370 
371  TrajectoryStateOnSurface innertsos;
372 
373  if (traj0.direction() == alongMomentum) {
374  // cout<<" Direction is along momentum "<<endl;
375  innertsos = traj0.firstMeasurement().updatedState();
376  } else {
377  innertsos = traj0.lastMeasurement().updatedState();
378  // cout<<" Direction is opposite to momentum "<<endl;
379 
380  }
381 
382 #ifdef DEBUG
383  cout<<" take inertsos "<<endl;
384 #endif
385 
386 
387  TSCBLBuilderNoMaterial tscblBuilder;
388 
389  //TrajectoryStateClosestToBeamLineBuilder tscblBuilder;
390  TrajectoryStateClosestToBeamLine tscbl = tscblBuilder(*(innertsos.freeState()),bs);
391 
392 #ifdef DEBUG
393  cout<<" closest to Beam "<<endl;
394 #endif
395 
396 
397  if (tscbl.isValid()==false) {
398  //cout<<" false track "<<endl;
399  return false;
400  }
401 
403  math::XYZPoint pos( v.x(), v.y(), v.z() );
404 
405 #ifdef DEBUG
406  cout<<" check vertex constraints "<<endl;
407 #endif
408 
409 
410  if(v.perp() > 0.1 ) return false;
411  if(fabs(v.z() - theHICConst->zvert ) > 0.4 ) return false;
412 
413  return true;
414 
415 }
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:32
T perp() const
Definition: PV3DBase.h:71
float zvert
Definition: HICConst.h:25
FreeTrajectoryState * freeTrajectoryState(bool withErrors=true) const
T y() const
Definition: PV3DBase.h:62
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:30
int foundHits() const
obsolete name, use measurements() instead.
PropagationDirection
TrackCharge charge() const
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
Definition: Trajectory.h:43
ConstRecHitContainer recHits(bool splitting=false) const
Definition: Trajectory.cc:67
PropagationDirection const & direction() const
Definition: Trajectory.cc:195
DataContainer const & measurements() const
Definition: Trajectory.h:203
virtual TrajectoryContainer trajectories(const TrajectorySeed &seed) const
trajectories building starting from a seed
std::vector< TrajectoryMeasurement > DataContainer
Definition: Trajectory.h:42
FreeTrajectoryState * freeState(bool withErrors=true) const
Trajectory toTrajectory() const
Convert to a standard Trajectory.
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:181
T z() const
Definition: PV3DBase.h:63
TrajectoryStateOnSurface updatedState() const
cms::HICConst * theHICConst
GlobalVector momentum() const
double chiSquared() const
Value of the raw Chi2 of the trajectory, not normalised to the N.D.F.
GlobalPoint position() const
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:194
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
tuple cout
Definition: gather_cfg.py:121
edm::ESHandle< TrajectoryFitter > theFitterTrack
T x() const
Definition: PV3DBase.h:61
mathSSE::Vec4< T > v
std::vector< TrajectoryMeasurement > HICTrajectoryBuilder::seedMeasurements ( const TrajectorySeed seed) const
private

Definition at line 261 of file HICTrajectoryBuilder.cc.

References gather_cfg::cout, cms::DiMuonTrajectorySeed::measurements(), query::result, and errorMatrix2Lands_multiChannel::start.

Referenced by createStartingTrajectory().

262 {
263  std::vector<TrajectoryMeasurement> result;
264 // TrajectoryStateTransform tsTransform;
265 
266 #ifdef DEBUG
267  cout<<" HICTrajectoryBuilder::seedMeasurements number of TM "<<dynamic_cast<DiMuonTrajectorySeed*>(const_cast<TrajectorySeed*>(&seed))->measurements().size()<<endl;
268 #endif
269 
270  std::vector<TrajectoryMeasurement> start = dynamic_cast<DiMuonTrajectorySeed*>(const_cast<TrajectorySeed*>(&seed))->measurements();
271  for(std::vector<TrajectoryMeasurement>::iterator imh = start.begin(); imh != start.end(); imh++)
272  {
273 #ifdef DEBUG
274  cout<<" HICTrajectoryBuilder::seedMeasurements::RecHit "<<endl;
275 #endif
276  result.push_back(*imh);
277  }
278 
279  return result;
280 }
tuple result
Definition: query.py:137
tuple cout
Definition: gather_cfg.py:121
std::vector< TrajectoryMeasurement > measurements() const
void HICTrajectoryBuilder::setEvent ( const edm::Event event) const
virtual

set Event for the internal MeasurementTracker data member

Reimplemented from BaseCkfTrajectoryBuilder.

Definition at line 91 of file HICTrajectoryBuilder.cc.

References theMeasurementTracker.

92 {
93  theMeasurementTracker->update(event);
94 }
const MeasurementTracker * theMeasurementTracker
virtual void HICTrajectoryBuilder::settracker ( const MeasurementTracker measurementTracker)
inlinevirtual

Definition at line 72 of file HICTrajectoryBuilder.h.

References theMeasurementTracker.

72 {theMeasurementTracker = measurementTracker;}
const MeasurementTracker * theMeasurementTracker
bool HICTrajectoryBuilder::toBeContinued ( const TempTrajectory traj) const
private

Definition at line 496 of file HICTrajectoryBuilder.cc.

References Trajectory::lost(), TempTrajectory::lostHits(), TempTrajectory::measurements(), cmsutils::bqueue< T >::rbegin(), cmsutils::bqueue< T >::rend(), theMaxConsecLostHit, and theMaxLostHit.

Referenced by limitedCandidates().

497 {
498  if ( traj.lostHits() > theMaxLostHit) return false;
499 
500  // check for conscutive lost hits only at the end
501  // (before the last valid hit),
502  // since if there was an unacceptable gap before the last
503  // valid hit the trajectory would have been stopped already
504 
505  int consecLostHit = 0;
506 
507  const TempTrajectory::DataContainer & tms = traj.measurements();
508  //for( TempTrajectory::DataContainer::const_iterator itm=tms.end()-1; itm>=tms.begin(); itm--) {
509  for( TempTrajectory::DataContainer::const_iterator itm=tms.rbegin(), itb = tms.rend(); itm != itb; --itm) {
510  if (itm->recHit()->isValid()) break;
511  else if ( // FIXME: restore this: !Trajectory::inactive(itm->recHit()->det()) &&
512  Trajectory::lost(*itm->recHit())) consecLostHit++;
513  }
514  if (consecLostHit > theMaxConsecLostHit) return false;
515 
516  // stopping condition from region has highest priority
517  // if ( regionalCondition && !(*regionalCondition)(traj) ) return false;
518  // next: pt-cut
519  //if ( !(*theMinPtCondition)(traj) ) return false;
520  //if ( !(*theMaxHitsCondition)(traj) ) return false;
521  // finally: configurable condition
522  // FIXME: restore this: if ( !(*theConfigurableCondition)(traj) ) return false;
523 
524  return true;
525 }
const_iterator rend() const
Definition: bqueue.h:145
static bool lost(const TransientTrackingRecHit &hit)
Definition: Trajectory.cc:205
const DataContainer & measurements() const
iterator rbegin()
Definition: bqueue.h:143
int lostHits() const
HICTrajectoryBuilder::TrajectoryContainer HICTrajectoryBuilder::trajectories ( const TrajectorySeed seed) const
virtual

trajectories building starting from a seed

limitedCandidates( startingTraj, regionalCondition, result); FIXME: restore regionalCondition

Implements BaseCkfTrajectoryBuilder.

Definition at line 97 of file HICTrajectoryBuilder.cc.

References gather_cfg::cout, createStartingTrajectory(), TempTrajectory::empty(), HICMeasurementEstimator::getHICConst(), limitedCandidates(), query::result, theEstimator, and theHICConst.

Referenced by qualityFilter().

98 {
100 #ifdef DEBUG
101  cout<<" HICTrajectoryBuilder::trajectories start with seed"<<endl;
102 #endif
104 
105  TempTrajectory startingTraj = createStartingTrajectory( seed );
106 #ifdef DEBUG
107  cout<<" HICTrajectoryBuilder::trajectories starting trajectories created "<<endl;
108 #endif
109  if(startingTraj.empty()) {
110 #ifdef DEBUG
111  cout<<" Problem with starting trajectory "<<endl;
112 #endif
113  return result;
114  }
115 
118 
119  limitedCandidates( startingTraj, result);
120 #ifdef DEBUG
121  cout<<" HICTrajectoryBuilder::trajectories candidates found "<<result.size()<<endl;
122 #endif
123 
124  return result;
125 }
bool empty() const
True if trajectory has no measurements.
const Chi2MeasurementEstimatorBase * theEstimator
std::vector< Trajectory > TrajectoryContainer
tuple result
Definition: query.py:137
cms::HICConst * theHICConst
void limitedCandidates(TempTrajectory &startingTraj, TrajectoryContainer &result) const
tuple cout
Definition: gather_cfg.py:121
TempTrajectory createStartingTrajectory(const TrajectorySeed &seed) const
bool HICTrajectoryBuilder::updateTrajectory ( TempTrajectory traj,
const TM tm 
) const
private

Definition at line 425 of file HICTrajectoryBuilder.cc.

References accept(), FreeTrajectoryState::charge(), HICMeasurementEstimator::chooseCuts(), gather_cfg::cout, TrajectoryStateOnSurface::curvilinearError(), HICMeasurementEstimator::estimate(), TrajectoryMeasurement::estimate(), first, TrajectoryStateOnSurface::freeTrajectoryState(), HICMeasurementEstimator::getField(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), TempTrajectory::lastMeasurement(), TrajectoryMeasurement::layer(), TrajectoryStateOnSurface::magneticField(), FreeTrajectoryState::momentum(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), FreeTrajectoryState::position(), TrajectoryMeasurement::predictedState(), TempTrajectory::push(), TrajectoryMeasurement::recHit(), HICMeasurementEstimator::setCuts(), TrajectoryStateOnSurface::surface(), theEstimator, theHICConst, tmp, TempTrajectory::toTrajectory(), HICMuonUpdator::update(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by limitedCandidates().

427 {
428  bool good=false;
429 #ifdef DEBUG
430  std::cout<<"HICTrajectoryBuilder::updateTrajectory::start"<<std::endl;
431 #endif
432  TSOS predictedState = tm.predictedState();
433  TM::ConstRecHitPointer hit = tm.recHit();
434  Trajectory traj0 = traj.toTrajectory();
435 
436 // My update
437  vector<double> theCut = dynamic_cast<HICMeasurementEstimator*>
438  (const_cast<Chi2MeasurementEstimatorBase*>(theEstimator))->setCuts(traj0,tm.layer());
439  int icut = 3;
441  const MagneticField * mf = dynamic_cast<HICMeasurementEstimator*>(const_cast<Chi2MeasurementEstimatorBase*>(theEstimator))->getField();
442  HICMuonUpdator hicup(theCut[2],theCut[3], mf,theHICConst);
443  double chi2rz,chi2rf;
444 
445  if ( hit->isValid()) {
446 // Check the charge
447 // if() {
448 
449  TrajectoryMeasurement tmlast = traj.lastMeasurement();
450  TM::ConstRecHitPointer lasthit = tmlast.recHit();
451  double dfi1 = predictedState.freeTrajectoryState()->position().phi() - lasthit->globalPosition().phi();
452  double dfi2 = hit->globalPosition().phi() - lasthit->globalPosition().phi();
453 
454 
455  if(dfi1*dfi2<0) {
456 // cout<<" Need to change charge "<<endl;
457  TrackCharge aCharge = -1*predictedState.freeTrajectoryState()->charge();
458  GlobalPoint xnew = predictedState.globalPosition();
459  GlobalVector pnew = predictedState.globalMomentum();
461  GlobalTrajectoryParameters(xnew, pnew, aCharge, predictedState.magneticField()),
462  predictedState.curvilinearError(), predictedState.surface());
463  predictedState = tsos;
464  }
465 
466 // Update trajectory
467 //
468  TrajectoryStateOnSurface newUpdateState=hicup.update(traj0, predictedState, tm, tm.layer(), chi2rz, chi2rf);
469 
470  bool accept=
471  (dynamic_cast<HICMeasurementEstimator*>(const_cast<Chi2MeasurementEstimatorBase*>(theEstimator))->estimate(newUpdateState,*hit)).first;
472  if(accept)
473  {
474 #ifdef DEBUG
475  std::cout<<" updateTrajectory::UpdateState::New momentum "<<newUpdateState.freeTrajectoryState()->momentum().perp()<<" "<<newUpdateState.freeTrajectoryState()->momentum().z()<<std::endl;
476 #endif
477  TM tmp = TM(predictedState, newUpdateState, hit, tm.estimate(), tm.layer());
478 
479  traj.push(tmp );
480  good=true;
481  return good;
482  }
483  else
484  {
485 #ifdef DEBUG
486  std::cout<<" updateTrajectory::failed after update "<<accept<<std::endl;
487 #endif
488  return good;
489  }
490  }
491  else {
492  return good;
493  }
494 }
T perp() const
Definition: PV3DBase.h:71
void update(const LocalTrajectoryParameters &p, const Surface &aSurface, const MagneticField *field, const SurfaceSide side=SurfaceSideDefinition::atCenterOfSurface)
FreeTrajectoryState * freeTrajectoryState(bool withErrors=true) const
const CurvilinearTrajectoryError & curvilinearError() const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
GlobalPoint globalPosition() const
ConstRecHitPointer recHit() const
TrackCharge charge() const
virtual std::vector< double > setCuts(Trajectory &traj, const DetLayer *theCurrentLayer)
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:22
const MagneticField * magneticField() const
const Chi2MeasurementEstimatorBase * theEstimator
const TrajectoryMeasurement & lastMeasurement() const
int TrackCharge
Definition: TrackCharge.h:4
Trajectory toTrajectory() const
Convert to a standard Trajectory.
const MagneticField * getField()
TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
T z() const
Definition: PV3DBase.h:63
cms::HICConst * theHICConst
bool first
Definition: L1TdeRCT.cc:94
GlobalVector momentum() const
GlobalPoint position() const
TrajectoryMeasurement TM
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
GlobalVector globalMomentum() const
const Surface & surface() const
tuple cout
Definition: gather_cfg.py:121
virtual std::pair< bool, double > estimate(const TrajectoryStateOnSurface &, const TransientTrackingRecHit &) const
void push(const TrajectoryMeasurement &tm)

Member Data Documentation

edm::ESHandle<GlobalTrackingGeometry> HICTrajectoryBuilder::globTkGeomHandle
private

Definition at line 82 of file HICTrajectoryBuilder.h.

Referenced by HICTrajectoryBuilder().

bool HICTrajectoryBuilder::theAlwaysUseInvalidHits
private

Definition at line 107 of file HICTrajectoryBuilder.h.

Referenced by HICTrajectoryBuilder().

const Propagator* HICTrajectoryBuilder::theBackwardPropagator
mutableprivate

Definition at line 93 of file HICTrajectoryBuilder.h.

Referenced by createStartingTrajectory().

const Chi2MeasurementEstimatorBase* HICTrajectoryBuilder::theEstimator
private
edm::ESHandle<TrajectoryFitter> HICTrajectoryBuilder::theFitterTrack
private

Definition at line 83 of file HICTrajectoryBuilder.h.

Referenced by HICTrajectoryBuilder(), and qualityFilter().

const Propagator* HICTrajectoryBuilder::theForwardPropagator
mutableprivate

Definition at line 92 of file HICTrajectoryBuilder.h.

Referenced by createStartingTrajectory(), and findCompatibleMeasurements().

cms::HICConst* HICTrajectoryBuilder::theHICConst
mutableprivate
bool HICTrajectoryBuilder::theIntermediateCleaning
private

Tells whether an intermediary cleaning stage should take place during TB.

Definition at line 104 of file HICTrajectoryBuilder.h.

Referenced by HICTrajectoryBuilder().

const LayerMeasurements* HICTrajectoryBuilder::theLayerMeasurements
private

Definition at line 89 of file HICTrajectoryBuilder.h.

Referenced by findCompatibleMeasurements(), and ~HICTrajectoryBuilder().

float HICTrajectoryBuilder::theLostHitPenalty
private

Chi**2 Penalty for each lost hit.

Definition at line 103 of file HICTrajectoryBuilder.h.

Referenced by HICTrajectoryBuilder().

int HICTrajectoryBuilder::theMaxCand
private
    Maximum number of trajectory candidates 

to propagate to the next layer.

Definition at line 98 of file HICTrajectoryBuilder.h.

Referenced by HICTrajectoryBuilder(), and limitedCandidates().

int HICTrajectoryBuilder::theMaxConsecLostHit
private

Maximum number of consecutive lost hits per trajectory candidate.

Definition at line 101 of file HICTrajectoryBuilder.h.

Referenced by HICTrajectoryBuilder(), and toBeContinued().

TrajectoryFilter* HICTrajectoryBuilder::theMaxHitsCondition
private

Definition at line 96 of file HICTrajectoryBuilder.h.

int HICTrajectoryBuilder::theMaxLostHit
private

Maximum number of lost hits per trajectory candidate.

Definition at line 100 of file HICTrajectoryBuilder.h.

Referenced by HICTrajectoryBuilder(), and toBeContinued().

const MeasurementTracker* HICTrajectoryBuilder::theMeasurementTracker
private

Definition at line 88 of file HICTrajectoryBuilder.h.

Referenced by setEvent(), and settracker().

int HICTrajectoryBuilder::theMinimumNumberOfHits
private

Minimum number of hits for a trajectory to be returned.

Definition at line 106 of file HICTrajectoryBuilder.h.

Referenced by HICTrajectoryBuilder(), and qualityFilter().

TrajectoryFilter* HICTrajectoryBuilder::theMinPtCondition
private

Definition at line 95 of file HICTrajectoryBuilder.h.

const Propagator* HICTrajectoryBuilder::thePropagatorAlong
private

Definition at line 76 of file HICTrajectoryBuilder.h.

const Propagator* HICTrajectoryBuilder::thePropagatorOpposite
private

Definition at line 77 of file HICTrajectoryBuilder.h.

edm::ESHandle<Propagator> HICTrajectoryBuilder::thePropagatorTrack
private

Definition at line 85 of file HICTrajectoryBuilder.h.

Referenced by HICTrajectoryBuilder().

edm::ESHandle<TrajectorySmoother> HICTrajectoryBuilder::theSmootherTrack
private

Definition at line 84 of file HICTrajectoryBuilder.h.

Referenced by HICTrajectoryBuilder().

const TransientTrackingRecHitBuilder* HICTrajectoryBuilder::theTTRHBuilder
private

Definition at line 87 of file HICTrajectoryBuilder.h.

const TrajectoryStateUpdator* HICTrajectoryBuilder::theUpdator
private

Definition at line 75 of file HICTrajectoryBuilder.h.