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  depth_(0.),
32  layer_(layer),
33  color_(2)
34 { }
35 
36 
38 
39  energy_ = 0;
40  position_ *= 0;
41  posrep_ *= 0;
42  time_=-99.;
44  rechits_.clear();
45 
47 
48 }
49 
51 
52  rechits_.clear();
53  hitsAndFractions_.clear();
54 
55 }
56 
58 
59  rechits_.push_back( frac );
60 
61  addHitAndFraction( frac.recHitRef()->detId(),
62  frac.fraction() );
63 }
64 
65 
66 double PFCluster::getDepthCorrection(double energy, bool isBelowPS,
67  bool isHadron)
68 {
69  double corrA = depthCorA_;
70  double corrB = depthCorB_;
71  if (isBelowPS) {
72  corrA = depthCorAp_;
73  corrB = depthCorBp_;
74  }
75  return isHadron ? corrA : corrA*(corrB + log(energy));
76 }
77 
79  // cout<<"calling PFCluster::setLayer "<<layer<<endl;
80  layer_ = layer;
81  caloID_ = PFLayer::toCaloID( layer );
82  // cout<<"done "<<caloID_<<endl;
83 }
84 
85 
87 
88  // cout<<"calling PFCluster::layer "<<caloID()<<" "<<PFLayer::fromCaloID( caloID() )<<endl;
89  if( layer_ != PFLayer::NONE ) return layer_;
90  return PFLayer::fromCaloID( caloID() );
91 }
92 
93 
95 
96  CaloCluster::operator=(other);
97  rechits_ = other.rechits_;
98  energy_ = other.energy_;
99  position_ = other.position_;
100  posrep_ = other.posrep_;
101  color_ = other.color_;
102 
103  return *this;
104 }
105 
106 
107 std::ostream& reco::operator<<(std::ostream& out,
108  const PFCluster& cluster) {
109 
110  if(!out) return out;
111 
112  const math::XYZPoint& pos = cluster.position();
113  const PFCluster::REPPoint& posrep = cluster.positionREP();
114  const std::vector< reco::PFRecHitFraction >& fracs =
115  cluster.recHitFractions();
116 
117  out<<"PFcluster "
118  <<", layer: "<<cluster.layer()
119  <<"\tE = "<<cluster.energy()
120  <<"\tXYZ: "
121  <<pos.X()<<","<<pos.Y()<<","<<pos.Z()<<" | "
122  <<"\tREP: "
123  <<posrep.Rho()<<","<<posrep.Eta()<<","<<posrep.Phi()<<" | "
124  <<fracs.size()<<" rechits";
125 
126  for(unsigned i=0; i<fracs.size(); i++) {
127  // PFRecHit is not available, print the detID
128  if( !fracs[i].recHitRef().isAvailable() )
129  out<<cluster.printHitAndFraction(i)<<", ";
130  else
131  out<<fracs[i]<<", ";
132  }
133 
134  return out;
135 }
PFLayer::Layer layer() const
cluster layer, see PFLayer.h in this directory
Definition: PFCluster.cc:86
void setLayer(PFLayer::Layer layer)
set layer
Definition: PFCluster.cc:78
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:126
int i
Definition: DBlmapReader.cc:9
math::XYZPoint position_
cluster centroid position
Definition: CaloCluster.h:212
static const char layer_[]
CaloID caloID_
bitmask for detector information
Definition: CaloCluster.h:215
void addHitAndFraction(DetId id, float fraction)
Definition: CaloCluster.h:185
double energy_
cluster energy
Definition: CaloCluster.h:207
static std::atomic< double > depthCorAp_
Definition: PFCluster.h:196
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:173
PFLayer::Layer layer_
transient layer
Definition: PFCluster.h:183
Fraction of a PFRecHit (rechits can be shared between several PFCluster&#39;s)
PFCluster & operator=(const PFCluster &)
Definition: PFCluster.cc:94
std::vector< std::pair< DetId, float > > hitsAndFractions_
Definition: CaloCluster.h:218
static std::atomic< double > depthCorB_
Definition: PFCluster.h:193
double fraction() const
tuple particleFlow
Definition: pfLinker_cff.py:5
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:71
const CaloID & caloID() const
Definition: CaloCluster.h:183
const REPPoint & positionREP() const
cluster position: rho, eta, phi
Definition: PFCluster.h:93
layer definition for PFRecHit and PFCluster
Definition: PFLayer.h:21
double time_
Michalis :Add timing and depth information.
Definition: PFCluster.h:179
void reset()
resets clusters parameters
Definition: PFCluster.cc:37
double energy() const
cluster energy
Definition: PFCluster.h:82
void resetHitsAndFractions()
reset only hits and fractions
Definition: PFCluster.cc:50
std::string printHitAndFraction(unsigned i) const
print hitAndFraction
Definition: CaloCluster.cc:17
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:66
REPPoint posrep_
cluster position: rho, eta, phi (transient)
Definition: PFCluster.h:176
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:57
static std::atomic< double > depthCorBp_
Definition: PFCluster.h:199
int color_
color (transient)
Definition: PFCluster.h:220
static std::atomic< double > depthCorA_
Definition: PFCluster.h:190
static Layer fromCaloID(const reco::CaloID &id)
Definition: PFLayer.cc:29
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< double > > REPPoint
Definition: PFCluster.h:54
const std::vector< reco::PFRecHitFraction > & recHitFractions() const
vector of rechit fractions
Definition: PFCluster.h:72
const PFRecHitRef & recHitRef() const
copy
void reset()
resets the CaloCluster (position, energy, hitsAndFractions)
Definition: CaloCluster.cc:11