CMS 3D CMS Logo

EgammaPCAHelper.h
Go to the documentation of this file.
1 //--------------------------------------------------------------------------------------------------
2 //
3 // EGammaPCAHelper
4 //
5 // Helper Class to compute PCA
6 //
7 //
8 //--------------------------------------------------------------------------------------------------
9 #ifndef RecoEgamma_EgammaTools_EGammaPCAHelper_h
10 #define RecoEgamma_EgammaTools_EGammaPCAHelper_h
11 
13 
19 
25 #include <map>
26 
27 #include "TPrincipal.h"
28 
29 class HGCalRecHit;
30 
31 namespace hgcal {
32 
34  {
35  public:
38 
41 
42  // for the GsfElectrons
43  void storeRecHits(const reco::CaloCluster & theCluster );
44  void storeRecHits(const reco::HGCalMultiCluster &cluster );
45 
46  const TPrincipal & pcaResult();
48  void setHitMap( std::map<DetId,const HGCRecHit *> * hitMap) ;
50  void fillHitMap(const HGCRecHitCollection & HGCEERecHits,
51  const HGCRecHitCollection & HGCFHRecHits,
52  const HGCRecHitCollection & HGCBHRecHits);
53 
54  std::map<DetId,const HGCRecHit *> * getHitMap(){return hitMap_;}
55 
56  void setRecHitTools(const hgcal::RecHitTools * recHitTools );
57 
58  inline void setdEdXWeights(const std::vector<double> & dEdX){ dEdXWeights_ = dEdX;}
59 
61  computePCA(-1.,false);
62  }
63 
64  void computePCA(float radius, bool withHalo=true);
65  const math::XYZPoint & barycenter() const {return barycenter_;}
66  const math::XYZVector & axis() const {return axis_;}
67 
68  void computeShowerWidth(float radius, bool withHalo=true);
69 
70  inline double sigmaUU() const { return checkIteration()? sigu_ : -1. ;}
71  inline double sigmaVV() const { return checkIteration()? sigv_ : -1. ;}
72  inline double sigmaEE() const { return checkIteration()? sige_ : -1. ;}
73  inline double sigmaPP() const { return checkIteration()? sigp_ : -1. ;}
74 
75  inline const TVectorD& eigenValues () const {return *pca_->GetEigenValues();}
76  inline const TVectorD& sigmas() const {return *pca_->GetSigmas();}
77  // contains maxlayer+1 values, first layer is [1]
78  LongDeps energyPerLayer(float radius, bool withHalo=true) ;
79 
80  float clusterDepthCompatibility(const LongDeps &, float & measuredDepth, float& expectedDepth, float& expectedSigma );
81  void printHits( float radius) const;
82  void clear();
83 
84  private:
85  bool checkIteration() const ;
86  void storeRecHits(const std::vector<std::pair<DetId, float>> &hf);
87  float findZFirstLayer(const LongDeps&) const;
88 
90  bool debug_;
91 
92  //parameters
93  std::vector<double> dEdXWeights_;
94  std::vector<double> invThicknessCorrection_;
95 
96  int hitMapOrigin_; // 0 not initialized; 1 set from outside ; 2 set from inside
98  std::map<DetId, const HGCRecHit *> * hitMap_;
99  std::vector<Spot> theSpots_;
101 
102  // output quantities
105 
106  Transform3D trans_;
108 
109  // helper
110  std::unique_ptr<TPrincipal> pca_;
113 
114  };
115 
116 }
117 
118 #endif
void computeShowerWidth(float radius, bool withHalo=true)
math::XYZPoint barycenter_
PositionVector3D< Cartesian3D< double >, DefaultCoordinateSystemTag > Point
Definition: Transform3DPJ.h:67
void computePCA(float radius, bool withHalo=true)
std::map< DetId, const HGCRecHit * > * hitMap_
LongDeps energyPerLayer(float radius, bool withHalo=true)
float findZFirstLayer(const LongDeps &) const
const math::XYZPoint & barycenter() const
std::unique_ptr< TPrincipal > pca_
ROOT::Math::Transform3DPJ Transform3D
const TVectorD & eigenValues() const
void setdEdXWeights(const std::vector< double > &dEdX)
const TVectorD & sigmas() const
void storeRecHits(const reco::CaloCluster &theCluster)
ROOT::Math::Transform3DPJ::Point Point
void setHitMap(std::map< DetId, const HGCRecHit * > *hitMap)
to set from outside - once per event
std::vector< Spot > theSpots_
std::map< DetId, const HGCRecHit * > * getHitMap()
double sigmaUU() const
double sigmaPP() const
void setRecHitTools(const hgcal::RecHitTools *recHitTools)
float clusterDepthCompatibility(const LongDeps &, float &measuredDepth, float &expectedDepth, float &expectedSigma)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
void printHits(float radius) const
double sigmaEE() const
double sigmaVV() const
std::vector< double > invThicknessCorrection_
void fillHitMap(const HGCRecHitCollection &HGCEERecHits, const HGCRecHitCollection &HGCFHRecHits, const HGCRecHitCollection &HGCBHRecHits)
to compute from inside - once per event
std::vector< double > dEdXWeights_
const reco::CaloCluster * theCluster_
const TPrincipal & pcaResult()
bool checkIteration() const
const math::XYZVector & axis() const
const hgcal::RecHitTools * recHitTools_