test
CMS 3D CMS Logo

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

#include <CRackTrajectoryBuilder.h>

Classes

class  CompareDetByTraj
 

Public Member Functions

 CRackTrajectoryBuilder (const edm::ParameterSet &conf)
 
Trajectory createStartingTrajectory (const TrajectorySeed &seed) const
 
const
TransientTrackingRecHitBuilder
hitBuilder () const
 
void init (const edm::EventSetup &es, bool)
 
void run (const TrajectorySeedCollection &collseed, const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const SiPixelRecHitCollection &collpixel, const edm::EventSetup &es, edm::Event &e, std::vector< Trajectory > &trajoutput)
 Runs the algorithm. More...
 
 ~CRackTrajectoryBuilder ()
 

Private Types

typedef std::pair
< TrackingRecHitRangeIterator,
TSOS
PairTrackingRecHitTsos
 
typedef TrajectoryMeasurement TM
 
typedef std::vector< const
TrackingRecHit * >::iterator 
TrackingRecHitIterator
 
typedef std::pair
< TrackingRecHitIterator,
TrackingRecHitIterator
TrackingRecHitRange
 
typedef std::vector
< TrackingRecHitRange >
::iterator 
TrackingRecHitRangeIterator
 
typedef TrajectoryStateOnSurface TSOS
 

Private Member Functions

void AddHit (Trajectory &traj, const std::vector< const TrackingRecHit * > &Hits, Propagator *currPropagator)
 
std::pair
< TrajectoryStateOnSurface,
const GeomDet * > 
innerState (const Trajectory &traj) const
 
bool isDifferentStripReHit2D (const SiStripRecHit2D &hitA, const SiStripRecHit2D &hitB)
 
bool qualityFilter (const Trajectory &traj)
 
std::vector
< TrajectoryMeasurement
seedMeasurements (const TrajectorySeed &seed) const
 
std::vector< const
TrackingRecHit * > 
SortHits (const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const SiPixelRecHitCollection &collpixel, const TrajectorySeed &seed, const bool bAddSeedHits)
 
TSOS startingTSOS (const TrajectorySeed &seed) const
 
void updateTrajectory (Trajectory &traj, const TM &tm, const TransientTrackingRecHit &hit) const
 

Private Attributes

double chi2cut
 
bool debug_info
 
bool fastPropagation
 
std::string geometry
 
TransientTrackingRecHit::RecHitContainer hits
 
edm::ESHandle< MagneticFieldmagfield
 
const
TransientTrackingRecHitBuilder
RHBuilder
 
bool seed_plus
 
std::string theBuilderName
 
Chi2MeasurementEstimatortheEstimator
 
const KFTrajectoryFittertheFitter
 
int theMinHits
 
PropagatorWithMaterialthePropagator
 
PropagatorWithMaterialthePropagatorOp
 
const KFTrajectorySmoothertheSmoother
 
KFUpdatortheUpdator
 
edm::ESHandle< TrackerGeometrytracker
 
std::vector< TrajectorytrajFit
 
bool useMatchedHits
 

Friends

class CompareDetByTraj
 

Detailed Description

Definition at line 125 of file CRackTrajectoryBuilder.h.

Member Typedef Documentation

Definition at line 138 of file CRackTrajectoryBuilder.h.

Definition at line 130 of file CRackTrajectoryBuilder.h.

typedef std::vector<const TrackingRecHit*>::iterator CRackTrajectoryBuilder::TrackingRecHitIterator
private

Definition at line 132 of file CRackTrajectoryBuilder.h.

Definition at line 134 of file CRackTrajectoryBuilder.h.

Definition at line 135 of file CRackTrajectoryBuilder.h.

Definition at line 129 of file CRackTrajectoryBuilder.h.

Constructor & Destructor Documentation

CRackTrajectoryBuilder::CRackTrajectoryBuilder ( const edm::ParameterSet conf)

Definition at line 32 of file CRackTrajectoryBuilder.cc.

References geometry, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

