9 PFDisplacedVertexCandidate::PFDisplacedVertexCandidate() {}
11 void PFDisplacedVertexCandidate::addElement(
const TrackBaseRef element) { elements_.push_back(element); }
13 void PFDisplacedVertexCandidate::setLink(
25 l.dcaPoint_ = dcaPoint;
26 l.test_ |= (1 <<
test);
29 VertexLinkData::iterator
it = vertexLinkData_.find(
index);
30 if (
it != vertexLinkData_.end())
31 vertexLinkData_.erase(
it);
39 void PFDisplacedVertexCandidate::associatedElements(
const unsigned i,
41 multimap<float, unsigned>& sortedAssociates,
43 sortedAssociates.clear();
46 if (
i > elements_.size())
49 for (
unsigned ie = 0; ie < elements_.size(); ie++) {
58 if (!matrix2vector(
i, ie,
index))
62 VertexLinkData::const_iterator
it = vertexLinkData.find(
index);
63 if (
it != vertexLinkData.end() && (((1 <<
test) &
it->second.test_) != 0 || (
test == LINKTEST_ALL)))
64 c2 =
it->second.distance_;
71 sortedAssociates.insert(pair<float, unsigned>(c2, ie));
80 for (
unsigned ie1 = 0; ie1 < elements_.size(); ie1++)
81 for (
unsigned ie2 = ie1 + 1; ie2 < elements_.size(); ie2++) {
86 float r2 =
P.x() *
P.x() +
P.y() *
P.y() +
P.z() *
P.z();
88 r2Map.insert(pair<
float, pair<int, int> >(
r2, pair<int, int>(ie1, ie2)));
97 for (
unsigned ie1 = 0; ie1 < elements_.size(); ie1++)
98 for (
unsigned ie2 = ie1 + 1; ie2 < elements_.size(); ie2++) {
103 float r2 =
P.x() *
P.x() +
P.y() *
P.y() +
P.z() *
P.z();
105 r2Vector.push_back(
r2);
114 for (
unsigned ie1 = 0; ie1 < elements_.size(); ie1++)
115 for (
unsigned ie2 = ie1 + 1; ie2 < elements_.size(); ie2++) {
116 float d = dist(ie1, ie2);
120 distVector.push_back(
d);
126 const GlobalPoint PFDisplacedVertexCandidate::dcaPoint(
unsigned ie1,
unsigned ie2)
const {
130 if (!matrix2vector(ie1, ie2,
index))
132 VertexLinkData::const_iterator
it = vertexLinkData_.find(
index);
133 if (
it != vertexLinkData_.end())
134 dcaPoint =
it->second.dcaPoint_;
141 bool PFDisplacedVertexCandidate::testLink(
unsigned ie1,
unsigned ie2)
const {
142 float d = dist(ie1, ie2);
148 const float PFDisplacedVertexCandidate::dist(
unsigned ie1,
unsigned ie2)
const {
152 if (!matrix2vector(ie1, ie2,
index))
154 VertexLinkData::const_iterator
it = vertexLinkData_.find(
index);
155 if (
it != vertexLinkData_.end())
156 dist =
it->second.distance_;
163 unsigned PFDisplacedVertexCandidate::vertexLinkDataSize()
const {
164 unsigned n = elements_.size();
169 return n * (
n - 1) / 2;
172 bool PFDisplacedVertexCandidate::matrix2vector(
unsigned iindex,
unsigned jindex,
unsigned&
index)
const {
173 unsigned size = elements_.size();
174 if (iindex == jindex || iindex >= size || jindex >= size) {
179 swap(iindex, jindex);
181 index = jindex - iindex - 1;
184 index += iindex * size;
185 unsigned missing = iindex * (iindex + 1) / 2;
192 void PFDisplacedVertexCandidate::Dump(ostream&
out)
const {
196 const vector<TrackBaseRef>&
elements = elements_;
197 out <<
"\t--- DisplacedVertexCandidate --- " << endl;
198 out <<
"\tnumber of elements: " <<
elements.size() << endl;
202 for (
unsigned ie = 0; ie <
elements.size(); ie++) {
206 float innermost_radius =
sqrt(
Pi.x() *
Pi.x() +
Pi.y() *
Pi.y() +
Pi.z() *
Pi.z());
207 float outermost_radius =
sqrt(Po.x() * Po.x() + Po.y() * Po.y() + Po.z() * Po.z());
208 float innermost_rho =
sqrt(
Pi.x() *
Pi.x() +
Pi.y() *
Pi.y());
209 float outermost_rho =
sqrt(Po.x() * Po.x() + Po.y() * Po.y());
213 out <<
"ie = " <<
elements[ie].key() <<
" pt = " <<
pt <<
" innermost hit radius = " << innermost_radius
214 <<
" rho = " << innermost_rho <<
" outermost hit radius = " << outermost_radius <<
" rho = " << outermost_rho
void swap(Association< C > &lhs, Association< C > &rhs)
std::map< unsigned int, VertexLink > VertexLinkData
std::vector< float > DistVector
XYZPointD XYZPoint
point in space with cartesian internal representation
std::pair< OmniClusterRef, TrackingParticleRef > P
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalPoint
point in global coordinate system
std::map< float, std::pair< int, int > > DistMap
if(threadIdxLocalY==0 &&threadIdxLocalX==0)