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 
24 #include "Math/Transform3D.h"
25 #include <unordered_map>
26 
27 #include "TPrincipal.h"
28 
29 class HGCalRecHit;
30 
31 namespace hgcal {
32 
34  public:
35  typedef ROOT::Math::Transform3D Transform3D;
37 
39 
40  // for the GsfElectrons
41  void storeRecHits(const reco::CaloCluster &theCluster);
42  void storeRecHits(const reco::HGCalMultiCluster &cluster);
43 
44  const TPrincipal &pcaResult();
46  void setHitMap(const std::unordered_map<DetId, const HGCRecHit *> *hitMap);
47  const std::unordered_map<DetId, const HGCRecHit *> *getHitMap() { return hitMap_; }
48 
49  void setRecHitTools(const hgcal::RecHitTools *recHitTools);
50 
51  inline void setdEdXWeights(const std::vector<double> &dEdX) { dEdXWeights_ = dEdX; }
52 
53  void pcaInitialComputation() { computePCA(-1., false); }
54 
55  void computePCA(float radius, bool withHalo = true);
56  const math::XYZPoint &barycenter() const { return barycenter_; }
57  const math::XYZVector &axis() const { return axis_; }
58 
59  void computeShowerWidth(float radius, bool withHalo = true);
60 
61  inline double sigmaUU() const { return checkIteration() ? sigu_ : -1.; }
62  inline double sigmaVV() const { return checkIteration() ? sigv_ : -1.; }
63  inline double sigmaEE() const { return checkIteration() ? sige_ : -1.; }
64  inline double sigmaPP() const { return checkIteration() ? sigp_ : -1.; }
65 
66  inline const TVectorD &eigenValues() const { return *pca_->GetEigenValues(); }
67  inline const TVectorD &sigmas() const { return *pca_->GetSigmas(); }
68  // contains maxlayer+1 values, first layer is [1]
69  LongDeps energyPerLayer(float radius, bool withHalo = true);
70 
71  float clusterDepthCompatibility(const LongDeps &, float &measuredDepth, float &expectedDepth, float &expectedSigma);
72  void printHits(float radius) const;
73  void clear();
74 
75  private:
76  bool checkIteration() const;
77  void storeRecHits(const std::vector<std::pair<DetId, float>> &hf);
78  float findZFirstLayer(const LongDeps &) const;
79 
81  bool debug_;
82 
83  //parameters
84  std::vector<double> dEdXWeights_;
85  std::vector<double> invThicknessCorrection_;
86 
88  const std::unordered_map<DetId, const HGCRecHit *> *hitMap_;
89  std::vector<Spot> theSpots_;
91  unsigned int maxlayer_;
92 
93  // output quantities
96 
98  double sigu_, sigv_, sige_, sigp_;
99 
100  // helper
101  std::unique_ptr<TPrincipal> pca_;
104  };
105 
106 } // namespace hgcal
107 
108 #endif
hgcal::EGammaPCAHelper::clusterDepthCompatibility
float clusterDepthCompatibility(const LongDeps &, float &measuredDepth, float &expectedDepth, float &expectedSigma)
Definition: EgammaPCAHelper.cc:307
hgcal::EGammaPCAHelper::barycenter_
math::XYZPoint barycenter_
Definition: EgammaPCAHelper.h:94
hgcal::RecHitTools
Definition: RecHitTools.h:23
hgcal::EGammaPCAHelper::sige_
double sige_
Definition: EgammaPCAHelper.h:98
hgcal::EGammaPCAHelper::sigmas
const TVectorD & sigmas() const
Definition: EgammaPCAHelper.h:67
hgcal::EGammaPCAHelper::recHitsStored_
bool recHitsStored_
Definition: EgammaPCAHelper.h:80
hgcal::EGammaPCAHelper::theCluster_
const reco::CaloCluster * theCluster_
Definition: EgammaPCAHelper.h:87
RecHitTools.h
hgcal::EGammaPCAHelper::printHits
void printHits(float radius) const
Definition: EgammaPCAHelper.cc:281
HGCalMultiCluster.h
hgcal::EGammaPCAHelper::sigmaEE
double sigmaEE() const
Definition: EgammaPCAHelper.h:63
hgcal::EGammaPCAHelper::setRecHitTools
void setRecHitTools(const hgcal::RecHitTools *recHitTools)
Definition: EgammaPCAHelper.cc:32
LongDeps.h
hgcal::EGammaPCAHelper::pcaInitialComputation
void pcaInitialComputation()
Definition: EgammaPCAHelper.h:53
hgcal::EGammaPCAHelper::axis_
math::XYZVector axis_
Definition: EgammaPCAHelper.h:95
hgcal::EGammaPCAHelper::dEdXWeights_
std::vector< double > dEdXWeights_
Definition: EgammaPCAHelper.h:84
hgcal::EGammaPCAHelper::pcaResult
const TPrincipal & pcaResult()
hgcal::EGammaPCAHelper::eigenValues
const TVectorD & eigenValues() const
Definition: EgammaPCAHelper.h:66
hgcal::EGammaPCAHelper::setdEdXWeights
void setdEdXWeights(const std::vector< double > &dEdX)
Definition: EgammaPCAHelper.h:51
hgcal
Definition: EgammaPCAHelper.h:31
hgcal::EGammaPCAHelper::recHitTools_
const hgcal::RecHitTools * recHitTools_
Definition: EgammaPCAHelper.h:102
hgcal::EGammaPCAHelper::sigv_
double sigv_
Definition: EgammaPCAHelper.h:98
HGCalRecHit_cfi.HGCalRecHit
HGCalRecHit
Definition: HGCalRecHit_cfi.py:71
Point
math::XYZPoint Point
Definition: TrackerDpgAnalysis.cc:106
photonIsolationHIProducer_cfi.hf
hf
Definition: photonIsolationHIProducer_cfi.py:9
HGCalRecHit_cfi.dEdX
dEdX
Definition: HGCalRecHit_cfi.py:5
hgcal::EGammaPCAHelper
Definition: EgammaPCAHelper.h:33
reco::CaloCluster
Definition: CaloCluster.h:31
ShowerDepth.h
hgcal::EGammaPCAHelper::setHitMap
void setHitMap(const std::unordered_map< DetId, const HGCRecHit * > *hitMap)
to set once per event
Definition: EgammaPCAHelper.cc:27
Spot.h
hgcal::EGammaPCAHelper::checkIteration
bool checkIteration() const
Definition: EgammaPCAHelper.cc:215
hgcal::EGammaPCAHelper::storeRecHits
void storeRecHits(const reco::CaloCluster &theCluster)
Definition: EgammaPCAHelper.cc:47
HGCRecHitCollections.h
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
hgcal::EGammaPCAHelper::debug_
bool debug_
Definition: EgammaPCAHelper.h:81
hgcal::EGammaPCAHelper::sigp_
double sigp_
Definition: EgammaPCAHelper.h:98
hgcal::EGammaPCAHelper::maxlayer_
unsigned int maxlayer_
Definition: EgammaPCAHelper.h:91
hgcal::LongDeps
Definition: LongDeps.h:14
hgcal::EGammaPCAHelper::axis
const math::XYZVector & axis() const
Definition: EgammaPCAHelper.h:57
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
hgcal::EGammaPCAHelper::findZFirstLayer
float findZFirstLayer(const LongDeps &) const
Definition: EgammaPCAHelper.cc:295
hgcal::EGammaPCAHelper::Point
ROOT::Math::Transform3D::Point Point
Definition: EgammaPCAHelper.h:36
hgcal::EGammaPCAHelper::clear
void clear()
Definition: EgammaPCAHelper.cc:232
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
hgcal::EGammaPCAHelper::Transform3D
ROOT::Math::Transform3D Transform3D
Definition: EgammaPCAHelper.h:35
hgcal::EGammaPCAHelper::sigmaPP
double sigmaPP() const
Definition: EgammaPCAHelper.h:64
hgcal::EGammaPCAHelper::computeShowerWidth
void computeShowerWidth(float radius, bool withHalo=true)
Definition: EgammaPCAHelper.cc:173
hgcal::EGammaPCAHelper::sigmaUU
double sigmaUU() const
Definition: EgammaPCAHelper.h:61
reco::HGCalMultiCluster
Definition: HGCalMultiCluster.h:12
hgcal::EGammaPCAHelper::computePCA
void computePCA(float radius, bool withHalo=true)
Definition: EgammaPCAHelper.cc:106
HGCalDetId.h
hgcal::EGammaPCAHelper::EGammaPCAHelper
EGammaPCAHelper()
Definition: EgammaPCAHelper.cc:17
Frameworkfwd.h
hgcal::ShowerDepth
Definition: ShowerDepth.h:27
hgcal::EGammaPCAHelper::invThicknessCorrection_
std::vector< double > invThicknessCorrection_
Definition: EgammaPCAHelper.h:85
hgcal::EGammaPCAHelper::theSpots_
std::vector< Spot > theSpots_
Definition: EgammaPCAHelper.h:89
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
hgcal::EGammaPCAHelper::pcaIteration_
int pcaIteration_
Definition: EgammaPCAHelper.h:90
hgcal::EGammaPCAHelper::trans_
Transform3D trans_
Definition: EgammaPCAHelper.h:97
hgcal::EGammaPCAHelper::sigmaVV
double sigmaVV() const
Definition: EgammaPCAHelper.h:62
hgcal::EGammaPCAHelper::energyPerLayer
LongDeps energyPerLayer(float radius, bool withHalo=true)
Definition: EgammaPCAHelper.cc:241
hgcal::EGammaPCAHelper::getHitMap
const std::unordered_map< DetId, const HGCRecHit * > * getHitMap()
Definition: EgammaPCAHelper.h:47
hgcal::EGammaPCAHelper::barycenter
const math::XYZPoint & barycenter() const
Definition: EgammaPCAHelper.h:56
hgcal::EGammaPCAHelper::pca_
std::unique_ptr< TPrincipal > pca_
Definition: EgammaPCAHelper.h:101
Vector3D.h
hgcal::EGammaPCAHelper::sigu_
double sigu_
Definition: EgammaPCAHelper.h:98
CaloCluster.h
hgcal::EGammaPCAHelper::showerDepth_
ShowerDepth showerDepth_
Definition: EgammaPCAHelper.h:103
hgcal::EGammaPCAHelper::hitMap_
const std::unordered_map< DetId, const HGCRecHit * > * hitMap_
Definition: EgammaPCAHelper.h:88