CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFCluster.h
Go to the documentation of this file.
1 #ifndef DataFormats_ParticleFlowReco_PFCluster_h
2 #define DataFormats_ParticleFlowReco_PFCluster_h
3 
6 
7 #include "Math/GenVector/PositionVector3D.h"
9 #include "Rtypes.h"
10 
14 
15 #include <iostream>
16 #include <vector>
17 #include <algorithm>
18 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
19 #include <atomic>
20 #endif
21 
22 
23 class PFClusterAlgo;
24 
25 namespace reco {
26 
47  class PFCluster : public CaloCluster {
48  public:
49 
50  typedef std::vector<std::pair<CaloClusterPtr::key_type,edm::Ptr<PFCluster> > > EEtoPSAssociation;
51  typedef ROOT::Math::PositionVector3D<ROOT::Math::CylindricalEta3D<Double32_t> > REPPoint;
52 
54 
57  double x, double y, double z );
58 
60  void reset();
61 
63  void resetHitsAndFractions();
64 
67 
69  const std::vector< reco::PFRecHitFraction >& recHitFractions() const
70  { return rechits_; }
71 
74 
76  PFLayer::Layer layer() const;
77 
79  double energy() const {return energy_;}
80 
82  double time() const {return time_;}
84  double depth() const {return depth_;}
85 
86  void setTime(double time) {time_ = time;}
87  void setDepth(double depth) {depth_ = depth;}
88 
90  const REPPoint& positionREP() const {return posrep_;}
91 
94  posrep_.SetCoordinates( position_.Rho(),
95  position_.Eta(),
96  position_.Phi() );
97  }
98 
100  static double getDepthCorrection(double energy, bool isBelowPS = false,
101  bool isHadron = false);
102 
104  void setColor(int color) {color_ = color;}
105 
107  int color() const {return color_;}
108 
109 
110  PFCluster& operator=(const PFCluster&);
111 
112  friend std::ostream& operator<<(std::ostream& out,
113  const PFCluster& cluster);
114 
116  static void setDepthCorParameters(int mode,
117  double a, double b,
118  double ap, double bp ) {
120  depthCorA_ = a;
121  depthCorB_ = b;
122  depthCorAp_ = ap;
123  depthCorBp_ = bp;
124  }
125 
126 
130 
132  double charge() const { return 0;}
133 
135  double pt() const {
136  return (energy() * sin(position_.theta()));
137  }
138 
140  double theta() const {
141  return position_.theta();
142  }
143 
145  math::XYZPoint const & vertex() const {
146  return dummyVtx_;
147  }
148  double vx() const { return vertex().x(); }
149  double vy() const { return vertex().y(); }
150  double vz() const { return vertex().z(); }
151 
152 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
153  template<typename pruner>
154  void pruneUsing(pruner prune) {
155  hitsAndFractions_.clear();
156  std::vector<reco::PFRecHitFraction>::iterator iter =
157  std::stable_partition(rechits_.begin(),rechits_.end(),prune);
158  rechits_.erase(iter,rechits_.end());
159  hitsAndFractions_.reserve(rechits_.size());
160  for( const auto& hitfrac : rechits_ ) {
161  hitsAndFractions_.emplace_back(hitfrac.recHitRef()->detId(),
162  hitfrac.fraction());
163  }
164  }
165 #endif
166 
167  private:
168 
170  std::vector< reco::PFRecHitFraction > rechits_;
171 
174 
176  double time_;
177  double depth_;
178 
181 
182 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
183  static std::atomic<int> depthCorMode_;
185 
187  static std::atomic<double> depthCorA_;
188 
190  static std::atomic<double> depthCorB_ ;
191 
193  static std::atomic<double> depthCorAp_;
194 
196  static std::atomic<double> depthCorBp_;
197 #else
198  static int depthCorMode_;
200 
202  static double depthCorA_;
203 
205  static double depthCorB_ ;
206 
208  static double depthCorAp_;
209 
211  static double depthCorBp_;
212 #endif
213 
214  static const math::XYZPoint dummyVtx_;
215 
217  int color_;
218  };
219 }
220 
221 #endif
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
math::XYZPoint position_
cluster centroid position
Definition: CaloCluster.h:212
double energy_
cluster energy
Definition: CaloCluster.h:207
static std::atomic< double > depthCorAp_
Definition: PFCluster.h:193
void setColor(int color)
set cluster color (for the PFRootEventManager display)
Definition: PFCluster.h:104
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:47
static void setDepthCorParameters(int mode, double a, double b, double ap, double bp)
Definition: PFCluster.h:116
std::vector< reco::PFRecHitFraction > rechits_
vector of rechit fractions (transient)
Definition: PFCluster.h:170
PFLayer::Layer layer_
transient layer
Definition: PFCluster.h:180
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< Double32_t > > REPPoint
Definition: PFCluster.h:51
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
void pruneUsing(pruner prune)
Definition: PFCluster.h:154
Fraction of a PFRecHit (rechits can be shared between several PFCluster&#39;s)
double pt() const
transverse momentum, massless approximation
Definition: PFCluster.h:135
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:190
double z() const
z coordinate of cluster centroid
Definition: CaloCluster.h:160
double vx() const
Definition: PFCluster.h:148
void setTime(double time)
Definition: PFCluster.h:86
void calculatePositionREP()
computes posrep_ once and for all
Definition: PFCluster.h:93
const REPPoint & positionREP() const
cluster position: rho, eta, phi
Definition: PFCluster.h:90
std::vector< std::pair< CaloClusterPtr::key_type, edm::Ptr< PFCluster > > > EEtoPSAssociation
Definition: PFCluster.h:50
static const math::XYZPoint dummyVtx_
Definition: PFCluster.h:214
layer definition for PFRecHit and PFCluster
Definition: PFLayer.h:21
double x() const
x coordinate of cluster centroid
Definition: CaloCluster.h:154
double vy() const
Definition: PFCluster.h:149
double time_
Michalis :Add timing and depth information.
Definition: PFCluster.h:176
void reset()
resets clusters parameters
Definition: PFCluster.cc:37
double energy() const
cluster energy
Definition: PFCluster.h:79
void resetHitsAndFractions()
reset only hits and fractions
Definition: PFCluster.cc:50
tuple out
Definition: dbtoconf.py:99
Layer
layer definition
Definition: PFLayer.h:31
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:173
double vz() const
Definition: PFCluster.h:150
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
static std::atomic< int > depthCorMode_
Definition: PFCluster.h:184
double b
Definition: hdecay.h:120
double theta() const
angle
Definition: PFCluster.h:140
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
Definition: PFCluster.cc:57
double time() const
cluster time
Definition: PFCluster.h:82
int color() const
Definition: PFCluster.h:107
static std::atomic< double > depthCorBp_
Definition: PFCluster.h:196
double a
Definition: hdecay.h:121
math::XYZPoint const & vertex() const
dummy vertex access
Definition: PFCluster.h:145
int color_
color (transient)
Definition: PFCluster.h:217
void setDepth(double depth)
Definition: PFCluster.h:87
friend std::ostream & operator<<(std::ostream &out, const PFCluster &cluster)
static std::atomic< double > depthCorA_
Definition: PFCluster.h:187
double charge() const
dummy charge
Definition: PFCluster.h:132
const std::vector< reco::PFRecHitFraction > & recHitFractions() const
vector of rechit fractions
Definition: PFCluster.h:69
double y() const
y coordinate of cluster centroid
Definition: CaloCluster.h:157
double depth() const
cluster depth
Definition: PFCluster.h:84