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 | Protected Attributes | Private Member Functions | Private Attributes
CrossingPtBasedLinearizationPointFinder Class Reference

#include <CrossingPtBasedLinearizationPointFinder.h>

Inheritance diagram for CrossingPtBasedLinearizationPointFinder:
LinearizationPointFinder FsmwLinearizationPointFinder HSMLinearizationPointFinder LMSLinearizationPointFinder SMSLinearizationPointFinder SubsetHSMLinearizationPointFinder DefaultLinearizationPointFinder

Classes

struct  CompareTwoTracks
 

Public Member Functions

virtual
CrossingPtBasedLinearizationPointFinder
clone () const
 
 CrossingPtBasedLinearizationPointFinder (const ModeFinder3d &algo, const signed int n_pairs=5)
 
 CrossingPtBasedLinearizationPointFinder (const RecTracksDistanceMatrix *m, const ModeFinder3d &algo, const signed int n_pairs=-1)
 
 CrossingPtBasedLinearizationPointFinder (const CrossingPtBasedLinearizationPointFinder &)
 
virtual GlobalPoint getLinearizationPoint (const std::vector< reco::TransientTrack > &) const
 
virtual GlobalPoint getLinearizationPoint (const std::vector< FreeTrajectoryState > &) const
 
 ~CrossingPtBasedLinearizationPointFinder ()
 
- Public Member Functions inherited from LinearizationPointFinder
virtual ~LinearizationPointFinder ()
 

Protected Attributes

const RecTracksDistanceMatrixtheMatrix
 
signed int theNPairs
 
const bool useMatrix
 

Private Member Functions

GlobalPoint find (const std::vector< std::pair< GlobalPoint, float > > &) const
 
std::vector< reco::TransientTrackgetBestTracks (const std::vector< reco::TransientTrack > &) const
 
GlobalPoint useAllTracks (const std::vector< reco::TransientTrack > &) const
 
GlobalPoint useFullMatrix (const std::vector< reco::TransientTrack > &) const
 

Private Attributes

ModeFinder3dtheAlgo
 

Detailed Description

A linearization point finder. It works the following way:

  1. Calculate in an optimal way 'n_pairs' different crossing points. Optimal in this context means the following: a. Try to use as many different tracks as possible; avoid using the same track all the time. b. Use the most energetic tracks. c. Try not to group the most energetic tracks together. Try to group more energetic tracks with less energetic tracks. We assume collimated bundles here, so this is why. d. Perform optimally. Do not sort more tracks (by total energy, see b) than necessary. e. If n_pairs >= (number of all possible combinations), do not leave any combinations out. ( a. and e. are almost but not entirely fulfilled in the current impl )
  2. Apply theAlgo on the n points.

Definition at line 26 of file CrossingPtBasedLinearizationPointFinder.h.

Constructor & Destructor Documentation

CrossingPtBasedLinearizationPointFinder::CrossingPtBasedLinearizationPointFinder ( const ModeFinder3d algo,
const signed int  n_pairs = 5 
)
Parameters
n_pairs,:how many track pairs will be considered (maximum) a value of -1 means full combinatorics.

Definition at line 106 of file CrossingPtBasedLinearizationPointFinder.cc.

Referenced by clone().

CrossingPtBasedLinearizationPointFinder::CrossingPtBasedLinearizationPointFinder ( const RecTracksDistanceMatrix m,
const ModeFinder3d algo,
const signed int  n_pairs = -1 
)

This constructor exploits the information stored in a RecTracksDistanceMatrix object.

Parameters
n_pairs,:how many track pairs will be considered (maximum) a value of -1 means full combinatorics.

Definition at line 112 of file CrossingPtBasedLinearizationPointFinder.cc.

CrossingPtBasedLinearizationPointFinder::CrossingPtBasedLinearizationPointFinder ( const CrossingPtBasedLinearizationPointFinder o)
CrossingPtBasedLinearizationPointFinder::~CrossingPtBasedLinearizationPointFinder ( )

Definition at line 126 of file CrossingPtBasedLinearizationPointFinder.cc.

References theAlgo.

Member Function Documentation

virtual CrossingPtBasedLinearizationPointFinder* CrossingPtBasedLinearizationPointFinder::clone ( ) const
inlinevirtual
GlobalPoint CrossingPtBasedLinearizationPointFinder::find ( const std::vector< std::pair< GlobalPoint, float > > &  ) const
private

