14 elements_.push_back(element->
clone());
17 void PFBlock::bookLinkData() {}
20 assert(test < LINKTEST_ALL);
23 bool ok = matrix2vector(i1, i2, index);
33 LinkData::iterator it = linkData.find(index);
34 if (it != linkData.end())
60 void PFBlock::associatedElements(
unsigned i,
62 multimap<double, unsigned>& sortedAssociates,
65 sortedAssociates.clear();
68 if (i > elements_.size())
72 for (
unsigned ie = 0; ie < elements_.size(); ie++) {
85 if (!matrix2vector(i, ie, index))
89 LinkData::const_iterator it = linkData.find(index);
90 if (it != linkData.end() && (((1 <<
test) & it->second.test) != 0 || (test == LINKTEST_ALL)))
91 c2 = it->second.distance;
98 sortedAssociates.insert(pair<double, unsigned>(c2, ie));
102 bool PFBlock::matrix2vector(
unsigned iindex,
unsigned jindex,
unsigned&
index)
const {
103 unsigned size = elements_.size();
104 if (iindex == jindex || iindex >= size || jindex >= size) {
111 index = jindex - iindex - 1;
114 index += iindex *
size;
115 unsigned missing = iindex * (iindex + 1) / 2;
122 double PFBlock::dist(
unsigned ie1,
unsigned ie2,
const LinkData& linkData)
const {
126 if (!matrix2vector(ie1, ie2, index))
128 LinkData::const_iterator it = linkData.find(index);
129 if (it != linkData.end())
130 Dist = it->second.distance;
139 out <<
"\t--- PFBlock --- " << endl;
140 out <<
"\tnumber of elements: " << elements.
size() << endl;
164 std::vector<bool> toPrint(elements.
size(),
static_cast<bool>(
true));
165 for (
unsigned ie = 0; ie < elements.
size(); ie++) {
167 std::multimap<double, unsigned> ecalElems;
169 case PFBlockElement::TRACK:
173 case PFBlockElement::GSF:
177 case PFBlockElement::BREM:
181 if (!ecalElems.empty()) {
187 case PFBlockElement::SC:
193 int layer = clusterref->layer();
229 ss <<
"FH" << iHFHAD;
245 out <<
"\t" << s <<
" " << elements[ie] << endl;
252 out << endl <<
"\tlink data (distance x 1000): " << endl;
253 out << setiosflags(ios::right);
254 out <<
"\t" << setw(width) <<
" ";
255 for (
unsigned ie = 0; ie < elid.size(); ie++)
257 out << setw(width) << elid[ie];
259 out << setiosflags(ios::fixed);
260 out << setprecision(1);
262 for (
unsigned i = 0;
i < block.
elements().size();
i++) {
266 out << setw(width) << elid[
i];
267 for (
unsigned j = 0;
j < block.
elements().size();
j++) {
274 out << setw(width) << Dist * 1000.;
276 out << setw(width) <<
" ";
281 out << endl <<
"\tlink data (distance x 1000) for tracking links : " << endl;
282 out << setiosflags(ios::right);
283 out <<
"\t" << setw(width) <<
" ";
284 for (
unsigned ie = 0; ie < elid.size(); ie++)
286 (block.
elements()[ie].type() == PFBlockElement::TRACK || block.
elements()[ie].type() == PFBlockElement::GSF))
287 out << setw(width) << elid[ie];
289 out << setiosflags(ios::fixed);
290 out << setprecision(1);
292 for (
unsigned i = 0; i < block.
elements().size(); i++) {
294 (block.
elements()[
i].type() != PFBlockElement::TRACK && block.
elements()[
i].type() != PFBlockElement::GSF))
297 out << setw(width) << elid[
i];
298 for (
unsigned j = 0; j < block.
elements().size(); j++) {
300 (block.
elements()[
j].type() != PFBlockElement::TRACK && block.
elements()[
j].type() != PFBlockElement::GSF))
306 out << setw(width) << Dist * 1000.;
308 out << setw(width) <<
" ";
313 out << setprecision(3);
314 out << resetiosflags(ios::right | ios::fixed);
317 out <<
"\tno links." << endl;
323 unsigned PFBlock::linkDataSize()
const {
324 unsigned n = elements_.size();
329 return n * (n - 1) / 2;
Abstract base class for a PFBlock element (track, cluster...)
std::map< unsigned int, Link > LinkData
const LinkData & linkData() const
constexpr std::array< uint8_t, layerIndexSize > layer
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
if(conf_.getParameter< bool >("UseStripCablingDB"))
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
const edm::OwnVector< reco::PFBlockElement > & elements() const
tuple size
Write out results.