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  // Next typedef uses double in ROOT 6 rather than Double32_t due to a bug in ROOT 5,
52  // which otherwise would make ROOT5 files unreadable in ROOT6. This does not increase
53  // the size on disk, because due to the bug, double was actually stored on disk in ROOT 5.
54  typedef ROOT::Math::PositionVector3D<ROOT::Math::CylindricalEta3D<double> > REPPoint;
55 
57 
60  double x, double y, double z );
61 
63  void reset();
64 
66  void resetHitsAndFractions();
67 
70 
72  const std::vector< reco::PFRecHitFraction >& recHitFractions() const
73  { return rechits_; }
74 
77 
79  PFLayer::Layer layer() const;
80 
82  double energy() const {return energy_;}
83 
85  double time() const {return time_;}
87  double depth() const {return depth_;}
88 
89  void setTime(double time) {time_ = time;}
90  void setDepth(double depth) {depth_ = depth;}
91 
93  const REPPoint& positionREP() const {return posrep_;}
94 
97  posrep_.SetCoordinates( position_.Rho(),
98  position_.Eta(),
99  position_.Phi() );
100  }
101 
103  static double getDepthCorrection(double energy, bool isBelowPS = false,
104  bool isHadron = false);
105 
107  void setColor(int color) {color_ = color;}
108 
110  int color() const {return color_;}
111 
112 
113  PFCluster& operator=(const PFCluster&);
114 
115  friend std::ostream& operator<<(std::ostream& out,
116  const PFCluster& cluster);
117 
119  static void setDepthCorParameters(int mode,
120  double a, double b,
121  double ap, double bp ) {
123  depthCorA_ = a;
124  depthCorB_ = b;
125  depthCorAp_ = ap;
126  depthCorBp_ = bp;
127  }
128 
129 
133 
135  double charge() const { return 0;}
136 
138  double pt() const {
139  return (energy() * sin(position_.theta()));
140  }
141 
143  double theta() const {
144  return position_.theta();
145  }
146 
148  math::XYZPoint const & vertex() const {
149  return dummyVtx_;
150  }
151  double vx() const { return vertex().x(); }
152  double vy() const { return vertex().y(); }
153  double vz() const { return vertex().z(); }
154 
155 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
156  template<typename pruner>
157  void pruneUsing(pruner prune) {
158  hitsAndFractions_.clear();
159  std::vector<reco::PFRecHitFraction>::iterator iter =
160  std::stable_partition(rechits_.begin(),rechits_.end(),prune);
161  rechits_.erase(iter,rechits_.end());
162  hitsAndFractions_.reserve(rechits_.size());
163  for( const auto& hitfrac : rechits_ ) {
164  hitsAndFractions_.emplace_back(hitfrac.recHitRef()->detId(),
165  hitfrac.fraction());
166  }
167  }
168 #endif
169 
170  private:
171 
173  std::vector< reco::PFRecHitFraction > rechits_;
174 
177 
179  double time_;
180  double depth_;
181 
184 
185 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
186  static std::atomic<int> depthCorMode_;
188 
190  static std::atomic<double> depthCorA_;
191 
193  static std::atomic<double> depthCorB_ ;
194 
196  static std::atomic<double> depthCorAp_;
197 
199  static std::atomic<double> depthCorBp_;
200 #else
201  static int depthCorMode_;
203 
205  static double depthCorA_;
206 
208  static double depthCorB_ ;
209 
211  static double depthCorAp_;
212 
214  static double depthCorBp_;
215 #endif
216 
217  static const math::XYZPoint dummyVtx_;
218 
220  int color_;
221  };
222 }
223 
224 #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:196
void setColor(int color)
set cluster color (for the PFRootEventManager display)
Definition: PFCluster.h:107
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:119
std::vector< reco::PFRecHitFraction > rechits_
vector of rechit fractions (transient)
Definition: PFCluster.h:173
PFLayer::Layer layer_
transient layer
Definition: PFCluster.h:183
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
void pruneUsing(pruner prune)
Definition: PFCluster.h:157
Fraction of a PFRecHit (rechits can be shared between several PFCluster&#39;s)
double pt() const
transverse momentum, massless approximation
Definition: PFCluster.h:138
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 z() const
z coordinate of cluster centroid
Definition: CaloCluster.h:160
double vx() const
Definition: PFCluster.h:151
void setTime(double time)
Definition: PFCluster.h:89
void calculatePositionREP()
computes posrep_ once and for all
Definition: PFCluster.h:96
const REPPoint & positionREP() const
cluster position: rho, eta, phi
Definition: PFCluster.h:93
std::vector< std::pair< CaloClusterPtr::key_type, edm::Ptr< PFCluster > > > EEtoPSAssociation
Definition: PFCluster.h:50
static const math::XYZPoint dummyVtx_
Definition: PFCluster.h:217
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:152
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
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:176
double vz() const
Definition: PFCluster.h:153
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
static std::atomic< int > depthCorMode_
Definition: PFCluster.h:187
double b
Definition: hdecay.h:120
double theta() const
angle
Definition: PFCluster.h:143
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:85
int color() const
Definition: PFCluster.h:110
static std::atomic< double > depthCorBp_
Definition: PFCluster.h:199
double a
Definition: hdecay.h:121
math::XYZPoint const & vertex() const
dummy vertex access
Definition: PFCluster.h:148
int color_
color (transient)
Definition: PFCluster.h:220
void setDepth(double depth)
Definition: PFCluster.h:90
friend std::ostream & operator<<(std::ostream &out, const PFCluster &cluster)
static std::atomic< double > depthCorA_
Definition: PFCluster.h:190
double charge() const
dummy charge
Definition: PFCluster.h:135
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
double y() const
y coordinate of cluster centroid
Definition: CaloCluster.h:157
double depth() const
cluster depth
Definition: PFCluster.h:87