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 25 of file PFDisplacedVertexSeed.h.

Constructor & Destructor Documentation

PFDisplacedVertexSeed::PFDisplacedVertexSeed ( )

Default constructor.

Definition at line 9 of file PFDisplacedVertexSeed.cc.

9 : seedPoint_(GlobalPoint(0, 0, 0)), totalWeight_(0) {}
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 11 of file PFDisplacedVertexSeed.cc.

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

Referenced by updateSeedPoint().

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

cout function

Definition at line 63 of file PFDisplacedVertexSeed.cc.

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

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

63  {
64  if (!out)
65  return;
66 
67  out << "\t--- DisplacedVertexSeed --- " << endl;
68  out << "\tnumber of elements: " << elements_.size() << endl;
69 
70  out << "\t Seed Point x = " << seedPoint().x() << "\t Seed Point y = " << seedPoint().y()
71  << "\t Seed Point z = " << seedPoint().z() << endl;
72 
73  // Build element label (string) : elid from type, layer and occurence number
74  // use stringstream instead of sprintf to concatenate string and integer into string
75  for (auto const& ie : elements_) {
76  math::XYZPoint Pi(ie.get()->innerPosition());
77  math::XYZPoint Po(ie.get()->outerPosition());
78 
79  float innermost_radius = sqrt(Pi.x() * Pi.x() + Pi.y() * Pi.y() + Pi.z() * Pi.z());
80  float outermost_radius = sqrt(Po.x() * Po.x() + Po.y() * Po.y() + Po.z() * Po.z());
81  float innermost_rho = sqrt(Pi.x() * Pi.x() + Pi.y() * Pi.y());
82  float outermost_rho = sqrt(Po.x() * Po.x() + Po.y() * Po.y());
83 
84  double pt = ie->pt();
85 
86  out << "ie = " << ie.key() << " pt = " << pt << " innermost hit radius = " << innermost_radius
87  << " rho = " << innermost_rho << " outermost hit radius = " << outermost_radius << " rho = " << outermost_rho
88  << endl;
89 
90  out << "ie = " << ie.key() << " pt = "
91  << pt
92  // <<" inn hit pos x = " << Pi.x() << " y = " << Pi.y() << " z = " << Pi.z()
93  << " out hit pos x = " << Po.x() << " y = " << Po.y() << " z = " << Po.z() << endl;
94  }
95 
96  out << endl;
97 }
const double Pi
T sqrt(T t)
Definition: SSEVec.h:19
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 48 of file PFDisplacedVertexSeed.h.

References elements_.

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

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

Check if it is a new Seed.

Definition at line 45 of file PFDisplacedVertexSeed.h.

References elements_.

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

45 { 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 41 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().

41  {
42  double weight = displacedVertex.totalWeight();
43  const GlobalPoint& dcaPoint = displacedVertex.seedPoint();
44 
45  Basic3DVector<double> vertexSeedVector(seedPoint_);
46  Basic3DVector<double> dcaVector(dcaPoint);
47 
48  dcaVector = (dcaVector * weight + vertexSeedVector * totalWeight_) / (totalWeight_ + weight);
49  GlobalPoint P(dcaVector.x(), dcaVector.y(), dcaVector.z());
51  seedPoint_ = P;
52 
53  reserveElements(elements_.size() + displacedVertex.elements().size());
54  auto const oldSize = elements_.size();
55  //avoid checking elements we just added from displacedVertex.elements()
56  for (auto const& e : displacedVertex.elements()) {
57  if (std::find(elements_.begin(), elements_.begin() + oldSize, e) == elements_.begin() + oldSize) {
58  elements_.emplace_back(e);
59  }
60  }
61 }
Definition: weight.py:1
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
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
std::vector< TrackBaseRef > elements_
---—— MEMBERS ----—— ///
const std::vector< TrackBaseRef > & elements() const
const double reco::PFDisplacedVertexSeed::nTracks ( ) const
inline

Definition at line 50 of file PFDisplacedVertexSeed.h.

References elements_.

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

Reserve space for elements.

Definition at line 17 of file PFDisplacedVertexSeed.cc.

References elements_.

Referenced by mergeWith(), and updateSeedPoint().

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

Definition at line 53 of file PFDisplacedVertexSeed.h.

References seedPoint_.

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

53 { 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 56 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 19 of file PFDisplacedVertexSeed.cc.

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

22  {
23  if (isEmpty()) {
24  seedPoint_ = dcaPoint;
26  } else {
27  Basic3DVector<double> vertexSeedVector(seedPoint_);
28  Basic3DVector<double> dcaVector(dcaPoint);
29 
30  dcaVector = (dcaVector * weight + vertexSeedVector * totalWeight_) / (totalWeight_ + weight);
31  GlobalPoint P(dcaVector.x(), dcaVector.y(), dcaVector.z());
33  seedPoint_ = P;
34  }
35 
36  reserveElements(elements_.size() + 2);
37  addElement(r1);
38  addElement(r2);
39 }
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 67 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 69 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 72 of file PFDisplacedVertexSeed.h.

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