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.
2 
3 using namespace std;
4 using namespace reco;
5 
6 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
7 std::atomic<int> PFCluster::depthCorMode_{0};
8 std::atomic<double> PFCluster::depthCorA_{0.89};
9 std::atomic<double> PFCluster::depthCorB_{7.3};
10 std::atomic<double> PFCluster::depthCorAp_{0.89};
11 std::atomic<double> PFCluster::depthCorBp_{4.0};
12 #else
13 int PFCluster::depthCorMode_ = 0;
14 double PFCluster::depthCorA_ = 0.89;
15 double PFCluster::depthCorB_ = 7.3;
16 double PFCluster::depthCorAp_ = 0.89;
17 double PFCluster::depthCorBp_ = 4.0;
18 #endif
19 
20 
21 const math::XYZPoint PFCluster::dummyVtx_(0,0,0);
22 
23 PFCluster::PFCluster(PFLayer::Layer layer, double energy,
24  double x, double y, double z ) :
25  CaloCluster( energy,
26  math::XYZPoint(x,y,z),
27  PFLayer::toCaloID(layer),
29  posrep_( position_.Rho(), position_.Eta(), position_.Phi() ),
30  time_(-99.),
31  layer_(layer),
32  color_(2)
33 { }
34 
35 
37 
38  energy_ = 0;
39  position_ *= 0;
40  posrep_ *= 0;
41  time_=-99.;
43  rechits_.clear();
44 
46 
47 }
48 
50 
51  rechits_.clear();
52  hitsAndFractions_.clear();
53 
54 }
55 
57 
58  rechits_.push_back( frac );
59 
60  addHitAndFraction( frac.recHitRef()->detId(),
61  frac.fraction() );
62 }
63 
64 
65 double PFCluster::getDepthCorrection(double energy, bool isBelowPS,
66  bool isHadron)
67 {
68  double corrA = depthCorA_;
69  double corrB = depthCorB_;
70  if (isBelowPS) {
71  corrA = depthCorAp_;
72  corrB = depthCorBp_;
73  }
74  return isHadron ? corrA : corrA*(corrB + log(energy));
75 }
76 
78  // cout<<"calling PFCluster::setLayer "<<layer<<endl;
79  layer_ = layer;
80  caloID_ = PFLayer::toCaloID( layer );
81  // cout<<"done "<<caloID_<<endl;
82 }
83 
84 
86 
87  // cout<<"calling PFCluster::layer "<<caloID()<<" "<<PFLayer::fromCaloID( caloID() )<<endl;
88  if( layer_ != PFLayer::NONE ) return layer_;
89  return PFLayer::fromCaloID( caloID() );
90 }
91 
92 
94 
95  CaloCluster::operator=(other);
96  rechits_ = other.rechits_;
97  energy_ = other.energy_;
98  position_ = other.position_;
99  posrep_ = other.posrep_;
100  color_ = other.color_;
101 
102  return *this;
103 }
104 
105 
106 std::ostream& reco::operator<<(std::ostream& out,
107  const PFCluster& cluster) {
108 
109  if(!out) return out;
110 
111  const math::XYZPoint& pos = cluster.position();
112  const PFCluster::REPPoint& posrep = cluster.positionREP();
113  const std::vector< reco::PFRecHitFraction >& fracs =
114  cluster.recHitFractions();
115 
116  out<<"PFcluster "
117  <<", layer: "<<cluster.layer()
118  <<"\tE = "<<cluster.energy()
119  <<"\tXYZ: "
120  <<pos.X()<<","<<pos.Y()<<","<<pos.Z()<<" | "
121  <<"\tREP: "
122  <<posrep.Rho()<<","<<posrep.Eta()<<","<<posrep.Phi()<<" | "
123  <<fracs.size()<<" rechits";
124 
125  for(unsigned i=0; i<fracs.size(); i++) {
126  // PFRecHit is not available, print the detID
127  if( !fracs[i].recHitRef().isAvailable() )
128  out<<cluster.printHitAndFraction(i)<<", ";
129  else
130  out<<fracs[i]<<", ";
131  }
132 
133  return out;
134 }
PFLayer::Layer layer() const
cluster layer, see PFLayer.h in this directory
Definition: PFCluster.cc:85
void setLayer(PFLayer::Layer layer)
set layer
Definition: PFCluster.cc:77
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:124
int i
Definition: DBlmapReader.cc:9
math::XYZPoint position_
cluster centroid position
Definition: CaloCluster.h:209
static const char layer_[]
CaloID caloID_
bitmask for detector information
Definition: CaloCluster.h:212
void addHitAndFraction(DetId id, float fraction)
Definition: CaloCluster.h:183
double energy_
cluster energy
Definition: CaloCluster.h:205
static std::atomic< double > depthCorAp_
Definition: PFCluster.h:189
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:47
std::vector< reco::PFRecHitFraction > rechits_
vector of rechit fractions (transient)
Definition: PFCluster.h:167
PFLayer::Layer layer_
transient layer
Definition: PFCluster.h:176
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< Double32_t > > REPPoint
Definition: PFCluster.h:51
Fraction of a PFRecHit (rechits can be shared between several PFCluster&#39;s)
PFCluster & operator=(const PFCluster &)
Definition: PFCluster.cc:93
std::vector< std::pair< DetId, float > > hitsAndFractions_
Definition: CaloCluster.h:215
static std::atomic< double > depthCorB_
Definition: PFCluster.h:186
double fraction() const
tuple particleFlow
Definition: pfLinker_cff.py:5
float float float z
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:71
const CaloID & caloID() const
Definition: CaloCluster.h:181
const REPPoint & positionREP() const
cluster position: rho, eta, phi
Definition: PFCluster.h:87
layer definition for PFRecHit and PFCluster
Definition: PFLayer.h:21
double time_
Michalis :Add timing information.
Definition: PFCluster.h:173
void reset()
resets clusters parameters
Definition: PFCluster.cc:36
double energy() const
cluster energy
Definition: PFCluster.h:79
void resetHitsAndFractions()
reset only hits and fractions
Definition: PFCluster.cc:49
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:65
REPPoint posrep_
cluster position: rho, eta, phi (transient)
Definition: PFCluster.h:170
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
Definition: PFCluster.cc:56
static std::atomic< double > depthCorBp_
Definition: PFCluster.h:192
int color_
color (transient)
Definition: PFCluster.h:213
static std::atomic< double > depthCorA_
Definition: PFCluster.h:183
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:69
const PFRecHitRef & recHitRef() const
copy
Definition: DDAxes.h:10
void reset()
resets the CaloCluster (position, energy, hitsAndFractions)
Definition: CaloCluster.cc:11