CMS 3D CMS Logo

HGCalShowerShapeHelper.h
Go to the documentation of this file.
1 #ifndef RecoEgamma_EgammaTools_HGCalShowerShapeHelper_h
2 #define RecoEgamma_EgammaTools_HGCalShowerShapeHelper_h
3 
4 // system include files
5 #include <algorithm>
6 #include <cstdlib>
7 #include <iostream>
8 #include <map>
9 #include <memory>
10 #include <string>
11 #include <utility>
12 #include <vector>
13 
14 // external include files
15 #include <CLHEP/Vector/LorentzVector.h>
16 #include <Math/Point3D.h>
17 #include <Math/Point3Dfwd.h>
18 #include <TMatrixD.h>
19 #include <TVectorD.h>
20 
21 // CMSSW include files
45 
47  // Good to filter/compute/store this stuff beforehand as they are common to the shower shape variables.
48  // No point in filtering, computing layer-wise centroids, etc. for each variable again and again.
49  // Once intitialized, one can the calculate different variables one after another for a given object.
50  // If a different set of preselections (E, ET, etc.) is required for a given object, then reinitialize using initPerObject(...).
51 
52  // In principle should consider the HGCalHSi and HGCalHSc hits (leakage) also.
53  // Can have subdetector dependent thresholds and layer selection.
54  // To be implemented.
55 
56 public:
57  static const double kLDWaferCellSize_;
58  static const double kHDWaferCellSize_;
59 
60  void setLayerWiseInfo();
61 
62  struct ShowerWidths {
63  double sigma2xx;
64  double sigma2yy;
65  double sigma2zz;
66 
67  double sigma2xy;
68  double sigma2yz;
69  double sigma2zx;
70 
71  double sigma2uu;
72  double sigma2vv;
73  double sigma2ww;
74 
76  : sigma2xx(0.0),
77  sigma2yy(0.0),
78  sigma2zz(0.0),
79  sigma2xy(0.0),
80  sigma2yz(0.0),
81  sigma2zx(0.0),
82  sigma2uu(0.0),
83  sigma2vv(0.0),
84  sigma2ww(0.0) {}
85  };
86 
88 
89  void initPerEvent(const edm::EventSetup &iSetup, const std::vector<reco::PFRecHit> &recHits);
90 
91  void initPerObject(const std::vector<std::pair<DetId, float> > &hitsAndFracs,
92  double minHitE = 0,
93  double minHitET = 0,
94  int minLayer = 1,
95  int maxLayer = -1,
97 
98  const double getCellSize(DetId detId);
99 
100  // Compute Rvar in a cylinder around the layer centroids
101  const double getRvar(double cylinderR, double energyNorm, bool useFractions = true, bool useCellSize = true);
102 
103  // Compute PCA widths around the layer centroids
104  const ShowerWidths getPCAWidths(double cylinderR, bool useFractions = false);
105 
106 private:
107  void setPFRecHitPtrMap(const std::vector<reco::PFRecHit> &recHits);
108  void setFilteredHitsAndFractions(const std::vector<std::pair<DetId, float> > &hitsAndFracs);
109 
110  double minHitE_;
111  double minHitET_;
112  double minHitET2_;
115  int nLayer_;
117 
120 
121  std::unordered_map<uint32_t, const reco::PFRecHit *> pfRecHitPtrMap_;
122  std::vector<std::pair<DetId, float> > hitsAndFracs_;
123  std::vector<double> hitEnergies_;
124  std::vector<double> hitEnergiesWithFracs_;
125 
127  std::vector<double> layerEnergies_;
128  std::vector<ROOT::Math::XYZVector> layerCentroids_;
129 };
130 
131 #endif
HGCEEDetId.h
HGCalShowerShapeHelper::setFilteredHitsAndFractions
void setFilteredHitsAndFractions(const std::vector< std::pair< DetId, float > > &hitsAndFracs)
Definition: HGCalShowerShapeHelper.cc:46
hgcal::RecHitTools
Definition: RecHitTools.h:23
InitialClusteringStepBase.h
HGCalShowerShapeHelper::nLayer_
int nLayer_
Definition: HGCalShowerShapeHelper.h:115
ESHandle.h
HGCalShowerShapeHelper::ShowerWidths::sigma2yy
double sigma2yy
Definition: HGCalShowerShapeHelper.h:64
HGCalShowerShapeHelper::ShowerWidths::sigma2uu
double sigma2uu
Definition: HGCalShowerShapeHelper.h:71
EDProducer.h
HGCalShowerShapeHelper::caloGeometryToken_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
Definition: HGCalShowerShapeHelper.h:118
HGCalShowerShapeHelper::initPerEvent
void initPerEvent(const edm::EventSetup &iSetup, const std::vector< reco::PFRecHit > &recHits)
Definition: HGCalShowerShapeHelper.cc:9
HGCalShowerShapeHelper::minHitET_
double minHitET_
Definition: HGCalShowerShapeHelper.h:111
HGCalShowerShapeHelper::centroid_
ROOT::Math::XYZVector centroid_
Definition: HGCalShowerShapeHelper.h:126
PFRecHit.h
HGCalShowerShapeHelper::setPFRecHitPtrMap
void setPFRecHitPtrMap(const std::vector< reco::PFRecHit > &recHits)
Definition: HGCalShowerShapeHelper.cc:38
DetId
Definition: DetId.h:17
DetId::HGCalEE
Definition: DetId.h:32
MakerMacros.h
Track.h
HGCalShowerShapeHelper::initPerObject
void initPerObject(const std::vector< std::pair< DetId, float > > &hitsAndFracs, double minHitE=0, double minHitET=0, int minLayer=1, int maxLayer=-1, DetId::Detector subDet=DetId::HGCalEE)
Definition: HGCalShowerShapeHelper.cc:14
TrackFwd.h
HGCRecHit.h
HGCalTopology.h
HGCalShowerShapeHelper::ShowerWidths::sigma2vv
double sigma2vv
Definition: HGCalShowerShapeHelper.h:72
HGCalShowerShapeHelper::ShowerWidths::ShowerWidths
ShowerWidths()
Definition: HGCalShowerShapeHelper.h:75
HGCalShowerShapeHelper::ShowerWidths::sigma2zz
double sigma2zz
Definition: HGCalShowerShapeHelper.h:65
HGCalShowerShapeHelper::ShowerWidths
Definition: HGCalShowerShapeHelper.h:62
GsfElectron.h
HGCalShowerShapeHelper::hitEnergies_
std::vector< double > hitEnergies_
Definition: HGCalShowerShapeHelper.h:123
HGCalShowerShapeHelper::ShowerWidths::sigma2yz
double sigma2yz
Definition: HGCalShowerShapeHelper.h:68
HGCalShowerShapeHelper::hitsAndFracs_
std::vector< std::pair< DetId, float > > hitsAndFracs_
Definition: HGCalShowerShapeHelper.h:122
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
HGCalShowerShapeHelper::setLayerWiseInfo
void setLayerWiseInfo()
Definition: HGCalShowerShapeHelper.cc:86
Event.h
HLT_FULL_cff.minLayer
minLayer
Definition: HLT_FULL_cff.py:53045
HGCalShowerShapeHelper::pfRecHitPtrMap_
std::unordered_map< uint32_t, const reco::PFRecHit * > pfRecHitPtrMap_
Definition: HGCalShowerShapeHelper.h:121
HGCalShowerShapeHelper::subDet_
DetId::Detector subDet_
Definition: HGCalShowerShapeHelper.h:116
HGCalShowerShapeHelper::recHitTools_
hgcal::RecHitTools recHitTools_
Definition: HGCalShowerShapeHelper.h:119
HGCalShowerShapeHelper::HGCalShowerShapeHelper
HGCalShowerShapeHelper(edm::ConsumesCollector &&sumes)
Definition: HGCalShowerShapeHelper.cc:6
LorentzVector.h
HGCalShowerShapeHelper::ShowerWidths::sigma2xy
double sigma2xy
Definition: HGCalShowerShapeHelper.h:67
GsfTrack.h
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
IdealGeometryRecord.h
DetId::Detector
Detector
Definition: DetId.h:24
edm::EventSetup
Definition: EventSetup.h:57
HGCalShowerShapeHelper::layerCentroids_
std::vector< ROOT::Math::XYZVector > layerCentroids_
Definition: HGCalShowerShapeHelper.h:128
HGCalShowerShapeHelper::minHitET2_
double minHitET2_
Definition: HGCalShowerShapeHelper.h:112
HGCalShowerShapeHelper::getRvar
const double getRvar(double cylinderR, double energyNorm, bool useFractions=true, bool useCellSize=true)
Definition: HGCalShowerShapeHelper.cc:137
edm::ESGetToken< CaloGeometry, CaloGeometryRecord >
HGCalShowerShapeHelper::ShowerWidths::sigma2ww
double sigma2ww
Definition: HGCalShowerShapeHelper.h:73
PFRecHitFraction.h
HGCalDetId.h
HGCalShowerShapeHelper::layerEnergies_
std::vector< double > layerEnergies_
Definition: HGCalShowerShapeHelper.h:127
HGCalShowerShapeHelper::getPCAWidths
const ShowerWidths getPCAWidths(double cylinderR, bool useFractions=false)
Definition: HGCalShowerShapeHelper.cc:188
Frameworkfwd.h
HGCalShowerShapeHelper::kHDWaferCellSize_
static const double kHDWaferCellSize_
Definition: HGCalShowerShapeHelper.h:58
HGCalShowerShapeHelper::hitEnergiesWithFracs_
std::vector< double > hitEnergiesWithFracs_
Definition: HGCalShowerShapeHelper.h:124
ESHandle.h
ROOT::Math::XYZVector
Transform3DPJ::Vector XYZVector
Definition: Transform3DPJ.cc:34
HGCalShowerShapeHelper::minHitE_
double minHitE_
Definition: HGCalShowerShapeHelper.h:110
HGCalShowerShapeHelper::getCellSize
const double getCellSize(DetId detId)
Definition: HGCalShowerShapeHelper.cc:133
ParameterSet.h
HGCalShowerShapeHelper::maxLayer_
int maxLayer_
Definition: HGCalShowerShapeHelper.h:114
HGCalShowerShapeHelper::ShowerWidths::sigma2zx
double sigma2zx
Definition: HGCalShowerShapeHelper.h:69
HGCalShowerShapeHelper::ShowerWidths::sigma2xx
double sigma2xx
Definition: HGCalShowerShapeHelper.h:63
HGCalShowerShapeHelper::kLDWaferCellSize_
static const double kLDWaferCellSize_
Definition: HGCalShowerShapeHelper.h:57
HGCalShowerShapeHelper
Definition: HGCalShowerShapeHelper.h:46
StreamID.h
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
RecHitTools.h
CaloCluster.h
HGCalShowerShapeHelper::minLayer_
int minLayer_
Definition: HGCalShowerShapeHelper.h:113