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 <map>
26 
27 #include "TPrincipal.h"
28 
29 class HGCalRecHit;
30 
31 namespace hgcal {
32 
34  public:
35  typedef ROOT::Math::Transform3D Transform3D;
37 
40 
41  // for the GsfElectrons
42  void storeRecHits(const reco::CaloCluster &theCluster);
43  void storeRecHits(const reco::HGCalMultiCluster &cluster);
44 
45  const TPrincipal &pcaResult();
47  void setHitMap(std::map<DetId, const HGCRecHit *> *hitMap);
49  void fillHitMap(const HGCRecHitCollection &HGCEERecHits,
50  const HGCRecHitCollection &HGCFHRecHits,
51  const HGCRecHitCollection &HGCBHRecHits);
52 
53  std::map<DetId, const HGCRecHit *> *getHitMap() { return hitMap_; }
54 
55  void setRecHitTools(const hgcal::RecHitTools *recHitTools);
56 
57  inline void setdEdXWeights(const std::vector<double> &dEdX) { dEdXWeights_ = dEdX; }
58 
59  void pcaInitialComputation() { computePCA(-1., false); }
60 
61  void computePCA(float radius, bool withHalo = true);
62  const math::XYZPoint &barycenter() const { return barycenter_; }
63  const math::XYZVector &axis() const { return axis_; }
64 
65  void computeShowerWidth(float radius, bool withHalo = true);
66 
67  inline double sigmaUU() const { return checkIteration() ? sigu_ : -1.; }
68  inline double sigmaVV() const { return checkIteration() ? sigv_ : -1.; }
69  inline double sigmaEE() const { return checkIteration() ? sige_ : -1.; }
70  inline double sigmaPP() const { return checkIteration() ? sigp_ : -1.; }
71 
72  inline const TVectorD &eigenValues() const { return *pca_->GetEigenValues(); }
73  inline const TVectorD &sigmas() const { return *pca_->GetSigmas(); }
74  // contains maxlayer+1 values, first layer is [1]
75  LongDeps energyPerLayer(float radius, bool withHalo = true);
76 
77  float clusterDepthCompatibility(const LongDeps &, float &measuredDepth, float &expectedDepth, float &expectedSigma);
78  void printHits(float radius) const;
79  void clear();
80 
81  private:
82  bool checkIteration() const;
83  void storeRecHits(const std::vector<std::pair<DetId, float>> &hf);
84  float findZFirstLayer(const LongDeps &) const;
85 
87  bool debug_;
88 
89  //parameters
90  std::vector<double> dEdXWeights_;
91  std::vector<double> invThicknessCorrection_;
92 
93  int hitMapOrigin_; // 0 not initialized; 1 set from outside ; 2 set from inside
95  std::map<DetId, const HGCRecHit *> *hitMap_;
96  std::vector<Spot> theSpots_;
98  unsigned int maxlayer_;
99 
100  // output quantities
103 
105  double sigu_, sigv_, sige_, sigp_;
106 
107  // helper
108  std::unique_ptr<TPrincipal> pca_;
111  };
112 
113 } // namespace hgcal
114 
115 #endif
hgcal::EGammaPCAHelper::clusterDepthCompatibility
float clusterDepthCompatibility(const LongDeps &, float &measuredDepth, float &expectedDepth, float &expectedSigma)
Definition: EgammaPCAHelper.cc:333
hgcal::EGammaPCAHelper::barycenter_
math::XYZPoint barycenter_
Definition: EgammaPCAHelper.h:101
hgcal::RecHitTools
Definition: RecHitTools.h:21
hgcal::EGammaPCAHelper::sige_
double sige_
Definition: EgammaPCAHelper.h:105
hgcal::EGammaPCAHelper::fillHitMap
void fillHitMap(const HGCRecHitCollection &HGCEERecHits, const HGCRecHitCollection &HGCFHRecHits, const HGCRecHitCollection &HGCBHRecHits)
to compute from inside - once per event
Definition: EgammaPCAHelper.cc:43
hgcal::EGammaPCAHelper::sigmas
const TVectorD & sigmas() const
Definition: EgammaPCAHelper.h:73
hgcal::EGammaPCAHelper::recHitsStored_
bool recHitsStored_
Definition: EgammaPCAHelper.h:86
hgcal::EGammaPCAHelper::theCluster_
const reco::CaloCluster * theCluster_
Definition: EgammaPCAHelper.h:94
hgcal::EGammaPCAHelper::printHits
void printHits(float radius) const
Definition: EgammaPCAHelper.cc:307
HGCalMultiCluster.h
hgcal::EGammaPCAHelper::sigmaEE
double sigmaEE() const
Definition: EgammaPCAHelper.h:69
hgcal::EGammaPCAHelper::setRecHitTools
void setRecHitTools(const hgcal::RecHitTools *recHitTools)
Definition: EgammaPCAHelper.cc:38
edm::SortedCollection
Definition: SortedCollection.h:49
LongDeps.h
hgcal::EGammaPCAHelper::pcaInitialComputation
void pcaInitialComputation()
Definition: EgammaPCAHelper.h:59
hgcal::EGammaPCAHelper::axis_
math::XYZVector axis_
Definition: EgammaPCAHelper.h:102
hgcal::EGammaPCAHelper::getHitMap
std::map< DetId, const HGCRecHit * > * getHitMap()
Definition: EgammaPCAHelper.h:53
hgcal::EGammaPCAHelper::dEdXWeights_
std::vector< double > dEdXWeights_
Definition: EgammaPCAHelper.h:90
hgcal::EGammaPCAHelper::pcaResult
const TPrincipal & pcaResult()
hgcal::EGammaPCAHelper::eigenValues
const TVectorD & eigenValues() const
Definition: EgammaPCAHelper.h:72
hgcal::EGammaPCAHelper::setdEdXWeights
void setdEdXWeights(const std::vector< double > &dEdX)
Definition: EgammaPCAHelper.h:57
hgcal
Definition: EgammaPCAHelper.h:31
hgcal::EGammaPCAHelper::recHitTools_
const hgcal::RecHitTools * recHitTools_
Definition: EgammaPCAHelper.h:109
hgcal::EGammaPCAHelper::sigv_
double sigv_
Definition: EgammaPCAHelper.h:105
HGCalRecHit_cfi.HGCalRecHit
HGCalRecHit
Definition: HGCalRecHit_cfi.py:186
Point
math::XYZPoint Point
Definition: TrackerDpgAnalysis.cc:107
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
Spot.h
hgcal::EGammaPCAHelper::hitMap_
std::map< DetId, const HGCRecHit * > * hitMap_
Definition: EgammaPCAHelper.h:95
hgcal::EGammaPCAHelper::checkIteration
bool checkIteration() const
Definition: EgammaPCAHelper.cc:241
hgcal::EGammaPCAHelper::storeRecHits
void storeRecHits(const reco::CaloCluster &theCluster)
Definition: EgammaPCAHelper.cc:73
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:87
hgcal::EGammaPCAHelper::sigp_
double sigp_
Definition: EgammaPCAHelper.h:105
hgcal::EGammaPCAHelper::maxlayer_
unsigned int maxlayer_
Definition: EgammaPCAHelper.h:98
hgcal::LongDeps
Definition: LongDeps.h:14
hgcal::EGammaPCAHelper::axis
const math::XYZVector & axis() const
Definition: EgammaPCAHelper.h:63
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:321
hgcal::EGammaPCAHelper::hitMapOrigin_
int hitMapOrigin_
Definition: EgammaPCAHelper.h:93
hgcal::EGammaPCAHelper::Point
ROOT::Math::Transform3D::Point Point
Definition: EgammaPCAHelper.h:36
hgcal::EGammaPCAHelper::clear
void clear()
Definition: EgammaPCAHelper.cc:258
hgcal::EGammaPCAHelper::Transform3D
ROOT::Math::Transform3D Transform3D
Definition: EgammaPCAHelper.h:35
hgcal::EGammaPCAHelper::sigmaPP
double sigmaPP() const
Definition: EgammaPCAHelper.h:70
hgcal::EGammaPCAHelper::computeShowerWidth
void computeShowerWidth(float radius, bool withHalo=true)
Definition: EgammaPCAHelper.cc:199
hgcal::EGammaPCAHelper::sigmaUU
double sigmaUU() const
Definition: EgammaPCAHelper.h:67
reco::HGCalMultiCluster
Definition: HGCalMultiCluster.h:12
hgcal::EGammaPCAHelper::computePCA
void computePCA(float radius, bool withHalo=true)
Definition: EgammaPCAHelper.cc:132
HGCalDetId.h
hgcal::EGammaPCAHelper::EGammaPCAHelper
EGammaPCAHelper()
Definition: EgammaPCAHelper.cc:16
Frameworkfwd.h
hgcal::ShowerDepth
Definition: ShowerDepth.h:27
hgcal::EGammaPCAHelper::setHitMap
void setHitMap(std::map< DetId, const HGCRecHit * > *hitMap)
to set from outside - once per event
Definition: EgammaPCAHelper.cc:32
hgcal::EGammaPCAHelper::invThicknessCorrection_
std::vector< double > invThicknessCorrection_
Definition: EgammaPCAHelper.h:91
hgcal::EGammaPCAHelper::theSpots_
std::vector< Spot > theSpots_
Definition: EgammaPCAHelper.h:96
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
hgcal::EGammaPCAHelper::pcaIteration_
int pcaIteration_
Definition: EgammaPCAHelper.h:97
hgcal::EGammaPCAHelper::trans_
Transform3D trans_
Definition: EgammaPCAHelper.h:104
hgcal::EGammaPCAHelper::sigmaVV
double sigmaVV() const
Definition: EgammaPCAHelper.h:68
hgcal::EGammaPCAHelper::energyPerLayer
LongDeps energyPerLayer(float radius, bool withHalo=true)
Definition: EgammaPCAHelper.cc:267
hgcal::EGammaPCAHelper::barycenter
const math::XYZPoint & barycenter() const
Definition: EgammaPCAHelper.h:62
hgcal::EGammaPCAHelper::pca_
std::unique_ptr< TPrincipal > pca_
Definition: EgammaPCAHelper.h:108
Vector3D.h
hgcal::EGammaPCAHelper::sigu_
double sigu_
Definition: EgammaPCAHelper.h:105
hgcal::EGammaPCAHelper::~EGammaPCAHelper
~EGammaPCAHelper()
Definition: EgammaPCAHelper.cc:27
RecHitTools.h
CaloCluster.h
hgcal::EGammaPCAHelper::showerDepth_
ShowerDepth showerDepth_
Definition: EgammaPCAHelper.h:110