13 element->
setIndex( elements_.size() );
15 elements_.push_back( element->
clone() );
20 void PFBlock::bookLinkData() {
26 void PFBlock::setLink(
unsigned i1,
32 assert( test<LINKTEST_ALL );
35 bool ok = matrix2vector(i1,i2, index);
42 l.
test |= (1 << test);
45 LinkData::iterator it = linkData.find(index);
46 if(it!=linkData.end()) linkData.erase(it);
75 void PFBlock::associatedElements(
unsigned i,
77 multimap<double, unsigned>& sortedAssociates,
81 sortedAssociates.clear();
84 if( i > elements_.size() )
return;
87 for(
unsigned ie=0; ie<elements_.size(); ie++) {
102 if( !matrix2vector(i, ie, index) )
continue;
105 LinkData::const_iterator it = linkData.find(index);
106 if ( it!=linkData.end() &&
107 ( ( (1 << test ) & it->second.test) !=0 || (test == LINKTEST_ALL) ) )
108 c2= it->second.distance;
115 sortedAssociates.insert( pair<double,unsigned>(c2, ie) );
119 bool PFBlock::matrix2vector(
unsigned iindex,
121 unsigned&
index )
const {
123 unsigned size = elements_.size();
124 if( iindex == jindex ||
130 if( iindex > jindex )
134 index = jindex-iindex-1;
137 index += iindex*
size;
138 unsigned missing = iindex*(iindex+1)/2;
146 double PFBlock::dist(
unsigned ie1,
unsigned ie2,
152 if( !matrix2vector(ie1, ie2, index) )
return Dist;
153 LinkData::const_iterator it = linkData.find(index);
154 if( it!=linkData.end() ) Dist= it->second.distance;
164 if(! out)
return out;
166 out<<
"\t--- PFBlock --- "<<endl;
167 out<<
"\tnumber of elements: "<<elements.
size()<<endl;
172 vector <string> elid;
190 std::vector<bool> toPrint(elements.
size(),
static_cast<bool>(
true));
191 for(
unsigned ie=0; ie<elements.
size(); ie++) {
194 std::multimap<double, unsigned> ecalElems;
196 case PFBlockElement::TRACK:
200 case PFBlockElement::GSF:
204 case PFBlockElement::BREM:
210 if ( ecalElems.size() ) {
216 case PFBlockElement::SC:
222 int layer = clusterref->layer();
254 ss <<
"FH" << iHFHAD;
269 if ( toPrint[ie] ) out<<
"\t"<< s <<
" "<<elements[ie] <<endl;
276 out<<endl<<
"\tlink data (distance x 1000): "<<endl;
277 out<<setiosflags(ios::right);
278 out<<
"\t" << setw(width) <<
" ";
279 for(
unsigned ie=0; ie<elid.size(); ie++)
280 if ( toPrint[ie] ) out <<setw(width)<< elid[ie];
282 out<<setiosflags(ios::fixed);
283 out<<setprecision(1);
286 if ( !toPrint[
i] )
continue;
288 out <<setw(width) << elid[
i];
290 if ( !toPrint[
j] )
continue;
294 if (Dist > -0.5) out<<setw(width)<< Dist*1000.;
295 else out <<setw(width)<<
" ";
301 out<<endl<<
"\tlink data (distance x 1000) for tracking links : "<<endl;
302 out<<setiosflags(ios::right);
303 out<<
"\t" << setw(width) <<
" ";
304 for(
unsigned ie=0; ie<elid.size(); ie++)
306 ( block.
elements_[ie].type() == PFBlockElement::TRACK ||
307 block.
elements_[ie].type() == PFBlockElement::GSF ))
308 out <<setw(width)<< elid[ie];
310 out<<setiosflags(ios::fixed);
311 out<<setprecision(1);
313 for(
unsigned i=0; i<block.
elements_.size(); i++) {
315 (block.
elements_[i].type() != PFBlockElement::TRACK &&
316 block.
elements_[
i].type() != PFBlockElement::GSF ))
continue;
318 out <<setw(width) << elid[
i];
319 for(
unsigned j=0; j<block.
elements_.size(); j++) {
321 (block.
elements_[j].type() != PFBlockElement::TRACK &&
322 block.
elements_[
j].type() != PFBlockElement::GSF ))
continue;
326 if (Dist > -0.5) out<<setw(width)<< Dist*1000.;
327 else out <<setw(width)<<
" ";
332 out<<setprecision(3);
333 out<<resetiosflags(ios::right|ios::fixed);
337 out<<
"\tno links."<<endl;
344 unsigned PFBlock::linkDataSize()
const {
345 unsigned n = elements_.size();
Abstract base class for a PFBlock element (track, cluster...)
std::map< unsigned int, Link > LinkData
const edm::OwnVector< reco::PFBlockElement > & elements() const
const LinkData & linkData() const
virtual PFBlockElement * clone() const =0
necessary to have the edm::OwnVector<PFBlockElement> working
std::ostream & operator<<(std::ostream &, BeamSpot beam)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
void setIndex(unsigned index)
set index
edm::OwnVector< reco::PFBlockElement > elements_
all elements
void associatedElements(unsigned i, const LinkData &linkData, std::multimap< double, unsigned > &sortedAssociates, reco::PFBlockElement::Type type=PFBlockElement::NONE, LinkTest test=LINKTEST_RECHIT) const
double dist(unsigned ie1, unsigned ie2, const LinkData &linkData, LinkTest test) const
tuple size
Write out results.