CMS 3D CMS Logo

PFDisplacedVertexSeed.cc
Go to the documentation of this file.
2 
5 
6 using namespace std;
7 using namespace reco;
8 
9 PFDisplacedVertexSeed::PFDisplacedVertexSeed() : seedPoint_(GlobalPoint(0, 0, 0)), totalWeight_(0) {}
10 
12  if (std::find(elements_.begin(), elements_.end(), element) == elements_.end()) {
13  elements_.emplace_back(std::move(element));
14  }
15 }
16 
17 void PFDisplacedVertexSeed::reserveElements(size_t newSize) { elements_.reserve(newSize); }
18 
22  double weight) {
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 }
40 
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 }
62 
63 void PFDisplacedVertexSeed::Dump(ostream& out) const {
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 }
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
Block of elements.
Definition: PFDisplacedVertexSeed.h:25
reco::PFDisplacedVertexSeed::totalWeight_
float totalWeight_
Definition: PFDisplacedVertexSeed.h:72
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
reco::PFDisplacedVertexSeed::Dump
void Dump(std::ostream &out=std::cout) const
cout function
Definition: PFDisplacedVertexSeed.cc:63
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::mergeWith
void mergeWith(const PFDisplacedVertexSeed &displacedVertex)
Merge two Seeds if their seed Points are close enough.
Definition: PFDisplacedVertexSeed.cc:41
reco::PFDisplacedVertexSeed::totalWeight
const double totalWeight() const
Definition: PFDisplacedVertexSeed.h:56
Basic3DVector::y
T y() const
Cartesian y coordinate.
Definition: extBasic3DVector.h:97
Track.h
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::PFDisplacedVertexSeed::elements
const std::vector< TrackBaseRef > & elements() const
Definition: PFDisplacedVertexSeed.h:48
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
PFDisplacedVertexSeed.h
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
std
Definition: JetResolutionObject.h:76
reco::PFDisplacedVertexSeed::elements_
std::vector< TrackBaseRef > elements_
------— MEMBERS -------— ///
Definition: PFDisplacedVertexSeed.h:67
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
Point3D.h
Basic3DVector::x
T x() const
Cartesian x coordinate.
Definition: extBasic3DVector.h:94
edm::RefToBase< reco::Track >
math::GlobalPoint
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalPoint
point in global coordinate system
Definition: Point3D.h:18
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
reco::PFDisplacedVertexSeed::updateSeedPoint
void updateSeedPoint(const GlobalPoint &dcaPoint, const TrackBaseRef, const TrackBaseRef, double weight=1)
Definition: PFDisplacedVertexSeed.cc:19
Basic3DVector::z
T z() const
Cartesian z coordinate.
Definition: extBasic3DVector.h:100
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