test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
41 //to sort hits by the det position
43  public:
45  bool operator()( const TrackingRecHit *rh1,
46  const TrackingRecHit *rh2)
47  {
48  const GeomDet* detPos1 = _tracker.idToDet(rh1->geographicalId());
49  const GeomDet* detPos2 = _tracker.idToDet(rh2->geographicalId());
50 
51  GlobalPoint gp1 = detPos1->position();
52  GlobalPoint gp2 = detPos2->position();
53 
54  if (gp1.y()>gp2.y())
55  return true;
56  if (gp1.y()<gp2.y())
57  return false;
58  // if (gp1.y()== gp2.y())
59  //
60  return (rh1->geographicalId() < rh2->geographicalId());
61  };
62  private:
63  // edm::ESHandle<TrackerGeometry> _tracker;
65  };
66 
68  public:
70  bool operator()( const TrackingRecHit *rh1,
71  const TrackingRecHit *rh2)
72  {
73  const GeomDet* detPos1 = _tracker.idToDet(rh1->geographicalId());
74  const GeomDet* detPos2 = _tracker.idToDet(rh2->geographicalId());
75 
76  GlobalPoint gp1 = detPos1->position();
77  GlobalPoint gp2 = detPos2->position();
78 
79  if (gp1.y()<gp2.y())
80  return true;
81  if (gp1.y()>gp2.y())
82  return false;
83  // if (gp1.y()== gp2.y())
84  //
85  return (rh1->geographicalId() < rh2->geographicalId());
86  };
87  private:
88  // edm::ESHandle<TrackerGeometry> _tracker;
90  };
91 
92 #ifndef TrajectoryBuilder_CompareHitY
93 #define TrajectoryBuilder_CompareHitY
94 
95 class CompareHitY {
96  public:
98  bool operator()( const TrackingRecHit *rh1,
99  const TrackingRecHit *rh2)
100  {
101  GlobalPoint gp1=_tracker.idToDet(rh1->geographicalId())->surface().toGlobal(rh1->localPosition());
102  GlobalPoint gp2=_tracker.idToDet(rh2->geographicalId())->surface().toGlobal(rh2->localPosition());
103  return gp1.y()<gp2.y();};
104  private:
105  // edm::ESHandle<TrackerGeometry> _tracker;
106  const TrackerGeometry& _tracker;
107 };
108 
109  class CompareHitY_plus {
110  public:
112  bool operator()( const TrackingRecHit *rh1,
113  const TrackingRecHit *rh2)
114  {
115  GlobalPoint gp1=_tracker.idToDet(rh1->geographicalId())->surface().toGlobal(rh1->localPosition());
116  GlobalPoint gp2=_tracker.idToDet(rh2->geographicalId())->surface().toGlobal(rh2->localPosition());
117  return gp1.y()>gp2.y();};
118  private:
119  // edm::ESHandle<TrackerGeometry> _tracker;
120  const TrackerGeometry& _tracker;
121  };
122 
123 #endif
124 
126 {
127 // using namespace std;
128 
131 
132  typedef std::vector<const TrackingRecHit*>::iterator TrackingRecHitIterator;
133 
134  typedef std::pair<TrackingRecHitIterator, TrackingRecHitIterator> TrackingRecHitRange;
135  typedef std::vector<TrackingRecHitRange>::iterator TrackingRecHitRangeIterator;
136 
137  // typedef std::pair<TrackingRecHitIterator, TSOS> PairTrackingRecHitTsos;
138  typedef std::pair<TrackingRecHitRangeIterator, TSOS> PairTrackingRecHitTsos;
139 
140  public:
142  friend class CompareDetByTraj;
143 
145  public:
146  CompareDetByTraj(const TSOS& tSos ):_tSos(tSos)
147  {};
148  bool operator()( const std::pair<TrackingRecHitRangeIterator, TSOS> rh1,
149  const std::pair<TrackingRecHitRangeIterator, TSOS> rh2)
150  {
151  GlobalPoint gp1 = rh1.second.globalPosition();
152  GlobalPoint gp2 = rh2.second.globalPosition();
153 
155  GlobalVector gpDiff1 = gp1-gpT;
156  GlobalVector gpDiff2 = gp2-gpT;
157 
158  //this might have a better performance ...
159  // 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() );
160  // 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() );
161  //if ( dist1<dist2 )
162 
163  // if ( gpDiff1.mag2() < gpDiff2.mag2() )
164 
165 
166  float dist1 = gpDiff1 * _tSos.globalDirection();
167  float dist2 = gpDiff2 * _tSos.globalDirection();
168 
169  if (dist1 < 0)
170  return false;
171  if ( dist1<dist2 )
172  return true;
173 
174  return false;
175  };
176  private:
178  };
179 
180 
181 
182  public:
183 
186 
188 
189  void run(const TrajectorySeedCollection &collseed,
190  const SiStripRecHit2DCollection &collstereo,
191  const SiStripRecHit2DCollection &collrphi ,
192  const SiStripMatchedRecHit2DCollection &collmatched,
193  const SiPixelRecHitCollection &collpixel,
194  const edm::EventSetup& es,
195  edm::Event& e,
196  std::vector<Trajectory> &trajoutput);
197 
198  void init(const edm::EventSetup& es,bool);
200 
202 
203  private:
204  std::vector<TrajectoryMeasurement> seedMeasurements(const TrajectorySeed& seed) const;
205 
206 
207  std::vector<const TrackingRecHit*> SortHits(const SiStripRecHit2DCollection &collstereo,
208  const SiStripRecHit2DCollection &collrphi ,
209  const SiStripMatchedRecHit2DCollection &collmatched,
210  const SiPixelRecHitCollection &collpixel,
211  const TrajectorySeed &seed,
212  const bool bAddSeedHits
213  );
214 
215 
216  // std::vector<TrackingRecHitRange> SortByTrajectory (const std::vector<TrackingRecHitRange>& inputHits);
217 
218 
219  TSOS startingTSOS(const TrajectorySeed& seed)const;
220  void updateTrajectory( Trajectory& traj,
221  const TM& tm,
222  const TransientTrackingRecHit& hit) const;
223 
224  void AddHit(Trajectory &traj,
225  const std::vector<const TrackingRecHit*>&Hits,
226  Propagator *currPropagator
227  );
228  // edm::OwnVector<TransientTrackingRecHit> hits);
229  bool qualityFilter(const Trajectory& traj);
230 
231  bool isDifferentStripReHit2D (const SiStripRecHit2D& hitA, const SiStripRecHit2D& hitB );
232 
233  std::pair<TrajectoryStateOnSurface, const GeomDet*>
234  innerState( const Trajectory& traj) const;
235 
236 
237 
238  private:
241 
244 
245 // AnalyticalPropagator *thePropagator;
246 // AnalyticalPropagator *thePropagatorOp;
247 
253 // const KFTrajectoryFitter * theFitterOp;
254 
258 
260  double chi2cut;
261  std::vector<Trajectory> trajFit;
262  //RC edm::OwnVector<const TransientTrackingRecHit> hits;
264  bool seed_plus;
267 // TransientInitialStateEstimator* theInitialState;
268 };
269 
270 #endif
edm::ESHandle< MagneticField > magfield
std::vector< TrackingRecHitRange >::iterator TrackingRecHitRangeIterator
Trajectory createStartingTrajectory(const TrajectorySeed &seed) const
bool operator()(const TrackingRecHit *rh1, const TrackingRecHit *rh2)
CompareHitY_plus(const TrackerGeometry &tracker)
Chi2MeasurementEstimator * theEstimator
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
T y() const
Definition: PV3DBase.h:63
const TrackerGeometry & _tracker
std::vector< ConstRecHitPointer > RecHitContainer
GlobalPoint globalPosition() const
const TrackerGeometry & _tracker
const TransientTrackingRecHitBuilder * RHBuilder
TransientTrackingRecHit::RecHitContainer hits
std::vector< const TrackingRecHit * >::iterator TrackingRecHitIterator
CompareDetY_minus(const TrackerGeometry &tracker)
const KFTrajectorySmoother * theSmoother
std::pair< TrajectoryStateOnSurface, const GeomDet * > innerState(const Trajectory &traj) const
std::vector< Trajectory > trajFit
std::pair< TrackingRecHitRangeIterator, TSOS > PairTrackingRecHitTsos
bool qualityFilter(const Trajectory &traj)
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:48
bool operator()(const TrackingRecHit *rh1, const TrackingRecHit *rh2)
std::vector< TrajectorySeed > TrajectorySeedCollection
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.
CompareDetY_plus(const TrackerGeometry &tracker)
edm::ESHandle< TrackerGeometry > tracker
CompareHitY(const TrackerGeometry &tracker)
PropagatorWithMaterial * thePropagatorOp
std::vector< TrajectoryMeasurement > seedMeasurements(const TrajectorySeed &seed) const
const TransientTrackingRecHitBuilder * hitBuilder() const
TSOS startingTSOS(const TrajectorySeed &seed) const
const TrajectoryStateOnSurface & _tSos
bool operator()(const TrackingRecHit *rh1, const TrackingRecHit *rh2)
bool operator()(const std::pair< TrackingRecHitRangeIterator, TSOS > rh1, const std::pair< TrackingRecHitRangeIterator, TSOS > rh2)
CRackTrajectoryBuilder(const edm::ParameterSet &conf)
bool isDifferentStripReHit2D(const SiStripRecHit2D &hitA, const SiStripRecHit2D &hitB)
std::pair< TrackingRecHitIterator, TrackingRecHitIterator > TrackingRecHitRange
void init(const edm::EventSetup &es, bool)
TrajectoryStateOnSurface TSOS
PropagatorWithMaterial * thePropagator
const KFTrajectoryFitter * theFitter
void updateTrajectory(Trajectory &traj, const TM &tm, const TransientTrackingRecHit &hit) const
std::vector< const TrackingRecHit * > SortHits(const SiStripRecHit2DCollection &collstereo, const SiStripRecHit2DCollection &collrphi, const SiStripMatchedRecHit2DCollection &collmatched, const SiPixelRecHitCollection &collpixel, const TrajectorySeed &seed, const bool bAddSeedHits)
DetId geographicalId() const
virtual LocalPoint localPosition() const =0
void AddHit(Trajectory &traj, const std::vector< const TrackingRecHit * > &Hits, Propagator *currPropagator)
const TrackerGeometry & _tracker
const TrackerGeometry & _tracker
bool operator()(const TrackingRecHit *rh1, const TrackingRecHit *rh2)
GlobalVector globalDirection() const
TrajectoryMeasurement TM
const TrackerGeomDet * idToDet(DetId) const