calls (*theAglo) (input) can optionally save input / output in .root file

Definition at line 216 of file CrossingPtBasedLinearizationPointFinder.cc.

References input, and runTheMatrix::ret.

Referenced by getLinearizationPoint(), useAllTracks(), and useFullMatrix().

218 {
219  /*
220  std::cout << "[CrossingPtBasedLinearizationPointFinder] input size="
221  << input.size() << std::endl;*/
222  GlobalPoint ret = (*theAlgo) (input);
223 #ifdef Use_GraphicsHarvester
224 
225  graphicsDebug ( input );
226 #endif
227 
228  return ret;
229 }
tuple ret
prodAgent to be discontinued
static std::string const input
Definition: EdmProvDump.cc:44
std::vector< reco::TransientTrack > CrossingPtBasedLinearizationPointFinder::getBestTracks ( const std::vector< reco::TransientTrack > &  tracks) const
private

Definition at line 131 of file CrossingPtBasedLinearizationPointFinder.cc.

References theNPairs, and testEve_cfg::tracks.

Referenced by getLinearizationPoint().

133 {
134  unsigned int n_tracks = (2*(unsigned int) (theNPairs)) < tracks.size() ? 2*theNPairs : tracks.size();
135 
136  std::vector <reco::TransientTrack> newtracks = tracks;
137  partial_sort ( newtracks.begin(), newtracks.begin()+n_tracks, newtracks.end(), CompareTwoTracks() );
138  newtracks.erase ( newtracks.begin()+n_tracks, newtracks.end() );
139 
140  /*
141  * old version, when we have a default constructor
142  *
143 
144  std::vector <reco::TransientTrack> newtracks ( n_tracks );
145  partial_sort_copy ( tracks.begin(), tracks.end(), newtracks.begin(),
146  newtracks.begin() + n_tracks , CompareTwoTracks() );
147  */
148 
149  return newtracks;
150 }
tuple tracks
Definition: testEve_cfg.py:39
GlobalPoint CrossingPtBasedLinearizationPointFinder::getLinearizationPoint ( const std::vector< reco::TransientTrack > &  tracks) const
virtual

Method giving back the Initial Linearization Point.

Implements LinearizationPointFinder.

Definition at line 231 of file CrossingPtBasedLinearizationPointFinder.cc.

References TwoTrackMinimumDistance::calculate(), RecTracksDistanceMatrix::crossingPoint(), dir, RecTracksDistanceMatrix::distance(), find(), getBestTracks(), FallbackLinearizationPointFinder::getLinearizationPoint(), reco::TransientTrack::impactPointState(), TwoTrackMinimumDistance::points(), RPCpg::pts, mps_update::status, theMatrix, theNPairs, useAllTracks(), useFullMatrix(), useMatrix, and findQualityFiles::v.

