CMS 3D CMS Logo

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