32  {
33  //minimum number of hits per tracks
34 
35  theMinHits=conf.getParameter<int>("MinHits");
36  //cut on chi2
37  chi2cut=conf.getParameter<double>("Chi2Cut");
38  edm::LogInfo("CosmicTrackFinder")<<"Minimum number of hits "<<theMinHits<<" Cut on Chi2= "<<chi2cut;
39 
40  debug_info=conf.getUntrackedParameter<bool>("debug", false);
41  fastPropagation=conf.getUntrackedParameter<bool>("fastPropagation", false);
42  useMatchedHits=conf.getUntrackedParameter<bool>("useMatchedHits", true);
43 
44 
45  geometry=conf.getUntrackedParameter<std::string>("GeometricStructure","STANDARD");
46  theBuilderName = conf.getParameter<std::string>("TTRHBuilder");
47 
48 
49 
50 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
CRackTrajectoryBuilder::~CRackTrajectoryBuilder ( )

Definition at line 53 of file CRackTrajectoryBuilder.cc.

53  {
54 // delete theInitialState;
55 }

Member Function Documentation

void CRackTrajectoryBuilder::AddHit ( Trajectory traj,
const std::vector< const TrackingRecHit * > &  Hits,
Propagator currPropagator 
)
private

do the old version ....

Definition at line 613 of file CRackTrajectoryBuilder.cc.

References Trajectory::chiSquared(), gather_cfg::cout, spr::find(), TrackingRecHit::geographicalId(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), Trajectory::lastMeasurement(), Propagator::propagate(), Trajectory::push(), DetId::rawId(), patCandidatesForDimuonsSequences_cff::tracker, TrajectoryStateOnSurface::update(), and TrajectoryMeasurement::updatedState().

614  {
615  vector<const TrackingRecHit*> Hits = _Hits;
616  if ( Hits.size() == 0 )
617  return;
618 
619  if (debug_info) cout << "CRackTrajectoryBuilder::AddHit" << endl;
620  if (debug_info) cout << "START " << traj.lastMeasurement().updatedState() << endl;
621 
622  vector <TrackingRecHitRange> hitRangeByDet;
623  TrackingRecHitIterator prevDet;
624 
625  prevDet = Hits.begin();
626  for( TrackingRecHitIterator iHit = Hits.begin(); iHit != Hits.end(); iHit++ )
627  {
628  if ( (*prevDet)->geographicalId() == (*iHit)->geographicalId() )
629  continue;
630 
631  hitRangeByDet.push_back( make_pair( prevDet, iHit ) );
632  prevDet = iHit;
633  }
634  hitRangeByDet.push_back( make_pair( prevDet, Hits.end() ) );
635 
637 
638  if (fastPropagation) {
639  for( TrackingRecHitRangeIterator iHitRange = hitRangeByDet.begin(); iHitRange != hitRangeByDet.end(); iHitRange++ )
640  {
641  const TrackingRecHit *currHit = *(iHitRange->first);
642  DetId currDet = currHit->geographicalId();
643 
644  TSOS prSt= currPropagator->propagate(traj.lastMeasurement().updatedState(),
645  tracker->idToDet(currDet)->surface());
646 
647  if ( !prSt.isValid())
648  {
649  if (debug_info) cout << "Not Valid: PRST" << prSt.globalPosition();
650  // if (debug_info) cout << "Not Valid: HIT" << *currHit;
651 
652 
653  continue;
654  }
655 
657  double chi2min = theEstimator->estimate( prSt, *bestHit).second;
658 
659  if (debug_info) cout << "Size " << iHitRange->first - (*iHitRange).second << endl;
660  for( TrackingRecHitIterator iHit = (*iHitRange).first+1; iHit != iHitRange->second; iHit++ )
661  {
662  if (debug_info) cout << "loop3 " <<" "<< Hits.end() - iHit << endl;
663 
665  double currChi2 = theEstimator->estimate(prSt, *tmpHit).second;
666  if ( currChi2 < chi2min )
667  {
668  chi2min = currChi2;
669  bestHit = tmpHit;
670  }
671  }
672  //now we have check if the track can be added to the trajectory
673  if (debug_info) cout << chi2min << endl;
674  if (chi2min < chi2cut)
675  {
676  if (debug_info) cout << "chi2 fine : " << chi2min << endl;
677  TSOS UpdatedState= theUpdator->update( prSt, *bestHit );
678  if (UpdatedState.isValid()){
679  hits.push_back(bestHit);
680  traj.push( TM(prSt,UpdatedState, bestHit, chi2min) );
681  if (debug_info) edm::LogInfo("CosmicTrackFinder") <<
682  "STATE UPDATED WITH HIT AT POSITION "
683 
684  << bestHit->globalPosition()
685  <<UpdatedState<<" "
686  <<traj.chiSquared();
687  if (debug_info) cout <<
688  "STATE UPDATED WITH HIT AT POSITION "
689 
690  << bestHit->globalPosition()
691  <<UpdatedState<<" "
692  <<traj.chiSquared();
693  if (debug_info) cout << "State is valid ..." << endl;
694  break; // now we need to
695  }
696  else
697  {
698  edm::LogWarning("CosmicTrackFinder")<<" State can not be updated with hit at position " << endl;
699  TSOS UpdatedState= theUpdator->update( prSt, *bestHit );
700  if (UpdatedState.isValid()){
701  cout <<
702  "NOT! UPDATED WITH HIT AT POSITION "
703 
704  << bestHit->globalPosition()
705  <<UpdatedState<<" "
706  <<traj.chiSquared();
707 
708  }
709  }
710  }
711  }
712  } //simple version end
713  else
714  {
715  //first sort the dets in the order they are traversed by the trajectory
716  // we need three loops:
717  // 1: loop as long as there can be an new hit added to the trajectory
718  // 2: loop over all dets that might be hit
719  // 3: loop over all hits on a certain det
720 
721 
722  std::vector < std::pair<TrackingRecHitRangeIterator, TSOS> > trackHitCandidates;
723  std::vector <std::pair<TrackingRecHitRangeIterator, TSOS> >::iterator iHitRange;
724  std::vector <uint32_t> processedDets;
725  do
726  {
727 
728  //create vector of possibly hit detectors...
729  trackHitCandidates.clear();
730  DetId currDet;
731  for( TrackingRecHitRangeIterator iHit = hitRangeByDet.begin(); iHit != hitRangeByDet.end(); iHit++ )
732  {
733  const TrackingRecHit *currHit = *(iHit->first);
734  currDet = currHit->geographicalId();
735 
736  if ( find(processedDets.begin(), processedDets.end(), currDet.rawId()) != processedDets.end() )
737  continue;
738 
739  TSOS prSt= currPropagator->propagate(traj.lastMeasurement().updatedState(),
740  tracker->idToDet(currDet)->surface());
741  if ( ( !prSt.isValid() ) || (theEstimator->Chi2MeasurementEstimatorBase::estimate(prSt,tracker->idToDet(currDet)->surface() ) == false) )
742  // if ( ( !prSt.isValid() ) || (theEstimator->estimate(prSt,tracker->idToDet(currDet)->surface() ) == false) )
743  continue;
744 
745  trackHitCandidates.push_back( make_pair(iHit, prSt) );
746  }
747 
748  if (!trackHitCandidates.size())
749  break;
750 
751  if (debug_info) cout << Hits.size() << " (int) trackHitCandidates.begin() " << trackHitCandidates.size() << endl;
752  if (debug_info) cout << "Before sorting ... " << endl;
753 
754  if (debug_info)
755  for( iHitRange = trackHitCandidates.begin(); iHitRange != trackHitCandidates.end(); iHitRange++ )
756  {
757  if (debug_info) cout << (tracker->idToDet((*(iHitRange->first->first))->geographicalId()))->position();
758  }
759  if (debug_info) cout << endl;
760 
761 
762  stable_sort( trackHitCandidates.begin(), trackHitCandidates.end(), CompareDetByTraj(traj.lastMeasurement().updatedState()) );
763 
764  if (debug_info) cout << "After sorting ... " << endl;
765  if (debug_info)
766  {
767  for( iHitRange = trackHitCandidates.begin(); iHitRange != trackHitCandidates.end(); iHitRange++ )
768  {
769  if (debug_info) cout << (tracker->idToDet((*(iHitRange->first->first))->geographicalId()))->position();
770  }
771  cout << endl;
772  }
773 
774  for( iHitRange = trackHitCandidates.begin(); iHitRange != trackHitCandidates.end(); iHitRange++ ) //loop over dets
775  {
776 
777  //now find the best hit of the detector
778  if (debug_info) cout << "loop2 " << trackHitCandidates.size() <<" " << trackHitCandidates.end() - iHitRange << endl;
779  const TrackingRecHit *currHit = *(iHitRange->first->first);
780 
782  TSOS currPrSt = (*iHitRange).second;
783 
784  if (debug_info) cout << "curr position" << bestHit->globalPosition();
785  for( TrackingRecHitIterator iHit = (*iHitRange).first->first+1; iHit != iHitRange->first->second; iHit++ )
786  {
788  if (debug_info) cout << "curr position" << tmpHit->globalPosition() ;
789 
790  }
791  }
792  if (debug_info) cout << "Cross check end ..." << endl;
793 
794 
795  //just a simple test if the same hit can be added twice ...
796  // for( iHitRange = trackHitCandidates.begin(); iHitRange != trackHitCandidates.end(); iHitRange++ ) //loop over all hits
797 
798  // break;
799 
800  for( iHitRange = trackHitCandidates.begin(); iHitRange != trackHitCandidates.end(); iHitRange++ ) //loop over detsall hits
801  {
802 
803  //now find the best hit of the detector
804  if (debug_info) cout << "loop2 " << trackHitCandidates.size() <<" " << trackHitCandidates.end() - iHitRange << endl;
805 
806  const TrackingRecHit *currHit = *(iHitRange->first->first);
807 
808  processedDets.push_back(currHit->geographicalId().rawId());
809 
810 
812 
813  if (debug_info) cout << "curr position A" << bestHit->globalPosition() << endl;
814  TSOS currPrSt = (*iHitRange).second;
815  double chi2min = theEstimator->estimate( currPrSt, *bestHit).second;
816 
817  if (debug_info) cout << "Size " << iHitRange->first->second - (*iHitRange).first->first << endl;
818  for( TrackingRecHitIterator iHit = (*iHitRange).first->first+1; iHit != iHitRange->first->second; iHit++ )
819  {
820  if (debug_info) cout << "loop3 " <<" "<< Hits.end() - iHit << endl;
821 
823  if (debug_info) cout << "curr position B" << tmpHit->globalPosition() << endl;
824  double currChi2 = theEstimator->estimate(currPrSt, *tmpHit).second;
825  if ( currChi2 < chi2min )
826  {
827  if (debug_info) cout << "Is best hit" << endl;
828  chi2min = currChi2;
829  bestHit = tmpHit;
830  }
831  }
832  //now we have checked the det and can remove the entry from the vector...
833 
834  //if (debug_info) cout << "before erase ..." << endl;
835  //this is to slow ...
836  // hitRangeByDet.erase( (*iHitRange).first,(*iHitRange).first+1 );
837  //if (debug_info) cout << "after erase ..." << endl;
838 
839  if (debug_info) cout << chi2min << endl;
840  //if the track can be added to the trajectory
841  if (chi2min < chi2cut)
842  {
843  if (debug_info) cout << "chi2 fine : " << chi2min << endl;
844 
845  // if (debug_info) cout << "previaous state " << traj.lastMeasurement().updatedState() <<endl;
846  TSOS UpdatedState= theUpdator->update( currPrSt, *bestHit );
847  if (UpdatedState.isValid()){
848 
849  hits.push_back(bestHit);
850  traj.push( TM(currPrSt,UpdatedState, bestHit, chi2min) );
851  if (debug_info) edm::LogInfo("CosmicTrackFinder") <<
852  "STATE UPDATED WITH HIT AT POSITION "
853  // <<tmphitbestdet->globalPosition()
854  <<UpdatedState<<" "
855  <<traj.chiSquared();
856  if (debug_info) cout << "Added Hit" << bestHit->globalPosition() << endl;
857  if (debug_info) cout << "State is valid ..." << UpdatedState << endl;
858  //cout << "updated state " << traj.lastMeasurement().updatedState() <<endl;
859 
860  // return; //break;
861  //
862  // TSOS prSt= currPropagator->propagate(traj.lastMeasurement().updatedState(),
863  // tracker->idToDet( bestHit->geographicalId() )->surface());
864  //
865  // if ( prSt.isValid())
866  // cout << "the same hit can be added twice ..." << endl;
867  //
868 
869  break;
870  }
871  else
872  {
873  if (debug_info) edm::LogWarning("CosmicTrackFinder")<<" State can not be updated with hit at position "
874  << bestHit->globalPosition();
875  // cout << "State can not be updated with hit at " << bestHit->globalPosition() << endl;
876  }
877  continue;
878  }
879  else
880  {
881  // cout << "chi2 to big : " << chi2min << endl;
882  }
883  if (debug_info) cout << " continue 1 " << endl;
884  }
885  //now we remove all already processed dets from the list ...
886  // hitRangeByDet.erase( (*trackHitCandidates.begin()).first,(*iHitRange).first+1 );
887 
888  if (debug_info) cout << " continue 2 " << endl;
889  }
890  //if this was the last exit
891  while ( iHitRange != trackHitCandidates.end() );
892  }
893 
894 
895 }
std::vector< TrackingRecHitRange >::iterator TrackingRecHitRangeIterator
Chi2MeasurementEstimator * theEstimator
GlobalPoint globalPosition() const
const TransientTrackingRecHitBuilder * RHBuilder
TransientTrackingRecHit::RecHitContainer hits
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< const TrackingRecHit * >::iterator TrackingRecHitIterator
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const
Definition: KFUpdator.cc:75
edm::ESHandle< TrackerGeometry > tracker
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:228
std::shared_ptr< TrackingRecHit const > RecHitPointer
Definition: DetId.h:18
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
float chiSquared() const
Definition: Trajectory.h:307
virtual std::pair< bool, double > estimate(const TrajectoryStateOnSurface &, const TrackingRecHit &) const
tuple cout
Definition: gather_cfg.py:145
TrajectoryStateOnSurface const & updatedState() const
DetId geographicalId() const
void push(const TrajectoryMeasurement &tm)
Definition: Trajectory.cc:35
TrajectoryMeasurement TM
Trajectory CRackTrajectoryBuilder::createStartingTrajectory ( const TrajectorySeed seed) const

Definition at line 252 of file CRackTrajectoryBuilder.cc.

References TrajectorySeed::direction(), i, eostools::move(), and mps_fire::result.

253 {
254  Trajectory result( seed, seed.direction());
255  std::vector<TM> && seedMeas = seedMeasurements(seed);
256  for (auto i : seedMeas) result.push(std::move(i));
257  return result;
258 }
PropagationDirection direction() const
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: mps_fire.py:83
def move
Definition: eostools.py:510
std::vector< TrajectoryMeasurement > seedMeasurements(const TrajectorySeed &seed) const
const TransientTrackingRecHitBuilder* CRackTrajectoryBuilder::hitBuilder ( ) const
inline

Definition at line 201 of file CRackTrajectoryBuilder.h.

References RHBuilder.

Referenced by cms::CosmicTrackFinder::produce().

201 {return RHBuilder;}
const TransientTrackingRecHitBuilder * RHBuilder
void CRackTrajectoryBuilder::init ( const edm::EventSetup es,
bool  seedplus 
)

Definition at line 58 of file CRackTrajectoryBuilder.cc.

References alongMomentum, edm::EventSetup::get(), HLT_ES_cff::magfield, oppositeToMomentum, edm::ESHandle< class >::product(), and patCandidatesForDimuonsSequences_cff::tracker.

58  {
59 
60 // edm::ParameterSet tise_params = conf_.getParameter<edm::ParameterSet>("TransientInitialStateEstimatorParameters") ;
61 // theInitialState = new TransientInitialStateEstimator( es,tise_params);
62 
63  //services
66 
67 
68 
69  if (seedplus) {
70  seed_plus=true;
73  else {
74  seed_plus=false;
77  }
78 
79  theUpdator= new KFUpdator();
80 // theUpdator= new KFStripUpdator();
82 
83 
85  es.get<TransientRecHitRecord>().get(theBuilderName,theBuilder);
86 
87 
88  RHBuilder= theBuilder.product();
89 
90 
91 
92 
94  *theUpdator,
95  *theEstimator) ;
96 
97 
99  *theUpdator,
100  *theEstimator);
101 
102 }
edm::ESHandle< MagneticField > magfield
Chi2MeasurementEstimator * theEstimator
const TransientTrackingRecHitBuilder * RHBuilder
const KFTrajectorySmoother * theSmoother
edm::ESHandle< TrackerGeometry > tracker
PropagatorWithMaterial * thePropagatorOp
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
PropagatorWithMaterial * thePropagator
const KFTrajectoryFitter * theFitter
std::pair< TrajectoryStateOnSurface, const GeomDet * > CRackTrajectoryBuilder::innerState ( const Trajectory traj) const
private