233 {
234  if ( tracks.size() < 2 )
235  throw LinPtException
236  ("CrossingPtBasedLinPtFinder: too few tracks given.");
237  std::vector < PointAndDistance > vgp;
238  if ( theNPairs == -1 )
239  {
240  if ( useMatrix )
241  {
242  return useFullMatrix( tracks );
243  }
244  else
245  {
246  return useAllTracks ( tracks );
247  }
248  }
249 
250  if ( sum ( tracks.size() - 1 ) < ((unsigned int) (theNPairs)) )
251  {
252  /*
253  std::cout << "[CrossingPtBasedLinearizationPointFinder] we exploit all track pairs"
254  << std::endl;*/
255  // we have fewer track pair options than is foreseen
256  // in the quota.
257  // so we exploit all tracks pairs.
258  return useAllTracks ( tracks );
259  }
260 
261  std::vector <reco::TransientTrack> goodtracks = getBestTracks ( tracks );
262 
263  // we sort according to momenta.
264  if ( goodtracks.size() < 2 )
265  throw LinPtException (
266  "CrossingPtBasedLinPtFinder: less than two tracks given");
267  // vgp.reserve ( theNPairs - 1 );
268  unsigned int t_first = 0;
269  unsigned int t_interval = goodtracks.size() / 2;
270  unsigned int lim = goodtracks.size() - 1;
271 
272  /*
273  std::cout << "[CrossingPtBasedLinearizationPointFinder] we start: npairs=" << theNPairs
274  << std::endl;
275  std::cout << "[CrossingPtBasedLinearizationPointFinder] t_interval=" << t_interval << std::endl;
276  std::cout << "[CrossingPtBasedLinearizationPointFinder goodtracks.size=" << goodtracks.size()
277  << std::endl;*/
278 
279  // the 'direction' false: intervals will expand
280  // true: intervals will shrink
281  bool dir = false;
282 
283  while ( vgp.size() < ((unsigned int) (theNPairs)) )
284  {
285  reco::TransientTrack rt1 = goodtracks [ t_first ];
286  reco::TransientTrack rt2 = goodtracks [ t_first + t_interval ];
287  // std::cout << "Considering now: " << t_first << ", " << t_first+t_interval << std::endl;
288  if ( useMatrix )
289  {
290  PointAndDistance v ( theMatrix->crossingPoint ( rt1, rt2 ),
291  theMatrix->distance ( rt1, rt2 ) );
292  vgp.push_back ( v );
293  }
294  else
295  { // No DistanceMatrix available
297  bool status = ttmd.calculate( rt1.impactPointState(), rt2.impactPointState() );
298  if (status) {
299  std::pair < GlobalPoint, GlobalPoint > pts = ttmd.points();
300  PointAndDistance v ( ( pts.second + pts.first ) / 2. ,
301  ( pts.second - pts.first ).mag() );
302  vgp.push_back( v );
303  }
304  }
305  if ( ( t_first + t_interval ) < lim )
306  {
307  t_first++;
308  }
309  else if ( dir )
310  {
311  t_first=0;
312  t_interval--;
313  if ( t_interval == 0 )
314  {
315  /* std::cout << "[CrossingPtBasedLinearizationPointFinder] t_interval=0. break."
316  << std::endl;*/
317  break;
318  }
319  }
320  else
321  {
322  t_first=0;
323  t_interval++;
324  if ( t_interval == goodtracks.size() )
325  {
326  /* std::cout << "[CrossingPtBasedLinearizationPointFinder] t_interval="
327  << goodtracks.size() << "(max). start to decrease intervals"
328  << std::endl; */
329  dir=true;
330  t_interval = goodtracks.size() / 2 - 1;
331  }
332  }
333  }
334  if (! vgp.size() )
335  {
336  // no crossing points? Fallback to a crossingpoint-less lin pt finder!
338  }
339  return find ( vgp );
340 
341  return GlobalPoint(0.,0.,0.); // if nothing else, then return 0,0,0
342 }
GlobalPoint useAllTracks(const std::vector< reco::TransientTrack > &) const
virtual bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb)
GlobalPoint find(const std::vector< std::pair< GlobalPoint, float > > &) const
std::pair< GlobalPoint, float > PointAndDistance
virtual double distance(const reco::TransientTrack, const reco::TransientTrack) const =0
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< reco::TransientTrack > getBestTracks(const std::vector< reco::TransientTrack > &) const
virtual GlobalPoint getLinearizationPoint(const std::vector< reco::TransientTrack > &) const
static const double pts[33]
Definition: Constants.h:30
virtual GlobalPoint crossingPoint(const reco::TransientTrack, const reco::TransientTrack) const =0
tuple tracks
Definition: testEve_cfg.py:39
TrajectoryStateOnSurface impactPointState() const
dbl *** dir
Definition: mlp_gen.cc:35
GlobalPoint useFullMatrix(const std::vector< reco::TransientTrack > &) const
virtual std::pair< GlobalPoint, GlobalPoint > points() const
tuple status
Definition: mps_update.py:57
GlobalPoint CrossingPtBasedLinearizationPointFinder::getLinearizationPoint ( const std::vector< FreeTrajectoryState > &  tracks) const
virtual

Reimplemented from LinearizationPointFinder.

Definition at line 210 of file CrossingPtBasedLinearizationPointFinder.cc.

References LinearizationPointFinder::getLinearizationPoint().

212 {
214 }
tuple tracks
Definition: testEve_cfg.py:39
virtual GlobalPoint getLinearizationPoint(const std::vector< reco::TransientTrack > &) const =0
GlobalPoint CrossingPtBasedLinearizationPointFinder::useAllTracks ( const std::vector< reco::TransientTrack > &  tracks) const
private

Definition at line 154 of file CrossingPtBasedLinearizationPointFinder.cc.

