CMS 3D CMS Logo

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, edm::ConsumesCollector iC)
 
Trajectory createStartingTrajectory (const TrajectorySeed &seed) const
 
const TransientTrackingRecHitBuilderhitBuilder () 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, TSOSPairTrackingRecHitTsos
 
typedef TrajectoryMeasurement TM
 
typedef std::vector< const TrackingRecHit * >::iterator TrackingRecHitIterator
 
typedef std::pair< TrackingRecHitIterator, TrackingRecHitIteratorTrackingRecHitRange
 
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< TrajectoryMeasurementseedMeasurements (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

const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecordbuilderToken_
 
double chi2cut
 
bool debug_info
 
bool fastPropagation
 
std::string geometry
 
TransientTrackingRecHit::RecHitContainer hits
 
const MagneticFieldmagfield
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagfieldToken_
 
const TransientTrackingRecHitBuilderRHBuilder
 
bool seed_plus
 
Chi2MeasurementEstimatortheEstimator
 
const KFTrajectoryFittertheFitter
 
int theMinHits
 
PropagatorWithMaterialthePropagator
 
PropagatorWithMaterialthePropagatorOp
 
const KFTrajectorySmoothertheSmoother
 
KFUpdatortheUpdator
 
const TrackerGeometrytracker
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtrackerToken_
 
std::vector< TrajectorytrajFit
 
bool useMatchedHits
 

Friends

class CompareDetByTraj
 

Detailed Description

Definition at line 122 of file CRackTrajectoryBuilder.h.

Member Typedef Documentation

◆ PairTrackingRecHitTsos

Definition at line 134 of file CRackTrajectoryBuilder.h.

◆ TM

Definition at line 126 of file CRackTrajectoryBuilder.h.

◆ TrackingRecHitIterator

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

Definition at line 128 of file CRackTrajectoryBuilder.h.

◆ TrackingRecHitRange

Definition at line 130 of file CRackTrajectoryBuilder.h.

◆ TrackingRecHitRangeIterator

Definition at line 131 of file CRackTrajectoryBuilder.h.

◆ TSOS

Definition at line 125 of file CRackTrajectoryBuilder.h.

Constructor & Destructor Documentation

◆ CRackTrajectoryBuilder()

CRackTrajectoryBuilder::CRackTrajectoryBuilder ( const edm::ParameterSet conf,
edm::ConsumesCollector  iC 
)

Definition at line 29 of file CRackTrajectoryBuilder.cc.

References chi2cut, debug_info, fastPropagation, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), AlCaHLTBitMon_QueryRunRegistry::string, theMinHits, and useMatchedHits.