Definition at line 943 of file CRackTrajectoryBuilder.cc.

References alongMomentum, funct::C, Trajectory::direction(), Trajectory::foundHits(), i, TrajectoryStateOnSurface::localParameters(), Trajectory::measurements(), nhits, oppositeToMomentum, TrajectoryMeasurement::recHit(), TrajectoryStateOnSurface::surface(), and TrajectoryMeasurement::updatedState().

944 {
945  int lastFitted = 999;
946  int nhits = traj.foundHits();
947  if (nhits < lastFitted+1) lastFitted = nhits-1;
948 
949  std::vector<TrajectoryMeasurement> measvec = traj.measurements();
951 
952  bool foundLast = false;
953  int actualLast = -99;
954  for (int i=lastFitted; i >= 0; i--) {
955  if(measvec[i].recHit()->isValid()){
956  if(!foundLast){
957  actualLast = i;
958  foundLast = true;
959  }
960  firstHits.push_back( measvec[i].recHit());
961  }
962  }
963  TSOS unscaledState = measvec[actualLast].updatedState();
964  AlgebraicSymMatrix55 C=ROOT::Math::SMatrixIdentity();
965  // C *= 100.;
966 
967  TSOS startingState( unscaledState.localParameters(), LocalTrajectoryError(C),
968  unscaledState.surface(),
970 
971  // cout << endl << "FitTester starts with state " << startingState << endl;
972 
973  KFTrajectoryFitter backFitter( *thePropagator,
974  KFUpdator(),
975  Chi2MeasurementEstimator( 100., 3));
976 
978 
979  // only direction matters in this contest
982  backFitDirection);
983 
984  vector<Trajectory> fitres = backFitter.fit( fakeSeed, firstHits, startingState);
985 
986  if (fitres.size() != 1) {
987  // cout << "FitTester: first hits fit failed!" << endl;
988  return std::pair<TrajectoryStateOnSurface, const GeomDet*>();
989  }
990 
991  TrajectoryMeasurement firstMeas = fitres[0].lastMeasurement();
992  TSOS firstState = firstMeas.updatedState();
993 
994  // cout << "FitTester: Fitted first state " << firstState << endl;
995  //cout << "FitTester: chi2 = " << fitres[0].chiSquared() << endl;
996 
997  TSOS initialState( firstState.localParameters(), LocalTrajectoryError(C),
998  firstState.surface(),
1000 
1001  return std::pair<TrajectoryStateOnSurface, const GeomDet*>( initialState,
1002  firstMeas.recHit()->det());
1003 }
virtual const MagneticField * magneticField() const
int foundHits() const
Definition: Trajectory.h:279
int i
Definition: DBlmapReader.cc:9
ConstRecHitPointer const & recHit() const
const LocalTrajectoryParameters & localParameters() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
PropagationDirection
PropagationDirection const & direction() const
Definition: Trajectory.cc:125
DataContainer const & measurements() const
Definition: Trajectory.h:250
const SurfaceType & surface() const
std::vector< ConstRecHitPointer > ConstRecHitContainer
PropagatorWithMaterial * thePropagator
TrajectoryStateOnSurface const & updatedState() const
bool CRackTrajectoryBuilder::isDifferentStripReHit2D ( const SiStripRecHit2D hitA,
const SiStripRecHit2D hitB 
)
private

Definition at line 922 of file CRackTrajectoryBuilder.cc.

References TrackingRecHit::geographicalId(), BaseTrackerRecHit::localPosition(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

923 {
924  if ( hitA.geographicalId() != hitB.geographicalId() )
925  return true;
926  if ( hitA.localPosition().x() != hitB.localPosition().x() )
927  return true;
928  if ( hitA.localPosition().y() != hitB.localPosition().y() )
929  return true;
930  if ( hitA.localPosition().z() != hitB.localPosition().z() )
931  return true;
932 
933  // if (debug_info) cout << hitA.localPosition() << endl;
934  // if (debug_info) cout << hitB << endl;
935 
936  return false;
937 }
T y() const
Definition: PV3DBase.h:63
T z() const
Definition: PV3DBase.h:64
DetId geographicalId() const
T x() const
Definition: PV3DBase.h:62
virtual LocalPoint localPosition() const final
bool CRackTrajectoryBuilder::qualityFilter ( const Trajectory traj)
private

Definition at line 899 of file CRackTrajectoryBuilder.cc.

References Trajectory::foundHits(), geometry, and Trajectory::recHits().

899  {
900  int ngoodhits=0;
901  if(geometry=="MTCC"){
902  auto hits= traj.recHits();
903  for(auto hit=hits.begin();hit!=hits.end();hit++){
904  unsigned int iid=(*hit)->hit()->geographicalId().rawId();
905  //CHECK FOR 3 hits r-phi
906  if(((iid>>0)&0x3)!=1) ngoodhits++;
907  }
908  }
909  else ngoodhits=traj.foundHits();
910 
911  if ( ngoodhits >= theMinHits) {
912  return true;
913  }
914  else {
915  return false;
916  }
917 }
int foundHits() const
Definition: Trajectory.h:279
ConstRecHitContainer recHits() const
Definition: Trajectory.h:258
TransientTrackingRecHit::RecHitContainer hits
void CRackTrajectoryBuilder::run ( const TrajectorySeedCollection collseed,
const SiStripRecHit2DCollection collstereo,
const SiStripRecHit2DCollection collrphi,
const SiStripMatchedRecHit2DCollection collmatched,
const SiPixelRecHitCollection collpixel,
const edm::EventSetup es,
edm::Event e,
std::vector< Trajectory > &  trajoutput 
)

Runs the algorithm.

Definition at line 105 of file CRackTrajectoryBuilder.cc.

References alongMomentum, gather_cfg::cout, Trajectory::firstMeasurement(), Trajectory::foundHits(), init, iseed, Trajectory::recHits(), Trajectory::seed(), patCandidatesForDimuonsSequences_cff::tracker, and TrajectoryMeasurement::updatedState().

Referenced by cms::CosmicTrackFinder::produce().

113 {
114 
115  std::vector<Trajectory> trajSmooth;
116  std::vector<Trajectory>::iterator trajIter;
117 
118  TrajectorySeedCollection::const_iterator iseed;
119  unsigned int IS=0;
120  for(iseed=collseed.begin();iseed!=collseed.end();iseed++){
121  bool seedplus=((*iseed).direction()==alongMomentum);
122  init(es,seedplus);
123  hits.clear();
124  trajFit.clear();
125  trajSmooth.clear();
126 
127  Trajectory startingTraj = createStartingTrajectory(*iseed);
128  Trajectory trajTmp; // used for the opposite direction
129  Trajectory traj = startingTraj;
130 
131 
132  //first propagate track in opposite direction ...
133  seed_plus = !seed_plus;
134  vector<const TrackingRecHit*> allHitsOppsite = SortHits(collstereo,collrphi,collmatched,collpixel, *iseed, true);
135  seed_plus = !seed_plus;
136  if (allHitsOppsite.size())
137  {
138  //there are hits which are above the seed,
139  //cout << "Number of hits higher than seed " <<allHitsOppsite.size() << endl;
140 
141  AddHit( traj, allHitsOppsite, thePropagatorOp);
142 
143 
144  if (debug_info)
145  {
146  cout << "Hits in opposite direction..." << endl;
147  TransientTrackingRecHit::RecHitContainer::const_iterator iHit;
148  for ( iHit = hits.begin(); iHit!=hits.end(); iHit++)
149  {
150  cout << (**iHit).globalPosition() << endl;
151  }
152  }
153 
154 
155  // now add hist opposite to seed
156  //now crate new starting trajectory
157  reverse(hits.begin(), hits.end());
159  tracker->idToDet((hits.front())->geographicalId())->surface()).isValid()){
160  TSOS startingStateNew = //TrajectoryStateWithArbitraryError()//
162  tracker->idToDet((hits.front())->geographicalId())->surface()));
163 
164  if (debug_info)
165  {
166  cout << "Hits in opposite direction reversed..." << endl;
167  TransientTrackingRecHit::RecHitContainer::const_iterator iHit;
168  for ( iHit = hits.begin(); iHit!=hits.end(); iHit++)
169  {
170  cout << (**iHit).globalPosition() << endl;
171  }
172  }
173 
174  const TrajectorySeed& tmpseed=traj.seed();
175  trajTmp = theFitter->fit(tmpseed,hits, startingStateNew ).front();
176 
177  if(debug_info){
178  cout << "Debugging show fitted hits" << endl;
179  auto hitsFit= trajTmp.recHits();
180  for(auto hit=hitsFit.begin();hit!=hitsFit.end();hit++){
181 
182  cout << RHBuilder->build( &(*(*hit)->hit()) )->globalPosition() << endl;
183  }
184  }
185 
186  }
187  }
188  else
189  {
190  if(debug_info) cout << "There are no hits in opposite direction ..." << endl;
191  }
192 
193  vector<const TrackingRecHit*> allHits;
194  if (trajTmp.foundHits())
195  {
196  traj = trajTmp;
197  allHits= SortHits(collstereo,collrphi,collmatched,collpixel,*iseed, false);
198  }
199  else
200  {
201  traj = startingTraj;
202  hits.clear();
203  allHits= SortHits(collstereo,collrphi,collmatched,collpixel,*iseed, true);
204  }
205 
206  AddHit( traj,allHits, thePropagator);
207 
208 
209  if(debug_info){
210  cout << "Debugging show All fitted hits" << endl;
211  auto hits= traj.recHits();
212  for(auto hit=hits.begin();hit!=hits.end();hit++){
213 
214  cout << (*hit)->globalPosition() << endl;
215  }
216 
217  cout << qualityFilter( traj) << " <- quality filter good?" << endl;
218  }
219 
220 
221  if (debug_info) cout << "now do quality checks" << endl;
222  if ( qualityFilter( traj) ) {
223  const TrajectorySeed& tmpseed=traj.seed();
224  std::pair<TrajectoryStateOnSurface, const GeomDet*> initState = innerState(traj); //theInitialState->innerState(traj);
225  if (initState.first.isValid())
226  trajFit = theFitter->fit(tmpseed,hits, initState.first);
227  }
228 
229  for (trajIter=trajFit.begin(); trajIter!=trajFit.end();trajIter++){
230  trajSmooth=theSmoother->trajectories((*trajIter));
231  }
232  for (trajIter= trajSmooth.begin(); trajIter!=trajSmooth.end();trajIter++){
233  if((*trajIter).isValid()){
234 
235  if (debug_info) cout << "adding track ... " << endl;
236  trajoutput.push_back((*trajIter));
237  }
238  }
239  delete theUpdator;
240  delete theEstimator;
241  delete thePropagator;
242  delete thePropagatorOp;
243  delete theFitter;
244  delete theSmoother;
245  //Only the first 30 seeds are considered
246  if (IS>30) return;
247  IS++;
248 
249  }
250 }
int foundHits() const
Definition: Trajectory.h:279
Trajectory createStartingTrajectory(const TrajectorySeed &seed) const
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:330
Chi2MeasurementEstimator * theEstimator
ConstRecHitContainer recHits() const
Definition: Trajectory.h:258
const TransientTrackingRecHitBuilder * RHBuilder
TransientTrackingRecHit::RecHitContainer hits
virtual TrajectoryContainer trajectories(const Trajectory &traj) const
const KFTrajectorySmoother * theSmoother
std::pair< TrajectoryStateOnSurface, const GeomDet * > innerState(const Trajectory &traj) const
std::vector< Trajectory > trajFit
bool qualityFilter(const Trajectory &traj)
edm::ESHandle< TrackerGeometry > tracker
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
PropagatorWithMaterial * thePropagatorOp
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:241
int iseed
Definition: AMPTWrapper.h:124
void init(const edm::EventSetup &es, bool)
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
PropagatorWithMaterial * thePropagator
const KFTrajectoryFitter * theFitter
std::vector< const TrackingRecHit * > SortHits(const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const SiPixelRecHitCollection &collpixel, const TrajectorySeed &seed, const bool bAddSeedHits)
tuple cout
Definition: gather_cfg.py:145
TrajectoryStateOnSurface const & updatedState() const
std::vector< Trajectory > fit(const Trajectory &traj, fitType type=standard) const
void AddHit(Trajectory &traj, const std::vector< const TrackingRecHit * > &Hits, Propagator *currPropagator)
std::vector< TrajectoryMeasurement > CRackTrajectoryBuilder::seedMeasurements ( const TrajectorySeed seed) const
private

