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);
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;
191 std::vector<bool> toPrint(elements.
size(),
static_cast<bool>(
true));
192 for(
unsigned ie=0; ie<elements.
size(); ie++) {
195 std::multimap<double, unsigned> ecalElems;
197 case PFBlockElement::TRACK:
201 case PFBlockElement::GSF:
205 case PFBlockElement::BREM:
211 if ( ecalElems.size() ) {
217 case PFBlockElement::SC:
223 int layer = clusterref->layer();
259 ss <<
"FH" << iHFHAD;
274 if ( toPrint[ie] ) out<<
"\t"<< s <<
" "<<elements[ie] <<endl;
281 out<<endl<<
"\tlink data (distance x 1000): "<<endl;
282 out<<setiosflags(ios::right);
283 out<<
"\t" << setw(width) <<
" ";
284 for(
unsigned ie=0; ie<elid.size(); ie++)
285 if ( toPrint[ie] ) out <<setw(width)<< elid[ie];
287 out<<setiosflags(ios::fixed);
288 out<<setprecision(1);
291 if ( !toPrint[
i] )
continue;
293 out <<setw(width) << elid[
i];
295 if ( !toPrint[
j] )
continue;
299 if (Dist > -0.5) out<<setw(width)<< Dist*1000.;
300 else out <<setw(width)<<
" ";
306 out<<endl<<
"\tlink data (distance x 1000) for tracking links : "<<endl;
307 out<<setiosflags(ios::right);
308 out<<
"\t" << setw(width) <<
" ";
309 for(
unsigned ie=0; ie<elid.size(); ie++)
311 ( block.
elements_[ie].type() == PFBlockElement::TRACK ||
312 block.
elements_[ie].type() == PFBlockElement::GSF ))
313 out <<setw(width)<< elid[ie];
315 out<<setiosflags(ios::fixed);
316 out<<setprecision(1);
318 for(
unsigned i=0; i<block.
elements_.size(); i++) {
320 (block.
elements_[i].type() != PFBlockElement::TRACK &&
321 block.
elements_[
i].type() != PFBlockElement::GSF ))
continue;
323 out <<setw(width) << elid[
i];
324 for(
unsigned j=0; j<block.
elements_.size(); j++) {
326 (block.
elements_[j].type() != PFBlockElement::TRACK &&
327 block.
elements_[
j].type() != PFBlockElement::GSF ))
continue;
331 if (Dist > -0.5) out<<setw(width)<< Dist*1000.;
332 else out <<setw(width)<<
" ";
337 out<<setprecision(3);
338 out<<resetiosflags(ios::right|ios::fixed);
342 out<<
"\tno links."<<endl;
349 unsigned PFBlock::linkDataSize()
const {
350 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.