CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloCluster.cc
Go to the documentation of this file.
2 
3 
4 #include <sstream>
5 #include <iostream>
6 
7 using namespace std;
8 using namespace reco;
9 
10 
12  position_ = math::XYZPoint();
13  energy_ = 0;
14  hitsAndFractions_.clear();
15 }
16 
17 string CaloCluster::printHitAndFraction(unsigned i) const {
18 
19  ostringstream out;
20  if( i>=hitsAndFractions().size() ) // i >= 0, since i is unsigned
21  out<<"out of range "<<i;
22  else
23  out<<"( "<<hitsAndFractions()[i].first
24  <<", "<<hitsAndFractions()[i].second
25  <<" )";
26  return out.str();
27 }
28 
29 
30 std::ostream& reco::operator<<(std::ostream& out,
31  const CaloCluster& cluster) {
32 
33  if(!out) return out;
34 
35  const math::XYZPoint& pos = cluster.position();
36 
37  out<<"CaloCluster , algoID="<<cluster.algoID()
38  <<", "<<cluster.caloID()
39  <<", E="<<cluster.energy()
40  <<", eta,phi="<<pos.eta()<<","<<pos.phi()
41  <<", nhits="<<cluster.hitsAndFractions().size()<<endl;
42  for(unsigned i=0; i<cluster.hitsAndFractions().size(); i++ ) {
43  out<<""<<cluster.printHitAndFraction(i)<<", ";
44  }
45 
46  return out;
47 }
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:123
int i
Definition: DBlmapReader.cc:9
AlgoID algoID() const
Definition: CaloCluster.h:170
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:189
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:72
const CaloID & caloID() const
Definition: CaloCluster.h:180
double energy() const
cluster energy
Definition: CaloCluster.h:120
std::string printHitAndFraction(unsigned i) const
print hitAndFraction
Definition: CaloCluster.cc:17
tuple out
Definition: dbtoconf.py:99
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
void reset(double vett[256])
Definition: TPedValues.cc:11
tuple size
Write out results.