CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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;
52  caloID_ = PFLayer::toCaloID(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 
64  CaloCluster::operator=(other);
65  rechits_ = other.rechits_;
66  energy_ = other.energy_;
67  position_ = other.position_;
68  posrep_ = other.posrep_;
69 
70  return *this;
71 }
72 
73 std::ostream& reco::operator<<(std::ostream& out, const PFCluster& cluster) {
74  if (!out)
75  return out;
76 
77  const math::XYZPoint& pos = cluster.position();
78  const PFCluster::REPPoint& posrep = cluster.positionREP();
79  const std::vector<reco::PFRecHitFraction>& fracs = cluster.recHitFractions();
80 
81  out << "PFcluster "
82  << ", layer: " << cluster.layer() << "\tE = " << cluster.energy() << "\tXYZ: " << pos.X() << "," << pos.Y() << ","
83  << pos.Z() << " | "
84  << "\tREP: " << posrep.Rho() << "," << posrep.Eta() << "," << posrep.Phi() << " | " << fracs.size() << " rechits";
85 
86  for (unsigned i = 0; i < fracs.size(); i++) {
87  // PFRecHit is not available, print the detID
88  if (!fracs[i].recHitRef().isAvailable())
89  out << cluster.printHitAndFraction(i) << ", ";
90  else
91  out << fracs[i] << ", ";
92  }
93 
94  return out;
95 }
PFLayer::Layer layer() const
cluster layer, see PFLayer.h in this directory
Definition: PFCluster.cc:56
void setLayer(PFLayer::Layer layer)
set layer
Definition: PFCluster.cc:49
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:154
math::XYZPoint position_
cluster centroid position
Definition: CaloCluster.h:228
static const char layer_[]
CaloID caloID_
bitmask for detector information
Definition: CaloCluster.h:231
static std::vector< std::string > checklist log
void addHitAndFraction(DetId id, float fraction)
Definition: CaloCluster.h:203
double energy_
cluster energy
Definition: CaloCluster.h:223
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
PFLayer::Layer layer_
transient layer
Definition: PFCluster.h:153
Fraction of a PFRecHit (rechits can be shared between several PFCluster&#39;s)
PFCluster & operator=(const PFCluster &)
Definition: PFCluster.cc:63
double fraction() const
tuple particleFlow
Definition: pfLinker_cff.py:5
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< reco::PFRecHitFraction > rechits_
vector of rechit fractions (transient)
Definition: PFCluster.h:143
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:66
const CaloID & caloID() const
Definition: CaloCluster.h:201
static const constexpr double depthCorAp_
Definition: PFCluster.h:158
const REPPoint & positionREP() const
cluster position: rho, eta, phi
Definition: PFCluster.h:92
layer definition for PFRecHit and PFCluster
Definition: PFLayer.h:20
void reset()
resets clusters parameters
Definition: PFCluster.cc:17
double energy() const
cluster energy
Definition: PFCluster.h:74
std::vector< std::pair< DetId, float > > hitsAndFractions_
Definition: CaloCluster.h:234
void resetHitsAndFractions()
reset only hits and fractions
Definition: PFCluster.cc:28
std::string printHitAndFraction(unsigned i) const
print hitAndFraction
Definition: CaloCluster.cc:15
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:157
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:156
REPPoint posrep_
cluster position: rho, eta, phi (transient)
Definition: PFCluster.h:146
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
const std::vector< reco::PFRecHitFraction > & recHitFractions() const
vector of rechit fractions
Definition: PFCluster.h:65
static const constexpr double depthCorBp_
Definition: PFCluster.h:159
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
Definition: PFCluster.cc:33
float time_
Michalis: add timing and depth information.
Definition: PFCluster.h:149
static Layer fromCaloID(const reco::CaloID &id)
Definition: PFLayer.cc:38
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< double > > REPPoint
Definition: PFCluster.h:48
const PFRecHitRef & recHitRef() const
void reset()
resets the CaloCluster (position, energy, hitsAndFractions)
Definition: CaloCluster.cc:9