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{
25  C1=0,
26  C2=1,
27  C3=2
28  };
29 
30  //direct accessors
31  bool isEB()const{return isEB_;}
32  float scRawEnergy()const{return scRawEnergy_;}
33  float scCalibEnergy()const{return scCalibEnergy_;}
34  float scPreShowerEnergy()const{return scPreShowerEnergy_;}
35  float scEta()const{return scEta_;}
36  float scPhi()const{return scPhi_;}
37  float scEtaWidth()const{return scEtaWidth_;}
38  float scPhiWidth()const{return scPhiWidth_;}
39  int scNrAdditionalClusters()const{return scNrAdditionalClusters_;}
40  float seedClusEnergy()const{return seedClusEnergy_;}
41  float eMax()const{return eMax_;}
42  float e2nd()const{return e2nd_;}
43  float e3x3()const{return e3x3_;}
44  float eTop()const{return eTop_;}
45  float eBottom()const{return eBottom_;}
46  float eLeft()const{return eLeft_;}
47  float eRight()const{return eRight_;}
48  float sigmaIEtaIEta()const{return sigmaIEtaIEta_;}
49  float sigmaIEtaIPhi()const{return sigmaIEtaIPhi_;}
50  float sigmaIPhiIPhi()const{return sigmaIPhiIPhi_;}
51 
52  float seedCrysPhiOrY()const{return seedCrysPhiOrY_;}
53  float seedCrysEtaOrX()const{return seedCrysEtaOrX_;}
54  float seedCrysIEtaOrIX()const{return seedCrysIEtaOrIX_;}
55  float seedCrysIPhiOrIY()const{return seedCrysIPhiOrIY_;}
56  float maxSubClusDR()const{return std::sqrt(maxSubClusDR2_);}
57  float maxSubClusDRDPhi()const{return maxSubClusDRDPhi_;}
58  float maxSubClusDRDEta()const{return maxSubClusDRDEta_;}
59  float maxSubClusDRRawEnergy()const{return maxSubClusDRRawEnergy_;}
60  const std::vector<float>& subClusRawEnergy()const{return subClusRawEnergy_;}
61  const std::vector<float>& subClusDPhi()const{return subClusDPhi_;}
62  const std::vector<float>& subClusDEta()const{return subClusDEta_;}
63  int nrVtx()const{return nrVtx_;}
64 
65  //indirect accessors
66  float scPreShowerEnergyOverSCRawEnergy()const{return divideBySCRawEnergy_(scPreShowerEnergy());}
67  float scSeedR9()const{return divideBySCRawEnergy_(e3x3());}
68  float seedClusEnergyOverSCRawEnergy()const{return divideBySCRawEnergy_(seedClusEnergy());}
69  float eMaxOverSCRawEnergy()const{return divideBySCRawEnergy_(eMax());}
70  float e2ndOverSCRawEnergy()const{return divideBySCRawEnergy_(e2nd());}
71  float seedLeftRightAsym()const;
72  float seedTopBottomAsym()const;
73  float maxSubClusDRRawEnergyOverSCRawEnergy()const{return divideBySCRawEnergy_(maxSubClusDRRawEnergy());}
74  float subClusRawEnergyOverSCRawEnergy(size_t clusNr)const{return divideBySCRawEnergy_(subClusRawEnergy(clusNr));}
75  float subClusRawEnergy(size_t clusNr)const;
76  float subClusDPhi(size_t clusNr)const;
77  float subClusDEta(size_t clusNr)const;
78  float subClusRawEnergyOverSCRawEnergy(SubClusNr clusNr)const{return subClusRawEnergyOverSCRawEnergy(static_cast<int>(clusNr));}
79  float subClusRawEnergy(SubClusNr clusNr)const{return subClusRawEnergy(static_cast<int>(clusNr));}
80  float subClusDPhi(SubClusNr clusNr)const{return subClusDPhi(static_cast<int>(clusNr));}
81  float subClusDEta(SubClusNr clusNr)const{return subClusDEta(static_cast<int>(clusNr));}
82 
83 
84  //modifiers
85  void fill(const reco::SuperCluster& superClus,
86  const EcalRecHitCollection* ebRecHits,const EcalRecHitCollection* eeRecHits,
87  const CaloGeometry* geom,const CaloTopology* topology,
89  fill(superClus,ebRecHits,eeRecHits,geom,topology,vertices->size());
90  }
91  void fill(const reco::SuperCluster& superClus,
92  const EcalRecHitCollection* ebRecHits,const EcalRecHitCollection* eeRecHits,
93  const CaloGeometry* geom,const CaloTopology* topology,
94  int nrVertices);
95  void clear();
96 
97  //converts output to single vector for use in training
98  void fillVec(std::vector<float>& inputVec)const;
99 
100 private:
101  //0 is obviously not a sensible energy for a supercluster so just return zero if this is the case
102  float divideBySCRawEnergy_(float numer)const{return scRawEnergy()!=0 ? numer/scRawEnergy() : 0.;}
103  void fillVecEB_(std::vector<float>& inputVec)const;
104  void fillVecEE_(std::vector<float>& inputVec)const;
105 
106 private:
107  bool isEB_;
108 
109  //supercluster quantities
113  float scEta_;
114  float scPhi_;
115  float scEtaWidth_;
116  float scPhiWidth_;
117  int scNrAdditionalClusters_; //excludes seed cluster
118 
119  //seed cluster quantities
121  float eMax_;
122  float e2nd_;
123  float e3x3_;
124  float eTop_;
125  float eBottom_;
126  float eLeft_;
127  float eRight_;
131 
132  //seed crystal quantities
137 
138  //sub cluster (non-seed) quantities
143  std::vector<float> subClusRawEnergy_;
144  std::vector<float> subClusDPhi_;
145  std::vector<float> subClusDEta_;
146 
147  //event quantities
148  int nrVtx_;
149 
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
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