test
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  // remove_if+erase algo applied to both vectors...
159  auto iter = std::find_if_not(rechits_.begin(),rechits_.end(),prune);
160  if (iter==rechits_.end()) return;
161  auto first = iter-rechits_.begin();
162  for (auto i=first; ++i<int(rechits_.size());) {
163  if (prune(rechits_[i])) {
166  ++first;
167  }
168  }
169  rechits_.erase(rechits_.begin()+first,rechits_.end());
171  }
172 #endif
173 
174  private:
175 
177  std::vector< reco::PFRecHitFraction > rechits_;
178 
181 
183  double time_;
184  double depth_;
185 
188 
189 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
190  static std::atomic<int> depthCorMode_;
192 
194  static std::atomic<double> depthCorA_;
195 
197  static std::atomic<double> depthCorB_ ;
198 
200  static std::atomic<double> depthCorAp_;
201 
203  static std::atomic<double> depthCorBp_;
204 #else
205  static int depthCorMode_;
207 
209  static double depthCorA_;
210 
212  static double depthCorB_ ;
213 
215  static double depthCorAp_;
216 
218  static double depthCorBp_;
219 #endif
220 
221  static const math::XYZPoint dummyVtx_;
222 
224  int color_;
225  };
226 }
227 
228 #endif
PFLayer::Layer layer() const
cluster layer, see PFLayer.h in this directory
Definition: PFCluster.cc:128
void setLayer(PFLayer::Layer layer)
set layer
Definition: PFCluster.cc:120
int i
Definition: DBlmapReader.cc:9
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:200
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:177
PFLayer::Layer layer_
transient layer
Definition: PFCluster.h:187
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:136
std::vector< std::pair< DetId, float > > hitsAndFractions_
Definition: CaloCluster.h:218
static std::atomic< double > depthCorB_
Definition: PFCluster.h:197
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
def move
Definition: eostools.py:510
std::vector< std::pair< CaloClusterPtr::key_type, edm::Ptr< PFCluster > > > EEtoPSAssociation
Definition: PFCluster.h:50
static const math::XYZPoint dummyVtx_
Definition: PFCluster.h:221
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:183
void reset()
resets clusters parameters
Definition: PFCluster.cc:79
double energy() const
cluster energy
Definition: PFCluster.h:82
void resetHitsAndFractions()
reset only hits and fractions
Definition: PFCluster.cc:92
Layer
layer definition
Definition: PFLayer.h:31
static double getDepthCorrection(double energy, bool isBelowPS=false, bool isHadron=false)
Definition: PFCluster.cc:108
REPPoint posrep_
cluster position: rho, eta, phi (transient)
Definition: PFCluster.h:180
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:191
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:99
double time() const
cluster time
Definition: PFCluster.h:85
int color() const
Definition: PFCluster.h:110
static std::atomic< double > depthCorBp_
Definition: PFCluster.h:203
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:224
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:194
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