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::PFDisplacedVertexSeed ( )

Default constructor.

Definition at line 9 of file PFDisplacedVertexSeed.cc.

9 : seedPoint_(GlobalPoint(0, 0, 0)), totalWeight_(0) {}

Member Function Documentation

◆ addElement()

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.

11  {
12  if (std::find(elements_.begin(), elements_.end(), element) == elements_.end()) {
13  elements_.emplace_back(std::move(element));
14  }
15 }

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

Referenced by updateSeedPoint().

◆ Dump()

void PFDisplacedVertexSeed::Dump ( std::ostream &  out = std::cout) const

cout function

Definition at line 63 of file PFDisplacedVertexSeed.cc.

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 }

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

Referenced by PFDisplacedVertexFinder::fitVertexFromSeed().

◆ elements()

const std::vector<TrackBaseRef>& reco::PFDisplacedVertexSeed::elements ( ) const
inline
Returns
vector of unique references to tracks

Definition at line 48 of file PFDisplacedVertexSeed.h.

48 { return elements_; }

References elements_.

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

◆ isEmpty()

bool reco::PFDisplacedVertexSeed::isEmpty ( ) const
inline

Check if it is a new Seed.

Definition at line 45 of file PFDisplacedVertexSeed.h.

45 { return (elements_.empty()); }

References elements_.

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

◆ mergeWith()

void PFDisplacedVertexSeed::mergeWith ( const PFDisplacedVertexSeed displacedVertex)

Merge two Seeds if their seed Points are close enough.

Definition at line 41 of file PFDisplacedVertexSeed.cc.

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 }

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().

◆ nTracks()

const double reco::PFDisplacedVertexSeed::nTracks ( ) const
inline

Definition at line 50 of file PFDisplacedVertexSeed.h.

50 { return elements_.size(); }

References elements_.

◆ reserveElements()

void PFDisplacedVertexSeed::reserveElements ( size_t  newSize)

Reserve space for elements.

Definition at line 17 of file PFDisplacedVertexSeed.cc.

17 { elements_.reserve(newSize); }

References elements_.

Referenced by mergeWith(), and updateSeedPoint().

◆ seedPoint()

const GlobalPoint& reco::PFDisplacedVertexSeed::seedPoint ( ) const
inline
Returns
the seedPoint for the vertex fitting

Definition at line 53 of file PFDisplacedVertexSeed.h.

53 { return seedPoint_; }

References seedPoint_.

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

◆ totalWeight()

const double reco::PFDisplacedVertexSeed::totalWeight ( ) const
inline
Returns
the total weight

Definition at line 56 of file PFDisplacedVertexSeed.h.

56 { return totalWeight_; }

References totalWeight_.

Referenced by mergeWith().

◆ updateSeedPoint()

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

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 }

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

Friends And Related Function Documentation

◆ operator<<

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

Member Data Documentation

◆ elements_

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().

◆ seedPoint_

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().

◆ totalWeight_

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().

reco::PFDisplacedVertexSeed::seedPoint
const GlobalPoint & seedPoint() const
Definition: PFDisplacedVertexSeed.h:53
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
mps_merge.weight
weight
Definition: mps_merge.py:88
reco::PFDisplacedVertexSeed::totalWeight_
float totalWeight_
Definition: PFDisplacedVertexSeed.h:72
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
reco::PFDisplacedVertexSeed::addElement
void addElement(TrackBaseRef)
Definition: PFDisplacedVertexSeed.cc:11
reco::PFDisplacedVertexSeed::totalWeight
const double totalWeight() const
Definition: PFDisplacedVertexSeed.h:56
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::PFDisplacedVertexSeed::elements
const std::vector< TrackBaseRef > & elements() const
Definition: PFDisplacedVertexSeed.h:48
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Point3DBase< float, GlobalTag >
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
diffTwoXMLs.r2
r2
Definition: diffTwoXMLs.py:73
reco::PFDisplacedVertexSeed::seedPoint_
GlobalPoint seedPoint_
Seed point which indicated the approximative position of the vertex.
Definition: PFDisplacedVertexSeed.h:69
eostools.move
def move(src, dest)
Definition: eostools.py:511
reco::PFDisplacedVertexSeed::elements_
std::vector< TrackBaseRef > elements_
------— MEMBERS -------— ///
Definition: PFDisplacedVertexSeed.h:67
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
P
std::pair< OmniClusterRef, TrackingParticleRef > P
Definition: BDHadronTrackMonitoringAnalyzer.cc:202
Basic3DVector
Definition: extBasic3DVector.h:30
weight
Definition: weight.py:1
reco::PFDisplacedVertexSeed::isEmpty
bool isEmpty() const
Check if it is a new Seed.
Definition: PFDisplacedVertexSeed.h:45
reco::PFDisplacedVertexSeed::reserveElements
void reserveElements(size_t)
Reserve space for elements.
Definition: PFDisplacedVertexSeed.cc:17
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37