CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EcalRegressionData.h
Go to the documentation of this file.
1 #ifndef EgammaElectronAlgos_EcalRegressionData_h
2 #define EgammaElectronAlgos_EcalRegressionData_h
3 
7 #include <vector>
8 #include <cmath>
9 
10 class CaloGeometry;
11 class CaloTopology;
12 
13 namespace reco {
14  class SuperCluster;
15 }
16 
18 public:
20 
21  //this exists due to concerns that sub-cluster 1 is actually accessed
22  //by subClusRawE_[0] and could potentially cause bugs
23  //this although slightly wordy, makes it absolutely clear
24  enum class SubClusNr { C1 = 0, C2 = 1, C3 = 2 };
25 
26  //direct accessors
27  bool isEB() const { return isEB_; }
28  float scRawEnergy() const { return scRawEnergy_; }
29  float scCalibEnergy() const { return scCalibEnergy_; }
30  float scPreShowerEnergy() const { return scPreShowerEnergy_; }
31  float scEta() const { return scEta_; }
32  float scPhi() const { return scPhi_; }
33  float scEtaWidth() const { return scEtaWidth_; }
34  float scPhiWidth() const { return scPhiWidth_; }
36  float seedClusEnergy() const { return seedClusEnergy_; }
37  float eMax() const { return eMax_; }
38  float e2nd() const { return e2nd_; }
39  float e3x3() const { return e3x3_; }
40  float eTop() const { return eTop_; }
41  float eBottom() const { return eBottom_; }
42  float eLeft() const { return eLeft_; }
43  float eRight() const { return eRight_; }
44  float sigmaIEtaIEta() const { return sigmaIEtaIEta_; }
45  float sigmaIEtaIPhi() const { return sigmaIEtaIPhi_; }
46  float sigmaIPhiIPhi() const { return sigmaIPhiIPhi_; }
47 
48  float seedCrysPhiOrY() const { return seedCrysPhiOrY_; }
49  float seedCrysEtaOrX() const { return seedCrysEtaOrX_; }
50  float seedCrysIEtaOrIX() const { return seedCrysIEtaOrIX_; }
51  float seedCrysIPhiOrIY() const { return seedCrysIPhiOrIY_; }
52  float maxSubClusDR() const { return std::sqrt(maxSubClusDR2_); }
53  float maxSubClusDRDPhi() const { return maxSubClusDRDPhi_; }
54  float maxSubClusDRDEta() const { return maxSubClusDRDEta_; }
56  const std::vector<float>& subClusRawEnergy() const { return subClusRawEnergy_; }
57  const std::vector<float>& subClusDPhi() const { return subClusDPhi_; }
58  const std::vector<float>& subClusDEta() const { return subClusDEta_; }
59  int nrVtx() const { return nrVtx_; }
60 
61  //indirect accessors
63  float scSeedR9() const { return divideBySCRawEnergy_(e3x3()); }
65  float eMaxOverSCRawEnergy() const { return divideBySCRawEnergy_(eMax()); }
66  float e2ndOverSCRawEnergy() const { return divideBySCRawEnergy_(e2nd()); }
67  float seedLeftRightAsym() const;
68  float seedTopBottomAsym() const;
70  float subClusRawEnergyOverSCRawEnergy(size_t clusNr) const { return divideBySCRawEnergy_(subClusRawEnergy(clusNr)); }
71  float subClusRawEnergy(size_t clusNr) const;
72  float subClusDPhi(size_t clusNr) const;
73  float subClusDEta(size_t clusNr) const;
75  return subClusRawEnergyOverSCRawEnergy(static_cast<int>(clusNr));
76  }
77  float subClusRawEnergy(SubClusNr clusNr) const { return subClusRawEnergy(static_cast<int>(clusNr)); }
78  float subClusDPhi(SubClusNr clusNr) const { return subClusDPhi(static_cast<int>(clusNr)); }
79  float subClusDEta(SubClusNr clusNr) const { return subClusDEta(static_cast<int>(clusNr)); }
80 
81  //modifiers
82  void fill(const reco::SuperCluster& superClus,
83  const EcalRecHitCollection* ebRecHits,
84  const EcalRecHitCollection* eeRecHits,
85  const CaloGeometry* geom,
86  const CaloTopology* topology,
88  fill(superClus, ebRecHits, eeRecHits, geom, topology, vertices->size());
89  }
90  void fill(const reco::SuperCluster& superClus,
91  const EcalRecHitCollection* ebRecHits,
92  const EcalRecHitCollection* eeRecHits,
93  const CaloGeometry* geom,
94  const CaloTopology* topology,
95  int nrVertices);
96  void clear();
97 
98  //converts output to single vector for use in training
99  void fillVec(std::vector<float>& inputVec) const;
100 
101 private:
102  //0 is obviously not a sensible energy for a supercluster so just return zero if this is the case
103  float divideBySCRawEnergy_(float numer) const { return scRawEnergy() != 0 ? numer / scRawEnergy() : 0.; }
104  void fillVecEB_(std::vector<float>& inputVec) const;
105  void fillVecEE_(std::vector<float>& inputVec) const;
106 
107 private:
108  bool isEB_;
109 
110  //supercluster quantities
114  float scEta_;
115  float scPhi_;
116  float scEtaWidth_;
117  float scPhiWidth_;
118  int scNrAdditionalClusters_; //excludes seed cluster
119 
120  //seed cluster quantities
122  float eMax_;
123  float e2nd_;
124  float e3x3_;
125  float eTop_;
126  float eBottom_;
127  float eLeft_;
128  float eRight_;
132 
133  //seed crystal quantities
138 
139  //sub cluster (non-seed) quantities
144  std::vector<float> subClusRawEnergy_;
145  std::vector<float> subClusDPhi_;
146  std::vector<float> subClusDEta_;
147 
148  //event quantities
149  int nrVtx_;
150 };
151 
152 #endif
float sigmaIPhiIPhi() const
const std::vector< float > & subClusRawEnergy() const
float e2ndOverSCRawEnergy() const
float divideBySCRawEnergy_(float numer) const
float maxSubClusDRRawEnergy() const
float maxSubClusDRDEta() const
float scEtaWidth() const
float subClusRawEnergyOverSCRawEnergy(SubClusNr clusNr) const
void fill(const reco::SuperCluster &superClus, const EcalRecHitCollection *ebRecHits, const EcalRecHitCollection *eeRecHits, const CaloGeometry *geom, const CaloTopology *topology, const reco::VertexCollection *vertices)
int scNrAdditionalClusters() const
float eLeft() const
float seedCrysPhiOrY() const
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
float sigmaIEtaIEta() const
float sigmaIEtaIPhi() const
float scSeedR9() const
float subClusRawEnergyOverSCRawEnergy(size_t clusNr) const
float scPreShowerEnergy() const
float seedClusEnergyOverSCRawEnergy() const
std::vector< float > subClusDPhi_
float subClusDPhi(SubClusNr clusNr) const
float scPhi() const
float seedCrysIPhiOrIY() const
T sqrt(T t)
Definition: SSEVec.h:19
float maxSubClusDR() const
float seedCrysIEtaOrIX() const
std::vector< float > subClusRawEnergy_
float maxSubClusDRDPhi() const
void fillVec(std::vector< float > &inputVec) const
float scPhiWidth() const
float scPreShowerEnergyOverSCRawEnergy() const
float seedLeftRightAsym() const
float seedCrysEtaOrX() const
std::vector< float > subClusDEta_
float seedClusEnergy() const
float subClusRawEnergy(SubClusNr clusNr) const
float eMaxOverSCRawEnergy() const
float maxSubClusDRRawEnergyOverSCRawEnergy() const
float scRawEnergy() const
const std::vector< float > & subClusDEta() const
float scEta() const
const std::vector< float > & subClusDPhi() const
float seedTopBottomAsym() const
float eRight() const
void fillVecEB_(std::vector< float > &inputVec) const
float subClusDEta(SubClusNr clusNr) const
float scCalibEnergy() const
void fillVecEE_(std::vector< float > &inputVec) const
float eBottom() const