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_;}
83 
84  void setTime(double time) {time_ = time;}
85 
87  const REPPoint& positionREP() const {return posrep_;}
88 
91  posrep_.SetCoordinates( position_.Rho(),
92  position_.Eta(),
93  position_.Phi() );
94  }
95 
97  static double getDepthCorrection(double energy, bool isBelowPS = false,
98  bool isHadron = false);
99 
101  void setColor(int color) {color_ = color;}
102 
104  int color() const {return color_;}
105 
106 
107  PFCluster& operator=(const PFCluster&);
108 
109  friend std::ostream& operator<<(std::ostream& out,
110  const PFCluster& cluster);
111 
113  static void setDepthCorParameters(int mode,
114  double a, double b,
115  double ap, double bp ) {
117  depthCorA_ = a;
118  depthCorB_ = b;
119  depthCorAp_ = ap;
120  depthCorBp_ = bp;
121  }
122 
123 
127 
129  double charge() const { return 0;}
130 
132  double pt() const {
133  return (energy() * sin(position_.theta()));
134  }
135 
137  double theta() const {
138  return position_.theta();
139  }
140 
142  math::XYZPoint const & vertex() const {
143  return dummyVtx_;
144  }
145  double vx() const { return vertex().x(); }
146  double vy() const { return vertex().y(); }
147  double vz() const { return vertex().z(); }
148 
149 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
150  template<typename pruner>
151  void pruneUsing(pruner prune) {
152  hitsAndFractions_.clear();
153  std::vector<reco::PFRecHitFraction>::iterator iter =
154  std::stable_partition(rechits_.begin(),rechits_.end(),prune);
155  rechits_.erase(iter,rechits_.end());
156  hitsAndFractions_.reserve(rechits_.size());
157  for( const auto& hitfrac : rechits_ ) {
158  hitsAndFractions_.emplace_back(hitfrac.recHitRef()->detId(),
159  hitfrac.fraction());
160  }
161  }
162 #endif
163 
164  private:
165 
167  std::vector< reco::PFRecHitFraction > rechits_;
168 
171 
173  double time_;
174 
177 
178 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
179  static std::atomic<int> depthCorMode_;
181 
183  static std::atomic<double> depthCorA_;
184 
186  static std::atomic<double> depthCorB_ ;
187 
189  static std::atomic<double> depthCorAp_;
190 
192  static std::atomic<double> depthCorBp_;
193 #else
194  static int depthCorMode_;
196 
198  static double depthCorA_;
199 
201  static double depthCorB_ ;
202 
204  static double depthCorAp_;
205 
207  static double depthCorBp_;
208 #endif
209 
210  static const math::XYZPoint dummyVtx_;
211 
213  int color_;
214  };
215 }
216 
217 #endif
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
math::XYZPoint position_
cluster centroid position
Definition: CaloCluster.h:209
double energy_
cluster energy
Definition: CaloCluster.h:205
static std::atomic< double > depthCorAp_
Definition: PFCluster.h:189
void setColor(int color)
set cluster color (for the PFRootEventManager display)
Definition: PFCluster.h:101
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:113
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
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
void pruneUsing(pruner prune)
Definition: PFCluster.h:151
Fraction of a PFRecHit (rechits can be shared between several PFCluster&#39;s)
double pt() const
transverse momentum, massless approximation
Definition: PFCluster.h:132
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 z() const
z coordinate of cluster centroid
Definition: CaloCluster.h:158
double vx() const
Definition: PFCluster.h:145
void setTime(double time)
Definition: PFCluster.h:84
void calculatePositionREP()
computes posrep_ once and for all
Definition: PFCluster.h:90
const REPPoint & positionREP() const
cluster position: rho, eta, phi
Definition: PFCluster.h:87
std::vector< std::pair< CaloClusterPtr::key_type, edm::Ptr< PFCluster > > > EEtoPSAssociation
Definition: PFCluster.h:50
static const math::XYZPoint dummyVtx_
Definition: PFCluster.h:210
layer definition for PFRecHit and PFCluster
Definition: PFLayer.h:21
double x() const
x coordinate of cluster centroid
Definition: CaloCluster.h:152
double vy() const
Definition: PFCluster.h:146
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
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:65
REPPoint posrep_
cluster position: rho, eta, phi (transient)
Definition: PFCluster.h:170
double vz() const
Definition: PFCluster.h:147
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
static std::atomic< int > depthCorMode_
Definition: PFCluster.h:180
double b
Definition: hdecay.h:120
double theta() const
angle
Definition: PFCluster.h:137
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
Definition: PFCluster.cc:56
double time() const
cluster time
Definition: PFCluster.h:82
int color() const
Definition: PFCluster.h:104
static std::atomic< double > depthCorBp_
Definition: PFCluster.h:192
double a
Definition: hdecay.h:121
math::XYZPoint const & vertex() const
dummy vertex access
Definition: PFCluster.h:142
int color_
color (transient)
Definition: PFCluster.h:213
friend std::ostream & operator<<(std::ostream &out, const PFCluster &cluster)
static std::atomic< double > depthCorA_
Definition: PFCluster.h:183
double charge() const
dummy charge
Definition: PFCluster.h:129
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:155