30  : magfieldToken_(iC.esConsumes()),
32  builderToken_(iC.esConsumes(edm::ESInputTag("", conf.getParameter<std::string>("TTRHBuilder")))) {
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  geometry = conf.getUntrackedParameter<std::string>("GeometricStructure", "STANDARD");
45 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfieldToken_
T getUntrackedParameter(std::string const &, T const &) const
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > builderToken_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerToken_
Log< level::Info, false > LogInfo

◆ ~CRackTrajectoryBuilder()

CRackTrajectoryBuilder::~CRackTrajectoryBuilder ( )

Definition at line 47 of file CRackTrajectoryBuilder.cc.

47  {
48  // delete theInitialState;
49 }

Member Function Documentation

◆ AddHit()

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

do the old version ....

Definition at line 472 of file CRackTrajectoryBuilder.cc.

References TransientTrackingRecHitBuilder::build(), chi2cut, Trajectory::chiSquared(), CompareDetByTraj, gather_cfg::cout, debug_info, fastPropagation, spr::find(), TrackingRecHit::geographicalId(), TrajectoryStateOnSurface::globalPosition(), hits, TrackerGeometry::idToDet(), TrajectoryStateOnSurface::isValid(), Trajectory::lastMeasurement(), Propagator::propagate(), Trajectory::push(), DetId::rawId(), RHBuilder, GeomDet::surface(), theEstimator, theUpdator, tracker, KFUpdator::update(), and TrajectoryMeasurement::updatedState().

Referenced by run().

474  {
475  vector<const TrackingRecHit*> Hits = _Hits;
476  if (Hits.empty())
477  return;
478 
479  if (debug_info)
480  cout << "CRackTrajectoryBuilder::AddHit" << endl;
481  if (debug_info)
482  cout << "START " << traj.lastMeasurement().updatedState() << endl;
483 
484  vector<TrackingRecHitRange> hitRangeByDet;
485  TrackingRecHitIterator prevDet;
486 
487  prevDet = Hits.begin();
488  for (TrackingRecHitIterator iHit = Hits.begin(); iHit != Hits.end(); iHit++) {
489  if ((*prevDet)->geographicalId() == (*iHit)->geographicalId())
490  continue;
491 
492  hitRangeByDet.push_back(make_pair(prevDet, iHit));
493  prevDet = iHit;
494  }
495  hitRangeByDet.push_back(make_pair(prevDet, Hits.end()));
496 
498 
499  if (fastPropagation) {
500  for (TrackingRecHitRangeIterator iHitRange = hitRangeByDet.begin(); iHitRange != hitRangeByDet.end(); iHitRange++) {
501  const TrackingRecHit* currHit = *(iHitRange->first);
502  DetId currDet = currHit->geographicalId();
503 
504  TSOS prSt =
505  currPropagator->propagate(traj.lastMeasurement().updatedState(), tracker->idToDet(currDet)->surface());
506 
507  if (!prSt.isValid()) {
508  if (debug_info)
509  cout << "Not Valid: PRST" << prSt.globalPosition();
510  // if (debug_info) cout << "Not Valid: HIT" << *currHit;
511 
512  continue;
513  }
514 
516  double chi2min = theEstimator->estimate(prSt, *bestHit).second;
517 
518  if (debug_info)
519  cout << "Size " << iHitRange->first - (*iHitRange).second << endl;
520  for (TrackingRecHitIterator iHit = (*iHitRange).first + 1; iHit != iHitRange->second; iHit++) {
521  if (debug_info)
522  cout << "loop3 "
523  << " " << Hits.end() - iHit << endl;
524 
526  double currChi2 = theEstimator->estimate(prSt, *tmpHit).second;
527  if (currChi2 < chi2min) {
528  chi2min = currChi2;
529  bestHit = tmpHit;
530  }
531  }
532  //now we have check if the track can be added to the trajectory
533  if (debug_info)
534  cout << chi2min << endl;
535  if (chi2min < chi2cut) {
536  if (debug_info)
537  cout << "chi2 fine : " << chi2min << endl;
538  TSOS UpdatedState = theUpdator->update(prSt, *bestHit);
539  if (UpdatedState.isValid()) {
540  hits.push_back(bestHit);
541  traj.push(TM(prSt, UpdatedState, bestHit, chi2min));
542  if (debug_info)
543  edm::LogInfo("CosmicTrackFinder") << "STATE UPDATED WITH HIT AT POSITION "
544 
545  << bestHit->globalPosition() << UpdatedState << " " << traj.chiSquared();
546  if (debug_info)
547  cout << "STATE UPDATED WITH HIT AT POSITION "
548 
549  << bestHit->globalPosition() << UpdatedState << " " << traj.chiSquared();
550  if (debug_info)
551  cout << "State is valid ..." << endl;
552  break; // now we need to
553  } else {
554  edm::LogWarning("CosmicTrackFinder") << " State can not be updated with hit at position " << endl;
555  TSOS UpdatedState = theUpdator->update(prSt, *bestHit);
556  if (UpdatedState.isValid()) {
557  cout << "NOT! UPDATED WITH HIT AT POSITION "
558 
559  << bestHit->globalPosition() << UpdatedState << " " << traj.chiSquared();
560  }
561  }
562  }
563  }
564  } //simple version end
565  else {
566  //first sort the dets in the order they are traversed by the trajectory
567  // we need three loops:
568  // 1: loop as long as there can be an new hit added to the trajectory
569  // 2: loop over all dets that might be hit
570  // 3: loop over all hits on a certain det
571 
572  std::vector<std::pair<TrackingRecHitRangeIterator, TSOS> > trackHitCandidates;
573  std::vector<std::pair<TrackingRecHitRangeIterator, TSOS> >::iterator iHitRange;
574  std::vector<uint32_t> processedDets;
575  do {
576  //create vector of possibly hit detectors...
577  trackHitCandidates.clear();
578  DetId currDet;
579  for (TrackingRecHitRangeIterator iHit = hitRangeByDet.begin(); iHit != hitRangeByDet.end(); iHit++) {
580  const TrackingRecHit* currHit = *(iHit->first);
581  currDet = currHit->geographicalId();
582 
583  if (find(processedDets.begin(), processedDets.end(), currDet.rawId()) != processedDets.end())
584  continue;
585 
586  TSOS prSt =
587  currPropagator->propagate(traj.lastMeasurement().updatedState(), tracker->idToDet(currDet)->surface());
588  if ((!prSt.isValid()) ||
589  (theEstimator->Chi2MeasurementEstimatorBase::estimate(prSt, tracker->idToDet(currDet)->surface()) == false))
590  // if ( ( !prSt.isValid() ) || (theEstimator->estimate(prSt,tracker->idToDet(currDet)->surface() ) == false) )
591  continue;
592 
593  trackHitCandidates.push_back(make_pair(iHit, prSt));
594  }
595 
596  if (trackHitCandidates.empty())
597  break;
598 
599  if (debug_info)
600  cout << Hits.size() << " (int) trackHitCandidates.begin() " << trackHitCandidates.size() << endl;
601  if (debug_info)
602  cout << "Before sorting ... " << endl;
603 
604  if (debug_info)
605  for (iHitRange = trackHitCandidates.begin(); iHitRange != trackHitCandidates.end(); iHitRange++) {
606  if (debug_info)
607  cout << (tracker->idToDet((*(iHitRange->first->first))->geographicalId()))->position();
608  }
609  if (debug_info)
610  cout << endl;
611 
612  stable_sort(trackHitCandidates.begin(),
613  trackHitCandidates.end(),
615 
616  if (debug_info)
617  cout << "After sorting ... " << endl;
618  if (debug_info) {
619  for (iHitRange = trackHitCandidates.begin(); iHitRange != trackHitCandidates.end(); iHitRange++) {
620  if (debug_info)
621  cout << (tracker->idToDet((*(iHitRange->first->first))->geographicalId()))->position();
622  }
623  cout << endl;
624  }
625 
626  for (iHitRange = trackHitCandidates.begin(); iHitRange != trackHitCandidates.end(); iHitRange++) //loop over dets
627  {
628  //now find the best hit of the detector
629  if (debug_info)
630  cout << "loop2 " << trackHitCandidates.size() << " " << trackHitCandidates.end() - iHitRange << endl;
631  const TrackingRecHit* currHit = *(iHitRange->first->first);
632 
634  TSOS currPrSt = (*iHitRange).second;
635 
636  if (debug_info)
637  cout << "curr position" << bestHit->globalPosition();
638  for (TrackingRecHitIterator iHit = (*iHitRange).first->first + 1; iHit != iHitRange->first->second; iHit++) {
640  if (debug_info)
641  cout << "curr position" << tmpHit->globalPosition();
642  }
643  }
644  if (debug_info)
645  cout << "Cross check end ..." << endl;
646 
647  //just a simple test if the same hit can be added twice ...
648  // for( iHitRange = trackHitCandidates.begin(); iHitRange != trackHitCandidates.end(); iHitRange++ ) //loop over all hits
649 
650  // break;
651 
652  for (iHitRange = trackHitCandidates.begin(); iHitRange != trackHitCandidates.end();
653  iHitRange++) //loop over detsall hits
654  {
655  //now find the best hit of the detector
656  if (debug_info)
657  cout << "loop2 " << trackHitCandidates.size() << " " << trackHitCandidates.end() - iHitRange << endl;
658 
659  const TrackingRecHit* currHit = *(iHitRange->first->first);
660 
661  processedDets.push_back(currHit->geographicalId().rawId());
662 
664 
665  if (debug_info)
666  cout << "curr position A" << bestHit->globalPosition() << endl;
667  TSOS currPrSt = (*iHitRange).second;
668  double chi2min = theEstimator->estimate(currPrSt, *bestHit).second;
669 
670  if (debug_info)
671  cout << "Size " << iHitRange->first->second - (*iHitRange).first->first << endl;
672  for (TrackingRecHitIterator iHit = (*iHitRange).first->first + 1; iHit != iHitRange->first->second; iHit++) {
673  if (debug_info)
674  cout << "loop3 "
675  << " " << Hits.end() - iHit << endl;
676 
678  if (debug_info)
679  cout << "curr position B" << tmpHit->globalPosition() << endl;
680  double currChi2 = theEstimator->estimate(currPrSt, *tmpHit).second;
681  if (currChi2 < chi2min) {
682  if (debug_info)
683  cout << "Is best hit" << endl;
684  chi2min = currChi2;
685  bestHit = tmpHit;
686  }
687  }
688  //now we have checked the det and can remove the entry from the vector...
689 
690  //if (debug_info) cout << "before erase ..." << endl;
691  //this is to slow ...
692  // hitRangeByDet.erase( (*iHitRange).first,(*iHitRange).first+1 );
693  //if (debug_info) cout << "after erase ..." << endl;
694 
695  if (debug_info)
696  cout << chi2min << endl;
697  //if the track can be added to the trajectory
698  if (chi2min < chi2cut) {
699  if (debug_info)
700  cout << "chi2 fine : " << chi2min << endl;
701 
702  // if (debug_info) cout << "previaous state " << traj.lastMeasurement().updatedState() <<endl;
703  TSOS UpdatedState = theUpdator->update(currPrSt, *bestHit);
704  if (UpdatedState.isValid()) {
705  hits.push_back(bestHit);
706  traj.push(TM(currPrSt, UpdatedState, bestHit, chi2min));
707  if (debug_info)
708  edm::LogInfo("CosmicTrackFinder") << "STATE UPDATED WITH HIT AT POSITION "
709  // <<tmphitbestdet->globalPosition()
710  << UpdatedState << " " << traj.chiSquared();
711  if (debug_info)
712  cout << "Added Hit" << bestHit->globalPosition() << endl;
713  if (debug_info)
714  cout << "State is valid ..." << UpdatedState << endl;
715  //cout << "updated state " << traj.lastMeasurement().updatedState() <<endl;
716 
717  // return; //break;
718  //
719  // TSOS prSt= currPropagator->propagate(traj.lastMeasurement().updatedState(),
720  // tracker->idToDet( bestHit->geographicalId() )->surface());
721  //
722  // if ( prSt.isValid())
723  // cout << "the same hit can be added twice ..." << endl;
724  //
725 
726  break;
727  } else {
728  if (debug_info)
729  edm::LogWarning("CosmicTrackFinder")
730  << " State can not be updated with hit at position " << bestHit->globalPosition();
731  // cout << "State can not be updated with hit at " << bestHit->globalPosition() << endl;
732  }
733  continue;
734  } else {
735  // cout << "chi2 to big : " << chi2min << endl;
736  }
737  if (debug_info)
738  cout << " continue 1 " << endl;
739  }
740  //now we remove all already processed dets from the list ...
741  // hitRangeByDet.erase( (*trackHitCandidates.begin()).first,(*iHitRange).first+1 );
742 
743  if (debug_info)
744  cout << " continue 2 " << endl;
745  }
746  //if this was the last exit
747  while (iHitRange != trackHitCandidates.end());
748  }
749 }
std::vector< TrackingRecHitRange >::iterator TrackingRecHitRangeIterator
Chi2MeasurementEstimator * theEstimator
const TransientTrackingRecHitBuilder * RHBuilder
float chiSquared() const
Definition: Trajectory.h:241
TransientTrackingRecHit::RecHitContainer hits
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:150
std::vector< const TrackingRecHit * >::iterator TrackingRecHitIterator
GlobalPoint globalPosition() const
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
Definition: KFUpdator.cc:177
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
const TrackerGeometry * tracker
const TrackerGeomDet * idToDet(DetId) const override
std::shared_ptr< TrackingRecHit const > RecHitPointer
Log< level::Info, false > LogInfo
Definition: DetId.h:17
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
DetId geographicalId() const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
TrajectoryStateOnSurface const & updatedState() const
Log< level::Warning, false > LogWarning
void push(const TrajectoryMeasurement &tm)
Definition: Trajectory.cc:50
TrajectoryMeasurement TM

◆ createStartingTrajectory()

Trajectory CRackTrajectoryBuilder::createStartingTrajectory ( const TrajectorySeed seed) const

Definition at line 212 of file CRackTrajectoryBuilder.cc.

References mps_fire::i, eostools::move(), mps_fire::result, fileCollector::seed, and seedMeasurements().

Referenced by run(), and SortHits().

212  {
213  Trajectory result(seed, seed.direction());
214  std::vector<TM>&& seedMeas = seedMeasurements(seed);
215  for (auto i : seedMeas)
216  result.push(std::move(i));
217  return result;
218 }
std::vector< TrajectoryMeasurement > seedMeasurements(const TrajectorySeed &seed) const
def move(src, dest)
Definition: eostools.py:511

◆ hitBuilder()

const TransientTrackingRecHitBuilder* CRackTrajectoryBuilder::hitBuilder ( ) const
inline

Definition at line 192 of file CRackTrajectoryBuilder.h.

References RHBuilder.

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

192 { return RHBuilder; }
const TransientTrackingRecHitBuilder * RHBuilder

◆ init()

void CRackTrajectoryBuilder::init ( const edm::EventSetup es,
bool  seedplus 
)

Definition at line 51 of file CRackTrajectoryBuilder.cc.

References alongMomentum, builderToken_, chi2cut, Chi2MeasurementEstimator_cfi::Chi2MeasurementEstimator, edm::EventSetup::getData(), magfield, magfieldToken_, oppositeToMomentum, RHBuilder, seed_plus, theEstimator, theFitter, thePropagator, thePropagatorOp, theSmoother, theUpdator, tracker, and trackerToken_.

Referenced by run().

51  {
52  // edm::ParameterSet tise_params = conf_.getParameter<edm::ParameterSet>("TransientInitialStateEstimatorParameters") ;
53  // theInitialState = new TransientInitialStateEstimator( es,tise_params);
54 
55  //services
58 
59  if (seedplus) {
60  seed_plus = true;
63  } else {
64  seed_plus = false;
67  }
68 
69  theUpdator = new KFUpdator();
70  // theUpdator= new KFStripUpdator();
72 
74 
75  theFitter = new KFTrajectoryFitter(*thePropagator, *theUpdator, *theEstimator);
76 
78 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
Chi2MeasurementEstimator * theEstimator
const TransientTrackingRecHitBuilder * RHBuilder
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfieldToken_
const KFTrajectorySmoother * theSmoother
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > builderToken_
const TrackerGeometry * tracker
PropagatorWithMaterial * thePropagatorOp
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerToken_
const MagneticField * magfield
PropagatorWithMaterial * thePropagator
const KFTrajectoryFitter * theFitter

◆ innerState()

std::pair< TrajectoryStateOnSurface, const GeomDet * > CRackTrajectoryBuilder::innerState ( const Trajectory traj) const
private

Definition at line 791 of file CRackTrajectoryBuilder.cc.

References alongMomentum, correctionTermsCaloMet_cff::C, Chi2MeasurementEstimator_cfi::Chi2MeasurementEstimator, Trajectory::direction(), Trajectory::foundHits(), mps_fire::i, sistrip::SpyUtilities::isValid(), TrajectoryStateOnSurface::localParameters(), PropagatorWithMaterial::magneticField(), Trajectory::measurements(), TrackingDataMCValidation_Standalone_cff::nhits, oppositeToMomentum, rpcPointValidation_cfi::recHit, TrajectoryMeasurement::recHit(), TrajectoryStateOnSurface::surface(), thePropagator, and TrajectoryMeasurement::updatedState().

Referenced by run().

791  {
792  int lastFitted = 999;
793  int nhits = traj.foundHits();
794  if (nhits < lastFitted + 1)
795  lastFitted = nhits - 1;
796 
797  std::vector<TrajectoryMeasurement> measvec = traj.measurements();
799 
800  bool foundLast = false;
801  int actualLast = -99;
802  for (int i = lastFitted; i >= 0; i--) {
803  if (measvec[i].recHit()->isValid()) {
804  if (!foundLast) {
805  actualLast = i;
806  foundLast = true;
807  }
808  firstHits.push_back(measvec[i].recHit());
809  }
810  }
811  TSOS unscaledState = measvec[actualLast].updatedState();
812  AlgebraicSymMatrix55 C = ROOT::Math::SMatrixIdentity();
813  // C *= 100.;
814 
815  TSOS startingState(unscaledState.localParameters(),
817  unscaledState.surface(),
819 
820  // cout << endl << "FitTester starts with state " << startingState << endl;
821 
822  KFTrajectoryFitter backFitter(*thePropagator, KFUpdator(), Chi2MeasurementEstimator(100., 3));
823 
825 
826  // only direction matters in this contest
828 
829  vector<Trajectory> fitres = backFitter.fit(fakeSeed, firstHits, startingState);
830 
831  if (fitres.size() != 1) {
832  // cout << "FitTester: first hits fit failed!" << endl;
833  return std::pair<TrajectoryStateOnSurface, const GeomDet*>();
834  }
835 
836  TrajectoryMeasurement firstMeas = fitres[0].lastMeasurement();
837  const TSOS& firstState = firstMeas.updatedState();
838 
839  // cout << "FitTester: Fitted first state " << firstState << endl;
840  //cout << "FitTester: chi2 = " << fitres[0].chiSquared() << endl;
841 
842  TSOS initialState(
843  firstState.localParameters(), LocalTrajectoryError(C), firstState.surface(), thePropagator->magneticField());
844 
845  return std::pair<TrajectoryStateOnSurface, const GeomDet*>(initialState, firstMeas.recHit()->det());
846 }
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
const LocalTrajectoryParameters & localParameters() const
PropagationDirection
const SurfaceType & surface() const
int foundHits() const
Definition: Trajectory.h:206
DataContainer const & measurements() const
Definition: Trajectory.h:178
PropagationDirection const & direction() const
Definition: Trajectory.cc:133
std::vector< ConstRecHitPointer > ConstRecHitContainer
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const MagneticField * magneticField() const override
PropagatorWithMaterial * thePropagator
TrajectoryStateOnSurface const & updatedState() const
ConstRecHitPointer const & recHit() const

◆ isDifferentStripReHit2D()

bool CRackTrajectoryBuilder::isDifferentStripReHit2D ( const SiStripRecHit2D hitA,
const SiStripRecHit2D hitB 
)
private

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

Referenced by SortHits().

774  {
775  if (hitA.geographicalId() != hitB.geographicalId())
776  return true;
777  if (hitA.localPosition().x() != hitB.localPosition().x())
778  return true;
779  if (hitA.localPosition().y() != hitB.localPosition().y())
780  return true;
781  if (hitA.localPosition().z() != hitB.localPosition().z())
782  return true;
783 
784  // if (debug_info) cout << hitA.localPosition() << endl;
785  // if (debug_info) cout << hitB << endl;
786 
787  return false;
788 }
T z() const
Definition: PV3DBase.h:61
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
DetId geographicalId() const
LocalPoint localPosition() const override

◆ qualityFilter()

bool CRackTrajectoryBuilder::qualityFilter ( const Trajectory traj)
private

Definition at line 751 of file CRackTrajectoryBuilder.cc.

References Trajectory::foundHits(), hits, Trajectory::recHits(), and theMinHits.

Referenced by run().

751  {
752  int ngoodhits = 0;
753  if (geometry == "MTCC") {
754  auto hits = traj.recHits();
755  for (auto hit = hits.begin(); hit != hits.end(); hit++) {
756  unsigned int iid = (*hit)->hit()->geographicalId().rawId();
757  //CHECK FOR 3 hits r-phi
758  if (((iid >> 0) & 0x3) != 1)
759  ngoodhits++;
760  }
761  } else
762  ngoodhits = traj.foundHits();
763 
764  if (ngoodhits >= theMinHits) {
765  return true;
766  } else {
767  return false;
768  }
769 }
TransientTrackingRecHit::RecHitContainer hits
int foundHits() const
Definition: Trajectory.h:206
ConstRecHitContainer recHits() const
Definition: Trajectory.h:186

◆ run()

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 80 of file CRackTrajectoryBuilder.cc.

References AddHit(), alongMomentum, TransientTrackingRecHitBuilder::build(), gather_cfg::cout, createStartingTrajectory(), debug_info, Trajectory::firstMeasurement(), Trajectory::foundHits(), hits, TrackerGeometry::idToDet(), init(), innerState(), iseed, sistrip::SpyUtilities::isValid(), PropagatorWithMaterial::propagate(), qualityFilter(), Trajectory::recHits(), groupFilesInBlocks::reverse, RHBuilder, Trajectory::seed(), seed_plus, SortHits(), theEstimator, theFitter, thePropagator, thePropagatorOp, theSmoother, theUpdator, tracker, TrajectorySmoother::trajectories(), trajFit, and TrajectoryMeasurement::updatedState().

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

87  {
88  std::vector<Trajectory> trajSmooth;
89  std::vector<Trajectory>::iterator trajIter;
90 
91  TrajectorySeedCollection::const_iterator iseed;
92  unsigned int IS = 0;
93  for (iseed = collseed.begin(); iseed != collseed.end(); iseed++) {
94  bool seedplus = ((*iseed).direction() == alongMomentum);
95  init(es, seedplus);
96  hits.clear();
97  trajFit.clear();
98  trajSmooth.clear();
99 
100  Trajectory startingTraj = createStartingTrajectory(*iseed);
101  Trajectory trajTmp; // used for the opposite direction
102  Trajectory traj = startingTraj;
103 
104  //first propagate track in opposite direction ...
105  seed_plus = !seed_plus;
106  vector<const TrackingRecHit*> allHitsOppsite = SortHits(collstereo, collrphi, collmatched, collpixel, *iseed, true);
107  seed_plus = !seed_plus;
108  if (!allHitsOppsite.empty()) {
109  //there are hits which are above the seed,
110  //cout << "Number of hits higher than seed " <<allHitsOppsite.size() << endl;
111 
112  AddHit(traj, allHitsOppsite, thePropagatorOp);
113 
114  if (debug_info) {
115  cout << "Hits in opposite direction..." << endl;
116  TransientTrackingRecHit::RecHitContainer::const_iterator iHit;
117  for (iHit = hits.begin(); iHit != hits.end(); iHit++) {
118  cout << (**iHit).globalPosition() << endl;
119  }
120  }
121 
122  // now add hist opposite to seed
123  //now crate new starting trajectory
124  reverse(hits.begin(), hits.end());
125  if (thePropagatorOp
126  ->propagate(traj.firstMeasurement().updatedState(),
127  tracker->idToDet((hits.front())->geographicalId())->surface())
128  .isValid()) {
129  TSOS startingStateNew = //TrajectoryStateWithArbitraryError()//
131  tracker->idToDet((hits.front())->geographicalId())->surface()));
132 
133  if (debug_info) {
134  cout << "Hits in opposite direction reversed..." << endl;
135  TransientTrackingRecHit::RecHitContainer::const_iterator iHit;
136  for (iHit = hits.begin(); iHit != hits.end(); iHit++) {
137  cout << (**iHit).globalPosition() << endl;
138  }
139  }
140 
141  const TrajectorySeed& tmpseed = traj.seed();
142  trajTmp = theFitter->fit(tmpseed, hits, startingStateNew).front();
143 
144  if (debug_info) {
145  cout << "Debugging show fitted hits" << endl;
146  auto hitsFit = trajTmp.recHits();
147  for (auto hit = hitsFit.begin(); hit != hitsFit.end(); hit++) {
148  cout << RHBuilder->build(&(*(*hit)->hit()))->globalPosition() << endl;
149  }
150  }
151  }
152  } else {
153  if (debug_info)
154  cout << "There are no hits in opposite direction ..." << endl;
155  }
156 
157  vector<const TrackingRecHit*> allHits;
158  if (trajTmp.foundHits()) {
159  traj = trajTmp;
160  allHits = SortHits(collstereo, collrphi, collmatched, collpixel, *iseed, false);
161  } else {
162  traj = startingTraj;
163  hits.clear();
164  allHits = SortHits(collstereo, collrphi, collmatched, collpixel, *iseed, true);
165  }
166 
167  AddHit(traj, allHits, thePropagator);
168 
169  if (debug_info) {
170  cout << "Debugging show All fitted hits" << endl;
171  auto hits = traj.recHits();
172  for (auto hit = hits.begin(); hit != hits.end(); hit++) {
173  cout << (*hit)->globalPosition() << endl;
174  }
175 
176  cout << qualityFilter(traj) << " <- quality filter good?" << endl;
177  }
178 
179  if (debug_info)
180  cout << "now do quality checks" << endl;
181  if (qualityFilter(traj)) {
182  const TrajectorySeed& tmpseed = traj.seed();
183  std::pair<TrajectoryStateOnSurface, const GeomDet*> initState =
184  innerState(traj); //theInitialState->innerState(traj);
185  if (initState.first.isValid())
186  trajFit = theFitter->fit(tmpseed, hits, initState.first);
187  }
188 
189  for (trajIter = trajFit.begin(); trajIter != trajFit.end(); trajIter++) {
190  trajSmooth = theSmoother->trajectories((*trajIter));
191  }
192  for (trajIter = trajSmooth.begin(); trajIter != trajSmooth.end(); trajIter++) {
193  if ((*trajIter).isValid()) {
194  if (debug_info)
195  cout << "adding track ... " << endl;
196  trajoutput.push_back((*trajIter));
197  }
198  }
199  delete theUpdator;
200  delete theEstimator;
201  delete thePropagator;
202  delete thePropagatorOp;
203  delete theFitter;
204  delete theSmoother;
205  //Only the first 30 seeds are considered
206  if (IS > 30)
207  return;
208  IS++;
209  }
210 }
virtual TrajectoryContainer trajectories(const Trajectory &traj) const
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
Chi2MeasurementEstimator * theEstimator
const TransientTrackingRecHitBuilder * RHBuilder
std::pair< TrajectoryStateOnSurface, const GeomDet * > innerState(const Trajectory &traj) const
TransientTrackingRecHit::RecHitContainer hits
int foundHits() const
Definition: Trajectory.h:206
const KFTrajectorySmoother * theSmoother
std::vector< Trajectory > trajFit
bool qualityFilter(const Trajectory &traj)
void AddHit(Trajectory &traj, const std::vector< const TrackingRecHit *> &Hits, Propagator *currPropagator)
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
ConstRecHitContainer recHits() const
Definition: Trajectory.h:186
const TrackerGeometry * tracker
PropagatorWithMaterial * thePropagatorOp
const TrackerGeomDet * idToDet(DetId) const override
int iseed
Definition: AMPTWrapper.h:134
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:263
Trajectory createStartingTrajectory(const TrajectorySeed &seed) const
void init(const edm::EventSetup &es, bool)
PropagatorWithMaterial * thePropagator
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
TrajectoryStateOnSurface const & updatedState() const
const KFTrajectoryFitter * theFitter
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:166
std::vector< const TrackingRecHit * > SortHits(const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const SiPixelRecHitCollection &collpixel, const TrajectorySeed &seed, const bool bAddSeedHits)

◆ seedMeasurements()

std::vector< TrajectoryMeasurement > CRackTrajectoryBuilder::seedMeasurements ( const TrajectorySeed seed) const
private

Definition at line 220 of file CRackTrajectoryBuilder.cc.

References TransientTrackingRecHitBuilder::build(), rpcPointValidation_cfi::recHit, mps_fire::result, RHBuilder, fileCollector::seed, startingTSOS(), and GeomDet::surface().

Referenced by createStartingTrajectory().

220  {
221  std::vector<TrajectoryMeasurement> result;
222  auto const& hitRange = seed.recHits();
223  for (auto ihit = hitRange.begin(); ihit != hitRange.end(); ihit++) {
224  //RC TransientTrackingRecHit* recHit = RHBuilder->build(&(*ihit));
226  const GeomDet* hitGeomDet = (&(*tracker))->idToDet(ihit->geographicalId());
227  TSOS invalidState(new BasicSingleTrajectoryState(hitGeomDet->surface()));
228 
229  if (ihit == hitRange.end() - 1) {
230  TSOS updatedState = startingTSOS(seed);
231  result.emplace_back(invalidState, updatedState, recHit);
232 
233  } else {
234  result.emplace_back(invalidState, recHit);
235  }
236  }
237 
238  return result;
239 }
const TransientTrackingRecHitBuilder * RHBuilder
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
TSOS startingTSOS(const TrajectorySeed &seed) const
std::shared_ptr< TrackingRecHit const > RecHitPointer
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37

◆ SortHits()

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 241 of file CRackTrajectoryBuilder.cc.

References TransientTrackingRecHitBuilder::build(), gather_cfg::cout, createStartingTrajectory(), edmNew::DetSetVector< T >::data(), debug_info, spr::find(), TrackingRecHit::geographicalId(), TrajectoryStateOnSurface::globalPosition(), hits, TrackerGeometry::idToDet(), isDifferentStripReHit2D(), TrajectoryStateOnSurface::isValid(), Trajectory::lastMeasurement(), TrajectoryStateOnSurface::localError(), LogDebug, visualization-live-secondInstance_cfg::m, LocalTrajectoryError::matrix(), SiStripMatchedRecHit2D::monoHit(), PropagatorWithMaterial::propagate(), DetId::rawId(), RHBuilder, alignCSCRings::s, fileCollector::seed, seed_plus, startingTSOS(), SiStripMatchedRecHit2D::stereoHit(), thePropagator, tracker, TrajectoryMeasurement::updatedState(), useMatchedHits, multiplicitycorr_cfi::yMax, and photonAnalyzer_cfi::yMin.

Referenced by run().

246  {
247  //The Hits with global y more than the seed are discarded
248  //The Hits correspondign to the seed are discarded
249  //At the end all the hits are sorted in y
250  vector<const TrackingRecHit*> allHits;
251 
253  float yref = 0.;
254 
255  if (debug_info)
256  cout << "SEED " << startingTSOS(seed) << endl;
257  if (debug_info)
258  cout << "seed hits size " << seed.nHits() << endl;
259 
260  //seed debugging:
261  // GeomDet *seedDet = tracker->idToDet(seed.startingState().detId());
262 
263  // edm::LogInfo("CRackTrajectoryBuilder::SortHits") << "SEED " << seed.startingState();
264 
265  edm::LogInfo("CRackTrajectoryBuilder::SortHits") << "SEED " << startingTSOS(seed);
266  // edm::LogInfo("CRackTrajectoryBuilder::SortHits" << "seed hits size " << seed.nHits();
267 
268  // if (seed.nHits()<2)
269  // return allHits;
270 
271  float_t yMin = 0.;
272  float_t yMax = 0.;
273 
274  int seedHitSize = seed.nHits();
275 
276  vector<int> detIDSeedMatched(seedHitSize);
277  vector<int> detIDSeedRphi(seedHitSize);
278  vector<int> detIDSeedStereo(seedHitSize);
279 
280  auto const& hRange = seed.recHits();
281  for (auto ihit = hRange.begin(); ihit != hRange.end(); ihit++) {
282  // need to find track with lowest (seed_plus)/ highest y (seed_minus)
283  // split matched hits ...
284  const SiStripMatchedRecHit2D* matchedhit = dynamic_cast<const SiStripMatchedRecHit2D*>(&(*ihit));
285 
286  yref = RHBuilder->build(&(*ihit))->globalPosition().y();
287  if (ihit == hRange.begin()) {
288  yMin = yref;
289  yMax = yref;
290  }
291 
292  if (matchedhit) {
293  auto m = matchedhit->monoHit();
294  auto s = matchedhit->stereoHit();
295  float_t yGlobRPhi = RHBuilder->build(&m)->globalPosition().y();
296  float_t yGlobStereo = RHBuilder->build(&s)->globalPosition().y();
297 
298  if (debug_info)
299  cout << "Rphi ..." << yGlobRPhi << endl;
300  if (debug_info)
301  cout << "Stereo ..." << yGlobStereo << endl;
302 
303  if (yGlobStereo < yMin)
304  yMin = yGlobStereo;
305  if (yGlobRPhi < yMin)
306  yMin = yGlobRPhi;
307 
308  if (yGlobStereo > yMax)
309  yMax = yGlobStereo;
310  if (yGlobRPhi > yMax)
311  yMax = yGlobRPhi;
312 
313  detIDSeedMatched.push_back(matchedhit->geographicalId().rawId());
314  detIDSeedRphi.push_back(m.geographicalId().rawId());
315  detIDSeedStereo.push_back(s.geographicalId().rawId());
316 
317  if (bAddSeedHits) {
318  if (useMatchedHits) {
319  hits.push_back((RHBuilder->build(&(*ihit))));
320  } else {
321  if (((yGlobRPhi > yGlobStereo) && seed_plus) || ((yGlobRPhi < yGlobStereo) && !seed_plus)) {
322  hits.push_back((RHBuilder->build(&m)));
323  hits.push_back((RHBuilder->build(&s)));
324  } else {
325  hits.push_back((RHBuilder->build(&s)));
326  hits.push_back((RHBuilder->build(&m)));
327  }
328  }
329  }
330  } else if (bAddSeedHits) {
331  hits.push_back((RHBuilder->build(&(*ihit))));
332  detIDSeedRphi.push_back(ihit->geographicalId().rawId());
333  detIDSeedMatched.push_back(-1);
334  detIDSeedStereo.push_back(-1);
335  }
336 
337  if (yref < yMin)
338  yMin = yref;
339  if (yref > yMax)
340  yMax = yref;
341 
342  // if (bAddSeedHits)
343  // hits.push_back((RHBuilder->build(&(*ihit))));
344 
345  LogDebug("CosmicTrackFinder") << "SEED HITS" << RHBuilder->build(&(*ihit))->globalPosition();
346  if (debug_info)
347  cout << "SEED HITS" << RHBuilder->build(&(*ihit))->globalPosition() << endl;
348  // if (debug_info) cout <<"SEED HITS"<< seed.startingState().parameters() << endl;
349  }
350 
351  yref = (seed_plus) ? yMin : yMax;
352 
354  for (ipix = collpixel.data().begin(); ipix != collpixel.data().end(); ipix++) {
355  float ych = RHBuilder->build(&(*ipix))->globalPosition().y();
356  if ((seed_plus && (ych < yref)) || (!(seed_plus) && (ych > yref)))
357  allHits.push_back(&(*ipix));
358  }
359 
360  if (useMatchedHits) // use matched
361  {
362  //add the matched hits ...
364 
365  for (istripm = collmatched.data().begin(); istripm != collmatched.data().end(); istripm++) {
366  float ych = RHBuilder->build(&(*istripm))->globalPosition().y();
367 
368  int cDetId = istripm->geographicalId().rawId();
369  bool noSeedDet = (detIDSeedMatched.end() == find(detIDSeedMatched.begin(), detIDSeedMatched.end(), cDetId));
370 
371  if (noSeedDet)
372  if ((seed_plus && (ych < yref)) || (!(seed_plus) && (ych > yref)))
373  allHits.push_back(&(*istripm));
374  }
375 
376  //add the rpi hits, but only accept hits that are not matched hits
377  for (istrip = collrphi.data().begin(); istrip != collrphi.data().end(); istrip++) {
378  float ych = RHBuilder->build(&(*istrip))->globalPosition().y();
379  StripSubdetector monoDetId(istrip->geographicalId());
380  if (monoDetId.partnerDetId()) {
381  edm::LogInfo("CRackTrajectoryBuilder::SortHits") << "this det belongs to a glued det " << ych << endl;
382  continue;
383  }
384  int cDetId = istrip->geographicalId().rawId();
385  bool noSeedDet = (detIDSeedRphi.end() == find(detIDSeedRphi.begin(), detIDSeedRphi.end(), cDetId));
386  if (noSeedDet)
387  if ((seed_plus && (ych < yref)) || (!(seed_plus) && (ych > yref))) {
388  bool hitIsUnique = true;
389  //now
390  for (istripm = collmatched.data().begin(); istripm != collmatched.data().end(); istripm++) {
391  // if ( isDifferentStripReHit2D ( *istrip, (istripm->stereoHit() ) ) == false)
392  if (isDifferentStripReHit2D(*istrip, (istripm->monoHit())) == false) {
393  hitIsUnique = false;
394  edm::LogInfo("CRackTrajectoryBuilder::SortHits") << "rphi hit is in matched hits; y: " << ych << endl;
395  break;
396  }
397  } //end loop over all matched
398  if (hitIsUnique) {
399  // if (debug_info) cout << "adding rphi hit " << &(*istrip) << endl;
400  allHits.push_back(&(*istrip));
401  }
402  }
403  }
404 
405  } else // dont use matched ...
406  {
407  for (istrip = collrphi.data().begin(); istrip != collrphi.data().end(); istrip++) {
408  float ych = RHBuilder->build(&(*istrip))->globalPosition().y();
409  if ((seed_plus && (ych < yref)) || (!(seed_plus) && (ych > yref)))
410  allHits.push_back(&(*istrip));
411  }
412 
413  for (istrip = collstereo.data().begin(); istrip != collstereo.data().end(); istrip++) {
414  float ych = RHBuilder->build(&(*istrip))->globalPosition().y();
415  if ((seed_plus && (ych < yref)) || (!(seed_plus) && (ych > yref)))
416  allHits.push_back(&(*istrip));
417  }
418  }
419 
420  if (seed_plus)
421  stable_sort(allHits.begin(), allHits.end(), CompareHitY_plus(*tracker));
422  else
423  stable_sort(allHits.begin(), allHits.end(), CompareHitY(*tracker));
424 
425  if (debug_info) {
426  if (debug_info)
427  cout << "all hits" << endl;
428 
429  //starting trajectory
430  Trajectory startingTraj = createStartingTrajectory(seed);
431 
432  if (debug_info)
433  cout << "START " << startingTraj.lastMeasurement().updatedState() << endl;
434  if (debug_info)
435  cout << "START Err" << startingTraj.lastMeasurement().updatedState().localError().matrix() << endl;
436 
437  vector<const TrackingRecHit*>::iterator iHit;
438  for (iHit = allHits.begin(); iHit < allHits.end(); iHit++) {
439  GlobalPoint gphit = RHBuilder->build(*iHit)->globalPosition();
440  if (debug_info)
441  cout << "GH " << gphit << endl;
442 
443  // tracker->idToDet((*iHit)->geographicalId())->surface();
444 
445  TSOS prSt = thePropagator->propagate(startingTraj.lastMeasurement().updatedState(),
446  tracker->idToDet((*iHit)->geographicalId())->surface());
447 
448  if (prSt.isValid()) {
449  if (debug_info)
450  cout << "PR " << prSt.globalPosition() << endl;
451  //if (debug_info) cout << "PR Err" << prSt.localError().matrix() << endl;
452 
453  } else {
454  if (debug_info)
455  cout << "not valid" << endl;
456  }
457  }
458  if (debug_info)
459  cout << "all hits end" << endl;
460  }
461 
462  return allHits;
463 }
SiStripRecHit2D stereoHit() const
const LocalTrajectoryError & localError() const
data_type const * data(size_t cell) 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:19
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:150
GlobalPoint globalPosition() const
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
const TrackerGeometry * tracker
TSOS startingTSOS(const TrajectorySeed &seed) const
const TrackerGeomDet * idToDet(DetId) const override
Log< level::Info, false > LogInfo
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
DetId geographicalId() const
bool isDifferentStripReHit2D(const SiStripRecHit2D &hitA, const SiStripRecHit2D &hitB)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
Trajectory createStartingTrajectory(const TrajectorySeed &seed) const
PropagatorWithMaterial * thePropagator
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
TrajectoryStateOnSurface const & updatedState() const
const AlgebraicSymMatrix55 & matrix() const
SiStripRecHit2D monoHit() const
#define LogDebug(id)

◆ startingTSOS()

TrajectoryStateOnSurface CRackTrajectoryBuilder::startingTSOS ( const TrajectorySeed seed) const
private

Definition at line 465 of file CRackTrajectoryBuilder.cc.

References magfield, fileCollector::seed, and trajectoryStateTransform::transientState().

Referenced by seedMeasurements(), and SortHits().

465  {
466  PTrajectoryStateOnDet pState(seed.startingState());
467  const GeomDet* gdet = (&(*tracker))->idToDet(DetId(pState.detId()));
468  TSOS State = trajectoryStateTransform::transientState(pState, &(gdet->surface()), &(*magfield));
469  return State;
470 }
const MagneticField * magfield
Definition: DetId.h:17
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)

◆ updateTrajectory()

void CRackTrajectoryBuilder::updateTrajectory ( Trajectory traj,
const TM tm,
const TransientTrackingRecHit hit 
) const
private

Friends And Related Function Documentation

◆ CompareDetByTraj

friend class CompareDetByTraj
friend

Definition at line 137 of file CRackTrajectoryBuilder.h.

Referenced by AddHit().

Member Data Documentation

◆ builderToken_

const edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> CRackTrajectoryBuilder::builderToken_
private

Definition at line 220 of file CRackTrajectoryBuilder.h.

Referenced by init().

◆ chi2cut

double CRackTrajectoryBuilder::chi2cut
private

Definition at line 242 of file CRackTrajectoryBuilder.h.

Referenced by AddHit(), CRackTrajectoryBuilder(), and init().

◆ debug_info

bool CRackTrajectoryBuilder::debug_info
private

Definition at line 237 of file CRackTrajectoryBuilder.h.

Referenced by AddHit(), CRackTrajectoryBuilder(), run(), and SortHits().

◆ fastPropagation

bool CRackTrajectoryBuilder::fastPropagation
private

Definition at line 238 of file CRackTrajectoryBuilder.h.

Referenced by AddHit(), and CRackTrajectoryBuilder().

◆ geometry

std::string CRackTrajectoryBuilder::geometry
private

Definition at line 247 of file CRackTrajectoryBuilder.h.

◆ hits

TransientTrackingRecHit::RecHitContainer CRackTrajectoryBuilder::hits
private

Definition at line 245 of file CRackTrajectoryBuilder.h.

Referenced by AddHit(), qualityFilter(), run(), and SortHits().

◆ magfield

const MagneticField* CRackTrajectoryBuilder::magfield
private

Definition at line 221 of file CRackTrajectoryBuilder.h.

Referenced by init(), and startingTSOS().

◆ magfieldToken_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> CRackTrajectoryBuilder::magfieldToken_
private

Definition at line 218 of file CRackTrajectoryBuilder.h.

Referenced by init().

◆ RHBuilder

const TransientTrackingRecHitBuilder* CRackTrajectoryBuilder::RHBuilder
private

Definition at line 232 of file CRackTrajectoryBuilder.h.

Referenced by AddHit(), hitBuilder(), init(), run(), seedMeasurements(), and SortHits().

◆ seed_plus

bool CRackTrajectoryBuilder::seed_plus
private

Definition at line 246 of file CRackTrajectoryBuilder.h.

Referenced by init(), run(), and SortHits().

◆ theEstimator

Chi2MeasurementEstimator* CRackTrajectoryBuilder::theEstimator
private

Definition at line 231 of file CRackTrajectoryBuilder.h.

Referenced by AddHit(), init(), and run().

◆ theFitter

const KFTrajectoryFitter* CRackTrajectoryBuilder::theFitter
private

Definition at line 234 of file CRackTrajectoryBuilder.h.

Referenced by init(), and run().

◆ theMinHits

int CRackTrajectoryBuilder::theMinHits
private

Definition at line 241 of file CRackTrajectoryBuilder.h.

Referenced by CRackTrajectoryBuilder(), and qualityFilter().

◆ thePropagator

PropagatorWithMaterial* CRackTrajectoryBuilder::thePropagator
private

Definition at line 224 of file CRackTrajectoryBuilder.h.

Referenced by init(), innerState(), run(), and SortHits().

◆ thePropagatorOp

PropagatorWithMaterial* CRackTrajectoryBuilder::thePropagatorOp
private

Definition at line 225 of file CRackTrajectoryBuilder.h.

Referenced by init(), and run().

◆ theSmoother

const KFTrajectorySmoother* CRackTrajectoryBuilder::theSmoother
private

Definition at line 233 of file CRackTrajectoryBuilder.h.

Referenced by init(), and run().

◆ theUpdator

KFUpdator* CRackTrajectoryBuilder::theUpdator
private

Definition at line 230 of file CRackTrajectoryBuilder.h.

Referenced by AddHit(), init(), and run().

◆ tracker

const TrackerGeometry* CRackTrajectoryBuilder::tracker
private

Definition at line 222 of file CRackTrajectoryBuilder.h.

Referenced by AddHit(), init(), run(), and SortHits().

◆ trackerToken_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> CRackTrajectoryBuilder::trackerToken_
private

Definition at line 219 of file CRackTrajectoryBuilder.h.

Referenced by init().

◆ trajFit

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

Definition at line 243 of file CRackTrajectoryBuilder.h.

Referenced by run().

◆ useMatchedHits

bool CRackTrajectoryBuilder::useMatchedHits
private

Definition at line 239 of file CRackTrajectoryBuilder.h.

Referenced by CRackTrajectoryBuilder(), and SortHits().