CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFDisplacedVertexSeed.cc
Go to the documentation of this file.
2 
5 
6 using namespace std;
7 using namespace reco;
8 
9 
10 PFDisplacedVertexSeed::PFDisplacedVertexSeed() :
11  seedPoint_(GlobalPoint(0,0,0)),
12  totalWeight_(0)
13 {}
14 
15 
17  elements_.insert( element );
18 }
19 
20 
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 }
44 
45 
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 }
69 
70 
71 void PFDisplacedVertexSeed::Dump( ostream& out ) const {
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 }
112 
113 
const double Pi
T y() const
Cartesian y coordinate.
T x() const
Cartesian x coordinate.
std::set< TrackBaseRef, Compare > elements_
---—— MEMBERS ----—— ///
#define P
void addElement(TrackBaseRef)
Add a track Reference to the current Seed.
void mergeWith(const PFDisplacedVertexSeed &displacedVertex)
Merge two Seeds if their seed Points are close enough.
const std::set< TrackBaseRef, Compare > & elements() const
void Dump(std::ostream &out=std::cout) const
cout function
T z() const
Cartesian z coordinate.
T sqrt(T t)
Definition: SSEVec.h:48
GlobalPoint seedPoint_
Seed point which indicated the approximative position of the vertex.
tuple out
Definition: dbtoconf.py:99
const GlobalPoint & seedPoint() const
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalPoint
point in global coordinate system
Definition: Point3D.h:17
bool isEmpty() const
Check if it is a new Seed.
std::set< reco::TrackBaseRef >::iterator IEset
-----— Useful Types -----— ///
const double totalWeight() const
int weight
Definition: histoStyle.py:50
void updateSeedPoint(const GlobalPoint &dcaPoint, const TrackBaseRef, const TrackBaseRef, double weight=1)