CMS 3D CMS Logo

CRackTrajectoryBuilder.h
Go to the documentation of this file.
1 #ifndef CRackTrajectoryBuilder_h
2 #define CRackTrajectoryBuilder_h
3 
4 //
5 // Package: RecoTracker/SingleTrackPattern
6 // Class: CRackTrajectoryBuilder
7 // Original Author: Michele Pioppi-INFN perugia
8 
9 #include <string>
10 
13 
37 
39 
40 //to sort hits by the det position
42 public:
44  bool operator()(const TrackingRecHit* rh1, const TrackingRecHit* rh2) {
45  const GeomDet* detPos1 = _tracker.idToDet(rh1->geographicalId());
46  const GeomDet* detPos2 = _tracker.idToDet(rh2->geographicalId());
47 
48  const GlobalPoint& gp1 = detPos1->position();
49  const GlobalPoint& gp2 = detPos2->position();
50 
51  if (gp1.y() > gp2.y())
52  return true;
53  if (gp1.y() < gp2.y())
54  return false;
55  // if (gp1.y()== gp2.y())
56  //
57  return (rh1->geographicalId() < rh2->geographicalId());
58  };
59 
60 private:
61  // edm::ESHandle<TrackerGeometry> _tracker;
63 };
64 
66 public:
68  bool operator()(const TrackingRecHit* rh1, const TrackingRecHit* rh2) {
69  const GeomDet* detPos1 = _tracker.idToDet(rh1->geographicalId());
70  const GeomDet* detPos2 = _tracker.idToDet(rh2->geographicalId());
71 
72  const GlobalPoint& gp1 = detPos1->position();
73  const GlobalPoint& gp2 = detPos2->position();
74 
75  if (gp1.y() < gp2.y())
76  return true;
77  if (gp1.y() > gp2.y())
78  return false;
79  // if (gp1.y()== gp2.y())
80  //
81  return (rh1->geographicalId() < rh2->geographicalId());
82  };
83 
84 private:
85  // edm::ESHandle<TrackerGeometry> _tracker;
87 };
88 
89 #ifndef TrajectoryBuilder_CompareHitY
90 #define TrajectoryBuilder_CompareHitY
91 
92 class CompareHitY {
93 public:
95  bool operator()(const TrackingRecHit* rh1, const TrackingRecHit* rh2) {
96  GlobalPoint gp1 = _tracker.idToDet(rh1->geographicalId())->surface().toGlobal(rh1->localPosition());
97  GlobalPoint gp2 = _tracker.idToDet(rh2->geographicalId())->surface().toGlobal(rh2->localPosition());
98  return gp1.y() < gp2.y();
99  };
100 
101 private:
102  // edm::ESHandle<TrackerGeometry> _tracker;
103  const TrackerGeometry& _tracker;
104 };
105 
106 class CompareHitY_plus {
107 public:
109  bool operator()(const TrackingRecHit* rh1, const TrackingRecHit* rh2) {
110  GlobalPoint gp1 = _tracker.idToDet(rh1->geographicalId())->surface().toGlobal(rh1->localPosition());
111  GlobalPoint gp2 = _tracker.idToDet(rh2->geographicalId())->surface().toGlobal(rh2->localPosition());
112  return gp1.y() > gp2.y();
113  };
114 
115 private:
116  // edm::ESHandle<TrackerGeometry> _tracker;
117  const TrackerGeometry& _tracker;
118 };
119 
120 #endif
121 
123  // using namespace std;
124 
127 
128  typedef std::vector<const TrackingRecHit*>::iterator TrackingRecHitIterator;
129 
130  typedef std::pair<TrackingRecHitIterator, TrackingRecHitIterator> TrackingRecHitRange;
131  typedef std::vector<TrackingRecHitRange>::iterator TrackingRecHitRangeIterator;
132 
133  // typedef std::pair<TrackingRecHitIterator, TSOS> PairTrackingRecHitTsos;
134  typedef std::pair<TrackingRecHitRangeIterator, TSOS> PairTrackingRecHitTsos;
135 
136 public:
138  friend class CompareDetByTraj;
139 
141  public:
142  CompareDetByTraj(const TSOS& tSos) : _tSos(tSos){};
143  bool operator()(const std::pair<TrackingRecHitRangeIterator, TSOS> rh1,
144  const std::pair<TrackingRecHitRangeIterator, TSOS> rh2) {
145  GlobalPoint gp1 = rh1.second.globalPosition();
146  GlobalPoint gp2 = rh2.second.globalPosition();
147 
149  GlobalVector gpDiff1 = gp1 - gpT;
150  GlobalVector gpDiff2 = gp2 - gpT;
151 
152  //this might have a better performance ...
153  // float dist1 = ( gp1.x()-gpT.x() ) * ( gp1.x()-gpT.x() ) + ( gp1.y()-gpT.y() ) * ( gp1.y()-gpT.y() ) + ( gp1.z()-gpT.z() ) * ( gp1.z()-gpT.z() );
154  // float dist2 = ( gp2.x()-gpT.x() ) * ( gp2.x()-gpT.x() ) + ( gp2.y()-gpT.y() ) * ( gp2.y()-gpT.y() ) + ( gp2.z()-gpT.z() ) * ( gp2.z()-gpT.z() );
155  //if ( dist1<dist2 )
156 
157  // if ( gpDiff1.mag2() < gpDiff2.mag2() )
158 
159  float dist1 = gpDiff1 * _tSos.globalDirection();
160  float dist2 = gpDiff2 * _tSos.globalDirection();
161 
162  if (dist1 < 0)
163  return false;
164  if (dist1 < dist2)
165  return true;
166 
167  return false;
168  };
169 
170  private:
172  };
173 
174 public:
177 
179 
180  void run(const TrajectorySeedCollection& collseed,
181  const SiStripRecHit2DCollection& collstereo,
182  const SiStripRecHit2DCollection& collrphi,
183  const SiStripMatchedRecHit2DCollection& collmatched,
184  const SiPixelRecHitCollection& collpixel,
185  const edm::EventSetup& es,
186  edm::Event& e,
187  std::vector<Trajectory>& trajoutput);
188 
189  void init(const edm::EventSetup& es, bool);
191 
193 
194 private:
195  std::vector<TrajectoryMeasurement> seedMeasurements(const TrajectorySeed& seed) const;
196 
197  std::vector<const TrackingRecHit*> SortHits(const SiStripRecHit2DCollection& collstereo,
198  const SiStripRecHit2DCollection& collrphi,
199  const SiStripMatchedRecHit2DCollection& collmatched,
200  const SiPixelRecHitCollection& collpixel,
201  const TrajectorySeed& seed,
202  const bool bAddSeedHits);
203 
204  // std::vector<TrackingRecHitRange> SortByTrajectory (const std::vector<TrackingRecHitRange>& inputHits);
205 
206  TSOS startingTSOS(const TrajectorySeed& seed) const;
207  void updateTrajectory(Trajectory& traj, const TM& tm, const TransientTrackingRecHit& hit) const;
208 
209  void AddHit(Trajectory& traj, const std::vector<const TrackingRecHit*>& Hits, Propagator* currPropagator);
210  // edm::OwnVector<TransientTrackingRecHit> hits);
211  bool qualityFilter(const Trajectory& traj);
212 
213  bool isDifferentStripReHit2D(const SiStripRecHit2D& hitA, const SiStripRecHit2D& hitB);
214 
215  std::pair<TrajectoryStateOnSurface, const GeomDet*> innerState(const Trajectory& traj) const;
216 
217 private:
220 
223 
224  // AnalyticalPropagator *thePropagator;
225  // AnalyticalPropagator *thePropagatorOp;
226 
232  // const KFTrajectoryFitter * theFitterOp;
233 
237 
239  double chi2cut;
240  std::vector<Trajectory> trajFit;
241  //RC edm::OwnVector<const TransientTrackingRecHit> hits;
243  bool seed_plus;
246  // TransientInitialStateEstimator* theInitialState;
247 };
248 
249 #endif
Vector3DBase
Definition: Vector3DBase.h:8
GeomDet::position
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
TrackerGeometry::idToDet
const TrackerGeomDet * idToDet(DetId) const override
Definition: TrackerGeometry.cc:193
CompareDetY_minus
Definition: CRackTrajectoryBuilder.h:65
CRackTrajectoryBuilder::seed_plus
bool seed_plus
Definition: CRackTrajectoryBuilder.h:243
TrajectoryStateOnSurface::globalDirection
GlobalVector globalDirection() const
Definition: TrajectoryStateOnSurface.h:67
CRackTrajectoryBuilder::tracker
edm::ESHandle< TrackerGeometry > tracker
Definition: CRackTrajectoryBuilder.h:219
Chi2MeasurementEstimator.h
TrackExtra.h
CRackTrajectoryBuilder::PairTrackingRecHitTsos
std::pair< TrackingRecHitRangeIterator, TSOS > PairTrackingRecHitTsos
Definition: CRackTrajectoryBuilder.h:134
CRackTrajectoryBuilder::CompareDetByTraj::_tSos
const TrajectoryStateOnSurface & _tSos
Definition: CRackTrajectoryBuilder.h:168
TrackerGeometry.h
GeomDet
Definition: GeomDet.h:27
CRackTrajectoryBuilder::debug_info
bool debug_info
Definition: CRackTrajectoryBuilder.h:234
CRackTrajectoryBuilder::run
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.
Definition: CRackTrajectoryBuilder.cc:82
TrajectorySeedCollection
std::vector< TrajectorySeed > TrajectorySeedCollection
Definition: TrajectorySeedCollection.h:6
Chi2MeasurementEstimator
Definition: Chi2MeasurementEstimator.h:15
TrackCandidateCollection.h
ESHandle.h
CRackTrajectoryBuilder::CompareDetByTraj::CompareDetByTraj
CompareDetByTraj(const TSOS &tSos)
Definition: CRackTrajectoryBuilder.h:142
SiStripMatchedRecHit2DCollection.h
CompareDetY_minus::CompareDetY_minus
CompareDetY_minus(const TrackerGeometry &tracker)
Definition: CRackTrajectoryBuilder.h:67
CRackTrajectoryBuilder::isDifferentStripReHit2D
bool isDifferentStripReHit2D(const SiStripRecHit2D &hitA, const SiStripRecHit2D &hitB)
Definition: CRackTrajectoryBuilder.cc:776
CRackTrajectoryBuilder::createStartingTrajectory
Trajectory createStartingTrajectory(const TrajectorySeed &seed) const
Definition: CRackTrajectoryBuilder.cc:214
CRackTrajectoryBuilder::TrackingRecHitRange
std::pair< TrackingRecHitIterator, TrackingRecHitIterator > TrackingRecHitRange
Definition: CRackTrajectoryBuilder.h:130
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
CRackTrajectoryBuilder::startingTSOS
TSOS startingTSOS(const TrajectorySeed &seed) const
Definition: CRackTrajectoryBuilder.cc:467
TrackerRecoGeometryRecord.h
CRackTrajectoryBuilder::thePropagator
PropagatorWithMaterial * thePropagator
Definition: CRackTrajectoryBuilder.h:221
KFTrajectoryFitter
Definition: KFTrajectoryFitter.h:22
SiStripRecHit2D
Definition: SiStripRecHit2D.h:7
KFTrajectorySmoother.h
CompareHitY_plus
Definition: CosmicTrajectoryBuilder.h:58
TrackingRecHit::localPosition
virtual LocalPoint localPosition() const =0
CRackTrajectoryBuilder::seedMeasurements
std::vector< TrajectoryMeasurement > seedMeasurements(const TrajectorySeed &seed) const
Definition: CRackTrajectoryBuilder.cc:222
CompareHitY_plus::operator()
bool operator()(const TrackingRecHit *rh1, const TrackingRecHit *rh2)
Definition: CRackTrajectoryBuilder.h:109
CRackTrajectoryBuilder::useMatchedHits
bool useMatchedHits
Definition: CRackTrajectoryBuilder.h:236
CRackTrajectoryBuilder::init
void init(const edm::EventSetup &es, bool)
Definition: CRackTrajectoryBuilder.cc:50
TrackingRecHit::geographicalId
DetId geographicalId() const
Definition: TrackingRecHit.h:120
CRackTrajectoryBuilder::TSOS
TrajectoryStateOnSurface TSOS
Definition: CRackTrajectoryBuilder.h:125
CRackTrajectoryBuilder::TM
TrajectoryMeasurement TM
Definition: CRackTrajectoryBuilder.h:126
CRackTrajectoryBuilder::CRackTrajectoryBuilder
CRackTrajectoryBuilder(const edm::ParameterSet &conf)
Definition: CRackTrajectoryBuilder.cc:30
fileCollector.seed
seed
Definition: fileCollector.py:127
CompareHitY_plus::CompareHitY_plus
CompareHitY_plus(const TrackerGeometry &tracker)
Definition: CRackTrajectoryBuilder.h:108
CRackTrajectoryBuilder::CompareDetByTraj
Definition: CRackTrajectoryBuilder.h:140
Propagator
Definition: Propagator.h:44
CRackTrajectoryBuilder::theFitter
const KFTrajectoryFitter * theFitter
Definition: CRackTrajectoryBuilder.h:231
GeometricSearchTracker.h
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
PropagatorWithMaterial
Definition: PropagatorWithMaterial.h:25
Track.h
TrackingRecHit::RecHitContainer
std::vector< ConstRecHitPointer > RecHitContainer
Definition: TrackingRecHit.h:31
CompareHitY::_tracker
const TrackerGeometry & _tracker
Definition: CosmicTrajectoryBuilder.h:51
LayerMeasurements.h
CRackTrajectoryBuilder::fastPropagation
bool fastPropagation
Definition: CRackTrajectoryBuilder.h:235
CRackTrajectoryBuilder
Definition: CRackTrajectoryBuilder.h:122
edm::ESHandle< MagneticField >
CRackTrajectoryBuilder::chi2cut
double chi2cut
Definition: CRackTrajectoryBuilder.h:239
CompareDetY_plus
Definition: CRackTrajectoryBuilder.h:41
CRackTrajectoryBuilder::AddHit
void AddHit(Trajectory &traj, const std::vector< const TrackingRecHit * > &Hits, Propagator *currPropagator)
Definition: CRackTrajectoryBuilder.cc:474
CRackTrajectoryBuilder::CompareDetByTraj::operator()
bool operator()(const std::pair< TrackingRecHitRangeIterator, TSOS > rh1, const std::pair< TrackingRecHitRangeIterator, TSOS > rh2)
Definition: CRackTrajectoryBuilder.h:143
Point3DBase< float, GlobalTag >
CRackTrajectoryBuilder::SortHits
std::vector< const TrackingRecHit * > SortHits(const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const SiPixelRecHitCollection &collpixel, const TrajectorySeed &seed, const bool bAddSeedHits)
Definition: CRackTrajectoryBuilder.cc:243
CompareDetY_plus::_tracker
const TrackerGeometry & _tracker
Definition: CRackTrajectoryBuilder.h:58
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
SiPixelRecHitCollection.h
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
KFUpdator.h
edm::ParameterSet
Definition: ParameterSet.h:47
CRackTrajectoryBuilder::theUpdator
KFUpdator * theUpdator
Definition: CRackTrajectoryBuilder.h:227
CompareDetY_minus::_tracker
const TrackerGeometry & _tracker
Definition: CRackTrajectoryBuilder.h:82
PropagatorWithMaterial.h
CRackTrajectoryBuilder::RHBuilder
const TransientTrackingRecHitBuilder * RHBuilder
Definition: CRackTrajectoryBuilder.h:229
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
SiStripRecHit2DCollection.h
CRackTrajectoryBuilder::hitBuilder
const TransientTrackingRecHitBuilder * hitBuilder() const
Definition: CRackTrajectoryBuilder.h:192
MagneticField.h
edm::EventSetup
Definition: EventSetup.h:58
CRackTrajectoryBuilder::updateTrajectory
void updateTrajectory(Trajectory &traj, const TM &tm, const TransientTrackingRecHit &hit) const
AnalyticalPropagator.h
CRackTrajectoryBuilder::TrackingRecHitRangeIterator
std::vector< TrackingRecHitRange >::iterator TrackingRecHitRangeIterator
Definition: CRackTrajectoryBuilder.h:131
CRackTrajectoryBuilder::magfield
edm::ESHandle< MagneticField > magfield
Definition: CRackTrajectoryBuilder.h:218
TrajectorySeedCollection.h
CompareHitY_plus::_tracker
const TrackerGeometry & _tracker
Definition: CosmicTrajectoryBuilder.h:65
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CompareDetY_minus::operator()
bool operator()(const TrackingRecHit *rh1, const TrackingRecHit *rh2)
Definition: CRackTrajectoryBuilder.h:68
CompareDetY_plus::CompareDetY_plus
CompareDetY_plus(const TrackerGeometry &tracker)
Definition: CRackTrajectoryBuilder.h:43
CRackTrajectoryBuilder::innerState
std::pair< TrajectoryStateOnSurface, const GeomDet * > innerState(const Trajectory &traj) const
Definition: CRackTrajectoryBuilder.cc:793
TrackingRecHit
Definition: TrackingRecHit.h:21
Trajectory.h
CRackTrajectoryBuilder::theSmoother
const KFTrajectorySmoother * theSmoother
Definition: CRackTrajectoryBuilder.h:230
CRackTrajectoryBuilder::~CRackTrajectoryBuilder
~CRackTrajectoryBuilder()
Definition: CRackTrajectoryBuilder.cc:46
edmNew::DetSetVector
Definition: DetSetNew.h:13
CRackTrajectoryBuilder::qualityFilter
bool qualityFilter(const Trajectory &traj)
Definition: CRackTrajectoryBuilder.cc:753
CompareDetY_plus::operator()
bool operator()(const TrackingRecHit *rh1, const TrackingRecHit *rh2)
Definition: CRackTrajectoryBuilder.h:44
CRackTrajectoryBuilder::theEstimator
Chi2MeasurementEstimator * theEstimator
Definition: CRackTrajectoryBuilder.h:228
CompareHitY::CompareHitY
CompareHitY(const TrackerGeometry &tracker)
Definition: CRackTrajectoryBuilder.h:94
Trajectory
Definition: Trajectory.h:38
KFTrajectorySmoother
Definition: KFTrajectorySmoother.h:20
CRackTrajectoryBuilder::theMinHits
int theMinHits
Definition: CRackTrajectoryBuilder.h:238
CRackTrajectoryBuilder::theBuilderName
std::string theBuilderName
Definition: CRackTrajectoryBuilder.h:245
TrajectorySeed
Definition: TrajectorySeed.h:18
EventSetup.h
CRackTrajectoryBuilder::trajFit
std::vector< Trajectory > trajFit
Definition: CRackTrajectoryBuilder.h:240
TrajectoryStateTransform.h
KFTrajectoryFitter.h
TransientTrackingRecHitBuilder.h
CompareHitY
Definition: CosmicTrajectoryBuilder.h:44
ParameterSet.h
CompareHitY::operator()
bool operator()(const TrackingRecHit *rh1, const TrackingRecHit *rh2)
Definition: CRackTrajectoryBuilder.h:95
edm::Event
Definition: Event.h:73
TransientTrackingRecHitBuilder
Definition: TransientTrackingRecHitBuilder.h:6
TrajectoryMeasurement
Definition: TrajectoryMeasurement.h:25
CRackTrajectoryBuilder::hits
TransientTrackingRecHit::RecHitContainer hits
Definition: CRackTrajectoryBuilder.h:242
GlobalPoint.h
KFUpdator
Definition: KFUpdator.h:32
hit
Definition: SiStripHitEffFromCalibTree.cc:88
CRackTrajectoryBuilder::TrackingRecHitIterator
std::vector< const TrackingRecHit * >::iterator TrackingRecHitIterator
Definition: CRackTrajectoryBuilder.h:128
MeasurementTracker.h
CRackTrajectoryBuilder::thePropagatorOp
PropagatorWithMaterial * thePropagatorOp
Definition: CRackTrajectoryBuilder.h:222
CRackTrajectoryBuilder::geometry
std::string geometry
Definition: CRackTrajectoryBuilder.h:244
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
TrackerGeometry
Definition: TrackerGeometry.h:14