References TwoTrackMinimumDistance::calculate(), end, find(), FallbackLinearizationPointFinder::getLinearizationPoint(), TwoTrackMinimumDistance::points(), RPCpg::pts, mps_update::status, findQualityFiles::v, x, and y.

Referenced by getLinearizationPoint().

156 {
157  std::vector< PointAndDistance > vgp;
158  // vgp.reserve ( ( tracks.size() * ( tracks.size()-1 ) ) / 2 - 1 );
160  bool status;
161  std::vector<reco::TransientTrack>::const_iterator end=tracks.end();
162  std::vector<reco::TransientTrack>::const_iterator endm1=(end-1);
163  for ( std::vector<reco::TransientTrack>::const_iterator x=tracks.begin();
164  x!=endm1 ; ++x )
165  {
166  for ( std::vector<reco::TransientTrack>::const_iterator y=x+1;
167  y!=end; ++y )
168  {
169  status = ttmd.calculate( (*x).impactPointState(), (*y).impactPointState() );
170  if (status) {
171  std::pair < GlobalPoint, GlobalPoint > pts = ttmd.points();
172  std::pair < GlobalPoint , float > v ( ( pts.second + pts.first ) / 2. ,
173  ( pts.second - pts.first ).mag() );
174  vgp.push_back( v );
175  } // If sth goes wrong, we just dont add. Who cares?
176  }
177  }
178  if (! vgp.size() )
179  {
181  }
182  return find ( vgp );
183 }
virtual bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb)
GlobalPoint find(const std::vector< std::pair< GlobalPoint, float > > &) const
virtual GlobalPoint getLinearizationPoint(const std::vector< reco::TransientTrack > &) const
static const double pts[33]
Definition: Constants.h:30
#define end
Definition: vmac.h:37
tuple tracks
Definition: testEve_cfg.py:39
virtual std::pair< GlobalPoint, GlobalPoint > points() const
tuple status
Definition: mps_update.py:57
GlobalPoint CrossingPtBasedLinearizationPointFinder::useFullMatrix ( const std::vector< reco::TransientTrack > &  tracks) const
private

Definition at line 185 of file CrossingPtBasedLinearizationPointFinder.cc.

References RecTracksDistanceMatrix::crossingPoint(), RecTracksDistanceMatrix::distance(), end, find(), FallbackLinearizationPointFinder::getLinearizationPoint(), theMatrix, findQualityFiles::v, x, and y.

Referenced by getLinearizationPoint().

187 {
188  std::vector< PointAndDistance > vgp;
189  vgp.reserve ( (int) ( tracks.size() * ( tracks.size() -1 ) / 2. - 1 ) );
190  std::vector<reco::TransientTrack>::const_iterator end=tracks.end();
191  std::vector<reco::TransientTrack>::const_iterator endm1=(end-1);
192  for ( std::vector<reco::TransientTrack>::const_iterator x=tracks.begin();
193  x!=endm1 ; ++x )
194  {
195  for ( std::vector<reco::TransientTrack>::const_iterator y=x+1;
196  y!=end; ++y )
197  {
199  theMatrix->distance ( *x, *y ) );
200  vgp.push_back ( v );
201  }
202  }
203  if (! vgp.size() )
204  {
206  }
207  return find ( vgp );
208 }
GlobalPoint find(const std::vector< std::pair< GlobalPoint, float > > &) const
std::pair< GlobalPoint, float > PointAndDistance
virtual double distance(const reco::TransientTrack, const reco::TransientTrack) const =0
virtual GlobalPoint getLinearizationPoint(const std::vector< reco::TransientTrack > &) const
#define end
Definition: vmac.h:37
virtual GlobalPoint crossingPoint(const reco::TransientTrack, const reco::TransientTrack) const =0
tuple tracks
Definition: testEve_cfg.py:39

Member Data Documentation

ModeFinder3d* CrossingPtBasedLinearizationPointFinder::theAlgo
private
const RecTracksDistanceMatrix* CrossingPtBasedLinearizationPointFinder::theMatrix
protected
signed int CrossingPtBasedLinearizationPointFinder::theNPairs
protected
const bool CrossingPtBasedLinearizationPointFinder::useMatrix
protected

Definition at line 57 of file CrossingPtBasedLinearizationPointFinder.h.

Referenced by getLinearizationPoint().