1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include "DataFormats/CaloRecHit/interface/CaloCluster.h"
#include <sstream>
#include <iostream>
using namespace std;
using namespace reco;
void CaloCluster::reset() {
position_ = math::XYZPoint();
energy_ = 0;
hitsAndFractions_.clear();
}
string CaloCluster::printHitAndFraction(unsigned i) const {
ostringstream out;
if (i >= hitsAndFractions().size()) // i >= 0, since i is unsigned
out << "out of range " << i;
else
out << "( " << hitsAndFractions()[i].first << ", " << hitsAndFractions()[i].second << " )";
return out.str();
}
std::ostream& reco::operator<<(std::ostream& out, const CaloCluster& cluster) {
if (!out)
return out;
const math::XYZPoint& pos = cluster.position();
out << "CaloCluster , algoID=" << cluster.algoID() << ", " << cluster.caloID() << ", E=" << cluster.energy();
if (cluster.correctedEnergy() != -1.0) {
out << ", E_corr=" << cluster.correctedEnergy();
}
out << ", eta,phi=" << pos.eta() << "," << pos.phi() << ", nhits=" << cluster.hitsAndFractions().size() << endl;
for (unsigned i = 0; i < cluster.hitsAndFractions().size(); i++) {
out << "" << cluster.printHitAndFraction(i) << ", ";
}
return out;
}
|