CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFCluster.cc
Go to the documentation of this file.
3 
4 using namespace std;
5 using namespace reco;
6 
7 
8 int PFCluster::depthCorMode_ = 0;
9 double PFCluster::depthCorA_ = 0.89;
10 double PFCluster::depthCorB_ = 7.3;
11 double PFCluster::depthCorAp_ = 0.89;
12 double PFCluster::depthCorBp_ = 4.0;
13 
14 unsigned PFCluster::instanceCounter_ = 0;
15 
16 PFCluster::PFCluster(PFLayer::Layer layer, double energy,
17  double x, double y, double z ) :
18  CaloCluster( energy,
19  math::XYZPoint(x,y,z),
20  PFLayer::toCaloID(layer),
22  posrep_( position_.Rho(), position_.Eta(), position_.Phi() ),
23  color_(2)
24 { }
25 
26 
28 
29  energy_ = 0;
30  position_ *= 0;
31  posrep_ *= 0;
32 
33  rechits_.clear();
34 
36 
37 }
38 
39 
41 
42  rechits_.push_back( frac );
43 
44  addHitAndFraction( frac.recHitRef()->detId(),
45  frac.fraction() );
46 }
47 
48 
49 double PFCluster::getDepthCorrection(double energy, bool isBelowPS,
50  bool isHadron)
51 {
52  double corrA = depthCorA_;
53  double corrB = depthCorB_;
54  if (isBelowPS) {
55  corrA = depthCorAp_;
56  corrB = depthCorBp_;
57  }
58  double depth = 0;
59  switch(isHadron) {
60  case 0: // e/gamma
61  depth = corrA*(corrB + log(energy));
62  break;
63  case 1: // hadrons
64  depth = corrA;
65  break;
66  default:
67  assert(0);
68  // edm::LogError("PFCluster") << "unknown function for depth correction!"
69  // << std::endl;
70  }
71  return depth;
72 }
73 
75  // cout<<"calling PFCluster::setLayer "<<layer<<endl;
76  caloID_ = PFLayer::toCaloID( layer );
77  // cout<<"done "<<caloID_<<endl;
78 }
79 
80 
82 
83  // cout<<"calling PFCluster::layer "<<caloID()<<" "<<PFLayer::fromCaloID( caloID() )<<endl;
84  return PFLayer::fromCaloID( caloID() );
85 }
86 
87 
89 
90  CaloCluster::operator=(other);
91  rechits_ = other.rechits_;
92  energy_ = other.energy_;
93  position_ = other.position_;
94  posrep_ = other.posrep_;
95  color_ = other.color_;
96 
97  return *this;
98 }
99 
100 
101 std::ostream& reco::operator<<(std::ostream& out,
102  const PFCluster& cluster) {
103 
104  if(!out) return out;
105 
106  const math::XYZPoint& pos = cluster.position();
107  const PFCluster::REPPoint& posrep = cluster.positionREP();
108  const std::vector< reco::PFRecHitFraction >& fracs =
109  cluster.recHitFractions();
110 
111  out<<"PFcluster "
112  <<", layer: "<<cluster.layer()
113  <<"\tE = "<<cluster.energy()
114  <<"\tXYZ: "
115  <<pos.X()<<","<<pos.Y()<<","<<pos.Z()<<" | "
116  <<"\tREP: "
117  <<posrep.Rho()<<","<<posrep.Eta()<<","<<posrep.Phi()<<" | "
118  <<fracs.size()<<" rechits";
119 
120  for(unsigned i=0; i<fracs.size(); i++) {
121  // PFRecHit is not available, print the detID
122  if( !fracs[i].recHitRef().isAvailable() )
123  out<<cluster.printHitAndFraction(i)<<", ";
124  else
125  out<<fracs[i]<<", ";
126  }
127 
128  return out;
129 }
PFLayer::Layer layer() const
cluster layer, see PFLayer.h in this directory
Definition: PFCluster.cc:81
void setLayer(PFLayer::Layer layer)
set layer
Definition: PFCluster.cc:74
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:123
int i
Definition: DBlmapReader.cc:9
math::XYZPoint position_
cluster centroid position
Definition: CaloCluster.h:207
CaloID caloID_
bitmask for detector information
Definition: CaloCluster.h:210
void addHitAndFraction(DetId id, float fraction)
Definition: CaloCluster.h:182
double energy_
cluster energy
Definition: CaloCluster.h:204
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
std::vector< reco::PFRecHitFraction > rechits_
vector of rechit fractions (transient)
Definition: PFCluster.h:144
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< Double32_t > > REPPoint
Definition: PFCluster.h:46
Fraction of a PFRecHit (rechits can be shared between several PFCluster&#39;s)
PFCluster & operator=(const PFCluster &)
Definition: PFCluster.cc:88
double fraction() const
tuple particleFlow
Definition: pfLinker_cff.py:5
float float float z
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:72
const CaloID & caloID() const
Definition: CaloCluster.h:180
static double depthCorAp_
Definition: PFCluster.h:160
const REPPoint & positionREP() const
cluster position: rho, eta, phi
Definition: PFCluster.h:76
layer definition for PFRecHit and PFCluster
Definition: PFLayer.h:21
static double depthCorB_
Definition: PFCluster.h:157
void reset()
resets clusters parameters
Definition: PFCluster.cc:27
static double depthCorBp_
Definition: PFCluster.h:163
double energy() const
cluster energy
Definition: PFCluster.h:73
std::string printHitAndFraction(unsigned i) const
print hitAndFraction
Definition: CaloCluster.cc:17
tuple out
Definition: dbtoconf.py:99
Layer
layer definition
Definition: PFLayer.h:31
static reco::CaloID toCaloID(Layer layer)
Definition: PFLayer.cc:11
static double getDepthCorrection(double energy, bool isBelowPS=false, bool isHadron=false)
Definition: PFCluster.cc:49
REPPoint posrep_
cluster position: rho, eta, phi (transient)
Definition: PFCluster.h:147
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
Definition: PFCluster.cc:40
int color_
color (transient)
Definition: PFCluster.h:167
static Layer fromCaloID(const reco::CaloID &id)
Definition: PFLayer.cc:28
const std::vector< reco::PFRecHitFraction > & recHitFractions() const
vector of rechit fractions
Definition: PFCluster.h:63
static double depthCorA_
Definition: PFCluster.h:154
const PFRecHitRef & recHitRef() const
copy
Definition: DDAxes.h:10
void reset()
resets the CaloCluster (position, energy, hitsAndFractions)
Definition: CaloCluster.cc:11