CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes | Friends
reco::PFDisplacedVertexSeed Class Reference

Block of elements. More...

#include <PFDisplacedVertexSeed.h>

Public Member Functions

void addElement (TrackBaseRef)
 
void Dump (std::ostream &out=std::cout) const
 cout function More...
 
const std::vector< TrackBaseRef > & 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...
 
void reserveElements (size_t)
 Reserve space for elements. More...
 
const GlobalPointseedPoint () const
 
const double totalWeight () const
 
void updateSeedPoint (const GlobalPoint &dcaPoint, const TrackBaseRef, const TrackBaseRef, double weight=1)
 

Private Attributes

std::vector< TrackBaseRefelements_
 ---—— 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.

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  element)

Add a track Reference to the current Seed If the track reference is already in the collection, it is ignored

Definition at line 16 of file PFDisplacedVertexSeed.cc.

References elements_, spr::find(), and eostools::move().

Referenced by updateSeedPoint().

16  {
17  if(std::find(elements_.begin(),elements_.end(), element) == elements_.end()) {
18  elements_.emplace_back(std::move(element));
19  }
20 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
def move(src, dest)
Definition: eostools.py:510
std::vector< TrackBaseRef > elements_
---—— MEMBERS ----—— ///
void PFDisplacedVertexSeed::Dump ( std::ostream &  out = std::cout) const

cout function

Definition at line 78 of file PFDisplacedVertexSeed.cc.

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

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

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

Definition at line 54 of file PFDisplacedVertexSeed.h.

References elements_.

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

55  {return elements_;}
std::vector< TrackBaseRef > elements_
---—— MEMBERS ----—— ///
bool reco::PFDisplacedVertexSeed::isEmpty ( ) const
inline

Check if it is a new Seed.

Definition at line 51 of file PFDisplacedVertexSeed.h.

References elements_.

Referenced by plotting.Plot::clone(), and updateSeedPoint().

51 {return (elements_.empty());}
std::vector< TrackBaseRef > elements_
---—— MEMBERS ----—— ///
void PFDisplacedVertexSeed::mergeWith ( const PFDisplacedVertexSeed displacedVertex)

Merge two Seeds if their seed Points are close enough.

Definition at line 53 of file PFDisplacedVertexSeed.cc.

References MillePedeFileConverter_cfg::e, elements(), elements_, spr::find(), reserveElements(), seedPoint(), seedPoint_, totalWeight(), totalWeight_, mps_merge::weight, Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

53  {
54 
55 
56  double weight = displacedVertex.totalWeight();
57  const GlobalPoint& dcaPoint = displacedVertex.seedPoint();
58 
59  Basic3DVector<double>vertexSeedVector(seedPoint_);
60  Basic3DVector<double>dcaVector(dcaPoint);
61 
62  dcaVector = (dcaVector*weight + vertexSeedVector*totalWeight_)/(totalWeight_+weight);
63  GlobalPoint P(dcaVector.x(), dcaVector.y(), dcaVector.z());
65  seedPoint_ = P;
66 
67  reserveElements(elements_.size()+displacedVertex.elements().size());
68  auto const oldSize=elements_.size();
69  //avoid checking elements we just added from displacedVertex.elements()
70  for(auto const& e: displacedVertex.elements()) {
71  if(std::find(elements_.begin(), elements_.begin()+oldSize,e) == elements_.begin()+oldSize) {
72  elements_.emplace_back(e);
73  }
74  }
75 }
Definition: weight.py:1
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
GlobalPoint seedPoint_
Seed point which indicated the approximative position of the vertex.
const GlobalPoint & seedPoint() const
std::pair< OmniClusterRef, TrackingParticleRef > P
void reserveElements(size_t)
Reserve space for elements.
const double totalWeight() const
const std::vector< TrackBaseRef > & elements() const
std::vector< TrackBaseRef > elements_
---—— MEMBERS ----—— ///
const double reco::PFDisplacedVertexSeed::nTracks ( ) const
inline

Definition at line 57 of file PFDisplacedVertexSeed.h.

References elements_.

57 {return elements_.size();}
std::vector< TrackBaseRef > elements_
---—— MEMBERS ----—— ///
void PFDisplacedVertexSeed::reserveElements ( size_t  newSize)

Reserve space for elements.

Definition at line 22 of file PFDisplacedVertexSeed.cc.

References elements_.

Referenced by mergeWith(), and updateSeedPoint().

22  {
23  elements_.reserve(newSize);
24 }
std::vector< TrackBaseRef > elements_
---—— MEMBERS ----—— ///
const GlobalPoint& reco::PFDisplacedVertexSeed::seedPoint ( ) const
inline
Returns
the seedPoint for the vertex fitting

Definition at line 60 of file PFDisplacedVertexSeed.h.

References seedPoint_.

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

60 {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 63 of file PFDisplacedVertexSeed.h.

References gather_cfg::cout, Dump(), operator<<, MillePedeFileConverter_cfg::out, and totalWeight_.

Referenced by mergeWith().

void PFDisplacedVertexSeed::updateSeedPoint ( const GlobalPoint dcaPoint,
const TrackBaseRef  r1,
const TrackBaseRef  r2,
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 27 of file PFDisplacedVertexSeed.cc.

References addElement(), elements_, isEmpty(), reserveElements(), seedPoint_, totalWeight_, mps_merge::weight, Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

27  {
28 
29 
30  if ( isEmpty() ) {
31  seedPoint_ = dcaPoint;
33  }
34  else {
35  Basic3DVector<double>vertexSeedVector(seedPoint_);
36  Basic3DVector<double>dcaVector(dcaPoint);
37 
38 
39  dcaVector = (dcaVector*weight + vertexSeedVector*totalWeight_)/(totalWeight_+weight);
40  GlobalPoint P(dcaVector.x(), dcaVector.y(), dcaVector.z());
42  seedPoint_ = P;
43 
44  }
45 
46  reserveElements(elements_.size()+2);
47  addElement(r1);
48  addElement(r2);
49 
50 }
Definition: weight.py:1
GlobalPoint seedPoint_
Seed point which indicated the approximative position of the vertex.
std::pair< OmniClusterRef, TrackingParticleRef > P
bool isEmpty() const
Check if it is a new Seed.
void reserveElements(size_t)
Reserve space for elements.
std::vector< TrackBaseRef > elements_
---—— MEMBERS ----—— ///

Friends And Related Function Documentation

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

Referenced by totalWeight().

Member Data Documentation

std::vector< TrackBaseRef> reco::PFDisplacedVertexSeed::elements_
private

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

Set of tracks refs associated to the seed

Definition at line 77 of file PFDisplacedVertexSeed.h.

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

GlobalPoint reco::PFDisplacedVertexSeed::seedPoint_
private

Seed point which indicated the approximative position of the vertex.

Definition at line 79 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 82 of file PFDisplacedVertexSeed.h.

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