Definition at line 262 of file CRackTrajectoryBuilder.cc.

References eostools::move(), TrajectorySeed::recHits(), mps_fire::result, and GeomDet::surface().

263 {
264  std::vector<TrajectoryMeasurement> result;
265  TrajectorySeed::range hitRange = seed.recHits();
266  for (TrajectorySeed::const_iterator ihit = hitRange.first;
267  ihit != hitRange.second; ihit++) {
268  //RC TransientTrackingRecHit* recHit = RHBuilder->build(&(*ihit));
270  const GeomDet* hitGeomDet = (&(*tracker))->idToDet( ihit->geographicalId());
271  TSOS invalidState( new BasicSingleTrajectoryState( hitGeomDet->surface()));
272 
273  if (ihit == hitRange.second - 1) {
274  TSOS updatedState=startingTSOS(seed);
275  result.push_back(std::move(TM( invalidState, updatedState, recHit)));
276 
277  }
278  else {
279  result.push_back(std::move(TM( invalidState, recHit)));
280  }
281 
282  }
283 
284  return result;
285 }
const TransientTrackingRecHitBuilder * RHBuilder
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
tuple result
Definition: mps_fire.py:83
recHitContainer::const_iterator const_iterator
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
def move
Definition: eostools.py:510
std::pair< const_iterator, const_iterator > range
TSOS startingTSOS(const TrajectorySeed &seed) const
std::shared_ptr< TrackingRecHit const > RecHitPointer
range recHits() const
TrajectoryMeasurement TM
vector< const TrackingRecHit * > CRackTrajectoryBuilder::SortHits ( const SiStripRecHit2DCollection collstereo,
const SiStripRecHit2DCollection collrphi,
const SiStripMatchedRecHit2DCollection collmatched,
const SiPixelRecHitCollection collpixel,
const TrajectorySeed seed,
const bool  bAddSeedHits 
)
private

