CMS 3D CMS Logo

CaloCluster.cc
Go to the documentation of this file.
2 
3 #include <sstream>
4 #include <iostream>
5 
6 using namespace std;
7 using namespace reco;
8 
10  position_ = math::XYZPoint();
11  energy_ = 0;
12  hitsAndFractions_.clear();
13 }
14 
15 string CaloCluster::printHitAndFraction(unsigned i) const {
16  ostringstream out;
17  if (i >= hitsAndFractions().size()) // i >= 0, since i is unsigned
18  out << "out of range " << i;
19  else
20  out << "( " << hitsAndFractions()[i].first << ", " << hitsAndFractions()[i].second << " )";
21  return out.str();
22 }
23 
24 std::ostream& reco::operator<<(std::ostream& out, const CaloCluster& cluster) {
25  if (!out)
26  return out;
27 
28  const math::XYZPoint& pos = cluster.position();
29 
30  out << "CaloCluster , algoID=" << cluster.algoID() << ", " << cluster.caloID() << ", E=" << cluster.energy();
31  if (cluster.correctedEnergy() != -1.0) {
32  out << ", E_corr=" << cluster.correctedEnergy();
33  }
34  out << ", eta,phi=" << pos.eta() << "," << pos.phi() << ", nhits=" << cluster.hitsAndFractions().size() << endl;
35  for (unsigned i = 0; i < cluster.hitsAndFractions().size(); i++) {
36  out << "" << cluster.printHitAndFraction(i) << ", ";
37  }
38 
39  return out;
40 }
size
Write out results.
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:154
std::string printHitAndFraction(unsigned i) const
print hitAndFraction
Definition: CaloCluster.cc:15
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
const CaloID & caloID() const
Definition: CaloCluster.h:201
double correctedEnergy() const
Definition: CaloCluster.h:150
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:66
double energy() const
cluster energy
Definition: CaloCluster.h:149
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
fixed size matrix
void reset(double vett[256])
Definition: TPedValues.cc:11
AlgoID algoID() const
Definition: CaloCluster.h:191