10 PFDisplacedVertexCandidate::PFDisplacedVertexCandidate(){}
12 void PFDisplacedVertexCandidate::addElement(
const TrackBaseRef element) {
13 elements_.push_back( element );
17 void PFDisplacedVertexCandidate::setLink(
const unsigned i1,
24 assert( test<LINKTEST_ALL );
27 bool ok = matrix2vector(i1,i2, index);
38 VertexLinkData::iterator it = vertexLinkData_.find(index);
39 if(it!=vertexLinkData_.end()) vertexLinkData_.erase(it);
49 void PFDisplacedVertexCandidate::associatedElements(
const unsigned i,
51 multimap<float, unsigned>& sortedAssociates,
54 sortedAssociates.clear();
57 if( i > elements_.size() )
return;
59 for(
unsigned ie=0; ie<elements_.size(); ie++) {
69 if( !matrix2vector(i, ie, index) )
continue;
72 VertexLinkData::const_iterator it = vertexLinkData.find(index);
73 if ( it!=vertexLinkData.end() &&
74 ( ( (1 <<
test ) & it->second.test_) !=0 || (test == LINKTEST_ALL) ) )
75 c2= it->second.distance_;
82 sortedAssociates.insert( pair<float,unsigned>(c2, ie) );
99 for (
unsigned ie1 = 0; ie1<elements_.size(); ie1++)
100 for (
unsigned ie2 = ie1+1; ie2<elements_.size(); ie2++){
103 if (P.x() > 1e9)
continue;
105 float r2 = P.x()*P.x()+P.y()*P.y()+P.z()*P.z();
107 r2Map.insert(pair<
float, pair<int,int> >(r2, pair <int, int>(ie1, ie2)));
120 for (
unsigned ie1 = 0; ie1<elements_.size(); ie1++)
121 for (
unsigned ie2 = ie1+1; ie2<elements_.size(); ie2++){
124 if (P.x() > 1e9)
continue;
126 float r2 = P.x()*P.x()+P.y()*P.y()+P.z()*P.z();
128 r2Vector.push_back(r2);
141 for (
unsigned ie1 = 0; ie1<elements_.size(); ie1++)
142 for (
unsigned ie2 = ie1+1; ie2<elements_.size(); ie2++){
144 float d = dist(ie1, ie2);
145 if (d < -0.5)
continue;
147 distVector.push_back(d);
155 const GlobalPoint PFDisplacedVertexCandidate::dcaPoint(
unsigned ie1,
unsigned ie2)
const {
160 if( !matrix2vector(ie1, ie2, index) )
return dcaPoint;
161 VertexLinkData::const_iterator it = vertexLinkData_.find(index);
162 if( it!=vertexLinkData_.end() ) dcaPoint = it->second.dcaPoint_;
171 bool PFDisplacedVertexCandidate::testLink(
unsigned ie1,
unsigned ie2)
const {
172 float d = dist( ie1, ie2);
173 if (d < -0.5)
return false;
178 const float PFDisplacedVertexCandidate::dist(
unsigned ie1,
unsigned ie2)
const {
183 if( !matrix2vector(ie1, ie2, index) )
return dist;
184 VertexLinkData::const_iterator it = vertexLinkData_.find(index);
185 if( it!=vertexLinkData_.end() ) dist= it->second.distance_;
202 unsigned PFDisplacedVertexCandidate::vertexLinkDataSize()
const {
203 unsigned n = elements_.size();
212 bool PFDisplacedVertexCandidate::matrix2vector(
unsigned iindex,
214 unsigned&
index )
const {
216 unsigned size = elements_.size();
217 if( iindex == jindex ||
223 if( iindex > jindex )
224 swap( iindex, jindex);
227 index = jindex-iindex-1;
230 index += iindex*
size;
231 unsigned missing = iindex*(iindex+1)/2;
238 void PFDisplacedVertexCandidate::Dump( ostream&
out )
const {
241 const vector < TrackBaseRef >&
elements = elements_;
242 out<<
"\t--- DisplacedVertexCandidate --- "<<endl;
243 out<<
"\tnumber of elements: "<<elements.size()<<endl;
247 for(
unsigned ie=0; ie<elements.size(); ie++) {
252 float innermost_radius =
sqrt(Pi.x()*Pi.x() + Pi.y()*Pi.y() + Pi.z()*Pi.z());
253 float outermost_radius =
sqrt(Po.x()*Po.x() + Po.y()*Po.y() + Po.z()*Po.z());
254 float innermost_rho =
sqrt(Pi.x()*Pi.x() + Pi.y()*Pi.y());
255 float outermost_rho =
sqrt(Po.x()*Po.x() + Po.y()*Po.y());
257 double pt = elements[ie]->pt();
260 out<<
"ie = " << elements[ie].key() <<
" pt = " << pt
261 <<
" innermost hit radius = " << innermost_radius <<
" rho = " << innermost_rho
262 <<
" outermost hit radius = " << outermost_radius <<
" rho = " << outermost_rho
std::vector< float > DistVector
std::map< float, std::pair< int, int > > DistMap
std::map< unsigned int, VertexLink > VertexLinkData
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
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