CMS 3D CMS Logo

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  if( cluster.correctedEnergy() != -1.0 ) {
41  out << ", E_corr="<<cluster.correctedEnergy();
42  }
43  out<<", eta,phi="<<pos.eta()<<","<<pos.phi()
44  <<", nhits="<<cluster.hitsAndFractions().size()<<endl;
45  for(unsigned i=0; i<cluster.hitsAndFractions().size(); i++ ) {
46  out<<""<<cluster.printHitAndFraction(i)<<", ";
47  }
48 
49  return out;
50 }
size
Write out results.
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:129
double correctedEnergy() const
Definition: CaloCluster.h:125
AlgoID algoID() const
Definition: CaloCluster.h:176
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:195
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:71
const CaloID & caloID() const
Definition: CaloCluster.h:186
double energy() const
cluster energy
Definition: CaloCluster.h:124
std::string printHitAndFraction(unsigned i) const
print hitAndFraction
Definition: CaloCluster.cc:17
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