Definition at line 288 of file CRackTrajectoryBuilder.cc.

References gather_cfg::cout, edmNew::DetSetVector< T >::data(), spr::find(), TrackingRecHit::geographicalId(), TrajectoryStateOnSurface::globalPosition(), BaseTrackerRecHit::globalPosition(), TrajectoryStateOnSurface::isValid(), Trajectory::lastMeasurement(), TrajectoryStateOnSurface::localError(), LogDebug, visualization-live-secondInstance_cfg::m, LocalTrajectoryError::matrix(), SiStripMatchedRecHit2D::monoHit(), TrajectorySeed::nHits(), DetId::rawId(), TrajectorySeed::recHits(), alignCSCRings::s, SiStripMatchedRecHit2D::stereoHit(), patCandidatesForDimuonsSequences_cff::tracker, TrajectoryMeasurement::updatedState(), PV3DBase< T, PVType, FrameType >::y(), HLT_25ns10e33_v2_cff::yMax, and HLT_25ns10e33_v2_cff::yMin.

294  {
295 
296 
297  //The Hits with global y more than the seed are discarded
298  //The Hits correspondign to the seed are discarded
299  //At the end all the hits are sorted in y
300  vector<const TrackingRecHit*> allHits;
301 
303  TrajectorySeed::range hRange= seed.recHits();
305  float yref=0.;
306 
307  if (debug_info) cout << "SEED " << startingTSOS(seed) << endl;
308  if (debug_info) cout << "seed hits size " << seed.nHits() << endl;
309 
310 
311  //seed debugging:
312  // GeomDet *seedDet = tracker->idToDet(seed.startingState().detId());
313 
314 
315 // edm::LogInfo("CRackTrajectoryBuilder::SortHits") << "SEED " << seed.startingState();
316 
317  edm::LogInfo("CRackTrajectoryBuilder::SortHits") << "SEED " << startingTSOS(seed);
318 // edm::LogInfo("CRackTrajectoryBuilder::SortHits" << "seed hits size " << seed.nHits();
319 
320 
321 
322  // if (seed.nHits()<2)
323  // return allHits;
324 
325  float_t yMin=0.;
326  float_t yMax=0.;
327 
328  int seedHitSize= hRange.second - hRange.first;
329 
330  vector <int> detIDSeedMatched (seedHitSize);
331  vector <int> detIDSeedRphi (seedHitSize);
332  vector <int> detIDSeedStereo (seedHitSize);
333 
334  for (ihit = hRange.first;
335  ihit != hRange.second; ihit++) {
336 
337  // need to find track with lowest (seed_plus)/ highest y (seed_minus)
338  // split matched hits ...
339  const SiStripMatchedRecHit2D* matchedhit=dynamic_cast<const SiStripMatchedRecHit2D*>(&(*ihit));
340 
341  yref=RHBuilder->build(&(*ihit))->globalPosition().y();
342  if (ihit == hRange.first)
343  {
344  yMin = yref;
345  yMax = yref;
346  }
347 
348  if (matchedhit)
349  {
350  auto m = matchedhit->monoHit();
351  auto s = matchedhit->stereoHit();
352  float_t yGlobRPhi = RHBuilder->build(&m)->globalPosition().y();
353  float_t yGlobStereo = RHBuilder->build(&s)->globalPosition().y();
354 
355  if (debug_info) cout << "Rphi ..." << yGlobRPhi << endl;
356  if (debug_info) cout << "Stereo ..." << yGlobStereo << endl;
357 
358  if ( yGlobStereo < yMin ) yMin = yGlobStereo;
359  if ( yGlobRPhi < yMin ) yMin = yGlobRPhi;
360 
361  if ( yGlobStereo > yMax ) yMax = yGlobStereo;
362  if ( yGlobRPhi > yMax ) yMax = yGlobRPhi;
363 
364  detIDSeedMatched.push_back ( matchedhit->geographicalId().rawId() );
365  detIDSeedRphi.push_back ( m.geographicalId().rawId() );
366  detIDSeedStereo.push_back ( s.geographicalId().rawId() );
367 
368  if (bAddSeedHits)
369  {
370  if (useMatchedHits)
371  {
372 
373  hits.push_back((RHBuilder->build(&(*ihit))));
374  }
375  else
376  {
377  if ( ( (yGlobRPhi > yGlobStereo ) && seed_plus ) || ((yGlobRPhi < yGlobStereo ) && !seed_plus ))
378  {
379  hits.push_back((RHBuilder->build(&m)));
380  hits.push_back((RHBuilder->build(&s)));
381  }
382  else
383  {
384  hits.push_back((RHBuilder->build(&s)));
385  hits.push_back((RHBuilder->build(&m)));
386 
387  }
388  }
389  }
390  }
391  else if (bAddSeedHits)
392  {
393  hits.push_back((RHBuilder->build(&(*ihit))));
394  detIDSeedRphi.push_back ( ihit->geographicalId().rawId() );
395  detIDSeedMatched.push_back ( -1 );
396  detIDSeedStereo.push_back ( -1 );
397 
398  }
399 
400  if ( yref < yMin ) yMin = yref;
401  if ( yref > yMax ) yMax = yref;
402 
403 // if (bAddSeedHits)
404 // hits.push_back((RHBuilder->build(&(*ihit))));
405 
406  LogDebug("CosmicTrackFinder")<<"SEED HITS"<<RHBuilder->build(&(*ihit))->globalPosition();
407  if (debug_info) cout <<"SEED HITS"<<RHBuilder->build(&(*ihit))->globalPosition() << endl;
408 // if (debug_info) cout <<"SEED HITS"<< seed.startingState().parameters() << endl;
409 
410 
411  }
412 
413  yref = (seed_plus) ? yMin : yMax;
414 
415  if ((&collpixel)!=0){
417  for(ipix=collpixel.data().begin();ipix!=collpixel.data().end();ipix++){
418  float ych= RHBuilder->build(&(*ipix))->globalPosition().y();
419  if ((seed_plus && (ych<yref)) || (!(seed_plus) && (ych>yref)))
420  allHits.push_back(&(*ipix));
421  }
422  }
423 
424 
425  if (useMatchedHits) // use matched
426  {
427  //add the matched hits ...
429 
430  if ((&collmatched)!=0){
431  for(istripm=collmatched.data().begin();istripm!=collmatched.data().end();istripm++){
432  float ych= RHBuilder->build(&(*istripm))->globalPosition().y();
433 
434  int cDetId=istripm->geographicalId().rawId();
435  bool noSeedDet = ( detIDSeedMatched.end() == find (detIDSeedMatched.begin(), detIDSeedMatched.end(), cDetId ) ) ;
436 
437  if ( noSeedDet )
438  if ((seed_plus && (ych<yref)) || (!(seed_plus) && (ych>yref)))
439  {
440  //if (debug_info) cout << "adding matched hit " << &(*istripm) << endl;
441  allHits.push_back(&(*istripm));
442  }
443  }
444  }
445 
446  //add the rpi hits, but only accept hits that are not matched hits
447  if ((&collrphi)!=0){
448  for(istrip=collrphi.data().begin();istrip!=collrphi.data().end();istrip++){
449  float ych= RHBuilder->build(&(*istrip))->globalPosition().y();
450  StripSubdetector monoDetId(istrip->geographicalId());
451  if (monoDetId.partnerDetId())
452  {
453  edm::LogInfo("CRackTrajectoryBuilder::SortHits") << "this det belongs to a glued det " << ych << endl;
454  continue;
455  }
456  int cDetId=istrip->geographicalId().rawId();
457  bool noSeedDet = ( detIDSeedRphi.end()== find (detIDSeedRphi.begin(), detIDSeedRphi.end(), cDetId ) ) ;
458  if (noSeedDet)
459  if ((seed_plus && (ych<yref)) || (!(seed_plus) && (ych>yref)))
460  {
461 
462  bool hitIsUnique = true;
463  //now
464  if ((&collmatched)!=0)
465  for(istripm=collmatched.data().begin();istripm!=collmatched.data().end();istripm++)
466  {
467  // if ( isDifferentStripReHit2D ( *istrip, (istripm->stereoHit() ) ) == false)
468  if ( isDifferentStripReHit2D ( *istrip, (istripm->monoHit() ) ) == false)
469  {
470  hitIsUnique = false;
471  edm::LogInfo("CRackTrajectoryBuilder::SortHits") << "rphi hit is in matched hits; y: " << ych << endl;
472  break;
473  }
474  } //end loop over all matched
475  if (hitIsUnique)
476  {
477  // if (debug_info) cout << "adding rphi hit " << &(*istrip) << endl;
478  allHits.push_back(&(*istrip));
479  }
480  }
481  }
482  }
483 
484 
485  //add the stereo hits except the hits that are in the matched collection
486  //update do not use unmatched rphi hist due to limitation of alignment framework
487  //if (!useMatchedHits)
488  //if ((&collstereo)!=0){
489  // for(istrip=collstereo.data().begin();istrip!=collstereo.data().end();istrip++){
490  // float ych= RHBuilder->build(&(*istrip))->globalPosition().y();
491  //
492  //
493  // int cDetId = istrip->geographicalId().rawId();
494  // bool noSeedDet = ( detIDSeedStereo.end()== find (detIDSeedStereo.begin(), detIDSeedStereo.end(), cDetId ) ) ;
495  //
496  // if (noSeedDet)
497  // if ((seed_plus && (ych<yref)) || (!(seed_plus) && (ych>yref)))
498  // {
499  //
500  // bool hitIsUnique = true;
501  // //now
502  // if ((&collmatched)!=0)
503  // for(istripm=collmatched.data().begin();istripm!=collmatched.data().end();istripm++)
504  // {
505  // if ( isDifferentStripReHit2D ( *istrip, * (istripm->stereoHit() ) ) == false)
506  // {
507  // hitIsUnique = false;
508  // edm::LogInfo("CRackTrajectoryBuilder::SortHits") << "stereo hit already in matched hits; y: " << ych << endl;
509  // break;
510  // }
511  // } //end loop over all stereo
512  // if (hitIsUnique)
513  // {
514  //
515  // // if (debug_info) cout << "now I am adding a stero hit, either noise or not in overlap ...!!!!" << endl;
516  // allHits.push_back(&(*istrip));
517  // }
518  // }
519  // }
520  //}
521  }
522  else // dont use matched ...
523  {
524 
525  if ((&collrphi)!=0){
526  for(istrip=collrphi.data().begin();istrip!=collrphi.data().end();istrip++){
527  float ych= RHBuilder->build(&(*istrip))->globalPosition().y();
528  if ((seed_plus && (ych<yref)) || (!(seed_plus) && (ych>yref)))
529  allHits.push_back(&(*istrip));
530  }
531  }
532 
533 
534  if ((&collstereo)!=0){
535  for(istrip=collstereo.data().begin();istrip!=collstereo.data().end();istrip++){
536  float ych= RHBuilder->build(&(*istrip))->globalPosition().y();
537  if ((seed_plus && (ych<yref)) || (!(seed_plus) && (ych>yref)))
538  allHits.push_back(&(*istrip));
539  }
540  }
541 
542  }
543 
544 
545 // if (seed_plus){
546 // stable_sort(allHits.begin(),allHits.end(),CompareDetY_plus(*tracker));
547 // }
548 // else {
549 // stable_sort(allHits.begin(),allHits.end(),CompareDetY_minus(*tracker));
550 // }
551 
552 
553  if (seed_plus){
554  stable_sort(allHits.begin(),allHits.end(),CompareHitY_plus(*tracker));
555  }
556  else {
557  stable_sort(allHits.begin(),allHits.end(),CompareHitY(*tracker));
558  }
559 
560 
561 
562  if (debug_info)
563  {
564  if (debug_info) cout << "all hits" << endl;
565 
566  //starting trajectory
567  Trajectory startingTraj = createStartingTrajectory(seed);
568 
569  if (debug_info) cout << "START " << startingTraj.lastMeasurement().updatedState() << endl;
570  if (debug_info) cout << "START Err" << startingTraj.lastMeasurement().updatedState().localError().matrix() << endl;
571 
572 
573  vector<const TrackingRecHit*>::iterator iHit;
574  for (iHit=allHits.begin(); iHit<allHits.end(); iHit++)
575  {
576  GlobalPoint gphit=RHBuilder->build(*iHit)->globalPosition();
577  if (debug_info) cout << "GH " << gphit << endl;
578 
579  // tracker->idToDet((*iHit)->geographicalId())->surface();
580 
581  TSOS prSt = thePropagator->propagate(startingTraj.lastMeasurement().updatedState(),
582  tracker->idToDet((*iHit)->geographicalId())->surface());
583 
584  if(prSt.isValid())
585  {
586  if (debug_info) cout << "PR " << prSt.globalPosition() << endl;
587  //if (debug_info) cout << "PR Err" << prSt.localError().matrix() << endl;
588 
589  }
590  else
591  {
592  if (debug_info) cout << "not valid" << endl;
593  }
594  }
595  if (debug_info) cout << "all hits end" << endl;
596  }
597 
598 
599  return allHits;
600 }
#define LogDebug(id)
Trajectory createStartingTrajectory(const TrajectorySeed &seed) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
GlobalPoint globalPosition() const
const TransientTrackingRecHitBuilder * RHBuilder
TransientTrackingRecHit::RecHitContainer hits
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
recHitContainer::const_iterator const_iterator
edm::ESHandle< TrackerGeometry > tracker
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:228
data_type const * data(size_t cell) const
std::pair< const_iterator, const_iterator > range
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
TSOS startingTSOS(const TrajectorySeed &seed) const
SiStripRecHit2D stereoHit() const
bool isDifferentStripReHit2D(const SiStripRecHit2D &hitA, const SiStripRecHit2D &hitB)
range recHits() const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
PropagatorWithMaterial * thePropagator
SiStripRecHit2D monoHit() const
unsigned int nHits() const
tuple cout
Definition: gather_cfg.py:145
TrajectoryStateOnSurface const & updatedState() const
DetId geographicalId() const
TrajectoryStateOnSurface CRackTrajectoryBuilder::startingTSOS ( const TrajectorySeed seed) const
private

