CMS 3D CMS Logo

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 maxSubClusDRDEta() const
float sigmaIPhiIPhi() const
float scRawEnergy() const
float seedCrysPhiOrY() const
float maxSubClusDRDPhi() const
float seedCrysIPhiOrIY() const
int scNrAdditionalClusters() const
void fill(const reco::SuperCluster &superClus, const EcalRecHitCollection *ebRecHits, const EcalRecHitCollection *eeRecHits, const CaloGeometry *geom, const CaloTopology *topology, const reco::VertexCollection *vertices)
float maxSubClusDRRawEnergy() const
void fillVecEB_(std::vector< float > &inputVec) const
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
float seedLeftRightAsym() const
float seedCrysEtaOrX() const
float scCalibEnergy() const
float subClusRawEnergyOverSCRawEnergy(SubClusNr clusNr) const
float e2ndOverSCRawEnergy() const
float subClusDEta(SubClusNr clusNr) const
float seedCrysIEtaOrIX() const
float scPhiWidth() const
float maxSubClusDRRawEnergyOverSCRawEnergy() const
const std::vector< float > & subClusDEta() const
std::vector< float > subClusDPhi_
const std::vector< float > & subClusDPhi() const
T sqrt(T t)
Definition: SSEVec.h:19
std::vector< float > subClusRawEnergy_
float scPreShowerEnergyOverSCRawEnergy() const
float divideBySCRawEnergy_(float numer) const
void fillVec(std::vector< float > &inputVec) const
float scEtaWidth() const
float sigmaIEtaIEta() const
std::vector< float > subClusDEta_
float sigmaIEtaIPhi() const
float subClusRawEnergyOverSCRawEnergy(size_t clusNr) const
void fillVecEE_(std::vector< float > &inputVec) const
float maxSubClusDR() const
float subClusRawEnergy(SubClusNr clusNr) const
fixed size matrix
float subClusDPhi(SubClusNr clusNr) const
float eMaxOverSCRawEnergy() const
float seedClusEnergy() const
float scSeedR9() const
const std::vector< float > & subClusRawEnergy() const
float scPreShowerEnergy() const
float seedTopBottomAsym() const
float seedClusEnergyOverSCRawEnergy() const