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 }
mps_fire.i
i
Definition: mps_fire.py:355
pos
Definition: PixelAliasList.h:18
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
std::size
constexpr auto size(const C &c) -> decltype(c.size())
Definition: cuda_cxx17.h:13
reco::CaloCluster
Definition: CaloCluster.h:31
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
reco::CaloCluster::hitsAndFractions
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
reco::CaloCluster::printHitAndFraction
std::string printHitAndFraction(unsigned i) const
print hitAndFraction
Definition: CaloCluster.cc:15
reco::operator<<
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:66
reco::CaloCluster::algoID
AlgoID algoID() const
Definition: CaloCluster.h:191
reco::CaloCluster::position
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:154
std
Definition: JetResolutionObject.h:76
reco::CaloCluster::caloID
const CaloID & caloID() const
Definition: CaloCluster.h:201
reco::CaloCluster::correctedEnergy
double correctedEnergy() const
Definition: CaloCluster.h:150
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
reset
void reset(double vett[256])
Definition: TPedValues.cc:11
reco::CaloCluster::energy
double energy() const
cluster energy
Definition: CaloCluster.h:149
CaloCluster.h