Definition at line 603 of file CRackTrajectoryBuilder.cc.

References HLT_ES_cff::magfield, TrajectorySeed::startingState(), and trajectoryStateTransform::transientState().

604 {
605  PTrajectoryStateOnDet pState( seed.startingState());
606  const GeomDet* gdet = (&(*tracker))->idToDet(DetId(pState.detId()));
607  TSOS State= trajectoryStateTransform::transientState( pState, &(gdet->surface()),
608  &(*magfield));
609  return State;
610 
611 }
edm::ESHandle< MagneticField > magfield
Definition: DetId.h:18
PTrajectoryStateOnDet const & startingState() const
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
State
Definition: hltDiff.cc:286
void CRackTrajectoryBuilder::updateTrajectory ( Trajectory traj,
const TM tm,
const TransientTrackingRecHit hit 
) const
private

Friends And Related Function Documentation

friend class CompareDetByTraj
friend

Definition at line 141 of file CRackTrajectoryBuilder.h.

Member Data Documentation

double CRackTrajectoryBuilder::chi2cut
private

Definition at line 260 of file CRackTrajectoryBuilder.h.

bool CRackTrajectoryBuilder::debug_info
private

Definition at line 255 of file CRackTrajectoryBuilder.h.

bool CRackTrajectoryBuilder::fastPropagation
private

