CMS 3D CMS Logo

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

Block of elements. More...

#include <PFDisplacedVertexSeed.h>

Classes

struct  Compare
 

Public Types

typedef std::set
< reco::TrackBaseRef >
::iterator 
IEset
 -----— Useful Types -----— /// More...
 

Public Member Functions

void addElement (TrackBaseRef)
 Add a track Reference to the current Seed. More...
 
void Dump (std::ostream &out=std::cout) const
 cout function More...
 
const std::set< TrackBaseRef,
Compare > & 
elements () const
 
bool isEmpty () const
 Check if it is a new Seed. More...
 
void mergeWith (const PFDisplacedVertexSeed &displacedVertex)
 Merge two Seeds if their seed Points are close enough. More...
 
const double nTracks () const
 
 PFDisplacedVertexSeed ()
 Default constructor. More...
 
const GlobalPointseedPoint () const
 
const double totalWeight () const
 
void updateSeedPoint (const GlobalPoint &dcaPoint, const TrackBaseRef, const TrackBaseRef, double weight=1)
 

Private Attributes

std::set< TrackBaseRef, Compareelements_
 ---—— MEMBERS ----—— /// More...
 
GlobalPoint seedPoint_
 Seed point which indicated the approximative position of the vertex. More...
 
float totalWeight_
 

Friends

std::ostream & operator<< (std::ostream &out, const PFDisplacedVertexSeed &co)
 

Detailed Description

Block of elements.

Author
Gouzevitch Maxime
Date
November 2009

A DisplacedVertexSeed is an intermediate format, usually not persistent, used by PFDisplacedVertexFinder to keep the information for vertex fit. This format is produced after parsing of PFDisplacedVertexCandidate which by construction may contain many seeds. This format contains:

Definition at line 28 of file PFDisplacedVertexSeed.h.

Member Typedef Documentation

-----— Useful Types -----— ///

Definition at line 34 of file PFDisplacedVertexSeed.h.

Constructor & Destructor Documentation

PFDisplacedVertexSeed::PFDisplacedVertexSeed ( )

Default constructor.

Definition at line 10 of file PFDisplacedVertexSeed.cc.

10  :
11  seedPoint_(GlobalPoint(0,0,0)),
12  totalWeight_(0)
13 {}
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint seedPoint_
Seed point which indicated the approximative position of the vertex.

Member Function Documentation

void PFDisplacedVertexSeed::addElement ( TrackBaseRef  )

Add a track Reference to the current Seed.

Definition at line 16 of file PFDisplacedVertexSeed.cc.

References elements_.

Referenced by mergeWith(), and updateSeedPoint().

16  {
17  elements_.insert( element );
18 }
std::set< TrackBaseRef, Compare > elements_
---—— MEMBERS ----—— ///
void PFDisplacedVertexSeed::Dump ( std::ostream &  out = std::cout) const

cout function

Definition at line 71 of file PFDisplacedVertexSeed.cc.

References elements_, Pi, EnergyCorrector::pt, seedPoint(), and mathSSE::sqrt().

Referenced by PFDisplacedVertexFinder::fitVertexFromSeed().

71  {
72  if(! out ) return;
73 
74  out<<"\t--- DisplacedVertexSeed --- "<<endl;
75  out<<"\tnumber of elements: "<<elements_.size()<<endl;
76 
77  out<<"\t Seed Point x = " << seedPoint().x()
78  <<"\t Seed Point y = " << seedPoint().y()
79  <<"\t Seed Point z = " << seedPoint().z() << endl;
80 
81  // Build element label (string) : elid from type, layer and occurence number
82  // use stringstream instead of sprintf to concatenate string and integer into string
83  for(IEset ie = elements_.begin(); ie != elements_.end(); ie++){
84 
85  math::XYZPoint Pi((*ie).get()->innerPosition());
86  math::XYZPoint Po((*ie).get()->outerPosition());
87 
88  float innermost_radius = sqrt(Pi.x()*Pi.x() + Pi.y()*Pi.y() + Pi.z()*Pi.z());
89  float outermost_radius = sqrt(Po.x()*Po.x() + Po.y()*Po.y() + Po.z()*Po.z());
90  float innermost_rho = sqrt(Pi.x()*Pi.x() + Pi.y()*Pi.y());
91  float outermost_rho = sqrt(Po.x()*Po.x() + Po.y()*Po.y());
92 
93  double pt = (*ie)->pt();
94 
95 
96  out<<"ie = " << (*ie).key() << " pt = " << pt
97  <<" innermost hit radius = " << innermost_radius << " rho = " << innermost_rho
98  <<" outermost hit radius = " << outermost_radius << " rho = " << outermost_rho
99  <<endl;
100 
101  out<<"ie = " << (*ie).key() << " pt = " << pt
102  // <<" inn hit pos x = " << Pi.x() << " y = " << Pi.y() << " z = " << Pi.z()
103  <<" out hit pos x = " << Po.x() << " y = " << Po.y() << " z = " << Po.z()
104  <<endl;
105 
106  }
107 
108  out<<endl;
109 
110 
111 }
const double Pi
std::set< TrackBaseRef, Compare > elements_
---—— MEMBERS ----—— ///
T sqrt(T t)
Definition: SSEVec.h:48
tuple out
Definition: dbtoconf.py:99
const GlobalPoint & seedPoint() const
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
std::set< reco::TrackBaseRef >::iterator IEset
-----— Useful Types -----— ///
const std::set< TrackBaseRef, Compare >& reco::PFDisplacedVertexSeed::elements ( ) const
inline
Returns
set of references to tracks

