CMS 3D CMS Logo

PFCluster.cc
Go to the documentation of this file.
2 
3 #include "Math/GenVector/etaMax.h"
4 
5 using namespace std;
6 using namespace reco;
7 
8 const math::XYZPoint PFCluster::dummyVtx_(0, 0, 0);
9 
10 PFCluster::PFCluster(PFLayer::Layer layer, double energy, double x, double y, double z)
11  : CaloCluster(energy, math::XYZPoint(x, y, z), PFLayer::toCaloID(layer), CaloCluster::particleFlow),
12  posrep_(position_.Rho(), position_.Eta(), position_.Phi()),
13  time_(-99.),
14  depth_(0.),
15  layer_(layer) {}
16 
18  energy_ = 0;
19  position_ *= 0;
20  posrep_ *= 0;
21  time_ = -99.;
23  rechits_.clear();
24 
26 }
27 
29  rechits_.clear();
30  hitsAndFractions_.clear();
31 }
32 
34  rechits_.push_back(frac);
35 
36  addHitAndFraction(frac.recHitRef()->detId(), frac.fraction());
37 }
38 
39 double PFCluster::getDepthCorrection(double energy, bool isBelowPS, bool isHadron) {
40  double corrA = depthCorA_;
41  double corrB = depthCorB_;
42  if (isBelowPS) {
43  corrA = depthCorAp_;
44  corrB = depthCorBp_;
45  }
46  return isHadron ? corrA : corrA * (corrB + log(energy));
47 }
48 
50  // cout<<"calling PFCluster::setLayer "<<layer<<endl;
51  layer_ = layer;
53  // cout<<"done "<<caloID_<<endl;
54 }
55 
57  // cout<<"calling PFCluster::layer "<<caloID()<<" "<<PFLayer::fromCaloID( caloID() )<<endl;
58  if (layer_ != PFLayer::NONE)
59  return layer_;
60  return PFLayer::fromCaloID(caloID());
61 }
62 
63 std::ostream& reco::operator<<(std::ostream& out, const PFCluster& cluster) {
64  if (!out)
65  return out;
66 
67  const math::XYZPoint& pos = cluster.position();
68  const PFCluster::REPPoint& posrep = cluster.positionREP();
69  const std::vector<reco::PFRecHitFraction>& fracs = cluster.recHitFractions();
70 
71  out << "PFcluster "
72  << ", layer: " << cluster.layer() << "\tE = " << cluster.energy() << "\tXYZ: " << pos.X() << "," << pos.Y() << ","
73  << pos.Z() << " | "
74  << "\tREP: " << posrep.Rho() << "," << posrep.Eta() << "," << posrep.Phi() << " | " << fracs.size() << " rechits";
75 
76  for (unsigned i = 0; i < fracs.size(); i++) {
77  // PFRecHit is not available, print the detID
78  if (!fracs[i].recHitRef().isAvailable())
79  out << cluster.printHitAndFraction(i) << ", ";
80  else
81  out << fracs[i] << ", ";
82  }
83 
84  return out;
85 }
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:153
void setLayer(PFLayer::Layer layer)
set layer
Definition: PFCluster.cc:49
math::XYZPoint position_
cluster centroid position
Definition: CaloCluster.h:227
static const char layer_[]
CaloID caloID_
bitmask for detector information
Definition: CaloCluster.h:230
std::string printHitAndFraction(unsigned i) const
print hitAndFraction
Definition: CaloCluster.cc:15
void addHitAndFraction(DetId id, float fraction)
Definition: CaloCluster.h:202
double energy_
cluster energy
Definition: CaloCluster.h:222
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
PFLayer::Layer layer_
transient layer
Definition: PFCluster.h:152
Fraction of a PFRecHit (rechits can be shared between several PFCluster&#39;s)
const std::vector< reco::PFRecHitFraction > & recHitFractions() const
vector of rechit fractions
Definition: PFCluster.h:65
PFLayer::Layer layer() const
cluster layer, see PFLayer.h in this directory
Definition: PFCluster.cc:56
const CaloID & caloID() const
Definition: CaloCluster.h:200
const REPPoint & positionREP() const
cluster position: rho, eta, phi
Definition: PFCluster.h:92
std::vector< reco::PFRecHitFraction > rechits_
vector of rechit fractions (transient)
Definition: PFCluster.h:141
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:66
static const constexpr double depthCorAp_
Definition: PFCluster.h:157
double energy() const
cluster energy
Definition: PFCluster.h:74
layer definition for PFRecHit and PFCluster
Definition: PFLayer.h:20
void reset()
resets clusters parameters
Definition: PFCluster.cc:17
std::vector< std::pair< DetId, float > > hitsAndFractions_
Definition: CaloCluster.h:233
void resetHitsAndFractions()
reset only hits and fractions
Definition: PFCluster.cc:28
Layer
layer definition
Definition: PFLayer.h:29
static reco::CaloID toCaloID(Layer layer)
Definition: PFLayer.cc:11
static const constexpr double depthCorB_
Definition: PFCluster.h:156
static double getDepthCorrection(double energy, bool isBelowPS=false, bool isHadron=false)
Definition: PFCluster.cc:39
static const constexpr double depthCorA_
depth corrections
Definition: PFCluster.h:155
REPPoint posrep_
cluster position: rho, eta, phi (transient)
Definition: PFCluster.h:144
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
static const constexpr double depthCorBp_
Definition: PFCluster.h:158
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
Definition: PFCluster.cc:33
fixed size matrix
float time_
Michalis: add timing and depth information.
Definition: PFCluster.h:147
float x
static Layer fromCaloID(const reco::CaloID &id)
Definition: PFLayer.cc:38
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< double > > REPPoint
Definition: PFCluster.h:48
void reset()
resets the CaloCluster (position, energy, hitsAndFractions)
Definition: CaloCluster.cc:9