Definition at line 256 of file CRackTrajectoryBuilder.h.

std::string CRackTrajectoryBuilder::geometry
private
TransientTrackingRecHit::RecHitContainer CRackTrajectoryBuilder::hits
private

Definition at line 263 of file CRackTrajectoryBuilder.h.

edm::ESHandle<MagneticField> CRackTrajectoryBuilder::magfield
private

Definition at line 239 of file CRackTrajectoryBuilder.h.

const TransientTrackingRecHitBuilder* CRackTrajectoryBuilder::RHBuilder
private

Definition at line 250 of file CRackTrajectoryBuilder.h.

Referenced by hitBuilder().

bool CRackTrajectoryBuilder::seed_plus
private

Definition at line 264 of file CRackTrajectoryBuilder.h.

std::string CRackTrajectoryBuilder::theBuilderName
private

Definition at line 266 of file CRackTrajectoryBuilder.h.

Chi2MeasurementEstimator* CRackTrajectoryBuilder::theEstimator
private

Definition at line 249 of file CRackTrajectoryBuilder.h.

const KFTrajectoryFitter* CRackTrajectoryBuilder::theFitter
private

Definition at line 252 of file CRackTrajectoryBuilder.h.

int CRackTrajectoryBuilder::theMinHits
private

Definition at line 259 of file CRackTrajectoryBuilder.h.

PropagatorWithMaterial* CRackTrajectoryBuilder::thePropagator
private

Definition at line 242 of file CRackTrajectoryBuilder.h.

PropagatorWithMaterial* CRackTrajectoryBuilder::thePropagatorOp
private

Definition at line 243 of file CRackTrajectoryBuilder.h.

const KFTrajectorySmoother* CRackTrajectoryBuilder::theSmoother
private

Definition at line 251 of file CRackTrajectoryBuilder.h.

KFUpdator* CRackTrajectoryBuilder::theUpdator
private

Definition at line 248 of file CRackTrajectoryBuilder.h.

edm::ESHandle<TrackerGeometry> CRackTrajectoryBuilder::tracker
private

Definition at line 240 of file CRackTrajectoryBuilder.h.

std::vector<Trajectory> CRackTrajectoryBuilder::trajFit
private

Definition at line 261 of file CRackTrajectoryBuilder.h.

bool CRackTrajectoryBuilder::useMatchedHits
private

Definition at line 257 of file CRackTrajectoryBuilder.h.