Definition at line 64 of file PFDisplacedVertexSeed.h.

References elements_.

Referenced by PFDisplacedVertexFinder::fitVertexFromSeed(), and mergeWith().

65  {return elements_;}
std::set< TrackBaseRef, Compare > elements_
---—— MEMBERS ----—— ///
bool reco::PFDisplacedVertexSeed::isEmpty ( ) const
inline

Check if it is a new Seed.

Definition at line 61 of file PFDisplacedVertexSeed.h.

References elements_.

Referenced by updateSeedPoint().

61 {return (elements_.size() == 0);}
std::set< TrackBaseRef, Compare > elements_
---—— MEMBERS ----—— ///
void PFDisplacedVertexSeed::mergeWith ( const PFDisplacedVertexSeed displacedVertex)

Merge two Seeds if their seed Points are close enough.

Definition at line 46 of file PFDisplacedVertexSeed.cc.

References addElement(), elements(), P, seedPoint(), seedPoint_, totalWeight(), totalWeight_, puppiForMET_cff::weight, Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

46  {
47 
48 
49  double weight = displacedVertex.totalWeight();
50  set<TrackBaseRef, Compare> newElements= displacedVertex.elements();
51  GlobalPoint dcaPoint = displacedVertex.seedPoint();
52 
53  Basic3DVector<double>vertexSeedVector(seedPoint_);
54  Basic3DVector<double>dcaVector(dcaPoint);
55 
56  dcaVector = (dcaVector*weight + vertexSeedVector*totalWeight_)/(totalWeight_+weight);
57  GlobalPoint P(dcaVector.x(), dcaVector.y(), dcaVector.z());
59  seedPoint_ = P;
60 
61 
62 
63  for ( set<TrackBaseRef, Compare>::const_iterator il = newElements.begin(); il != newElements.end(); il++)
64  addElement(*il);
65 
66 
67 
68 }
#define P
void addElement(TrackBaseRef)
Add a track Reference to the current Seed.
const std::set< TrackBaseRef, Compare > & elements() const
GlobalPoint seedPoint_
Seed point which indicated the approximative position of the vertex.
const GlobalPoint & seedPoint() const
const double totalWeight() const
const double reco::PFDisplacedVertexSeed::nTracks ( ) const
inline

Definition at line 67 of file PFDisplacedVertexSeed.h.

References elements_.

67 {return elements_.size();}
std::set< TrackBaseRef, Compare > elements_
---—— MEMBERS ----—— ///
const GlobalPoint& reco::PFDisplacedVertexSeed::seedPoint ( ) const
inline
Returns
the seedPoint for the vertex fitting

Definition at line 70 of file PFDisplacedVertexSeed.h.

References seedPoint_.

Referenced by Dump(), PFDisplacedVertexFinder::fitVertexFromSeed(), PFDisplacedVertexFinder::isCloseTo(), and mergeWith().

70 {return seedPoint_;}
GlobalPoint seedPoint_
Seed point which indicated the approximative position of the vertex.
const double reco::PFDisplacedVertexSeed::totalWeight ( ) const
inline
Returns
the total weight

Definition at line 73 of file PFDisplacedVertexSeed.h.

References totalWeight_.

Referenced by mergeWith().

void PFDisplacedVertexSeed::updateSeedPoint ( const GlobalPoint dcaPoint,
const TrackBaseRef  ,
const TrackBaseRef  ,
double  weight = 1 
)

Add a track Ref to the Seed and recalculate the seedPoint with a new dcaPoint A weight different from 1 may be assign to the new DCA point

Definition at line 21 of file PFDisplacedVertexSeed.cc.

References addElement(), isEmpty(), P, seedPoint_, totalWeight_, puppiForMET_cff::weight, Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

21  {
22 
23 
24  if ( isEmpty() ) {
25  seedPoint_ = dcaPoint;
27  }
28  else {
29  Basic3DVector<double>vertexSeedVector(seedPoint_);
30  Basic3DVector<double>dcaVector(dcaPoint);
31 
32 
33  dcaVector = (dcaVector*weight + vertexSeedVector*totalWeight_)/(totalWeight_+weight);
34  GlobalPoint P(dcaVector.x(), dcaVector.y(), dcaVector.z());
36  seedPoint_ = P;
37 
38  }
39 
40  addElement(r1);
41  addElement(r2);
42 
43 }
#define P
void addElement(TrackBaseRef)
Add a track Reference to the current Seed.
GlobalPoint seedPoint_
Seed point which indicated the approximative position of the vertex.
bool isEmpty() const
Check if it is a new Seed.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const PFDisplacedVertexSeed co 
)
friend

Member Data Documentation

std::set< TrackBaseRef , Compare > reco::PFDisplacedVertexSeed::elements_
private

---—— MEMBERS ----—— ///

Set of tracks refs associated to the seed

Definition at line 87 of file PFDisplacedVertexSeed.h.

Referenced by addElement(), Dump(), elements(), isEmpty(), and nTracks().

GlobalPoint reco::PFDisplacedVertexSeed::seedPoint_
private

Seed point which indicated the approximative position of the vertex.

Definition at line 89 of file PFDisplacedVertexSeed.h.

Referenced by mergeWith(), seedPoint(), and updateSeedPoint().

float reco::PFDisplacedVertexSeed::totalWeight_
private

Total weight of the points used to calculate the seed point. Necessary for UpdateSeed Point function

Definition at line 92 of file PFDisplacedVertexSeed.h.

Referenced by mergeWith(), totalWeight(), and updateSeedPoint().